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 /framework | |
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 'framework')
-rw-r--r-- | framework/source/dispatch/systemexec.cxx | 7 | ||||
-rw-r--r-- | framework/source/jobs/shelljob.cxx | 9 | ||||
-rw-r--r-- | framework/source/services/pathsettings.cxx | 9 |
3 files changed, 15 insertions, 10 deletions
diff --git a/framework/source/dispatch/systemexec.cxx b/framework/source/dispatch/systemexec.cxx index d3f5e78270dd..e2e9d80cd926 100644 --- a/framework/source/dispatch/systemexec.cxx +++ b/framework/source/dispatch/systemexec.cxx @@ -39,6 +39,7 @@ // interface includes //_________________________________________________________________________________________________________________ #include <com/sun/star/system/XSystemShellExecute.hpp> +#include <com/sun/star/util/PathSubstitution.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> @@ -48,6 +49,7 @@ //_________________________________________________________________________________________________________________ #include <vcl/svapp.hxx> +#include <comphelper/componentcontext.hxx> //_________________________________________________________________________________________________________________ // namespace @@ -182,9 +184,8 @@ void SAL_CALL SystemExec::dispatchWithNotification( const css::util::URL& try { - css::uno::Reference< css::util::XStringSubstitution > xPathSubst( - xFactory->createInstance(SERVICENAME_SUBSTITUTEPATHVARIABLES), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::ComponentContext(xFactory).getUNOContext() ); + css::uno::Reference< css::util::XStringSubstitution > xPathSubst( css::util::PathSubstitution::create(xContext) ); ::rtl::OUString sSystemURL = xPathSubst->substituteVariables(sSystemURLWithVariables, sal_True); // sal_True force an exception if unknown variables exists ! diff --git a/framework/source/jobs/shelljob.cxx b/framework/source/jobs/shelljob.cxx index 9bf85711cf67..a4c073b527cc 100644 --- a/framework/source/jobs/shelljob.cxx +++ b/framework/source/jobs/shelljob.cxx @@ -42,11 +42,13 @@ #include <osl/process.h> #include <vcl/svapp.hxx> #include <rtl/ustrbuf.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/sequenceashashmap.hxx> //_______________________________________________ // include interfaces +#include <com/sun/star/util/PathSubstitution.hpp> #include <com/sun/star/util/XStringSubstitution.hpp> //_______________________________________________ @@ -160,9 +162,10 @@ css::uno::Any ShellJob::impl_generateAnswer4Deactivation() try { - css::uno::Reference< css::util::XStringSubstitution > xSubst ( xSMGR->createInstance(SERVICENAME_SUBSTITUTEPATHVARIABLES), css::uno::UNO_QUERY_THROW); - const ::sal_Bool bSubstRequired = sal_True; - const ::rtl::OUString sCompleteCommand = xSubst->substituteVariables(sCommand, bSubstRequired); + css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::ComponentContext(xSMGR).getUNOContext() ); + css::uno::Reference< css::util::XStringSubstitution > xSubst( css::util::PathSubstitution::create(xContext) ); + const ::sal_Bool bSubstRequired = sal_True; + const ::rtl::OUString sCompleteCommand = xSubst->substituteVariables(sCommand, bSubstRequired); return sCompleteCommand; } diff --git a/framework/source/services/pathsettings.cxx b/framework/source/services/pathsettings.cxx index 8d74d71379ef..3de4348eb06d 100644 --- a/framework/source/services/pathsettings.cxx +++ b/framework/source/services/pathsettings.cxx @@ -48,6 +48,7 @@ #include <com/sun/star/container/XContainer.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/util/XChangesNotifier.hpp> +#include <com/sun/star/util/PathSubstitution.hpp> // ______________________________________________ // includes of other projects @@ -55,6 +56,7 @@ #include <rtl/ustrbuf.hxx> #include <rtl/logfile.hxx> +#include <comphelper/componentcontext.hxx> #include <comphelper/configurationhelper.hxx> #include <unotools/configpaths.hxx> @@ -1091,11 +1093,10 @@ css::uno::Reference< css::util::XStringSubstitution > PathSettings::fa_getSubsti { // create the needed substitution service. // We must replace all used variables inside readed path values. - // In case we can't do so ... the whole office can't work realy. + // In case we can't do so ... the whole office can't work really. // That's why it seams to be OK to throw a RuntimeException then. - xSubst = css::uno::Reference< css::util::XStringSubstitution >( - xSMGR->createInstance(SERVICENAME_SUBSTITUTEPATHVARIABLES), - css::uno::UNO_QUERY_THROW); + css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::ComponentContext(xSMGR).getUNOContext() ); + xSubst = css::util::PathSubstitution::create(xContext); // SAFE -> WriteGuard aWriteLock(m_aLock); |