summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basic/source/uno/namecont.cxx7
-rw-r--r--extensions/source/logging/filehandler.cxx7
-rw-r--r--filter/source/xsltfilter/XSLTFilter.cxx9
-rw-r--r--framework/source/dispatch/systemexec.cxx7
-rw-r--r--framework/source/jobs/shelljob.cxx9
-rw-r--r--framework/source/services/pathsettings.cxx9
-rw-r--r--unotools/source/config/moduleoptions.cxx12
-rw-r--r--unotools/source/config/pathoptions.cxx3
-rw-r--r--xmloff/source/core/DocumentSettingsContext.cxx18
-rw-r--r--xmloff/source/core/SettingsExportHelper.cxx7
10 files changed, 43 insertions, 45 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 7a954000d239..2baa1853a35b 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -62,6 +62,7 @@
#include <com/sun/star/script/LibraryNotLoadedException.hpp>
#include <com/sun/star/script/vba/VBAScriptEventId.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/util/PathSubstitution.hpp>
#include <com/sun/star/deployment/ExtensionManager.hpp>
#include <comphelper/componentcontext.hxx>
#include <comphelper/storagehelper.hxx>
@@ -388,11 +389,7 @@ SfxLibraryContainer::SfxLibraryContainer( void )
mxSFI = ucb::SimpleFileAccess::create( comphelper::ComponentContext(mxMSF).getUNOContext() );
- mxStringSubstitution = Reference< XStringSubstitution >( mxMSF->createInstance
- ( OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.PathSubstitution")) ), UNO_QUERY );
- SAL_WARN_IF(
- !mxStringSubstitution.is(), "basic",
- "couldn't create PathSubstitution component");
+ mxStringSubstitution = util::PathSubstitution::create( comphelper::ComponentContext(mxMSF).getUNOContext() );
}
SfxLibraryContainer::~SfxLibraryContainer()
diff --git a/extensions/source/logging/filehandler.cxx b/extensions/source/logging/filehandler.cxx
index c0750a90cab2..0d5d9d9965f3 100644
--- a/extensions/source/logging/filehandler.cxx
+++ b/extensions/source/logging/filehandler.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/ucb/AlreadyInitializedException.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/util/PathSubstitution.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
/** === end UNO includes === **/
@@ -75,6 +76,7 @@ namespace logging
using ::com::sun::star::uno::Exception;
using ::com::sun::star::lang::IllegalArgumentException;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::util::PathSubstitution;
using ::com::sun::star::util::XStringSubstitution;
using ::com::sun::star::beans::NamedValue;
/** === end UNO using === **/
@@ -240,9 +242,8 @@ namespace logging
{
try
{
- Reference< XStringSubstitution > xStringSubst;
- if ( m_aContext.createComponent( "com.sun.star.util.PathSubstitution", xStringSubst ) )
- _inout_rURL = xStringSubst->substituteVariables( _inout_rURL, true );
+ Reference< XStringSubstitution > xStringSubst(PathSubstitution::create(m_aContext.getUNOContext()));
+ _inout_rURL = xStringSubst->substituteVariables( _inout_rURL, true );
}
catch( const Exception& )
{
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index f3ebd2f62992..fd3fc8b6a51b 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -41,6 +41,7 @@
#include <rtl/strbuf.hxx>
#include <tools/urlobj.hxx>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/interaction.hxx>
#include <com/sun/star/lang/XComponent.hpp>
@@ -67,6 +68,7 @@
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XActiveDataControl.hpp>
#include <com/sun/star/io/XStreamListener.hpp>
+#include <com/sun/star/util/PathSubstitution.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
@@ -245,12 +247,9 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
XSLTFilter::rel2abs(const OUString& s)
{
+ css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::ComponentContext(m_rServiceFactory).getUNOContext() );
css::uno::Reference<XStringSubstitution>
- subs(
- m_rServiceFactory->createInstance(
- OUString(
- "com.sun.star.util.PathSubstitution" )),
- UNO_QUERY);
+ subs(css::util::PathSubstitution::create(xContext));
OUString aWorkingDir(subs->getSubstituteVariableValue(OUString( "$(progurl)")));
INetURLObject aObj(aWorkingDir);
aObj.setFinalSlash();
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);
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
diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx
index 6b08e12dcf8d..99e6ee4895d5 100644
--- a/xmloff/source/core/DocumentSettingsContext.cxx
+++ b/xmloff/source/core/DocumentSettingsContext.cxx
@@ -31,6 +31,7 @@
#include <officecfg/Office/Common.hxx>
#include <sax/tools/converter.hxx>
+#include <com/sun/star/util/PathSubstitution.hpp>
#include <com/sun/star/util/XStringSubstitution.hpp>
#include <xmloff/DocumentSettingsContext.hxx>
#include <xmloff/xmlimp.hxx>
@@ -39,6 +40,7 @@
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmluconv.hxx>
#include <tools/debug.hxx>
+#include <comphelper/componentcontext.hxx>
#include <list>
#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
@@ -716,17 +718,13 @@ void XMLConfigItemContext::ManipulateConfigItem()
{
if( GetImport().getServiceFactory().is() ) try
{
- uno::Reference< util::XStringSubstitution > xStringSubsitution(
- GetImport().getServiceFactory()->
- createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ), uno::UNO_QUERY );
+ uno::Reference< uno::XComponentContext > xContext( comphelper::ComponentContext(GetImport().getServiceFactory()).getUNOContext() );
+ uno::Reference< util::XStringSubstitution > xStringSubsitution( util::PathSubstitution::create(xContext) );
- if( xStringSubsitution.is() )
- {
- rtl::OUString aURL;
- mrAny >>= aURL;
- aURL = xStringSubsitution->substituteVariables( aURL, sal_False );
- mrAny <<= aURL;
- }
+ rtl::OUString aURL;
+ mrAny >>= aURL;
+ aURL = xStringSubsitution->substituteVariables( aURL, sal_False );
+ mrAny <<= aURL;
}
catch( uno::Exception& )
{
diff --git a/xmloff/source/core/SettingsExportHelper.cxx b/xmloff/source/core/SettingsExportHelper.cxx
index abfef5d2a6ff..79c21a2651be 100644
--- a/xmloff/source/core/SettingsExportHelper.cxx
+++ b/xmloff/source/core/SettingsExportHelper.cxx
@@ -34,6 +34,7 @@
#include <xmloff/xmltoken.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/extract.hxx>
#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
@@ -41,6 +42,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
+#include <com/sun/star/util/PathSubstitution.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/formula/SymbolDescriptor.hpp>
@@ -545,10 +547,9 @@ void XMLSettingsExportHelper::ManipulateSetting( uno::Any& rAny, const rtl::OUSt
{
if( m_rContext.GetServiceFactory().is() ) try
{
+ uno::Reference< uno::XComponentContext > xContext( comphelper::ComponentContext(m_rContext.GetServiceFactory()).getUNOContext() );
const_cast< XMLSettingsExportHelper* >(this)->mxStringSubsitution =
- uno::Reference< util::XStringSubstitution >::query(
- m_rContext.GetServiceFactory()->
- createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.PathSubstitution" ) ) ) );
+ util::PathSubstitution::create(xContext);
}
catch( uno::Exception& )
{