LibreOffice Module ucbhelper (master) 1
interactionrequest.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX
21#define INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX
22
23#include <config_options.h>
24#include <com/sun/star/lang/XTypeProvider.hpp>
25#include <com/sun/star/task/XInteractionRequest.hpp>
26#include <com/sun/star/task/XInteractionAbort.hpp>
27#include <com/sun/star/task/XInteractionRetry.hpp>
28#include <com/sun/star/task/XInteractionApprove.hpp>
29#include <com/sun/star/task/XInteractionDisapprove.hpp>
30#include <com/sun/star/ucb/XInteractionAuthFallback.hpp>
31#include <com/sun/star/ucb/XInteractionReplaceExistingData.hpp>
32#include <com/sun/star/ucb/XInteractionSupplyAuthentication2.hpp>
35#include <memory>
36
37namespace rtl { template <class reference_type> class Reference; }
38
39namespace ucbhelper {
40
41class InteractionContinuation;
42
43
44struct InteractionRequest_Impl;
45
66 public cppu::WeakImplHelper<css::task::XInteractionRequest>
67{
68 std::unique_ptr<InteractionRequest_Impl> m_pImpl;
69
70protected:
71 void setRequest( const css::uno::Any & rRequest );
72
74 virtual ~InteractionRequest() override;
75
76public:
82 InteractionRequest( const css::uno::Any & rRequest );
83
90 const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > & rContinuations );
91
92 // XInteractionRequest
93 virtual css::uno::Any SAL_CALL
94 getRequest() override;
95 virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL
96 getContinuations() override;
97
98 // Non-interface methods.
99
108
118 void
120 const rtl::Reference< InteractionContinuation > & rxSelection );
121};
122
123
134{
136
137protected:
145 void recordSelection();
146 virtual ~InteractionContinuation() override;
147
148public:
150};
151
152
160 public css::lang::XTypeProvider,
161 public css::task::XInteractionAbort
162{
163public:
165 : InteractionContinuation( pRequest ) {}
166
167 // XInterface
168 virtual css::uno::Any SAL_CALL
169 queryInterface( const css::uno::Type & rType ) override;
170 virtual void SAL_CALL acquire() noexcept override
171 { OWeakObject::acquire(); }
172 virtual void SAL_CALL release() noexcept override
173 { OWeakObject::release(); }
174
175 // XTypeProvider
176 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
177 getTypes() override;
178 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
179 getImplementationId() override;
180
181 // XInteractionContinuation
182 virtual void SAL_CALL select() override;
183};
184
185
193 public css::lang::XTypeProvider,
194 public css::task::XInteractionRetry
195{
196public:
198 : InteractionContinuation( pRequest ) {}
199
200 // XInterface
201 virtual css::uno::Any SAL_CALL
202 queryInterface( const css::uno::Type & rType ) override;
203 virtual void SAL_CALL acquire() noexcept override
204 { OWeakObject::acquire(); }
205 virtual void SAL_CALL release() noexcept override
206 { OWeakObject::release(); }
207
208 // XTypeProvider
209 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
210 getTypes() override;
211 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
212 getImplementationId() override;
213
214 // XInteractionContinuation
215 virtual void SAL_CALL select() override;
216};
217
218
225class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionApprove final : public InteractionContinuation,
226 public css::lang::XTypeProvider,
227 public css::task::XInteractionApprove
228{
229public:
230 InteractionApprove( InteractionRequest * pRequest )
231 : InteractionContinuation( pRequest ) {}
232
233 // XInterface
234 virtual css::uno::Any SAL_CALL
235 queryInterface( const css::uno::Type & rType ) override;
236 virtual void SAL_CALL acquire() noexcept override
237 { OWeakObject::acquire(); }
238 virtual void SAL_CALL release() noexcept override
239 { OWeakObject::release(); }
240
241 // XTypeProvider
242 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
243 getTypes() override;
244 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
245 getImplementationId() override;
246
247 // XInteractionContinuation
248 virtual void SAL_CALL select() override;
249};
250
251
258class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionDisapprove final : public InteractionContinuation,
259 public css::lang::XTypeProvider,
260 public css::task::XInteractionDisapprove
261{
262public:
263 InteractionDisapprove( InteractionRequest * pRequest )
264 : InteractionContinuation( pRequest ) {}
265
266 // XInterface
267 virtual css::uno::Any SAL_CALL
268 queryInterface( const css::uno::Type & rType ) override;
269 virtual void SAL_CALL acquire() noexcept override
270 { OWeakObject::acquire(); }
271 virtual void SAL_CALL release() noexcept override
272 { OWeakObject::release(); }
273
274 // XTypeProvider
275 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
276 getTypes() override;
277 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
278 getImplementationId() override;
279
280 // XInteractionContinuation
281 virtual void SAL_CALL select() override;
282};
283
284
291class UNLESS_MERGELIBS(UCBHELPER_DLLPUBLIC) InteractionSupplyAuthentication final :
292 public InteractionContinuation,
293 public css::lang::XTypeProvider,
294 public css::ucb::XInteractionSupplyAuthentication2
295{
296 css::uno::Sequence< css::ucb::RememberAuthentication >
297 m_aRememberPasswordModes;
298 css::uno::Sequence< css::ucb::RememberAuthentication >
299 m_aRememberAccountModes;
300 OUString m_aRealm;
301 OUString m_aUserName;
302 OUString m_aPassword;
303 css::ucb::RememberAuthentication m_eRememberPasswordMode;
304 css::ucb::RememberAuthentication m_eDefaultRememberPasswordMode;
305 css::ucb::RememberAuthentication m_eDefaultRememberAccountMode;
306 bool m_bCanSetRealm : 1;
307 bool m_bCanSetUserName : 1;
308 bool m_bCanSetPassword : 1;
309 bool m_bCanSetAccount : 1;
310 bool m_bCanUseSystemCredentials : 1;
311 bool m_bUseSystemCredentials : 1;
312
313public:
346 inline InteractionSupplyAuthentication(
347 InteractionRequest * pRequest,
348 bool bCanSetRealm,
349 bool bCanSetUserName,
350 bool bCanSetPassword,
351 bool bCanSetAccount,
352 const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberPasswordModes,
353 const css::ucb::RememberAuthentication eDefaultRememberPasswordMode,
354 const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberAccountModes,
355 const css::ucb::RememberAuthentication eDefaultRememberAccountMode,
356 bool bCanUseSystemCredentials );
357
358 // XInterface
359 virtual css::uno::Any SAL_CALL
360 queryInterface( const css::uno::Type & rType ) override;
361 virtual void SAL_CALL acquire() noexcept override
362 { OWeakObject::acquire(); }
363 virtual void SAL_CALL release() noexcept override
364 { OWeakObject::release(); }
365
366 // XTypeProvider
367 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
368 getTypes() override;
369 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
370 getImplementationId() override;
371
372 // XInteractionContinuation
373 virtual void SAL_CALL select() override;
374
375 // XInteractionSupplyAuthentication
376 virtual sal_Bool SAL_CALL
377 canSetRealm() override;
378 virtual void SAL_CALL
379 setRealm( const OUString& Realm ) override;
380
381 virtual sal_Bool SAL_CALL
382 canSetUserName() override;
383 virtual void SAL_CALL
384 setUserName( const OUString& UserName ) override;
385
386 virtual sal_Bool SAL_CALL
387 canSetPassword() override;
388 virtual void SAL_CALL
389 setPassword( const OUString& Password ) override;
390
391 virtual css::uno::Sequence<
392 css::ucb::RememberAuthentication > SAL_CALL
393 getRememberPasswordModes(
394 css::ucb::RememberAuthentication& Default ) override;
395 virtual void SAL_CALL
396 setRememberPassword( css::ucb::RememberAuthentication Remember ) override;
397
398 virtual sal_Bool SAL_CALL
399 canSetAccount() override;
400 virtual void SAL_CALL
401 setAccount( const OUString& Account ) override;
402
403 virtual css::uno::Sequence< css::ucb::RememberAuthentication > SAL_CALL
404 getRememberAccountModes(
405 css::ucb::RememberAuthentication& Default ) override;
406 virtual void SAL_CALL
407 setRememberAccount( css::ucb::RememberAuthentication Remember ) override;
408
409 // XInteractionSupplyAuthentication2
410 virtual sal_Bool SAL_CALL canUseSystemCredentials( sal_Bool& Default ) override;
411 virtual void SAL_CALL setUseSystemCredentials( sal_Bool UseSystemCredentials ) override;
412
413 // Non-interface methods.
414
421 const OUString & getRealm() const { return m_aRealm; }
422
429 const OUString & getUserName() const { return m_aUserName; }
430
437 const OUString & getPassword() const { return m_aPassword; }
438
445 const css::ucb::RememberAuthentication &
446 getRememberPasswordMode() const { return m_eRememberPasswordMode; }
447
448 bool getUseSystemCredentials() const { return m_bUseSystemCredentials; }
449};
450
451
452
453inline InteractionSupplyAuthentication::InteractionSupplyAuthentication(
454 InteractionRequest * pRequest,
455 bool bCanSetRealm,
456 bool bCanSetUserName,
457 bool bCanSetPassword,
458 bool bCanSetAccount,
459 const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberPasswordModes,
460 const css::ucb::RememberAuthentication eDefaultRememberPasswordMode,
461 const css::uno::Sequence< css::ucb::RememberAuthentication > & rRememberAccountModes,
462 const css::ucb::RememberAuthentication eDefaultRememberAccountMode,
463 bool bCanUseSystemCredentials )
464: InteractionContinuation( pRequest ),
465 m_aRememberPasswordModes( rRememberPasswordModes ),
466 m_aRememberAccountModes( rRememberAccountModes ),
467 m_eRememberPasswordMode( eDefaultRememberPasswordMode ),
468 m_eDefaultRememberPasswordMode( eDefaultRememberPasswordMode ),
469 m_eDefaultRememberAccountMode( eDefaultRememberAccountMode ),
470 m_bCanSetRealm( bCanSetRealm ),
471 m_bCanSetUserName( bCanSetUserName ),
472 m_bCanSetPassword( bCanSetPassword ),
473 m_bCanSetAccount( bCanSetAccount ),
474 m_bCanUseSystemCredentials( bCanUseSystemCredentials ),
475 m_bUseSystemCredentials( false )
476{
477}
478
479
488 public css::lang::XTypeProvider,
489 public css::ucb::XInteractionReplaceExistingData
490{
491public:
493 : InteractionContinuation( pRequest ) {}
494
495 // XInterface
496 virtual css::uno::Any SAL_CALL
497 queryInterface( const css::uno::Type & rType ) override;
498 virtual void SAL_CALL acquire() noexcept override
499 { OWeakObject::acquire(); }
500 virtual void SAL_CALL release() noexcept override
501 { OWeakObject::release(); }
502
503 // XTypeProvider
504 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
505 getTypes() override;
506 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
507 getImplementationId() override;
508
509 // XInteractionContinuation
510 virtual void SAL_CALL select() override;
511};
512
515 public css::ucb::XInteractionAuthFallback
516{
517 OUString m_aCode;
518
519public:
521 : InteractionContinuation( pRequest ) {}
522
523 // XInterface
524 virtual css::uno::Any SAL_CALL
525 queryInterface( const css::uno::Type & rType ) override;
526 virtual void SAL_CALL acquire() noexcept override
527 { OWeakObject::acquire(); }
528 virtual void SAL_CALL release() noexcept override
529 { OWeakObject::release(); }
530
531 // XInteractionContinuation
532 virtual void SAL_CALL select() override;
533
534 // XAuthFallback
535 virtual void SAL_CALL setCode( const OUString& code ) override;
537 const OUString& getCode() const;
538
539
540};
541
542
543} // namespace ucbhelper
544
545#endif /* ! INCLUDED_UCBHELPER_INTERACTIONREQUEST_HXX */
546
547/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class implements a standard interaction continuation, namely the interface XInteractionAbort.
virtual void SAL_CALL release() noexcept override
InteractionAbort(InteractionRequest *pRequest)
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL release() noexcept override
InteractionAuthFallback(InteractionRequest *pRequest)
virtual void SAL_CALL acquire() noexcept override
This class is the base for implementations of the interface XInteractionContinuation.
This class implements a standard interaction continuation, namely the interface XInteractionReplaceEx...
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
InteractionReplaceExistingData(InteractionRequest *pRequest)
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual void SAL_CALL acquire() noexcept override
virtual void SAL_CALL select() override
virtual void SAL_CALL release() noexcept override
void setSelection(const rtl::Reference< InteractionContinuation > &rxSelection)
This method sets a continuation for the request.
rtl::Reference< InteractionContinuation > const & getSelection() const
After passing this request to XInteractionHandler::handle, this method returns the continuation that ...
void setRequest(const css::uno::Any &rRequest)
virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() override
virtual ~InteractionRequest() override
void setContinuations(const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > &rContinuations)
This method sets the continuations for the request.
std::unique_ptr< InteractionRequest_Impl > m_pImpl
virtual css::uno::Any SAL_CALL getRequest() override
InteractionRequest(const css::uno::Any &rRequest)
Constructor.
This class implements a standard interaction continuation, namely the interface XInteractionRetry.
virtual void SAL_CALL release() noexcept override
InteractionRetry(InteractionRequest *pRequest)
virtual void SAL_CALL acquire() noexcept override
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
Reference
bool getPassword(const css::uno::Reference< css::task::XInteractionHandler > &xHandler, OUString &rOutPwd, bool bFirstTry, const OUString &rDocName)
OUString m_aPassword
unsigned char sal_Bool
#define UCBHELPER_DLLPUBLIC