summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-02-08 11:02:37 +0200
committerNoel Grandin <noel@peralex.com>2013-02-11 08:02:13 +0200
commit591ef7844079e93ff627c7e194c04d520d2f1d55 (patch)
tree39c16f140ef2eae20f00a6c078d49519d4bd6bdc
parent81c967e06e4247dec7ecb9ffec695ba31cb4f057 (diff)
fdo#46808, Use singleton util::theMacroExpander new-style constructor
And deprecate the old-style service util::MacroExpander Change-Id: Ifcefe31a8f8c68c6d44d6ec19616727eb607e1cd
-rw-r--r--basctl/source/basicide/scriptdocument.cxx8
-rw-r--r--basic/source/uno/namecont.cxx10
-rw-r--r--comphelper/source/officeinstdir/officeinstallationdirectories.cxx38
-rw-r--r--cui/source/options/treeopt.cxx9
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx8
-rw-r--r--fileaccess/source/FileAccess.cxx22
-rw-r--r--filter/source/xsltfilter/XSLTFilter.cxx8
-rw-r--r--framework/source/fwe/classes/addonsoptions.cxx12
-rw-r--r--framework/source/uielement/imagebuttontoolbarcontroller.cxx6
-rw-r--r--jvmaccess/source/classpath.cxx13
-rw-r--r--scripting/source/basprov/basprov.cxx11
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx8
-rw-r--r--sd/source/core/CustomAnimationPreset.cxx7
-rw-r--r--sd/source/core/TransitionPreset.cxx7
-rw-r--r--sdext/source/minimizer/configurationaccess.cxx10
-rw-r--r--sfx2/source/doc/doctemplates.cxx13
-rw-r--r--shell/source/unix/exec/shellexec.cxx16
-rw-r--r--stoc/source/javavm/javavm.cxx19
-rw-r--r--ucb/source/ucp/expand/ucpexpand.cxx9
-rw-r--r--udkapi/UnoApi_udkapi.mk6
-rw-r--r--udkapi/com/sun/star/util/MacroExpander.idl4
-rw-r--r--udkapi/com/sun/star/util/theMacroExpander.idl7
-rw-r--r--unotools/source/config/lingucfg.cxx15
-rw-r--r--unotools/source/config/moduleoptions.cxx16
-rw-r--r--unotools/source/config/pathoptions.cxx24
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx7
-rw-r--r--xmlhelp/source/treeview/tvread.cxx28
27 files changed, 108 insertions, 233 deletions
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
index b184974b0fc0..fac7f9dca87f 100644
--- a/basctl/source/basicide/scriptdocument.cxx
+++ b/basctl/source/basicide/scriptdocument.cxx
@@ -26,7 +26,7 @@
#include "documentenumeration.hxx"
#include <com/sun/star/uri/UriReferenceFactory.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/document/MacroExecMode.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
@@ -93,6 +93,7 @@ namespace basctl
using ::com::sun::star::uri::XUriReference;
using ::com::sun::star::uno::XComponentContext;
using ::com::sun::star::util::XMacroExpander;
+ using ::com::sun::star::util::theMacroExpander;
using ::com::sun::star::io::XInputStreamProvider;
using ::com::sun::star::uno::Any;
using ::com::sun::star::io::XInputStream;
@@ -953,10 +954,7 @@ namespace basctl
{
OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) );
aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- Reference< XMacroExpander > xMacroExpander(
- xContext->getValueByName(
- "/singletons/com.sun.star.util.theMacroExpander" ),
- UNO_QUERY_THROW );
+ Reference< XMacroExpander > xMacroExpander = theMacroExpander::get(xContext);
aFileURL = xMacroExpander->expandMacros( aDecodedURL );
}
}
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 2a61123290e3..eb2dceb389ed 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -54,6 +54,7 @@
#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/util/theMacroExpander.hpp>
#include <com/sun/star/deployment/ExtensionManager.hpp>
#include <comphelper/processfactory.hxx>
#include <comphelper/storagehelper.hxx>
@@ -2848,14 +2849,7 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
if( !mxMacroExpander.is() )
{
Reference< XComponentContext > xContext(comphelper::getComponentContext( mxMSF ) );
- Reference< util::XMacroExpander > xExpander;
- xContext->getValueByName( OUString("/singletons/com.sun.star.util.theMacroExpander") ) >>= xExpander;
- if(! xExpander.is())
- {
- throw uno::DeploymentException(
- OUString("no macro expander singleton available!"),
- Reference< XInterface >() );
- }
+ Reference< util::XMacroExpander > xExpander = util::theMacroExpander::get(xContext);
MutexGuard guard( Mutex::getGlobalMutex() );
if( !mxMacroExpander.is() )
{
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
index 49928ddb32f1..e04b6801026a 100644
--- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
+++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx
@@ -28,7 +28,7 @@
#include "osl/file.hxx"
#include "com/sun/star/beans/XPropertySet.hpp"
-#include "com/sun/star/util/XMacroExpander.hpp"
+#include "com/sun/star/util/theMacroExpander.hpp"
#include "officeinstallationdirectories.hxx"
@@ -290,35 +290,25 @@ void OfficeInstallationDirectories::initDirs()
m_pOfficeBrandDir = new rtl::OUString;
m_pUserDir = new rtl::OUString;
- uno::Reference< util::XMacroExpander > xExpander;
+ uno::Reference< util::XMacroExpander > xExpander = util::theMacroExpander::get(m_xCtx);
- m_xCtx->getValueByName(
- OUString("/singletons/com.sun.star.util.theMacroExpander"))
- >>= xExpander;
+ *m_pOfficeBrandDir =
+ xExpander->expandMacros(
+ OUString( "$BRAND_BASE_DIR" ) );
- OSL_ENSURE( xExpander.is(),
- "Unable to obtain macro expander singleton!" );
+ OSL_ENSURE( !m_pOfficeBrandDir->isEmpty(),
+ "Unable to obtain office brand installation directory!" );
- if ( xExpander.is() )
- {
- *m_pOfficeBrandDir =
- xExpander->expandMacros(
- OUString( "$BRAND_BASE_DIR" ) );
-
- OSL_ENSURE( !m_pOfficeBrandDir->isEmpty(),
- "Unable to obtain office brand installation directory!" );
+ makeCanonicalFileURL( *m_pOfficeBrandDir );
- makeCanonicalFileURL( *m_pOfficeBrandDir );
+ *m_pUserDir =
+ xExpander->expandMacros(
+ OUString("${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":UserInstallation}" ) );
- *m_pUserDir =
- xExpander->expandMacros(
- OUString("${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":UserInstallation}" ) );
+ OSL_ENSURE( !m_pUserDir->isEmpty(),
+ "Unable to obtain office user data directory!" );
- OSL_ENSURE( !m_pUserDir->isEmpty(),
- "Unable to obtain office user data directory!" );
-
- makeCanonicalFileURL( *m_pUserDir );
- }
+ makeCanonicalFileURL( *m_pUserDir );
}
}
}
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index bbd9f6fd818b..358a56570adf 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -58,7 +58,7 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <comphelper/processfactory.hxx>
#include <editeng/optitems.hxx>
#include <editeng/unolingu.hxx>
@@ -824,15 +824,14 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
}
// MacroExpander to convert "expand"-URL to "file"-URL
- Reference< XMacroExpander > m_xMacroExpander;
+ Reference< XMacroExpander > xMacroExpander;
bool bMustExpand = ( INetURLObject( sLastURL ).GetProtocol() == INET_PROT_FILE );
if ( bMustExpand )
{
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
- m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >(
- xContext->getValueByName( ::rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) ), UNO_QUERY );
+ xMacroExpander = theMacroExpander::get(xContext);
}
SvTreeListEntry* pTemp = aTreeLB.First();
@@ -853,7 +852,7 @@ void OfaTreeOptionsDialog::ActivateLastSelection()
sTemp = ::rtl::Uri::decode(
sTemp, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
// expand string
- sPageURL = m_xMacroExpander->expandMacros( sTemp );
+ sPageURL = xMacroExpander->expandMacros( sTemp );
}
if ( ( !bIsFromExtensionManager
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 0704e9243327..2f6d8988ec7f 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -42,7 +42,7 @@
#include "com/sun/star/loader/XImplementationLoader.hpp"
#include "com/sun/star/io/XInputStream.hpp"
#include "com/sun/star/ucb/NameClash.hpp"
-#include "com/sun/star/util/XMacroExpander.hpp"
+#include "com/sun/star/util/theMacroExpander.hpp"
#include <list>
#include <boost/unordered_map.hpp>
#include <vector>
@@ -1083,11 +1083,7 @@ Reference<XComponentContext> raise_uno_process(
{
OSL_ASSERT( xContext.is() );
- ::rtl::OUString url(
- Reference<util::XMacroExpander>(
- xContext->getValueByName( "/singletons/com.sun.star.util.theMacroExpander" ),
- UNO_QUERY_THROW )->
- expandMacros( "$URE_BIN_DIR/uno" ) );
+ ::rtl::OUString url( util::theMacroExpander::get(xContext)->expandMacros( "$URE_BIN_DIR/uno" ) );
::rtl::OUStringBuffer buf;
buf.appendAscii( "uno:pipe,name=" );
diff --git a/fileaccess/source/FileAccess.cxx b/fileaccess/source/FileAccess.cxx
index b4c45db5beda..165b773b120e 100644
--- a/fileaccess/source/FileAccess.cxx
+++ b/fileaccess/source/FileAccess.cxx
@@ -49,7 +49,7 @@
#include <com/sun/star/ucb/XContent.hpp>
#include <com/sun/star/ucb/XContentAccess.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess3.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <vector>
@@ -81,7 +81,7 @@ class OCommandEnvironment;
class OFileAccess : public FileAccessHelper
{
- Reference< XMultiServiceFactory > mxSMgr;
+ Reference< XComponentContext > m_xContext;
Reference< XCommandEnvironment > mxEnvironment;
OCommandEnvironment* mpEnvironment;
@@ -93,8 +93,8 @@ class OFileAccess : public FileAccessHelper
throw ( Exception );
public:
- OFileAccess( const Reference< XMultiServiceFactory > & xSMgr )
- : mxSMgr( xSMgr), mpEnvironment( NULL ) {}
+ OFileAccess( const Reference< XComponentContext > & xContext )
+ : m_xContext( xContext), mpEnvironment( NULL ) {}
// Methods
virtual void SAL_CALL copy( const ::rtl::OUString& SourceURL, const ::rtl::OUString& DestURL ) throw(::com::sun::star::ucb::CommandAbortedException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
@@ -252,17 +252,7 @@ void OFileAccess::transferImpl( const rtl::OUString& rSource,
try
{
- Reference< XComponentContext > xCtx(
- comphelper::getComponentContext( mxSMgr ) );
-
- Reference< XMacroExpander > xExpander;
-
- xCtx->getValueByName(
- rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) )
- >>= xExpander;
-
- OSL_ENSURE( xExpander.is(),
- "Unable to obtain macro expander singleton!" );
+ Reference< XMacroExpander > xExpander = theMacroExpander::get(m_xContext);
aDestURL = xExpander->expandMacros(
aDestObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) );
@@ -791,7 +781,7 @@ void OFileAccess::setHidden( const ::rtl::OUString& FileURL, sal_Bool bHidden )
Reference< XInterface > SAL_CALL FileAccess_CreateInstance( const Reference< XMultiServiceFactory > & xSMgr )
{
- return Reference < XInterface >( ( cppu::OWeakObject * ) new OFileAccess( xSMgr ) );
+ return Reference < XInterface >( ( cppu::OWeakObject * ) new OFileAccess( comphelper::getComponentContext(xSMgr) ) );
}
diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx
index 7771f885a353..30f7e0dc3ed2 100644
--- a/filter/source/xsltfilter/XSLTFilter.cxx
+++ b/filter/source/xsltfilter/XSLTFilter.cxx
@@ -50,7 +50,7 @@
#include <com/sun/star/xml/XImportFilter.hpp>
#include <com/sun/star/xml/XExportFilter.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/io/Pipe.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -181,11 +181,7 @@ m_rServiceFactory(r), m_bTerminated(sal_False), m_bError(sal_False)
css::uno::Reference<XComponentContext> xContext(
comphelper::getComponentContext(m_rServiceFactory));
css::uno::Reference<XMacroExpander>
- xMacroExpander(
- xContext->getValueByName(
- ::rtl::OUString(
- "/singletons/com.sun.star.util.theMacroExpander" )),
- UNO_QUERY_THROW);
+ xMacroExpander = theMacroExpander::get(xContext);
sExpandedUrl = xMacroExpander->expandMacros(sUrl);
sal_Int32 nPos = sExpandedUrl.indexOf( "vnd.sun.star.expand:" );
if (nPos != -1)
diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx
index 44ee290f3834..077c3a3f90c7 100644
--- a/framework/source/fwe/classes/addonsoptions.cxx
+++ b/framework/source/fwe/classes/addonsoptions.cxx
@@ -24,7 +24,7 @@
#include <tools/stream.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include "com/sun/star/util/XMacroExpander.hpp"
+#include "com/sun/star/util/theMacroExpander.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include <rtl/ustrbuf.hxx>
#include <rtl/uri.hxx>
@@ -46,6 +46,7 @@ using namespace ::osl ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::beans ;
using namespace ::com::sun::star::lang ;
+using namespace ::com::sun::star;
#define ROOTNODE_ADDONMENU ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Office.Addons" ))
#define PATHDELIMITER ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/" ))
@@ -350,7 +351,7 @@ class AddonsOptions_Impl : public ConfigItem
AddonToolBars m_aCachedToolBarPartProperties;
std::vector< rtl::OUString > m_aCachedToolBarPartResourceNames;
Sequence< Sequence< PropertyValue > > m_aCachedHelpMenuProperties;
- Reference< com::sun::star::util::XMacroExpander > m_xMacroExpander;
+ Reference< util::XMacroExpander > m_xMacroExpander;
ImageManager m_aImageManager;
Sequence< Sequence< PropertyValue > > m_aEmptyAddonToolBar;
MergeMenuInstructionContainer m_aCachedMergeMenuInsContainer;
@@ -407,9 +408,7 @@ AddonsOptions_Impl::AddonsOptions_Impl()
Reference< XComponentContext > xContext(
comphelper::getProcessComponentContext() );
- m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
- UNO_QUERY );
+ m_xMacroExpander = util::theMacroExpander::get(xContext);
ReadConfigurationData();
@@ -1287,8 +1286,7 @@ sal_Bool AddonsOptions_Impl::HasAssociatedImages( const ::rtl::OUString& aURL )
//*****************************************************************************************************************
void AddonsOptions_Impl::SubstituteVariables( ::rtl::OUString& aURL )
{
- if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) &&
- m_xMacroExpander.is() )
+ if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) )
{
// cut protocol
::rtl::OUString macro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) );
diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
index e57af2e878dd..cabe8b14005e 100644
--- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx
+++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx
@@ -27,7 +27,7 @@
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/frame/XControlNotificationListener.hpp>
-#include "com/sun/star/util/XMacroExpander.hpp"
+#include "com/sun/star/util/theMacroExpander.hpp"
#include "com/sun/star/uno/XComponentContext.hpp"
#include <rtl/uri.hxx>
@@ -73,9 +73,7 @@ uno::Reference< util::XMacroExpander > GetMacroExpander()
{
uno::Reference< uno::XComponentContext > xContext(
comphelper::getProcessComponentContext() );
- m_xMacroExpander = Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander"))),
- UNO_QUERY );
+ m_xMacroExpander = util::theMacroExpander::get(xContext);
xMacroExpander = m_xMacroExpander;
}
}
diff --git a/jvmaccess/source/classpath.cxx b/jvmaccess/source/classpath.cxx
index 4861849e2789..5fc4a7e38ea7 100644
--- a/jvmaccess/source/classpath.cxx
+++ b/jvmaccess/source/classpath.cxx
@@ -31,7 +31,7 @@
#include "com/sun/star/uno/XInterface.hpp"
#include "com/sun/star/uri/UriReferenceFactory.hpp"
#include "com/sun/star/uri/XVndSunStarExpandUrlReference.hpp"
-#include "com/sun/star/util/XMacroExpander.hpp"
+#include "com/sun/star/util/theMacroExpander.hpp"
#include "osl/diagnose.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
@@ -65,15 +65,10 @@ void * ::jvmaccess::ClassPath::doTranslateToUrls(
css::uri::UriReferenceFactory::create(context)->parse(url),
css::uno::UNO_QUERY);
if (expUrl.is()) {
- css::uno::Reference< css::util::XMacroExpander > expander(
- context->getValueByName(
- ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "/singletons/"
- "com.sun.star.util.theMacroExpander"))),
- css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::util::XMacroExpander > expander =
+ css::util::theMacroExpander::get(context);
try {
- url = expUrl->expand(expander);
+ url = expUrl->expand( expander );
} catch (const css::lang::IllegalArgumentException & e) {
throw css::uno::RuntimeException(
(::rtl::OUString(
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx
index 30743ec0fb7a..674885b4334d 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -41,7 +41,7 @@
#include <sfx2/app.hxx>
#include <sfx2/objsh.hxx>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/script/XLibraryContainer2.hpp>
#include <com/sun/star/uri/XUriReference.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
@@ -155,12 +155,9 @@ namespace basprov
{
::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) );
aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- Reference<util::XMacroExpander> xMacroExpander(
- m_xContext->getValueByName(
- ::rtl::OUString("/singletons/com.sun.star.util.theMacroExpander") ),
- UNO_QUERY );
- if ( xMacroExpander.is() )
- aFileURL = xMacroExpander->expandMacros( aDecodedURL );
+ Reference<util::XMacroExpander> xMacroExpander =
+ util::theMacroExpander::get(m_xContext);
+ aFileURL = xMacroExpander->expandMacros( aDecodedURL );
}
}
}
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 04c458f273de..9ea9735c9d44 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -47,7 +47,7 @@
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarScriptUrl.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <util/MiscUtils.hxx>
@@ -295,10 +295,8 @@ static ::rtl::OUString aResourceResolverPropName("ResourceResolver");
// Accept file URL to single dialog
bool bSingleDialog = false;
- Reference< util::XMacroExpander > xMacroExpander(
- m_xContext->getValueByName(
- ::rtl::OUString("/singletons/com.sun.star.util.theMacroExpander") ),
- UNO_QUERY_THROW );
+ Reference< util::XMacroExpander > xMacroExpander =
+ util::theMacroExpander::get(m_xContext);
Reference< uri::XUriReference > uriRef;
for (;;)
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index 3e923eb83387..3cc45984e16e 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -18,7 +18,7 @@
*/
#include <com/sun/star/util/XCloneable.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -303,9 +303,8 @@ void CustomAnimationPresets::importEffects()
Reference< XMultiServiceFactory > xServiceFactory(
xContext->getServiceManager(), UNO_QUERY_THROW );
- uno::Reference< util::XMacroExpander > xMacroExpander(
- xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
- UNO_QUERY );
+ uno::Reference< util::XMacroExpander > xMacroExpander =
+ util::theMacroExpander::get(xContext);
Reference< XMultiServiceFactory > xConfigProvider =
configuration::theDefaultProvider::get( xContext );
diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx
index 53a09b8a26d6..3c9f408a635d 100644
--- a/sd/source/core/TransitionPreset.cxx
+++ b/sd/source/core/TransitionPreset.cxx
@@ -23,7 +23,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/animations/AnimationNodeType.hpp>
#include <vcl/svapp.hxx>
#include <osl/mutex.hxx>
@@ -148,9 +148,8 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
Reference< XMultiServiceFactory > xServiceFactory(
xContext->getServiceManager(), UNO_QUERY_THROW );
- uno::Reference< util::XMacroExpander > xMacroExpander(
- xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
- UNO_QUERY );
+ uno::Reference< util::XMacroExpander > xMacroExpander =
+ util::theMacroExpander::get(xContext);
// import ui strings
Reference< XMultiServiceFactory > xConfigProvider =
diff --git a/sdext/source/minimizer/configurationaccess.cxx b/sdext/source/minimizer/configurationaccess.cxx
index 3057e91808bc..3a0f78af567e 100644
--- a/sdext/source/minimizer/configurationaccess.cxx
+++ b/sdext/source/minimizer/configurationaccess.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <sal/macros.h>
@@ -169,18 +169,14 @@ rtl::OUString ConfigurationAccess::getPath( const PPPOptimizerTokenEnum eToken )
try
{
static const OUString sProtocol( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.expand:" ) );
- static const OUString stheMacroExpander( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" ) );
Reference< container::XNameAccess > xSet( OpenConfiguration( true ), UNO_QUERY_THROW );
if ( xSet->hasByName( TKGet( eToken ) ) )
xSet->getByName( TKGet( eToken ) ) >>= aPath;
if ( aPath.match( sProtocol, 0 ) )
{
rtl::OUString aTmp( aPath.copy( 20 ) );
- Reference< util::XMacroExpander > xExpander;
- if ( mxMSF->getValueByName( stheMacroExpander ) >>= xExpander )
- {
- aPath = xExpander->expandMacros( aTmp );
- }
+ Reference< util::XMacroExpander > xExpander = util::theMacroExpander::get(mxMSF);
+ aPath = xExpander->expandMacros( aTmp );
}
}
catch (const Exception&)
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 49e71cdcbc42..94ba00bd2c4f 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -38,7 +38,7 @@
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/StringPair.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
@@ -580,17 +580,10 @@ void SfxDocTplService_Impl::getDirList()
uno::Reference< XComponentContext > xCtx(
comphelper::getComponentContext( mxFactory ) );
- uno::Reference< util::XMacroExpander > xExpander;
+ uno::Reference< util::XMacroExpander > xExpander = util::theMacroExpander::get(xCtx);
const rtl::OUString aPrefix(
"vnd.sun.star.expand:" );
- xCtx->getValueByName(
- rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) )
- >>= xExpander;
-
- OSL_ENSURE( xExpander.is(),
- "Unable to obtain macro expander singleton!" );
-
for ( sal_uInt16 i=0; i<nCount; i++ )
{
aURL.SetSmartProtocol( INET_PROT_FILE );
@@ -2852,7 +2845,7 @@ void SfxURLRelocator_Impl::implExpandURL( ::rtl::OUString& io_url )
if ( !mxMacroExpander.is() )
{
::comphelper::ComponentContext aContext( mxFactory );
- mxMacroExpander.set( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY_THROW );
+ mxMacroExpander.set( theMacroExpander::get(aContext.getUNOContext()), UNO_QUERY_THROW );
}
io_url = mxMacroExpander->expandMacros( io_url );
}
diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
index be926bf89cf4..755e1ecef321 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -27,7 +27,7 @@
#include "shellexec.hxx"
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp>
@@ -168,19 +168,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
// The url launchers are expected to be in the $BRAND_BASE_DIR/program
// directory:
com::sun::star::uno::Reference< com::sun::star::util::XMacroExpander >
- exp;
- if (!(m_xContext->getValueByName(
- rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander"))
- >>= exp)
- || !exp.is())
- {
- throw SystemShellExecuteException(
- rtl::OUString(
- "component context fails to supply singleton"
- " com.sun.star.util.theMacroExpander of type"
- " com.sun.star.util.XMacroExpander"),
- static_cast< XSystemShellExecute * >(this), ENOENT);
- }
+ exp = com::sun::star::util::theMacroExpander::get(m_xContext);
OUString aProgramURL;
try {
aProgramURL = exp->expandMacros(
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index e0ac281de0c6..d105f344aa9e 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -48,7 +48,7 @@
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XCurrentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp"
-#include "com/sun/star/util/XMacroExpander.hpp"
+#include "com/sun/star/util/theMacroExpander.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
#include "cppuhelper/exc_hlp.hxx"
#include "cppuhelper/factory.hxx"
@@ -1624,22 +1624,7 @@ void JavaVirtualMachine::setINetSettingsInVM(bool set_reset)
}
void JavaVirtualMachine::setUpUnoVirtualMachine(JNIEnv * environment) {
- css::uno::Reference< css::util::XMacroExpander > exp;
- if (!(m_xContext->getValueByName(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "/singletons/com.sun.star.util.theMacroExpander")))
- >>= exp)
- || !exp.is())
- {
- throw css::uno::RuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "component context fails to supply singleton"
- " com.sun.star.util.theMacroExpander of type"
- " com.sun.star.util.XMacroExpander")),
- m_xContext);
- }
+ css::uno::Reference< css::util::XMacroExpander > exp = css::util::theMacroExpander::get(m_xContext);
rtl::OUString baseUrl;
try {
baseUrl = exp->expandMacros(
diff --git a/ucb/source/ucp/expand/ucpexpand.cxx b/ucb/source/ucp/expand/ucpexpand.cxx
index bf6846823f56..9dd95fa5d7fd 100644
--- a/ucb/source/ucp/expand/ucpexpand.cxx
+++ b/ucb/source/ucp/expand/ucpexpand.cxx
@@ -29,7 +29,7 @@
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/registry/XRegistryKey.hpp"
-#include "com/sun/star/util/XMacroExpander.hpp"
+#include "com/sun/star/util/theMacroExpander.hpp"
#include "com/sun/star/ucb/XContentProvider.hpp"
#define EXPAND_PROTOCOL "vnd.sun.star.expand"
@@ -54,7 +54,7 @@ typedef ::cppu::WeakComponentImplHelper2<
class ExpandContentProviderImpl : protected MutexHolder, public t_impl_helper
{
uno::Reference< uno::XComponentContext > m_xComponentContext;
- uno::Reference< util::XMacroExpander > m_xMacroExpander;
+ uno::Reference< util::XMacroExpander > m_xMacroExpander;
OUString expandUri(
uno::Reference< ucb::XContentIdentifier > const & xIdentifier ) const;
@@ -67,10 +67,7 @@ public:
uno::Reference< uno::XComponentContext > const & xComponentContext )
: t_impl_helper( m_mutex ),
m_xComponentContext( xComponentContext ),
- m_xMacroExpander(
- xComponentContext->getValueByName(
- "/singletons/com.sun.star.util.theMacroExpander" ),
- uno::UNO_QUERY_THROW )
+ m_xMacroExpander( util::theMacroExpander::get(xComponentContext) )
{}
virtual ~ExpandContentProviderImpl() throw ();
diff --git a/udkapi/UnoApi_udkapi.mk b/udkapi/UnoApi_udkapi.mk
index 2d8abc63a9db..262ad55d8154 100644
--- a/udkapi/UnoApi_udkapi.mk
+++ b/udkapi/UnoApi_udkapi.mk
@@ -95,8 +95,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/script,
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,udkapi,udkapi/com/sun/star/util,\
BootstrapMacroExpander \
- MacroExpander \
- theMacroExpander \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/beans,\
@@ -149,6 +147,10 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/uri,\
UriSchemeParser_vndDOTsunDOTstarDOTscript \
VndSunStarPkgUrlReferenceFactory \
))
+$(eval $(call gb_UnoApi_add_idlfiles_nohdl,udkapi,udkapi/com/sun/star/util,\
+ MacroExpander \
+ theMacroExpander \
+))
$(eval $(call gb_UnoApi_add_idlfiles,udkapi,udkapi/com/sun/star/beans,\
diff --git a/udkapi/com/sun/star/util/MacroExpander.idl b/udkapi/com/sun/star/util/MacroExpander.idl
index 9c656452d0f2..40195f38b165 100644
--- a/udkapi/com/sun/star/util/MacroExpander.idl
+++ b/udkapi/com/sun/star/util/MacroExpander.idl
@@ -19,9 +19,8 @@
#ifndef __com_sun_star_util_MacroExpander_idl__
#define __com_sun_star_util_MacroExpander_idl__
-#include <com/sun/star/util/XMacroExpander.idl>
#include <com/sun/star/lang/XComponent.idl>
-
+#include <com/sun/star/util/XMacroExpander.idl>
module com { module sun { module star { module util {
@@ -36,6 +35,7 @@ module com { module sun { module star { module util {
@see theMacroExpander
@since OOo 1.1.2
+ @deprecated rather use the util::theMacroExpander singleton
*/
published service MacroExpander
{
diff --git a/udkapi/com/sun/star/util/theMacroExpander.idl b/udkapi/com/sun/star/util/theMacroExpander.idl
index 998b498f22ed..c2de31268ad3 100644
--- a/udkapi/com/sun/star/util/theMacroExpander.idl
+++ b/udkapi/com/sun/star/util/theMacroExpander.idl
@@ -20,7 +20,7 @@
#ifndef __com_sun_star_util_theMacroExpander_idl__
#define __com_sun_star_util_theMacroExpander_idl__
-#include <com/sun/star/util/MacroExpander.idl>
+#include <com/sun/star/util/XMacroExpander.idl>
module com { module sun { module star { module util {
@@ -35,10 +35,7 @@ module com { module sun { module star { module util {
@see MacroExpander
*/
-published singleton theMacroExpander
-{
- service MacroExpander;
-};
+published singleton theMacroExpander : XMacroExpander;
}; }; }; };
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 45fc0a7ac0f7..6721821fe8ac 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
-#include "com/sun/star/util/XMacroExpander.hpp"
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <rtl/uri.hxx>
#include <rtl/instance.hxx>
#include <osl/mutex.hxx>
@@ -937,15 +937,8 @@ static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander()
uno::Reference< util::XMacroExpander > xMacroExpander( aG_xMacroExpander );
if ( !xMacroExpander.is() )
{
- if ( !xMacroExpander.is() )
- {
- uno::Reference< uno::XComponentContext > xContext(
- comphelper::getProcessComponentContext() );
- aG_xMacroExpander = uno::Reference< com::sun::star::util::XMacroExpander >( xContext->getValueByName(
- OUString(RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.util.theMacroExpander"))),
- uno::UNO_QUERY );
- xMacroExpander = aG_xMacroExpander;
- }
+ aG_xMacroExpander = util::theMacroExpander::get( comphelper::getProcessComponentContext() );
+ xMacroExpander = aG_xMacroExpander;
}
return xMacroExpander;
@@ -958,7 +951,7 @@ static bool lcl_GetFileUrlFromOrigin(
uno::Reference< util::XMacroExpander > &rxMacroExpander )
{
bool bSuccess = false;
- if (!rOrigin.isEmpty() && rxMacroExpander.is())
+ if (!rOrigin.isEmpty())
{
rtl::OUString aURL( rOrigin );
if (( aURL.compareToAscii( RTL_CONSTASCII_STRINGPARAM( EXPAND_PROTOCOL )) == 0 ) &&
diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx
index 4c03a2cd93dd..9023d8d700b6 100644
--- a/unotools/source/config/moduleoptions.cxx
+++ b/unotools/source/config/moduleoptions.cxx
@@ -98,8 +98,6 @@ struct FactoryInfo
FactoryInfo()
{
free();
- // @@@ should be supplied from outside!
- xSMgr = ::comphelper::getProcessServiceFactory();
}
//---------------------------------------------------------------------------------------------------------
@@ -262,10 +260,7 @@ struct FactoryInfo
{
if ( !xSubstVars.is() )
{
- css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getComponentContext(xSMgr) );
- xSubstVars
- = css::uno::Reference< css::util::XStringSubstitution >(
- css::util::PathSubstitution::create(xContext) );
+ xSubstVars.set( css::util::PathSubstitution::create(::comphelper::getProcessComponentContext()) );
}
return xSubstVars;
}
@@ -286,7 +281,6 @@ struct FactoryInfo
sal_Bool bChangedIcon :1 ;
sal_Bool bDefaultFilterReadonly :1 ;
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMgr;
css::uno::Reference< css::util::XStringSubstitution > xSubstVars;
};
@@ -1271,18 +1265,16 @@ SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByServiceName(const
SvtModuleOptions::EFactory SvtModuleOptions::ClassifyFactoryByURL(const ::rtl::OUString& sURL ,
const css::uno::Sequence< css::beans::PropertyValue >& lMediaDescriptor)
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
- if (!xSMGR.is())
- return E_UNKNOWN_FACTORY;
+ css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
css::uno::Reference< css::container::XNameAccess > xFilterCfg;
css::uno::Reference< css::container::XNameAccess > xTypeCfg ;
try
{
xFilterCfg = css::uno::Reference< css::container::XNameAccess >(
- xSMGR->createInstance(::rtl::OUString("com.sun.star.document.FilterFactory")), css::uno::UNO_QUERY);
+ xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.FilterFactory", xContext), css::uno::UNO_QUERY);
xTypeCfg = css::uno::Reference< css::container::XNameAccess >(
- xSMGR->createInstance(::rtl::OUString("com.sun.star.document.TypeDetection")), css::uno::UNO_QUERY);
+ xContext->getServiceManager()->createInstanceWithContext("com.sun.star.document.TypeDetection", xContext), css::uno::UNO_QUERY);
}
catch(const css::uno::RuntimeException&)
{ throw; }
diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx
index a4fe929024ee..507c902df9e2 100644
--- a/unotools/source/config/pathoptions.cxx
+++ b/unotools/source/config/pathoptions.cxx
@@ -38,7 +38,7 @@
#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>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <rtl/instance.hxx>
#include <itemholder1.hxx>
@@ -416,11 +416,11 @@ OUString SvtPathOptions_Impl::SubstVar( const OUString& rVar ) const
SvtPathOptions_Impl::SvtPathOptions_Impl() :
m_aPathArray( (sal_Int32)SvtPathOptions::PATH_COUNT )
{
- Reference< XMultiServiceFactory > xSMgr = comphelper::getProcessServiceFactory();
+ Reference< XComponentContext > xContext = comphelper::getProcessComponentContext();
// Create necessary services
- m_xPathSettings = Reference< XFastPropertySet >( xSMgr->createInstance(
- ::rtl::OUString( "com.sun.star.util.PathSettings" )),
+ m_xPathSettings = Reference< XFastPropertySet >( xContext->getServiceManager()->createInstanceWithContext(
+ "com.sun.star.util.PathSettings", xContext),
UNO_QUERY );
if ( !m_xPathSettings.is() )
{
@@ -431,9 +431,8 @@ SvtPathOptions_Impl::SvtPathOptions_Impl() :
Reference< XInterface >() );
}
- ::comphelper::ComponentContext aContext( xSMgr );
- m_xSubstVariables.set( PathSubstitution::create(aContext.getUNOContext()) );
- m_xMacroExpander.set( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY_THROW );
+ m_xSubstVariables.set( PathSubstitution::create(xContext) );
+ m_xMacroExpander = theMacroExpander::get(xContext);
// Create temporary hash map to have a mapping between property names and property handles
Reference< XPropertySet > xPropertySet = Reference< XPropertySet >( m_xPathSettings, UNO_QUERY );
@@ -944,14 +943,9 @@ sal_Bool SvtPathOptions::SearchFile( String& rIniFile, Paths ePath )
}
if ( aObj.GetProtocol() == INET_PROT_VND_SUN_STAR_EXPAND )
{
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference< XMacroExpander > xMacroExpander( aContext.getSingleton( "com.sun.star.util.theMacroExpander" ), UNO_QUERY );
- OSL_ENSURE( xMacroExpander.is(), "SvtPathOptions::SearchFile: unable to access the MacroExpander singleton!" );
- if ( xMacroExpander.is() )
- {
- const ::rtl::OUString sExpandedPath = xMacroExpander->expandMacros( aObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) );
- aObj.SetURL( sExpandedPath );
- }
+ Reference< XMacroExpander > xMacroExpander = theMacroExpander::get( ::comphelper::getProcessComponentContext() );
+ const ::rtl::OUString sExpandedPath = xMacroExpander->expandMacros( aObj.GetURLPath( INetURLObject::DECODE_WITH_CHARSET ) );
+ aObj.SetURL( sExpandedPath );
}
sal_Int32 nIniIndex = 0;
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 7eda0aad3403..33f1c1c724de 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -46,7 +46,7 @@
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/frame/XConfigManager.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
#include <com/sun/star/script/XInvocation.hpp>
@@ -91,10 +91,7 @@ rtl::OUString Databases::expandURL( const rtl::OUString& aURL, Reference< uno::X
{
xFac = uri::UriReferenceFactory::create( xContext );
- xMacroExpander = Reference< util::XMacroExpander >(
- xContext->getValueByName(
- ::rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) ),
- UNO_QUERY_THROW );
+ xMacroExpander = util::theMacroExpander::get(xContext);
}
rtl::OUString aRetURL = aURL;
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index fb9b62767b01..b47a2abd5536 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -31,7 +31,7 @@
#include <comphelper/processfactory.hxx>
#include "com/sun/star/deployment/thePackageManagerFactory.hpp"
-#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/util/theMacroExpander.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrl.hpp>
#include <comphelper/locale.hxx>
@@ -1281,29 +1281,23 @@ rtl::OUString TreeFileIterator::expandURL( const rtl::OUString& aURL )
{
xFac = uri::UriReferenceFactory::create( m_xContext );
- xMacroExpander = Reference< util::XMacroExpander >(
- m_xContext->getValueByName(
- ::rtl::OUString( "/singletons/com.sun.star.util.theMacroExpander" ) ),
- UNO_QUERY_THROW );
+ xMacroExpander = util::theMacroExpander::get(m_xContext);
}
rtl::OUString aRetURL = aURL;
- if( xMacroExpander.is() )
+ Reference< uri::XUriReference > uriRef;
+ for (;;)
{
- Reference< uri::XUriReference > uriRef;
- for (;;)
+ uriRef = Reference< uri::XUriReference >( xFac->parse( aRetURL ), UNO_QUERY );
+ if ( uriRef.is() )
{
- uriRef = Reference< uri::XUriReference >( xFac->parse( aRetURL ), UNO_QUERY );
- if ( uriRef.is() )
- {
- Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY );
- if( !sxUri.is() )
- break;
+ Reference < uri::XVndSunStarExpandUrl > sxUri( uriRef, UNO_QUERY );
+ if( !sxUri.is() )
+ break;
- aRetURL = sxUri->expand( xMacroExpander );
- }
+ aRetURL = sxUri->expand( xMacroExpander );
}
- }
+ }
return aRetURL;
}