Related: tdf#149484 Display BOOLEAN literal string text additions

Change-Id: Ifbaf0b18178091c3a340a7c4bc66f78397aadc18
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135506
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
This commit is contained in:
Eike Rathke 2022-06-08 17:43:13 +02:00
parent 98cfc7db5e
commit 2932dc7aa0
2 changed files with 31 additions and 1 deletions

View file

@ -696,6 +696,10 @@ private:
SVL_DLLPRIVATE static void ImpAppendEraG( OUStringBuffer& OutStringBuffer, const CalendarWrapper& rCal,
sal_Int16 nNatNum );
SVL_DLLPRIVATE bool ImpGetLogicalOutput( double fNumber,
sal_uInt16 nIx,
OUStringBuffer& OutString );
SVL_DLLPRIVATE bool ImpGetNumberOutput( double fNumber,
sal_uInt16 nIx,
OUStringBuffer& OutString );

View file

@ -2449,7 +2449,7 @@ bool SvNumberformat::GetOutputString(double fNumber,
bool bRes = false;
OutString.clear();
*ppColor = nullptr; // No color change
if (eType & SvNumFormatType::LOGICAL)
if (eType & SvNumFormatType::LOGICAL && sFormatstring == rScan.GetKeywords()[NF_KEY_BOOLEAN])
{
if (fNumber)
{
@ -2615,6 +2615,9 @@ bool SvNumberformat::GetOutputString(double fNumber,
case SvNumFormatType::CURRENCY:
bRes |= ImpGetNumberOutput(fNumber, nIx, sBuff);
break;
case SvNumFormatType::LOGICAL:
bRes |= ImpGetLogicalOutput(fNumber, nIx, sBuff);
break;
case SvNumFormatType::FRACTION:
bRes |= ImpGetFractionOutput(fNumber, nIx, sBuff);
break;
@ -4287,6 +4290,29 @@ bool SvNumberformat::ImpGetDateTimeOutput(double fNumber,
return bRes;
}
bool SvNumberformat::ImpGetLogicalOutput(double fNumber,
sal_uInt16 nIx,
OUStringBuffer& sStr)
{
bool bRes = false;
const ImpSvNumberformatInfo& rInfo = NumFor[nIx].Info();
const sal_uInt16 nCnt = NumFor[nIx].GetCount();
for (sal_uInt16 j = 0; j < nCnt; ++j)
{
switch (rInfo.nTypeArray[j])
{
case NF_KEY_BOOLEAN:
sStr.append( fNumber ? rScan.GetTrueString() : rScan.GetFalseString());
break;
case NF_SYMBOLTYPE_STRING:
sStr.append( rInfo.sStrArray[j]);
break;
}
}
impTransliterate(sStr, NumFor[nIx].GetNatNum());
return bRes;
}
bool SvNumberformat::ImpGetNumberOutput(double fNumber,
sal_uInt16 nIx,
OUStringBuffer& sStr)