bin/find-can-be-private-symbols.functions.results | 1 - include/svl/numformat.hxx | 6 +----- sc/source/ui/view/formatsh.cxx | 2 +- svl/source/numbers/zforlist.cxx | 9 +++++++-- svx/source/items/numfmtsh.cxx | 2 +- sw/source/core/fields/fldbas.cxx | 10 ++++------ xmloff/source/style/xmlnumfe.cxx | 2 +- xmloff/source/style/xmlnumfi.cxx | 2 +- 8 files changed, 16 insertions(+), 18 deletions(-)
New commits: commit e8d01d2447b3350f1bd24e07580402c4c699756c Author: Caolán McNamara <[email protected]> AuthorDate: Wed Mar 20 17:22:46 2024 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Mar 21 20:34:52 2024 +0100 Related: tdf#160056 this can be be a local function Change-Id: I0ffebd5a1f871b86507d0c1b3946b32993d76365 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165106 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/bin/find-can-be-private-symbols.functions.results b/bin/find-can-be-private-symbols.functions.results index 31b9cef633aa..2782bdc631a7 100644 --- a/bin/find-can-be-private-symbols.functions.results +++ b/bin/find-can-be-private-symbols.functions.results @@ -6491,7 +6491,6 @@ SvNumberFormatter::GetNumThousandSep() const SvNumberFormatter::GetTransliteration() const SvNumberFormatter::GetUserDefColor(unsigned short) const SvNumberFormatter::ImpLookupCurrencyEntryLoopBody(NfCurrencyEntry const*&, bool&, NfCurrencyEntry const*, unsigned short, std::basic_string_view<char16_t, std::char_traits<char16_t> >) -SvNumberFormatter::ImpPosToken(rtl::OUStringBuffer const&, char16_t, int) const SvNumberFormatter::ImpSubstituteEntry(SvNumberformat*, unsigned int*) SvNumberFormatter::InvalidateDateAcceptancePatterns() SvNumberFormatter::IsDecimalSep(std::basic_string_view<char16_t, std::char_traits<char16_t> >) const diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx index ffbc5f8f9769..52ffa46d7920 100644 --- a/include/svl/numformat.hxx +++ b/include/svl/numformat.hxx @@ -673,10 +673,6 @@ private: // link to be set at <method>SvtSysLocaleOptions::SetCurrencyChangeLink()</method> DECL_DLLPRIVATE_STATIC_LINK(SvNumberFormatter, CurrencyChangeLink, LinkParamNone*, void); - // return position of a special character - sal_Int32 ImpPosToken(const OUStringBuffer& sFormat, sal_Unicode token, - sal_Int32 nStartPos = 0) const; - // Substitute a format during GetFormatEntry(), i.e. system formats. SvNumberformat* ImpSubstituteEntry(SvNumberformat* pFormat, sal_uInt32* o_pRealKey = nullptr); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 1a5d57437b08..b4ef00d2a96c 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -3084,8 +3084,10 @@ void SvNumberFormatter::ImpGenerateAdditionalFormats( sal_uInt32 CLOffset, pStdFormat->SetLastInsertKey( static_cast<sal_uInt16>(nPos - CLOffset), SvNumberformat::FormatterPrivateAccess() ); } +namespace { -sal_Int32 SvNumberFormatter::ImpPosToken ( const OUStringBuffer & sFormat, sal_Unicode token, sal_Int32 nStartPos /* = 0*/ ) const +// return position of a special character +sal_Int32 ImpPosToken(const OUStringBuffer & sFormat, sal_Unicode token, sal_Int32 nStartPos = 0) { sal_Int32 nLength = sFormat.getLength(); for ( sal_Int32 i=nStartPos; i<nLength && i>=0 ; i++ ) @@ -3118,6 +3120,8 @@ sal_Int32 SvNumberFormatter::ImpPosToken ( const OUStringBuffer & sFormat, sal_U return -2; } +} + OUString SvNumberFormatter::GenerateFormat(sal_uInt32 nIndex, LanguageType eLnge, bool bThousand, commit 49189bb8823adc6a76d3f33b34c02d6a640df96a Author: Caolán McNamara <[email protected]> AuthorDate: Wed Mar 20 16:43:26 2024 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Mar 21 20:34:44 2024 +0100 Related: tdf#160056 this can be static Change-Id: I1172854a1bf00e74adbe350c54e4e98ea38b0b35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165072 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx index e28bd3a1af94..ffbc5f8f9769 100644 --- a/include/svl/numformat.hxx +++ b/include/svl/numformat.hxx @@ -356,7 +356,7 @@ public: NF_INDEX_TABLE_ENTRIES if it's not a builtin format. @see NfIndexTableOffset */ - NfIndexTableOffset GetIndexTableOffset(sal_uInt32 nFormat) const; + static NfIndexTableOffset GetIndexTableOffset(sal_uInt32 nFormat); /** Set evaluation type and order of input date strings @see NfEvalDateFormat diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index c57aa34a57ce..d95c5e09810c 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1736,7 +1736,7 @@ void ScFormatShell::GetNumFormatState( SfxItemSet& rSet ) // SvNumFormatType::DEFINED bit. const SvNumFormatType nType = (eItemState >= SfxItemState::DEFAULT ? pFormatter->GetType( nNumberFormat) : GetCurrentNumberFormatType()); - NfIndexTableOffset nOffset = pFormatter->GetIndexTableOffset(nNumberFormat); + NfIndexTableOffset nOffset = SvNumberFormatter::GetIndexTableOffset(nNumberFormat); SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 206a0c090d2f..1a5d57437b08 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -3540,7 +3540,8 @@ sal_uInt32 SvNumberFormatter::GetFormatIndex( NfIndexTableOffset nTabOff, return nCLOffset + indexTable[nTabOff]; } -NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset( sal_uInt32 nFormat ) const +//static +NfIndexTableOffset SvNumberFormatter::GetIndexTableOffset(sal_uInt32 nFormat) { sal_uInt32 nOffset = nFormat % SV_COUNTRY_LANGUAGE_OFFSET; // relative index if ( nOffset > SV_MAX_COUNT_STANDARD_FORMATS ) diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 4f0825a88bca..aa9e668169cb 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -714,7 +714,7 @@ bool SvxNumberFormatShell::IsEssentialFormat_Impl(SvNumFormatType eType, sal_uIn if (nKey == nCurFormatKey) return true; - const NfIndexTableOffset nIndex = pFormatter->GetIndexTableOffset(nKey); + const NfIndexTableOffset nIndex = SvNumberFormatter::GetIndexTableOffset(nKey); switch (nIndex) { // These are preferred or edit formats. diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index 655a3a16f7df..fa3192d284b6 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -48,13 +48,12 @@ using namespace ::com::sun::star; using namespace nsSwDocInfoSubType; -static LanguageType lcl_GetLanguageOfFormat( LanguageType nLng, sal_uLong nFormat, - const SvNumberFormatter& rFormatter ) +static LanguageType lcl_GetLanguageOfFormat(LanguageType nLng, sal_uLong nFormat) { if( nLng == LANGUAGE_NONE ) // Bug #60010 nLng = LANGUAGE_SYSTEM; else if( nLng == ::GetAppLanguage() ) - switch( rFormatter.GetIndexTableOffset( nFormat )) + switch( SvNumberFormatter::GetIndexTableOffset( nFormat )) { case NF_NUMBER_SYSTEM: case NF_DATE_SYSTEM_SHORT: @@ -587,7 +586,7 @@ OUString SwValueFieldType::ExpandValue( const double& rVal, const Color* pCol = nullptr; // Bug #60010 - LanguageType nFormatLng = ::lcl_GetLanguageOfFormat( nLng, nFormat, *pFormatter ); + LanguageType nFormatLng = ::lcl_GetLanguageOfFormat( nLng, nFormat ); if( nFormat < SV_COUNTRY_LANGUAGE_OFFSET && LANGUAGE_SYSTEM != nFormatLng ) { @@ -756,8 +755,7 @@ void SwValueField::SetLanguage( LanguageType nLng ) { // Bug #60010 SvNumberFormatter* pFormatter = GetDoc()->GetNumberFormatter(); - LanguageType nFormatLng = ::lcl_GetLanguageOfFormat( nLng, GetFormat(), - *pFormatter ); + LanguageType nFormatLng = ::lcl_GetLanguageOfFormat( nLng, GetFormat() ); if( (GetFormat() >= SV_COUNTRY_LANGUAGE_OFFSET || LANGUAGE_SYSTEM != nFormatLng ) && diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index 406c22236a71..f86893c6708e 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -1100,7 +1100,7 @@ void SvXMLNumFmtExport::ExportPart_Impl( const SvNumberformat& rFormat, sal_uInt // element name - NfIndexTableOffset eBuiltIn = m_pFormatter->GetIndexTableOffset( nRealKey ); + NfIndexTableOffset eBuiltIn = SvNumberFormatter::GetIndexTableOffset( nRealKey ); SvNumFormatType nFmtType = SvNumFormatType::ALL; bool bThousand = false; diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index b6bf1d8844f7..424e3f9e599e 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -1688,7 +1688,7 @@ sal_Int32 SvXMLNumFormatContext::CreateAndInsert(SvNumberFormatter* pFormatter) // use fixed-order formats instead of SYS... if bAutoOrder is false // (only if the format strings are equal for the locale) - NfIndexTableOffset eOffset = pFormatter->GetIndexTableOffset( nIndex ); + NfIndexTableOffset eOffset = SvNumberFormatter::GetIndexTableOffset( nIndex ); if ( eOffset == NF_DATE_SYS_DMMMYYYY ) { sal_uInt32 nNewIndex = pFormatter->GetFormatIndex( NF_DATE_DIN_DMMMYYYY, m_nFormatLang );
