22#include <osl/diagnose.h>
24#include <com/sun/star/awt/XWindow.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
27#include <com/sun/star/lang/XInitialization.hpp>
28#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <com/sun/star/task/XInteractionHandler2.hpp>
30#include <com/sun/star/uno/RuntimeException.hpp>
42class UUIInteractionHandler:
43 public cppu::WeakImplHelper<css::lang::XServiceInfo,
44 css::lang::XInitialization,
45 css::task::XInteractionHandler2,
46 css::beans::XPropertySet>
52 explicit UUIInteractionHandler(css::uno::Reference< css::uno::XComponentContext >
const & rxContext);
54 UUIInteractionHandler(
const UUIInteractionHandler&) =
delete;
55 UUIInteractionHandler& operator=(
const UUIInteractionHandler&) =
delete;
61 virtual css::uno::Sequence< OUString > SAL_CALL
66 css::uno::Sequence< css::uno::Any >
const & rArguments)
override;
69 handle(css::uno::Reference< css::task::XInteractionRequest >
const & rRequest)
override;
73 const css::uno::Reference< css::task::XInteractionRequest >& Request
77 addPropertyChangeListener(
const OUString& ,
const css::uno::Reference< css::beans::XPropertyChangeListener >& )
override
79 throw css::uno::RuntimeException(
80 "UUIInteractionHandler addPropertyChangeListener is not supported");
84 removePropertyChangeListener(
const OUString& ,
const css::uno::Reference< css::beans::XPropertyChangeListener >& )
override
86 throw css::uno::RuntimeException(
87 "UUIInteractionHandler removePropertyChangeListener is not supported");
91 addVetoableChangeListener(
const OUString& ,
const css::uno::Reference< css::beans::XVetoableChangeListener >& )
override
93 throw css::uno::RuntimeException(
94 "UUIInteractionHandler addVetoableChangeListener is not supported");
98 removeVetoableChangeListener(
const OUString& ,
const css::uno::Reference< css::beans::XVetoableChangeListener >& )
override
100 throw css::uno::RuntimeException(
101 "UUIInteractionHandler removeVetoableChangeListener is not supported");
104 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL
105 getPropertySetInfo()
override
110 virtual void SAL_CALL
setPropertyValue(
const OUString& rPropertyName,
const css::uno::Any& rValue)
override
112 if (rPropertyName ==
"ParentWindow")
114 css::uno::Reference<css::awt::XWindow> xWindow;
116 m_pImpl.SetParentWindow(xWindow);
119 throw css::beans::UnknownPropertyException(rPropertyName);
122 virtual css::uno::Any SAL_CALL
getPropertyValue(
const OUString& rPropertyName)
override
124 if (rPropertyName ==
"ParentWindow")
128 throw css::beans::UnknownPropertyException(rPropertyName);
132UUIInteractionHandler::UUIInteractionHandler(
133 uno::Reference< uno::XComponentContext >
const & rxContext)
138OUString SAL_CALL UUIInteractionHandler::getImplementationName()
140 return "com.sun.star.comp.uui.UUIInteractionHandler";
144UUIInteractionHandler::supportsService(OUString
const & rServiceName)
149uno::Sequence< OUString > SAL_CALL
150UUIInteractionHandler::getSupportedServiceNames()
152 return {
"com.sun.star.task.InteractionHandler",
154 "com.sun.star.configuration.backend.InteractionHandler",
156 "com.sun.star.uui.InteractionHandler" };
160UUIInteractionHandler::initialize(
161 uno::Sequence< uno::Any >
const & rArguments)
167 uno::Reference< awt::XWindow > xWindow;
169 if (!((rArguments.getLength() == 1 && (rArguments[0] >>= xWindow)) ||
170 (rArguments.getLength() == 2 && (rArguments[0] >>= xWindow) &&
171 (rArguments[1] >>= aContext))))
176 OSL_VERIFY(
aProperties.get(
"Parent" ) >>= xWindow );
180 OSL_VERIFY(
aProperties.get(
"Context" ) >>= aContext );
184 m_pImpl.SetParentWindow(xWindow);
189UUIInteractionHandler::handle(
190 uno::Reference< task::XInteractionRequest >
const & rRequest)
194 m_pImpl.handleRequest(rRequest);
196 catch (uno::RuntimeException
const & ex)
199 throw css::lang::WrappedTargetRuntimeException(
ex.Message,
204sal_Bool SAL_CALL UUIInteractionHandler::handleInteractionRequest(
205 const uno::Reference< task::XInteractionRequest >& Request )
209 return m_pImpl.handleRequest( Request );
211 catch (uno::RuntimeException
const & ex)
214 throw css::lang::WrappedTargetRuntimeException(
ex.Message,
221extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
223 css::uno::XComponentContext *context,
224 css::uno::Sequence<css::uno::Any>
const &)
226 return cppu::acquire(
new UUIInteractionHandler(context));
PropertiesInfo aProperties
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_uui_UUIInteractionHandler_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
Any SAL_CALL getCaughtException()
void handleInteractionRequest(const uno::Reference< uno::XComponentContext > &xContext, const uno::Reference< task::XInteractionRequest > &xRequest)
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)