include/svl/zformat.hxx | 4 ++++ svl/source/numbers/zformat.cxx | 28 +++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-)
New commits: commit 2932dc7aa0c1239d39e060e6b7627317f1305549 Author: Eike Rathke <er...@redhat.com> AuthorDate: Wed Jun 8 17:43:13 2022 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Wed Jun 8 20:15:19 2022 +0200 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 <er...@redhat.com> Tested-by: Jenkins diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx index cd04f96ac8a1..ae57f5c868ed 100644 --- a/include/svl/zformat.hxx +++ b/include/svl/zformat.hxx @@ -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 ); diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index dd5b9fe00429..a4756f4982b1 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -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)