Kaydet (Commit) b5fab0c2 authored tarafından Eike Rathke's avatar Eike Rathke

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
üst cb1af4e1
...@@ -426,9 +426,19 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero ) ...@@ -426,9 +426,19 @@ double ScInterpreter::IterateParameters( ScIterFunc eFunc, bool bTextAsZero )
if( eFunc == ifCOUNT ) if( eFunc == ifCOUNT )
{ {
OUString aStr = PopString().getString(); OUString aStr = PopString().getString();
sal_uInt32 nFIndex = 0; // damit default Land/Spr. if ( bTextAsZero )
if ( bTextAsZero || pFormatter->IsNumberFormat(aStr, nFIndex, fVal))
nCount++; 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 else
{ {
...@@ -952,7 +962,6 @@ void ScInterpreter::ScCount() ...@@ -952,7 +962,6 @@ void ScInterpreter::ScCount()
else else
{ {
short nParamCount = GetByte(); short nParamCount = GetByte();
double fVal = 0.0;
sal_uLong nCount = 0; sal_uLong nCount = 0;
ScAddress aAdr; ScAddress aAdr;
ScRange aRange; ScRange aRange;
...@@ -967,9 +976,14 @@ void ScInterpreter::ScCount() ...@@ -967,9 +976,14 @@ void ScInterpreter::ScCount()
case svString: case svString:
{ {
OUString aStr = PopString().getString(); OUString aStr = PopString().getString();
sal_uInt32 nFIndex = 0; // damit default Land/Spr. // Only check if string can be converted to number, no
if (pFormatter->IsNumberFormat(aStr, nFIndex, fVal)) // error propagation.
nCount++; sal_uInt16 nErr = nGlobalError;
nGlobalError = 0;
ConvertStringToValue( aStr );
if (!nGlobalError)
++nCount;
nGlobalError = nErr;
} }
break; break;
case svDouble : case svDouble :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment