diff options
author | Noel Grandin <noel@peralex.com> | 2012-06-01 15:15:25 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-06 10:53:34 +0200 |
commit | 0fcd1a73f0e1ec564f3c6da1ccd890183d3c18db (patch) | |
tree | 3895ecd6f804b8f3ef3a8f03f1739e17918feeef | |
parent | 8a95074eaefd01621dc55db8567b19c8e6157f95 (diff) |
fdo#46808, Adapt UNO services to new style, Part 7, updating ::create
Update code to use factory method URLTransformer::create
Change-Id: I3fd2e838497bcfd8fc949615c0e7d60a6ea47118
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, added some tweaks.
84 files changed, 339 insertions, 395 deletions
diff --git a/UnoControls/Library_ctl.mk b/UnoControls/Library_ctl.mk index 9e7fc16f6d70..1bedad8f1fcc 100644 --- a/UnoControls/Library_ctl.mk +++ b/UnoControls/Library_ctl.mk @@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_api,ctl,\ )) $(eval $(call gb_Library_use_libraries,ctl,\ + comphelper \ cppu \ cppuhelper \ sal \ diff --git a/UnoControls/source/controls/framecontrol.cxx b/UnoControls/source/controls/framecontrol.cxx index 0504a11a354a..1f9838cda3f8 100644 --- a/UnoControls/source/controls/framecontrol.cxx +++ b/UnoControls/source/controls/framecontrol.cxx @@ -37,10 +37,12 @@ // includes of other projects //______________________________________________________________________________________________________________ #include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <comphelper/componentcontext.hxx> #include <cppuhelper/typeprovider.hxx> #include <osl/diagnose.h> @@ -497,20 +499,19 @@ void FrameControl::impl_createFrame( const Reference< XWindowPeer >& xPee // option //xFrame->setName( "WhatYouWant" ); - Reference< XURLTransformer > xTrans ( impl_getMultiServiceFactory()->createInstance ( "com.sun.star.util.URLTransformer" ), UNO_QUERY ) ; - if(xTrans.is()) - { - // load file - URL aURL ; + Reference< XURLTransformer > xTrans ( + URLTransformer::create( + ::comphelper::ComponentContext( impl_getMultiServiceFactory() ).getUNOContext() ) ); + // load file + URL aURL ; - aURL.Complete = rURL ; - xTrans->parseStrict( aURL ) ; + aURL.Complete = rURL ; + xTrans->parseStrict( aURL ) ; - Reference< XDispatch > xDisp = xDSP->queryDispatch ( aURL, OUString (), FrameSearchFlag::SELF ) ; - if (xDisp.is()) - { - xDisp->dispatch ( aURL, rArguments ) ; - } + Reference< XDispatch > xDisp = xDSP->queryDispatch ( aURL, OUString (), FrameSearchFlag::SELF ) ; + if (xDisp.is()) + { + xDisp->dispatch ( aURL, rArguments ) ; } } diff --git a/chart2/source/controller/main/CommandDispatch.cxx b/chart2/source/controller/main/CommandDispatch.cxx index bf3d996b201b..8940686b12e8 100644 --- a/chart2/source/controller/main/CommandDispatch.cxx +++ b/chart2/source/controller/main/CommandDispatch.cxx @@ -30,6 +30,7 @@ #include "CommandDispatch.hxx" #include "CommonFunctors.hxx" #include "macros.hxx" +#include <com/sun/star/util/URLTransformer.hpp> #include <algorithm> #include <functional> @@ -155,14 +156,9 @@ void CommandDispatch::fireStatusEventForURL( aURL.Complete = rURL; if( !m_xURLTransformer.is()) { - m_xURLTransformer.set( - m_xContext->getServiceManager()->createInstanceWithContext( - C2U( "com.sun.star.util.URLTransformer" ), - m_xContext ), - uno::UNO_QUERY ); + m_xURLTransformer.set( util::URLTransformer::create(m_xContext) ); } - if( m_xURLTransformer.is()) - m_xURLTransformer->parseStrict( aURL ); + m_xURLTransformer->parseStrict( aURL ); frame::FeatureStateEvent aEventToSend( static_cast< cppu::OWeakObject* >( this ), // Source diff --git a/cui/source/options/optupdt.cxx b/cui/source/options/optupdt.cxx index 28d20f1c2b70..ebcfc740d249 100644 --- a/cui/source/options/optupdt.cxx +++ b/cui/source/options/optupdt.cxx @@ -34,6 +34,7 @@ #include "optupdt.hrc" #include <dialmgr.hxx> #include <cuires.hrc> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -42,6 +43,7 @@ #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/util/XChangesBatch.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <osl/file.hxx> #include <osl/security.hxx> @@ -362,8 +364,7 @@ IMPL_LINK_NOARG(SvxOnlineUpdateTabPage, CheckNowHdl_Impl) xNameAccess->getByName(UNISTRING("URL")) >>= aURL.Complete; uno::Reference < util::XURLTransformer > xTransformer( - xFactory->createInstance( UNISTRING( "com.sun.star.util.URLTransformer" ) ), - uno::UNO_QUERY_THROW ); + util::URLTransformer::create( comphelper::getProcessComponentContext() ) ); xTransformer->parseStrict(aURL); diff --git a/dbaccess/source/core/dataaccess/documenteventexecutor.cxx b/dbaccess/source/core/dataaccess/documenteventexecutor.cxx index df1a60f5a34b..413bc6eef8a2 100644 --- a/dbaccess/source/core/dataaccess/documenteventexecutor.cxx +++ b/dbaccess/source/core/dataaccess/documenteventexecutor.cxx @@ -30,6 +30,7 @@ /** === begin UNO includes === **/ #include <com/sun/star/document/XDocumentEventBroadcaster.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -62,6 +63,7 @@ namespace dbaccess using ::com::sun::star::document::XEventsSupplier; using ::com::sun::star::container::XNameAccess; using ::com::sun::star::frame::XModel; + using ::com::sun::star::util::URLTransformer; using ::com::sun::star::util::XURLTransformer; using ::com::sun::star::frame::XDispatchProvider; using ::com::sun::star::frame::XDispatch; @@ -144,7 +146,7 @@ namespace dbaccess try { - _rContext.createComponent( "com.sun.star.util.URLTransformer", m_pData->xURLTransformer ); + m_pData->xURLTransformer = URLTransformer::create(_rContext.getUNOContext()); } catch( const Exception& ) { diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index df140ed3e71d..8291bcbf161a 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -53,6 +53,7 @@ #include <com/sun/star/sdb/XDocumentDataSource.hpp> #include <com/sun/star/task/XJobExecutor.hpp> #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/sdb/application/DatabaseObjectContainer.hpp> @@ -340,14 +341,11 @@ namespace bool bDoesAllow = sal_False; try { - Reference< XURLTransformer > xTransformer; - if ( _rContext.createComponent( "com.sun.star.util.URLTransformer", xTransformer ) ) - { - URL aURL; - aURL.Complete = _rURL; - xTransformer->parseStrict( aURL ); - bDoesAllow = aURL.Arguments == "Interactive"; - } + Reference< XURLTransformer > xTransformer( URLTransformer::create(_rContext.getUNOContext()) ); + URL aURL; + aURL.Complete = _rURL; + xTransformer->parseStrict( aURL ); + bDoesAllow = aURL.Arguments == "Interactive"; } catch( const Exception& ) { diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 4283d7eed180..7652b5847a2e 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -37,6 +37,7 @@ #include <osl/diagnose.h> #include "dbustrings.hrc" #include <vcl/stdtext.hxx> +#include <comphelper/componentcontext.hxx> #include <cppuhelper/typeprovider.hxx> #include <framework/titlehelper.hxx> #include <comphelper/sequence.hxx> @@ -46,6 +47,7 @@ #include <com/sun/star/sdb/XCompletedConnection.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XCloseable.hpp> #include "UITools.hxx" #include "commontypes.hxx" @@ -206,7 +208,7 @@ OGenericUnoController::OGenericUnoController(const Reference< XMultiServiceFacto try { - m_xUrlTransformer = Reference< XURLTransformer > (_rM->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY); + m_xUrlTransformer = URLTransformer::create(comphelper::ComponentContext(_rM).getUNOContext()); } catch(Exception&) { diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 7f037c11a7e7..7374ea322f2e 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -50,6 +50,7 @@ #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/view/XPrintable.hpp> #include <com/sun/star/awt/XTopWindow.hpp> +#include "com/sun/star/util/URLTransformer.hpp" #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -1186,20 +1187,18 @@ sal_Bool impl_callRecoveryUI(sal_Bool bEmergencySave , sal_Bool bExistsRecoveryData) { static ::rtl::OUString SERVICENAME_RECOVERYUI("com.sun.star.comp.svx.RecoveryUI"); - static ::rtl::OUString SERVICENAME_URLPARSER("com.sun.star.util.URLTransformer"); static ::rtl::OUString COMMAND_EMERGENCYSAVE("vnd.sun.star.autorecovery:/doEmergencySave"); static ::rtl::OUString COMMAND_RECOVERY("vnd.sun.star.autorecovery:/doAutoRecovery"); static ::rtl::OUString COMMAND_CRASHREPORT("vnd.sun.star.autorecovery:/doCrashReport"); css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - css::uno::Reference< css::frame::XSynchronousDispatch > xRecoveryUI( + Reference< css::frame::XSynchronousDispatch > xRecoveryUI( xSMGR->createInstance(SERVICENAME_RECOVERYUI), css::uno::UNO_QUERY_THROW); - css::uno::Reference< css::util::XURLTransformer > xURLParser( - xSMGR->createInstance(SERVICENAME_URLPARSER), - css::uno::UNO_QUERY_THROW); + Reference< css::util::XURLTransformer > xURLParser( + css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); css::util::URL aURL; if (bEmergencySave) @@ -2459,9 +2458,7 @@ void Desktop::OpenClients() ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.frame.AutoRecovery") ), ::com::sun::star::uno::UNO_QUERY_THROW ); - Reference< XURLTransformer > xParser( - ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.util.URLTransformer") ), - ::com::sun::star::uno::UNO_QUERY_THROW ); + Reference< css::util::XURLTransformer > xParser( css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); css::util::URL aCmd; aCmd.Complete = ::rtl::OUString("vnd.sun.star.autorecovery:/disableRecovery"); @@ -2886,9 +2883,9 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) // The user will try it again, in case nothing happens .-) try { - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); + Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory(); - com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > + Reference< css::frame::XDispatchProvider > xDesktop( xSMGR->createInstance( OUString("com.sun.star.frame.Desktop") ), ::com::sun::star::uno::UNO_QUERY ); @@ -2896,7 +2893,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent ) if ( ! xDesktop.is()) return; - css::uno::Reference< css::util::XURLTransformer > xParser(xSMGR->createInstance(rtl::OUString("com.sun.star.util.URLTransformer")), css::uno::UNO_QUERY_THROW); + Reference< css::util::XURLTransformer > xParser( css::util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); css::util::URL aCommand; if( rAppEvent.GetData() == ::rtl::OUString("PREFERENCES") ) aCommand.Complete = rtl::OUString( ".uno:OptionsTreeDialog" ); diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 7536a90c607e..b2c817d71e3f 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/view/XPrintable.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/document/UpdateDocMode.hpp> @@ -284,7 +285,7 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch Reference < XDispatch > xDispatcher ; Reference < XDispatchProvider > xProvider ( xDesktop, UNO_QUERY ); - Reference < XURLTransformer > xParser ( ::comphelper::getProcessServiceFactory()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer")) ), ::com::sun::star::uno::UNO_QUERY ); + Reference < XURLTransformer > xParser ( URLTransformer::create(::comphelper::getProcessComponentContext()) ); if( xParser.is() == sal_True ) xParser->parseStrict( aURL ); @@ -314,7 +315,7 @@ sal_Bool DispatchWatcher::executeDispatchRequests( const DispatchList& aDispatch Reference < XDispatch > xDispatcher ; Reference < XDispatchProvider > xProvider ( xDesktop, UNO_QUERY ); - Reference < XURLTransformer > xParser ( ::comphelper::getProcessServiceFactory()->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer")) ), ::com::sun::star::uno::UNO_QUERY ); + Reference < XURLTransformer > xParser ( URLTransformer::create(::comphelper::getProcessComponentContext()) ); if( xParser.is() == sal_True ) xParser->parseStrict( aURL ); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index f7dbd0405560..6704da10192b 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -79,6 +79,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/util/URL.hpp" #include "com/sun/star/util/XChangesBatch.hpp" +#include "com/sun/star/util/URLTransformer.hpp" #include "com/sun/star/util/XURLTransformer.hpp" #include "com/sun/star/xml/dom/XElement.hpp" #include "com/sun/star/xml/dom/XNode.hpp" @@ -859,8 +860,7 @@ void UpdateDialog::createNotifyJob( bool bPrepareOnly, xNameAccess->getByName(OUSTR("URL")) >>= aURL.Complete; uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() ); - uno::Reference < util::XURLTransformer > xTransformer( xFactory->createInstance( OUSTR( "com.sun.star.util.URLTransformer" ) ), - uno::UNO_QUERY_THROW ); + uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); xTransformer->parseStrict(aURL); diff --git a/embedserv/source/embed/ed_ipersiststr.cxx b/embedserv/source/embed/ed_ipersiststr.cxx index 8eadce0a9158..72153757fc22 100644 --- a/embedserv/source/embed/ed_ipersiststr.cxx +++ b/embedserv/source/embed/ed_ipersiststr.cxx @@ -42,9 +42,10 @@ #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/util/XUrlTransformer.hpp> - +#include <com/sun/star/util/URLTransformer.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <comphelper/componentcontext.hxx> #include <osl/mutex.hxx> #include <osl/diagnose.h> @@ -228,18 +229,13 @@ uno::Sequence< beans::PropertyValue > EmbedDocument_Impl::fillArgsForLoading_Imp rtl::OUString sDocUrl; if ( pFilePath ) { - ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.util.URLTransformer" ) ); - uno::Reference< util::XURLTransformer > aTransformer( m_xFactory->createInstance( aServiceName ), - uno::UNO_QUERY ); - if ( aTransformer.is() ) - { - util::URL aURL; + uno::Reference< util::XURLTransformer > aTransformer( util::URLTransformer::create(comphelper::ComponentContext(m_xFactory).getUNOContext()) ); + util::URL aURL; - aURL.Complete = ::rtl::OUString( reinterpret_cast<const sal_Unicode*>(pFilePath) ); + aURL.Complete = ::rtl::OUString( reinterpret_cast<const sal_Unicode*>(pFilePath) ); - if ( aTransformer->parseSmart( aURL, ::rtl::OUString() ) ) - sDocUrl = aURL.Complete; - } + if ( aTransformer->parseSmart( aURL, ::rtl::OUString() ) ) + sDocUrl = aURL.Complete; } aArgs[nInd++].Value <<= sDocUrl; @@ -894,9 +890,7 @@ STDMETHODIMP EmbedDocument_Impl::Save( LPCOLESTR pszFileName, BOOL fRemember ) util::URL aURL; aURL.Complete = ::rtl::OUString( reinterpret_cast<const sal_Unicode*>( pszFileName ) ); - ::rtl::OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.util.URLTransformer" ) ); - uno::Reference< util::XURLTransformer > aTransformer( m_xFactory->createInstance( aServiceName ), - uno::UNO_QUERY_THROW ); + uno::Reference< util::XURLTransformer > aTransformer( util::URLTransformer::create(comphelper::ComponentContext(m_xFactory).getUNOContext()) ); if ( aTransformer->parseSmart( aURL, ::rtl::OUString() ) && aURL.Complete.getLength() ) { diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index b1607395b4d9..152a41b23355 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -29,6 +29,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> #include <datman.hxx> @@ -261,10 +262,8 @@ void BibToolBar::InitListener() { sal_uInt16 nCount=GetItemCount(); - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); uno::Reference< frame::XDispatch > xDisp(xController,UNO_QUERY); - - uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY ); + uno::Reference< util::XURLTransformer > xTrans( util::URLTransformer::create(comphelper::getProcessComponentContext()) ); if( xTrans.is() ) { util::URL aQueryURL; @@ -345,9 +344,7 @@ void BibToolBar::SendDispatch(sal_uInt16 nId, const Sequence< PropertyValue >& r if( xDSP.is() && !aCommand.isEmpty()) { - uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory(); - - uno::Reference< util::XURLTransformer > xTrans ( xMgr->createInstance( C2U("com.sun.star.util.URLTransformer") ), UNO_QUERY ); + uno::Reference< util::XURLTransformer > xTrans( util::URLTransformer::create(comphelper::getProcessComponentContext()) ); if( xTrans.is() ) { // Datei laden diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index f593fa0f76d5..5389c9b47a8d 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/inspection/PropertyControlType.hpp> #include <com/sun/star/inspection/XHyperlinkControl.hpp> #include <com/sun/star/awt/XActionListener.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> /** === end UNO includes === **/ @@ -290,7 +291,7 @@ namespace pcr //-------------------------------------------------------------------- void UrlClickHandler::impl_dispatch_throw( const ::rtl::OUString& _rURL ) { - Reference< XURLTransformer > xTransformer( m_aContext.createComponent( "com.sun.star.util.URLTransformer" ), UNO_QUERY_THROW ); + Reference< XURLTransformer > xTransformer( URLTransformer::create(m_aContext.getUNOContext()) ); URL aURL; aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:OpenHyperlink" ) ); xTransformer->parseStrict( aURL ); diff --git a/extensions/source/propctrlr/unourl.cxx b/extensions/source/propctrlr/unourl.cxx index 946091e2c4dc..b0c02f7861c4 100644 --- a/extensions/source/propctrlr/unourl.cxx +++ b/extensions/source/propctrlr/unourl.cxx @@ -27,7 +27,9 @@ ************************************************************************/ #include "unourl.hxx" +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <comphelper/componentcontext.hxx> //........................................................................ namespace pcr @@ -51,7 +53,7 @@ namespace pcr { if ( _rxORB.is() ) { - xTransform = xTransform.query( _rxORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ) ) ); + xTransform.set( URLTransformer::create(comphelper::ComponentContext(_rxORB).getUNOContext()) ); OSL_ENSURE( xTransform.is(), "UnoURL::UnoURL: could not create an URL transformer!" ); if ( xTransform.is() ) xTransform->parseStrict( m_aURL ); diff --git a/filter/source/config/cache/constant.hxx b/filter/source/config/cache/constant.hxx index a6e28b55554a..5fda7bbd01c9 100644 --- a/filter/source/config/cache/constant.hxx +++ b/filter/source/config/cache/constant.hxx @@ -179,7 +179,6 @@ */ #define SERVICE_CONFIGURATIONUPDATEACCESS _FILTER_CONFIG_FROM_ASCII_("com.sun.star.configuration.ConfigurationUpdateAccess" ) #define SERVICE_CONFIGURATIONACCESS _FILTER_CONFIG_FROM_ASCII_("com.sun.star.configuration.ConfigurationAccess" ) -#define SERVICE_URLTRANSFORMER _FILTER_CONFIG_FROM_ASCII_("com.sun.star.util.URLTransformer" ) #define SERVICE_FILTERCONFIGREFRESH _FILTER_CONFIG_FROM_ASCII_("com.sun.star.document.FilterConfigRefresh" ) /** @short some configuration paths. diff --git a/filter/source/config/cache/typedetection.cxx b/filter/source/config/cache/typedetection.cxx index 49e5e24b9f9d..8e3747cb7aa6 100644 --- a/filter/source/config/cache/typedetection.cxx +++ b/filter/source/config/cache/typedetection.cxx @@ -32,6 +32,7 @@ //_______________________________________________ // includes #include <com/sun/star/document/XExtendedFilterDetection.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/io/XInputStream.hpp> @@ -42,6 +43,7 @@ #include <framework/interaction.hxx> #include <tools/urlobj.hxx> #include <unotools/localfilehelper.hxx> +#include <comphelper/componentcontext.hxx> //_______________________________________________ // namespace @@ -77,7 +79,7 @@ TypeDetection::~TypeDetection() css::util::URL aURL; aURL.Complete = sURL; - css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICE_URLTRANSFORMER), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(comphelper::ComponentContext(m_xSMGR).getUNOContext())); xParser->parseStrict(aURL); // set std types as minimum requirement first! @@ -261,7 +263,7 @@ struct EqualByName : public std::binary_function<FlatDetectionInfo, FlatDetectio css::util::URL aURL; aURL.Complete = sURL; - css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICE_URLTRANSFORMER), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(comphelper::ComponentContext(m_xSMGR).getUNOContext())); xParser->parseStrict(aURL); rtl::OUString aSelectedFilter = stlDescriptor.getUnpackedValueOrDefault( diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 58d5f40d5c7c..d3dd3385fd56 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -60,9 +60,11 @@ #include <com/sun/star/sdbcx/Privilege.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> #include <com/sun/star/util/XCancellable.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XModifiable2.hpp> +#include <comphelper/componentcontext.hxx> #include <comphelper/basicio.hxx> #include <comphelper/container.hxx> #include <comphelper/enumhelper.hxx> @@ -2239,10 +2241,7 @@ void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const ::com: if (!xFrame.is()) return; - Reference<XURLTransformer> - xTransformer(m_xServiceFactory->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer") ) ), UNO_QUERY); - DBG_ASSERT(xTransformer.is(), "ODatabaseForm::submit_impl : could not create an URL transformer !"); + Reference<XURLTransformer> xTransformer(URLTransformer::create(comphelper::ComponentContext(m_xServiceFactory).getUNOContext())); // URL encoding if( eSubmitEncoding == FormSubmitEncoding_URL ) diff --git a/forms/source/helper/urltransformer.cxx b/forms/source/helper/urltransformer.cxx index 4fcfaeab92cc..f9d05378f838 100644 --- a/forms/source/helper/urltransformer.cxx +++ b/forms/source/helper/urltransformer.cxx @@ -29,8 +29,10 @@ #include "urltransformer.hxx" /** === begin UNO includes === **/ +#include <com/sun/star/util/URLTransformer.hpp> /** === end UNO includes === **/ #include <tools/debug.hxx> +#include <comphelper/componentcontext.hxx> //........................................................................ namespace frm @@ -60,12 +62,7 @@ namespace frm { if ( m_xORB.is() ) { - m_xTransformer = m_xTransformer.query( - m_xORB->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ) - ) - ); - DBG_ASSERT( m_xTransformer.is(), "UrlTransformer::getStrictURL: couldn't get an URL transformer!" ); + m_xTransformer.set(URLTransformer::create(comphelper::ComponentContext(m_xORB).getUNOContext())); } m_bTriedToCreateTransformer = true; diff --git a/framework/inc/services.h b/framework/inc/services.h index ef14a96c1959..c6e71c8b2541 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -50,7 +50,6 @@ namespace framework{ #define SERVICENAME_TASK DECLARE_ASCII("com.sun.star.frame.Task" ) #define SERVICENAME_FRAMELOADERFACTORY DECLARE_ASCII("com.sun.star.frame.FrameLoaderFactory" ) #define SERVICENAME_FILTERFACTORY DECLARE_ASCII("com.sun.star.document.FilterFactory" ) -#define SERVICENAME_URLTRANSFORMER DECLARE_ASCII("com.sun.star.util.URLTransformer" ) #define SERVICENAME_PLUGINFRAME DECLARE_ASCII("com.sun.star.mozilla.Plugin" ) #define SERVICENAME_BRIDGEFACTORY DECLARE_ASCII("com.sun.star.bridge.BridgeFactory" ) #define SERVICENAME_MEDIATYPEDETECTIONHELPER DECLARE_ASCII("com.sun.star.frame.MediaTypeDetectionHelper" ) diff --git a/framework/source/classes/droptargetlistener.cxx b/framework/source/classes/droptargetlistener.cxx index c1a422f466f1..897e1706abe3 100644 --- a/framework/source/classes/droptargetlistener.cxx +++ b/framework/source/classes/droptargetlistener.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> //_________________________________________________________________________________________________________________ @@ -51,6 +52,7 @@ #include <svtools/transfer.hxx> #include <unotools/localfilehelper.hxx> #include <sot/filelist.hxx> +#include <comphelper/componentcontext.hxx> #include <osl/file.hxx> #include <vcl/svapp.hxx> @@ -232,8 +234,8 @@ void DropTargetListener::implts_OpenFile( const String& rFilePath ) // open file /* SAFE { */ ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::frame::XFrame > xTargetFrame( m_xTargetFrame.get() , css::uno::UNO_QUERY ); - css::uno::Reference< css::util::XURLTransformer > xParser ( m_xFactory->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY ); + css::uno::Reference< css::frame::XFrame > xTargetFrame( m_xTargetFrame.get(), css::uno::UNO_QUERY ); + css::uno::Reference< css::util::XURLTransformer > xParser ( css::util::URLTransformer::create(::comphelper::ComponentContext(m_xFactory).getUNOContext()) ); aReadLock.unlock(); /* } SAFE */ if (xTargetFrame.is() && xParser.is()) diff --git a/framework/source/classes/menumanager.cxx b/framework/source/classes/menumanager.cxx index 8319bec42913..8797cd687315 100644 --- a/framework/source/classes/menumanager.cxx +++ b/framework/source/classes/menumanager.cxx @@ -47,6 +47,7 @@ //_________________________________________________________________________________________________________________ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -59,6 +60,7 @@ // includes of other projects //_________________________________________________________________________________________________________________ #include <comphelper/processfactory.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/extract.hxx> #include <svtools/menuoptions.hxx> @@ -302,7 +304,7 @@ void MenuManager::SetHdl() m_pVCLMenu->SetSelectHdl( LINK( this, MenuManager, Select )); if ( mxServiceFactory.is() ) - m_xURLTransformer.set( mxServiceFactory->createInstance(SERVICENAME_URLTRANSFORMER),UNO_QUERY ); + m_xURLTransformer.set( URLTransformer::create(::comphelper::ComponentContext(mxServiceFactory).getUNOContext()) ); } MenuManager::~MenuManager() diff --git a/framework/source/dispatch/windowcommanddispatch.cxx b/framework/source/dispatch/windowcommanddispatch.cxx index 756a1661deba..1a1637b2ea43 100644 --- a/framework/source/dispatch/windowcommanddispatch.cxx +++ b/framework/source/dispatch/windowcommanddispatch.cxx @@ -41,11 +41,13 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> //_______________________________________________ // includes of other projects +#include <comphelper/componentcontext.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> #include <vcl/cmdevt.hxx> @@ -185,7 +187,7 @@ void WindowCommandDispatch::impl_dispatchCommand(const ::rtl::OUString& sCommand if ( ! xProvider.is()) return; - css::uno::Reference< css::util::XURLTransformer > xParser(xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(xSMGR).getUNOContext())); css::util::URL aCommand; aCommand.Complete = sCommand; xParser->parseStrict(aCommand); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index e44e231cf0ce..d302ab0c60c2 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -66,8 +66,10 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatchHelper.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/util/URLTransformer.hpp> // other includes +#include <comphelper/componentcontext.hxx> #include <svtools/imgdef.hxx> #include <tools/diagnose_ex.h> #include <vcl/window.hxx> @@ -119,7 +121,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex()) , LayoutManager_PBase( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) , m_xSMGR( xServiceManager ) - , m_xURLTransformer( xServiceManager->createInstance( SERVICENAME_URLTRANSFORMER ), UNO_QUERY ) + , m_xURLTransformer( URLTransformer::create(::comphelper::ComponentContext(xServiceManager).getUNOContext()) ) , m_xDisplayAccess( xServiceManager->createInstance( SERVICENAME_DISPLAYACCESS ), UNO_QUERY ) , m_nLockCount( 0 ) , m_bActive( false ) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index cc24ece023ea..fc6e3138415f 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -50,6 +50,7 @@ #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> #include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/ucb/XContentProviderManager.hpp> #include <com/sun/star/util/XCloseable.hpp> @@ -88,6 +89,7 @@ #include <svtools/sfxecode.hxx> #include <comphelper/processfactory.hxx> #include <unotools/ucbhelper.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/configurationhelper.hxx> #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> @@ -288,7 +290,7 @@ void LoadEnv::initializeLoading(const ::rtl::OUString& // parse it - because some following code require that m_aURL.Complete = sURL; - css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); xParser->parseStrict(m_aURL); // BTW: Split URL and JumpMark ... @@ -1260,7 +1262,7 @@ void LoadEnv::impl_jumpToMark(const css::uno::Reference< css::frame::XFrame >& x css::util::URL aCmd; aCmd.Complete = ::rtl::OUString(".uno:JumpToMark"); - css::uno::Reference< css::util::XURLTransformer > xParser(xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); xParser->parseStrict(aCmd); css::uno::Reference< css::frame::XDispatch > xDispatcher = xProvider->queryDispatch(aCmd, SPECIALTARGET_SELF, 0); diff --git a/framework/source/lomenubar/FrameHelper.cxx b/framework/source/lomenubar/FrameHelper.cxx index 7de75889810a..8f0e622ca7f6 100644 --- a/framework/source/lomenubar/FrameHelper.cxx +++ b/framework/source/lomenubar/FrameHelper.cxx @@ -56,6 +56,7 @@ #include <com/sun/star/lang/SystemDependent.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> @@ -260,7 +261,7 @@ FrameHelper::FrameHelper(const Reference< XMultiServiceFactory >& rServiceManag : m_xStatusListener(new MenuItemStatusListener(this)) , m_pDispatchRegistry(new framework::lomenubar::DispatchRegistry(m_xStatusListener)) , m_xMSF(rServiceManager) - , m_xTrans(m_xMSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer" ))), UNO_QUERY) + , m_xTrans(util::URLTransformer::create(m_xMSF)) , m_xMM(m_xMSF->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager"))),UNO_QUERY) , m_xPCF(m_xMSF->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.PopupMenuControllerFactory"))), UNO_QUERY) , m_xFrame(xFrame) diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 690e4df5069e..3249d03975df 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> @@ -78,6 +79,7 @@ //_______________________________________________ // other includes +#include <comphelper/componentcontext.hxx> #include <comphelper/configurationhelper.hxx> #include <comphelper/mediadescriptor.hxx> #include <comphelper/namedvaluecollection.hxx> @@ -2777,7 +2779,7 @@ void AutoRecovery::implts_generateNewTempURL(const ::rtl::OUString& ::rtl::OUStringBuffer sUniqueName; if (!rInfo.OrgURL.isEmpty()) { - css::uno::Reference< css::util::XURLTransformer > xParser(xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); css::util::URL aURL; aURL.Complete = rInfo.OrgURL; xParser->parseStrict(aURL); diff --git a/framework/source/services/backingcomp.cxx b/framework/source/services/backingcomp.cxx index a3032843f89d..af64d81dc61d 100644 --- a/framework/source/services/backingcomp.cxx +++ b/framework/source/services/backingcomp.cxx @@ -53,9 +53,11 @@ #include <com/sun/star/awt/KeyEvent.hpp> #include <com/sun/star/awt/KeyModifier.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/util/URLTransformer.hpp> //_______________________________________________ // other includes +#include <comphelper/componentcontext.hxx> #include <cppuhelper/typeprovider.hxx> #include <cppuhelper/factory.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -681,7 +683,7 @@ void SAL_CALL BackingComp::dispose() // kill the menu css::util::URL aURL; aURL.Complete = DECLARE_ASCII(".uno:close"); - css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); if (xParser.is()) xParser->parseStrict(aURL); diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index 1ffd4339f152..1755b98989d8 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -65,6 +65,7 @@ #include "com/sun/star/system/SystemShellExecuteFlags.hpp" #include "com/sun/star/task/XJobExecutor.hpp" #include "com/sun/star/util/XStringWidth.hpp" +#include <com/sun/star/util/URLTransformer.hpp> using namespace ::com::sun::star::beans; @@ -1004,35 +1005,31 @@ void BackingWindow::dispatchURL( const rtl::OUString& i_rURL, aDispatchURL.Complete = i_rURL; Reference < com::sun::star::util::XURLTransformer > xURLTransformer( - comphelper::getProcessServiceFactory()->createInstance( rtl::OUString("com.sun.star.util.URLTransformer") ), - com::sun::star::uno::UNO_QUERY ); - if ( xURLTransformer.is() ) + com::sun::star::util::URLTransformer::create( comphelper::getProcessComponentContext() ) ); + try { - try - { - // clean up the URL - xURLTransformer->parseStrict( aDispatchURL ); - // get a Dispatch for the URL and target - Reference< XDispatch > xDispatch( - xProvider->queryDispatch( aDispatchURL, rTarget, 0 ) - ); - // dispatch the URL - if ( xDispatch.is() ) - { - ImplDelayedDispatch* pDisp = new ImplDelayedDispatch( xDispatch, aDispatchURL, i_rArgs ); - sal_uLong nEventId = 0; - if( ! Application::PostUserEvent( nEventId, Link( NULL, implDispatchDelayed ), pDisp ) ) - delete pDisp; // event could not be posted for unknown reason, at least don't leak - } - } - catch (const com::sun::star::uno::RuntimeException&) - { - throw; - } - catch (const com::sun::star::uno::Exception&) + // clean up the URL + xURLTransformer->parseStrict( aDispatchURL ); + // get a Dispatch for the URL and target + Reference< XDispatch > xDispatch( + xProvider->queryDispatch( aDispatchURL, rTarget, 0 ) + ); + // dispatch the URL + if ( xDispatch.is() ) { + ImplDelayedDispatch* pDisp = new ImplDelayedDispatch( xDispatch, aDispatchURL, i_rArgs ); + sal_uLong nEventId = 0; + if( ! Application::PostUserEvent( nEventId, Link( NULL, implDispatchDelayed ), pDisp ) ) + delete pDisp; // event could not be posted for unknown reason, at least don't leak } } + catch (const com::sun::star::uno::RuntimeException&) + { + throw; + } + catch (const com::sun::star::uno::Exception&) + { + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/services/dispatchhelper.cxx b/framework/source/services/dispatchhelper.cxx index a64f8b8357c1..3a46189d970e 100644 --- a/framework/source/services/dispatchhelper.cxx +++ b/framework/source/services/dispatchhelper.cxx @@ -36,11 +36,13 @@ //_______________________________________________ // interface includes +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XNotifyingDispatch.hpp> //_______________________________________________ // includes of other projects +#include <comphelper/componentcontext.hxx> //_______________________________________________ // namespace @@ -130,7 +132,7 @@ css::uno::Any SAL_CALL DispatchHelper::executeDispatch( // parse given URL /* SAFE { */ ReadGuard aReadLock(m_aLock); - css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext()) ); aReadLock.unlock(); /* } SAFE */ diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 6000e55f4a53..078361e8b4f4 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/task/JobExecutor.hpp> #include <com/sun/star/task/XJobExecutor.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/awt/XDevice.hpp> @@ -86,6 +87,7 @@ #include <toolkit/unohlp.hxx> #include <toolkit/awt/vclxwindow.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <unotools/moduleoptions.hxx> @@ -2338,7 +2340,7 @@ void SAL_CALL Frame::windowClosing( const css::lang::EventObject& ) throw( css:: css::util::URL aURL; aURL.Complete = DECLARE_ASCII(".uno:CloseFrame"); - css::uno::Reference< css::util::XURLTransformer > xParser(xFactory->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(xFactory).getUNOContext())); xParser->parseStrict(aURL); css::uno::Reference< css::frame::XDispatch > xCloser = queryDispatch(aURL, SPECIALTARGET_SELF, 0); diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index 1f52d37b9cb3..3c7fdfcd5e8e 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -56,9 +56,11 @@ #include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XChangesBatch.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/URL.hpp> #include <osl/time.h> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <unotools/pathoptions.hxx> #include <unotools/internaloptions.hxx> @@ -162,7 +164,7 @@ void SessionListener::StoreSession( sal_Bool bAsync ) // in case of synchronous call the caller should do saveDone() call himself! css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); - css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW); + css::uno::Reference< XURLTransformer > xURLTransformer(URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionSave"); xURLTransformer->parseStrict(aURL); @@ -195,7 +197,7 @@ void SessionListener::QuitSessionQuietly() // it is done synchronously to avoid conflict with normal quit process css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW); - css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW); + css::uno::Reference< XURLTransformer > xURLTransformer(URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionQuietQuit"); xURLTransformer->parseStrict(aURL); @@ -278,7 +280,7 @@ sal_Bool SAL_CALL SessionListener::doRestore() URL aURL; aURL.Complete = OUString("vnd.sun.star.autorecovery:/doSessionRestore"); - css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW); + css::uno::Reference< XURLTransformer > xURLTransformer(URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); xURLTransformer->parseStrict(aURL); Sequence< PropertyValue > args; xDispatch->addStatusListener(this, aURL); diff --git a/framework/source/services/urltransformer.cxx b/framework/source/services/urltransformer.cxx index 132143e58c43..0d9676e61f01 100644 --- a/framework/source/services/urltransformer.cxx +++ b/framework/source/services/urltransformer.cxx @@ -93,7 +93,7 @@ URLTransformer::~URLTransformer() DEFINE_XSERVICEINFO_MULTISERVICE ( URLTransformer , OWeakObject , - SERVICENAME_URLTRANSFORMER , + DECLARE_ASCII("com.sun.star.util.URLTransformer"), IMPLEMENTATIONNAME_URLTRANSFORMER ) diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx index 7061386a398b..172f872f8996 100644 --- a/framework/source/uielement/buttontoolbarcontroller.cxx +++ b/framework/source/uielement/buttontoolbarcontroller.cxx @@ -38,6 +38,7 @@ //_________________________________________________________________________________________________________________ // interface includes //_________________________________________________________________________________________________________________ +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -52,6 +53,7 @@ #include <rtl/uri.hxx> #include <osl/mutex.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <unotools/ucbstreamhelper.hxx> #include <vcl/svapp.hxx> @@ -244,9 +246,7 @@ throw (::com::sun::star::uno::RuntimeException) { if ( !m_xURLTransformer.is() ) { - m_xURLTransformer = uno::Reference< util::XURLTransformer >( - m_xServiceManager->createInstance( rtl::OUString( "com.sun.star.util.URLTransformer" )), - uno::UNO_QUERY_THROW ); + m_xURLTransformer = util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ); } xFrame = m_xFrame; diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx index c7badf678f91..0c4c786e881b 100644 --- a/framework/source/uielement/complextoolbarcontroller.cxx +++ b/framework/source/uielement/complextoolbarcontroller.cxx @@ -38,6 +38,7 @@ //_________________________________________________________________________________________________________________ // interface includes //_________________________________________________________________________________________________________________ +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -50,6 +51,7 @@ //_________________________________________________________________________________________________________________ // other includes //_________________________________________________________________________________________________________________ +#include <comphelper/componentcontext.hxx> #include <svtools/toolboxcontroller.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> @@ -80,9 +82,7 @@ ComplexToolbarController::ComplexToolbarController( , m_nID( nID ) , m_bMadeInvisible( sal_False ) { - m_xURLTransformer.set( m_xServiceManager->createInstance( - rtl::OUString( "com.sun.star.util.URLTransformer" )), - UNO_QUERY_THROW ); + m_xURLTransformer.set( URLTransformer::create(::comphelper::ComponentContext(m_xServiceManager).getUNOContext()) ); } // ------------------------------------------------------------------ diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index 58f05bbe083a..d5960e40fb50 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -38,6 +38,7 @@ //_________________________________________________________________________________________________________________ // interface includes //_________________________________________________________________________________________________________________ +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -49,6 +50,7 @@ //_________________________________________________________________________________________________________________ // other includes //_________________________________________________________________________________________________________________ +#include <comphelper/componentcontext.hxx> #include <svtools/toolboxcontroller.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> @@ -167,9 +169,7 @@ throw ( RuntimeException ) m_xServiceManager.is() && !m_aCommandURL.isEmpty() ) { - xURLTransformer = Reference< XURLTransformer >( m_xServiceManager->createInstance( - rtl::OUString( "com.sun.star.util.URLTransformer" )), - UNO_QUERY ); + xURLTransformer = URLTransformer::create(::comphelper::ComponentContext(m_xServiceManager).getUNOContext()); aCommandURL = m_aCommandURL; URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL ); @@ -364,7 +364,7 @@ MenuToolbarController::createPopupWindow() throw (::com::sun::star::uno::Runtime if ( !pMenu ) { Reference< XDispatchProvider > xDispatch; - Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( rtl::OUString( "com.sun.star.util.URLTransformer" )), UNO_QUERY ); + Reference< XURLTransformer > xURLTransformer = URLTransformer::create(::comphelper::ComponentContext(m_xServiceManager).getUNOContext()); pMenu = new Toolbarmenu(); m_xMenuManager.set( new MenuBarManager( m_xServiceManager, m_xFrame, xURLTransformer, xDispatch, m_aModuleIdentifier, pMenu, sal_True, sal_True ) ); if ( m_xMenuManager.is() ) diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx index ed39425ea7d0..26fef12723b5 100644 --- a/framework/source/uielement/langselectionstatusbarcontroller.cxx +++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx @@ -57,6 +57,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <comphelper/processfactory.hxx> #include <comphelper/componentcontext.hxx> @@ -318,7 +319,7 @@ throw (::com::sun::star::uno::RuntimeException) aURL.Complete += OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FontDialogForParagraph")); } - uno::Reference< util::XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), uno::UNO_QUERY ); + uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(::comphelper::ComponentContext(m_xServiceManager).getUNOContext()) ); xURLTransformer->parseStrict( aURL ); uno::Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch(aURL, OUString(), 0); if( xDispatch.is() ) diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 4c64446bfd8a..e075f0b2e8f0 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -69,10 +69,12 @@ #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ItemStyle.hpp> #include <com/sun/star/frame/status/Visibility.hpp> +#include <com/sun/star/util/URLTransformer.hpp> //_________________________________________________________________________________________________________________ // includes of other projects //_________________________________________________________________________________________________________________ +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/extract.hxx> #include <svtools/menuoptions.hxx> @@ -2098,9 +2100,9 @@ void MenuBarManager::SetHdl() m_pVCLMenu->SetSelectHdl( LINK( this, MenuBarManager, Select )); if ( !m_xURLTransformer.is() && mxServiceFactory.is() ) - m_xURLTransformer.set( mxServiceFactory->createInstance( - SERVICENAME_URLTRANSFORMER), - UNO_QUERY ); + m_xURLTransformer.set( + URLTransformer::create( + ::comphelper::ComponentContext(mxServiceFactory).getUNOContext()) ); } } diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index 45d5bf849ad6..5c97bf181a44 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -46,10 +46,12 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/util/URLTransformer.hpp> //_________________________________________________________________________________________________________________ // other includes //_________________________________________________________________________________________________________________ +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <tools/solar.h> #include <vcl/svapp.hxx> @@ -172,9 +174,7 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) th Reference< XURLTransformer > xTrans; try { - xTrans.set( m_xServiceFactory->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.URLTransformer" ))), UNO_QUERY ); + xTrans.set( URLTransformer::create(::comphelper::ComponentContext(m_xServiceFactory).getUNOContext()) ); m_xConfigData = m_xConfigSource->getSettings( m_aResourceURL, sal_False ); if ( m_xConfigData.is() ) { diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 475c99aa7e84..ac73f320061d 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -67,6 +67,7 @@ #include <comphelper/sequence.hxx> #include <com/sun/star/frame/status/Visibility.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/util/URLTransformer.hpp> //_________________________________________________________________________________________________________________ // other includes @@ -75,6 +76,7 @@ #include <svtools/toolboxcontroller.hxx> #include <unotools/cmdoptions.hxx> #include <toolkit/unohlp.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/mediadescriptor.hxx> #include <svtools/miscopt.hxx> #include <svl/imageitm.hxx> @@ -262,9 +264,9 @@ ToolBarManager::ToolBarManager( const Reference< XMultiServiceFactory >& rServic m_xServiceManager->createInstance( SERVICENAME_TOOLBARCONTROLLERFACTORY ), UNO_QUERY ); - m_xURLTransformer.set( m_xServiceManager->createInstance( - SERVICENAME_URLTRANSFORMER), - UNO_QUERY ); + m_xURLTransformer.set( + URLTransformer::create( + ::comphelper::ComponentContext(m_xServiceManager).getUNOContext()) ); } m_pToolBar->SetSelectHdl( LINK( this, ToolBarManager, Select) ); diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx index 4f77bf2a7edd..7d770ffa04c5 100644 --- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx +++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <comphelper/processfactory.hxx> #include <boost/bind.hpp> #include <algorithm> @@ -51,11 +52,8 @@ ResourceFactoryManager::ResourceFactoryManager (const Reference<XControllerManag mxURLTransformer() { // Create the URL transformer. - Reference<lang::XMultiServiceFactory> xServiceManager ( - ::comphelper::getProcessServiceFactory()); - mxURLTransformer = Reference<util::XURLTransformer>( - xServiceManager->createInstance("com.sun.star.util.URLTransformer"), - UNO_QUERY); + Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext()); + mxURLTransformer = util::URLTransformer::create(xContext); } diff --git a/sd/source/ui/framework/configuration/ResourceId.cxx b/sd/source/ui/framework/configuration/ResourceId.cxx index aece40c1d8a0..7816e770a31f 100644 --- a/sd/source/ui/framework/configuration/ResourceId.cxx +++ b/sd/source/ui/framework/configuration/ResourceId.cxx @@ -32,6 +32,7 @@ #include "tools/SdGlobalResourceContainer.hxx" #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <comphelper/processfactory.hxx> #include <rtl/ref.hxx> @@ -597,11 +598,8 @@ void ResourceId::ParseResourceURL (void) if ( ! xURLTransformer.is()) { // Create the URL transformer. - Reference<lang::XMultiServiceFactory> xServiceManager ( - ::comphelper::getProcessServiceFactory()); - xURLTransformer = Reference<util::XURLTransformer>( - xServiceManager->createInstance("com.sun.star.util.URLTransformer"), - UNO_QUERY); + Reference<uno::XComponentContext> xContext(::comphelper::getProcessComponentContext()); + xURLTransformer = Reference<util::XURLTransformer>(util::URLTransformer::create(xContext)); mxURLTransformerWeak = xURLTransformer; SdGlobalResourceContainer::Instance().AddResource( Reference<XInterface>(xURLTransformer,UNO_QUERY)); diff --git a/sd/source/ui/framework/module/ReadOnlyModeObserver.cxx b/sd/source/ui/framework/module/ReadOnlyModeObserver.cxx index 1f5577cfb203..423d503645e3 100644 --- a/sd/source/ui/framework/module/ReadOnlyModeObserver.cxx +++ b/sd/source/ui/framework/module/ReadOnlyModeObserver.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/drawing/framework/XControllerManager.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <comphelper/processfactory.hxx> #include <cppuhelper/interfacecontainer.hxx> @@ -66,16 +67,8 @@ ReadOnlyModeObserver::ReadOnlyModeObserver ( { // Create a URL object for the slot name. maSlotNameURL.Complete = ".uno:EditDoc"; - uno::Reference<lang::XMultiServiceFactory> xServiceManager ( - ::comphelper::getProcessServiceFactory()); - if (xServiceManager.is()) - { - Reference<util::XURLTransformer> xTransformer(xServiceManager->createInstance( - "com.sun.star.util.URLTransformer"), - UNO_QUERY); - if (xTransformer.is()) - xTransformer->parseStrict(maSlotNameURL); - } + Reference<util::XURLTransformer> xTransformer(util::URLTransformer::create(::comphelper::getProcessComponentContext())); + xTransformer->parseStrict(maSlotNameURL); if ( ! ConnectToDispatch()) { diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index 16b9e4297438..7e366fd9b644 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/beans/XPropertySetInfo.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/awt/SystemPointer.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> @@ -2847,10 +2848,9 @@ void SlideshowImpl::setAutoSaveState( bool bOn) try { uno::Reference<lang::XMultiServiceFactory> xFac( ::comphelper::getProcessServiceFactory() ); + uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() ); - uno::Reference< util::XURLTransformer > xParser( - xFac->createInstance( "com.sun.star.util.URLTransformer" ), - uno::UNO_QUERY_THROW); + uno::Reference< util::XURLTransformer > xParser(util::URLTransformer::create(xContext)); util::URL aURL; aURL.Complete = "vnd.sun.star.autorecovery:/setAutoSaveState"; xParser->parseStrict(aURL); diff --git a/sd/source/ui/tools/SlotStateListener.cxx b/sd/source/ui/tools/SlotStateListener.cxx index 567567477d1b..c9894eac7e51 100644 --- a/sd/source/ui/tools/SlotStateListener.cxx +++ b/sd/source/ui/tools/SlotStateListener.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/frame/XStatusListener.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp> @@ -125,19 +126,10 @@ void SlotStateListener::disposing (void) util::URL SlotStateListener::MakeURL (const OUString& rSlotName) const { util::URL aURL; - aURL.Complete = rSlotName; - uno::Reference<lang::XMultiServiceFactory> xServiceManager ( - ::comphelper::getProcessServiceFactory()); - if (xServiceManager.is()) - { - uno::Reference<util::XURLTransformer> xTransformer(xServiceManager->createInstance( - "com.sun.star.util.URLTransformer"), - uno::UNO_QUERY); - if (xTransformer.is()) - xTransformer->parseStrict(aURL); - } + uno::Reference<util::XURLTransformer> xTransformer(util::URLTransformer::create(::comphelper::getProcessComponentContext())); + xTransformer->parseStrict(aURL); return aURL; } diff --git a/sdext/source/minimizer/impoptimizer.cxx b/sdext/source/minimizer/impoptimizer.cxx index 8afd16f93c75..95b35ff0d887 100644 --- a/sdext/source/minimizer/impoptimizer.cxx +++ b/sdext/source/minimizer/impoptimizer.cxx @@ -69,6 +69,8 @@ #include <com/sun/star/io/XSeekable.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> +#include <comphelper/componentcontext.hxx> using namespace ::std; using namespace ::rtl; @@ -586,12 +588,11 @@ sal_Bool ImpOptimizer::Optimize() return sal_True; } -static void DispatchURL( Reference< XComponentContext > xMSF, OUString sURL, Reference< XFrame > xFrame ) +static void DispatchURL( Reference< XComponentContext > xContext, OUString sURL, Reference< XFrame > xFrame ) { try { - Reference< XURLTransformer > xURLTransformer( xMSF->getServiceManager()->createInstanceWithContext( - OUString( "com.sun.star.util.URLTransformer" ), xMSF ), UNO_QUERY_THROW ); + Reference< XURLTransformer > xURLTransformer( URLTransformer::create(xContext) ); util::URL aUrl; aUrl.Complete = sURL; xURLTransformer->parseStrict( aUrl ); diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx index c74599f57bab..b09f1ab90d5c 100644 --- a/sdext/source/minimizer/informationdialog.cxx +++ b/sdext/source/minimizer/informationdialog.cxx @@ -36,6 +36,7 @@ #include <rtl/ustrbuf.hxx> #include <sal/macros.h> #include "com/sun/star/util/URL.hpp" +#include "com/sun/star/util/URLTransformer.hpp" #include "com/sun/star/util/XURLTransformer.hpp" #define DIALOG_WIDTH 240 @@ -300,21 +301,17 @@ void InformationDialog::InitDialog() rtl::OUString aTitle; if ( !maSaveAsURL.isEmpty() ) { - Reference< XURLTransformer > xURLTransformer( mxMSF->getServiceManager()->createInstanceWithContext( - OUString( "com.sun.star.util.URLTransformer" ), mxMSF ), UNO_QUERY ); - if ( xURLTransformer.is() ) - { - util::URL aURL, aPresentationURL; - aURL.Complete = maSaveAsURL; - xURLTransformer->parseSmart( aURL, rtl::OUString() ); + Reference< XURLTransformer > xURLTransformer( URLTransformer::create(mxMSF) ); + util::URL aURL, aPresentationURL; + aURL.Complete = maSaveAsURL; + xURLTransformer->parseSmart( aURL, rtl::OUString() ); - const OUString sFileProtocol( "file:///" ); - aPresentationURL.Complete = sFileProtocol.concat( aURL.Name ); - aTitle = xURLTransformer->getPresentation( aPresentationURL, sal_False ); + const OUString sFileProtocol( "file:///" ); + aPresentationURL.Complete = sFileProtocol.concat( aURL.Name ); + aTitle = xURLTransformer->getPresentation( aPresentationURL, sal_False ); - if ( aTitle.match( sFileProtocol, 0 ) ) - aTitle = aTitle.replaceAt( 0, sFileProtocol.getLength(), rtl::OUString() ); - } + if ( aTitle.match( sFileProtocol, 0 ) ) + aTitle = aTitle.replaceAt( 0, sFileProtocol.getLength(), rtl::OUString() ); } OUString aInfoString( getString( eInfoString ) ); diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx index 2b1c3e46ac0e..1418d5a3b793 100644 --- a/sdext/source/presenter/PresenterController.cxx +++ b/sdext/source/presenter/PresenterController.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/presentation/XPresentationSupplier.hpp> #include <com/sun/star/rendering/CompositeOperation.hpp> #include <com/sun/star/rendering/TextDirection.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <rtl/ustrbuf.hxx> @@ -194,11 +195,7 @@ PresenterController::PresenterController ( // Create a URLTransformer. if (xFactory.is()) { - mxUrlTransformer = Reference<util::XURLTransformer>( - xFactory->createInstanceWithContext( - A2S("com.sun.star.util.URLTransformer"), - mxComponentContext), - UNO_QUERY); + mxUrlTransformer = Reference<util::XURLTransformer>(util::URLTransformer::create(mxComponentContext)); } } diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 3c619e76eee0..31e96945c13d 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/frame/DispatchResultState.hpp> #include <com/sun/star/frame/XDispatchResultListener.hpp> #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/system/SystemShellExecuteException.hpp> #include <com/sun/star/document/XTypeDetection.hpp> @@ -936,8 +937,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) ::rtl::OUString aTypeName; aURL.Complete = aFileName; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aURL ); INetProtocol aINetProtocol = INetURLObject( aURL.Complete ).GetProtocol(); @@ -1209,7 +1209,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) { URL aURL; aURL.Complete = aFileName; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aURL ); Reference < XDispatchProvider > xProv( xTargetFrame, UNO_QUERY ); diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index bc7900f29488..1f4c69e2ef5c 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -84,6 +84,7 @@ #include <com/sun/star/util/URL.hpp> #include <com/sun/star/util/XSearchable.hpp> #include <com/sun/star/util/XSearchDescriptor.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> @@ -170,8 +171,7 @@ using namespace ::comphelper; #define KEY_UI_NAME DEFINE_CONST_OUSTRING("ooSetupFactoryUIName") #define PARSE_URL( aURL ) \ - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( \ - DEFINE_CONST_UNICODE("com.sun.star.util.URLTransformer" )), UNO_QUERY ); \ + Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); \ xTrans->parseStrict( aURL ) //......................................................................... diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index cabfc39e8e47..5f6244696eb6 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -839,8 +840,7 @@ void SfxHelp::OpenHelpAgent( const rtl::OString& sHelpId ) { URL aURL; aURL.Complete = CreateHelpURL_Impl( rtl::OStringToOUString(sHelpId, RTL_TEXTENCODING_UTF8), GetHelpModuleName_Impl() ); - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString("com.sun.star.util.URLTransformer") ), UNO_QUERY ); + Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict(aURL); Reference < XFrame > xCurrentFrame; diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx index 391286db89b9..d240f3746ebf 100644 --- a/sfx2/source/appl/shutdownicon.cxx +++ b/sfx2/source/appl/shutdownicon.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/XComponentLoader.hpp> #include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> #include <com/sun/star/ui/dialogs/XFilterManager.hpp> @@ -296,27 +297,22 @@ void ShutdownIcon::OpenURL( const ::rtl::OUString& aURL, const ::rtl::OUString& com::sun::star::util::URL aDispatchURL; aDispatchURL.Complete = aURL; - Reference < com::sun::star::util::XURLTransformer > xURLTransformer( - ::comphelper::getProcessServiceFactory()->createInstance( OUString("com.sun.star.util.URLTransformer") ), - com::sun::star::uno::UNO_QUERY ); - if ( xURLTransformer.is() ) + Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); + try { - try - { - Reference< com::sun::star::frame::XDispatch > xDispatch; + Reference< com::sun::star::frame::XDispatch > xDispatch; - xURLTransformer->parseStrict( aDispatchURL ); - xDispatch = xDispatchProvider->queryDispatch( aDispatchURL, rTarget, 0 ); - if ( xDispatch.is() ) - xDispatch->dispatch( aDispatchURL, aArgs ); - } - catch ( com::sun::star::uno::RuntimeException& ) - { - throw; - } - catch ( com::sun::star::uno::Exception& ) - { - } + xURLTransformer->parseStrict( aDispatchURL ); + xDispatch = xDispatchProvider->queryDispatch( aDispatchURL, rTarget, 0 ); + if ( xDispatch.is() ) + xDispatch->dispatch( aDispatchURL, aArgs ); + } + catch ( com::sun::star::uno::RuntimeException& ) + { + throw; + } + catch ( com::sun::star::uno::Exception& ) + { } } } @@ -347,7 +343,7 @@ void ShutdownIcon::FromTemplate() URL aTargetURL; aTargetURL.Complete = OUString( "slot:5500" ); - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); Reference < ::com::sun::star::frame::XDispatchProvider > xProv( xFrame, UNO_QUERY ); diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index e18b564ad406..442065d4d3c7 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -39,6 +39,7 @@ #include <svl/intitem.hxx> #include <svl/stritem.hxx> #include <svl/visitem.hxx> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/frame/XDispatch.hpp> @@ -2189,7 +2190,7 @@ sal_Bool SfxBindings::ExecuteCommand_Impl( const String& rCommand ) { ::com::sun::star::util::URL aURL; aURL.Complete = rCommand; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference< util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aURL ); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDisp = pImp->xProv->queryDispatch( aURL, ::rtl::OUString(), 0 ); if ( xDisp.is() ) diff --git a/sfx2/source/control/querystatus.cxx b/sfx2/source/control/querystatus.cxx index 76f985bdccc1..4c40279578a3 100644 --- a/sfx2/source/control/querystatus.cxx +++ b/sfx2/source/control/querystatus.cxx @@ -38,6 +38,7 @@ #include <comphelper/processfactory.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> #include <com/sun/star/frame/status/ItemState.hpp> @@ -95,8 +96,7 @@ SfxQueryStatus_Impl::SfxQueryStatus_Impl( const Reference< XDispatchProvider >& m_nSlotID( nSlotId ) { m_aCommand.Complete = rCommand; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( m_aCommand ); if ( rDispatchProvider.is() ) m_xDispatch = rDispatchProvider->queryDispatch( m_aCommand, rtl::OUString(), 0 ); diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx index 78f0a7da6bca..296690b54d36 100644 --- a/sfx2/source/control/request.cxx +++ b/sfx2/source/control/request.cxx @@ -33,6 +33,7 @@ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> #include <svl/itemiter.hxx> @@ -40,6 +41,7 @@ #include <svl/itempool.hxx> #include <svtools/itemdel.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <svl/smplhint.hxx> @@ -373,9 +375,7 @@ void SfxRequest_Impl::Record ::comphelper::getProcessServiceFactory(), com::sun::star::uno::UNO_QUERY); - com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > xTransform( - xFactory->createInstance(rtl::OUString("com.sun.star.util.URLTransformer")), - com::sun::star::uno::UNO_QUERY); + uno::Reference< util::XURLTransformer > xTransform( util::URLTransformer::create( ::comphelper::ComponentContext(xFactory).getUNOContext() ) ); com::sun::star::util::URL aURL; aURL.Complete = aCmd; diff --git a/sfx2/source/control/sfxstatuslistener.cxx b/sfx2/source/control/sfxstatuslistener.cxx index 8d4d2e58f762..9c580f47fae6 100644 --- a/sfx2/source/control/sfxstatuslistener.cxx +++ b/sfx2/source/control/sfxstatuslistener.cxx @@ -38,6 +38,7 @@ #include <comphelper/processfactory.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/frame/status/ItemStatus.hpp> @@ -66,8 +67,7 @@ SfxStatusListener::SfxStatusListener( const Reference< XDispatchProvider >& rDis m_xDispatchProvider( rDispatchProvider ) { m_aCommand.Complete = rCommand; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( m_aCommand ); if ( rDispatchProvider.is() ) m_xDispatch = rDispatchProvider->queryDispatch( m_aCommand, rtl::OUString(), 0 ); diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index aa537a6a5304..a738a882e8ac 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -36,6 +36,7 @@ #include <svtools/javacontext.hxx> #include <svl/itempool.hxx> #include <tools/urlobj.hxx> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XFrameActionListener.hpp> @@ -108,7 +109,7 @@ SfxUnoControllerItem::SfxUnoControllerItem( SfxControllerItem *pItem, SfxBinding DBG_ASSERT( !pCtrlItem || !pCtrlItem->IsBound(), "ControllerItem is incorrect!" ); aCommand.Complete = rCmd; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aCommand ); pBindings->RegisterUnoController_Impl( this ); } @@ -464,7 +465,7 @@ SfxDispatchController_Impl::SfxDispatchController_Impl( rtl::OStringBuffer aTmp(RTL_CONSTASCII_STRINGPARAM(".uno:")); aTmp.append(pUnoName); aDispatchURL.Complete = ::rtl::OStringToOUString(aTmp.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); - Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference< XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aDispatchURL ); } diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index a6362bdb6cd8..8e2c6d8f9f67 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/ucb/CommandAbortedException.hpp> #include <com/sun/star/uno/Reference.h> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/system/XSimpleMailClientSupplier.hpp> #include <com/sun/star/system/SimpleMailClientFlags.hpp> @@ -72,6 +73,7 @@ #include <tools/urlobj.hxx> #include <unotools/useroptions.hxx> #include <comphelper/extract.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/mediadescriptor.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> @@ -570,20 +572,15 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( css::util::URL aPrepareURL; css::uno::Reference< css::frame::XDispatch > xPrepareDispatch; css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( xFrame, css::uno::UNO_QUERY ); - css::uno::Reference< css::util::XURLTransformer > xURLTransformer( - xSMGR->createInstance( rtl::OUString( "com.sun.star.util.URLTransformer" )), - css::uno::UNO_QUERY ); + css::uno::Reference< css::util::XURLTransformer > xURLTransformer( css::util::URLTransformer::create( ::comphelper::ComponentContext(xSMGR).getUNOContext() ) ); if( !bSendAsPDF ) { try { // check if the document needs to be prepared for sending as mail (embedding of links, removal of invisible content) - if ( xURLTransformer.is() ) - { - aPrepareURL.Complete = rtl::OUString( ".uno:PrepareMailExport" ); - xURLTransformer->parseStrict( aPrepareURL ); - } + aPrepareURL.Complete = rtl::OUString( ".uno:PrepareMailExport" ); + xURLTransformer->parseStrict( aPrepareURL ); if ( xDispatchProvider.is() ) { @@ -651,11 +648,8 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( { css::util::URL aURL; // #i30432# notify that export is finished - the Writer may want to restore removed content - if ( xURLTransformer.is() ) - { - aURL.Complete = rtl::OUString( ".uno:MailExportFinished" ); - xURLTransformer->parseStrict( aURL ); - } + aURL.Complete = rtl::OUString( ".uno:MailExportFinished" ); + xURLTransformer->parseStrict( aURL ); if ( xDispatchProvider.is() ) { diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 3231bdea1a6a..a9fdd5bf673f 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/document/XDocumentInfo.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/util/DateTime.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XStorable2.hpp> @@ -68,6 +69,7 @@ #include <svtools/miscopt.hxx> #include <tools/debug.hxx> #include <tools/urlobj.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/configurationhelper.hxx> #include <comphelper/mimeconfighelper.hxx> @@ -1118,11 +1120,8 @@ sal_Bool ModelData_Impl::ShowDocumentInfoDialog() util::URL aURL; aURL.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:SetDocumentProperties")); - uno::Reference< util::XURLTransformer > xTransformer( - m_pOwner->GetServiceFactory()->createInstance( - DEFINE_CONST_UNICODE("com.sun.star.util.URLTransformer") ), - uno::UNO_QUERY ); - if ( xTransformer.is() && xTransformer->parseStrict( aURL ) ) + uno::Reference < util::XURLTransformer > xTransformer( util::URLTransformer::create( ::comphelper::ComponentContext(m_pOwner->GetServiceFactory()).getUNOContext() ) ); + if ( xTransformer->parseStrict( aURL ) ) { uno::Reference< frame::XDispatch > xDispatch = xFrameDispatch->queryDispatch( aURL, diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index 9d60fb6a8168..8e0a03029013 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -33,8 +33,10 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> +#include <comphelper/componentcontext.hxx> #include <tools/urlobj.hxx> #include <tools/debug.hxx> #include <rtl/ustring.hxx> @@ -154,7 +156,7 @@ throw( uno::RuntimeException ) util::URL aTargetURL; aTargetURL.Complete = ::rtl::OUString( maFrmDescr.GetURL().GetMainURL( INetURLObject::NO_DECODE ) ); - uno::Reference < util::XURLTransformer > xTrans( mxFact->createInstance( "com.sun.star.util.URLTransformer"), uno::UNO_QUERY ); + uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::ComponentContext(mxFact).getUNOContext() ) ); xTrans->parseStrict( aTargetURL ); uno::Sequence < beans::PropertyValue > aProps(2); diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx index 039f03dbd3d9..9f617ebfdc84 100644 --- a/sfx2/source/notify/eventsupplier.cxx +++ b/sfx2/source/notify/eventsupplier.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <tools/urlobj.hxx> #include <svl/macitem.hxx> @@ -239,12 +240,7 @@ static void Execute( ANY& aEventData, const css::document::DocumentEvent& aTrigg SfxViewFrame::GetFirst( pDoc ) : SfxViewFrame::Current(); - ::com::sun::star::uno::Reference - < ::com::sun::star::util::XURLTransformer > xTrans( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( - "com.sun.star.util.URLTransformer" ) ), - UNO_QUERY ); + ::com::sun::star::uno::Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::com::sun::star::util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); ::com::sun::star::util::URL aURL; aURL.Complete = aScript; diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx index 7c7254f8f99c..9c993eaea2ad 100644 --- a/sfx2/source/statbar/stbitem.cxx +++ b/sfx2/source/statbar/stbitem.cxx @@ -28,6 +28,7 @@ #include <svl/stritem.hxx> #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -86,8 +87,7 @@ svt::StatusbarController* SAL_CALL SfxStatusBarControllerFactory( util::URL aTargetURL; aTargetURL.Complete = aCommandURL; - uno::Reference < util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString("com.sun.star.util.URLTransformer")), uno::UNO_QUERY ); + uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); SfxObjectShell* pObjShell = NULL; diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index d220e71c7770..1e458ed912d3 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> @@ -143,7 +144,7 @@ svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const Reference< X URL aTargetURL; aTargetURL.Complete = aCommandURL; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference < XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); if ( !aTargetURL.Arguments.isEmpty() ) return NULL; @@ -437,9 +438,7 @@ void SfxToolBoxControl::Dispatch( { ::com::sun::star::util::URL aTargetURL; aTargetURL.Complete = rCommand; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString("com.sun.star.util.URLTransformer")), - UNO_QUERY ); + Reference < XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); Reference < XDispatch > xDispatch = rProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); @@ -1650,9 +1649,7 @@ long Select_Impl( void* /*pHdl*/, void* pVoid ) URL aTargetURL; aTargetURL.Complete = aURL; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString("com.sun.star.util.URLTransformer")), - UNO_QUERY ); + Reference < XURLTransformer > xTrans( URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 72da247620a9..09351f11f48a 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -58,6 +58,7 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/frame/XModel2.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XCloseable.hpp> #include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> @@ -3150,7 +3151,9 @@ void SfxViewFrame::ChildWindowExecute( SfxRequest &rReq ) { ::com::sun::star::util::URL aTargetURL; aTargetURL.Complete = ::rtl::OUString(".component:DB/DataSourceBrowser"); - Reference < ::com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString("com.sun.star.util.URLTransformer")), UNO_QUERY ); + Reference < ::com::sun::star::util::XURLTransformer > xTrans( + ::com::sun::star::util::URLTransformer::create( + ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index a0f5a7b39e89..937236f785b0 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <toolkit/helper/vclunohelper.hxx> #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/util/XOfficeInstallationDirectories.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> @@ -710,8 +711,8 @@ void SvtFrameWindow_Impl::OpenFile( const String& rURL, sal_Bool bPreview, sal_B { com::sun::star::util::URL aURL; aURL.Complete = rURL; - Reference < com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()-> - createInstance( ASCII_STR("com.sun.star.util.URLTransformer" ) ), UNO_QUERY ); + Reference< com::sun::star::util::XURLTransformer > xTrans( + com::sun::star::util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aURL ); String aTarget; @@ -1615,8 +1616,8 @@ IMPL_LINK_NOARG(SvtDocumentTemplateDialog , OrganizerHdl_Impl) com::sun::star::util::URL aTargetURL; aTargetURL.Complete = ASCII_STR("slot:5540"); - Reference < com::sun::star::util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()-> - createInstance( ASCII_STR("com.sun.star.util.URLTransformer") ), UNO_QUERY ); + Reference< com::sun::star::util::XURLTransformer > xTrans( + com::sun::star::util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aTargetURL ); Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index b8cd25a74ee8..181a1dc35c5d 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -40,7 +40,9 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <toolkit/helper/vclunohelper.hxx> +#include <comphelper/componentcontext.hxx> #include <vcl/window.hxx> #include <vcl/svapp.hxx> @@ -448,8 +450,7 @@ css::uno::Reference< css::util::XURLTransformer > AcceleratorExecute::impl_ts_ge // <- SAFE ---------------------------------- css::uno::Reference< css::util::XURLTransformer > xParser( - xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - css::uno::UNO_QUERY_THROW); + css::util::URLTransformer::create( ::comphelper::ComponentContext(xSMGR).getUNOContext() ) ); // SAFE -> ---------------------------------- aLock.reset(); diff --git a/svtools/source/uno/contextmenuhelper.cxx b/svtools/source/uno/contextmenuhelper.cxx index 6d8578e7952c..541b3c920dfb 100644 --- a/svtools/source/uno/contextmenuhelper.cxx +++ b/svtools/source/uno/contextmenuhelper.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ImageType.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <osl/conditn.hxx> @@ -341,35 +342,28 @@ ContextMenuHelper::dispatchCommand( { if ( !m_xURLTransformer.is() ) { - m_xURLTransformer = uno::Reference< util::XURLTransformer >( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.URLTransformer" ))), - uno::UNO_QUERY ); + m_xURLTransformer = util::URLTransformer::create( ::comphelper::getProcessComponentContext() ); } util::URL aTargetURL; + aTargetURL.Complete = aCommandURL; + m_xURLTransformer->parseStrict( aTargetURL ); + uno::Reference< frame::XDispatch > xDispatch; - if ( m_xURLTransformer.is() ) + uno::Reference< frame::XDispatchProvider > xDispatchProvider( + rFrame, uno::UNO_QUERY ); + if ( xDispatchProvider.is() ) { - aTargetURL.Complete = aCommandURL; - m_xURLTransformer->parseStrict( aTargetURL ); - - uno::Reference< frame::XDispatchProvider > xDispatchProvider( - rFrame, uno::UNO_QUERY ); - if ( xDispatchProvider.is() ) + try + { + xDispatch = xDispatchProvider->queryDispatch( aTargetURL, m_aSelf, 0 ); + } + catch ( uno::RuntimeException& ) + { + throw; + } + catch ( uno::Exception& ) { - try - { - xDispatch = xDispatchProvider->queryDispatch( aTargetURL, m_aSelf, 0 ); - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& ) - { - } } } @@ -594,11 +588,7 @@ ContextMenuHelper::completeMenuProperties( if ( !m_xURLTransformer.is() ) { - m_xURLTransformer = uno::Reference< util::XURLTransformer >( - ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.URLTransformer" ))), - uno::UNO_QUERY ); + m_xURLTransformer = util::URLTransformer::create( ::comphelper::getProcessComponentContext() ); } for ( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ ) diff --git a/svtools/source/uno/framestatuslistener.cxx b/svtools/source/uno/framestatuslistener.cxx index 6579c26feae2..909170dd4da5 100644 --- a/svtools/source/uno/framestatuslistener.cxx +++ b/svtools/source/uno/framestatuslistener.cxx @@ -29,8 +29,10 @@ #include <svtools/framestatuslistener.hxx> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/DisposedException.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> +#include <comphelper/componentcontext.hxx> using namespace ::cppu; using namespace ::com::sun::star::awt; @@ -103,10 +105,7 @@ throw (::com::sun::star::uno::RuntimeException) try { Reference< XDispatch > xDispatch( pIter->second ); - Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.util.URLTransformer" ))), - UNO_QUERY ); + Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = pIter->first; xURLTransformer->parseStrict( aTargetURL ); @@ -193,9 +192,7 @@ void FrameStatusListener::addStatusListener( const rtl::OUString& aCommandURL ) Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); if ( m_xServiceManager.is() && xDispatchProvider.is() ) { - Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - UNO_QUERY ); + Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) ); aTargetURL.Complete = aCommandURL; xURLTransformer->parseStrict( aTargetURL ); xDispatch = xDispatchProvider->queryDispatch( aTargetURL, ::rtl::OUString(), 0 ); @@ -253,9 +250,7 @@ void FrameStatusListener::bindListener() URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); while ( pIter != m_aListenerMap.end() ) { - Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - UNO_QUERY ); + Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = pIter->first; xURLTransformer->parseStrict( aTargetURL ); @@ -324,9 +319,7 @@ void FrameStatusListener::unbindListener() URLToDispatchMap::iterator pIter = m_aListenerMap.begin(); while ( pIter != m_aListenerMap.end() ) { - Reference< XURLTransformer > xURLTransformer( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - UNO_QUERY ); + Reference< XURLTransformer > xURLTransformer( com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) ); com::sun::star::util::URL aTargetURL; aTargetURL.Complete = pIter->first; xURLTransformer->parseStrict( aTargetURL ); diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx index 3dfc34e77e94..9d7777836b05 100644 --- a/svtools/source/uno/generictoolboxcontroller.cxx +++ b/svtools/source/uno/generictoolboxcontroller.cxx @@ -35,6 +35,7 @@ //_________________________________________________________________________________________________________________ // interface includes //_________________________________________________________________________________________________________________ +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/beans/PropertyValue.hpp> @@ -45,6 +46,7 @@ //_________________________________________________________________________________________________________________ // other includes //_________________________________________________________________________________________________________________ +#include <comphelper/componentcontext.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> @@ -116,9 +118,7 @@ throw ( RuntimeException ) m_xServiceManager.is() && !m_aCommandURL.isEmpty() ) { - xURLTransformer = Reference< XURLTransformer >( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - UNO_QUERY ); + xURLTransformer = com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ); aCommandURL = m_aCommandURL; URLToDispatchMap::iterator pIter = m_aListenerMap.find( m_aCommandURL ); diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index cdc12be41a6b..a20d4690ea9f 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/awt/XMenuExtended.hpp> +#include <com/sun/star/util/URLTransformer.hpp> //_________________________________________________________________________________________________________________ // includes of other projects @@ -52,6 +53,7 @@ #include <rtl/ustrbuf.hxx> #include <rtl/logfile.hxx> #include <osl/mutex.hxx> +#include <comphelper/componentcontext.hxx> //_________________________________________________________________________________________________________________ // Defines @@ -87,7 +89,7 @@ PopupMenuControllerBase::PopupMenuControllerBase( const Reference< XMultiService m_xServiceManager( xServiceManager ) { if ( m_xServiceManager.is() ) - m_xURLTransformer.set( m_xServiceManager->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))),UNO_QUERY ); + m_xURLTransformer.set( util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) ); } PopupMenuControllerBase::~PopupMenuControllerBase() diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx index 34f72eba446b..55f383e87786 100644 --- a/svtools/source/uno/statusbarcontroller.cxx +++ b/svtools/source/uno/statusbarcontroller.cxx @@ -32,6 +32,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/window.hxx> @@ -39,6 +40,7 @@ #include <svtools/imgdef.hxx> #include <svtools/miscopt.hxx> #include <toolkit/unohlp.hxx> +#include <comphelper/componentcontext.hxx> using namespace ::cppu; using namespace ::com::sun::star::awt; @@ -92,10 +94,7 @@ Reference< XURLTransformer > StatusbarController::getURLTransformer() const SolarMutexGuard aSolarMutexGuard; if ( !m_xURLTransformer.is() && m_xServiceManager.is() ) { - m_xURLTransformer = Reference< XURLTransformer >( - m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - UNO_QUERY ); + m_xURLTransformer = com::sun::star::util::URLTransformer::create( ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ); } return m_xURLTransformer; diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index ea31875b346d..10b9e85862a4 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -33,12 +33,14 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <svtools/imgdef.hxx> #include <svtools/miscopt.hxx> #include <toolkit/unohlp.hxx> #include <vcl/toolbox.hxx> +#include <comphelper/componentcontext.hxx> const int TOOLBARCONTROLLER_PROPHANDLE_SUPPORTSVISIBLE = 1; const char TOOLBARCONTROLLER_PROPNAME_SUPPORTSVISIBLE[] = "SupportsVisible"; @@ -103,9 +105,9 @@ ToolboxController::ToolboxController( try { - m_pImpl->m_xUrlTransformer.set( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - UNO_QUERY ); + m_pImpl->m_xUrlTransformer.set( + ::com::sun::star::util::URLTransformer::create( + ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) ); } catch(const Exception&) { @@ -241,9 +243,9 @@ throw ( Exception, RuntimeException ) try { if ( !m_pImpl->m_xUrlTransformer.is() && m_xServiceManager.is() ) - m_pImpl->m_xUrlTransformer.set( m_xServiceManager->createInstance( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ))), - UNO_QUERY ); + m_pImpl->m_xUrlTransformer.set( + ::com::sun::star::util::URLTransformer::create( + ::comphelper::ComponentContext(m_xServiceManager).getUNOContext() ) ); } catch(const Exception&) { diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 4c0c96ab1eff..a7e09d212189 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -34,6 +34,7 @@ #include "docrecovery.hxx" #include "docrecovery.hrc" +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/sequenceashashmap.hxx> #include <comphelper/configurationhelper.hxx> @@ -56,6 +57,7 @@ #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/ui/dialogs/XFolderPicker.hpp> #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <osl/file.hxx> #include <osl/security.hxx> #include <rtl/bootstrap.hxx> @@ -583,7 +585,7 @@ void RecoveryCore::impl_startListening() aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE; else aURL.Complete = RECOVERY_CMD_DO_RECOVERY; - css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); xParser->parseStrict(aURL); /* Note: addStatusListener() call us synchronous back ... so we @@ -603,7 +605,7 @@ void RecoveryCore::impl_stopListening() aURL.Complete = RECOVERY_CMD_DO_EMERGENCY_SAVE; else aURL.Complete = RECOVERY_CMD_DO_RECOVERY; - css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); xParser->parseStrict(aURL); m_xRealCore->removeStatusListener(static_cast< css::frame::XStatusListener* >(this), aURL); @@ -616,7 +618,7 @@ css::util::URL RecoveryCore::impl_getParsedURL(const ::rtl::OUString& sURL) css::util::URL aURL; aURL.Complete = sURL; - css::uno::Reference< css::util::XURLTransformer > xParser(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::util::XURLTransformer > xParser(css::util::URLTransformer::create(::comphelper::ComponentContext(m_xSMGR).getUNOContext())); xParser->parseStrict(aURL); return aURL; diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 4d387b0458ac..c4119fd1fbc2 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -60,6 +60,7 @@ #include <com/sun/star/uno/XNamingService.hpp> #include <com/sun/star/util/XNumberFormats.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <svl/svstdarr.hxx> @@ -1161,10 +1162,8 @@ void FmGridControl::DeleteSelectedRows() aUrl.Complete = FMURL_CONFIRM_DELETION; // #100312# ------------ Reference< ::com::sun::star::util::XURLTransformer > xTransformer( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), UNO_QUERY); - if( xTransformer.is() ) - xTransformer->parseStrict( aUrl ); + ::com::sun::star::util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); + xTransformer->parseStrict( aUrl ); Reference< ::com::sun::star::frame::XDispatch > xDispatch = xDispatcher->queryDispatch(aUrl, rtl::OUString(), 0); Reference< ::com::sun::star::form::XConfirmDeleteListener > xConfirm(xDispatch, UNO_QUERY); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index ae3d0b0fae33..a19ecc49fd61 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -48,6 +48,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/sdbc/ResultSetType.hpp> #include <com/sun/star/sdbcx/XColumnsSupplier.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/sdbcx/XRowLocate.hpp> @@ -2794,15 +2795,10 @@ Sequence< ::com::sun::star::util::URL>& FmXGridPeer::getSupportedURLs() // let an ::com::sun::star::util::URL-transformer normalize the URLs Reference< ::com::sun::star::util::XURLTransformer > xTransformer( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString("com.sun.star.util.URLTransformer")), - UNO_QUERY); + util::URLTransformer::create(::comphelper::getProcessComponentContext()) ); pSupported = aSupported.getArray(); - if (xTransformer.is()) - { - for (i=0; i<aSupported.getLength(); ++i) - xTransformer->parseStrict(pSupported[i]); - } + for (i=0; i<aSupported.getLength(); ++i) + xTransformer->parseStrict(pSupported[i]); } return aSupported; diff --git a/svx/source/form/fmtextcontrolshell.cxx b/svx/source/form/fmtextcontrolshell.cxx index 154ebe5215a7..4ffc6f89704b 100644 --- a/svx/source/form/fmtextcontrolshell.cxx +++ b/svx/source/form/fmtextcontrolshell.cxx @@ -49,6 +49,7 @@ #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/awt/XFocusListener.hpp> #include <com/sun/star/awt/XMouseListener.hpp> +#include <com/sun/star/util/URLTransformer.hpp> /** === end UNO includes === **/ #include <comphelper/componentcontext.hxx> @@ -1316,8 +1317,7 @@ namespace svx { if ( !m_xURLTransformer.is() ) { - ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - aContext.createComponent( "com.sun.star.util.URLTransformer", m_xURLTransformer ); + m_xURLTransformer = util::URLTransformer::create( ::comphelper::getProcessComponentContext() ); } if ( m_xURLTransformer.is() ) m_xURLTransformer->parseStrict( _rURL ); diff --git a/svx/source/inc/docrecovery.hxx b/svx/source/inc/docrecovery.hxx index 1159f0153056..1daee038f223 100644 --- a/svx/source/inc/docrecovery.hxx +++ b/svx/source/inc/docrecovery.hxx @@ -61,7 +61,6 @@ #define RECOVERY_CMD_DO_ENTRY_CLEANUP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.autorecovery:/doEntryCleanUp" )) #define SERVICENAME_PROGRESSFACTORY rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.StatusIndicatorFactory")) -#define SERVICENAME_URLTRANSFORMER rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" )) #define SERVICENAME_RECOVERYCORE rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.AutoRecovery" )) #define SERVICENAME_FOLDERPICKER rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" )) #define SERVICENAME_DESKTOP rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index b723139efe37..68b4e214ec9c 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -42,6 +42,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/string.hxx> #include <svtools/colorcfg.hxx> +#include <com/sun/star/util/URLTransformer.hpp> // namespaces using namespace ::com::sun::star::uno; @@ -377,9 +378,7 @@ void TableWindow::TableDialog( const Sequence< PropertyValue >& rArgs ) if ( xDispatchProvider.is() ) { com::sun::star::util::URL aTargetURL; - Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( - rtl::OUString("com.sun.star.util.URLTransformer")), - UNO_QUERY ); + Reference < XURLTransformer > xTrans( URLTransformer::create(::comphelper::getProcessComponentContext()) ); aTargetURL.Complete = maCommand; xTrans->parseStrict( aTargetURL ); diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 5fddc89c48a5..e58bd7fa5d69 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -31,11 +31,13 @@ #include <svx/dialogs.hrc> #include <svx/dialmgr.hxx> +#include <comphelper/componentcontext.hxx> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/frame/XLayoutManager.hpp> #include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/ui/XUIElement.hpp> #include <com/sun/star/util/URL.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/toolbox.hxx> @@ -56,25 +58,21 @@ static const char COMMAND_DOWNSEARCH[] = ".uno:DownSearch"; static const char COMMAND_UPSEARCH[] = ".uno:UpSearch"; static const char COMMAND_APPENDSEARCHHISTORY[] = "AppendSearchHistory"; -static const char SERVICENAME_URLTRANSFORMER[] = "com.sun.star.util.URLTransformer"; static const sal_Int32 REMEMBER_SIZE = 10; void impl_executeSearch( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMgr, const css::uno::Reference< css::frame::XFrame >& xFrame, const css::uno::Sequence< css::beans::PropertyValue >& lArgs ) { - css::uno::Reference< css::util::XURLTransformer > xURLTransformer( rSMgr->createInstance(rtl::OUString(SERVICENAME_URLTRANSFORMER)), css::uno::UNO_QUERY ); - if ( xURLTransformer.is() ) - { - css::util::URL aURL; - aURL.Complete = rtl::OUString(COMMAND_EXECUTESEARCH); - xURLTransformer->parseStrict(aURL); + css::uno::Reference< css::util::XURLTransformer > xURLTransformer( css::util::URLTransformer::create(::comphelper::ComponentContext(rSMgr).getUNOContext()) ); + css::util::URL aURL; + aURL.Complete = rtl::OUString(COMMAND_EXECUTESEARCH); + xURLTransformer->parseStrict(aURL); - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); - if ( xDispatchProvider.is() ) - { - css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); - if ( xDispatch.is() && !aURL.Complete.isEmpty() ) - xDispatch->dispatch( aURL, lArgs ); - } + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider(xFrame, css::uno::UNO_QUERY); + if ( xDispatchProvider.is() ) + { + css::uno::Reference< css::frame::XDispatch > xDispatch = xDispatchProvider->queryDispatch( aURL, ::rtl::OUString(), 0 ); + if ( xDispatch.is() && !aURL.Complete.isEmpty() ) + xDispatch->dispatch( aURL, lArgs ); } } diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 5c94fcf272ca..1722998e6499 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -79,6 +79,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/util/URL.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <vcl/svapp.hxx> @@ -749,17 +750,11 @@ sal_Bool SwView::ExecSpellPopup(const Point& rPt) xFrame = pSfxViewFrame->GetFrame().GetFrameInterface(); com::sun::star::util::URL aURL; uno::Reference< frame::XDispatchProvider > xDispatchProvider( xFrame, UNO_QUERY ); - uno::Reference< lang::XMultiServiceFactory > xMgr( comphelper::getProcessServiceFactory(), uno::UNO_QUERY ); try { uno::Reference< frame::XDispatch > xDispatch; - uno::Reference< util::XURLTransformer > xURLTransformer; - if (xMgr.is()) - { - xURLTransformer = uno::Reference< util::XURLTransformer >( xMgr->createInstance( - C2U("com.sun.star.util.URLTransformer")), UNO_QUERY); - } + uno::Reference< util::XURLTransformer > xURLTransformer = util::URLTransformer::create(comphelper::getProcessComponentContext()); aURL.Complete = aCommand; xURLTransformer->parseStrict(aURL); diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx index 4c6c8004af38..13fc0fe55757 100644 --- a/sw/source/ui/utlui/uitool.cxx +++ b/sw/source/ui/utlui/uitool.cxx @@ -51,6 +51,7 @@ #include <unotools/localedatawrapper.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <comphelper/processfactory.hxx> #include <sfx2/viewfrm.hxx> @@ -740,7 +741,7 @@ bool ExecuteMenuCommand( PopupMenu& rMenu, SfxViewFrame& rViewFrame, sal_uInt16 uno::Reference < frame::XDispatchProvider > xProv( xFrame, uno::UNO_QUERY ); util::URL aURL; aURL.Complete = sCommand; - uno::Reference < util::XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.URLTransformer"))), uno::UNO_QUERY ); + uno::Reference < util::XURLTransformer > xTrans( util::URLTransformer::create(::comphelper::getProcessComponentContext() ) ); xTrans->parseStrict( aURL ); uno::Reference< frame::XDispatch > xDisp = xProv->queryDispatch( aURL, ::rtl::OUString(), 0 ); if( xDisp.is() ) diff --git a/uui/source/newerverwarn.cxx b/uui/source/newerverwarn.cxx index a18825cd9e4c..bac1f60b1c30 100644 --- a/uui/source/newerverwarn.cxx +++ b/uui/source/newerverwarn.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/system/XSystemShellExecute.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/container/XNameReplace.hpp> @@ -138,8 +139,7 @@ IMPL_LINK_NOARG(NewerVersionWarningDialog, UpdateHdl) util::URL aURL; if ( aVal >>= aURL.Complete ) { - uno::Reference< util::XURLTransformer > xTransformer( - aContext.createComponent( "com.sun.star.util.URLTransformer" ), uno::UNO_QUERY_THROW ); + uno::Reference< util::XURLTransformer > xTransformer( util::URLTransformer::create(aContext.getUNOContext()) ); xTransformer->parseStrict( aURL ); uno::Reference < frame::XDesktop > xDesktop( diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx index 977f5ead5f4c..526b07a1c009 100644 --- a/vbahelper/source/vbahelper/vbadocumentbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx @@ -34,6 +34,7 @@ #include <com/sun/star/util/XModifiable.hpp> #include <com/sun/star/util/XProtectable.hpp> #include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/frame/XFrame.hpp> @@ -141,11 +142,7 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg, uno::Reference< frame::XDispatchProvider > xDispatchProvider( xController->getFrame(), uno::UNO_QUERY_THROW ); uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW ); - uno::Reference< util::XURLTransformer > xURLTransformer( - xServiceManager->createInstanceWithContext( - rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ), - mxContext ), - uno::UNO_QUERY_THROW ); + uno::Reference< util::XURLTransformer > xURLTransformer( util::URLTransformer::create(mxContext) ); util::URL aURL; aURL.Complete = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:CloseDoc" ) ); diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx index a917ef7a6786..b65f36a754f5 100644 --- a/vbahelper/source/vbahelper/vbahelper.cxx +++ b/vbahelper/source/vbahelper/vbahelper.cxx @@ -26,6 +26,7 @@ * ************************************************************************/ #include <cppuhelper/bootstrap.hxx> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -171,11 +172,7 @@ dispatchRequests (const uno::Reference< frame::XModel>& xModel, const rtl::OUStr if ( !xServiceManager.is() ) return; - uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext( - rtl::OUString( "com.sun.star.util.URLTransformer" ), xContext), - uno::UNO_QUERY_THROW ); - if (!xParser.is()) - return; + uno::Reference<util::XURLTransformer> xParser( util::URLTransformer::create(xContext) ); xParser->parseStrict (url); } catch (const uno::Exception&) diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 2c4d10b61ca7..df7d15eb5b2c 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -76,6 +76,7 @@ #include <comphelper/processfactory.hxx> #include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/util/URLTransformer.hpp> #include <com/sun/star/util/URL.hpp> #include "cppuhelper/implbase1.hxx" @@ -10560,19 +10561,14 @@ sal_Int32 PDFWriterImpl::setLinkURL( sal_Int32 nLinkId, const OUString& rURL ) if (!m_xTrans.is()) { - uno::Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory() ); - if( xFact.is() ) - { - m_xTrans = uno::Reference < util::XURLTransformer >( - xFact->createInstance( OUString( "com.sun.star.util.URLTransformer" ) ), uno::UNO_QUERY ); - } + uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); + m_xTrans = util::URLTransformer::create(xContext);; } util::URL aURL; aURL.Complete = rURL; - if (m_xTrans.is()) - m_xTrans->parseStrict( aURL ); + m_xTrans->parseStrict( aURL ); m_aLinks[ nLinkId ].m_aURL = aURL.Complete; |