basic/qa/basic_coverage/da-DK/test_ccur_da_DK_locale.bas |    6 ++++--
 basic/qa/basic_coverage/test_ccur_method.bas             |    3 +++
 basic/qa/basic_coverage/zh-CN/test_ccur_zh_CN_locale.bas |    2 ++
 basic/source/sbx/sbxcurr.cxx                             |    5 +++--
 4 files changed, 12 insertions(+), 4 deletions(-)

New commits:
commit 74a68f76bb116e348826bff912d52d8205ab92a3
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Sat Aug 31 20:08:28 2024 +0500
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Wed Sep 4 11:36:24 2024 +0200

    tdf#162724: use localized decimal separator in ImpCurrencyToString
    
    Same as in ImpCvtNum
    
    Change-Id: Icbaa237e944a39309b01fdb18e668d054ff61c60
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172693
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    (cherry picked from commit a795fddafad69e8a7ce600352c7236b35539cebb)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172680
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/basic/qa/basic_coverage/da-DK/test_ccur_da_DK_locale.bas 
b/basic/qa/basic_coverage/da-DK/test_ccur_da_DK_locale.bas
index 52b8d3b6f1aa..ff4704fcc3db 100644
--- a/basic/qa/basic_coverage/da-DK/test_ccur_da_DK_locale.bas
+++ b/basic/qa/basic_coverage/da-DK/test_ccur_da_DK_locale.bas
@@ -18,8 +18,10 @@ Sub verify_testCCurDaDKLocale
     On Error GoTo errorHandler
 
     ' tdf#141050 - characteristic test for CCur() with the da_DK locale
-    TestUtil.AssertEqual(CCur("75,50"), 75.5, "CCur(75,50)")
-    TestUtil.AssertEqual(CCur("75,50 kr."), 75.5, "CCur(75,50 kr.)")
+    TestUtil.AssertEqual(CCur("75,50"), 75.5, "CCur(""75,50"")")
+    TestUtil.AssertEqual(CCur("75,50 kr."), 75.5, "CCur(""75,50 kr."")")
+    ' tdf#162724 - CStr must create strings that allow CCur round-trip
+    TestUtil.AssertEqual(CCur(CStr(CCur(75.50))), 75.5, 
"CCur(CStr(CCur(75.50)))")
 
     Exit Sub
 errorHandler:
diff --git a/basic/qa/basic_coverage/test_ccur_method.bas 
b/basic/qa/basic_coverage/test_ccur_method.bas
index c42dcb938590..d1c6c247a6e2 100644
--- a/basic/qa/basic_coverage/test_ccur_method.bas
+++ b/basic/qa/basic_coverage/test_ccur_method.bas
@@ -29,6 +29,9 @@ Sub verify_testCCur
     TestUtil.AssertEqual(CCur("$100"), 100, "CCur($100)")
     TestUtil.AssertEqual(CCur("$1.50"), 1.5, "CCur($1.50)")
 
+    ' tdf#162724 - CStr must create strings that allow CCur round-trip
+    TestUtil.AssertEqual(CCur(CStr(CCur(75.50))), 75.5, 
"CCur(CStr(CCur(75.50)))")
+
     verify_testCCurUnderflow
     verify_testCCurOverflow
     verify_testCCurInvalidFormat
diff --git a/basic/qa/basic_coverage/zh-CN/test_ccur_zh_CN_locale.bas 
b/basic/qa/basic_coverage/zh-CN/test_ccur_zh_CN_locale.bas
index 38a084e36c7f..2d63cd87a72f 100644
--- a/basic/qa/basic_coverage/zh-CN/test_ccur_zh_CN_locale.bas
+++ b/basic/qa/basic_coverage/zh-CN/test_ccur_zh_CN_locale.bas
@@ -20,6 +20,8 @@ Sub verify_testCCurZhCNLocale
     ' tdf#141050 - characteristic test for CCur() with the zh_CN locale
     TestUtil.AssertEqual(CCur("75.50"), 75.5, "CCur(75.50)")
     TestUtil.AssertEqual(CCur("¥75.50"), 75.5, "CCur(¥75.50)")
+    ' tdf#162724 - CStr must create strings that allow CCur round-trip
+    TestUtil.AssertEqual(CCur(CStr(CCur(75.50))), 75.5, 
"CCur(CStr(CCur(75.50)))")
 
     Exit Sub
 errorHandler:
diff --git a/basic/source/sbx/sbxcurr.cxx b/basic/source/sbx/sbxcurr.cxx
index ca67977a3a56..37de86a800f3 100644
--- a/basic/source/sbx/sbxcurr.cxx
+++ b/basic/source/sbx/sbxcurr.cxx
@@ -35,7 +35,8 @@ static OUString ImpCurrencyToString( sal_Int64 rVal )
     bool isNeg = ( rVal < 0 );
     sal_Int64 absVal = isNeg ? -rVal : rVal;
 
-    sal_Unicode const cDecimalSep = '.';
+    sal_Unicode cDecimalSep, cThousandSepDummy, cDecimalSepAltDummy;
+    ImpGetIntntlSep(cDecimalSep, cThousandSepDummy, cDecimalSepAltDummy);
 
     OUString aAbsStr = OUString::number( absVal );
 
@@ -70,7 +71,7 @@ static OUString ImpCurrencyToString( sal_Int64 rVal )
         if ( nDigitCount < initialLen )
             aBuf[nInsertIndex--] = aAbsStr[ charCpyIndex-- ];
         else
-        // Handle leading 0's to right of decimal point
+        // Handle leading 0's to right of decimal separator
         // Note: in VBA the stringification is a little more complex
         // but more natural as only the necessary digits
         // to the right of the decimal places are displayed

Reply via email to