fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / ucbhelper / source / provider / interactionrequest.cxx
blobc36c2a68ff6feeba3788dc7e65d9f3e5adc24509
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
21 /**************************************************************************
22 TODO
23 **************************************************************************
25 *************************************************************************/
26 #include <ucbhelper/interactionrequest.hxx>
28 #include <osl/mutex.hxx>
29 #include <osl/diagnose.h>
30 #include <cppuhelper/typeprovider.hxx>
31 #include <cppuhelper/queryinterface.hxx>
33 using namespace com::sun::star;
34 using namespace ucbhelper;
39 // InteractionRequest Implementation.
44 namespace ucbhelper
47 struct InteractionRequest_Impl
49 rtl::Reference< InteractionContinuation > m_xSelection;
50 com::sun::star::uno::Any m_aRequest;
51 com::sun::star::uno::Sequence<
52 com::sun::star::uno::Reference<
53 com::sun::star::task::XInteractionContinuation > > m_aContinuations;
55 InteractionRequest_Impl() {}
56 InteractionRequest_Impl( const uno::Any & rRequest )
57 : m_aRequest( rRequest ) {}
63 InteractionRequest::InteractionRequest()
64 : m_pImpl( new InteractionRequest_Impl )
69 InteractionRequest::InteractionRequest( const uno::Any & rRequest )
70 : m_pImpl( new InteractionRequest_Impl( rRequest ) )
75 // virtual
76 InteractionRequest::~InteractionRequest()
78 delete m_pImpl;
82 void InteractionRequest::setRequest( const uno::Any & rRequest )
84 m_pImpl->m_aRequest = rRequest;
88 void InteractionRequest::setContinuations(
89 const uno::Sequence< uno::Reference<
90 task::XInteractionContinuation > > & rContinuations )
92 m_pImpl->m_aContinuations = rContinuations;
96 rtl::Reference< InteractionContinuation >
97 InteractionRequest::getSelection() const
99 return m_pImpl->m_xSelection;
103 void InteractionRequest::setSelection(
104 const rtl::Reference< InteractionContinuation > & rxSelection )
106 m_pImpl->m_xSelection = rxSelection;
111 // XInterface methods.
115 // virtual
116 void SAL_CALL InteractionRequest::acquire()
117 throw()
119 OWeakObject::acquire();
123 // virtual
124 void SAL_CALL InteractionRequest::release()
125 throw()
127 OWeakObject::release();
131 // virtual
132 uno::Any SAL_CALL
133 InteractionRequest::queryInterface( const uno::Type & rType )
134 throw ( uno::RuntimeException, std::exception )
136 uno::Any aRet = cppu::queryInterface( rType,
137 static_cast< lang::XTypeProvider * >( this ),
138 static_cast< task::XInteractionRequest * >( this ) );
140 return aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType );
145 // XTypeProvider methods.
149 // virtual
150 uno::Sequence< sal_Int8 > SAL_CALL InteractionRequest::getImplementationId()
151 throw( uno::RuntimeException, std::exception )
153 return css::uno::Sequence<sal_Int8>();
157 // virtual
158 uno::Sequence< uno::Type > SAL_CALL InteractionRequest::getTypes()
159 throw( uno::RuntimeException, std::exception )
161 static cppu::OTypeCollection* pCollection = 0;
162 if ( !pCollection )
164 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
165 if ( !pCollection )
167 static cppu::OTypeCollection collection(
168 cppu::UnoType<lang::XTypeProvider>::get(),
169 cppu::UnoType<task::XInteractionRequest>::get() );
170 pCollection = &collection;
173 return (*pCollection).getTypes();
178 // XInteractionRequest methods.
182 // virtual
183 uno::Any SAL_CALL InteractionRequest::getRequest()
184 throw( uno::RuntimeException, std::exception )
186 return m_pImpl->m_aRequest;
190 // virtual
191 uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL
192 InteractionRequest::getContinuations()
193 throw( uno::RuntimeException, std::exception )
195 return m_pImpl->m_aContinuations;
201 // InteractionContinuation Implementation.
206 namespace ucbhelper
209 struct InteractionContinuation_Impl
211 InteractionRequest * m_pRequest;
213 InteractionContinuation_Impl( InteractionRequest * pRequest )
214 : m_pRequest( pRequest ) {}
220 InteractionContinuation::InteractionContinuation(
221 InteractionRequest * pRequest )
222 : m_pImpl( new InteractionContinuation_Impl( pRequest ) )
227 // virtual
228 InteractionContinuation::~InteractionContinuation()
230 delete m_pImpl;
234 void InteractionContinuation::recordSelection()
236 m_pImpl->m_pRequest->setSelection( this );
242 // InteractionAbort Implementation.
249 // XInterface methods.
253 // virtual
254 void SAL_CALL InteractionAbort::acquire()
255 throw()
257 OWeakObject::acquire();
261 // virtual
262 void SAL_CALL InteractionAbort::release()
263 throw()
265 OWeakObject::release();
269 // virtual
270 uno::Any SAL_CALL
271 InteractionAbort::queryInterface( const uno::Type & rType )
272 throw ( uno::RuntimeException, std::exception )
274 uno::Any aRet = cppu::queryInterface( rType,
275 static_cast< lang::XTypeProvider * >( this ),
276 static_cast< task::XInteractionContinuation * >( this ),
277 static_cast< task::XInteractionAbort * >( this ) );
279 return aRet.hasValue()
280 ? aRet : InteractionContinuation::queryInterface( rType );
285 // XTypeProvider methods.
289 // virtual
290 uno::Sequence< sal_Int8 > SAL_CALL InteractionAbort::getImplementationId()
291 throw( uno::RuntimeException, std::exception )
293 return css::uno::Sequence<sal_Int8>();
297 // virtual
298 uno::Sequence< uno::Type > SAL_CALL InteractionAbort::getTypes()
299 throw( uno::RuntimeException, std::exception )
301 static cppu::OTypeCollection* pCollection = 0;
302 if ( !pCollection )
304 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
305 if ( !pCollection )
307 static cppu::OTypeCollection collection(
308 cppu::UnoType<lang::XTypeProvider>::get(),
309 cppu::UnoType<task::XInteractionAbort>::get() );
310 pCollection = &collection;
313 return (*pCollection).getTypes();
318 // XInteractionContinuation methods.
322 // virtual
323 void SAL_CALL InteractionAbort::select()
324 throw( uno::RuntimeException, std::exception )
326 recordSelection();
332 // InteractionRetry Implementation.
339 // XInterface methods.
343 // virtual
344 void SAL_CALL InteractionRetry::acquire()
345 throw()
347 OWeakObject::acquire();
351 // virtual
352 void SAL_CALL InteractionRetry::release()
353 throw()
355 OWeakObject::release();
359 // virtual
360 uno::Any SAL_CALL
361 InteractionRetry::queryInterface( const uno::Type & rType )
362 throw ( uno::RuntimeException, std::exception )
364 uno::Any aRet = cppu::queryInterface( rType,
365 static_cast< lang::XTypeProvider * >( this ),
366 static_cast< task::XInteractionContinuation * >( this ),
367 static_cast< task::XInteractionRetry * >( this ) );
369 return aRet.hasValue()
370 ? aRet : InteractionContinuation::queryInterface( rType );
375 // XTypeProvider methods.
379 // virtual
380 uno::Sequence< sal_Int8 > SAL_CALL InteractionRetry::getImplementationId()
381 throw( uno::RuntimeException, std::exception )
383 return css::uno::Sequence<sal_Int8>();
387 // virtual
388 uno::Sequence< uno::Type > SAL_CALL InteractionRetry::getTypes()
389 throw( uno::RuntimeException, std::exception )
391 static cppu::OTypeCollection* pCollection = 0;
392 if ( !pCollection )
394 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
395 if ( !pCollection )
397 static cppu::OTypeCollection collection(
398 cppu::UnoType<lang::XTypeProvider>::get(),
399 cppu::UnoType<task::XInteractionRetry>::get() );
400 pCollection = &collection;
403 return (*pCollection).getTypes();
408 // XInteractionContinuation methods.
412 // virtual
413 void SAL_CALL InteractionRetry::select()
414 throw( uno::RuntimeException, std::exception )
416 recordSelection();
422 // InteractionApprove Implementation.
429 // XInterface methods.
433 // virtual
434 void SAL_CALL InteractionApprove::acquire()
435 throw()
437 OWeakObject::acquire();
441 // virtual
442 void SAL_CALL InteractionApprove::release()
443 throw()
445 OWeakObject::release();
449 // virtual
450 uno::Any SAL_CALL
451 InteractionApprove::queryInterface( const uno::Type & rType )
452 throw ( uno::RuntimeException, std::exception )
454 uno::Any aRet = cppu::queryInterface( rType,
455 static_cast< lang::XTypeProvider * >( this ),
456 static_cast< task::XInteractionContinuation * >( this ),
457 static_cast< task::XInteractionApprove * >( this ) );
459 return aRet.hasValue()
460 ? aRet : InteractionContinuation::queryInterface( rType );
465 // XTypeProvider methods.
469 // virtual
470 uno::Sequence< sal_Int8 > SAL_CALL InteractionApprove::getImplementationId()
471 throw( uno::RuntimeException, std::exception )
473 return css::uno::Sequence<sal_Int8>();
477 // virtual
478 uno::Sequence< uno::Type > SAL_CALL InteractionApprove::getTypes()
479 throw( uno::RuntimeException, std::exception )
481 static cppu::OTypeCollection* pCollection = 0;
482 if ( !pCollection )
484 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
485 if ( !pCollection )
487 static cppu::OTypeCollection collection(
488 cppu::UnoType<lang::XTypeProvider>::get(),
489 cppu::UnoType<task::XInteractionApprove>::get() );
490 pCollection = &collection;
493 return (*pCollection).getTypes();
498 // XInteractionContinuation methods.
502 // virtual
503 void SAL_CALL InteractionApprove::select()
504 throw( uno::RuntimeException, std::exception )
506 recordSelection();
512 // InteractionDisapprove Implementation.
519 // XInterface methods.
523 // virtual
524 void SAL_CALL InteractionDisapprove::acquire()
525 throw()
527 OWeakObject::acquire();
531 // virtual
532 void SAL_CALL InteractionDisapprove::release()
533 throw()
535 OWeakObject::release();
539 // virtual
540 uno::Any SAL_CALL
541 InteractionDisapprove::queryInterface( const uno::Type & rType )
542 throw ( uno::RuntimeException, std::exception )
544 uno::Any aRet = cppu::queryInterface( rType,
545 static_cast< lang::XTypeProvider * >( this ),
546 static_cast< task::XInteractionContinuation * >( this ),
547 static_cast< task::XInteractionDisapprove * >( this ) );
549 return aRet.hasValue()
550 ? aRet : InteractionContinuation::queryInterface( rType );
555 // XTypeProvider methods.
559 // virtual
560 uno::Sequence< sal_Int8 > SAL_CALL InteractionDisapprove::getImplementationId()
561 throw( uno::RuntimeException, std::exception )
563 return css::uno::Sequence<sal_Int8>();
567 // virtual
568 uno::Sequence< uno::Type > SAL_CALL InteractionDisapprove::getTypes()
569 throw( uno::RuntimeException, std::exception )
571 static cppu::OTypeCollection* pCollection = 0;
572 if ( !pCollection )
574 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
575 if ( !pCollection )
577 static cppu::OTypeCollection collection(
578 cppu::UnoType<lang::XTypeProvider>::get(),
579 cppu::UnoType<task::XInteractionDisapprove>::get() );
580 pCollection = &collection;
583 return (*pCollection).getTypes();
588 // XInteractionContinuation methods.
592 // virtual
593 void SAL_CALL InteractionDisapprove::select()
594 throw( uno::RuntimeException, std::exception )
596 recordSelection();
602 // InteractionSupplyAuthentication Implementation.
609 // XInterface methods.
613 // virtual
614 void SAL_CALL InteractionSupplyAuthentication::acquire()
615 throw()
617 OWeakObject::acquire();
621 // virtual
622 void SAL_CALL InteractionSupplyAuthentication::release()
623 throw()
625 OWeakObject::release();
629 // virtual
630 uno::Any SAL_CALL
631 InteractionSupplyAuthentication::queryInterface( const uno::Type & rType )
632 throw ( uno::RuntimeException, std::exception )
634 uno::Any aRet = cppu::queryInterface( rType,
635 static_cast< lang::XTypeProvider * >( this ),
636 static_cast< task::XInteractionContinuation * >( this ),
637 static_cast< ucb::XInteractionSupplyAuthentication * >( this ),
638 static_cast< ucb::XInteractionSupplyAuthentication2 * >( this ));
640 return aRet.hasValue()
641 ? aRet : InteractionContinuation::queryInterface( rType );
646 // XTypeProvider methods.
650 // virtual
651 uno::Sequence< sal_Int8 > SAL_CALL
652 InteractionSupplyAuthentication::getImplementationId()
653 throw( uno::RuntimeException, std::exception )
655 return css::uno::Sequence<sal_Int8>();
659 // virtual
660 uno::Sequence< uno::Type > SAL_CALL InteractionSupplyAuthentication::getTypes()
661 throw( uno::RuntimeException, std::exception )
663 static cppu::OTypeCollection* pCollection = 0;
664 if ( !pCollection )
666 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
667 if ( !pCollection )
669 static cppu::OTypeCollection collection(
670 cppu::UnoType<lang::XTypeProvider>::get(),
671 cppu::UnoType<ucb::XInteractionSupplyAuthentication2>::get() );
672 pCollection = &collection;
675 return (*pCollection).getTypes();
680 // XInteractionContinuation methods.
684 // virtual
685 void SAL_CALL InteractionSupplyAuthentication::select()
686 throw( uno::RuntimeException, std::exception )
688 recordSelection();
693 // XInteractionSupplyAuthentication methods.
697 // virtual
698 sal_Bool SAL_CALL
699 InteractionSupplyAuthentication::canSetRealm()
700 throw( uno::RuntimeException, std::exception )
702 return m_bCanSetRealm;
706 // virtual
707 void SAL_CALL
708 InteractionSupplyAuthentication::setRealm( const OUString& Realm )
709 throw( uno::RuntimeException, std::exception )
711 OSL_ENSURE( m_bCanSetPassword,
712 "InteractionSupplyAuthentication::setRealm - Not supported!" );
714 if ( m_bCanSetRealm )
715 m_aRealm = Realm;
719 // virtual
720 sal_Bool SAL_CALL
721 InteractionSupplyAuthentication::canSetUserName()
722 throw( uno::RuntimeException, std::exception )
724 return m_bCanSetUserName;
728 // virtual
729 void SAL_CALL
730 InteractionSupplyAuthentication::setUserName( const OUString& UserName )
731 throw( uno::RuntimeException, std::exception )
733 OSL_ENSURE( m_bCanSetUserName,
734 "InteractionSupplyAuthentication::setUserName - Not supported!" );
736 if ( m_bCanSetUserName )
737 m_aUserName = UserName;
741 // virtual
742 sal_Bool SAL_CALL
743 InteractionSupplyAuthentication::canSetPassword()
744 throw( uno::RuntimeException, std::exception )
746 return m_bCanSetPassword;
750 // virtual
751 void SAL_CALL
752 InteractionSupplyAuthentication::setPassword( const OUString& Password )
753 throw( uno::RuntimeException, std::exception )
755 OSL_ENSURE( m_bCanSetPassword,
756 "InteractionSupplyAuthentication::setPassword - Not supported!" );
758 if ( m_bCanSetPassword )
759 m_aPassword = Password;
763 // virtual
764 uno::Sequence< ucb::RememberAuthentication > SAL_CALL
765 InteractionSupplyAuthentication::getRememberPasswordModes(
766 ucb::RememberAuthentication& Default )
767 throw( uno::RuntimeException, std::exception )
769 Default = m_eDefaultRememberPasswordMode;
770 return m_aRememberPasswordModes;
774 // virtual
775 void SAL_CALL
776 InteractionSupplyAuthentication::setRememberPassword(
777 ucb::RememberAuthentication Remember )
778 throw( uno::RuntimeException, std::exception )
780 m_eRememberPasswordMode = Remember;
784 // virtual
785 sal_Bool SAL_CALL
786 InteractionSupplyAuthentication::canSetAccount()
787 throw( uno::RuntimeException, std::exception )
789 return m_bCanSetAccount;
793 // virtual
794 void SAL_CALL
795 InteractionSupplyAuthentication::setAccount( const OUString& Account )
796 throw( uno::RuntimeException, std::exception )
798 OSL_ENSURE( m_bCanSetAccount,
799 "InteractionSupplyAuthentication::setAccount - Not supported!" );
801 if ( m_bCanSetAccount )
802 m_aAccount = Account;
806 // virtual
807 uno::Sequence< ucb::RememberAuthentication > SAL_CALL
808 InteractionSupplyAuthentication::getRememberAccountModes(
809 ucb::RememberAuthentication& Default )
810 throw( uno::RuntimeException, std::exception )
812 Default = m_eDefaultRememberAccountMode;
813 return m_aRememberAccountModes;
817 // virtual
818 void SAL_CALL InteractionSupplyAuthentication::setRememberAccount(
819 ucb::RememberAuthentication Remember )
820 throw( uno::RuntimeException, std::exception )
822 m_eRememberAccountMode = Remember;
827 // XInteractionSupplyAuthentication2 methods.
831 // virtual
832 sal_Bool SAL_CALL
833 InteractionSupplyAuthentication::canUseSystemCredentials(
834 sal_Bool& Default )
835 throw ( uno::RuntimeException, std::exception )
837 Default = m_bDefaultUseSystemCredentials;
838 return m_bCanUseSystemCredentials;
842 // virtual
843 void SAL_CALL InteractionSupplyAuthentication::setUseSystemCredentials(
844 sal_Bool UseSystemCredentials )
845 throw ( uno::RuntimeException, std::exception )
847 if ( m_bCanUseSystemCredentials )
848 m_bUseSystemCredentials = UseSystemCredentials;
855 // InteractionReplaceExistingData Implementation.
862 // XInterface methods.
866 // virtual
867 void SAL_CALL InteractionReplaceExistingData::acquire()
868 throw()
870 OWeakObject::acquire();
874 // virtual
875 void SAL_CALL InteractionReplaceExistingData::release()
876 throw()
878 OWeakObject::release();
882 // virtual
883 uno::Any SAL_CALL
884 InteractionReplaceExistingData::queryInterface( const uno::Type & rType )
885 throw ( uno::RuntimeException, std::exception )
887 uno::Any aRet = cppu::queryInterface( rType,
888 static_cast< lang::XTypeProvider * >( this ),
889 static_cast< task::XInteractionContinuation * >( this ),
890 static_cast< ucb::XInteractionReplaceExistingData * >( this ) );
892 return aRet.hasValue()
893 ? aRet : InteractionContinuation::queryInterface( rType );
898 // XTypeProvider methods.
902 // virtual
903 uno::Sequence< sal_Int8 > SAL_CALL
904 InteractionReplaceExistingData::getImplementationId()
905 throw( uno::RuntimeException, std::exception )
907 return css::uno::Sequence<sal_Int8>();
911 // virtual
912 uno::Sequence< uno::Type > SAL_CALL InteractionReplaceExistingData::getTypes()
913 throw( uno::RuntimeException, std::exception )
915 static cppu::OTypeCollection* pCollection = 0;
916 if ( !pCollection )
918 osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() );
919 if ( !pCollection )
921 static cppu::OTypeCollection collection(
922 cppu::UnoType<lang::XTypeProvider>::get(),
923 cppu::UnoType<ucb::XInteractionReplaceExistingData>::get() );
924 pCollection = &collection;
927 return (*pCollection).getTypes();
932 // XInteractionContinuation methods.
936 // virtual
937 void SAL_CALL InteractionReplaceExistingData::select()
938 throw( uno::RuntimeException, std::exception )
940 recordSelection();
943 // InteractionAuthFallback Implementation
945 // XInterface methods.
947 // virtual
948 void SAL_CALL InteractionAuthFallback::acquire()
949 throw()
951 OWeakObject::acquire();
954 // virtual
955 void SAL_CALL InteractionAuthFallback::release()
956 throw()
958 OWeakObject::release();
961 // virtual
962 uno::Any SAL_CALL
963 InteractionAuthFallback::queryInterface( const uno::Type & rType )
964 throw ( uno::RuntimeException, std::exception )
966 uno::Any aRet = cppu::queryInterface( rType,
967 static_cast< task::XInteractionContinuation * >( this ),
968 static_cast< ucb::XInteractionAuthFallback * >( this ));
970 return aRet.hasValue()
971 ? aRet : InteractionContinuation::queryInterface( rType );
974 // XInteractionContinuation methods.
976 // virtual
977 void SAL_CALL InteractionAuthFallback::select()
978 throw( uno::RuntimeException, std::exception )
980 recordSelection();
983 // XInteractionAuthFallback methods
985 // virtual
986 void SAL_CALL InteractionAuthFallback::setCode( const OUString& code )
987 throw ( uno::RuntimeException, std::exception )
989 m_aCode = code;
992 // virtual
993 OUString SAL_CALL InteractionAuthFallback::getCode( )
994 throw ( uno::RuntimeException, std::exception )
996 return m_aCode;
999 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */