diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-05-16 11:19:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-05-16 12:04:10 +0100 |
commit | 8512e5c2b3617a2c8d77381788c3864db594ce46 (patch) | |
tree | c7fde308b180a2bce971fc80958d8bd28aa123d0 /svl | |
parent | c7f60050da130eaeab11a53142a65b61c92c34a1 (diff) |
reduce static_initialization_and_destruction chain
Change-Id: I962aeac0c7feeabb7963016d5afcfeca5a48ccfe
Diffstat (limited to 'svl')
-rw-r--r-- | svl/inc/svl/zforlist.hxx | 13 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 19 |
2 files changed, 18 insertions, 14 deletions
diff --git a/svl/inc/svl/zforlist.hxx b/svl/inc/svl/zforlist.hxx index 96a8955936e5..701216468f0d 100644 --- a/svl/inc/svl/zforlist.hxx +++ b/svl/inc/svl/zforlist.hxx @@ -339,9 +339,6 @@ public: */ static const sal_uInt16 INPUTSTRING_PRECISION; - /** THE set of installed locales. */ - static NfInstalledLocales theInstalledLocales; - /// Preferred ctor with service manager and language/country enum SvNumberFormatter( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMgr, @@ -809,15 +806,7 @@ public: String GetStandardName( LanguageType eLnge ); /** Check if a specific locale has supported locale data. */ - static bool IsLocaleInstalled( LanguageType eLang ) - { - // The set is initialized as a side effect of the currency table - // created, make sure that exists, which usually is the case unless a - // SvNumberFormatter was never instanciated. - GetTheCurrencyTable(); - return theInstalledLocales.find( eLang) != theInstalledLocales.end(); - } - + static bool IsLocaleInstalled( LanguageType eLang ); private: ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index c09d14ea28b2..7c8a49ca727b 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -178,6 +178,11 @@ namespace struct theLegacyOnlyCurrencyTable : public rtl::Static< NfCurrencyTable, theLegacyOnlyCurrencyTable > {}; + + /** THE set of installed locales. */ + struct theInstalledLocales : + public rtl::Static< NfInstalledLocales, theInstalledLocales> {}; + } sal_uInt16 SvNumberFormatter::nSystemCurrencyPosition = 0; SV_IMPL_PTRARR( NfCurrencyTable, NfCurrencyEntry* ); @@ -192,7 +197,6 @@ SV_IMPL_PTRARR( NfWSStringsDtor, String* ); const sal_uInt16 SvNumberFormatter::UNLIMITED_PRECISION = ::std::numeric_limits<sal_uInt16>::max(); const sal_uInt16 SvNumberFormatter::INPUTSTRING_PRECISION = ::std::numeric_limits<sal_uInt16>::max()-1; -NfInstalledLocales SvNumberFormatter::theInstalledLocales; SvNumberFormatter::SvNumberFormatter( const Reference< XMultiServiceFactory >& xSMgr, @@ -3514,6 +3518,16 @@ void lcl_CheckCurrencySymbolPosition( const NfCurrencyEntry& rCurr ) } } +// static +bool SvNumberFormatter::IsLocaleInstalled( LanguageType eLang ) +{ + // The set is initialized as a side effect of the currency table + // created, make sure that exists, which usually is the case unless a + // SvNumberFormatter was never instanciated. + GetTheCurrencyTable(); + const NfInstalledLocales &rInstalledLocales = theInstalledLocales::get(); + return rInstalledLocales.find( eLang) != rInstalledLocales.end(); +} // static void SvNumberFormatter::ImpInitCurrencyTable() @@ -3554,12 +3568,13 @@ void SvNumberFormatter::ImpInitCurrencyTable() Locale const * const pLocales = xLoc.getConstArray(); NfCurrencyTable &rCurrencyTable = theCurrencyTable::get(); NfCurrencyTable &rLegacyOnlyCurrencyTable = theLegacyOnlyCurrencyTable::get(); + NfInstalledLocales &rInstalledLocales = theInstalledLocales::get(); sal_uInt16 nLegacyOnlyCurrencyPos = 0; for ( sal_Int32 nLocale = 0; nLocale < nLocaleCount; nLocale++ ) { LanguageType eLang = MsLangId::convertLocaleToLanguage( pLocales[nLocale]); - theInstalledLocales.insert( eLang); + rInstalledLocales.insert( eLang); pLocaleData->setLocale( pLocales[nLocale] ); Sequence< Currency2 > aCurrSeq = pLocaleData->getAllCurrencies(); sal_Int32 nCurrencyCount = aCurrSeq.getLength(); |