summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2025-01-07 20:56:37 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2025-01-08 09:28:50 +0100
commitc2f6f23097121a56da9bbd50f96ab5878ced0fec (patch)
treed112437a5b815c9d503424d1d368b0bd585c5d01 /vcl
parent158e43c438049fa5d3c28dbcc3edfbfe11021aac (diff)
Resolves: tdf#158669 round long currency to decimal digits in use
as its predecessor did before: commit 0c85d1ee0688435ffefd8eff797e57eac9bace27 CommitDate: Wed Jul 15 10:26:16 2020 +0200 weld LongCurrencyControl Change-Id: I251c976b9b3025a0faddd0f75cd303c29b1a33c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179917 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/longcurr.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx
index 587c99cf1724..96afc509dfa2 100644
--- a/vcl/source/control/longcurr.cxx
+++ b/vcl/source/control/longcurr.cxx
@@ -221,7 +221,13 @@ namespace weld
{
const LocaleDataWrapper& rLocaleDataWrapper = Application::GetSettings().GetLocaleDataWrapper();
const OUString& rCurrencySymbol = !m_aCurrencySymbol.isEmpty() ? m_aCurrencySymbol : rLocaleDataWrapper.getCurrSymbol();
- double fValue = GetValue() * weld::SpinButton::Power10(GetDecimalDigits());
+ double fValue = GetValue();
+ sal_uInt16 nDecimalDigits = GetDecimalDigits();
+ if (nDecimalDigits)
+ {
+ // tdf#158669 round to decimal digits
+ fValue = std::round(fValue * weld::SpinButton::Power10(nDecimalDigits));
+ }
OUString aText = ImplGetCurr(rLocaleDataWrapper, fValue, GetDecimalDigits(), rCurrencySymbol, m_bThousandSep);
ImplSetTextImpl(aText, nullptr);
return true;