diff options
author | Noel Grandin <noel@peralex.com> | 2012-05-30 16:45:36 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-06-06 10:01:22 +0200 |
commit | 392a483e1040787857fa09fead0547d567c570b5 (patch) | |
tree | 76f2f1aab1a5a9c81c30e212e0df3f568fa92e34 /unotools | |
parent | d08578912f2c9ef42d4349079422e25b951e544e (diff) |
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 <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'unotools')
-rw-r--r-- | unotools/source/config/moduleoptions.cxx | 12 | ||||
-rw-r--r-- | unotools/source/config/pathoptions.cxx | 3 |
2 files changed, 6 insertions, 9 deletions
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 <comphelper/sequenceashashmap.hxx> #include <unotools/configmgr.hxx> #include <unotools/configitem.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/processfactory.hxx> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> @@ -44,6 +45,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/document/XTypeDetection.hpp> +#include <com/sun/star/util/PathSubstitution.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> #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 <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/util/PathSubstitution.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/util/XMacroExpander.hpp> @@ -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 |