summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-04-10 21:26:35 +0200
committerHenry Castro <hcastro@collabora.com>2017-05-02 20:09:27 -0400
commite1523481d3fdf30ba68d6307458f8618deb39c0b (patch)
treece54a977db58cfe7a2a900f830eb1237cbc1674e
parent3226a277ce80137eeb15c86e462c521f86d49187 (diff)
Add bool bIgnoreUndo parameter to removeFromDrawPageAndFree()
In preparation of using that in the dtor. Change-Id: I9a8713390c548e774c1e23cef201effe00a29be9
-rw-r--r--sc/inc/postit.hxx2
-rw-r--r--sc/source/core/data/postit.cxx18
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)