diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-02 15:03:12 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-04 14:42:52 +0200 |
commit | c25cb8a641723ab098980bb842caf75c0dc9b059 (patch) | |
tree | e264e2727309789e06147a7275b91abd05f9fcff /sfx2 | |
parent | 0f3f9cb63056715845d9c3565bde69470c73efb2 (diff) |
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
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/shutdownicon.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/bastyp/helper.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/control/templateremoteview.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/dialog/templateinfodlg.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/doc/docfile.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/doc/doctemplates.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/guisaveas.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 32 |
8 files changed, 38 insertions, 52 deletions
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 58925b5899be..96f19ec9100b 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -23,7 +23,7 @@ #include <osl/mutex.hxx> #include <svtools/imagemgr.hxx> #include <svtools/miscopt.hxx> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/frame/XNotifyingDispatch.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> @@ -439,8 +439,8 @@ IMPL_STATIC_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, EMPTYAR Sequence< PropertyValue > aArgs(3); Reference < com::sun::star::task::XInteractionHandler > xInteraction( - ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.task.InteractionHandler") ), - com::sun::star::uno::UNO_QUERY ); + task::InteractionHandler::createDefault(::comphelper::getProcessComponentContext()), + com::sun::star::uno::UNO_QUERY_THROW ); aArgs[0].Name = OUString("InteractionHandler"); aArgs[0].Value <<= xInteraction; diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx index a2656b7dc62b..248595c2a453 100644 --- a/sfx2/source/bastyp/helper.cxx +++ b/sfx2/source/bastyp/helper.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> #include <com/sun/star/ucb/IllegalIdentifierException.hpp> #include <com/sun/star/ucb/NameClash.hpp> @@ -168,9 +169,9 @@ uno::Sequence< OUString > SfxContentHelper::GetHelpTreeViewContents( const Strin StringList_Impl* pProperties = NULL; try { - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< task::XInteractionHandler > xInteractionHandler = uno::Reference< task::XInteractionHandler > ( - xFactory->createInstance( "com.sun.star.task.InteractionHandler" ), uno::UNO_QUERY ); + task::InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ), comphelper::getProcessComponentContext() ); uno::Reference< sdbc::XResultSet > xResultSet; @@ -252,9 +253,9 @@ String SfxContentHelper::GetActiveHelpString( const String& rURL ) String aRet; try { - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< task::XInteractionHandler > xInteractionHandler = uno::Reference< task::XInteractionHandler > ( - xFactory->createInstance( "com.sun.star.task.InteractionHandler" ), uno::UNO_QUERY ); + task::InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); ::ucbhelper::Content aCnt( rURL, new ::ucbhelper::CommandEnvironment( xInteractionHandler, uno::Reference< ucb::XProgressHandler >() ), comphelper::getProcessComponentContext() ); // open the "active help" stream uno::Reference< io::XInputStream > xStream = aCnt.openStream(); diff --git a/sfx2/source/control/templateremoteview.cxx b/sfx2/source/control/templateremoteview.cxx index ad414affbb71..40f9208d53ec 100644 --- a/sfx2/source/control/templateremoteview.cxx +++ b/sfx2/source/control/templateremoteview.cxx @@ -20,7 +20,7 @@ #include <ucbhelper/commandenvironment.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> @@ -52,9 +52,9 @@ TemplateRemoteView::TemplateRemoteView (Window *pParent, WinBits nWinStyle, bool mpItemView->SetColor(Color(COL_WHITE)); mpItemView->setChangeNameHdl(LINK(this,TemplateRemoteView,ChangeNameHdl)); - Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory(); + Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); Reference< XInteractionHandler > xGlobalInteractionHandler = Reference< XInteractionHandler >( - xFactory->createInstance("com.sun.star.task.InteractionHandler" ), UNO_QUERY ); + InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() ); } diff --git a/sfx2/source/dialog/templateinfodlg.cxx b/sfx2/source/dialog/templateinfodlg.cxx index 2a77bde0336c..06ecbbf661a4 100644 --- a/sfx2/source/dialog/templateinfodlg.cxx +++ b/sfx2/source/dialog/templateinfodlg.cxx @@ -19,7 +19,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> @@ -71,12 +71,12 @@ void SfxTemplateInfoDlg::loadDocument(const OUString &rURL) { assert(!rURL.isEmpty()); - uno::Reference<lang::XMultiServiceFactory> xContext(comphelper::getProcessServiceFactory()); + uno::Reference<uno::XComponentContext> xContext(comphelper::getProcessComponentContext()); try { uno::Reference<task::XInteractionHandler> xInteractionHandler( - xContext->createInstance("com.sun.star.task.InteractionHandler"), uno::UNO_QUERY ); + task::InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); uno::Sequence<beans::PropertyValue> aProps(1); aProps[0].Name = "InteractionHandler"; diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index db5887e4220f..666d37fd915d 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -21,7 +21,7 @@ #include "sfx2/signaturestate.hxx" #include <uno/mapping.hxx> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/ucb/XContent.hpp> #include <com/sun/star/container/XChild.hpp> @@ -2526,14 +2526,10 @@ SfxMedium::GetInteractionHandler() return pImp->xInteraction; // create default handler and cache it! - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - { - pImp->xInteraction = ::com::sun::star::uno::Reference< com::sun::star::task::XInteractionHandler >( xFactory->createInstance( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), ::com::sun::star::uno::UNO_QUERY ); - return pImp->xInteraction; - } - - return ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >(); + Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + pImp->xInteraction = Reference< task::XInteractionHandler >( + task::InteractionHandler::createDefault(xContext), UNO_QUERY_THROW ); + return pImp->xInteraction; } //---------------------------------------------------------------- diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx index 281e1c762e14..bb06eddb1587 100644 --- a/sfx2/source/doc/doctemplates.cxx +++ b/sfx2/source/doc/doctemplates.cxx @@ -152,7 +152,7 @@ typedef vector< NamePair_Impl* > NameList_Impl; typedef vector< GroupData_Impl* > GroupList_Impl; //============================================================================= -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> class TplTaskEnvironment : public ::cppu::WeakImplHelper1< ucb::XCommandEnvironment > @@ -389,12 +389,10 @@ public: //----------------------------------------------------------------------------- void SfxDocTplService_Impl::init_Impl() { - uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); - if ( xFactory.is() ) - { - uno::Reference < task::XInteractionHandler > xInteractionHandler( xFactory->createInstance( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), uno::UNO_QUERY ); - maCmdEnv = new TplTaskEnvironment( xInteractionHandler ); - } + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + uno::Reference < task::XInteractionHandler > xInteractionHandler( + task::InteractionHandler::createDefault(xContext), uno::UNO_QUERY_THROW ); + maCmdEnv = new TplTaskEnvironment( xInteractionHandler ); ::osl::ClearableMutexGuard aGuard( maMutex ); sal_Bool bIsInitialized = sal_False; diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 83eb28a3065f..7bbfd072422d 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -31,7 +31,7 @@ #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/document/XDocumentInfoSupplier.hpp> #include <com/sun/star/document/XDocumentInfo.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/util/DateTime.hpp> #include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> @@ -441,8 +441,7 @@ void ModelData_Impl::CheckInteractionHandler() try { m_aMediaDescrHM[ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("InteractionHandler")) ] <<= uno::Reference< task::XInteractionHandler >( - m_pOwner->GetServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), + task::InteractionHandler::createDefault(comphelper::getComponentContext(m_pOwner->GetServiceFactory())), uno::UNO_QUERY ); } catch( const uno::Exception& ) diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 443294aafafd..c6caa28ff4c3 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/document/XExporter.hpp> -#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/task/InteractionHandler.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <com/sun/star/frame/DocumentTemplates.hpp> @@ -554,28 +554,20 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq) SFX_REQUEST_ARG( rReq, pInteractionHandlerItem, SfxUnoAnyItem, SID_INTERACTIONHANDLER, sal_False ); if ( !pInteractionHandlerItem ) { - uno::Reference< task::XInteractionHandler > xInteract; - uno::Reference< lang::XMultiServiceFactory > xServiceManager = ::comphelper::getProcessServiceFactory(); - if( xServiceManager.is() ) - { - xInteract = Reference< XInteractionHandler >( - xServiceManager->createInstance( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), - UNO_QUERY ); - } + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + uno::Reference< task::XInteractionHandler > xInteract( + task::InteractionHandler::createDefault(xContext), + UNO_QUERY_THROW ); - OSL_ENSURE( xInteract.is(), "Can not retrieve default status indicator!\n" ); - if ( xInteract.is() ) + SfxUnoAnyItem aInteractionItem( SID_INTERACTIONHANDLER, uno::makeAny( xInteract ) ); + if ( nId == SID_SAVEDOC ) { - SfxUnoAnyItem aInteractionItem( SID_INTERACTIONHANDLER, uno::makeAny( xInteract ) ); - if ( nId == SID_SAVEDOC ) - { - // in case of saving it is not possible to transport the parameters from here - // but it is not clear here whether the saving will be done or saveAs operation - GetMedium()->GetItemSet()->Put( aInteractionItem ); - } - - rReq.AppendItem( aInteractionItem ); + // in case of saving it is not possible to transport the parameters from here + // but it is not clear here whether the saving will be done or saveAs operation + GetMedium()->GetItemSet()->Put( aInteractionItem ); } + + rReq.AppendItem( aInteractionItem ); } else if ( nId == SID_SAVEDOC ) { |