include/svl/numformat.hxx | 4 ++-- include/svl/zformat.hxx | 12 ++++++------ sc/source/core/data/queryevaluator.cxx | 2 +- svl/source/numbers/zforlist.cxx | 5 ++--- svl/source/numbers/zformat.cxx | 12 ++++++------ 5 files changed, 17 insertions(+), 18 deletions(-)
New commits: commit e3e9d51c2d4bed475f9848c62c7b0e5c72d5e125 Author: Caolán McNamara <[email protected]> AuthorDate: Tue Mar 12 20:38:35 2024 +0000 Commit: Eike Rathke <[email protected]> CommitDate: Mon May 6 14:54:11 2024 +0200 Related: tdf#160056 various functions and objects that can be const this formatter can be const Change-Id: I2cd83140585e0b7027bb1c165a8d59e51cbbaad0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164728 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> SvNumberformat::ImpGetFractionOfSecondString can be const Change-Id: If7a31f8b3667d9a6b8719553567211071bd2d631 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164774 Tested-by: Jenkins Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> ImpIsEntry can be const Change-Id: Id229344a68925a1bde84f2b4aad46cfc5f01b797 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164769 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> SvNumberformat::ImpGetLogicalOutput can be const Change-Id: I847e5de84f0636b5a169f383e319a6b8707cc31f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164773 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> SvNumberFormatter::GetUserDefColor can be const Change-Id: If499e28e5ac69018b35b475a73ecb2dc4b78dad6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164786 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> These methods can be const too Change-Id: Iaef46216dac6584f57b7933d658384f54d0a4544 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164772 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166125 Reviewed-by: Eike Rathke <[email protected]> diff --git a/include/svl/numformat.hxx b/include/svl/numformat.hxx index bf31ff22b605..2ebed94959cc 100644 --- a/include/svl/numformat.hxx +++ b/include/svl/numformat.hxx @@ -62,7 +62,7 @@ public: /// Set CallBack to ColorTable void SetColorLink(const Link<sal_uInt16, Color*>& rColorTableCallBack); /// Do the CallBack to ColorTable - Color* GetUserDefColor(sal_uInt16 nIndex); + Color* GetUserDefColor(sal_uInt16 nIndex) const; /// Change language/country, also input and format scanner void ChangeIntl(LanguageType eLnge); @@ -627,7 +627,7 @@ private: // Test whether format code already exists, then return index key, // otherwise NUMBERFORMAT_ENTRY_NOT_FOUND SVL_DLLPRIVATE sal_uInt32 ImpIsEntry(std::u16string_view rString, sal_uInt32 CLOffset, - LanguageType eLnge); + LanguageType eLnge) const; // Create builtin formats for language/country if necessary, return CLOffset SVL_DLLPRIVATE sal_uInt32 ImpGenerateCL(LanguageType eLnge); diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx index 1fa52c3384a2..b4d7ddb0ac29 100644 --- a/include/svl/zformat.hxx +++ b/include/svl/zformat.hxx @@ -638,7 +638,7 @@ private: sal_uInt16 j, sal_uInt16 nIx, sal_Int32 nDigCnt, - bool bAddDecSep = true ); + bool bAddDecSep = true ) const; // Helper function to fill in the group (AKA thousand) separators // or to skip additional digits @@ -647,14 +647,14 @@ private: sal_Int32& k, sal_uInt16 nIx, sal_Int32 & nDigitCount, - utl::DigitGroupingIterator & ); + utl::DigitGroupingIterator & ) const; SVL_DLLPRIVATE bool ImpDecimalFill( OUStringBuffer& sStr, double& rNumber, sal_Int32 nDecPos, sal_uInt16 j, sal_uInt16 nIx, - bool bInteger ); + bool bInteger ) const; /** Calculate each element of fraction: * integer part, numerator part, denominator part @@ -701,11 +701,11 @@ private: SVL_DLLPRIVATE bool ImpGetLogicalOutput( double fNumber, sal_uInt16 nIx, - OUStringBuffer& OutString ); + OUStringBuffer& OutString ) const; SVL_DLLPRIVATE bool ImpGetNumberOutput( double fNumber, sal_uInt16 nIx, - OUStringBuffer& OutString ); + OUStringBuffer& OutString ) const; SVL_DLLPRIVATE void ImpCopyNumberformat( const SvNumberformat& rFormat ); @@ -731,7 +731,7 @@ private: // nFractionDecimals, unless nMinimumInputLineDecimals>0 is given for input // line string where extra trailing "0" are discarded. SVL_DLLPRIVATE sal_uInt16 ImpGetFractionOfSecondString( OUStringBuffer& rBuf, double fFractionOfSecond, - int nFractionDecimals, bool bAddOneRoundingDecimal, sal_uInt16 nIx, sal_uInt16 nMinimumInputLineDecimals ); + int nFractionDecimals, bool bAddOneRoundingDecimal, sal_uInt16 nIx, sal_uInt16 nMinimumInputLineDecimals ) const; // transliterate according to NativeNumber SVL_DLLPRIVATE OUString impTransliterateImpl(const OUString& rStr, const SvNumberNatNum& rNum) const; diff --git a/sc/source/core/data/queryevaluator.cxx b/sc/source/core/data/queryevaluator.cxx index a8a08d9edfd9..174e1e0989c7 100644 --- a/sc/source/core/data/queryevaluator.cxx +++ b/sc/source/core/data/queryevaluator.cxx @@ -244,7 +244,7 @@ std::pair<bool, bool> ScQueryEvaluator::compareByValue(const ScRefCellValue& rCe nNumFmt = getNumFmt(nCol, nRow); if (nNumFmt) { - SvNumberFormatter* pFormatter + const SvNumberFormatter* pFormatter = mpContext ? mpContext->GetFormatTable() : mrDoc.GetFormatTable(); const SvNumberformat* pEntry = pFormatter->GetEntry(nNumFmt); if (pEntry) diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index 1aeec0386899..e7b45a820984 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -375,7 +375,7 @@ void SvNumberFormatter::SetColorLink( const Link<sal_uInt16,Color*>& rColorTable aColorLink = rColorTableCallBack; } -Color* SvNumberFormatter::GetUserDefColor(sal_uInt16 nIndex) +Color* SvNumberFormatter::GetUserDefColor(sal_uInt16 nIndex) const { ::osl::MutexGuard aGuard( GetInstanceMutex() ); if( aColorLink.IsSet() ) @@ -996,7 +996,7 @@ sal_uInt32 SvNumberFormatter::ImpGetCLOffset(LanguageType eLnge) const sal_uInt32 SvNumberFormatter::ImpIsEntry(std::u16string_view rString, sal_uInt32 nCLOffset, - LanguageType eLnge) + LanguageType eLnge) const { sal_uInt32 res = NUMBERFORMAT_ENTRY_NOT_FOUND; auto it = aFTable.find( nCLOffset); @@ -1015,7 +1015,6 @@ sal_uInt32 SvNumberFormatter::ImpIsEntry(std::u16string_view rString, return res; } - SvNumberFormatTable& SvNumberFormatter::GetFirstEntryTable( SvNumFormatType& eType, sal_uInt32& FIndex, diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 313a59827947..b2d38f29cde7 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3052,7 +3052,7 @@ bool SvNumberformat::ImpGetFractionOutput(double fNumber, } sal_uInt16 SvNumberformat::ImpGetFractionOfSecondString( OUStringBuffer& rBuf, double fFractionOfSecond, - int nFractionDecimals, bool bAddOneRoundingDecimal, sal_uInt16 nIx, sal_uInt16 nMinimumInputLineDecimals ) + int nFractionDecimals, bool bAddOneRoundingDecimal, sal_uInt16 nIx, sal_uInt16 nMinimumInputLineDecimals ) const { if (!nFractionDecimals) return 0; @@ -4327,7 +4327,7 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber, bool SvNumberformat::ImpGetLogicalOutput(double fNumber, sal_uInt16 nIx, - OUStringBuffer& sStr) + OUStringBuffer& sStr) const { bool bRes = false; const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info(); @@ -4350,7 +4350,7 @@ bool SvNumberformat::ImpGetLogicalOutput(double fNumber, bool SvNumberformat::ImpGetNumberOutput(double fNumber, sal_uInt16 nIx, - OUStringBuffer& sStr) + OUStringBuffer& sStr) const { bool bRes = false; bool bSign; @@ -4470,7 +4470,7 @@ bool SvNumberformat::ImpDecimalFill( OUStringBuffer& sStr, // number string sal_Int32 nDecPos, // decimals start sal_uInt16 j, // symbol index within format code sal_uInt16 nIx, // subformat index - bool bInteger) // is integer + bool bInteger) const // is integer { bool bRes = false; bool bFilled = false; // Was filled? @@ -4592,7 +4592,7 @@ bool SvNumberformat::ImpNumberFillWithThousands( OUStringBuffer& sBuff, // numb sal_uInt16 j, // symbol index within format code sal_uInt16 nIx, // subformat index sal_Int32 nDigCnt, // count of integer digits in format - bool bAddDecSep) // add decimal separator if necessary + bool bAddDecSep) const // add decimal separator if necessary { bool bRes = false; sal_Int32 nLeadingStringChars = 0; // inserted StringChars before number @@ -4752,7 +4752,7 @@ void SvNumberformat::ImpDigitFill(OUStringBuffer& sStr, // number string sal_Int32 & k, // position within string sal_uInt16 nIx, // subformat index sal_Int32 & nDigitCount, // count of integer digits from the right so far - utl::DigitGroupingIterator & rGrouping ) // current grouping + utl::DigitGroupingIterator & rGrouping ) const // current grouping { if (NumFor[nIx].Info().bThousand) // Only if grouping fill in separators {
