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 /sd | |
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 'sd')
5 files changed, 15 insertions, 34 deletions
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; } |