summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-04-06 23:41:32 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-04-06 23:41:59 -0400
commitbc617d8135cc364f204ddb3dced2afdb8aad6143 (patch)
tree93b1bea32f8532037948aaa93e6c0a65016bbc71 /sc/source/core
parent31cc9baa5c8afa22f8f81077515c23c085c2de19 (diff)
Ported calc-string-number.diff from the build repo.
This change allows string numbers (even fractional numbers) to be treated as numbers. Note that fractional numbers are local-dependent, and the current locale's number formatting is used to interpret them.
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/tool/interpr4.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index a30ac5507cb9..1c7ecdd33c78 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -238,6 +238,18 @@ double ScInterpreter::GetValueCellValue( const ScAddress& rPos, const ScValueCel
double ScInterpreter::ConvertStringToValue( const String& rStr )
{
+#if 1
+ // We keep this code until we provide a friendly way to convert string
+ // numbers into numbers in the UI.
+ double fValue = 0.0;
+ sal_uInt32 nFIndex = 0;
+ if (!pFormatter->IsNumberFormat(rStr, nFIndex, fValue))
+ {
+ SetError(errNoValue);
+ fValue = 0.0;
+ }
+ return fValue;
+#else
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "er", "ScInterpreter::ConvertStringToValue" );
double fValue = 0.0;
if (mnStringNoValueError == errCellNoValue)
@@ -407,6 +419,7 @@ double ScInterpreter::ConvertStringToValue( const String& rStr )
fValue = 0.0;
}
return fValue;
+#endif
}