Blob Blame History Raw
From d210265a1b6c4d7b405ef6e79fd30395ca1bc0aa Mon Sep 17 00:00:00 2001
Message-Id: <d210265a1b6c4d7b405ef6e79fd30395ca1bc0aa.1421445696.git.erack@redhat.com>
From: Eike Rathke <erack@redhat.com>
Date: Thu, 18 Dec 2014 13:26:48 +0100
Subject: [PATCH] Resolves: fdo#86978 append formula cells to track instead of
 tree
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------erAck-patch-parts"

This is a multi-part message in MIME format.
--------------erAck-patch-parts
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit


Cells in FormulaTree are assumed to be tracked already and their
dependents be notified. Also postpone tracking until all listeners are
established.

(cherry picked from commit 573f5dfba805b733dd2da62bde3cd5d9d25879d9)

Conflicts:
	sc/source/core/data/formulacell.cxx

Change-Id: I7f27fba979fe231e3d3cd071fcc8a273142cb3f3
Reviewed-on: https://gerrit.libreoffice.org/13523
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
---
 sc/source/core/data/document.cxx    | 4 ++++
 sc/source/core/data/formulacell.cxx | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)


--------------erAck-patch-parts
Content-Type: text/x-patch; name="0001-Resolves-fdo-86978-append-formula-cells-to-track-ins.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Resolves-fdo-86978-append-formula-cells-to-track-ins.patch"

diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f53426a0..af7d98f 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3735,6 +3735,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 48e6760..da68f68 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -2033,7 +2033,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();
             }
         }
 

--------------erAck-patch-parts--