LibreOffice Module ucbhelper (master)  1
interactionrequest.cxx
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 
21 /**************************************************************************
22  TODO
23  **************************************************************************
24 
25  *************************************************************************/
27 
28 #include <rtl/ref.hxx>
29 #include <osl/diagnose.h>
32 
33 using namespace com::sun::star;
34 using namespace ucbhelper;
35 
36 
37 // InteractionRequest Implementation.
38 
39 
40 namespace ucbhelper
41 {
42 
44 {
46  css::uno::Any m_aRequest;
47  css::uno::Sequence<
48  css::uno::Reference<
49  css::task::XInteractionContinuation > > m_aContinuations;
50 
52  explicit InteractionRequest_Impl( const uno::Any & rRequest )
53  : m_aRequest( rRequest ) {}
54 };
55 
56 }
57 
58 
59 InteractionRequest::InteractionRequest()
61 {
62 }
63 
64 
66 : m_pImpl( new InteractionRequest_Impl( rRequest ) )
67 {
68 }
69 
70 
71 // virtual
73 {
74 }
75 
76 
77 void InteractionRequest::setRequest( const uno::Any & rRequest )
78 {
79  m_pImpl->m_aRequest = rRequest;
80 }
81 
82 
84  const uno::Sequence< uno::Reference<
85  task::XInteractionContinuation > > & rContinuations )
86 {
87  m_pImpl->m_aContinuations = rContinuations;
88 }
89 
90 
93 {
94  return m_pImpl->m_xSelection;
95 }
96 
97 
99  const rtl::Reference< InteractionContinuation > & rxSelection )
100 {
101  m_pImpl->m_xSelection = rxSelection;
102 }
103 
104 
105 // XInterface methods.
106 
107 
108 // XInteractionRequest methods.
109 
110 
111 // virtual
113 {
114  return m_pImpl->m_aRequest;
115 }
116 
117 
118 // virtual
119 uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL
121 {
122  return m_pImpl->m_aContinuations;
123 }
124 
125 
126 // InteractionContinuation Implementation.
127 
128 
130  InteractionRequest * pRequest )
131 : m_pRequest( pRequest )
132 {
133 }
134 
135 
136 // virtual
138 {
139 }
140 
141 
143 {
144  m_pRequest->setSelection( this );
145 }
146 
147 
148 // InteractionAbort Implementation.
149 
150 
151 // XInterface methods.
152 
153 
154 // virtual
155 uno::Any SAL_CALL
157 {
158  uno::Any aRet = cppu::queryInterface( rType,
159  static_cast< lang::XTypeProvider * >( this ),
160  static_cast< task::XInteractionContinuation * >( this ),
161  static_cast< task::XInteractionAbort * >( this ) );
162 
163  return aRet.hasValue()
164  ? aRet : InteractionContinuation::queryInterface( rType );
165 }
166 
167 
168 // XTypeProvider methods.
169 
170 
171 // virtual
172 uno::Sequence< sal_Int8 > SAL_CALL InteractionAbort::getImplementationId()
173 {
174  return css::uno::Sequence<sal_Int8>();
175 }
176 
177 
178 // virtual
179 uno::Sequence< uno::Type > SAL_CALL InteractionAbort::getTypes()
180 {
181  static cppu::OTypeCollection s_aCollection(
184 
185  return s_aCollection.getTypes();
186 }
187 
188 
189 // XInteractionContinuation methods.
190 
191 
192 // virtual
194 {
195  recordSelection();
196 }
197 
198 
199 // InteractionRetry Implementation.
200 
201 
202 // XInterface methods.
203 
204 
205 // virtual
206 uno::Any SAL_CALL
208 {
209  uno::Any aRet = cppu::queryInterface( rType,
210  static_cast< lang::XTypeProvider * >( this ),
211  static_cast< task::XInteractionContinuation * >( this ),
212  static_cast< task::XInteractionRetry * >( this ) );
213 
214  return aRet.hasValue()
215  ? aRet : InteractionContinuation::queryInterface( rType );
216 }
217 
218 
219 // XTypeProvider methods.
220 
221 
222 // virtual
223 uno::Sequence< sal_Int8 > SAL_CALL InteractionRetry::getImplementationId()
224 {
225  return css::uno::Sequence<sal_Int8>();
226 }
227 
228 
229 // virtual
230 uno::Sequence< uno::Type > SAL_CALL InteractionRetry::getTypes()
231 {
232  static cppu::OTypeCollection s_aCollection(
235 
236  return s_aCollection.getTypes();
237 }
238 
239 
240 // XInteractionContinuation methods.
241 
242 
243 // virtual
245 {
246  recordSelection();
247 }
248 
249 
250 // InteractionApprove Implementation.
251 
252 
253 // XInterface methods.
254 
255 
256 // virtual
257 uno::Any SAL_CALL
258 InteractionApprove::queryInterface( const uno::Type & rType )
259 {
260  uno::Any aRet = cppu::queryInterface( rType,
261  static_cast< lang::XTypeProvider * >( this ),
262  static_cast< task::XInteractionContinuation * >( this ),
263  static_cast< task::XInteractionApprove * >( this ) );
264 
265  return aRet.hasValue()
266  ? aRet : InteractionContinuation::queryInterface( rType );
267 }
268 
269 
270 // XTypeProvider methods.
271 
272 
273 // virtual
274 uno::Sequence< sal_Int8 > SAL_CALL InteractionApprove::getImplementationId()
275 {
276  return css::uno::Sequence<sal_Int8>();
277 }
278 
279 
280 // virtual
281 uno::Sequence< uno::Type > SAL_CALL InteractionApprove::getTypes()
282 {
283  static cppu::OTypeCollection s_aCollection(
286 
287  return s_aCollection.getTypes();
288 }
289 
290 
291 // XInteractionContinuation methods.
292 
293 
294 // virtual
295 void SAL_CALL InteractionApprove::select()
296 {
297  recordSelection();
298 }
299 
300 
301 // InteractionDisapprove Implementation.
302 
303 
304 // XInterface methods.
305 
306 
307 // virtual
308 uno::Any SAL_CALL
309 InteractionDisapprove::queryInterface( const uno::Type & rType )
310 {
311  uno::Any aRet = cppu::queryInterface( rType,
312  static_cast< lang::XTypeProvider * >( this ),
313  static_cast< task::XInteractionContinuation * >( this ),
314  static_cast< task::XInteractionDisapprove * >( this ) );
315 
316  return aRet.hasValue()
317  ? aRet : InteractionContinuation::queryInterface( rType );
318 }
319 
320 
321 // XTypeProvider methods.
322 
323 
324 // virtual
325 uno::Sequence< sal_Int8 > SAL_CALL InteractionDisapprove::getImplementationId()
326 {
327  return css::uno::Sequence<sal_Int8>();
328 }
329 
330 
331 // virtual
332 uno::Sequence< uno::Type > SAL_CALL InteractionDisapprove::getTypes()
333 {
334  static cppu::OTypeCollection s_aCollection(
337 
338  return s_aCollection.getTypes();
339 }
340 
341 
342 // XInteractionContinuation methods.
343 
344 
345 // virtual
346 void SAL_CALL InteractionDisapprove::select()
347 {
348  recordSelection();
349 }
350 
351 
352 // InteractionSupplyAuthentication Implementation.
353 
354 
355 // XInterface methods.
356 
357 
358 // virtual
359 uno::Any SAL_CALL
360 InteractionSupplyAuthentication::queryInterface( const uno::Type & rType )
361 {
362  uno::Any aRet = cppu::queryInterface( rType,
363  static_cast< lang::XTypeProvider * >( this ),
364  static_cast< task::XInteractionContinuation * >( this ),
365  static_cast< ucb::XInteractionSupplyAuthentication * >( this ),
366  static_cast< ucb::XInteractionSupplyAuthentication2 * >( this ));
367 
368  return aRet.hasValue()
369  ? aRet : InteractionContinuation::queryInterface( rType );
370 }
371 
372 
373 // XTypeProvider methods.
374 
375 
376 // virtual
377 uno::Sequence< sal_Int8 > SAL_CALL
378 InteractionSupplyAuthentication::getImplementationId()
379 {
380  return css::uno::Sequence<sal_Int8>();
381 }
382 
383 
384 // virtual
385 uno::Sequence< uno::Type > SAL_CALL InteractionSupplyAuthentication::getTypes()
386 {
387  static cppu::OTypeCollection s_aCollection(
390 
391  return s_aCollection.getTypes();
392 }
393 
394 
395 // XInteractionContinuation methods.
396 
397 
398 // virtual
399 void SAL_CALL InteractionSupplyAuthentication::select()
400 {
401  recordSelection();
402 }
403 
404 
405 // XInteractionSupplyAuthentication methods.
406 
407 
408 // virtual
409 sal_Bool SAL_CALL
410 InteractionSupplyAuthentication::canSetRealm()
411 {
412  return m_bCanSetRealm;
413 }
414 
415 
416 // virtual
417 void SAL_CALL
418 InteractionSupplyAuthentication::setRealm( const OUString& Realm )
419 {
420  OSL_ENSURE( m_bCanSetPassword,
421  "InteractionSupplyAuthentication::setRealm - Not supported!" );
422 
423  if ( m_bCanSetRealm )
424  m_aRealm = Realm;
425 }
426 
427 
428 // virtual
429 sal_Bool SAL_CALL
430 InteractionSupplyAuthentication::canSetUserName()
431 {
432  return m_bCanSetUserName;
433 }
434 
435 
436 // virtual
437 void SAL_CALL
438 InteractionSupplyAuthentication::setUserName( const OUString& UserName )
439 {
440  OSL_ENSURE( m_bCanSetUserName,
441  "InteractionSupplyAuthentication::setUserName - Not supported!" );
442 
443  if ( m_bCanSetUserName )
444  m_aUserName = UserName;
445 }
446 
447 
448 // virtual
449 sal_Bool SAL_CALL
450 InteractionSupplyAuthentication::canSetPassword()
451 {
452  return m_bCanSetPassword;
453 }
454 
455 
456 // virtual
457 void SAL_CALL
458 InteractionSupplyAuthentication::setPassword( const OUString& Password )
459 {
460  OSL_ENSURE( m_bCanSetPassword,
461  "InteractionSupplyAuthentication::setPassword - Not supported!" );
462 
463  if ( m_bCanSetPassword )
464  m_aPassword = Password;
465 }
466 
467 
468 // virtual
469 uno::Sequence< ucb::RememberAuthentication > SAL_CALL
470 InteractionSupplyAuthentication::getRememberPasswordModes(
471  ucb::RememberAuthentication& Default )
472 {
473  Default = m_eDefaultRememberPasswordMode;
474  return m_aRememberPasswordModes;
475 }
476 
477 
478 // virtual
479 void SAL_CALL
480 InteractionSupplyAuthentication::setRememberPassword(
481  ucb::RememberAuthentication Remember )
482 {
483  m_eRememberPasswordMode = Remember;
484 }
485 
486 
487 // virtual
488 sal_Bool SAL_CALL
489 InteractionSupplyAuthentication::canSetAccount()
490 {
491  return m_bCanSetAccount;
492 }
493 
494 
495 // virtual
496 void SAL_CALL
497 InteractionSupplyAuthentication::setAccount( const OUString& /*Account*/ )
498 {
499  OSL_ENSURE( m_bCanSetAccount,
500  "InteractionSupplyAuthentication::setAccount - Not supported!" );
501 }
502 
503 
504 // virtual
505 uno::Sequence< ucb::RememberAuthentication > SAL_CALL
506 InteractionSupplyAuthentication::getRememberAccountModes(
507  ucb::RememberAuthentication& Default )
508 {
509  Default = m_eDefaultRememberAccountMode;
510  return m_aRememberAccountModes;
511 }
512 
513 
514 // virtual
515 void SAL_CALL InteractionSupplyAuthentication::setRememberAccount(
516  ucb::RememberAuthentication )
517 {
518 }
519 
520 
521 // XInteractionSupplyAuthentication2 methods.
522 
523 
524 // virtual
525 sal_Bool SAL_CALL
526 InteractionSupplyAuthentication::canUseSystemCredentials(
527  sal_Bool& Default )
528 {
529  Default = false;
530  return m_bCanUseSystemCredentials;
531 }
532 
533 
534 // virtual
535 void SAL_CALL InteractionSupplyAuthentication::setUseSystemCredentials(
536  sal_Bool UseSystemCredentials )
537 {
538  if ( m_bCanUseSystemCredentials )
539  m_bUseSystemCredentials = UseSystemCredentials;
540 }
541 
542 
543 // InteractionReplaceExistingData Implementation.
544 
545 
546 // XInterface methods.
547 
548 
549 // virtual
550 uno::Any SAL_CALL
552 {
553  uno::Any aRet = cppu::queryInterface( rType,
554  static_cast< lang::XTypeProvider * >( this ),
555  static_cast< task::XInteractionContinuation * >( this ),
556  static_cast< ucb::XInteractionReplaceExistingData * >( this ) );
557 
558  return aRet.hasValue()
559  ? aRet : InteractionContinuation::queryInterface( rType );
560 }
561 
562 
563 // XTypeProvider methods.
564 
565 
566 // virtual
567 uno::Sequence< sal_Int8 > SAL_CALL
569 {
570  return css::uno::Sequence<sal_Int8>();
571 }
572 
573 
574 // virtual
575 uno::Sequence< uno::Type > SAL_CALL InteractionReplaceExistingData::getTypes()
576 {
577  static cppu::OTypeCollection s_aCollection(
580 
581  return s_aCollection.getTypes();
582 }
583 
584 
585 // XInteractionContinuation methods.
586 
587 
588 // virtual
590 {
591  recordSelection();
592 }
593 
594 // InteractionAuthFallback Implementation
595 
596 // XInterface methods.
597 
598 // virtual
599 uno::Any SAL_CALL
601 {
602  uno::Any aRet = cppu::queryInterface( rType,
603  static_cast< task::XInteractionContinuation * >( this ),
604  static_cast< ucb::XInteractionAuthFallback * >( this ));
605 
606  return aRet.hasValue()
607  ? aRet : InteractionContinuation::queryInterface( rType );
608 }
609 
610 // XInteractionContinuation methods.
611 
612 // virtual
614 {
615  recordSelection();
616 }
617 
618 // XInteractionAuthFallback methods
619 
620 // virtual
621 void SAL_CALL InteractionAuthFallback::setCode( const OUString& code )
622 {
623  m_aCode = code;
624 }
625 
626 const OUString& InteractionAuthFallback::getCode() const
627 {
628  return m_aCode;
629 }
630 
631 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL select() override
bool hasValue()
void setContinuations(const css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > &rContinuations)
This method sets the continuations for the request.
virtual void SAL_CALL select() override
OUString m_aPassword
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual css::uno::Any SAL_CALL getRequest() override
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
void setSelection(const rtl::Reference< InteractionContinuation > &rxSelection)
This method sets a continuation for the request.
virtual void SAL_CALL setCode(const OUString &code) override
virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() override
void recordSelection()
This method marks this continuation as "selected" at the request it belongs to.
InteractionRequest_Impl(const uno::Any &rRequest)
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
unsigned char sal_Bool
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
InteractionContinuation(InteractionRequest *pRequest)
SQLCHAR SQLSMALLINT SQLCHAR * UserName
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > m_aContinuations
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
rtl::Reference< InteractionContinuation > const & getSelection() const
After passing this request to XInteractionHandler::handle, this method returns the continuation that ...
virtual void SAL_CALL select() override
virtual ~InteractionRequest() override
virtual void SAL_CALL select() override
css::uno::Sequence< css::uno::Type > SAL_CALL getTypes()
rtl::Reference< InteractionContinuation > m_xSelection
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
void setRequest(const css::uno::Any &rRequest)
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) SAL_OVERRIDE
std::unique_ptr< InteractionRequest_Impl > m_pImpl
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)