summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx5
-rw-r--r--sc/inc/document.hxx19
-rw-r--r--sc/qa/unit/ucalc.cxx10
-rw-r--r--sc/source/core/data/cell.cxx5
-rw-r--r--sc/source/core/data/documen7.cxx6
-rw-r--r--sc/source/filter/oox/workbookfragment.cxx2
-rw-r--r--sc/source/ui/docshell/docsh.cxx2
7 files changed, 35 insertions, 14 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 2a48678cf581..29b66945c799 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1069,7 +1069,10 @@ void FormulaCompiler::Factor()
pArr->SetRecalcModeOnRefMove();
break;
case ocHyperLink :
- pArr->SetHyperLink(true);
+ // cell with hyperlink needs to be calculated on load to
+ // get its matrix result generated.
+ pArr->SetRecalcModeOnLoad();
+ pArr->SetHyperLink(true);
break;
default:
; // nothing
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index d38142cbab63..41afbf2d11b6 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1646,9 +1646,22 @@ public:
SvtListener* pListener );
void PutInFormulaTree( ScFormulaCell* pCell );
void RemoveFromFormulaTree( ScFormulaCell* pCell );
- SC_DLLPUBLIC void CalcFormulaTree( bool bOnlyForced = false,
- bool bNoProgressBar = false,
- bool bDirtyFlag=true );
+
+ /**
+ * Calculate formula cells that are on the formula tree either partially,
+ * or in full.
+ *
+ * @param bOnlyForced when true, it only calculates those formula cells
+ * that are marked "recalc forced".
+ * @param bProgressBar whether or not to use progress bar.
+ * @param bSetAllDirty when true, it marks all formula cells currently on
+ * the formula tree dirty, which forces all of them to
+ * be recalculated. When false, only those cells
+ * that are marked dirty prior to this call get
+ * recalculated.
+ */
+ SC_DLLPUBLIC void CalcFormulaTree(
+ bool bOnlyForced = false, bool bProgressBar = true, bool bSetAllDirty = true );
void ClearFormulaTree();
void AppendToFormulaTrack( ScFormulaCell* pCell );
void RemoveFromFormulaTrack( ScFormulaCell* pCell );
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 250940016321..842a13cc19ff 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -1060,7 +1060,7 @@ void Test::testSheetsFunc()
m_pDoc->InsertTab (SC_TAB_APPEND, aTabName1));
m_pDoc->SetString(0, 0, 0, OUString("=SHEETS()"));
- m_pDoc->CalcFormulaTree(false, true);
+ m_pDoc->CalcFormulaTree(false, false);
double original;
m_pDoc->GetValue(0, 0, 0, original);
@@ -1100,14 +1100,14 @@ void Test::testVolatileFunc()
val = 0;
m_pDoc->SetValue(0, 0, 0, val);
- m_pDoc->CalcFormulaTree(false, true);
+ m_pDoc->CalcFormulaTree(false, false);
double zero;
m_pDoc->GetValue(0, 1, 0, zero);
CPPUNIT_ASSERT_MESSAGE("Result should equal the 3rd parameter of IF, which is zero.", zero == 0.0);
val = 1;
m_pDoc->SetValue(0, 0, 0, val);
- m_pDoc->CalcFormulaTree(false, true);
+ m_pDoc->CalcFormulaTree(false, false);
double now2;
m_pDoc->GetValue(0, 1, 0, now2);
CPPUNIT_ASSERT_MESSAGE("Result should be the value of NOW() again.", (now2 - now1) >= 0.0);
@@ -1231,7 +1231,7 @@ void Test::testFuncParam()
// First, the normal case, with no missing parameters.
m_pDoc->SetString(0, 0, 0, OUString("=AVERAGE(1;2;3)"));
- m_pDoc->CalcFormulaTree(false, true);
+ m_pDoc->CalcFormulaTree(false, false);
double val;
m_pDoc->GetValue(0, 0, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 2);
@@ -1239,7 +1239,7 @@ void Test::testFuncParam()
// Now function with missing parameters. Missing values should be treated
// as zeros.
m_pDoc->SetString(0, 0, 0, OUString("=AVERAGE(1;;;)"));
- m_pDoc->CalcFormulaTree(false, true);
+ m_pDoc->CalcFormulaTree(false, false);
m_pDoc->GetValue(0, 0, 0, val);
CPPUNIT_ASSERT_MESSAGE("incorrect result", val == 0.25);
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 0641c02ddb0b..bbf89760597f 100644
--- a/sc/source/core/data/cell.cxx
+++ b/sc/source/core/data/cell.cxx
@@ -1097,7 +1097,12 @@ void ScFormulaCell::CompileXML( ScProgress& rProgress )
//volatile cells must be added here for import
if( pCode->IsRecalcModeAlways() || pCode->IsRecalcModeForced() ||
pCode->IsRecalcModeOnLoad() || pCode->IsRecalcModeOnLoadOnce() )
+ {
+ // During load, only those cells that are marked explicitly dirty get
+ // recalculated. So we need to set it dirty here.
+ SetDirtyVar();
pDocument->PutInFormulaTree(this);
+ }
}
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index ea1cc24c1d11..c67d3723d8b8 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -271,7 +271,7 @@ bool ScDocument::IsInFormulaTree( ScFormulaCell* pCell ) const
}
-void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bNoProgress, bool bDirtyFlag )
+void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bProgressBar, bool bSetAllDirty )
{
OSL_ENSURE( !IsCalculatingFormulaTree(), "CalcFormulaTree recursion" );
// never ever recurse into this, might end up lost in infinity
@@ -308,13 +308,13 @@ void ScDocument::CalcFormulaTree( bool bOnlyForced, bool bNoProgress, bool bDirt
}
else
{ // andere simpel berechnen
- if( bDirtyFlag )
+ if( bSetAllDirty )
pCell->SetDirtyVar();
pCell = pCell->GetNext();
}
}
}
- bool bProgress = !bOnlyForced && nFormulaCodeInTree && !bNoProgress;
+ bool bProgress = !bOnlyForced && nFormulaCodeInTree && bProgressBar;
if ( bProgress )
ScProgress::CreateInterpretProgress( this, true );
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index 3c696b677bab..b5d7ff2bf4bc 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -331,7 +331,7 @@ void WorkbookFragment::finalizeImport()
if (bHardRecalc)
pDocSh->DoHardRecalc(false);
else
- rDoc.CalcFormulaTree(false, false, false);
+ rDoc.CalcFormulaTree(false, true, false);
}
// private --------------------------------------------------------------------
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 22322ba4da28..183833c0637a 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -442,7 +442,7 @@ sal_Bool ScDocShell::LoadXML( SfxMedium* pLoadMedium, const ::com::sun::star::un
DoHardRecalc(false);
else
// still need to recalc volatile formula cells.
- aDocument.CalcFormulaTree(false, false, false);
+ aDocument.CalcFormulaTree(false, true, false);
aDocument.EnableAdjustHeight(false);