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