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

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Apr 6 20:43:33 PDT 2011


 sc/source/core/tool/interpr4.cxx |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 957a56d2dd4f54c41d94fc0fedb3499eb2176db7
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Apr 6 23:41:32 2011 -0400

    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.

diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index a30ac55..1c7ecdd 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
 }
 
 


More information about the Libreoffice-commits mailing list