summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-05-30 16:45:36 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-06-06 10:01:22 +0200
commit392a483e1040787857fa09fead0547d567c570b5 (patch)
tree76f2f1aab1a5a9c81c30e212e0df3f568fa92e34 /xmloff
parentd08578912f2c9ef42d4349079422e25b951e544e (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 'xmloff')
-rw-r--r--xmloff/source/core/DocumentSettingsContext.cxx18
-rw-r--r--xmloff/source/core/SettingsExportHelper.cxx7
2 files changed, 12 insertions, 13 deletions
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& )
{