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