From c25cb8a641723ab098980bb842caf75c0dc9b059 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 2 Oct 2012 15:03:12 +0200 Subject: fdo#46808, Adapt task::InteractionHandler UNO service to new style Since we don't need to expose XInitialisation, we can make the new-style service implement XInteractionHandler2. Change-Id: Ib27beed1c12df17592c6472d6f58c233d2c41558 --- desktop/source/app/configinit.cxx | 15 +++------------ desktop/source/app/dispatchwatcher.cxx | 9 +++++---- .../source/deployment/gui/dp_gui_extensioncmdqueue.cxx | 6 ++---- desktop/source/deployment/gui/dp_gui_updatedialog.cxx | 15 +++++---------- 4 files changed, 15 insertions(+), 30 deletions(-) (limited to 'desktop') diff --git a/desktop/source/app/configinit.cxx b/desktop/source/app/configinit.cxx index 393a755ea96b..66b1c6e3d4d0 100644 --- a/desktop/source/app/configinit.cxx +++ b/desktop/source/app/configinit.cxx @@ -36,6 +36,7 @@ #include #include #include +#include // ---------------------------------------------------------------------------- @@ -45,7 +46,6 @@ using rtl::OUString; using uno::UNO_QUERY; // ---------------------------------------------------------------------------- -static char const CONFIGURATION_ERROR_HANDLER[] = "com.sun.star.configuration.backend.InteractionHandler"; // must be aligned with configmgr/source/misc/configinteractionhandler static char const CONFIG_ERROR_HANDLER[] = "configuration.interaction-handler"; @@ -164,17 +164,8 @@ void ConfigurationErrorHandler::deactivate() ConfigurationErrorHandler::InteractionHandler ConfigurationErrorHandler::getDefaultInteractionHandler() { - uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); - - OSL_ENSURE( xServiceManager.is(),"No ServiceManager set for ConfigurationErrorHandler"); - - InteractionHandler xHandler; - - if (xServiceManager.is()) - { - xHandler.set( xServiceManager->createInstance(k_ERRORHANDLER), UNO_QUERY ); - } - + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + InteractionHandler xHandler( com::sun::star::task::InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); return xHandler; } //------------------------------------------------------------------------------ diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 1ed73d59f48f..091d48465205 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include @@ -73,6 +73,7 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::view; +using namespace ::com::sun::star::task; namespace desktop { @@ -226,9 +227,9 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch } else { - Reference < com::sun::star::task::XInteractionHandler > xInteraction( - ::comphelper::getProcessServiceFactory()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.task.InteractionHandler")) ), - com::sun::star::uno::UNO_QUERY ); + Reference < XInteractionHandler > xInteraction( + InteractionHandler::createDefault(::comphelper::getProcessComponentContext()), + UNO_QUERY_THROW ); aArgs[1].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" )); aArgs[1].Value <<= xInteraction; diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 323778d4c642..b52478146734 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -50,6 +50,7 @@ #include "com/sun/star/deployment/UpdateInformationProvider.hpp" #include "com/sun/star/deployment/XPackage.hpp" +#include "com/sun/star/task/InteractionHandler.hpp" #include "com/sun/star/task/XAbortChannel.hpp" #include "com/sun/star/task/XInteractionAbort.hpp" #include "com/sun/star/task/XInteractionApprove.hpp" @@ -536,10 +537,7 @@ void ProgressCmdEnv::handle( uno::Reference< task::XInteractionRequest > const & handlerArgs[ 0 ] <<= beans::PropertyValue( OUSTR("Context"), -1, uno::Any( m_sTitle ), beans::PropertyState_DIRECT_VALUE ); - m_xHandler.set( m_xContext->getServiceManager() - ->createInstanceWithArgumentsAndContext( - OUSTR("com.sun.star.uui.InteractionHandler"), - handlerArgs, m_xContext ), uno::UNO_QUERY_THROW ); + m_xHandler.set( task::InteractionHandler::createWithParentAndContext(m_xContext, NULL, m_sTitle), uno::UNO_QUERY_THROW ); } m_xHandler->handle( xRequest ); } diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 88deb2042ad0..107e7b6017cd 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -66,6 +66,7 @@ #include "com/sun/star/lang/XSingleServiceFactory.hpp" #include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/system/SystemShellExecute.hpp" +#include "com/sun/star/task/InteractionHandler.hpp" #include "com/sun/star/task/XAbortChannel.hpp" #include "com/sun/star/task/XJob.hpp" #include "com/sun/star/ucb/CommandAbortedException.hpp" @@ -272,16 +273,10 @@ UpdateDialog::Thread::Thread( { if( m_context.is() ) { - uno::Reference< lang::XMultiComponentFactory > xServiceManager( m_context->getServiceManager() ); - - if( xServiceManager.is() ) - { - m_xInteractionHdl = uno::Reference< task::XInteractionHandler > ( - xServiceManager->createInstanceWithContext( OUSTR( "com.sun.star.task.InteractionHandler" ), m_context), - uno::UNO_QUERY ); - if ( m_xInteractionHdl.is() ) - m_updateInformation->setInteractionHandler( m_xInteractionHdl ); - } + m_xInteractionHdl = uno::Reference< task::XInteractionHandler > ( + task::InteractionHandler::createDefault(m_context), + uno::UNO_QUERY_THROW ); + m_updateInformation->setInteractionHandler( m_xInteractionHdl ); } } -- cgit