diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-17 16:03:11 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-09-17 21:26:26 +0200 |
commit | 82689553221e1f8ceab62d72a27b31902d45f436 (patch) | |
tree | 17078ac4de66192ca44a66214ea081c094e421e6 /svl | |
parent | 54906a9b925dee3fd0076e9d258a82c223d62520 (diff) |
create OnDemandCharClass cache
and use it in SvNumberFormatter for situations where we are rapidly
switching locales (e.g. spreadsheet with alternating locales on adjacent
rows)
Change-Id: Ic35fdbbfbdc960673e91a37efed1d0e12c1a0751
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122264
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 9c35f99547fc..e623a0239743 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -303,7 +303,7 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang ) nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; maLanguageTag.reset( eLang ); - oCharClass.emplace( m_xContext, maLanguageTag ); + xCharClass.changeLocale( m_xContext, maLanguageTag ); xLocaleData.init( m_xContext, maLanguageTag ); xCalendar.init( m_xContext, maLanguageTag.getLocale() ); xTransliteration.init( m_xContext, eLang ); @@ -338,7 +338,7 @@ void SvNumberFormatter::ChangeIntl(LanguageType eLnge) ActLnge = eLnge; maLanguageTag.reset( eLnge ); - oCharClass.emplace( m_xContext, maLanguageTag ); + xCharClass.changeLocale( m_xContext, maLanguageTag ); xLocaleData.changeLocale( maLanguageTag ); xCalendar.changeLocale( maLanguageTag.getLocale() ); xTransliteration.changeLocale( eLnge ); @@ -532,7 +532,7 @@ const ::utl::TransliterationWrapper* SvNumberFormatter::GetTransliteration() con return xTransliteration.get(); } -const CharClass* SvNumberFormatter::GetCharClass() const { return oCharClass ? &*oCharClass : nullptr; } +const CharClass* SvNumberFormatter::GetCharClass() const { return xCharClass.get(); } const LocaleDataWrapper* SvNumberFormatter::GetLocaleData() const { return xLocaleData.get(); } @@ -1846,7 +1846,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString, eLnge = ActLnge; bool bEnglish = (eLnge == LANGUAGE_ENGLISH_US); - OUString aFormatStringUpper( oCharClass->uppercase( sFormatString ) ); + OUString aFormatStringUpper( xCharClass->uppercase( sFormatString ) ); sal_uInt32 nCLOffset = ImpGenerateCL( eLnge ); sal_uInt32 nKey = ImpIsEntry( aFormatStringUpper, nCLOffset, eLnge ); if ( nKey != NUMBERFORMAT_ENTRY_NOT_FOUND ) |