summaryrefslogtreecommitdiff
path: root/svx
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
parent9638e6207c7fc48712b1b238177462c00f5011e8 (diff)
impl. Clone for all subclasses of SdrPage
Change-Id: Ie370161e51ff83cb605bc57d317ff945404e5611
Diffstat (limited to 'svx')
-rw-r--r--svx/source/form/fmpage.cxx17
-rw-r--r--svx/source/svdraw/svdpage.cxx27
2 files changed, 34 insertions, 10 deletions
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
index 96c3baaf7105..5c41a768728f 100644
--- a/svx/source/form/fmpage.cxx
+++ b/svx/source/form/fmpage.cxx
@@ -68,9 +68,9 @@ FmFormPage::FmFormPage(const FmFormPage& rPage)
{
}
-void FmFormPage::lateInit(const FmFormPage& rPage)
+void FmFormPage::lateInit(const FmFormPage& rPage, FmFormModel* const pNewModel)
{
- SdrPage::lateInit( rPage );
+ SdrPage::lateInit( rPage, pNewModel );
m_pImpl->initFrom( rPage.GetImpl() );
m_sPageName = rPage.m_sPageName;
@@ -119,8 +119,19 @@ void FmFormPage::SetModel(SdrModel* pNewModel)
SdrPage* FmFormPage::Clone() const
{
+ return Clone(0);
+}
+
+SdrPage* FmFormPage::Clone(SdrModel* const pNewModel) const
+{
FmFormPage* const pNewPage = new FmFormPage(*this);
- pNewPage->lateInit(*this);
+ FmFormModel* pFormModel = 0;
+ if (pNewModel)
+ {
+ pFormModel = dynamic_cast<FmFormModel*>(pNewModel);
+ assert(pFormModel);
+ }
+ pNewPage->lateInit(*this, pFormModel);
return pNewPage;
}
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