summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-07-23 21:10:50 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-07-23 22:06:40 -0400
commit3a8f10ddb4bfbbf76590102bbcaa10c9aa2c0af3 (patch)
tree11d727f3d8f3b2668f55459be91c0a670f17839a /sc
parent22cf0759547aa1803f77dbd3ee91774600dadc6f (diff)
Honor the configuration option in the interpreter.
Change-Id: I686d1f3703cbb122e1b3ed010a727163be2e942a
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/interpr4.cxx29
1 files changed, 17 insertions, 12 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index 566d0b363647..c35cdfd0f836 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -243,21 +243,26 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
SetError( mnStringNoValueError);
return fValue;
}
- // The number scanner does not accept empty strings or strings containing
- // only spaces, be on par in these cases with what was accepted in OOo and
- // is in AOO (see also the #else branch below) and convert to 0 to prevent
- // interoperability nightmares.
- if (!rStr.Len())
- return fValue;
- else if (rStr.GetChar(0) == ' ')
+
+ if (GetGlobalConfig().mbEmptyStringAsZero)
{
- const sal_Unicode* p = rStr.GetBuffer() + 1;
- const sal_Unicode* const pStop = p - 1 + rStr.Len();
- while (p < pStop && *p == ' ')
- ++p;
- if (p == pStop)
+ // The number scanner does not accept empty strings or strings
+ // containing only spaces, be on par in these cases with what was
+ // accepted in OOo and is in AOO (see also the else branch below) and
+ // convert to 0 to prevent interoperability nightmares.
+ if (!rStr.Len())
return fValue;
+ else if (rStr.GetChar(0) == ' ')
+ {
+ const sal_Unicode* p = rStr.GetBuffer() + 1;
+ const sal_Unicode* const pStop = p - 1 + rStr.Len();
+ while (p < pStop && *p == ' ')
+ ++p;
+ if (p == pStop)
+ return fValue;
+ }
}
+
sal_uInt32 nFIndex = 0;
if (!pFormatter->IsNumberFormat(rStr, nFIndex, fValue))
{