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 _UCBHELPER_INTERATIONREQUEST_HXX
21 : #define _UCBHELPER_INTERATIONREQUEST_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 <com/sun/star/ucb/XInteractionSupplyName.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 choosen 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 );
97 : virtual void SAL_CALL acquire()
98 : throw();
99 : virtual void SAL_CALL release()
100 : throw();
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 );
106 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
107 : getImplementationId()
108 : throw( com::sun::star::uno::RuntimeException );
109 :
110 : // XInteractionRequest
111 : virtual com::sun::star::uno::Any SAL_CALL
112 : getRequest()
113 : throw( com::sun::star::uno::RuntimeException );
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 );
119 :
120 : // Non-interface methods.
121 :
122 : /**
123 : * After passing this request to XInteractionHandler::handle, this method
124 : * returns the continuation that was choosen by the interaction handler.
125 : *
126 : * @return the continuation choosen 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 then 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 possiblity to abort
181 : * the operation that caused the request.
182 : */
183 3226 : class UCBHELPER_DLLPUBLIC InteractionAbort : public InteractionContinuation,
184 : public com::sun::star::lang::XTypeProvider,
185 : public com::sun::star::task::XInteractionAbort
186 : {
187 : public:
188 1613 : InteractionAbort( InteractionRequest * pRequest )
189 1613 : : 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 );
195 : virtual void SAL_CALL acquire()
196 : throw();
197 : virtual void SAL_CALL release()
198 : throw();
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 );
204 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
205 : getImplementationId()
206 : throw( com::sun::star::uno::RuntimeException );
207 :
208 : // XInteractionContinuation
209 : virtual void SAL_CALL select()
210 : throw( com::sun::star::uno::RuntimeException );
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 possiblity to retry
218 : * the operation that caused the request.
219 : */
220 0 : class UCBHELPER_DLLPUBLIC InteractionRetry : public InteractionContinuation,
221 : public com::sun::star::lang::XTypeProvider,
222 : public com::sun::star::task::XInteractionRetry
223 : {
224 : public:
225 0 : InteractionRetry( InteractionRequest * pRequest )
226 0 : : 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 );
232 : virtual void SAL_CALL acquire()
233 : throw();
234 : virtual void SAL_CALL release()
235 : throw();
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 );
241 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
242 : getImplementationId()
243 : throw( com::sun::star::uno::RuntimeException );
244 :
245 : // XInteractionContinuation
246 : virtual void SAL_CALL select()
247 : throw( com::sun::star::uno::RuntimeException );
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 possiblity 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 );
269 : virtual void SAL_CALL acquire()
270 : throw();
271 : virtual void SAL_CALL release()
272 : throw();
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 );
278 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
279 : getImplementationId()
280 : throw( com::sun::star::uno::RuntimeException );
281 :
282 : // XInteractionContinuation
283 : virtual void SAL_CALL select()
284 : throw( com::sun::star::uno::RuntimeException );
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 possiblity 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 );
306 : virtual void SAL_CALL acquire()
307 : throw();
308 : virtual void SAL_CALL release()
309 : throw();
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 );
315 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
316 : getImplementationId()
317 : throw( com::sun::star::uno::RuntimeException );
318 :
319 : // XInteractionContinuation
320 : virtual void SAL_CALL select()
321 : throw( com::sun::star::uno::RuntimeException );
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 0 : 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 : rtl::OUString m_aRealm;
341 : rtl::OUString m_aUserName;
342 : rtl::OUString m_aPassword;
343 : rtl::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 : unsigned m_bCanSetRealm : 1;
349 : unsigned m_bCanSetUserName : 1;
350 : unsigned m_bCanSetPassword : 1;
351 : unsigned m_bCanSetAccount : 1;
352 : unsigned m_bCanUseSystemCredentials : 1;
353 : unsigned m_bDefaultUseSystemCredentials : 1;
354 : unsigned 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 : sal_Bool bCanSetRealm,
375 : sal_Bool bCanSetUserName,
376 : sal_Bool bCanSetPassword,
377 : sal_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 : sal_Bool bCanSetRealm,
415 : sal_Bool bCanSetUserName,
416 : sal_Bool bCanSetPassword,
417 : sal_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 : sal_Bool bCanUseSystemCredentials,
429 : sal_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 );
435 : virtual void SAL_CALL acquire()
436 : throw();
437 : virtual void SAL_CALL release()
438 : throw();
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 );
444 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
445 : getImplementationId()
446 : throw( com::sun::star::uno::RuntimeException );
447 :
448 : // XInteractionContinuation
449 : virtual void SAL_CALL select()
450 : throw( com::sun::star::uno::RuntimeException );
451 :
452 : // XInteractionSupplyAuthentication
453 : virtual sal_Bool SAL_CALL
454 : canSetRealm()
455 : throw( com::sun::star::uno::RuntimeException );
456 : virtual void SAL_CALL
457 : setRealm( const rtl::OUString& Realm )
458 : throw( com::sun::star::uno::RuntimeException );
459 :
460 : virtual sal_Bool SAL_CALL
461 : canSetUserName()
462 : throw( com::sun::star::uno::RuntimeException );
463 : virtual void SAL_CALL
464 : setUserName( const rtl::OUString& UserName )
465 : throw( com::sun::star::uno::RuntimeException );
466 :
467 : virtual sal_Bool SAL_CALL
468 : canSetPassword()
469 : throw( com::sun::star::uno::RuntimeException );
470 : virtual void SAL_CALL
471 : setPassword( const rtl::OUString& Password )
472 : throw( com::sun::star::uno::RuntimeException );
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 );
479 : virtual void SAL_CALL
480 : setRememberPassword( com::sun::star::ucb::RememberAuthentication Remember )
481 : throw( com::sun::star::uno::RuntimeException );
482 :
483 : virtual sal_Bool SAL_CALL
484 : canSetAccount()
485 : throw( com::sun::star::uno::RuntimeException );
486 : virtual void SAL_CALL
487 : setAccount( const rtl::OUString& Account )
488 : throw( com::sun::star::uno::RuntimeException );
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 );
495 : virtual void SAL_CALL
496 : setRememberAccount( com::sun::star::ucb::RememberAuthentication Remember )
497 : throw( com::sun::star::uno::RuntimeException );
498 :
499 : // XInteractionSupplyAuthentication2
500 : virtual ::sal_Bool SAL_CALL canUseSystemCredentials( ::sal_Bool& Default )
501 : throw ( ::com::sun::star::uno::RuntimeException );
502 : virtual void SAL_CALL setUseSystemCredentials( ::sal_Bool UseSystemCredentials )
503 : throw ( ::com::sun::star::uno::RuntimeException );
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 rtl::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 rtl::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 0 : const rtl::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 rtl::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 : sal_Bool getUseSystemCredentials() const { return m_bUseSystemCredentials; }
558 : };
559 :
560 : //============================================================================
561 : inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
562 : InteractionRequest * pRequest,
563 : sal_Bool bCanSetRealm,
564 : sal_Bool bCanSetUserName,
565 : sal_Bool bCanSetPassword,
566 : sal_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( sal_False ),
583 : m_bDefaultUseSystemCredentials( sal_False ),
584 : m_bUseSystemCredentials( sal_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 0 : inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
594 : InteractionRequest * pRequest,
595 : sal_Bool bCanSetRealm,
596 : sal_Bool bCanSetUserName,
597 : sal_Bool bCanSetPassword,
598 : sal_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 : sal_Bool bCanUseSystemCredentials,
608 : sal_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 0 : m_bUseSystemCredentials( bDefaultUseSystemCredentials & bCanUseSystemCredentials )
623 : {
624 0 : }
625 :
626 : //============================================================================
627 : /**
628 : * This class implements a standard interaction continuation, namely the
629 : * interface XInteractionSupplyName. Instances of this class can be passed
630 : * along with an interaction request to indicate the possiblity to
631 : * supply a new name.
632 : */
633 0 : class InteractionSupplyName : public InteractionContinuation,
634 : public com::sun::star::lang::XTypeProvider,
635 : public com::sun::star::ucb::XInteractionSupplyName
636 : {
637 : rtl::OUString m_aName;
638 :
639 : public:
640 0 : InteractionSupplyName( InteractionRequest * pRequest )
641 0 : : InteractionContinuation( pRequest ) {}
642 :
643 : // XInterface
644 : virtual com::sun::star::uno::Any SAL_CALL
645 : queryInterface( const com::sun::star::uno::Type & rType )
646 : throw( com::sun::star::uno::RuntimeException );
647 : virtual void SAL_CALL acquire()
648 : throw();
649 : virtual void SAL_CALL release()
650 : throw();
651 :
652 : // XTypeProvider
653 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
654 : getTypes()
655 : throw( com::sun::star::uno::RuntimeException );
656 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
657 : getImplementationId()
658 : throw( com::sun::star::uno::RuntimeException );
659 :
660 : // XInteractionContinuation
661 : virtual void SAL_CALL select()
662 : throw( com::sun::star::uno::RuntimeException );
663 :
664 : // XInteractionSupplyName
665 : virtual void SAL_CALL setName( const ::rtl::OUString& Name )
666 : throw ( com::sun::star::uno::RuntimeException );
667 :
668 : // Non-interface methods.
669 :
670 : /**
671 : * This method returns the name that was supplied by the interaction
672 : * handler.
673 : *
674 : * @return the name.
675 : */
676 0 : const rtl::OUString & getName() const { return m_aName; }
677 : };
678 :
679 : //============================================================================
680 : /**
681 : * This class implements a standard interaction continuation, namely the
682 : * interface XInteractionReplaceExistingData. Instances of this class can be
683 : * passed along with an interaction request to indicate the possiblity to
684 : * replace existing data.
685 : */
686 0 : class InteractionReplaceExistingData :
687 : public InteractionContinuation,
688 : public com::sun::star::lang::XTypeProvider,
689 : public com::sun::star::ucb::XInteractionReplaceExistingData
690 : {
691 : public:
692 0 : InteractionReplaceExistingData( InteractionRequest * pRequest )
693 0 : : InteractionContinuation( pRequest ) {}
694 :
695 : // XInterface
696 : virtual com::sun::star::uno::Any SAL_CALL
697 : queryInterface( const com::sun::star::uno::Type & rType )
698 : throw( com::sun::star::uno::RuntimeException );
699 : virtual void SAL_CALL acquire()
700 : throw();
701 : virtual void SAL_CALL release()
702 : throw();
703 :
704 : // XTypeProvider
705 : virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
706 : getTypes()
707 : throw( com::sun::star::uno::RuntimeException );
708 : virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
709 : getImplementationId()
710 : throw( com::sun::star::uno::RuntimeException );
711 :
712 : // XInteractionContinuation
713 : virtual void SAL_CALL select()
714 : throw( com::sun::star::uno::RuntimeException );
715 : };
716 :
717 : } // namespace ucbhelper
718 :
719 : #endif /* !_UCBHELPER_INTERATIONREQUEST_HXX */
720 :
721 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|