diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-03-19 14:34:52 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-03-19 14:45:53 +0100 |
commit | 3968f5e874038ddfdcf70080ba6f122a48753b60 (patch) | |
tree | 83472373bd4eaa4832a9bd65e93ecc3dd723ea49 | |
parent | e8504d9737ba0306ab8bcde9fcd8f50fdf30d33f (diff) |
Simply obtain theMacroExpander on demand
Change-Id: I919c8f5c26d1c879dd77e691babaa4eb7f608c35
-rw-r--r-- | unotools/source/config/lingucfg.cxx | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 517a6cafad06..f5317f04f08a 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -930,39 +930,24 @@ sal_Bool SvtLinguConfig::GetSupportedDictionaryFormatsFor( return bSuccess; } -static uno::Reference< util::XMacroExpander > lcl_GetMacroExpander() -{ - static uno::WeakReference< util::XMacroExpander > aG_xMacroExpander; - - uno::Reference< util::XMacroExpander > xMacroExpander( aG_xMacroExpander ); - if ( !xMacroExpander.is() ) - { - aG_xMacroExpander = util::theMacroExpander::get( comphelper::getProcessComponentContext() ); - xMacroExpander = aG_xMacroExpander; - } - - return xMacroExpander; -} - - static bool lcl_GetFileUrlFromOrigin( OUString /*out*/ &rFileUrl, - const OUString &rOrigin, - uno::Reference< util::XMacroExpander > &rxMacroExpander ) + const OUString &rOrigin ) { bool bSuccess = false; if (!rOrigin.isEmpty()) { OUString aURL( rOrigin ); - if (( aURL.compareTo( EXPAND_PROTOCOL ) == 0 ) && - rxMacroExpander.is() ) + if ( aURL.compareTo( EXPAND_PROTOCOL ) == 0 ) { // cut protocol OUString aMacro( aURL.copy( sizeof ( EXPAND_PROTOCOL ) -1 ) ); // decode uric class chars aMacro = Uri::decode( aMacro, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); // expand macro string - aURL = rxMacroExpander->expandMacros( aMacro ); + aURL = util::theMacroExpander::get( + comphelper::getProcessComponentContext() )->expandMacros( + aMacro ); bool bIsFileUrl = aURL.compareTo( FILE_PROTOCOL ) == 0; if (bIsFileUrl) @@ -1013,11 +998,10 @@ sal_Bool SvtLinguConfig::GetDictionaryEntry( if (bSuccess) { // get file URL's for the locations - uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() ); for (sal_Int32 i = 0; i < aLocations.getLength(); ++i) { rtl::OUString &rLocation = aLocations[i]; - if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation, xMacroExpander )) + if (!lcl_GetFileUrlFromOrigin( rLocation, rLocation )) bSuccess = false; } @@ -1156,8 +1140,7 @@ rtl::OUString SvtLinguConfig::GetVendorImageUrl_Impl( rtl::OUString aTmp; if (aAny >>= aTmp) { - uno::Reference< util::XMacroExpander > xMacroExpander( lcl_GetMacroExpander() ); - if (lcl_GetFileUrlFromOrigin( aTmp, aTmp, xMacroExpander )) + if (lcl_GetFileUrlFromOrigin( aTmp, aTmp )) aRes = aTmp; } } |