tdf#97983 - Added localization for numeric types

For numeric types, take into consideration different locales

Change-Id: I815c195e7ef53a7b958f85932415a16c9a8a1e35
Reviewed-on: https://gerrit.libreoffice.org/83683
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/basic/qa/basic_coverage/test_types_conversion.vb b/basic/qa/basic_coverage/test_types_conversion.vb
index 0de109b..0868f4d 100644
--- a/basic/qa/basic_coverage/test_types_conversion.vb
+++ b/basic/qa/basic_coverage/test_types_conversion.vb
@@ -11,6 +11,7 @@ Dim nTotalCount As Integer
Dim nPassCount As Integer
Dim nFailCount As Integer

' For the following tests the en-US (English - United States) locale is required
Function doUnitTest() As Integer
    nTotalCount = 0
    nPassCount = 0
@@ -35,13 +36,13 @@ Function doUnitTest() As Integer

    ' Negative floating-point with leading and trailing spaces
    StartTest()
    nVal = " -123.45 "
    AssertTest(nVal = -123.45)
    nVal = " -123.456 "
    AssertTest(nVal = -123.456)

    ' Wrong decimal separator
    ' Wrong decimal separator (interpreted as group separator)
    StartTest()
    nVal = " -123,45 "
    AssertTest(nVal = -123)
    nVal = " -123,456 "
    AssertTest(nVal = -123456)

    If ((nFailCount > 0) Or (nPassCount <> nTotalCount)) Then
        doUnitTest = 0
diff --git a/basic/source/sbx/sbxbool.cxx b/basic/source/sbx/sbxbool.cxx
index 950fb16..723939f 100644
--- a/basic/source/sbx/sbxbool.cxx
+++ b/basic/source/sbx/sbxbool.cxx
@@ -80,7 +80,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
                    double n;
                    SbxDataType t;
                    sal_uInt16 nLen = 0;
                    if( ImpScan( *p->pOUString, n, t, &nLen, false ) == ERRCODE_NONE )
                    if( ImpScan( *p->pOUString, n, t, &nLen, true ) == ERRCODE_NONE )
                    {
                        if( nLen == p->pOUString->getLength() )
                        {
diff --git a/basic/source/sbx/sbxbyte.cxx b/basic/source/sbx/sbxbyte.cxx
index ab07815..6557aa3 100644
--- a/basic/source/sbx/sbxbyte.cxx
+++ b/basic/source/sbx/sbxbyte.cxx
@@ -162,7 +162,7 @@ start:
            {
                double d;
                SbxDataType t;
                if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                    nRes = 0;
                else if( d > SbxMAXBYTE )
                {
diff --git a/basic/source/sbx/sbxchar.cxx b/basic/source/sbx/sbxchar.cxx
index ef2b134..d25ccc0 100644
--- a/basic/source/sbx/sbxchar.cxx
+++ b/basic/source/sbx/sbxchar.cxx
@@ -147,7 +147,7 @@ start:
            {
                double d;
                SbxDataType t;
                if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                    nRes = 0;
                else if( d > SbxMAXCHAR )
                {
diff --git a/basic/source/sbx/sbxdbl.cxx b/basic/source/sbx/sbxdbl.cxx
index c68d290..9010dfa 100644
--- a/basic/source/sbx/sbxdbl.cxx
+++ b/basic/source/sbx/sbxdbl.cxx
@@ -81,7 +81,7 @@ double ImpGetDouble( const SbxValues* p )
            {
                double d;
                SbxDataType t;
                if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                {
                    nRes = 0;
#if HAVE_FEATURE_SCRIPTING
diff --git a/basic/source/sbx/sbxint.cxx b/basic/source/sbx/sbxint.cxx
index 90f68bf..2ba76c8 100644
--- a/basic/source/sbx/sbxint.cxx
+++ b/basic/source/sbx/sbxint.cxx
@@ -157,7 +157,7 @@ start:
            {
                double d;
                SbxDataType t;
                if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                    nRes = 0;
                else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SbxMAXINT) )
                {
@@ -442,7 +442,7 @@ start:
                    // Check if really 0 or invalid conversion
                    double d;
                    SbxDataType t;
                    if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                    if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                        nRes = 0;
                    else
                        nRes = static_cast<sal_Int64>(d);
@@ -703,7 +703,7 @@ start:
                    // Check if really 0 or invalid conversion
                    double d;
                    SbxDataType t;
                    if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                    if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                        nRes = 0;
                    else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SAL_MAX_UINT64) )
                    {
diff --git a/basic/source/sbx/sbxlng.cxx b/basic/source/sbx/sbxlng.cxx
index 2b08a27..bda401b 100644
--- a/basic/source/sbx/sbxlng.cxx
+++ b/basic/source/sbx/sbxlng.cxx
@@ -121,7 +121,7 @@ start:
            {
                double d;
                SbxDataType t;
                if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                    nRes = 0;
                else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SbxMAXLNG) )
                {
diff --git a/basic/source/sbx/sbxscan.cxx b/basic/source/sbx/sbxscan.cxx
index 0c5c9a7..f555908 100644
--- a/basic/source/sbx/sbxscan.cxx
+++ b/basic/source/sbx/sbxscan.cxx
@@ -564,7 +564,7 @@ bool SbxValue::Scan( const OUString& rSrc, sal_uInt16* pLen )
    {
        double n;
        SbxDataType t;
        eRes = ImpScan( rSrc, n, t, pLen, false );
        eRes = ImpScan( rSrc, n, t, pLen, true );
        if( eRes == ERRCODE_NONE )
        {
            if( !IsFixed() )
diff --git a/basic/source/sbx/sbxsng.cxx b/basic/source/sbx/sbxsng.cxx
index 357b9cd..ad4301f 100644
--- a/basic/source/sbx/sbxsng.cxx
+++ b/basic/source/sbx/sbxsng.cxx
@@ -109,7 +109,7 @@ start:
            {
                double d;
                SbxDataType t;
                if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                    nRes = 0;
                else if( d > SbxMAXSNG )
                {
diff --git a/basic/source/sbx/sbxuint.cxx b/basic/source/sbx/sbxuint.cxx
index f1c916b..a3751e2 100644
--- a/basic/source/sbx/sbxuint.cxx
+++ b/basic/source/sbx/sbxuint.cxx
@@ -154,7 +154,7 @@ start:
            {
                double d;
                SbxDataType t;
                if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                    nRes = 0;
                else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SbxMAXUINT) )
                {
diff --git a/basic/source/sbx/sbxulng.cxx b/basic/source/sbx/sbxulng.cxx
index 14b3795..bcb1ce0 100644
--- a/basic/source/sbx/sbxulng.cxx
+++ b/basic/source/sbx/sbxulng.cxx
@@ -121,7 +121,7 @@ start:
            {
                double d;
                SbxDataType t;
                if( ImpScan( *p->pOUString, d, t, nullptr, false ) != ERRCODE_NONE )
                if( ImpScan( *p->pOUString, d, t, nullptr, true ) != ERRCODE_NONE )
                    nRes = 0;
                else if( !o3tl::convertsToAtMost(o3tl::roundAway(d), SbxMAXULNG) )
                {
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index c32d51f..a36abf5 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1352,7 +1352,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
                RTL_TEXTENCODING_ASCII_US);
            double d;
            SbxDataType t;
            if( ImpScan( aVal, d, t, nullptr, false ) != ERRCODE_NONE || t == SbxDOUBLE )
            if( ImpScan( aVal, d, t, nullptr, true ) != ERRCODE_NONE || t == SbxDOUBLE )
            {
                aData.nSingle = 0.0F;
                return false;
@@ -1367,7 +1367,7 @@ bool SbxValue::LoadData( SvStream& r, sal_uInt16 )
            OUString aVal = read_uInt16_lenPrefixed_uInt8s_ToOUString(r,
                RTL_TEXTENCODING_ASCII_US);
            SbxDataType t;
            if( ImpScan( aVal, aData.nDouble, t, nullptr, false ) != ERRCODE_NONE )
            if( ImpScan( aVal, aData.nDouble, t, nullptr, true ) != ERRCODE_NONE )
            {
                aData.nDouble = 0.0;
                return false;
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index d18ada8..01d394b 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -503,7 +503,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
                    rStrm, RTL_TEXTENCODING_ASCII_US);
            double d;
            SbxDataType t;
            if( ImpScan( aTmpString, d, t, nullptr, false ) != ERRCODE_NONE || t == SbxDOUBLE )
            if( ImpScan( aTmpString, d, t, nullptr, true ) != ERRCODE_NONE || t == SbxDOUBLE )
            {
                aTmp.nSingle = 0;
                return false;
@@ -518,7 +518,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
            aTmpString = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm,
                                                                        RTL_TEXTENCODING_ASCII_US);
            SbxDataType t;
            if( ImpScan( aTmpString, aTmp.nDouble, t, nullptr, false ) != ERRCODE_NONE )
            if( ImpScan( aTmpString, aTmp.nDouble, t, nullptr, true ) != ERRCODE_NONE )
            {
                aTmp.nDouble = 0;
                return false;