diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-10-26 15:10:09 +0100 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-10-26 15:10:09 +0100 |
commit | acae9170ea69e3b54b31ebf0322b53e4818172a3 (patch) | |
tree | 0e09d99e023c913c2e88d65100a322925534c6b8 /unotools/source/misc | |
parent | bd76a8cd10f3a734f4dc0489faa76bd4ce92866a (diff) |
#i103496#: shorten timespan when locale settings are inconsistent as they are stored at three different locations
Diffstat (limited to 'unotools/source/misc')
-rw-r--r-- | unotools/source/misc/syslocale.cxx | 59 |
1 files changed, 9 insertions, 50 deletions
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx index f108cd2ed3df..8e9d75c6ce0c 100644 --- a/unotools/source/misc/syslocale.cxx +++ b/unotools/source/misc/syslocale.cxx @@ -54,57 +54,19 @@ public: SvtSysLocaleOptions aSysLocaleOptions; LocaleDataWrapper* pLocaleData; CharClass* pCharClass; - com::sun::star::lang::Locale maLocale; - com::sun::star::lang::Locale maUILocale; - LanguageType meLanguage; - LanguageType meUILanguage; SvtSysLocale_Impl(); virtual ~SvtSysLocale_Impl(); CharClass* GetCharClass(); virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); - void GetLocale(); - void GetUILocale(); }; -void SvtSysLocale_Impl::GetLocale() -{ - // ask configuration - maLocale = aSysLocaleOptions.GetLocale(); - if ( maLocale.Language.getLength() ) - { - meLanguage = MsLangId::convertLocaleToLanguage( maLocale ); - } - else - { - meLanguage = MsLangId::getSystemLanguage(); - MsLangId::convertLanguageToLocale( meLanguage, maLocale ); - } -} - -void SvtSysLocale_Impl::GetUILocale() -{ - maLocale = aSysLocaleOptions.GetLocale(); - if ( maUILocale.Language.getLength() ) - { - meUILanguage = MsLangId::convertLocaleToLanguage( maUILocale ); - } - else - { - meUILanguage = MsLangId::getSystemUILanguage(); - MsLangId::convertLanguageToLocale( meUILanguage, maUILocale ); - } -} - // ----------------------------------------------------------------------- SvtSysLocale_Impl::SvtSysLocale_Impl() : pCharClass(NULL) { - GetLocale(); - GetUILocale(); - - pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), maLocale ); + pLocaleData = new LocaleDataWrapper( ::comphelper::getProcessServiceFactory(), aSysLocaleOptions.GetRealLocale() ); // listen for further changes aSysLocaleOptions.AddListener( this ); @@ -121,7 +83,7 @@ SvtSysLocale_Impl::~SvtSysLocale_Impl() CharClass* SvtSysLocale_Impl::GetCharClass() { if ( !pCharClass ) - pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), maLocale ); + pCharClass = new CharClass(::comphelper::getProcessServiceFactory(), aSysLocaleOptions.GetRealLocale() ); return pCharClass; } @@ -130,13 +92,10 @@ void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, sa MutexGuard aGuard( SvtSysLocale::GetMutex() ); if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE ) { - GetLocale(); - pLocaleData->setLocale( maLocale ); - GetCharClass()->setLocale( maLocale ); + com::sun::star::lang::Locale aLocale( aSysLocaleOptions.GetRealLocale() ); + pLocaleData->setLocale( aLocale ); + GetCharClass()->setLocale( aLocale ); } - - if ( nHint & SYSLOCALEOPTIONS_HINT_UILOCALE ) - GetUILocale(); } // ==================================================================== @@ -210,22 +169,22 @@ SvtSysLocaleOptions& SvtSysLocale::GetOptions() const com::sun::star::lang::Locale SvtSysLocale::GetLocale() const { - return pImpl->maLocale; + return pImpl->aSysLocaleOptions.GetRealLocale(); } LanguageType SvtSysLocale::GetLanguage() const { - return pImpl->meLanguage; + return pImpl->aSysLocaleOptions.GetRealLanguage(); } com::sun::star::lang::Locale SvtSysLocale::GetUILocale() const { - return pImpl->maUILocale; + return pImpl->aSysLocaleOptions.GetRealUILocale(); } LanguageType SvtSysLocale::GetUILanguage() const { - return pImpl->meUILanguage; + return pImpl->aSysLocaleOptions.GetRealUILanguage(); } |