diff options
author | Eike Rathke <erack@redhat.com> | 2017-04-10 21:26:35 +0200 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2017-05-02 20:09:27 -0400 |
commit | e1523481d3fdf30ba68d6307458f8618deb39c0b (patch) | |
tree | ce54a977db58cfe7a2a900f830eb1237cbc1674e | |
parent | 3226a277ce80137eeb15c86e462c521f86d49187 (diff) |
Add bool bIgnoreUndo parameter to removeFromDrawPageAndFree()
In preparation of using that in the dtor.
Change-Id: I9a8713390c548e774c1e23cef201effe00a29be9
-rw-r--r-- | sc/inc/postit.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/postit.cxx | 18 |
2 files changed, 12 insertions, 8 deletions
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index 09094ca41942..b339bfd3416b 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -70,7 +70,7 @@ public: /** Remove from draw page and free caption object if no Undo recording. */ - void removeFromDrawPageAndFree(); + void removeFromDrawPageAndFree( bool bIgnoreUndo = false ); /** Release all management of the SdrCaptionObj* in all instances of this list and dissolve. The SdrCaptionObj pointer returned is ready to be diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 6a2bf0035b7a..4eef5d5f9f09 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -717,7 +717,7 @@ void ScCaptionPtr::removeFromDrawPage( SdrPage& rDrawPage ) assert(pObj == mpCaption); (void)pObj; } -void ScCaptionPtr::removeFromDrawPageAndFree() +void ScCaptionPtr::removeFromDrawPageAndFree( bool bIgnoreUndo ) { assert(mpHead && mpCaption); SdrPage* pDrawPage = mpCaption->GetPage(); @@ -725,12 +725,16 @@ void ScCaptionPtr::removeFromDrawPageAndFree() if (pDrawPage) { pDrawPage->RecalcObjOrdNums(); - ScDrawLayer* pDrawLayer = dynamic_cast<ScDrawLayer*>(mpCaption->GetModel()); - SAL_WARN_IF( !pDrawLayer, "sc.core", "ScCaptionPtr::removeFromDrawPageAndFree - object without drawing layer"); - // create drawing undo action (before removing the object to have valid draw page in undo action) - const bool bRecording = (pDrawLayer && pDrawLayer->IsRecording()); - if (bRecording) - pDrawLayer->AddCalcUndo( new SdrUndoDelObj( *mpCaption )); + bool bRecording = false; + if (!bIgnoreUndo) + { + ScDrawLayer* pDrawLayer = dynamic_cast<ScDrawLayer*>(mpCaption->GetModel()); + SAL_WARN_IF( !pDrawLayer, "sc.core", "ScCaptionPtr::removeFromDrawPageAndFree - object without drawing layer"); + // create drawing undo action (before removing the object to have valid draw page in undo action) + bRecording = (pDrawLayer && pDrawLayer->IsRecording()); + if (bRecording) + pDrawLayer->AddCalcUndo( new SdrUndoDelObj( *mpCaption )); + } // remove the object from the drawing page, delete if undo is disabled removeFromDrawPage( *pDrawPage ); if (!bRecording) |