summaryrefslogtreecommitdiff
path: root/sd/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sd/source/ui')
-rw-r--r--sd/source/ui/animations/motionpathtag.cxx6
-rw-r--r--sd/source/ui/dlg/animobjs.cxx22
-rw-r--r--sd/source/ui/func/fumorph.cxx12
-rw-r--r--sd/source/ui/func/fuvect.cxx2
-rw-r--r--sd/source/ui/sidebar/DocumentHelper.cxx4
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx4
-rw-r--r--sd/source/ui/unoidl/unoobj.cxx5
-rw-r--r--sd/source/ui/view/GraphicObjectBar.cxx2
-rw-r--r--sd/source/ui/view/drviews6.cxx3
-rw-r--r--sd/source/ui/view/drviews9.cxx2
-rw-r--r--sd/source/ui/view/sdview3.cxx6
-rw-r--r--sd/source/ui/view/sdview4.cxx4
12 files changed, 46 insertions, 26 deletions
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index 6699ade88ff7..b5189251a276 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -986,10 +986,12 @@ void MotionPathTag::disposing()
if( mpPathObj )
{
- SdrPathObj* pPathObj = mpPathObj;
+ SdrObject* pTemp(mpPathObj);
mpPathObj = nullptr;
mrView.updateHandles();
- delete pPathObj;
+
+ // always use SdrObject::Free(...) for SdrObjects (!)
+ SdrObject::Free(pTemp);
}
if( mpMark )
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 5ca6bab37ebd..8f48e7e13b29 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -789,7 +789,9 @@ void AnimationWindow::AddObj (::sd::View& rView )
++m_nCurrentFrame;
// Clone
- pPage->InsertObject(pSnapShot->Clone(), m_nCurrentFrame);
+ pPage->InsertObject(
+ pSnapShot->CloneSdrObject(pPage->getSdrModelFromSdrPage()),
+ m_nCurrentFrame);
}
bAnimObj = true;
}
@@ -813,7 +815,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
{
SdrMark* pMark = rMarkList.GetMark(0);
SdrObject* pObject = pMark->GetMarkedSdrObj();
- SdrObject* pClone = pObject->Clone();
+ SdrObject* pClone(pObject->CloneSdrObject(pPage->getSdrModelFromSdrPage()));
size_t nIndex = m_nCurrentFrame + 1;
pPage->InsertObject(pClone, nIndex);
}
@@ -837,7 +839,9 @@ void AnimationWindow::AddObj (::sd::View& rView )
// increment => next one inserted after this one
++m_nCurrentFrame;
- pPage->InsertObject(pObject->Clone(), m_nCurrentFrame);
+ pPage->InsertObject(
+ pObject->CloneSdrObject(pPage->getSdrModelFromSdrPage()),
+ m_nCurrentFrame);
}
bAnimObj = true; // that we don't change again
}
@@ -847,7 +851,11 @@ void AnimationWindow::AddObj (::sd::View& rView )
SdrObjList* pObjList = pCloneGroup->GetSubList();
for (size_t nObject= 0; nObject < nMarkCount; ++nObject)
- pObjList->InsertObject(rMarkList.GetMark(nObject)->GetMarkedSdrObj()->Clone());
+ {
+ pObjList->InsertObject(
+ rMarkList.GetMark(nObject)->GetMarkedSdrObj()->CloneSdrObject(
+ pPage->getSdrModelFromSdrPage()));
+ }
size_t nIndex = m_nCurrentFrame + 1;
pPage->InsertObject(pCloneGroup, nIndex);
@@ -1074,7 +1082,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView )
// the clone remains in the animation; we insert a clone of the
// clone into the group
pClone = pPage->GetObj(i);
- SdrObject* pCloneOfClone = pClone->Clone();
+ SdrObject* pCloneOfClone(pClone->CloneSdrObject(pPage->getSdrModelFromSdrPage()));
//SdrObject* pCloneOfClone = pPage->GetObj(i)->Clone();
pObjList->InsertObject(pCloneOfClone);
}
@@ -1093,7 +1101,9 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView )
// #i42894# if that worked, delete the group again
if(!pGroup->GetSubList()->GetObjCount())
{
- delete pGroup;
+ // always use SdrObject::Free(...) for SdrObjects (!)
+ SdrObject* pTemp(pGroup);
+ SdrObject::Free(pTemp);
}
}
}
diff --git a/sd/source/ui/func/fumorph.cxx b/sd/source/ui/func/fumorph.cxx
index 2a2b2355b93f..6fa9494dfb7f 100644
--- a/sd/source/ui/func/fumorph.cxx
+++ b/sd/source/ui/func/fumorph.cxx
@@ -81,8 +81,8 @@ void FuMorph::DoExecute( SfxRequest& )
// create clones
SdrObject* pObj1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
SdrObject* pObj2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
- SdrObject* pCloneObj1 = pObj1->Clone();
- SdrObject* pCloneObj2 = pObj2->Clone();
+ SdrObject* pCloneObj1(pObj1->CloneSdrObject(pObj1->getSdrModelFromSdrObject()));
+ SdrObject* pCloneObj2(pObj2->CloneSdrObject(pObj2->getSdrModelFromSdrObject()));
// delete text at clone, otherwise we do net get a correct PathObj
pCloneObj1->SetOutlinerParaObject(nullptr);
@@ -431,8 +431,12 @@ void FuMorph::ImpInsertPolygons(
if ( nCount )
{
- pObjList->InsertObject( pObj1->Clone(), 0 );
- pObjList->InsertObject( pObj2->Clone() );
+ pObjList->InsertObject(
+ pObj1->CloneSdrObject(pObj1->getSdrModelFromSdrObject()),
+ 0 );
+ pObjList->InsertObject(
+ pObj2->CloneSdrObject(pObj2->getSdrModelFromSdrObject()) );
+
mpView->DeleteMarked();
mpView->InsertObjectAtView( pObjGroup, *pPageView, SdrInsertFlags:: SETDEFLAYER );
}
diff --git a/sd/source/ui/func/fuvect.cxx b/sd/source/ui/func/fuvect.cxx
index 6722e9e379c6..8a547243d6d8 100644
--- a/sd/source/ui/func/fuvect.cxx
+++ b/sd/source/ui/func/fuvect.cxx
@@ -70,7 +70,7 @@ void FuVectorize::DoExecute( SfxRequest& )
if( pPageView && rMtf.GetActionSize() )
{
- SdrGrafObj* pVectObj = static_cast<SdrGrafObj*>( pObj->Clone() );
+ SdrGrafObj* pVectObj = static_cast<SdrGrafObj*>( pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject()) );
OUString aStr( mpView->GetDescriptionOfMarkedObjects() );
aStr += " " + SdResId( STR_UNDO_VECTORIZE );
mpView->BegUndo( aStr );
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx
index b9336124f9e1..7198a19217d8 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -209,7 +209,7 @@ SdPage* DocumentHelper::AddMasterPage (
try
{
// Duplicate the master page.
- pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
+ pClonedMasterPage = static_cast<SdPage*>(pMasterPage->CloneSdrPage(rTargetDocument));
// Copy the necessary styles.
SdDrawDocument& rSourceDocument(static_cast< SdDrawDocument& >(pMasterPage->getSdrModelFromSdrPage()));
@@ -347,7 +347,7 @@ SdPage* DocumentHelper::AddMasterPage (
if (pMasterPage!=nullptr)
{
// Duplicate the master page.
- pClonedMasterPage = static_cast<SdPage*>(pMasterPage->Clone());
+ pClonedMasterPage = static_cast<SdPage*>(pMasterPage->CloneSdrPage(rTargetDocument));
// Copy the precious flag.
pClonedMasterPage->SetPrecious(pMasterPage->IsPrecious());
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 677687e703d0..2c0c60302a02 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -505,7 +505,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, bool bDuplicate )
* standard page
**************************************************************/
if( bDuplicate )
- pStandardPage = static_cast<SdPage*>( pPreviousStandardPage->Clone() );
+ pStandardPage = static_cast<SdPage*>( pPreviousStandardPage->CloneSdrPage(*mpDoc) );
else
pStandardPage = mpDoc->AllocSdPage(false);
@@ -540,7 +540,7 @@ SdPage* SdXImpressDocument::InsertSdPage( sal_uInt16 nPage, bool bDuplicate )
SdPage* pNotesPage = nullptr;
if( bDuplicate )
- pNotesPage = static_cast<SdPage*>( pPreviousNotesPage->Clone() );
+ pNotesPage = static_cast<SdPage*>( pPreviousNotesPage->CloneSdrPage(*mpDoc) );
else
pNotesPage = mpDoc->AllocSdPage(false);
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 33e9928cafc5..5b0922b148a4 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -506,7 +506,10 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c
if(!pGroup->GetSubList()->GetObjCount())
{
pPage->NbcRemoveObject(pGroup->GetOrdNum());
- delete pGroup;
+
+ // always use SdrObject::Free(...) for SdrObjects (!)
+ SdrObject* pTemp(pGroup);
+ SdrObject::Free(pTemp);
}
}
}
diff --git a/sd/source/ui/view/GraphicObjectBar.cxx b/sd/source/ui/view/GraphicObjectBar.cxx
index 90871e3e4456..acecdffd7dac 100644
--- a/sd/source/ui/view/GraphicObjectBar.cxx
+++ b/sd/source/ui/view/GraphicObjectBar.cxx
@@ -129,7 +129,7 @@ void GraphicObjectBar::ExecuteFilter( SfxRequest const & rReq )
if( pPageView )
{
- SdrGrafObj* pFilteredObj = static_cast<SdrGrafObj*>( pObj->Clone() );
+ SdrGrafObj* pFilteredObj = static_cast<SdrGrafObj*>( pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject()) );
OUString aStr = mpView->GetDescriptionOfMarkedObjects();
aStr += " " + SdResId(STR_UNDO_GRAFFILTER);
mpView->BegUndo( aStr );
diff --git a/sd/source/ui/view/drviews6.cxx b/sd/source/ui/view/drviews6.cxx
index 595ec0353681..bfc0fe363e43 100644
--- a/sd/source/ui/view/drviews6.cxx
+++ b/sd/source/ui/view/drviews6.cxx
@@ -279,7 +279,8 @@ void DrawViewShell::ExecBmpMask( SfxRequest const & rReq )
if ( pObj && !mpDrawView->IsTextEdit() )
{
- std::unique_ptr<SdrGrafObj> xNewObj(pObj->Clone());
+ typedef std::unique_ptr< SdrGrafObj, SdrObjectFreeOp > SdrGrafObjPtr;
+ SdrGrafObjPtr xNewObj(pObj->CloneSdrObject(pObj->getSdrModelFromSdrObject()));
bool bCont = true;
if (xNewObj->IsLinkedGraphic())
diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx
index afc151b29a96..b253e25098ec 100644
--- a/sd/source/ui/view/drviews9.cxx
+++ b/sd/source/ui/view/drviews9.cxx
@@ -151,7 +151,7 @@ void DrawViewShell::ExecGallery(SfxRequest const & rReq)
// the empty graphic object gets a new graphic
bInsertNewObject = false;
- SdrGrafObj* pNewGrafObj = pGrafObj->Clone();
+ SdrGrafObj* pNewGrafObj(pGrafObj->CloneSdrObject(pGrafObj->getSdrModelFromSdrObject()));
pNewGrafObj->SetEmptyPresObj(false);
pNewGrafObj->SetOutlinerParaObject(nullptr);
pNewGrafObj->SetGraphic(aGraphic);
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 73f06ae8f975..4100fe9dfacc 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -480,7 +480,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
for(size_t a = 0; a < pMarkList->GetMarkCount(); ++a)
{
SdrMark* pM = pMarkList->GetMark(a);
- SdrObject* pObj = pM->GetMarkedSdrObj()->Clone();
+ SdrObject* pObj(pM->GetMarkedSdrObj()->CloneSdrObject(pPage->getSdrModelFromSdrPage()));
if(pObj)
{
@@ -714,7 +714,8 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
if( ( mnAction & DND_ACTION_MOVE ) && pPickObj2 && pObj )
{
// replace object
- SdrObject* pNewObj = pObj->Clone();
+ SdrPage* pWorkPage = GetSdrPageView()->GetPage();
+ SdrObject* pNewObj(pObj->CloneSdrObject(pWorkPage->getSdrModelFromSdrPage()));
::tools::Rectangle aPickObjRect( pPickObj2->GetCurrentBoundRect() );
Size aPickObjSize( aPickObjRect.GetSize() );
Point aVec( aPickObjRect.TopLeft() );
@@ -733,7 +734,6 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
if( bUndo )
BegUndo(SdResId(STR_UNDO_DRAGDROP));
pNewObj->NbcSetLayer( pPickObj->GetLayer() );
- SdrPage* pWorkPage = GetSdrPageView()->GetPage();
pWorkPage->InsertObject( pNewObj );
if( bUndo )
{
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 0a8792cd8538..9d1cb05ed000 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -111,7 +111,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
if( bIsGraphic )
{
// We fill the object with the Bitmap
- pNewGrafObj = static_cast<SdrGrafObj*>( pPickObj->Clone() );
+ pNewGrafObj = static_cast<SdrGrafObj*>( pPickObj->CloneSdrObject(pPickObj->getSdrModelFromSdrObject()) );
pNewGrafObj->SetGraphic(rGraphic);
}
else
@@ -318,7 +318,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM
if( mnAction == DND_ACTION_LINK && pPickObj && pPV && dynamic_cast< SdrMediaObj *>( pPickObj ) != nullptr )
{
- pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() );
+ pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->CloneSdrObject(pPickObj->getSdrModelFromSdrObject()) );
pNewMediaObj->setURL( rMediaURL, ""/*TODO?*/, rMimeType );
BegUndo(SdResId(STR_UNDO_DRAGDROP));