diff options
Diffstat (limited to 'svx/source/svdraw/svdpage.cxx')
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 52 |
1 files changed, 35 insertions, 17 deletions
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 6dd816d429da..8da0b248f38b 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1221,18 +1221,6 @@ SdrPageProperties::SdrPageProperties(SdrPage& rSdrPage) } } -SdrPageProperties::SdrPageProperties(const SdrPageProperties& rCandidate) -: SfxListener(), - mpSdrPage(rCandidate.mpSdrPage), - mpStyleSheet(0), - mpProperties(new SfxItemSet(*rCandidate.mpProperties)) -{ - if(rCandidate.GetStyleSheet()) - { - ImpAddStyleSheet(*rCandidate.GetStyleSheet()); - } -} - SdrPageProperties::~SdrPageProperties() { ImpRemoveStyleSheet(); @@ -1365,6 +1353,8 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) // Warning: this leads to slicing (see issue 93186) and has to be // removed as soon as possible. *this = rSrcPage; + OSL_ENSURE(mpSdrPageProperties, + "SdrPage::SdrPage: operator= did not create needed SdrPageProperties (!)"); // be careful and correct eListKind, a member of SdrObjList which // will be changed by the SdrOIbjList::operator= before... @@ -1382,8 +1372,6 @@ SdrPage::SdrPage(const SdrPage& rSrcPage) mxUnoPage = NULL; xComponent->dispose(); } - - mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); } SdrPage::~SdrPage() @@ -1478,8 +1466,28 @@ void SdrPage::operator=(const SdrPage& rSrcPage) mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent; { - delete mpSdrPageProperties; - mpSdrPageProperties = new SdrPageProperties(rSrcPage.getSdrPageProperties()); + // #i111122# delete SdrPageProperties when model is different + if(mpSdrPageProperties && GetModel() != rSrcPage.GetModel()) + { + delete mpSdrPageProperties; + mpSdrPageProperties = 0; + } + + if(!mpSdrPageProperties) + { + mpSdrPageProperties = new SdrPageProperties(*this); + } + else + { + mpSdrPageProperties->ClearItem(0); + } + + if(!IsMasterPage()) + { + mpSdrPageProperties->PutItemSet(rSrcPage.getSdrPageProperties().GetItemSet()); + } + + mpSdrPageProperties->SetStyleSheet(rSrcPage.getSdrPageProperties().GetStyleSheet()); } // Now copy the contained obejcts (by cloning them) @@ -1659,7 +1667,17 @@ void SdrPage::SetModel(SdrModel* pNewModel) } pLayerAdmin->SetModel(pNewModel); - SdrPageProperties *pNew = new SdrPageProperties(getSdrPageProperties()); + // create new SdrPageProperties with new model (due to SfxItemSet there) + // and copy ItemSet and StyleSheet + SdrPageProperties *pNew = new SdrPageProperties(*this); + + if(!IsMasterPage()) + { + pNew->PutItemSet(getSdrPageProperties().GetItemSet()); + } + + pNew->SetStyleSheet(getSdrPageProperties().GetStyleSheet()); + delete mpSdrPageProperties; mpSdrPageProperties = pNew; } |