summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorMaarten Bosmans <mkbosmans@gmail.com>2016-09-09 21:28:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2016-09-22 07:13:42 +0000
commit110183572bfe9da0020b4c506d4b458bf69b1e85 (patch)
tree2049535fd6c3fd88c1fd769de0f5f49d8032a742 /svl
parent9df9949cc484ea0ba109e7d41fd03b15afaedb11 (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>
Diffstat (limited to 'svl')
-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 568655eb487d..0542cf34c134 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -45,6 +45,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!
@@ -202,7 +203,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 );
@@ -624,10 +624,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 bf92049bae1f..001abe6de491 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