summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaarten Bosmans <mkbosmans@gmail.com>2016-09-09 21:28:01 +0200
committerAndras Timar <andras.timar@collabora.com>2016-10-10 21:12:37 +0200
commitdf53a5f695b37bdd3eef57203fc0a3f4c95dbeea (patch)
treec721c1b174541372359c3beb47ebc55a73e8b51a
parentb396a8a328fee64173f9efaedc8f1c17aa5b8f52 (diff)
tdf#53698: Add a NumberFormatMapper member to SvNumberformatScan
This way the NumberFormatMapper can cache subsequent getFormatCode calls. It improves performance in case LANG=en_US. Change-Id: I81922f219c29a5aa302e5ad3afead107dee463e3 Reviewed-on: https://gerrit.libreoffice.org/29135 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> (cherry picked from commit 110183572bfe9da0020b4c506d4b458bf69b1e85)
-rw-r--r--svl/source/numbers/zforscan.cxx7
-rw-r--r--svl/source/numbers/zforscan.hxx1
2 files changed, 3 insertions, 5 deletions
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 31721593593a..807fb6316dd9 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -74,6 +74,7 @@ ImpSvNumberformatScan::ImpSvNumberformatScan( SvNumberFormatter* pFormatterP )
, nCurrPos(-1)
{
pFormatter = pFormatterP;
+ xNFC = css::i18n::NumberFormatMapper::create( pFormatter->GetComponentContext() );
bConvertMode = false;
bConvertSystemToSystem = false;
//! All keywords MUST be UPPERCASE!
@@ -231,7 +232,6 @@ void ImpSvNumberformatScan::SetDependentKeywords()
const LanguageTag& rLoadedLocale = pLocaleData->getLoadedLanguageTag();
LanguageType eLang = rLoadedLocale.getLanguageType( false);
- css::uno::Reference< css::i18n::XNumberFormatCode > xNFC = i18n::NumberFormatMapper::create( pFormatter->GetComponentContext() );
i18n::NumberFormatCode aFormat = xNFC->getFormatCode( NF_NUMBER_STANDARD, rLoadedLocale.getLocale() );
sNameStandardFormat = lcl_extractStandardGeneralName( aFormat.Code );
sKeyword[NF_KEY_GENERAL] = pCharClass->uppercase( sNameStandardFormat );
@@ -642,10 +642,7 @@ short ImpSvNumberformatScan::Next_Symbol( const OUString& rStr,
sal_Int32& nPos,
OUString& sSymbol )
{
- if ( bKeywordsNeedInit )
- {
- InitKeywords();
- }
+ InitKeywords();
const CharClass* pChrCls = pFormatter->GetCharClass();
const LocaleDataWrapper* pLoc = pFormatter->GetLocaleData();
short eType = 0;
diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx
index 82535fd1e84a..a94caea25ca5 100644
--- a/svl/source/numbers/zforscan.hxx
+++ b/svl/source/numbers/zforscan.hxx
@@ -154,6 +154,7 @@ private: // Private section
OUString sNameStandardFormat; // "Standard"
sal_uInt16 nStandardPrec; // Default Precision for Standardformat
SvNumberFormatter* pFormatter; // Pointer to the FormatList
+ css::uno::Reference< css::i18n::XNumberFormatCode > xNFC;
OUString sStrArray[NF_MAX_FORMAT_SYMBOLS]; // Array of symbols
short nTypeArray[NF_MAX_FORMAT_SYMBOLS]; // Array of infos