summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/document.cxx4
-rw-r--r--sc/source/core/data/formulacell.cxx13
2 files changed, 15 insertions, 2 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 5ce3b1b0a95c..15c6914891e7 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3764,6 +3764,10 @@ void ScDocument::CompileXML()
if ( pValidationList )
pValidationList->CompileXML();
+ // Track all formula cells that were appended to the FormulaTrack during
+ // import or CompileXML().
+ TrackFormulas();
+
SetAutoCalc( bOldAutoCalc );
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index d8c79b96921b..6c6c3d4259e5 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -1330,7 +1330,9 @@ void ScFormulaCell::CompileXML( sc::CompileFormulaContext& rCxt, ScProgress& rPr
// During load, only those cells that are marked explicitly dirty get
// recalculated. So we need to set it dirty here.
SetDirtyVar();
- pDocument->PutInFormulaTree(this);
+ pDocument->AppendToFormulaTrack(this);
+ // Do not call TrackFormulas() here, not all listeners may have been
+ // established, postponed until ScDocument::CompileXML() finishes.
}
else if (bWasInFormulaTree)
pDocument->PutInFormulaTree(this);
@@ -2135,7 +2137,14 @@ void ScFormulaCell::SetDirty( bool bDirtyFlag )
if( bDirtyFlag )
SetDirtyVar();
pDocument->AppendToFormulaTrack( this );
- pDocument->TrackFormulas();
+
+ // While loading a document listeners have not been established yet.
+ // Tracking would remove this cell from the FormulaTrack and add it to
+ // the FormulaTree, once in there it would be assumed that its
+ // dependents already had been tracked and it would be skipped on a
+ // subsequent notify. Postpone tracking until all listeners are set.
+ if (!pDocument->IsImportingXML())
+ pDocument->TrackFormulas();
}
pDocument->SetStreamValid(aPos.Tab(), false);