From 392a483e1040787857fa09fead0547d567c570b5 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 30 May 2012 16:45:36 +0200 Subject: fdo#46808, Adapt UNO services to new style, Part 7, updating ::create Update code to use factory method PathSubstitutions::create Change-Id: I3721bd93c36b207d849eea19102f5ac61cadd205 Signed-off-by: Stephan Bergmann , added some tweaks. --- unotools/source/config/moduleoptions.cxx | 12 ++++-------- unotools/source/config/pathoptions.cxx | 3 ++- 2 files changed, 6 insertions(+), 9 deletions(-) (limited to 'unotools') diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index 1e65dc86fd9e..938c09e79a8c 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,7 @@ #include #include #include +#include #include #include "itemholder1.hxx" @@ -282,16 +284,10 @@ struct FactoryInfo { if ( !xSubstVars.is() ) { + css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::ComponentContext(xSMgr).getUNOContext() ); xSubstVars = css::uno::Reference< css::util::XStringSubstitution >( - xSMgr->createInstance( - ::rtl::OUString( "com.sun.star.util.PathSubstitution" ) ), - css::uno::UNO_QUERY ); - if ( !xSubstVars.is() ) - throw css::uno::RuntimeException( - ::rtl::OUString( "Cannot instanciate service " - "com.sun.star.util.PathSubstitution" ), - css::uno::Reference< css::uno::XInterface >() ); + css::util::PathSubstitution::create(xContext) ); } return xSubstVars; } diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index 3b5cc26ada3e..28aa1bca8f9f 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include @@ -440,7 +441,7 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() : } ::comphelper::ComponentContext aContext( xSMgr ); - m_xSubstVariables.set( aContext.createComponent( "com.sun.star.util.PathSubstitution" ), UNO_QUERY_THROW ); + m_xSubstVariables.set( PathSubstitution::create(aContext.getUNOContext()) ); m_xMacroExpander.set( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY_THROW ); // Create temporary hash map to have a mapping between property names and property handles -- cgit v1.2.3