From 0fcd1a73f0e1ec564f3c6da1ccd890183d3c18db Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 1 Jun 2012 15:15:25 +0200 Subject: 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 , added some tweaks. --- sdext/source/minimizer/impoptimizer.cxx | 7 ++++--- sdext/source/minimizer/informationdialog.cxx | 23 ++++++++++------------- sdext/source/presenter/PresenterController.cxx | 7 ++----- 3 files changed, 16 insertions(+), 21 deletions(-) (limited to 'sdext') 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 #include #include +#include +#include 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 #include #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 #include #include +#include #include @@ -194,11 +195,7 @@ PresenterController::PresenterController ( // Create a URLTransformer. if (xFactory.is()) { - mxUrlTransformer = Reference( - xFactory->createInstanceWithContext( - A2S("com.sun.star.util.URLTransformer"), - mxComponentContext), - UNO_QUERY); + mxUrlTransformer = Reference(util::URLTransformer::create(mxComponentContext)); } } -- cgit v1.2.3