diff options
author | Eike Rathke <erack@redhat.com> | 2014-12-18 13:26:48 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-12-18 13:38:35 +0100 |
commit | 3c7b69f0e68cfdcc4ec45e6ee1e696b99ae4a780 (patch) | |
tree | a1f3a8d760c0092c2ceb6c7fa4f32740d508d1b7 | |
parent | 0b0860414cefded03fdbc0a4490aaac39236ff09 (diff) |
Resolves: fdo#86978 append formula cells to track instead of tree
Cells in FormulaTree are assumed to be tracked already and their
dependents be notified. Also postpone tracking until all listeners are
established.
Change-Id: I7f27fba979fe231e3d3cd071fcc8a273142cb3f3
(cherry picked from commit 573f5dfba805b733dd2da62bde3cd5d9d25879d9)
-rw-r--r-- | sc/source/core/data/document.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/formulacell.cxx | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index fdab20404c04..252352cc5e19 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3756,6 +3756,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 8f78e8b21935..bc9ffbe4940c 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); |