diff options
author | Eike Rathke <erack@redhat.com> | 2021-09-01 15:35:11 +0200 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-09-02 16:47:14 +0200 |
commit | 3879accdfbee52b3bbecbe20fd1cf4d391189b70 (patch) | |
tree | ea95b25c41d7d6b4018cb8ec6add332a32b98d51 /include | |
parent | 132603eb108a4e028ec0f41ada6defe777079ded (diff) |
Resolves: tdf#144209 Handle General containing formats in RoundValueAsShown()
Calling SvNumberformat::GetThousandDivisorPrecision() for a
"AA "General
format resulted in 3000 as that was implemented for tdf#106253
without taking into account that ImpSvNumberformatInfo::nThousand
may be abused under some conditions, which here is having
FLAG_STANDARD_IN_FORMAT = 1000 as nThousand, multiplied by 3 gives
3000. Subtracted from the 0 precision gave -3000 decimals for
which of course the new rounding produced 0 where it previously
simply ignored the decimals and returned the original value.
Change-Id: I66afaf1e2d8b2654d9f7cc8cfb66389357fb742d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121447
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Jenkins
(cherry picked from commit 71b003a12f8afdff42a25786ad0a12ddd6609d59)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121459
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/svl/zformat.hxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/svl/zformat.hxx b/include/svl/zformat.hxx index 976488257218..abbf92e92af8 100644 --- a/include/svl/zformat.hxx +++ b/include/svl/zformat.hxx @@ -271,10 +271,15 @@ public: { return NumFor[nIx].Info().nCntPre; } /** Count of hidden integer digits with thousands divisor: - * formats like "0," to show only thousands + formats like "0," to show only thousands. + + Works only with SvNumFormatType::NUMBER and SvNumFormatType::CURRENCY, + returns 0 otherwise. + + Returns SvNumberFormatter::UNLIMITED_PRECISION for formats that contain + the General keyword. */ - sal_uInt16 GetThousandDivisorPrecision( sal_uInt16 nIx = 0 ) const - { return NumFor[nIx].Info().nThousand * 3; } + sal_uInt16 GetThousandDivisorPrecision( sal_uInt16 nIx = 0 ) const; //! Read/write access on a special sal_uInt16 component, may only be used on the //! standard format 0, 10000, ... and only by the number formatter! |