summaryrefslogtreecommitdiff
path: root/uui/source/iahndl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'uui/source/iahndl.cxx')
-rw-r--r--uui/source/iahndl.cxx55
1 files changed, 13 insertions, 42 deletions
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 127f7d42737c..e09256d9027e 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -34,6 +34,7 @@
#include "com/sun/star/task/ErrorCodeIOException.hpp"
#include "com/sun/star/task/ErrorCodeRequest.hpp"
#include "com/sun/star/task/FutureDocumentVersionProductUpdateRequest.hpp"
+#include "com/sun/star/task/InteractionHandler.hpp"
#include "com/sun/star/task/XInteractionAbort.hpp"
#include "com/sun/star/task/XInteractionApprove.hpp"
#include "com/sun/star/task/XInteractionAskLater.hpp"
@@ -72,6 +73,7 @@
#include "vcl/svapp.hxx"
#include "unotools/configmgr.hxx"
#include "toolkit/helper/vclunohelper.hxx"
+#include "comphelper/processfactory.hxx"
#include "comphelper/namedvaluecollection.hxx"
#include "typelib/typedescription.hxx"
#include "unotools/confignode.hxx"
@@ -99,6 +101,7 @@ using ::com::sun::star::task::FutureDocumentVersionProductUpdateRequest;
using ::com::sun::star::uno::XInterface;
using ::com::sun::star::lang::XInitialization;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::com::sun::star::task::InteractionHandler;
using ::com::sun::star::task::XInteractionHandler2;
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Any;
@@ -129,10 +132,12 @@ public:
UUIInteractionHelper::UUIInteractionHelper(
uno::Reference< lang::XMultiServiceFactory > const & rServiceFactory,
- uno::Sequence< uno::Any > const & rArguments)
+ uno::Reference< awt::XWindow > const & rxWindowParam,
+ const OUString & rContextParam)
SAL_THROW(()):
m_xServiceFactory(rServiceFactory),
- m_aProperties(rArguments)
+ m_xWindowParam(rxWindowParam),
+ m_aContextParam(rContextParam)
{
}
@@ -1092,58 +1097,24 @@ uno::Reference< awt::XWindow>
UUIInteractionHelper::getParentXWindow() const
SAL_THROW(())
{
- osl::MutexGuard aGuard(m_aPropertyMutex);
- ::comphelper::NamedValueCollection aProperties( m_aProperties );
- if ( aProperties.has( "Parent" ) )
- {
- uno::Reference< awt::XWindow > xWindow;
- OSL_VERIFY( aProperties.get( "Parent" ) >>= xWindow );
- return xWindow;
- }
- return 0;
+ return m_xWindowParam;
}
rtl::OUString
UUIInteractionHelper::getContextProperty()
SAL_THROW(())
{
- osl::MutexGuard aGuard(m_aPropertyMutex);
- for (sal_Int32 i = 0; i < m_aProperties.getLength(); ++i)
- {
- beans::PropertyValue aProperty;
- if ((m_aProperties[i] >>= aProperty) && aProperty.Name == "Context" )
- {
- rtl::OUString aContext;
- aProperty.Value >>= aContext;
- return aContext;
- }
- }
- return rtl::OUString();
+ return m_aContextParam;
}
uno::Reference< task::XInteractionHandler >
UUIInteractionHelper::getInteractionHandler()
SAL_THROW((uno::RuntimeException))
{
- uno::Reference< task::XInteractionHandler > xIH;
- try
- {
- xIH.set(m_xServiceFactory->createInstanceWithArguments(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.task.InteractionHandler")),
- m_aProperties),
- uno::UNO_QUERY);
- }
- catch (uno::Exception const &)
- {}
-
- if (!xIH.is())
- throw uno::RuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "unable to instanciate Interaction Handler service")),
- uno::Reference< uno::XInterface >());
+ uno::Reference< task::XInteractionHandler > xIH(
+ InteractionHandler::createWithParentAndContext(comphelper::getComponentContext(m_xServiceFactory),
+ m_xWindowParam, m_aContextParam),
+ UNO_QUERY_THROW);
return xIH;
}