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 #ifndef INCLUDED_COMPHELPER_INTERACTION_HXX
21 #define INCLUDED_COMPHELPER_INTERACTION_HXX
23 #include <comphelper/uno3.hxx>
24 #include <cppuhelper/implbase.hxx>
25 #include <com/sun/star/task/XInteractionApprove.hpp>
26 #include <com/sun/star/task/XInteractionDisapprove.hpp>
27 #include <com/sun/star/task/XInteractionAbort.hpp>
28 #include <com/sun/star/task/XInteractionRetry.hpp>
29 #include <com/sun/star/task/XInteractionPassword.hpp>
30 #include <com/sun/star/task/XInteractionRequest.hpp>
31 #include <comphelper/comphelperdllapi.h>
41 /** template for instantiating concrete interaction handlers<p/>
42 the template argument must be an interface derived from XInteractionContinuation
44 template <class INTERACTION
>
46 : public ::cppu::WeakImplHelper
< INTERACTION
>
49 OInteraction() : m_bSelected(false) {}
51 /// determines whether or not this handler was selected
52 bool wasSelected() const { return m_bSelected
; }
54 // XInteractionContinuation
55 virtual void SAL_CALL
select() override
;
57 bool m_bSelected
: 1; /// indicates if the select event occurred
61 template <class INTERACTION
>
62 void SAL_CALL OInteraction
< INTERACTION
>::select( )
68 //= OInteractionApprove
70 typedef OInteraction
< css::task::XInteractionApprove
> OInteractionApprove
;
73 //= OInteractionDisapprove
75 typedef OInteraction
< css::task::XInteractionDisapprove
> OInteractionDisapprove
;
80 typedef OInteraction
< css::task::XInteractionAbort
> OInteractionAbort
;
85 typedef OInteraction
< css::task::XInteractionRetry
> OInteractionRetry
;
88 //= OInteractionPassword
90 class COMPHELPER_DLLPUBLIC OInteractionPassword
: public OInteraction
< css::task::XInteractionPassword
>
93 OInteractionPassword( const OUString
& _rInitialPassword
)
94 :m_sPassword( _rInitialPassword
)
98 // XInteractionPassword
99 virtual void SAL_CALL
setPassword( const OUString
& Password
) override
;
100 virtual OUString SAL_CALL
getPassword( ) override
;
103 OUString m_sPassword
;
107 //= OInteractionRequest
109 typedef ::cppu::WeakImplHelper
< css::task::XInteractionRequest
110 > OInteractionRequest_Base
;
111 /** implements an interaction request (com.sun.star.task::XInteractionRequest)<p/>
112 at run time, you can freely add any interaction continuation objects
114 class COMPHELPER_DLLPUBLIC OInteractionRequest
: public OInteractionRequest_Base
117 m_aRequest
; /// the request we represent
118 std::vector
< css::uno::Reference
< css::task::XInteractionContinuation
> >
119 m_aContinuations
; /// all registered continuations
122 OInteractionRequest(const css::uno::Any
& _rRequestDescription
);
123 OInteractionRequest(const css::uno::Any
& rRequestDescription
,
124 std::vector
<css::uno::Reference
<css::task::XInteractionContinuation
>> const& rContinuations
);
126 /// add a new continuation
127 void addContinuation(const css::uno::Reference
< css::task::XInteractionContinuation
>& _rxContinuation
);
129 // XInteractionRequest
130 virtual css::uno::Any SAL_CALL
getRequest( ) override
;
131 virtual css::uno::Sequence
< css::uno::Reference
< css::task::XInteractionContinuation
> > SAL_CALL
getContinuations( ) override
;
134 } // namespace comphelper
137 #endif // INCLUDED_COMPHELPER_INTERACTION_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */