[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sc/source

Eike Rathke erack at redhat.com
Mon Jan 19 14:58:28 PST 2015


 sc/source/core/tool/interpr6.cxx |   26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

New commits:
commit 250477f8eb2b2240209bffbe1ddeb3e587e3a5cf
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Jan 19 23:16:23 2015 +0100

    in COUNT() use ConvertStringToValue() for literal string arguments
    
    ... to evaluate the string conversion configuration, instead of the hard
    coded locale dependent IsNumberFormat()
    
    This only for literals, not referenced cell values.
    
    Change-Id: I774b52f1e258294014d8ea6a62374dd1d262f022
    (cherry picked from commit b5fab0c20550b724986ad8a59973b92b181e0478)
    Reviewed-on: https://gerrit.libreoffice.org/14026
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 13c603f..7eac4eb 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -429,9 +429,19 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
                 if( eFunc == ifCOUNT )
                 {
                     OUString aStr = PopString().getString();
-                    sal_uInt32 nFIndex = 0;                 // damit default Land/Spr.
-                    if ( bTextAsZero || pFormatter->IsNumberFormat(aStr, nFIndex, fVal))
+                    if ( bTextAsZero )
                         nCount++;
+                    else
+                    {
+                        // Only check if string can be converted to number, no
+                        // error propagation.
+                        sal_uInt16 nErr = nGlobalError;
+                        nGlobalError = 0;
+                        ConvertStringToValue( aStr );
+                        if (!nGlobalError)
+                            ++nCount;
+                        nGlobalError = nErr;
+                    }
                 }
                 else
                 {
@@ -955,7 +965,6 @@ void ScInterpreter::ScCount()
     else
     {
         short nParamCount = GetByte();
-        double fVal = 0.0;
         sal_uLong nCount = 0;
         ScAddress aAdr;
         ScRange aRange;
@@ -970,9 +979,14 @@ void ScInterpreter::ScCount()
                 case svString:
                 {
                     OUString aStr = PopString().getString();
-                    sal_uInt32 nFIndex = 0;                 // damit default Land/Spr.
-                    if (pFormatter->IsNumberFormat(aStr, nFIndex, fVal))
-                        nCount++;
+                    // Only check if string can be converted to number, no
+                    // error propagation.
+                    sal_uInt16 nErr = nGlobalError;
+                    nGlobalError = 0;
+                    ConvertStringToValue( aStr );
+                    if (!nGlobalError)
+                        ++nCount;
+                    nGlobalError = nErr;
                 }
                 break;
                 case svDouble    :


More information about the Libreoffice-commits mailing list