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 /framework | |
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.
Diffstat (limited to 'framework')
21 files changed, 84 insertions, 62 deletions
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) ); |