summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-03-28 00:39:06 +0100
committerEike Rathke <erack@redhat.com>2013-03-28 01:39:08 +0100
commit3106c4d37f70114c41ceca1213f12eb1bc0f92d4 (patch)
tree6990b266680959c2158cbd94b062024672cf36c1
parent68fac46e71e954d559eeb8591383f304f3038ad6 (diff)
eliminated useless back and forth conversion
Why convert back and forth between LanguageTag (formerly comphelper::Locale) if all you need and use is a BCP47 string. Change-Id: I1ec12186284211bcd7d115ee092c195b926e7cd0
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx19
-rw-r--r--framework/source/accelerators/presethandler.cxx17
-rw-r--r--framework/source/inc/accelerators/acceleratorconfiguration.hxx13
-rw-r--r--framework/source/inc/accelerators/presethandler.hxx4
4 files changed, 25 insertions, 28 deletions
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index c7a5f4ee83af..2a0330d30a58 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -53,7 +53,6 @@
#include <unotools/configpaths.hxx>
#include <rtl/logfile.hxx>
#include <svtools/acceleratorexecute.hxx>
-#include <i18npool/languagetag.hxx>
#include <stdio.h>
@@ -608,7 +607,7 @@ AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteA
}
//-----------------------------------------------
-LanguageTag XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
+OUString XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
@@ -623,8 +622,8 @@ LanguageTag XMLBasedAcceleratorConfiguration::impl_ts_getLocale() const
xProp->getPropertyValue("ooLocale") >>= sISOLocale;
if (sISOLocale.isEmpty())
- return LanguageTag( LANGUAGE_ENGLISH_US);
- return LanguageTag(sISOLocale);
+ return OUString("en-US");
+ return sISOLocale;
}
/*******************************************************************************
@@ -1264,7 +1263,7 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const
xModules->getByName(m_sModuleCFG) >>= xAccess;
}
- const ::rtl::OUString sIsoLang = impl_ts_getLocale().getBcp47();
+ const ::rtl::OUString sIsoLang = impl_ts_getLocale();
const ::rtl::OUString sDefaultLocale("en-US");
css::uno::Reference< css::container::XNameAccess > xKey;
@@ -1492,7 +1491,7 @@ void XCUBasedAcceleratorConfiguration::insertKeyToConfiguration( const css::awt:
xContainer->getByName(sKey) >>= xKey;
xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
- ::rtl::OUString sLocale = impl_ts_getLocale().getBcp47();
+ ::rtl::OUString sLocale = impl_ts_getLocale();
if ( !xCommand->hasByName(sLocale) )
xCommand->insertByName(sLocale, css::uno::makeAny(sCommand));
else
@@ -1574,7 +1573,7 @@ void XCUBasedAcceleratorConfiguration::reloadChanged( const ::rtl::OUString& sPr
if (xContainer->hasByName(sKey))
{
- ::rtl::OUString sLocale = impl_ts_getLocale().getBcp47();
+ ::rtl::OUString sLocale = impl_ts_getLocale();
xContainer->getByName(sKey) >>= xKey;
xKey->getByName(CFG_PROP_COMMAND) >>= xCommand;
xCommand->getByName(sLocale) >>= sCommand;
@@ -1646,7 +1645,7 @@ AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPrefer
}
//-----------------------------------------------
-LanguageTag XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
+OUString XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
{
// SAFE -> ----------------------------------
ReadGuard aReadLock(m_aLock);
@@ -1661,8 +1660,8 @@ LanguageTag XCUBasedAcceleratorConfiguration::impl_ts_getLocale() const
xProp->getPropertyValue("ooLocale") >>= sISOLocale;
if (sISOLocale.isEmpty())
- return LanguageTag( LANGUAGE_ENGLISH_US);
- return LanguageTag(sISOLocale);
+ return OUString("en-US");
+ return sISOLocale;
}
} // namespace framework
diff --git a/framework/source/accelerators/presethandler.cxx b/framework/source/accelerators/presethandler.cxx
index d65e2fabf7cc..7e5002883ad1 100644
--- a/framework/source/accelerators/presethandler.cxx
+++ b/framework/source/accelerators/presethandler.cxx
@@ -488,7 +488,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
{
// First try to find the right localized set inside share layer.
// Fallbacks are allowed there.
- LanguageTag aShareLocale( rLanguageTag);
+ OUString aShareLocale( rLanguageTag.getBcp47());
::rtl::OUString sLocalizedSharePath(sRelPathShare);
sal_Bool bAllowFallbacks = sal_True ;
xShare = impl_openLocalizedPathIgnoringErrors(sLocalizedSharePath, eShareMode, sal_True , aShareLocale, bAllowFallbacks);
@@ -496,7 +496,7 @@ void PresetHandler::connectToResource( PresetHandler::EConfigType
// The try to locate the right sub dir inside user layer ... without using fallbacks!
// Normaly the corresponding sub dir should be created matching the specified locale.
// Because we allow creation of storages inside user layer by default.
- LanguageTag aUserLocale( rLanguageTag);
+ OUString aUserLocale( rLanguageTag.getBcp47());
::rtl::OUString sLocalizedUserPath(sRelPathUser);
bAllowFallbacks = sal_False ;
xUser = impl_openLocalizedPathIgnoringErrors(sLocalizedUserPath, eUserMode , sal_False, aUserLocale, bAllowFallbacks);
@@ -800,22 +800,21 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
//-----------------------------------------------
::std::vector< ::rtl::OUString >::const_iterator PresetHandler::impl_findMatchingLocalizedValue(
const ::std::vector< ::rtl::OUString >& lLocalizedValues,
- LanguageTag& rLanguageTag,
+ OUString& rLanguageTag,
sal_Bool bAllowFallbacks )
{
::std::vector< ::rtl::OUString >::const_iterator pFound = lLocalizedValues.end();
if (bAllowFallbacks)
{
- pFound = LanguageTag::getFallback(lLocalizedValues, rLanguageTag.getBcp47());
+ pFound = LanguageTag::getFallback(lLocalizedValues, rLanguageTag);
}
else
{
- OUString aCheck( rLanguageTag.getBcp47());
for ( pFound = lLocalizedValues.begin();
pFound != lLocalizedValues.end() ;
++pFound )
{
- if (*pFound == aCheck)
+ if (*pFound == rLanguageTag)
break;
}
}
@@ -823,7 +822,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openPathIgnoring
// if we found a valid locale ... take it over to our in/out parameter rLanguageTag
if (pFound != lLocalizedValues.end())
{
- rLanguageTag.reset( *pFound);
+ rLanguageTag = *pFound;
}
return pFound;
@@ -834,7 +833,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat
::rtl::OUString& sPath ,
sal_Int32 eMode ,
sal_Bool bShare ,
- LanguageTag& rLanguageTag ,
+ OUString& rLanguageTag ,
sal_Bool bAllowFallback)
{
css::uno::Reference< css::embed::XStorage > xPath = impl_openPathIgnoringErrors(sPath, eMode, bShare);
@@ -857,7 +856,7 @@ css::uno::Reference< css::embed::XStorage > PresetHandler::impl_openLocalizedPat
if (pLocaleFolder != lSubFolders.end())
sLocalizedPath += *pLocaleFolder;
else
- sLocalizedPath += rLanguageTag.getBcp47();
+ sLocalizedPath += rLanguageTag;
css::uno::Reference< css::embed::XStorage > xLocalePath = impl_openPathIgnoringErrors(sLocalizedPath, eMode, bShare);
diff --git a/framework/source/inc/accelerators/acceleratorconfiguration.hxx b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
index 38889fa93ffa..a918a4627700 100644
--- a/framework/source/inc/accelerators/acceleratorconfiguration.hxx
+++ b/framework/source/inc/accelerators/acceleratorconfiguration.hxx
@@ -48,7 +48,6 @@
#include <cppuhelper/propshlp.hxx>
#include <cppuhelper/weak.hxx>
-#include <i18npool/languagetag.hxx>
#include <salhelper/singletonref.hxx>
//__________________________________________
@@ -210,10 +209,10 @@ class XMLBasedAcceleratorConfiguration : protected ThreadHelpBase
@descr We does not cache this value, because we are not listen
for changes on the configuration layer ...
- @return LanguageTag
- The current office locale.
+ @return OUString
+ The current office locale as BCP47 string.
*/
- LanguageTag impl_ts_getLocale() const;
+ OUString impl_ts_getLocale() const;
//______________________________________
// helper
@@ -428,10 +427,10 @@ class XCUBasedAcceleratorConfiguration : protected ThreadHelpBase
@descr We does not cache this value, because we are not listen
for changes on the configuration layer ...
- @return LanguageTag
- The current office locale.
+ @return OUString
+ The current office locale as BCP47 string.
*/
- LanguageTag impl_ts_getLocale() const;
+ OUString impl_ts_getLocale() const;
//______________________________________
// helper
diff --git a/framework/source/inc/accelerators/presethandler.hxx b/framework/source/inc/accelerators/presethandler.hxx
index c1069f320aa8..d5325f9cf093 100644
--- a/framework/source/inc/accelerators/presethandler.hxx
+++ b/framework/source/inc/accelerators/presethandler.hxx
@@ -455,7 +455,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
As a negative result the special iterator lLocalizedValues.end() will be returned.
*/
::std::vector< ::rtl::OUString >::const_iterator impl_findMatchingLocalizedValue(const ::std::vector< ::rtl::OUString >& lLocalizedValues,
- LanguageTag& rLanguageTag ,
+ OUString& rLanguageTag ,
sal_Bool bAllowFallbacks );
//---------------------------------------
@@ -489,7 +489,7 @@ class PresetHandler : private ThreadHelpBase // attention! Must be the first bas
css::uno::Reference< css::embed::XStorage > impl_openLocalizedPathIgnoringErrors(::rtl::OUString& sPath ,
sal_Int32 eMode ,
sal_Bool bShare ,
- LanguageTag& rLanguageTag ,
+ OUString& rLanguageTag ,
sal_Bool bAllowFallback);
//---------------------------------------