summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdpage.cxx
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2014-12-04 21:39:43 +0100
committerDavid Tardon <dtardon@redhat.com>2014-12-04 23:10:25 +0100
commit51bacc6a065f380a26b8cc2e5c18ff0ab4162ac3 (patch)
treeb42a463a134ff18ddac578dc88066d282268c4eb /svx/source/svdraw/svdpage.cxx
parent9638e6207c7fc48712b1b238177462c00f5011e8 (diff)
impl. Clone for all subclasses of SdrPage
Change-Id: Ie370161e51ff83cb605bc57d317ff945404e5611
Diffstat (limited to 'svx/source/svdraw/svdpage.cxx')
-rw-r--r--svx/source/svdraw/svdpage.cxx27
1 files changed, 20 insertions, 7 deletions
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index da27d4a27f09..e4238d96766b 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1302,10 +1302,17 @@ SdrPage::~SdrPage()
}
-void SdrPage::lateInit(const SdrPage& rSrcPage)
+void SdrPage::lateInit(const SdrPage& rSrcPage, SdrModel* const pNewModel)
{
assert(!mpViewContact);
assert(!mpSdrPageProperties);
+ assert(!mxUnoPage.is());
+
+ if (pNewModel && (pNewModel != pModel))
+ {
+ pModel = pNewModel;
+ impl_setModelForLayerAdmin(pNewModel);
+ }
// copy all the local parameters to make this instance
// a valid copy of source page before copying and inserting
@@ -1512,18 +1519,24 @@ sal_Int32 SdrPage::GetLwrBorder() const
return nBordLwr;
}
+void SdrPage::impl_setModelForLayerAdmin(SdrModel* const pNewModel)
+{
+ if (pNewModel!=NULL) {
+ pLayerAdmin->SetParent(&pNewModel->GetLayerAdmin());
+ } else {
+ pLayerAdmin->SetParent(NULL);
+ }
+ pLayerAdmin->SetModel(pNewModel);
+}
+
void SdrPage::SetModel(SdrModel* pNewModel)
{
SdrModel* pOldModel=pModel;
SdrObjList::SetModel(pNewModel);
+
if (pNewModel!=pOldModel)
{
- if (pNewModel!=NULL) {
- pLayerAdmin->SetParent(&pNewModel->GetLayerAdmin());
- } else {
- pLayerAdmin->SetParent(NULL);
- }
- pLayerAdmin->SetModel(pNewModel);
+ impl_setModelForLayerAdmin( pNewModel );
// create new SdrPageProperties with new model (due to SfxItemSet there)
// and copy ItemSet and StyleSheet