summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdmodel.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/svdraw/svdmodel.cxx')
-rw-r--r--svx/source/svdraw/svdmodel.cxx45
1 files changed, 17 insertions, 28 deletions
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index bb237ba756cf..04d0f701247e 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -1323,7 +1323,7 @@ void SdrModel::InsertPage(SdrPage* pPage, sal_uInt16 nPos)
PageListChanged();
pPage->SetInserted();
pPage->SetPageNum(nPos);
-
+ pPage->SetModel(this);
if (nPos<nCount) bPagNumsDirty=true;
SetChanged();
SdrHint aHint(SdrHintKind::PageOrderChange, pPage);
@@ -1372,11 +1372,10 @@ void SdrModel::InsertMasterPage(SdrPage* pPage, sal_uInt16 nPos)
MasterPageListChanged();
pPage->SetInserted();
pPage->SetPageNum(nPos);
-
+ pPage->SetModel(this);
if (nPos<nCount) {
bMPgNumsDirty=true;
}
-
SetChanged();
SdrHint aHint(SdrHintKind::PageOrderChange, pPage);
Broadcast(aHint);
@@ -1477,10 +1476,7 @@ void SdrModel::CopyPages(sal_uInt16 nFirstPageNum, sal_uInt16 nLastPageNum,
if (!bMoveNoCopy)
{
const SdrPage* pPg1=GetPage(nPageNum2);
-
- // Clone to local model
pPg=pPg1->Clone();
-
InsertPage(pPg,nDestNum);
if (bUndo)
AddUndo(GetSdrUndoFactory().CreateUndoCopyPage(*pPg));
@@ -1581,18 +1577,14 @@ void SdrModel::Merge(SdrModel& rSourceModel,
if (pMasterMap && pMasterNeed && nMasterNeed!=0) {
for (sal_uInt16 i=nSrcMasterPageCnt; i>0;) {
i--;
- if (pMasterNeed[i])
- {
- // Always Clone to new model
- const SdrPage* pPg1(rSourceModel.GetMasterPage(i));
- SdrPage* pPg(pPg1->Clone(this));
-
- if(!bTreadSourceAsConst)
- {
- // if requested, delete original/modify original model
- delete rSourceModel.RemoveMasterPage(i);
+ if (pMasterNeed[i]) {
+ SdrPage* pPg=nullptr;
+ if (bTreadSourceAsConst) {
+ const SdrPage* pPg1=rSourceModel.GetMasterPage(i);
+ pPg=pPg1->Clone();
+ } else {
+ pPg=rSourceModel.RemoveMasterPage(i);
}
-
if (pPg!=nullptr) {
// Now append all of them to the end of the DstModel.
// Don't use InsertMasterPage(), because everything is
@@ -1600,6 +1592,7 @@ void SdrModel::Merge(SdrModel& rSourceModel,
maMaPag.insert(maMaPag.begin()+nDstMasterPageCnt, pPg);
MasterPageListChanged();
pPg->SetInserted();
+ pPg->SetModel(this);
bMPgNumsDirty=true;
if (bUndo) AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pPg));
} else {
@@ -1614,18 +1607,14 @@ void SdrModel::Merge(SdrModel& rSourceModel,
sal_uInt16 nSourcePos=nFirstPageNum;
sal_uInt16 nMergeCount=sal_uInt16(std::abs(static_cast<long>(static_cast<long>(nFirstPageNum)-nLastPageNum))+1);
if (nDestPos>GetPageCount()) nDestPos=GetPageCount();
- while (nMergeCount>0)
- {
- // Always Clone to new model
- const SdrPage* pPg1(rSourceModel.GetPage(nSourcePos));
- SdrPage* pPg(pPg1->Clone(this));
-
- if(!bTreadSourceAsConst)
- {
- // if requested, delete original/modify original model
- delete rSourceModel.RemovePage(nSourcePos);
+ while (nMergeCount>0) {
+ SdrPage* pPg=nullptr;
+ if (bTreadSourceAsConst) {
+ const SdrPage* pPg1=rSourceModel.GetPage(nSourcePos);
+ pPg=pPg1->Clone();
+ } else {
+ pPg=rSourceModel.RemovePage(nSourcePos);
}
-
if (pPg!=nullptr) {
InsertPage(pPg,nDestPos);
if (bUndo) AddUndo(GetSdrUndoFactory().CreateUndoNewPage(*pPg));