1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <ucbhelper/interactionrequest.hxx>
22 #include <rtl/ref.hxx>
23 #include <osl/diagnose.h>
24 #include <cppuhelper/typeprovider.hxx>
25 #include <cppuhelper/queryinterface.hxx>
28 using namespace com::sun::star
;
29 using namespace ucbhelper
;
32 // InteractionRequest Implementation.
38 struct InteractionRequest_Impl
40 rtl::Reference
< InteractionContinuation
> m_xSelection
;
41 css::uno::Any m_aRequest
;
44 css::task::XInteractionContinuation
> > m_aContinuations
;
46 InteractionRequest_Impl() {}
47 explicit InteractionRequest_Impl( uno::Any aRequest
)
48 : m_aRequest(std::move( aRequest
)) {}
54 InteractionRequest::InteractionRequest()
55 : m_pImpl( new InteractionRequest_Impl
)
60 InteractionRequest::InteractionRequest( const uno::Any
& rRequest
)
61 : m_pImpl( new InteractionRequest_Impl( rRequest
) )
67 InteractionRequest::~InteractionRequest()
72 void InteractionRequest::setRequest( const uno::Any
& rRequest
)
74 m_pImpl
->m_aRequest
= rRequest
;
78 void InteractionRequest::setContinuations(
79 const uno::Sequence
< uno::Reference
<
80 task::XInteractionContinuation
> > & rContinuations
)
82 m_pImpl
->m_aContinuations
= rContinuations
;
86 rtl::Reference
< InteractionContinuation
> const &
87 InteractionRequest::getSelection() const
89 return m_pImpl
->m_xSelection
;
93 void InteractionRequest::setSelection(
94 const rtl::Reference
< InteractionContinuation
> & rxSelection
)
96 m_pImpl
->m_xSelection
= rxSelection
;
100 // XInterface methods.
103 // XInteractionRequest methods.
107 uno::Any SAL_CALL
InteractionRequest::getRequest()
109 return m_pImpl
->m_aRequest
;
114 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > SAL_CALL
115 InteractionRequest::getContinuations()
117 return m_pImpl
->m_aContinuations
;
121 // InteractionContinuation Implementation.
124 InteractionContinuation::InteractionContinuation(
125 InteractionRequest
* pRequest
)
126 : m_pRequest( pRequest
)
132 InteractionContinuation::~InteractionContinuation()
137 void InteractionContinuation::recordSelection()
139 m_pRequest
->setSelection( this );
143 // InteractionAbort Implementation.
146 // XInteractionContinuation methods.
150 void SAL_CALL
InteractionAbort::select()
156 // InteractionRetry Implementation.
159 // XInteractionContinuation methods.
163 void SAL_CALL
InteractionRetry::select()
169 // InteractionApprove Implementation.
172 // XInteractionContinuation methods.
176 void SAL_CALL
InteractionApprove::select()
182 // InteractionDisapprove Implementation.
185 // XInteractionContinuation methods.
189 void SAL_CALL
InteractionDisapprove::select()
195 // InteractionSupplyAuthentication Implementation.
198 // XInteractionContinuation methods.
202 void SAL_CALL
InteractionSupplyAuthentication::select()
208 // XInteractionSupplyAuthentication methods.
213 InteractionSupplyAuthentication::canSetRealm()
215 return m_bCanSetRealm
;
221 InteractionSupplyAuthentication::setRealm( const OUString
& Realm
)
223 OSL_ENSURE( m_bCanSetPassword
,
224 "InteractionSupplyAuthentication::setRealm - Not supported!" );
226 if ( m_bCanSetRealm
)
233 InteractionSupplyAuthentication::canSetUserName()
235 return m_bCanSetUserName
;
241 InteractionSupplyAuthentication::setUserName( const OUString
& UserName
)
243 OSL_ENSURE( m_bCanSetUserName
,
244 "InteractionSupplyAuthentication::setUserName - Not supported!" );
246 if ( m_bCanSetUserName
)
247 m_aUserName
= UserName
;
253 InteractionSupplyAuthentication::canSetPassword()
255 return m_bCanSetPassword
;
261 InteractionSupplyAuthentication::setPassword( const OUString
& Password
)
263 OSL_ENSURE( m_bCanSetPassword
,
264 "InteractionSupplyAuthentication::setPassword - Not supported!" );
266 if ( m_bCanSetPassword
)
267 m_aPassword
= Password
;
272 uno::Sequence
< ucb::RememberAuthentication
> SAL_CALL
273 InteractionSupplyAuthentication::getRememberPasswordModes(
274 ucb::RememberAuthentication
& Default
)
276 Default
= m_eDefaultRememberPasswordMode
;
277 return m_aRememberPasswordModes
;
283 InteractionSupplyAuthentication::setRememberPassword(
284 ucb::RememberAuthentication Remember
)
286 m_eRememberPasswordMode
= Remember
;
292 InteractionSupplyAuthentication::canSetAccount()
294 return m_bCanSetAccount
;
300 InteractionSupplyAuthentication::setAccount( const OUString
& /*Account*/ )
302 OSL_ENSURE( m_bCanSetAccount
,
303 "InteractionSupplyAuthentication::setAccount - Not supported!" );
308 uno::Sequence
< ucb::RememberAuthentication
> SAL_CALL
309 InteractionSupplyAuthentication::getRememberAccountModes(
310 ucb::RememberAuthentication
& Default
)
312 Default
= m_eDefaultRememberAccountMode
;
313 return m_aRememberAccountModes
;
318 void SAL_CALL
InteractionSupplyAuthentication::setRememberAccount(
319 ucb::RememberAuthentication
)
324 // XInteractionSupplyAuthentication2 methods.
329 InteractionSupplyAuthentication::canUseSystemCredentials(
333 return m_bCanUseSystemCredentials
;
338 void SAL_CALL
InteractionSupplyAuthentication::setUseSystemCredentials(
339 sal_Bool UseSystemCredentials
)
341 if ( m_bCanUseSystemCredentials
)
342 m_bUseSystemCredentials
= UseSystemCredentials
;
346 // InteractionReplaceExistingData Implementation.
349 // XInteractionContinuation methods.
353 void SAL_CALL
InteractionReplaceExistingData::select()
358 // InteractionAuthFallback Implementation
360 // XInteractionContinuation methods.
363 void SAL_CALL
InteractionAuthFallback::select()
368 // XInteractionAuthFallback methods
371 void SAL_CALL
InteractionAuthFallback::setCode( const OUString
& code
)
376 const OUString
& InteractionAuthFallback::getCode() const
381 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */