[ooo-build-commit] .: sc/inc sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Oct 4 11:50:59 PDT 2010


 sc/inc/cell.hxx               |    2 ++
 sc/source/core/data/cell.cxx  |   12 ++++++++++--
 sc/source/core/data/cell2.cxx |   23 ++++++++---------------
 3 files changed, 20 insertions(+), 17 deletions(-)

New commits:
commit 2be957ecb812c50898d45d6123e5a61b7ece0d7d
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Mon Oct 4 14:47:46 2010 -0400

    Ported calc-formula-matrix-no-autocalc.diff from ooo-build.
    
    This patch allows formula to be recalculated if it's during matrix
    calculation even if the auto recalc flag is OFF.  This is needed
    when calculating a formula whose result is a matrix which previously
    only calculated the top-left cell when the auto recalc was OFF.

diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx
index 93818ec..847e833 100644
--- a/sc/inc/cell.hxx
+++ b/sc/inc/cell.hxx
@@ -538,6 +538,8 @@ public:
 
     /** Determines whether or not the result string contains more than one paragraph */
     bool            IsMultilineResult();
+
+    void            MaybeInterpret();
 };
 
 //			Iterator fuer Referenzen in einer Formelzelle
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 74d7126..35840ae 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -899,8 +899,7 @@ void ScFormulaCell::GetFormula( String& rFormula, const FormulaGrammar::Grammar
 
 void ScFormulaCell::GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows )
 {
-    if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
-        Interpret();
+    MaybeInterpret();
 
     const ScMatrix* pMat = NULL;
     if (!pCode->GetCodeError() && aResult.GetType() == svMatrixCell &&
@@ -1969,6 +1968,15 @@ bool ScFormulaCell::IsMultilineResult()
     return false;
 }
 
+void ScFormulaCell::MaybeInterpret()
+{
+    if (!IsDirtyOrInTableOpDirty())
+        return;
+
+    if (pDocument->GetAutoCalc() || (cMatrixFlag != MM_NONE))
+        Interpret();
+}
+
 EditTextObject* ScFormulaCell::CreateURLObject()
 {
     String aCellText;
diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx
index f2a1429..d3b3621 100644
--- a/sc/source/core/data/cell2.cxx
+++ b/sc/source/core/data/cell2.cxx
@@ -489,29 +489,25 @@ bool lcl_isReference(const FormulaToken& rToken)
 
 BOOL ScFormulaCell::IsEmpty()
 {
-    if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
-        Interpret();
+    MaybeInterpret();
     return aResult.GetCellResultType() == formula::svEmptyCell;
 }
 
 BOOL ScFormulaCell::IsEmptyDisplayedAsString()
 {
-    if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
-        Interpret();
+    MaybeInterpret();
     return aResult.IsEmptyDisplayedAsString();
 }
 
 BOOL ScFormulaCell::IsValue()
 {
-    if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
-        Interpret();
+    MaybeInterpret();
     return aResult.IsValue();
 }
 
 double ScFormulaCell::GetValue()
 {
-    if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
-        Interpret();
+    MaybeInterpret();
     if ((!pCode->GetCodeError() || pCode->GetCodeError() == errDoubleRef) &&
             !aResult.GetResultError())
         return aResult.GetDouble();
@@ -521,16 +517,13 @@ double ScFormulaCell::GetValue()
 double ScFormulaCell::GetValueAlways()
 {
     // for goal seek: return result value even if error code is set
-
-    if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
-        Interpret();
+    MaybeInterpret();
     return aResult.GetDouble();
 }
 
 void ScFormulaCell::GetString( String& rString )
 {
-    if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
-        Interpret();
+    MaybeInterpret();
     if ((!pCode->GetCodeError() || pCode->GetCodeError() == errDoubleRef) &&
             !aResult.GetResultError())
         rString = aResult.GetString();
@@ -722,8 +715,8 @@ USHORT ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos )
 
 USHORT ScFormulaCell::GetErrCode()
 {
-    if (IsDirtyOrInTableOpDirty() && pDocument->GetAutoCalc())
-        Interpret();
+    MaybeInterpret();
+
     /* FIXME: If ScTokenArray::SetCodeError() was really only for code errors
      * and not also abused for signaling other error conditions we could bail
      * out even before attempting to interpret broken code. */


More information about the ooo-build-commit mailing list