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 --- cui/source/dialogs/insdlg.cxx | 25 +++++++------------------ cui/source/options/webconninfo.cxx | 10 ++++------ 2 files changed, 11 insertions(+), 24 deletions(-) (limited to 'cui/source') diff --git a/cui/source/dialogs/insdlg.cxx b/cui/source/dialogs/insdlg.cxx index f0158b61ec1d..95b2eb13f0d5 100644 --- a/cui/source/dialogs/insdlg.cxx +++ b/cui/source/dialogs/insdlg.cxx @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include "insdlg.hxx" #include @@ -341,24 +341,13 @@ short SvInsertOleDlg::Execute() aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) ); aMedium[0].Value <<= ::rtl::OUString( aFileName ); - uno::Reference< task::XInteractionHandler > xInteraction; - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - xInteraction = uno::Reference< task::XInteractionHandler >( - xFactory->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), - uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + uno::Reference< task::XInteractionHandler > xInteraction( + task::InteractionHandler::createDefault(xContext), + uno::UNO_QUERY_THROW ); - if ( xInteraction.is() ) - { - aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ); - aMedium[1].Value <<= xInteraction; - } - else - { - OSL_FAIL( "Can not get InteractionHandler!\n" ); - aMedium.realloc( 1 ); - } + aMedium[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ) ); + aMedium[1].Value <<= xInteraction; // create object from media descriptor if ( bLink ) diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx index 0bfdd2527cbf..5b4ca5fcb09f 100644 --- a/cui/source/options/webconninfo.cxx +++ b/cui/source/options/webconninfo.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -187,9 +188,8 @@ void WebConnectionInfoDialog::FillPasswordList() if ( xMasterPasswd->isPersistentStoringAllowed() ) { uno::Reference< task::XInteractionHandler > xInteractionHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.task.InteractionHandler" ) ) ), - uno::UNO_QUERY_THROW ); + task::InteractionHandler::createDefault(comphelper::getProcessComponentContext()), + uno::UNO_QUERY_THROW); uno::Sequence< task::UrlRecord > aURLEntries = xMasterPasswd->getAllPersistent( xInteractionHandler ); sal_Int32 nCount = 0; @@ -297,9 +297,7 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl) uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest ); uno::Reference< task::XInteractionHandler > xInteractionHandler( - comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.task.InteractionHandler" ) ) ), + task::InteractionHandler::createDefault(comphelper::getProcessComponentContext()), uno::UNO_QUERY_THROW ); xInteractionHandler->handle( rRequest ); -- cgit