[Libreoffice-commits] core.git: svl/source

Maarten Bosmans mkbosmans at gmail.com
Thu Sep 22 07:16:06 UTC 2016


 svl/source/numbers/zforscan.cxx |    7 ++-----
 svl/source/numbers/zforscan.hxx |    1 +
 2 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 110183572bfe9da0020b4c506d4b458bf69b1e85
Author: Maarten Bosmans <mkbosmans at gmail.com>
Date:   Fri Sep 9 21:28:01 2016 +0200

    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 at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 568655e..0542cf3 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 bf92049..001abe6 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


More information about the Libreoffice-commits mailing list