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>
This commit is contained in:
parent
9df9949cc4
commit
110183572b
2 changed files with 3 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue