[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Mon Jan 19 14:26:25 PST 2015


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

New commits:
commit b5fab0c20550b724986ad8a59973b92b181e0478
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

diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 165401b..92a6ed3 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -426,9 +426,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
                 {
@@ -952,7 +962,6 @@ void ScInterpreter::ScCount()
     else
     {
         short nParamCount = GetByte();
-        double fVal = 0.0;
         sal_uLong nCount = 0;
         ScAddress aAdr;
         ScRange aRange;
@@ -967,9 +976,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