summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@cib.de>2018-12-05 10:56:29 +0100
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2018-12-07 10:19:27 +0100
commitbe3b9945edc1ef767400fc143494a96c76712041 (patch)
treea64f34ab399b33fbb00e4f103dd620da61a44977 /svx
parent8e92da60341cbc882cf310f04f0d15862763a888 (diff)
tdf#121022 Do change parent of SdrObj early
Need to change parent of an SdrObject in the according SdrObjList methods before calling InsertedStateChange - that one relies on asking for the parent of the SdrObject Change-Id: I8c4d39190cafe889b27975941d72afca870e2ce5 Reviewed-on: https://gerrit.libreoffice.org/64608 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de> (cherry picked from commit b38f856f234f364199d306226875471ed589b764) Reviewed-on: https://gerrit.libreoffice.org/64706 Tested-by: Xisco Faulí <xiscofauli@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdpage.cxx30
1 files changed, 25 insertions, 5 deletions
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index c56b06d6c954..3706eee5a2c9 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -384,8 +384,14 @@ SdrObject* SdrObjList::NbcRemoveObject(size_t nObjNum)
pObj->GetViewContact().flushViewObjectContacts();
DBG_ASSERT(pObj->IsInserted(),"The object does not have the status Inserted.");
- pObj->InsertedStateChange(); // calls UserCall, among other
+
+ // tdf#121022 Do first remove from SdrObjList - InsertedStateChange
+ // relies now on IsInserted which uses getParentSdrObjListFromSdrObject
SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
+
+ // calls UserCall, among other
+ pObj->InsertedStateChange();
+
if (!mbObjOrdNumsDirty)
{
// optimizing for the case that the last object has to be removed
@@ -426,9 +432,13 @@ SdrObject* SdrObjList::RemoveObject(size_t nObjNum)
pObj->getSdrModelFromSdrObject().SetChanged();
- pObj->InsertedStateChange(); // calls, among other things, the UserCall
+ // tdf#121022 Do first remove from SdrObjList - InsertedStateChange
+ // relies now on IsInserted which uses getParentSdrObjListFromSdrObject
SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
+ // calls, among other things, the UserCall
+ pObj->InsertedStateChange();
+
if (!mbObjOrdNumsDirty)
{
// optimization for the case that the last object is removed
@@ -475,18 +485,28 @@ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, size_t nObjNum)
pObj->getSdrModelFromSdrObject().Broadcast(aHint);
}
- pObj->InsertedStateChange();
+ // Change parent and replace in SdrObjList
SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
ReplaceObjectInContainer(*pNewObj,nObjNum);
- // flushViewObjectContacts() clears the VOC's and those invalidate
+ // tdf#121022 InsertedStateChange uses the parent
+ // to detect if pObj is inserted or not, so have to call
+ // it *after* changing these settings, else a obviously wrong
+ // 'SdrUserCallType::Inserted' would be sent
+ pObj->InsertedStateChange();
+
+ // flushViewObjectContacts() clears the VOC's and those
+ // trigger the evtl. needed invalidate(s)
pObj->GetViewContact().flushViewObjectContacts();
+ // Setup data at new SdrObject - it already *is* inserted to
+ // the SdrObjList due to 'ReplaceObjectInContainer' above
pNewObj->SetOrdNum(nObjNum);
SetParentAtSdrObjectFromSdrObjList(*pNewObj, this);
// Inform the parent about change to allow invalidations at
- // evtl. existing parent visualisations
+ // evtl. existing parent visualisations, but also react on
+ // newly inserted SdrObjects (as e.g. GraphCtrlUserCall does)
impChildInserted(*pNewObj);
pNewObj->InsertedStateChange();