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