diff options
author | Eike Rathke <erack@redhat.com> | 2021-09-01 15:35:11 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2021-09-01 22:53:55 +0200 |
commit | 71b003a12f8afdff42a25786ad0a12ddd6609d59 (patch) | |
tree | a989b5b02a697f623e1dd8f63cf2211a09e00212 /include/svl/zformat.hxx | |
parent | f560a3a296871084801ced75fae20fb5f1b5d7ce (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
Diffstat (limited to 'include/svl/zformat.hxx')
-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 3fdee06d99dc..cd04f96ac8a1 100644 --- a/include/svl/zformat.hxx +++ b/include/svl/zformat.hxx @@ -272,10 +272,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! |