From f887a993954942de9ee05e0282303187b6a22534 Mon Sep 17 00:00:00 2001 From: Ivo Hinkelmann Date: Fri, 18 Sep 2009 08:24:29 +0000 Subject: CWS-TOOLING: integrate CWS tkr25 2009-09-01 14:44:57 +0200 tkr r275661 : #i104188# fixed linux build issue 2009-08-17 13:44:47 +0200 tkr r275048 : #104188# use XInitialization with custom interaction handler to provide parent window --- uui/source/iahndl.cxx | 29 ++++++++++++++++++++++++++++- uui/source/iahndl.hxx | 2 ++ 2 files changed, 30 insertions(+), 1 deletion(-) (limited to 'uui') diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx index 8ea299289986..996fd24e531d 100644 --- a/uui/source/iahndl.cxx +++ b/uui/source/iahndl.cxx @@ -107,6 +107,7 @@ #include "com/sun/star/uno/RuntimeException.hpp" #include "com/sun/star/xforms/InvalidDataOnSubmitException.hpp" #include +#include #include "vos/mutex.hxx" @@ -1370,6 +1371,23 @@ UUIInteractionHelper::handle_impl( Reference< uno::XInterface > xIfc = m_xServiceFactory->createInstance(aIt->ServiceName); + + Reference< com::sun::star::lang::XInitialization > xInitialization = + Reference< com::sun::star::lang::XInitialization >( xIfc, UNO_QUERY ); + + OSL_ENSURE( xInitialization.is(), "Custom Interactionhandler does not implement mandatory interface XInitialization!" ); + if (xInitialization.is()) + { + uno::Sequence< uno::Any > propertyValues(1); + beans::PropertyValue aProperty; + + aProperty.Name = rtl::OUString::createFromAscii( "Parent" ); + aProperty.Value <<= getParentXWindow(); + propertyValues[ 0 ] <<= aProperty; + + xInitialization->initialize(propertyValues); + } + Reference< task::XInteractionHandler2 > xInteractionHandler( xIfc, UNO_QUERY ); @@ -1502,6 +1520,15 @@ void UUIInteractionHelper::GetInteractionHandlerList(InteractionHandlerDataList } Window * UUIInteractionHelper::getParentProperty() SAL_THROW(()) +{ + star::uno::Reference< star::awt::XWindow > xWindow = getParentXWindow(); + if ( xWindow.is() ) + return VCLUnoHelper::GetWindow(xWindow); + + return 0; +} + +star::uno::Reference< ::com::sun::star::awt::XWindow> UUIInteractionHelper::getParentXWindow() SAL_THROW(()) { osl::MutexGuard aGuard(m_aPropertyMutex); for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i) @@ -1513,7 +1540,7 @@ Window * UUIInteractionHelper::getParentProperty() SAL_THROW(()) { star::uno::Reference< star::awt::XWindow > xWindow; aProperty.Value >>= xWindow; - return VCLUnoHelper::GetWindow(xWindow); + return xWindow; } } return 0; diff --git a/uui/source/iahndl.hxx b/uui/source/iahndl.hxx index dadac27b63a4..bea53e436c6d 100644 --- a/uui/source/iahndl.hxx +++ b/uui/source/iahndl.hxx @@ -177,6 +177,8 @@ private: Window * getParentProperty() SAL_THROW(()); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow> getParentXWindow() SAL_THROW(()); + rtl::OUString getContextProperty() SAL_THROW(()); bool -- cgit