summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-09-03 16:47:06 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2020-09-03 19:32:28 +0200
commitf12050bfb15580b564e342b704d5c55128fac644 (patch)
treee4a825d72c93548bf7ec39e7a8325855d58b288e /svl
parent07dcb0dab759d4ab535d99c0e6d326959906b87e (diff)
Make ImpSvNumberformatScan::GetColor const
Change-Id: Idbcce18029944ab884cdde03e21190cbb574a00f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102005 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'svl')
-rw-r--r--svl/qa/unit/svl.cxx9
-rw-r--r--svl/source/numbers/numfmuno.cxx12
-rw-r--r--svl/source/numbers/zforlist.cxx14
-rw-r--r--svl/source/numbers/zformat.cxx10
-rw-r--r--svl/source/numbers/zforscan.cxx6
-rw-r--r--svl/source/numbers/zforscan.hxx4
6 files changed, 27 insertions, 28 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index c32017f7aea6..beaf62ad39ec 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -431,9 +431,8 @@ void Test::checkPreviewString(SvNumberFormatter& aFormatter,
OUString const & sExpected)
{
OUString sStr;
- Color* pColor = nullptr;
- Color** ppColor = &pColor;
- if (!aFormatter.GetPreviewString(sCode, fPreviewNumber, sStr, ppColor, eLang))
+ const Color* pColor = nullptr;
+ if (!aFormatter.GetPreviewString(sCode, fPreviewNumber, sStr, &pColor, eLang))
{
OString aMessage = "GetPreviewString( \"" +
OUStringToOString( sCode, RTL_TEXTENCODING_ASCII_US ) +
@@ -1111,7 +1110,7 @@ void Test::checkDateInput( SvNumberFormatter& rFormatter, const char* pTimezone,
CPPUNIT_ASSERT_MESSAGE("Format parsed is not date.",
(rFormatter.GetType(nIndex) & SvNumFormatType::DATE));
OUString aOutString;
- Color *pColor;
+ const Color *pColor;
rFormatter.GetOutputString( fVal, nIndex, aOutString, &pColor);
CPPUNIT_ASSERT_EQUAL( aDate, aOutString);
}
@@ -1184,7 +1183,7 @@ void checkSpecificNumberFormats( SvNumberFormatter& rFormatter,
{
if (rVec[i].mnOutputIndex)
nIndex = rVec[i].mnOutputIndex;
- Color* pColor;
+ const Color* pColor;
rFormatter.GetOutputString( fNumber, nIndex, aString, &pColor);
CPPUNIT_ASSERT_EQUAL_MESSAGE( OString( pName + OStringLiteral(" ") + OString::number(i) + " mismatch").getStr(),
OUString::fromUtf8( rVec[i].mpOutput), aString);
diff --git a/svl/source/numbers/numfmuno.cxx b/svl/source/numbers/numfmuno.cxx
index 6c5077c7a788..ba3a9e0cbe0d 100644
--- a/svl/source/numbers/numfmuno.cxx
+++ b/svl/source/numbers/numfmuno.cxx
@@ -181,7 +181,7 @@ OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToString( sal_Int32
if (!pFormatter)
throw uno::RuntimeException();
- Color* pColor = nullptr;
+ const Color* pColor = nullptr;
pFormatter->GetOutputString(fValue, nKey, aRet, &pColor);
return aRet;
@@ -199,7 +199,7 @@ sal_Int32 SAL_CALL SvNumberFormatterServiceObj::queryColorForNumber( sal_Int32 n
throw uno::RuntimeException();
OUString aStr;
- Color* pColor = nullptr;
+ const Color* pColor = nullptr;
pFormatter->GetOutputString(fValue, nKey, aStr, &pColor);
if (pColor)
nRet = sal_uInt32(*pColor);
@@ -220,7 +220,7 @@ OUString SAL_CALL SvNumberFormatterServiceObj::formatString( sal_Int32 nKey,
throw uno::RuntimeException();
}
- Color* pColor = nullptr;
+ const Color* pColor = nullptr;
pFormatter->GetOutputString(aString, nKey, aRet, &pColor);
return aRet;
@@ -240,7 +240,7 @@ sal_Int32 SAL_CALL SvNumberFormatterServiceObj::queryColorForString( sal_Int32 n
}
OUString aStr;
- Color* pColor = nullptr;
+ const Color* pColor = nullptr;
pFormatter->GetOutputString(aString, nKey, aStr, &pColor);
if (pColor)
{
@@ -280,7 +280,7 @@ OUString SAL_CALL SvNumberFormatterServiceObj::convertNumberToPreviewString( con
throw uno::RuntimeException();
LanguageType eLang = lcl_GetLanguage( nLocale );
- Color* pColor = nullptr;
+ const Color* pColor = nullptr;
bool bOk;
if ( bAllowEnglish )
@@ -309,7 +309,7 @@ sal_Int32 SAL_CALL SvNumberFormatterServiceObj::queryPreviewColorForNumber( cons
OUString aOutString;
LanguageType eLang = lcl_GetLanguage( nLocale );
- Color* pColor = nullptr;
+ const Color* pColor = nullptr;
bool bOk;
if ( bAllowEnglish )
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index d113c6b9f767..de29679297aa 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -849,7 +849,7 @@ OUString SvNumberFormatter::GetFormatStringForExcel( sal_uInt32 nKey, const NfKe
{
// Build Boolean number format, which needs non-zero and zero
// subformat codes with TRUE and FALSE strings.
- Color* pColor = nullptr;
+ const Color* pColor = nullptr;
OUString aTemp;
const_cast< SvNumberformat* >( pEntry )->GetOutputString( 1.0, aTemp, &pColor );
aFormatStr += "\"" + aTemp + "\";\"" + aTemp + "\";\"";
@@ -1592,7 +1592,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
OUString& sOutString)
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
- Color* pColor;
+ const Color* pColor;
sal_uInt32 nRealKey = nFIndex;
SvNumberformat* pFormat = ImpSubstituteEntry( GetFormatEntry( nFIndex ), &nRealKey);
if (!pFormat)
@@ -1652,7 +1652,7 @@ void SvNumberFormatter::GetInputLineString(const double& fOutNumber,
void SvNumberFormatter::GetOutputString(const OUString& sString,
sal_uInt32 nFIndex,
OUString& sOutString,
- Color** ppColor,
+ const Color** ppColor,
bool bUseStarFormat )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
@@ -1686,7 +1686,7 @@ void SvNumberFormatter::GetOutputString(const OUString& sString,
void SvNumberFormatter::GetOutputString(const double& fOutNumber,
sal_uInt32 nFIndex,
OUString& sOutString,
- Color** ppColor,
+ const Color** ppColor,
bool bUseStarFormat )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
@@ -1709,7 +1709,7 @@ void SvNumberFormatter::GetOutputString(const double& fOutNumber,
bool SvNumberFormatter::GetPreviewString(const OUString& sFormatString,
double fPreviewNumber,
OUString& sOutString,
- Color** ppColor,
+ const Color** ppColor,
LanguageType eLnge,
bool bUseStarFormat )
{
@@ -1763,7 +1763,7 @@ bool SvNumberFormatter::GetPreviewString(const OUString& sFormatString,
bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
double fPreviewNumber,
OUString& sOutString,
- Color** ppColor,
+ const Color** ppColor,
LanguageType eLnge )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
@@ -1864,7 +1864,7 @@ bool SvNumberFormatter::GetPreviewStringGuess( const OUString& sFormatString,
bool SvNumberFormatter::GetPreviewString( const OUString& sFormatString,
const OUString& sPreviewString,
OUString& sOutString,
- Color** ppColor,
+ const Color** ppColor,
LanguageType eLnge )
{
::osl::MutexGuard aGuard( GetInstanceMutex() );
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index 471c350a7629..b0e90b4916f6 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -872,7 +872,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
}
else
{
- Color* pColor = pSc->GetColor( sStr);
+ const Color* pColor = pSc->GetColor( sStr);
NumFor[nIndex].SetColor( pColor, sStr);
if (pColor == nullptr)
{ // error
@@ -1919,7 +1919,7 @@ void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter,
for (ImpSvNumFor & rFormatter : NumFor)
{
OUString aColorName = rFormatter.GetColorName();
- Color* pColor = rScan.GetColor( aColorName );
+ const Color* pColor = rScan.GetColor( aColorName );
rFormatter.SetColor( pColor, aColorName );
}
}
@@ -2160,7 +2160,7 @@ static bool lcl_insertStarFillChar( OUStringBuffer& rBuf, sal_Int32 nPos, const
void SvNumberformat::GetOutputString(const OUString& sString,
OUString& OutString,
- Color** ppColor)
+ const Color** ppColor)
{
OUStringBuffer sOutBuff;
sal_uInt16 nIx;
@@ -2439,7 +2439,7 @@ sal_uInt16 SvNumberformat::GetSubformatIndex (double fNumber ) const
bool SvNumberformat::GetOutputString(double fNumber,
OUString& OutString,
- Color** ppColor)
+ const Color** ppColor)
{
bool bRes = false;
OUStringBuffer sBuff(64);
@@ -5039,7 +5039,7 @@ void SvNumberformat::GetConditions( SvNumberformatLimitOps& rOper1, double& rVal
rVal2 = fLimit2;
}
-Color* SvNumberformat::GetColor( sal_uInt16 nNumFor ) const
+const Color* SvNumberformat::GetColor( sal_uInt16 nNumFor ) const
{
if ( nNumFor > 3 )
{
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index b77670ce2be1..288623ef2a6c 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -106,7 +106,7 @@ const NfKeywordTable ImpSvNumberformatScan::sEnglishKeyword =
"WHITE" // NF_KEY_WHITE
};
-::std::vector<Color> ImpSvNumberformatScan::StandardColor{
+const ::std::vector<Color> ImpSvNumberformatScan::StandardColor{
COL_BLACK, COL_LIGHTBLUE, COL_LIGHTGREEN, COL_LIGHTCYAN, COL_LIGHTRED,
COL_LIGHTMAGENTA, COL_BROWN, COL_GRAY, COL_YELLOW, COL_WHITE
};
@@ -537,7 +537,7 @@ void ImpSvNumberformatScan::ChangeStandardPrec(sal_uInt16 nPrec)
nStandardPrec = nPrec;
}
-Color* ImpSvNumberformatScan::GetColor(OUString& sStr)
+const Color* ImpSvNumberformatScan::GetColor(OUString& sStr) const
{
OUString sString = pFormatter->GetCharClass()->uppercase(sStr);
const NfKeywordTable & rKeyword = GetKeywords();
@@ -595,7 +595,7 @@ Color* ImpSvNumberformatScan::GetColor(OUString& sStr)
eColorKeywordConversion = ColorKeywordConversion::EnglishToGerman;
}
- Color* pResult = nullptr;
+ const Color* pResult = nullptr;
if (i >= NF_MAX_DEFAULT_COLORS)
{
const OUString& rColorWord = rKeyword[NF_KEY_COLOR];
diff --git a/svl/source/numbers/zforscan.hxx b/svl/source/numbers/zforscan.hxx
index b2ed7535c5b4..2120a58323fd 100644
--- a/svl/source/numbers/zforscan.hxx
+++ b/svl/source/numbers/zforscan.hxx
@@ -112,7 +112,7 @@ public:
}
sal_uInt16 GetStandardPrec() const { return nStandardPrec; }
static const Color& GetRedColor() { return StandardColor[4]; }
- Color* GetColor(OUString& sStr); // Set main colors or defines colors
+ const Color* GetColor(OUString& sStr) const; // Set main colors or defines colors
// the compatibility currency symbol for old automatic currency formats
const OUString& GetCurSymbol() const
@@ -176,7 +176,7 @@ public:
private: // Private section
NfKeywordTable sKeyword; // Syntax keywords
static const NfKeywordTable sEnglishKeyword; // English Syntax keywords
- static ::std::vector<Color> StandardColor; // Standard color array
+ static const ::std::vector<Color> StandardColor; // Standard color array
Date maNullDate; // 30Dec1899
OUString sNameStandardFormat; // "Standard"
sal_uInt16 nStandardPrec; // Default Precision for Standardformat