Line data Source code
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 : #ifndef INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX
21 : #define INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX
22 :
23 : #include <com/sun/star/lang/XTypeProvider.hpp>
24 : #include <com/sun/star/task/XInteractionRequest.hpp>
25 : #include <com/sun/star/task/XInteractionAbort.hpp>
26 : #include <com/sun/star/task/XInteractionRetry.hpp>
27 : #include <com/sun/star/task/XInteractionApprove.hpp>
28 : #include <com/sun/star/task/XInteractionDisapprove.hpp>
29 : #include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp>
30 : #include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
31 : #include <rtl/ref.hxx>
32 : #include <cppuhelper/weak.hxx>
33 : #include <ucbhelper/ucbhelperdllapi.h>
34 :
35 : namespace ucbhelper {
36 :
37 : class InteractionContinuation;
38 :
39 :
40 : struct InteractionRequest_Impl;
41 :
42 : /**
43 : * This class implements the interface XInteractionRequest. Instances can
44 : * be passed directly to XInteractionHandler::handle(...). Each interaction
45 : * request contains an exception describing the error and a number of
46 : * interaction continuations describing the possible "answers" for the request.
47 : * After the request was passed to XInteractionHandler::handle(...) the method
48 : * getSelection() returns the continuation chosen by the interaction handler.
49 : *
50 : * The typical usage of this class would be:
51 : *
52 : * 1) Create exception object that shall be handled by the interaction handler.
53 : * 2) Create InteractionRequest, supply exception as ctor parameter
54 : * 3) Create continuations needed and add them to a sequence
55 : * 4) Supply the continuations to the InteractionRequest by calling
56 : * setContinuations(...)
57 : *
58 : * This class can also be used as base class for more specialized requests,
59 : * like authentication requests.
60 : */
61 : class UCBHELPER_DLLPUBLIC InteractionRequest : public cppu::OWeakObject,
62 : public com::sun::star::lang::XTypeProvider,
63 : public com::sun::star::task::XInteractionRequest
64 : {
65 : InteractionRequest_Impl * m_pImpl;
66 :
67 : protected:
68 : void setRequest( const com::sun::star::uno::Any & rRequest );
69 :
70 : InteractionRequest();
71 : virtual ~InteractionRequest();
72 :
73 : public:
74 : /**
75 : * Constructor.
76 : *
77 : * @param rRequest is the exception describing the error.
78 : */
79 : InteractionRequest( const com::sun::star::uno::Any & rRequest );
80 :
81 : /**
82 : * This method sets the continuations for the request.
83 : *
84 : * @param rContinuations contains the possible continuations.
85 : */
86 : void setContinuations(
87 : const com::sun::star::uno::Sequence<
88 : com::sun::star::uno::Reference<
89 : com::sun::star::task::XInteractionContinuation > > &
90 : rContinuations );
91 :
92 : // XInterface
93 : virtual com::sun::star::uno::Any SAL_CALL
94 : queryInterface( const com::sun::star::uno::Type & rType )
95 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
96 : virtual void SAL_CALL acquire()
97 : throw() SAL_OVERRIDE;
98 : virtual void SAL_CALL release()
99 : throw() SAL_OVERRIDE;
100 :
101 : // XTypeProvider
102 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
103 : getTypes()
104 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
105 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
106 : getImplementationId()
107 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
108 :
109 : // XInteractionRequest
110 : virtual com::sun::star::uno::Any SAL_CALL
111 : getRequest()
112 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
113 : virtual com::sun::star::uno::Sequence<
114 : com::sun::star::uno::Reference<
115 : com::sun::star::task::XInteractionContinuation > > SAL_CALL
116 : getContinuations()
117 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
118 :
119 : // Non-interface methods.
120 :
121 : /**
122 : * After passing this request to XInteractionHandler::handle, this method
123 : * returns the continuation that was chosen by the interaction handler.
124 : *
125 : * @return the continuation chosen by an interaction handler or an empty
126 : * reference, if the request was not (yet) handled.
127 : */
128 : rtl::Reference< InteractionContinuation > getSelection() const;
129 :
130 : /**
131 : * This method sets a continuation for the request. It also can be used
132 : * to reset the continuation set by a previous XInteractionHandler::handle
133 : * call in order to use this request object more than once.
134 : *
135 : * @param rxSelection is the interaction continuation to activate for
136 : * the request or an empty reference in order to reset the
137 : * current selection.
138 : */
139 : void
140 : setSelection(
141 : const rtl::Reference< InteractionContinuation > & rxSelection );
142 : };
143 :
144 :
145 : struct InteractionContinuation_Impl;
146 :
147 : /**
148 : * This class is the base for implementations of the interface
149 : * XInteractionContinuation. Classes derived from this bas class work together
150 : * with class InteractionRequest.
151 : *
152 : * Derived classes must implement their XInteractionContinuation::select()
153 : * method the way that they simply call recordSelection() which is provided by
154 : * this class.
155 : */
156 : class UCBHELPER_DLLPUBLIC InteractionContinuation : public cppu::OWeakObject
157 : {
158 : InteractionContinuation_Impl * m_pImpl;
159 :
160 : protected:
161 : /**
162 : * This method marks this continuation as "selected" at the request it
163 : * belongs to.
164 : *
165 : * Derived classes must implement their XInteractionContinuation::select()
166 : * method the way that they call this method.
167 : */
168 : void recordSelection();
169 : virtual ~InteractionContinuation();
170 :
171 : public:
172 : InteractionContinuation( InteractionRequest * pRequest );
173 : };
174 :
175 :
176 : /**
177 : * This class implements a standard interaction continuation, namely the
178 : * interface XInteractionAbort. Instances of this class can be passed
179 : * along with an interaction request to indicate the possibility to abort
180 : * the operation that caused the request.
181 : */
182 61772 : class UCBHELPER_DLLPUBLIC InteractionAbort : public InteractionContinuation,
183 : public com::sun::star::lang::XTypeProvider,
184 : public com::sun::star::task::XInteractionAbort
185 : {
186 : public:
187 30886 : InteractionAbort( InteractionRequest * pRequest )
188 30886 : : InteractionContinuation( pRequest ) {}
189 :
190 : // XInterface
191 : virtual com::sun::star::uno::Any SAL_CALL
192 : queryInterface( const com::sun::star::uno::Type & rType )
193 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
194 : virtual void SAL_CALL acquire()
195 : throw() SAL_OVERRIDE;
196 : virtual void SAL_CALL release()
197 : throw() SAL_OVERRIDE;
198 :
199 : // XTypeProvider
200 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
201 : getTypes()
202 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
203 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
204 : getImplementationId()
205 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
206 :
207 : // XInteractionContinuation
208 : virtual void SAL_CALL select()
209 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
210 : };
211 :
212 :
213 : /**
214 : * This class implements a standard interaction continuation, namely the
215 : * interface XInteractionRetry. Instances of this class can be passed
216 : * along with an interaction request to indicate the possibility to retry
217 : * the operation that caused the request.
218 : */
219 8 : class UCBHELPER_DLLPUBLIC InteractionRetry : public InteractionContinuation,
220 : public com::sun::star::lang::XTypeProvider,
221 : public com::sun::star::task::XInteractionRetry
222 : {
223 : public:
224 4 : InteractionRetry( InteractionRequest * pRequest )
225 4 : : InteractionContinuation( pRequest ) {}
226 :
227 : // XInterface
228 : virtual com::sun::star::uno::Any SAL_CALL
229 : queryInterface( const com::sun::star::uno::Type & rType )
230 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
231 : virtual void SAL_CALL acquire()
232 : throw() SAL_OVERRIDE;
233 : virtual void SAL_CALL release()
234 : throw() SAL_OVERRIDE;
235 :
236 : // XTypeProvider
237 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
238 : getTypes()
239 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
240 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
241 : getImplementationId()
242 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
243 :
244 : // XInteractionContinuation
245 : virtual void SAL_CALL select()
246 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
247 : };
248 :
249 :
250 : /**
251 : * This class implements a standard interaction continuation, namely the
252 : * interface XInteractionApprove. Instances of this class can be passed
253 : * along with an interaction request to indicate the possibility to approve
254 : * the request.
255 : */
256 0 : class UCBHELPER_DLLPUBLIC InteractionApprove : public InteractionContinuation,
257 : public com::sun::star::lang::XTypeProvider,
258 : public com::sun::star::task::XInteractionApprove
259 : {
260 : public:
261 0 : InteractionApprove( InteractionRequest * pRequest )
262 0 : : InteractionContinuation( pRequest ) {}
263 :
264 : // XInterface
265 : virtual com::sun::star::uno::Any SAL_CALL
266 : queryInterface( const com::sun::star::uno::Type & rType )
267 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
268 : virtual void SAL_CALL acquire()
269 : throw() SAL_OVERRIDE;
270 : virtual void SAL_CALL release()
271 : throw() SAL_OVERRIDE;
272 :
273 : // XTypeProvider
274 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
275 : getTypes()
276 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
277 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
278 : getImplementationId()
279 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
280 :
281 : // XInteractionContinuation
282 : virtual void SAL_CALL select()
283 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
284 : };
285 :
286 :
287 : /**
288 : * This class implements a standard interaction continuation, namely the
289 : * interface XInteractionDisapprove. Instances of this class can be passed
290 : * along with an interaction request to indicate the possibility to disapprove
291 : * the request.
292 : */
293 0 : class UCBHELPER_DLLPUBLIC InteractionDisapprove : public InteractionContinuation,
294 : public com::sun::star::lang::XTypeProvider,
295 : public com::sun::star::task::XInteractionDisapprove
296 : {
297 : public:
298 0 : InteractionDisapprove( InteractionRequest * pRequest )
299 0 : : InteractionContinuation( pRequest ) {}
300 :
301 : // XInterface
302 : virtual com::sun::star::uno::Any SAL_CALL
303 : queryInterface( const com::sun::star::uno::Type & rType )
304 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
305 : virtual void SAL_CALL acquire()
306 : throw() SAL_OVERRIDE;
307 : virtual void SAL_CALL release()
308 : throw() SAL_OVERRIDE;
309 :
310 : // XTypeProvider
311 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
312 : getTypes()
313 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
314 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
315 : getImplementationId()
316 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
317 :
318 : // XInteractionContinuation
319 : virtual void SAL_CALL select()
320 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
321 : };
322 :
323 :
324 : /**
325 : * This class implements a standard interaction continuation, namely the
326 : * interface XInteractionSupplyAuthentication. Instances of this class can be
327 : * passed along with an authentication interaction request to enable the
328 : * interaction handler to supply the missing authentication data.
329 : */
330 8 : class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication :
331 : public InteractionContinuation,
332 : public com::sun::star::lang::XTypeProvider,
333 : public com::sun::star::ucb::XInteractionSupplyAuthentication2
334 : {
335 : com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication >
336 : m_aRememberPasswordModes;
337 : com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication >
338 : m_aRememberAccountModes;
339 : OUString m_aRealm;
340 : OUString m_aUserName;
341 : OUString m_aPassword;
342 : OUString m_aAccount;
343 : com::sun::star::ucb::RememberAuthentication m_eRememberPasswordMode;
344 : com::sun::star::ucb::RememberAuthentication m_eDefaultRememberPasswordMode;
345 : com::sun::star::ucb::RememberAuthentication m_eRememberAccountMode;
346 : com::sun::star::ucb::RememberAuthentication m_eDefaultRememberAccountMode;
347 : bool m_bCanSetRealm : 1;
348 : bool m_bCanSetUserName : 1;
349 : bool m_bCanSetPassword : 1;
350 : bool m_bCanSetAccount : 1;
351 : bool m_bCanUseSystemCredentials : 1;
352 : bool m_bDefaultUseSystemCredentials : 1;
353 : bool m_bUseSystemCredentials : 1;
354 :
355 : public:
356 : /**
357 : * Constructor.
358 : *
359 : * @param rxRequest is the interaction request that owns this continuation.
360 : * @param bCanSetRealm indicates, whether the realm given with the
361 : * authentication request is read-only.
362 : * @param bCanSetUserName indicates, whether the username given with the
363 : * authentication request is read-only.
364 : * @param bCanSetPassword indicates, whether the password given with the
365 : * authentication request is read-only.
366 : * @param bCanSetAccount indicates, whether the account given with the
367 : * authentication request is read-only.
368 : *
369 : * @see com::sun::star::ucb::AuthenticationRequest
370 : */
371 : inline InteractionSupplyAuthentication(
372 : InteractionRequest * pRequest,
373 : bool bCanSetRealm,
374 : bool bCanSetUserName,
375 : bool bCanSetPassword,
376 : bool bCanSetAccount);
377 : /**
378 : * Constructor.
379 : *
380 : * Note: The remember-authentication stuff is interesting only for
381 : * clients implementing own password storage functionality.
382 : *
383 : * @param rxRequest is the interaction request that owns this continuation.
384 : * @param bCanSetRealm indicates, whether the realm given with the
385 : * authentication request is read-only.
386 : * @param bCanSetUserName indicates, whether the username given with the
387 : * authentication request is read-only.
388 : * @param bCanSetPassword indicates, whether the password given with the
389 : * authentication request is read-only.
390 : * @param bCanSetAccount indicates, whether the account given with the
391 : * authentication request is read-only.
392 : * @param rRememberPasswordModes specifies the authentication-remember-
393 : * modes for passwords supported by the requesting client.
394 : * @param eDefaultRememberPasswordMode specifies the default
395 : * authentication-remember-mode for passwords preferred by the
396 : * requesting client.
397 : * @param rRememberAccountModes specifies the authentication-remember-
398 : * modes for accounts supported by the requesting client.
399 : * @param eDefaultRememberAccountMode specifies the default
400 : * authentication-remember-mode for accounts preferred by the
401 : * requesting client.
402 : * @param bCanUseSystemCredentials indicates whether issuer of the
403 : * authetication request can obtain and use system credentials
404 : * for authentication.
405 : * @param bDefaultUseSystemCredentials specifies the default system
406 : * credentials usage preferred by the requesting client
407 : *
408 : * @see com::sun::star::ucb::AuthenticationRequest
409 : * @see com::sun::star::ucb::RememberAuthentication
410 : */
411 : inline InteractionSupplyAuthentication(
412 : InteractionRequest * pRequest,
413 : bool bCanSetRealm,
414 : bool bCanSetUserName,
415 : bool bCanSetPassword,
416 : bool bCanSetAccount,
417 : const com::sun::star::uno::Sequence<
418 : com::sun::star::ucb::RememberAuthentication > &
419 : rRememberPasswordModes,
420 : const com::sun::star::ucb::RememberAuthentication
421 : eDefaultRememberPasswordMode,
422 : const com::sun::star::uno::Sequence<
423 : com::sun::star::ucb::RememberAuthentication > &
424 : rRememberAccountModes,
425 : const com::sun::star::ucb::RememberAuthentication
426 : eDefaultRememberAccountMode,
427 : bool bCanUseSystemCredentials,
428 : bool bDefaultUseSystemCredentials );
429 :
430 : // XInterface
431 : virtual com::sun::star::uno::Any SAL_CALL
432 : queryInterface( const com::sun::star::uno::Type & rType )
433 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
434 : virtual void SAL_CALL acquire()
435 : throw() SAL_OVERRIDE;
436 : virtual void SAL_CALL release()
437 : throw() SAL_OVERRIDE;
438 :
439 : // XTypeProvider
440 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
441 : getTypes()
442 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
443 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
444 : getImplementationId()
445 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
446 :
447 : // XInteractionContinuation
448 : virtual void SAL_CALL select()
449 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
450 :
451 : // XInteractionSupplyAuthentication
452 : virtual sal_Bool SAL_CALL
453 : canSetRealm()
454 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
455 : virtual void SAL_CALL
456 : setRealm( const OUString& Realm )
457 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
458 :
459 : virtual sal_Bool SAL_CALL
460 : canSetUserName()
461 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
462 : virtual void SAL_CALL
463 : setUserName( const OUString& UserName )
464 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
465 :
466 : virtual sal_Bool SAL_CALL
467 : canSetPassword()
468 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
469 : virtual void SAL_CALL
470 : setPassword( const OUString& Password )
471 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
472 :
473 : virtual com::sun::star::uno::Sequence<
474 : com::sun::star::ucb::RememberAuthentication > SAL_CALL
475 : getRememberPasswordModes(
476 : com::sun::star::ucb::RememberAuthentication& Default )
477 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
478 : virtual void SAL_CALL
479 : setRememberPassword( com::sun::star::ucb::RememberAuthentication Remember )
480 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
481 :
482 : virtual sal_Bool SAL_CALL
483 : canSetAccount()
484 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
485 : virtual void SAL_CALL
486 : setAccount( const OUString& Account )
487 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
488 :
489 : virtual com::sun::star::uno::Sequence<
490 : com::sun::star::ucb::RememberAuthentication > SAL_CALL
491 : getRememberAccountModes(
492 : com::sun::star::ucb::RememberAuthentication& Default )
493 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
494 : virtual void SAL_CALL
495 : setRememberAccount( com::sun::star::ucb::RememberAuthentication Remember )
496 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
497 :
498 : // XInteractionSupplyAuthentication2
499 : virtual sal_Bool SAL_CALL canUseSystemCredentials( sal_Bool& Default )
500 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
501 : virtual void SAL_CALL setUseSystemCredentials( sal_Bool UseSystemCredentials )
502 : throw ( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
503 :
504 : // Non-interface methods.
505 :
506 : /**
507 : * This method returns the realm that was supplied by the interaction
508 : * handler.
509 : *
510 : * @return the realm.
511 : */
512 0 : const OUString & getRealm() const { return m_aRealm; }
513 :
514 : /**
515 : * This method returns the username that was supplied by the interaction
516 : * handler.
517 : *
518 : * @return the username.
519 : */
520 0 : const OUString & getUserName() const { return m_aUserName; }
521 :
522 : /**
523 : * This method returns the password that was supplied by the interaction
524 : * handler.
525 : *
526 : * @return the password.
527 : */
528 4 : const OUString & getPassword() const { return m_aPassword; }
529 :
530 : /**
531 : * This method returns the account that was supplied by the interaction
532 : * handler.
533 : *
534 : * @return the account.
535 : */
536 : const OUString & getAccount() const { return m_aAccount; }
537 :
538 : /**
539 : * This method returns the authentication remember-mode for the password
540 : * that was supplied by the interaction handler.
541 : *
542 : * @return the remember-mode for the password.
543 : */
544 : const com::sun::star::ucb::RememberAuthentication &
545 0 : getRememberPasswordMode() const { return m_eRememberPasswordMode; }
546 :
547 : /**
548 : * This method returns the authentication remember-mode for the account
549 : * that was supplied by the interaction handler.
550 : *
551 : * @return the remember-mode for the account.
552 : */
553 : const com::sun::star::ucb::RememberAuthentication &
554 : getRememberAccountMode() const { return m_eRememberAccountMode; }
555 :
556 0 : bool getUseSystemCredentials() const { return m_bUseSystemCredentials; }
557 : };
558 :
559 :
560 : inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
561 : InteractionRequest * pRequest,
562 : bool bCanSetRealm,
563 : bool bCanSetUserName,
564 : bool bCanSetPassword,
565 : bool bCanSetAccount )
566 : : InteractionContinuation( pRequest ),
567 : m_aRememberPasswordModes( com::sun::star::uno::Sequence<
568 : com::sun::star::ucb::RememberAuthentication >( 1 ) ),
569 : m_aRememberAccountModes( com::sun::star::uno::Sequence<
570 : com::sun::star::ucb::RememberAuthentication >( 1 ) ),
571 : m_eRememberPasswordMode( com::sun::star::ucb::RememberAuthentication_NO ),
572 : m_eDefaultRememberPasswordMode(
573 : com::sun::star::ucb::RememberAuthentication_NO ),
574 : m_eRememberAccountMode( com::sun::star::ucb::RememberAuthentication_NO ),
575 : m_eDefaultRememberAccountMode(
576 : com::sun::star::ucb::RememberAuthentication_NO ),
577 : m_bCanSetRealm( bCanSetRealm ),
578 : m_bCanSetUserName( bCanSetUserName ),
579 : m_bCanSetPassword( bCanSetPassword ),
580 : m_bCanSetAccount( bCanSetAccount ),
581 : m_bCanUseSystemCredentials( false ),
582 : m_bDefaultUseSystemCredentials( false ),
583 : m_bUseSystemCredentials( false )
584 : {
585 : m_aRememberPasswordModes[ 0 ]
586 : = com::sun::star::ucb::RememberAuthentication_NO;
587 : m_aRememberAccountModes [ 0 ]
588 : = com::sun::star::ucb::RememberAuthentication_NO;
589 : }
590 :
591 :
592 4 : inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
593 : InteractionRequest * pRequest,
594 : bool bCanSetRealm,
595 : bool bCanSetUserName,
596 : bool bCanSetPassword,
597 : bool bCanSetAccount,
598 : const com::sun::star::uno::Sequence<
599 : com::sun::star::ucb::RememberAuthentication > & rRememberPasswordModes,
600 : const com::sun::star::ucb::RememberAuthentication
601 : eDefaultRememberPasswordMode,
602 : const com::sun::star::uno::Sequence<
603 : com::sun::star::ucb::RememberAuthentication > & rRememberAccountModes,
604 : const com::sun::star::ucb::RememberAuthentication
605 : eDefaultRememberAccountMode,
606 : bool bCanUseSystemCredentials,
607 : bool bDefaultUseSystemCredentials )
608 : : InteractionContinuation( pRequest ),
609 : m_aRememberPasswordModes( rRememberPasswordModes ),
610 : m_aRememberAccountModes( rRememberAccountModes ),
611 : m_eRememberPasswordMode( eDefaultRememberPasswordMode ),
612 : m_eDefaultRememberPasswordMode( eDefaultRememberPasswordMode ),
613 : m_eRememberAccountMode( eDefaultRememberAccountMode ),
614 : m_eDefaultRememberAccountMode( eDefaultRememberAccountMode ),
615 : m_bCanSetRealm( bCanSetRealm ),
616 : m_bCanSetUserName( bCanSetUserName ),
617 : m_bCanSetPassword( bCanSetPassword ),
618 : m_bCanSetAccount( bCanSetAccount ),
619 : m_bCanUseSystemCredentials( bCanUseSystemCredentials ),
620 : m_bDefaultUseSystemCredentials( bDefaultUseSystemCredentials ),
621 4 : m_bUseSystemCredentials( bDefaultUseSystemCredentials && bCanUseSystemCredentials )
622 : {
623 4 : }
624 :
625 :
626 : /**
627 : * This class implements a standard interaction continuation, namely the
628 : * interface XInteractionReplaceExistingData. Instances of this class can be
629 : * passed along with an interaction request to indicate the possibility to
630 : * replace existing data.
631 : */
632 0 : class InteractionReplaceExistingData :
633 : public InteractionContinuation,
634 : public com::sun::star::lang::XTypeProvider,
635 : public com::sun::star::ucb::XInteractionReplaceExistingData
636 : {
637 : public:
638 0 : InteractionReplaceExistingData( InteractionRequest * pRequest )
639 0 : : InteractionContinuation( pRequest ) {}
640 :
641 : // XInterface
642 : virtual com::sun::star::uno::Any SAL_CALL
643 : queryInterface( const com::sun::star::uno::Type & rType )
644 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
645 : virtual void SAL_CALL acquire()
646 : throw() SAL_OVERRIDE;
647 : virtual void SAL_CALL release()
648 : throw() SAL_OVERRIDE;
649 :
650 : // XTypeProvider
651 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
652 : getTypes()
653 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
654 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
655 : getImplementationId()
656 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
657 :
658 : // XInteractionContinuation
659 : virtual void SAL_CALL select()
660 : throw( com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
661 : };
662 :
663 : } // namespace ucbhelper
664 :
665 : #endif /* ! INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX */
666 :
667 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|