xref: /trunk/main/ucbhelper/inc/ucbhelper/interactionrequest.hxx (revision 91144cd0085a7583d2099b982122deb2184ab956)
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 chosen 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     virtual void SAL_CALL acquire()
101         throw();
102     virtual void SAL_CALL release()
103         throw();
104 
105     // XTypeProvider
106     virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
107     getTypes();
108     virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
109     getImplementationId();
110 
111     // XInteractionRequest
112     virtual com::sun::star::uno::Any SAL_CALL
113     getRequest();
114     virtual com::sun::star::uno::Sequence<
115                 com::sun::star::uno::Reference<
116                     com::sun::star::task::XInteractionContinuation > > SAL_CALL
117     getContinuations();
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 then 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 class UCBHELPER_DLLPUBLIC InteractionAbort : public InteractionContinuation,
183                          public com::sun::star::lang::XTypeProvider,
184                          public com::sun::star::task::XInteractionAbort
185 {
186 public:
InteractionAbort(InteractionRequest * pRequest)187     InteractionAbort( InteractionRequest * pRequest )
188     : InteractionContinuation( pRequest ) {}
189 
190     // XInterface
191     virtual com::sun::star::uno::Any SAL_CALL
192     queryInterface( const com::sun::star::uno::Type & rType );
193     virtual void SAL_CALL acquire()
194         throw();
195     virtual void SAL_CALL release()
196         throw();
197 
198     // XTypeProvider
199     virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
200     getTypes();
201     virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
202     getImplementationId();
203 
204     // XInteractionContinuation
205     virtual void SAL_CALL select();
206 };
207 
208 //============================================================================
209 /**
210   * This class implements a standard interaction continuation, namely the
211   * interface XInteractionRetry. Instances of this class can be passed
212   * along with an interaction request to indicate the possibility to retry
213   * the operation that caused the request.
214   */
215 class UCBHELPER_DLLPUBLIC InteractionRetry : public InteractionContinuation,
216                          public com::sun::star::lang::XTypeProvider,
217                          public com::sun::star::task::XInteractionRetry
218 {
219 public:
InteractionRetry(InteractionRequest * pRequest)220     InteractionRetry( InteractionRequest * pRequest )
221     : InteractionContinuation( pRequest ) {}
222 
223     // XInterface
224     virtual com::sun::star::uno::Any SAL_CALL
225     queryInterface( const com::sun::star::uno::Type & rType );
226     virtual void SAL_CALL acquire()
227         throw();
228     virtual void SAL_CALL release()
229         throw();
230 
231     // XTypeProvider
232     virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
233     getTypes();
234     virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
235     getImplementationId();
236 
237     // XInteractionContinuation
238     virtual void SAL_CALL select();
239 };
240 
241 //============================================================================
242 /**
243   * This class implements a standard interaction continuation, namely the
244   * interface XInteractionApprove. Instances of this class can be passed
245   * along with an interaction request to indicate the possibility to approve
246   * the request.
247   */
248 class UCBHELPER_DLLPUBLIC InteractionApprove : public InteractionContinuation,
249                            public com::sun::star::lang::XTypeProvider,
250                            public com::sun::star::task::XInteractionApprove
251 {
252 public:
InteractionApprove(InteractionRequest * pRequest)253     InteractionApprove( InteractionRequest * pRequest )
254     : InteractionContinuation( pRequest ) {}
255 
256     // XInterface
257     virtual com::sun::star::uno::Any SAL_CALL
258     queryInterface( const com::sun::star::uno::Type & rType );
259     virtual void SAL_CALL acquire()
260         throw();
261     virtual void SAL_CALL release()
262         throw();
263 
264     // XTypeProvider
265     virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
266     getTypes();
267     virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
268     getImplementationId();
269 
270     // XInteractionContinuation
271     virtual void SAL_CALL select();
272 };
273 
274 //============================================================================
275 /**
276   * This class implements a standard interaction continuation, namely the
277   * interface XInteractionDisapprove. Instances of this class can be passed
278   * along with an interaction request to indicate the possibility to disapprove
279   * the request.
280   */
281 class UCBHELPER_DLLPUBLIC InteractionDisapprove : public InteractionContinuation,
282                               public com::sun::star::lang::XTypeProvider,
283                               public com::sun::star::task::XInteractionDisapprove
284 {
285 public:
InteractionDisapprove(InteractionRequest * pRequest)286     InteractionDisapprove( InteractionRequest * pRequest )
287     : InteractionContinuation( pRequest ) {}
288 
289     // XInterface
290     virtual com::sun::star::uno::Any SAL_CALL
291     queryInterface( const com::sun::star::uno::Type & rType );
292     virtual void SAL_CALL acquire()
293         throw();
294     virtual void SAL_CALL release()
295         throw();
296 
297     // XTypeProvider
298     virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
299     getTypes();
300     virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
301     getImplementationId();
302 
303     // XInteractionContinuation
304     virtual void SAL_CALL select();
305 };
306 
307 //============================================================================
308 /**
309   * This class implements a standard interaction continuation, namely the
310   * interface XInteractionSupplyAuthentication. Instances of this class can be
311   * passed along with an authentication interaction request to enable the
312   * interaction handler to supply the missing authentication data.
313   */
314 class UCBHELPER_DLLPUBLIC InteractionSupplyAuthentication :
315                   public InteractionContinuation,
316                   public com::sun::star::lang::XTypeProvider,
317                   public com::sun::star::ucb::XInteractionSupplyAuthentication2
318 {
319     com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication >
320                   m_aRememberPasswordModes;
321     com::sun::star::uno::Sequence< com::sun::star::ucb::RememberAuthentication >
322                   m_aRememberAccountModes;
323     rtl::OUString m_aRealm;
324     rtl::OUString m_aUserName;
325     rtl::OUString m_aPassword;
326     rtl::OUString m_aAccount;
327     com::sun::star::ucb::RememberAuthentication m_eRememberPasswordMode;
328     com::sun::star::ucb::RememberAuthentication m_eDefaultRememberPasswordMode;
329     com::sun::star::ucb::RememberAuthentication m_eRememberAccountMode;
330     com::sun::star::ucb::RememberAuthentication m_eDefaultRememberAccountMode;
331     unsigned m_bCanSetRealm    : 1;
332     unsigned m_bCanSetUserName : 1;
333     unsigned m_bCanSetPassword : 1;
334     unsigned m_bCanSetAccount  : 1;
335     unsigned m_bCanUseSystemCredentials     : 1;
336     unsigned m_bDefaultUseSystemCredentials : 1;
337     unsigned m_bUseSystemCredentials        : 1;
338 
339 public:
340     /**
341       * Constructor.
342       *
343       * @param rxRequest is the interaction request that owns this continuation.
344       * @param bCanSetRealm indicates, whether the realm given with the
345       *        authentication request is read-only.
346       * @param bCanSetUserName indicates, whether the username given with the
347       *        authentication request is read-only.
348       * @param bCanSetPassword indicates, whether the password given with the
349       *        authentication request is read-only.
350       * @param bCanSetAccount indicates, whether the account given with the
351       *        authentication request is read-only.
352       *
353       * @see com::sun::star::ucb::AuthenticationRequest
354       */
355     inline InteractionSupplyAuthentication(
356                     InteractionRequest * pRequest,
357                     sal_Bool bCanSetRealm,
358                     sal_Bool bCanSetUserName,
359                     sal_Bool bCanSetPassword,
360                     sal_Bool bCanSetAccount);
361     /**
362       * Constructor.
363       *
364       * Note: The remember-authentication stuff is interesting only for
365       *       clients implementing own password storage functionality.
366       *
367       * @param rxRequest is the interaction request that owns this continuation.
368       * @param bCanSetRealm indicates, whether the realm given with the
369       *        authentication request is read-only.
370       * @param bCanSetUserName indicates, whether the username given with the
371       *        authentication request is read-only.
372       * @param bCanSetPassword indicates, whether the password given with the
373       *        authentication request is read-only.
374       * @param bCanSetAccount indicates, whether the account given with the
375       *        authentication request is read-only.
376       * @param rRememberPasswordModes specifies the authentication-remember-
377       *        modes for passwords supported by the requesting client.
378       * @param eDefaultRememberPasswordMode specifies the default
379       *        authentication-remember-mode for passwords preferred by the
380       *        requesting client.
381       * @param rRememberAccountModes specifies the authentication-remember-
382       *        modes for accounts supported by the requesting client.
383       * @param eDefaultRememberAccountMode specifies the default
384       *        authentication-remember-mode for accounts preferred by the
385       *        requesting client.
386       * @param bCanUseSystemCredentials indicates whether issuer of the
387       *        authentication request can obtain and use system credentials
388       *        for authentication.
389       * @param bDefaultUseSystemCredentials specifies the default system
390       *        credentials usage preferred by the requesting client
391       *
392       * @see com::sun::star::ucb::AuthenticationRequest
393       * @see com::sun::star::ucb::RememberAuthentication
394       */
395     inline InteractionSupplyAuthentication(
396                     InteractionRequest * pRequest,
397                     sal_Bool bCanSetRealm,
398                     sal_Bool bCanSetUserName,
399                     sal_Bool bCanSetPassword,
400                     sal_Bool bCanSetAccount,
401                     const com::sun::star::uno::Sequence<
402                         com::sun::star::ucb::RememberAuthentication > &
403                             rRememberPasswordModes,
404                     const com::sun::star::ucb::RememberAuthentication
405                         eDefaultRememberPasswordMode,
406                     const com::sun::star::uno::Sequence<
407                         com::sun::star::ucb::RememberAuthentication > &
408                             rRememberAccountModes,
409                     const com::sun::star::ucb::RememberAuthentication
410                         eDefaultRememberAccountMode,
411                     sal_Bool bCanUseSystemCredentials,
412                     sal_Bool bDefaultUseSystemCredentials );
413 
414     // XInterface
415     virtual com::sun::star::uno::Any SAL_CALL
416     queryInterface( const com::sun::star::uno::Type & rType );
417     virtual void SAL_CALL acquire()
418         throw();
419     virtual void SAL_CALL release()
420         throw();
421 
422     // XTypeProvider
423     virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
424     getTypes();
425     virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
426     getImplementationId();
427 
428     // XInteractionContinuation
429     virtual void SAL_CALL select();
430 
431     // XInteractionSupplyAuthentication
432     virtual sal_Bool SAL_CALL
433     canSetRealm();
434     virtual void SAL_CALL
435     setRealm( const rtl::OUString& Realm );
436 
437     virtual sal_Bool SAL_CALL
438     canSetUserName();
439     virtual void SAL_CALL
440     setUserName( const rtl::OUString& UserName );
441 
442     virtual sal_Bool SAL_CALL
443     canSetPassword();
444     virtual void SAL_CALL
445     setPassword( const rtl::OUString& Password );
446 
447     virtual com::sun::star::uno::Sequence<
448                 com::sun::star::ucb::RememberAuthentication > SAL_CALL
449     getRememberPasswordModes(
450             com::sun::star::ucb::RememberAuthentication& Default );
451     virtual void SAL_CALL
452     setRememberPassword( com::sun::star::ucb::RememberAuthentication Remember );
453 
454     virtual sal_Bool SAL_CALL
455     canSetAccount();
456     virtual void SAL_CALL
457     setAccount( const rtl::OUString& Account );
458 
459     virtual com::sun::star::uno::Sequence<
460                 com::sun::star::ucb::RememberAuthentication > SAL_CALL
461     getRememberAccountModes(
462             com::sun::star::ucb::RememberAuthentication& Default );
463     virtual void SAL_CALL
464     setRememberAccount( com::sun::star::ucb::RememberAuthentication Remember );
465 
466     // XInteractionSupplyAuthentication2
467     virtual ::sal_Bool SAL_CALL canUseSystemCredentials( ::sal_Bool& Default );
468     virtual void SAL_CALL setUseSystemCredentials( ::sal_Bool UseSystemCredentials );
469 
470     // Non-interface methods.
471 
472     /**
473       * This method returns the realm that was supplied by the interaction
474       * handler.
475       *
476       * @return the realm.
477       */
getRealm() const478     const rtl::OUString & getRealm()    const { return m_aRealm; }
479 
480     /**
481       * This method returns the username that was supplied by the interaction
482       * handler.
483       *
484       * @return the username.
485       */
getUserName() const486     const rtl::OUString & getUserName() const { return m_aUserName; }
487 
488     /**
489       * This method returns the password that was supplied by the interaction
490       * handler.
491       *
492       * @return the password.
493       */
getPassword() const494     const rtl::OUString & getPassword() const { return m_aPassword; }
495 
496     /**
497       * This method returns the account that was supplied by the interaction
498       * handler.
499       *
500       * @return the account.
501       */
getAccount() const502     const rtl::OUString & getAccount()  const { return m_aAccount; }
503 
504     /**
505       * This method returns the authentication remember-mode for the password
506       * that was supplied by the interaction handler.
507       *
508       * @return the remember-mode for the password.
509       */
510     const com::sun::star::ucb::RememberAuthentication &
getRememberPasswordMode() const511     getRememberPasswordMode() const { return m_eRememberPasswordMode; }
512 
513     /**
514       * This method returns the authentication remember-mode for the account
515       * that was supplied by the interaction handler.
516       *
517       * @return the remember-mode for the account.
518       */
519     const com::sun::star::ucb::RememberAuthentication &
getRememberAccountMode() const520     getRememberAccountMode() const { return m_eRememberAccountMode; }
521 
getUseSystemCredentials() const522     sal_Bool getUseSystemCredentials() const { return m_bUseSystemCredentials; }
523 };
524 
525 //============================================================================
InteractionSupplyAuthentication(InteractionRequest * pRequest,sal_Bool bCanSetRealm,sal_Bool bCanSetUserName,sal_Bool bCanSetPassword,sal_Bool bCanSetAccount)526 inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
527                     InteractionRequest * pRequest,
528                     sal_Bool bCanSetRealm,
529                     sal_Bool bCanSetUserName,
530                     sal_Bool bCanSetPassword,
531                     sal_Bool bCanSetAccount )
532 : InteractionContinuation( pRequest ),
533   m_aRememberPasswordModes( com::sun::star::uno::Sequence<
534                 com::sun::star::ucb::RememberAuthentication >( 1 ) ),
535   m_aRememberAccountModes( com::sun::star::uno::Sequence<
536                 com::sun::star::ucb::RememberAuthentication >( 1 ) ),
537   m_eRememberPasswordMode( com::sun::star::ucb::RememberAuthentication_NO ),
538   m_eDefaultRememberPasswordMode(
539                 com::sun::star::ucb::RememberAuthentication_NO ),
540   m_eRememberAccountMode( com::sun::star::ucb::RememberAuthentication_NO ),
541   m_eDefaultRememberAccountMode(
542                 com::sun::star::ucb::RememberAuthentication_NO ),
543   m_bCanSetRealm( bCanSetRealm ),
544   m_bCanSetUserName( bCanSetUserName ),
545   m_bCanSetPassword( bCanSetPassword ),
546   m_bCanSetAccount( bCanSetAccount ),
547   m_bCanUseSystemCredentials( sal_False ),
548   m_bDefaultUseSystemCredentials( sal_False ),
549   m_bUseSystemCredentials( sal_False )
550 {
551     m_aRememberPasswordModes[ 0 ]
552         = com::sun::star::ucb::RememberAuthentication_NO;
553     m_aRememberAccountModes [ 0 ]
554         = com::sun::star::ucb::RememberAuthentication_NO;
555 }
556 
557 //============================================================================
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)558 inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
559     InteractionRequest * pRequest,
560     sal_Bool bCanSetRealm,
561     sal_Bool bCanSetUserName,
562     sal_Bool bCanSetPassword,
563     sal_Bool bCanSetAccount,
564     const com::sun::star::uno::Sequence<
565         com::sun::star::ucb::RememberAuthentication > & rRememberPasswordModes,
566     const com::sun::star::ucb::RememberAuthentication
567         eDefaultRememberPasswordMode,
568     const com::sun::star::uno::Sequence<
569         com::sun::star::ucb::RememberAuthentication > & rRememberAccountModes,
570     const com::sun::star::ucb::RememberAuthentication
571         eDefaultRememberAccountMode,
572     sal_Bool bCanUseSystemCredentials,
573     sal_Bool bDefaultUseSystemCredentials )
574 : InteractionContinuation( pRequest ),
575   m_aRememberPasswordModes( rRememberPasswordModes ),
576   m_aRememberAccountModes( rRememberAccountModes ),
577   m_eRememberPasswordMode( eDefaultRememberPasswordMode ),
578   m_eDefaultRememberPasswordMode( eDefaultRememberPasswordMode ),
579   m_eRememberAccountMode( eDefaultRememberAccountMode ),
580   m_eDefaultRememberAccountMode( eDefaultRememberAccountMode ),
581   m_bCanSetRealm( bCanSetRealm ),
582   m_bCanSetUserName( bCanSetUserName ),
583   m_bCanSetPassword( bCanSetPassword ),
584   m_bCanSetAccount( bCanSetAccount ),
585   m_bCanUseSystemCredentials( bCanUseSystemCredentials ),
586   m_bDefaultUseSystemCredentials( bDefaultUseSystemCredentials ),
587   m_bUseSystemCredentials( bDefaultUseSystemCredentials & bCanUseSystemCredentials )
588 {
589 }
590 
591 //============================================================================
592 /**
593   * This class implements a standard interaction continuation, namely the
594   * interface XInteractionSupplyName. Instances of this class can be passed
595   * along with an interaction request to indicate the possibility to
596   * supply a new name.
597   */
598 class InteractionSupplyName : public InteractionContinuation,
599                               public com::sun::star::lang::XTypeProvider,
600                               public com::sun::star::ucb::XInteractionSupplyName
601 {
602     rtl::OUString m_aName;
603 
604 public:
InteractionSupplyName(InteractionRequest * pRequest)605     InteractionSupplyName( InteractionRequest * pRequest )
606     : InteractionContinuation( pRequest ) {}
607 
608     // XInterface
609     virtual com::sun::star::uno::Any SAL_CALL
610     queryInterface( const com::sun::star::uno::Type & rType );
611     virtual void SAL_CALL acquire()
612         throw();
613     virtual void SAL_CALL release()
614         throw();
615 
616     // XTypeProvider
617     virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
618     getTypes();
619     virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
620     getImplementationId();
621 
622     // XInteractionContinuation
623     virtual void SAL_CALL select();
624 
625     // XInteractionSupplyName
626     virtual void SAL_CALL setName( const ::rtl::OUString& Name );
627 
628     // Non-interface methods.
629 
630     /**
631       * This method returns the name that was supplied by the interaction
632       * handler.
633       *
634       * @return the name.
635       */
getName() const636     const rtl::OUString & getName() const { return m_aName; }
637 };
638 
639 //============================================================================
640 /**
641   * This class implements a standard interaction continuation, namely the
642   * interface XInteractionReplaceExistingData. Instances of this class can be
643   * passed along with an interaction request to indicate the possibility to
644   * replace existing data.
645   */
646 class InteractionReplaceExistingData :
647                   public InteractionContinuation,
648                   public com::sun::star::lang::XTypeProvider,
649                   public com::sun::star::ucb::XInteractionReplaceExistingData
650 {
651 public:
InteractionReplaceExistingData(InteractionRequest * pRequest)652     InteractionReplaceExistingData( InteractionRequest * pRequest )
653     : InteractionContinuation( pRequest ) {}
654 
655     // XInterface
656     virtual com::sun::star::uno::Any SAL_CALL
657     queryInterface( const com::sun::star::uno::Type & rType );
658     virtual void SAL_CALL acquire()
659         throw();
660     virtual void SAL_CALL release()
661         throw();
662 
663     // XTypeProvider
664     virtual com::sun::star::uno::Sequence< com::sun::star::uno::Type > SAL_CALL
665     getTypes();
666     virtual com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL
667     getImplementationId();
668 
669     // XInteractionContinuation
670     virtual void SAL_CALL select();
671 };
672 
673 } // namespace ucbhelper
674 
675 #endif /* !_UCBHELPER_INTERATIONREQUEST_HXX */
676