vcl/source/control/longcurr.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit c2f6f23097121a56da9bbd50f96ab5878ced0fec
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Tue Jan 7 20:56:37 2025 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jan 8 09:28:50 2025 +0100

    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.mcnam...@collabora.com>

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;

Reply via email to