diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-02-29 12:33:23 +0000 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2024-03-01 11:59:28 +0100 |
commit | 72caa6437556d349051b4cf100dda5d2befc4095 (patch) | |
tree | 719864321f38f28f557ad800a7b92e5195eaab11 /svl | |
parent | b203c6561a9bc5830f1d3faa74358a9484331918 (diff) |
SvNumberFormatter::ImpConstruct is only used once by the single ctor
so fold it into the ctor
Change-Id: If063143ef47a8ab293edf3896fb51079d0e0284f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164144
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 657631791421eae2c88a89da27bd2c0dc1822175)
there is only the one ctor, so drop misleading "preferred" comment
that suggests there are alternatives to choose from
Change-Id: Ica3367fae93f57f339bdc39b1cd91d47a2c9618e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164146
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 023e59d0283614a568362b794bb94a9254401d7e)
if we rearrange, we don't need to create maLanguageTag twice
Change-Id: I2c8ad9999adc406dc850c59b48e49681099dc054
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164147
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 9fcee419dd368823d842b9c9a032b2213ee24d34)
use member init list
Change-Id: I09dea90e3e3f3fd0a4047b989329a027f788f695
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164148
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 8f7cb2b7474d877af61ab00f6635aec5cefa3d78)
IniLnge is set during ctor and never changes subsequently
Change-Id: Ie052e32976d9810555c8f1892dab47a7472cdc71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164149
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
(cherry picked from commit 1245614991654b9d3ddb15f644a689585fd4c9de)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164185
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 62 |
1 files changed, 24 insertions, 38 deletions
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 3b6c2bd7f1b5..fa9c83757eff 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -275,44 +275,18 @@ const sal_uInt16 SvNumberFormatter::INPUTSTRING_PRECISION = ::std::numeric_limit SvNumberFormatter::SvNumberFormatter( const Reference< XComponentContext >& rxContext, LanguageType eLang ) : m_xContext( rxContext ) - , maLanguageTag( eLang) + , IniLnge(eLang != LANGUAGE_DONTKNOW ? eLang : UNKNOWN_SUBSTITUTE) + , ActLnge(IniLnge) + , maLanguageTag(IniLnge) + , MaxCLOffset(0) + , nDefaultSystemCurrencyFormat(NUMBERFORMAT_ENTRY_NOT_FOUND) + , eEvalDateFormat(NF_EVALDATEFORMAT_INTL) + , bNoZero(false) { - ImpConstruct( eLang ); -} - -SvNumberFormatter::~SvNumberFormatter() -{ - { - ::osl::MutexGuard aGuard( GetGlobalMutex() ); - pFormatterRegistry->Remove( this ); - if ( !pFormatterRegistry->Count() ) - { - delete pFormatterRegistry; - pFormatterRegistry = nullptr; - } - } - - aFTable.clear(); - ClearMergeTable(); -} - - -void SvNumberFormatter::ImpConstruct( LanguageType eLang ) -{ - if ( eLang == LANGUAGE_DONTKNOW ) - { - eLang = UNKNOWN_SUBSTITUTE; - } - IniLnge = eLang; - ActLnge = eLang; - eEvalDateFormat = NF_EVALDATEFORMAT_INTL; - nDefaultSystemCurrencyFormat = NUMBERFORMAT_ENTRY_NOT_FOUND; - - maLanguageTag.reset( eLang ); xCharClass.changeLocale( m_xContext, maLanguageTag ); xLocaleData.init( m_xContext, maLanguageTag ); xCalendar.init( m_xContext, maLanguageTag.getLocale() ); - xTransliteration.init( m_xContext, eLang ); + xTransliteration.init( m_xContext, IniLnge ); xNatNum.init( m_xContext ); // cached locale data items @@ -324,16 +298,28 @@ void SvNumberFormatter::ImpConstruct( LanguageType eLang ) pStringScanner.reset( new ImpSvNumberInputScan( this ) ); pFormatScanner.reset( new ImpSvNumberformatScan( this ) ); - pFormatTable = nullptr; - MaxCLOffset = 0; ImpGenerateFormats( 0, false ); // 0 .. 999 for initialized language formats - pMergeTable = nullptr; - bNoZero = false; ::osl::MutexGuard aGuard( GetGlobalMutex() ); GetFormatterRegistry().Insert( this ); } +SvNumberFormatter::~SvNumberFormatter() +{ + { + ::osl::MutexGuard aGuard( GetGlobalMutex() ); + pFormatterRegistry->Remove( this ); + if ( !pFormatterRegistry->Count() ) + { + delete pFormatterRegistry; + pFormatterRegistry = nullptr; + } + } + + aFTable.clear(); + ClearMergeTable(); +} + void SvNumberFormatter::ChangeIntl(LanguageType eLnge) { |