Coverage Report

Created: 2026-05-16 09:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/ucbhelper/source/provider/interactionrequest.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <ucbhelper/interactionrequest.hxx>
21
22
#include <rtl/ref.hxx>
23
#include <osl/diagnose.h>
24
#include <cppuhelper/typeprovider.hxx>
25
#include <cppuhelper/queryinterface.hxx>
26
#include <utility>
27
28
using namespace com::sun::star;
29
using namespace ucbhelper;
30
31
32
// InteractionRequest Implementation.
33
34
35
namespace ucbhelper
36
{
37
38
struct InteractionRequest_Impl
39
{
40
    rtl::Reference< InteractionContinuation > m_xSelection;
41
    css::uno::Any m_aRequest;
42
    css::uno::Sequence<
43
        css::uno::Reference<
44
            css::task::XInteractionContinuation > > m_aContinuations;
45
46
0
    InteractionRequest_Impl() {}
47
    explicit InteractionRequest_Impl( uno::Any aRequest )
48
0
    : m_aRequest(std::move( aRequest )) {}
49
};
50
51
}
52
53
54
InteractionRequest::InteractionRequest()
55
0
: m_pImpl( new InteractionRequest_Impl )
56
0
{
57
0
}
58
59
60
InteractionRequest::InteractionRequest( const uno::Any & rRequest )
61
0
: m_pImpl( new InteractionRequest_Impl( rRequest ) )
62
0
{
63
0
}
64
65
66
// virtual
67
InteractionRequest::~InteractionRequest()
68
0
{
69
0
}
70
71
72
void InteractionRequest::setRequest( const uno::Any & rRequest )
73
0
{
74
0
    m_pImpl->m_aRequest = rRequest;
75
0
}
76
77
78
void InteractionRequest::setContinuations(
79
                const uno::Sequence< uno::Reference<
80
                    task::XInteractionContinuation > > & rContinuations )
81
0
{
82
0
    m_pImpl->m_aContinuations = rContinuations;
83
0
}
84
85
86
rtl::Reference< InteractionContinuation > const &
87
InteractionRequest::getSelection() const
88
0
{
89
0
    return m_pImpl->m_xSelection;
90
0
}
91
92
93
void InteractionRequest::setSelection(
94
                const rtl::Reference< InteractionContinuation > & rxSelection )
95
0
{
96
0
    m_pImpl->m_xSelection = rxSelection;
97
0
}
98
99
100
// XInterface methods.
101
102
103
// XInteractionRequest methods.
104
105
106
// virtual
107
uno::Any SAL_CALL InteractionRequest::getRequest()
108
0
{
109
0
    return m_pImpl->m_aRequest;
110
0
}
111
112
113
// virtual
114
uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL
115
InteractionRequest::getContinuations()
116
0
{
117
0
    return m_pImpl->m_aContinuations;
118
0
}
119
120
121
// InteractionContinuation Implementation.
122
123
124
InteractionContinuation::InteractionContinuation(
125
                        InteractionRequest * pRequest )
126
0
: m_pRequest( pRequest )
127
0
{
128
0
}
129
130
131
// virtual
132
InteractionContinuation::~InteractionContinuation()
133
0
{
134
0
}
135
136
137
void InteractionContinuation::recordSelection()
138
0
{
139
0
    m_pRequest->setSelection( this );
140
0
}
141
142
143
// InteractionAbort Implementation.
144
145
146
// XInteractionContinuation methods.
147
148
149
// virtual
150
void SAL_CALL InteractionAbort::select()
151
0
{
152
0
    recordSelection();
153
0
}
154
155
156
// InteractionRetry Implementation.
157
158
159
// XInteractionContinuation methods.
160
161
162
// virtual
163
void SAL_CALL InteractionRetry::select()
164
0
{
165
0
    recordSelection();
166
0
}
167
168
169
// InteractionApprove Implementation.
170
171
172
// XInteractionContinuation methods.
173
174
175
// virtual
176
void SAL_CALL InteractionApprove::select()
177
0
{
178
0
    recordSelection();
179
0
}
180
181
182
// InteractionDisapprove Implementation.
183
184
185
// XInteractionContinuation methods.
186
187
188
// virtual
189
void SAL_CALL InteractionDisapprove::select()
190
0
{
191
0
    recordSelection();
192
0
}
193
194
195
// InteractionSupplyAuthentication Implementation.
196
197
198
// XInteractionContinuation methods.
199
200
201
// virtual
202
void SAL_CALL InteractionSupplyAuthentication::select()
203
0
{
204
0
    recordSelection();
205
0
}
206
207
208
// XInteractionSupplyAuthentication methods.
209
210
211
// virtual
212
sal_Bool SAL_CALL
213
InteractionSupplyAuthentication::canSetRealm()
214
0
{
215
0
    return m_bCanSetRealm;
216
0
}
217
218
219
// virtual
220
void SAL_CALL
221
InteractionSupplyAuthentication::setRealm( const OUString& Realm )
222
0
{
223
0
    OSL_ENSURE( m_bCanSetPassword,
224
0
        "InteractionSupplyAuthentication::setRealm - Not supported!" );
225
226
0
    if ( m_bCanSetRealm )
227
0
        m_aRealm = Realm;
228
0
}
229
230
231
// virtual
232
sal_Bool SAL_CALL
233
InteractionSupplyAuthentication::canSetUserName()
234
0
{
235
0
    return m_bCanSetUserName;
236
0
}
237
238
239
// virtual
240
void SAL_CALL
241
InteractionSupplyAuthentication::setUserName( const OUString& UserName )
242
0
{
243
0
    OSL_ENSURE( m_bCanSetUserName,
244
0
        "InteractionSupplyAuthentication::setUserName - Not supported!" );
245
246
0
    if ( m_bCanSetUserName )
247
0
        m_aUserName = UserName;
248
0
}
249
250
251
// virtual
252
sal_Bool SAL_CALL
253
InteractionSupplyAuthentication::canSetPassword()
254
0
{
255
0
    return m_bCanSetPassword;
256
0
}
257
258
259
// virtual
260
void SAL_CALL
261
InteractionSupplyAuthentication::setPassword( const OUString& Password )
262
0
{
263
0
    OSL_ENSURE( m_bCanSetPassword,
264
0
        "InteractionSupplyAuthentication::setPassword - Not supported!" );
265
266
0
    if ( m_bCanSetPassword )
267
0
        m_aPassword = Password;
268
0
}
269
270
271
// virtual
272
uno::Sequence< ucb::RememberAuthentication > SAL_CALL
273
InteractionSupplyAuthentication::getRememberPasswordModes(
274
                                    ucb::RememberAuthentication& Default )
275
0
{
276
0
    Default = m_eDefaultRememberPasswordMode;
277
0
    return m_aRememberPasswordModes;
278
0
}
279
280
281
// virtual
282
void SAL_CALL
283
InteractionSupplyAuthentication::setRememberPassword(
284
                                    ucb::RememberAuthentication Remember )
285
0
{
286
0
    m_eRememberPasswordMode = Remember;
287
0
}
288
289
290
// virtual
291
sal_Bool SAL_CALL
292
InteractionSupplyAuthentication::canSetAccount()
293
0
{
294
0
    return m_bCanSetAccount;
295
0
}
296
297
298
// virtual
299
void SAL_CALL
300
InteractionSupplyAuthentication::setAccount( const OUString& /*Account*/ )
301
0
{
302
0
    OSL_ENSURE( m_bCanSetAccount,
303
0
        "InteractionSupplyAuthentication::setAccount - Not supported!" );
304
0
}
305
306
307
// virtual
308
uno::Sequence< ucb::RememberAuthentication > SAL_CALL
309
InteractionSupplyAuthentication::getRememberAccountModes(
310
                                    ucb::RememberAuthentication& Default )
311
0
{
312
0
    Default = m_eDefaultRememberAccountMode;
313
0
    return m_aRememberAccountModes;
314
0
}
315
316
317
// virtual
318
void SAL_CALL InteractionSupplyAuthentication::setRememberAccount(
319
                                    ucb::RememberAuthentication )
320
0
{
321
0
}
322
323
324
// XInteractionSupplyAuthentication2 methods.
325
326
327
// virtual
328
sal_Bool SAL_CALL
329
InteractionSupplyAuthentication::canUseSystemCredentials(
330
        sal_Bool& Default )
331
0
{
332
0
    Default = false;
333
0
    return m_bCanUseSystemCredentials;
334
0
}
335
336
337
// virtual
338
void SAL_CALL InteractionSupplyAuthentication::setUseSystemCredentials(
339
        sal_Bool UseSystemCredentials )
340
0
{
341
0
    if ( m_bCanUseSystemCredentials )
342
0
        m_bUseSystemCredentials = UseSystemCredentials;
343
0
}
344
345
346
// InteractionReplaceExistingData Implementation.
347
348
349
// XInteractionContinuation methods.
350
351
352
// virtual
353
void SAL_CALL InteractionReplaceExistingData::select()
354
0
{
355
0
    recordSelection();
356
0
}
357
358
// InteractionAuthFallback Implementation
359
360
// XInteractionContinuation methods.
361
362
// virtual
363
void SAL_CALL InteractionAuthFallback::select()
364
0
{
365
0
    recordSelection();
366
0
}
367
368
// XInteractionAuthFallback methods
369
370
// virtual
371
void SAL_CALL InteractionAuthFallback::setCode( const OUString& code )
372
0
{
373
0
    m_aCode = code;
374
0
}
375
376
const OUString& InteractionAuthFallback::getCode() const
377
0
{
378
0
    return m_aCode;
379
0
}
380
381
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */