Kaydet (Commit) 11018357 authored tarafından Maarten Bosmans's avatar Maarten Bosmans Kaydeden (comit) Noel Grandin

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/29135Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 9df9949c
......@@ -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;
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment