Add bool bIgnoreUndo parameter to removeFromDrawPageAndFree()
In preparation of using that in the dtor.
Change-Id: I9a8713390c548e774c1e23cef201effe00a29be9
diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx
index 8791a8b..993de2a 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 36d1f82..524328e 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)