sc/inc/cell.hxx                    |    8 ++++++++
 sc/inc/formularesult.hxx           |   12 +++++++-----
 sc/source/filter/excel/excform.cxx |    2 +-
 3 files changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 757a346159dd51ae65767bce98a12826fef179b6
Author: Eike Rathke <er...@redhat.com>
Date:   Thu Jul 5 20:26:20 2012 +0200

    resolved fdo#51664 some matrix cases broken in binary Excel import
    
    Import (ab)used ScFormulaCell::SetHybridDouble() in the sense that
    actually it is not a hybrid (no formula string, the token array is
    present in binary import) and during interpretation a matrix was
    expected but instead the hybrid encountered.
    
    Introduced ScFormulaCell::SetResultDouble() for exactly this case as a
    workaround.
    
    Change-Id: I4da3812ef4974380224b5a2bf42d0b62c14d121b

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 1717d8d..f609a46 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -500,6 +500,14 @@ public:
     void            SetHybridFormula( const rtl::OUString& r,
                                     const formula::FormulaGrammar::Grammar 
eGrammar )
                         { aResult.SetHybridFormula( r); eTempGrammar = 
eGrammar; }
+
+    /** For import only: set a double result.
+        Use this instead of SetHybridDouble() if there is no (temporary)
+        formula string because the formula is present as a token array, as it
+        is the case for binary Excel import.
+     */
+    void            SetResultDouble( double n )     { aResult.SetDouble( n); }
+
     void            SetErrCode( sal_uInt16 n );
     inline bool     IsHyperLinkCell() const { return pCode && 
pCode->IsHyperLink(); }
     EditTextObject* CreateURLObject() ;
diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx
index 2983176..e0f586c 100644
--- a/sc/inc/formularesult.hxx
+++ b/sc/inc/formularesult.hxx
@@ -151,11 +151,13 @@ public:
     void SetResultError( sal_uInt16 nErr );
 
     /** Set direct double. Shouldn't be used externally except in
-        ScFormulaCell for rounded CalcAsShown or SetErrCode(). If
-        ScMatrixFormulaCellToken the token isn't replaced but upper left result
-        is modified instead, but only if it was of type formula::svDouble 
before or not
-        set at all. */
-    void SetDouble( double f );
+        ScFormulaCell for rounded CalcAsShown or SetErrCode() or
+        SetResultDouble(), see there for condition. If
+        ScMatrixFormulaCellToken the token isn't replaced but upper
+        left result is modified instead, but only if it was of type
+        formula::svDouble before or not set at all.
+     */
+    SC_DLLPUBLIC void SetDouble( double f );
 
     /** Return value if type formula::svDouble or formula::svHybridCell or 
formula::svMatrixCell and upper
         left formula::svDouble, else 0.0 */
diff --git a/sc/source/filter/excel/excform.cxx 
b/sc/source/filter/excel/excform.cxx
index 4fcf976..416d46f 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -160,7 +160,7 @@ void ImportExcel::Formula(
                 ExcelToSc::SetError( *pCell, eErr );
 
             if (!rtl::math::isNan(fCurVal))
-                pCell->SetHybridDouble(fCurVal);
+                pCell->SetResultDouble(fCurVal);
         }
 
         GetXFRangeBuffer().SetXF( aScPos, nXF );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to