diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-08 11:02:37 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-11 08:02:13 +0200 |
commit | 591ef7844079e93ff627c7e194c04d520d2f1d55 (patch) | |
tree | 39c16f140ef2eae20f00a6c078d49519d4bd6bdc /comphelper | |
parent | 81c967e06e4247dec7ecb9ffec695ba31cb4f057 (diff) |
fdo#46808, Use singleton util::theMacroExpander new-style constructor
And deprecate the old-style service util::MacroExpander
Change-Id: Ifcefe31a8f8c68c6d44d6ec19616727eb607e1cd
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/officeinstdir/officeinstallationdirectories.cxx | 38 |
1 files changed, 14 insertions, 24 deletions
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 ); } } } |