diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-27 11:11:11 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-03-27 17:23:45 +0100 |
commit | 6ddc398095bcbb288b1ef1ec3f01a52a615672f8 (patch) | |
tree | 682a027cf778fe030166ce9068f6dbea522cea78 | |
parent | 381e257a814036df6baab4ddbb96371fba856acf (diff) |
drop const_cast and be more honest that internal state changes
Change-Id: I20dd009b2bd14cdf958572dabc7a7e565a2f98ba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165393
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | include/svl/nfengine.hxx | 2 | ||||
-rw-r--r-- | include/svl/numformat.hxx | 2 | ||||
-rw-r--r-- | svl/source/numbers/zforlist.cxx | 11 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 2 |
4 files changed, 8 insertions, 9 deletions
diff --git a/include/svl/nfengine.hxx b/include/svl/nfengine.hxx index aa57d731fbac..a4890e074d1a 100644 --- a/include/svl/nfengine.hxx +++ b/include/svl/nfengine.hxx @@ -92,7 +92,7 @@ public: bool IsDecimalSep(std::u16string_view rStr) const; /// Return the decimal separator matching the given locale / LanguageType. - OUString GetLangDecimalSep(LanguageType nLang) const; + OUString GetLangDecimalSep(LanguageType nLang); /// Change language/country, also input and format scanner void ChangeIntl(LanguageType eLnge); diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx index 7acecbcbc2b4..b26e245ca8d5 100644 --- a/include/svl/numformat.hxx +++ b/include/svl/numformat.hxx @@ -264,7 +264,7 @@ public: const SvNumberformat* GetEntry(sal_uInt32 nKey) const; /// Obtain substituted GetFormatEntry(), i.e. system formats. - const SvNumberformat* GetSubstitutedEntry(sal_uInt32 nKey, sal_uInt32& o_rNewKey) const; + const SvNumberformat* GetSubstitutedEntry(sal_uInt32 nKey, sal_uInt32& o_rNewKey); /// Return the format index of the standard default number format for language/country sal_uInt32 GetStandardIndex(LanguageType eLnge = LANGUAGE_DONTKNOW); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 05f3dd9f2daa..9a4490849d11 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -362,7 +362,7 @@ bool SvNFLanguageData::IsDecimalSep( std::u16string_view rStr ) const return rStr == GetNumDecimalSepAlt(); } -OUString SvNFLanguageData::GetLangDecimalSep( LanguageType nLang ) const +OUString SvNFLanguageData::GetLangDecimalSep( LanguageType nLang ) { if (nLang == ActLnge) { @@ -377,9 +377,9 @@ OUString SvNFLanguageData::GetLangDecimalSep( LanguageType nLang ) const else { LanguageTag aSaveLocale( xLocaleData->getLanguageTag() ); - const_cast<SvNFLanguageData*>(this)->xLocaleData.changeLocale( LanguageTag( nLang)); + xLocaleData.changeLocale( LanguageTag( nLang)); aRet = xLocaleData->getNumDecimalSep(); - const_cast<SvNFLanguageData*>(this)->xLocaleData.changeLocale( aSaveLocale ); + xLocaleData.changeLocale( aSaveLocale ); } return aRet; } @@ -2886,14 +2886,13 @@ const SvNumberformat* SvNumberFormatter::GetEntry( sal_uInt32 nKey ) const return m_aFormatData.GetFormatEntry(nKey); } -const SvNumberformat* SvNumberFormatter::GetSubstitutedEntry( sal_uInt32 nKey, sal_uInt32 & o_rNewKey ) const +const SvNumberformat* SvNumberFormatter::GetSubstitutedEntry( sal_uInt32 nKey, sal_uInt32 & o_rNewKey ) { ::osl::MutexGuard aGuard( GetInstanceMutex() ); // A tad ugly, but GetStandardFormat() and GetFormatIndex() in // ImpSubstituteEntry() may have to add the LANGUAGE_SYSTEM formats if not // already present (which in practice most times they are). - SvNumberFormatter* pThis = const_cast<SvNumberFormatter*>(this); - return pThis->ImpSubstituteEntry( pThis->m_aFormatData.GetFormatEntry( nKey), &o_rNewKey); + return ImpSubstituteEntry(m_aFormatData.GetFormatEntry(nKey), &o_rNewKey); } const SvNumberformat* SvNumberFormatter::ImpSubstituteEntry( const SvNumberformat* pFormat, sal_uInt32 * o_pRealKey ) diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index ca34bd235aad..951c61ec04e1 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -858,7 +858,7 @@ SvNumberformat::SvNumberformat(OUString& rString, else if (rScan.GetConvertMode() && ((nDecPos = sStr.indexOf( aConvertFromDecSep)) >= 0)) { if (aConvertToDecSep.isEmpty()) - aConvertToDecSep = GetCurrentLanguageData().GetLangDecimalSep( rScan.GetNewLnge()); + aConvertToDecSep = rScan.GetCurrentLanguageData().GetLangDecimalSep( rScan.GetNewLnge()); if (aConvertToDecSep != aConvertFromDecSep) { const OUString aStr( sStr.replaceAt( nDecPos, |