Blame SOURCES/0001-ooo-93212-avoid-slicing-during-construction-of-SdrPa.patch

ebc4bd
From 9638e6207c7fc48712b1b238177462c00f5011e8 Mon Sep 17 00:00:00 2001
ebc4bd
From: David Tardon <dtardon@redhat.com>
ebc4bd
Date: Wed, 3 Dec 2014 22:01:57 +0100
ebc4bd
Subject: [PATCH] ooo#93212 avoid slicing during construction of SdrPage
ebc4bd
ebc4bd
Also hide copy ctor and assignment operator of all derived classes, to
ebc4bd
ensure that Clone() is the only method to make copies of them.
ebc4bd
ebc4bd
Change-Id: Icb3b50c63b086abe8c9add32e3041fe19692d20b
ebc4bd
---
ebc4bd
 basctl/source/dlged/dlgedpage.cxx        | 10 +++-
ebc4bd
 basctl/source/inc/dlgedpage.hxx          |  5 ++
ebc4bd
 include/svx/fmpage.hxx                   |  9 +++-
ebc4bd
 include/svx/obj3d.hxx                    |  8 ++-
ebc4bd
 include/svx/svdpage.hxx                  | 27 +++++++---
ebc4bd
 reportdesign/inc/RptPage.hxx             |  2 +
ebc4bd
 reportdesign/source/core/sdr/RptPage.cxx |  4 +-
ebc4bd
 sc/inc/drawpage.hxx                      |  3 ++
ebc4bd
 sd/inc/sdpage.hxx                        |  6 ++-
ebc4bd
 sd/source/core/sdpage2.cxx               | 28 ++++++-----
ebc4bd
 svx/source/engine3d/obj3d.cxx            | 11 ++++-
ebc4bd
 svx/source/form/fmpage.cxx               | 11 ++++-
ebc4bd
 svx/source/svdraw/svdpage.cxx            | 84 +++++++++-----------------------
ebc4bd
 sw/inc/dpage.hxx                         |  3 ++
ebc4bd
 14 files changed, 122 insertions(+), 89 deletions(-)
ebc4bd
ebc4bd
diff --git a/basctl/source/dlged/dlgedpage.cxx b/basctl/source/dlged/dlgedpage.cxx
ebc4bd
index 86a792f..15f7f12 100644
ebc4bd
--- a/basctl/source/dlged/dlgedpage.cxx
ebc4bd
+++ b/basctl/source/dlged/dlgedpage.cxx
ebc4bd
@@ -33,6 +33,12 @@ DlgEdPage::DlgEdPage(DlgEdModel& rModel, bool bMasterPage)
ebc4bd
 {
ebc4bd
 }
ebc4bd
 
ebc4bd
+DlgEdPage::DlgEdPage(const DlgEdPage& rSrcPage)
ebc4bd
+    : SdrPage(rSrcPage)
ebc4bd
+    , pDlgEdForm(0)
ebc4bd
+{
ebc4bd
+}
ebc4bd
+
ebc4bd
 DlgEdPage::~DlgEdPage()
ebc4bd
 {
ebc4bd
     Clear();
ebc4bd
@@ -41,7 +47,9 @@ DlgEdPage::~DlgEdPage()
ebc4bd
 
ebc4bd
 SdrPage* DlgEdPage::Clone() const
ebc4bd
 {
ebc4bd
-    return new DlgEdPage( *this );
ebc4bd
+    DlgEdPage* const pNewPage = new DlgEdPage( *this );
ebc4bd
+    pNewPage->lateInit( *this );
ebc4bd
+    return pNewPage;
ebc4bd
 }
ebc4bd
 
ebc4bd
 
ebc4bd
diff --git a/basctl/source/inc/dlgedpage.hxx b/basctl/source/inc/dlgedpage.hxx
ebc4bd
index b92760f..0275292 100644
ebc4bd
--- a/basctl/source/inc/dlgedpage.hxx
ebc4bd
+++ b/basctl/source/inc/dlgedpage.hxx
ebc4bd
@@ -34,6 +34,8 @@ class DlgEdForm;
ebc4bd
 
ebc4bd
 class DlgEdPage : public SdrPage
ebc4bd
 {
ebc4bd
+    DlgEdPage& operator=(const DlgEdPage&) SAL_DELETED_FUNCTION;
ebc4bd
+
ebc4bd
 private:
ebc4bd
     DlgEdForm*      pDlgEdForm;
ebc4bd
 
ebc4bd
@@ -50,6 +52,9 @@ public:
ebc4bd
     DlgEdForm*      GetDlgEdForm() const { return pDlgEdForm; }
ebc4bd
 
ebc4bd
     virtual SdrObject* SetObjectOrdNum(sal_uLong nOldObjNum, sal_uLong nNewObjNum) SAL_OVERRIDE;
ebc4bd
+
ebc4bd
+protected:
ebc4bd
+    DlgEdPage(const DlgEdPage& rSrcPage);
ebc4bd
 };
ebc4bd
 
ebc4bd
 } // namespace basctl
ebc4bd
diff --git a/include/svx/fmpage.hxx b/include/svx/fmpage.hxx
ebc4bd
index e381a64..a48df9c 100644
ebc4bd
--- a/include/svx/fmpage.hxx
ebc4bd
+++ b/include/svx/fmpage.hxx
ebc4bd
@@ -40,6 +40,8 @@ class HelpEvent;
ebc4bd
 
ebc4bd
 class SVX_DLLPUBLIC FmFormPage : public SdrPage
ebc4bd
 {
ebc4bd
+    FmFormPage& operator=(const FmFormPage&) SAL_DELETED_FUNCTION;
ebc4bd
+
ebc4bd
     friend class FmFormObj;
ebc4bd
     FmFormPageImpl*     m_pImpl;
ebc4bd
     OUString            m_sPageName;
ebc4bd
@@ -48,12 +50,12 @@ public:
ebc4bd
     TYPEINFO_OVERRIDE();
ebc4bd
 
ebc4bd
     FmFormPage(FmFormModel& rModel, bool bMasterPage=false);
ebc4bd
-    FmFormPage(const FmFormPage& rPage);
ebc4bd
     virtual ~FmFormPage();
ebc4bd
 
ebc4bd
     virtual void    SetModel(SdrModel* pNewModel) SAL_OVERRIDE;
ebc4bd
 
ebc4bd
     virtual SdrPage* Clone() const SAL_OVERRIDE;
ebc4bd
+    // TODO: Uh huh, how is this supposed to work? Creating a SdrPage from FmFormPage?
ebc4bd
     using SdrPage::Clone;
ebc4bd
 
ebc4bd
     virtual void    InsertObject(SdrObject* pObj, sal_uLong nPos = CONTAINER_APPEND,
ebc4bd
@@ -73,6 +75,11 @@ public:
ebc4bd
                             Window* pWin,
ebc4bd
                             SdrView* pView,
ebc4bd
                             const HelpEvent& rEvt );
ebc4bd
+
ebc4bd
+protected:
ebc4bd
+    FmFormPage(const FmFormPage& rPage);
ebc4bd
+
ebc4bd
+    void lateInit(const FmFormPage& rPage);
ebc4bd
 };
ebc4bd
 
ebc4bd
 #endif // INCLUDED_SVX_FMPAGE_HXX
ebc4bd
diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx
ebc4bd
index bdba2c3..f370f20 100644
ebc4bd
--- a/include/svx/obj3d.hxx
ebc4bd
+++ b/include/svx/obj3d.hxx
ebc4bd
@@ -78,16 +78,22 @@ public:
ebc4bd
 
ebc4bd
 class E3dObjList : public SdrObjList
ebc4bd
 {
ebc4bd
+    E3dObjList &operator=(const E3dObjList& rSrcList) SAL_DELETED_FUNCTION;
ebc4bd
+
ebc4bd
 public:
ebc4bd
     TYPEINFO_OVERRIDE();
ebc4bd
     E3dObjList(SdrModel* pNewModel = 0, SdrPage* pNewPage = 0, E3dObjList* pNewUpList = 0);
ebc4bd
-    SVX_DLLPUBLIC E3dObjList(const E3dObjList& rSrcList);
ebc4bd
     SVX_DLLPUBLIC virtual ~E3dObjList();
ebc4bd
 
ebc4bd
+    virtual E3dObjList* Clone() const;
ebc4bd
+
ebc4bd
     virtual void NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND, const SdrInsertReason* pReason=NULL) SAL_OVERRIDE;
ebc4bd
     virtual void InsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND, const SdrInsertReason* pReason=NULL) SAL_OVERRIDE;
ebc4bd
     virtual SdrObject* NbcRemoveObject(sal_uIntPtr nObjNum) SAL_OVERRIDE;
ebc4bd
     virtual SdrObject* RemoveObject(sal_uIntPtr nObjNum) SAL_OVERRIDE;
ebc4bd
+
ebc4bd
+protected:
ebc4bd
+    SVX_DLLPUBLIC E3dObjList(const E3dObjList& rSrcList);
ebc4bd
 };
ebc4bd
 
ebc4bd
 /*************************************************************************
ebc4bd
diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
ebc4bd
index c737186..87bf2f3 100644
ebc4bd
--- a/include/svx/svdpage.hxx
ebc4bd
+++ b/include/svx/svdpage.hxx
ebc4bd
@@ -78,6 +78,9 @@ public:
ebc4bd
 
ebc4bd
 class SVX_DLLPUBLIC SdrObjList
ebc4bd
 {
ebc4bd
+    SdrObjList(const SdrObjList& rSrcList) SAL_DELETED_FUNCTION;
ebc4bd
+    SdrObjList &operator=(const SdrObjList& rSrcList) SAL_DELETED_FUNCTION;
ebc4bd
+
ebc4bd
 private:
ebc4bd
     typedef ::std::vector<SdrObject*> SdrObjectContainerType;
ebc4bd
     SdrObjectContainerType maList;
ebc4bd
@@ -97,20 +100,23 @@ friend class SdrEditView;
ebc4bd
 protected:
ebc4bd
     virtual void RecalcRects();
ebc4bd
 
ebc4bd
+    SdrObjList();
ebc4bd
+    void lateInit(const SdrObjList& rSrcList);
ebc4bd
+
ebc4bd
 private:
ebc4bd
     /// simple ActionChildInserted forwarder to have it on a central place
ebc4bd
     void impChildInserted(SdrObject& rChild) const;
ebc4bd
 public:
ebc4bd
     TYPEINFO();
ebc4bd
     SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewUpList=NULL);
ebc4bd
-    SdrObjList(const SdrObjList& rSrcList);
ebc4bd
     virtual ~SdrObjList();
ebc4bd
+
ebc4bd
+    virtual SdrObjList* Clone() const;
ebc4bd
+
ebc4bd
     // !!! Diese Methode nur fuer Leute, die ganz genau wissen was sie tun !!!
ebc4bd
 
ebc4bd
     // #110094# This should not be needed (!)
ebc4bd
     void SetObjOrdNumsDirty()                           { bObjOrdNumsDirty=true; }
ebc4bd
-    // pModel, pPage, pUpList und pOwnerObj werden Zuweisungeoperator nicht veraendert!
ebc4bd
-    void operator=(const SdrObjList& rSrcList);
ebc4bd
     void CopyObjects(const SdrObjList& rSrcList);
ebc4bd
     // alles Aufraeumen (ohne Undo)
ebc4bd
     void    Clear();
ebc4bd
@@ -403,6 +409,7 @@ public:
ebc4bd
 
ebc4bd
 class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage >
ebc4bd
 {
ebc4bd
+    SdrPage& operator=(const SdrPage& rSrcPage) SAL_DELETED_FUNCTION;
ebc4bd
 
ebc4bd
     // start PageUser section
ebc4bd
 private:
ebc4bd
@@ -473,15 +480,19 @@ protected:
ebc4bd
                         ::com::sun::star::drawing::XDrawPage> const&);
ebc4bd
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage();
ebc4bd
 
ebc4bd
+    // Copying of pages is split into two parts: construction and copying of page objects,
ebc4bd
+    // because the copying might need access to fully initialized page. Clone() is responsible
ebc4bd
+    // to call lateInit() after copy-construction of a new object. Any initialization in derived
ebc4bd
+    // classes that needs access to the page objects must be deferred to lateInit. And it must
ebc4bd
+    // call lateInit() of its parent class.
ebc4bd
+    SdrPage(const SdrPage& rSrcPage);
ebc4bd
+    void lateInit(const SdrPage& rSrcPage);
ebc4bd
+
ebc4bd
 public:
ebc4bd
     TYPEINFO_OVERRIDE();
ebc4bd
     SdrPage(SdrModel& rNewModel, bool bMasterPage=false);
ebc4bd
-    // Copy-Ctor und Zuweisungeoperator sind nicht getestet!
ebc4bd
-    SdrPage(const SdrPage& rSrcPage);
ebc4bd
     virtual ~SdrPage();
ebc4bd
-    // pModel, pPage, pUpList, pOwnerObj und mbInserted werden Zuweisungeoperator nicht veraendert!
ebc4bd
-    SdrPage& operator=(const SdrPage& rSrcPage);
ebc4bd
-    virtual SdrPage* Clone() const;
ebc4bd
+    virtual SdrPage* Clone() const SAL_OVERRIDE;
ebc4bd
     virtual SdrPage* Clone(SdrModel* pNewModel) const;
ebc4bd
     bool IsMasterPage() const       { return mbMaster; }
ebc4bd
     void SetInserted(bool bNew = true);
ebc4bd
diff --git a/reportdesign/inc/RptPage.hxx b/reportdesign/inc/RptPage.hxx
ebc4bd
index b320a3e..9ea966a 100644
ebc4bd
--- a/reportdesign/inc/RptPage.hxx
ebc4bd
+++ b/reportdesign/inc/RptPage.hxx
ebc4bd
@@ -34,6 +34,8 @@ class OReportModel;
ebc4bd
 
ebc4bd
 class REPORTDESIGN_DLLPUBLIC OReportPage : public SdrPage
ebc4bd
 {
ebc4bd
+    OReportPage& operator=(const OReportPage&) SAL_DELETED_FUNCTION;
ebc4bd
+
ebc4bd
     OReportModel&           rModel;
ebc4bd
     ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > m_xSection;
ebc4bd
     bool                    m_bSpecialInsertMode;
ebc4bd
diff --git a/reportdesign/source/core/sdr/RptPage.cxx b/reportdesign/source/core/sdr/RptPage.cxx
ebc4bd
index 5009a66..c55a360 100644
ebc4bd
--- a/reportdesign/source/core/sdr/RptPage.cxx
ebc4bd
+++ b/reportdesign/source/core/sdr/RptPage.cxx
ebc4bd
@@ -61,7 +61,9 @@ OReportPage::~OReportPage()
ebc4bd
 
ebc4bd
 SdrPage* OReportPage::Clone() const
ebc4bd
 {
ebc4bd
-    return new OReportPage( *this );
ebc4bd
+    OReportPage *const pNewPage = new OReportPage( *this );
ebc4bd
+    pNewPage->lateInit( *this );
ebc4bd
+    return pNewPage;
ebc4bd
 }
ebc4bd
 
ebc4bd
 
ebc4bd
diff --git a/sc/inc/drawpage.hxx b/sc/inc/drawpage.hxx
ebc4bd
index c11d4cc..6f7b68e 100644
ebc4bd
--- a/sc/inc/drawpage.hxx
ebc4bd
+++ b/sc/inc/drawpage.hxx
ebc4bd
@@ -26,6 +26,9 @@ class ScDrawLayer;
ebc4bd
 
ebc4bd
 class ScDrawPage: public FmFormPage
ebc4bd
 {
ebc4bd
+    ScDrawPage(const ScDrawPage&) SAL_DELETED_FUNCTION;
ebc4bd
+    ScDrawPage& operator=(const ScDrawPage&) SAL_DELETED_FUNCTION;
ebc4bd
+
ebc4bd
 public:
ebc4bd
     ScDrawPage(ScDrawLayer& rNewModel, bool bMasterPage = false);
ebc4bd
     virtual ~ScDrawPage();
ebc4bd
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
ebc4bd
index 767cf39..13ec1c2 100644
ebc4bd
--- a/sd/inc/sdpage.hxx
ebc4bd
+++ b/sd/inc/sdpage.hxx
ebc4bd
@@ -98,6 +98,8 @@ namespace sd {
ebc4bd
 
ebc4bd
 class SD_DLLPUBLIC SdPage : public FmFormPage, public SdrObjUserCall
ebc4bd
 {
ebc4bd
+    SdPage& operator=(const SdPage&) SAL_DELETED_FUNCTION;
ebc4bd
+
ebc4bd
 friend class SdGenericDrawPage;
ebc4bd
 friend class SdDrawPage;
ebc4bd
 friend class sd::UndoAnimation;
ebc4bd
@@ -153,11 +155,13 @@ protected:
ebc4bd
     sal_Int32 mnTransitionFadeColor;
ebc4bd
     double mfTransitionDuration;
ebc4bd
 
ebc4bd
+    SdPage(const SdPage& rSrcPage);
ebc4bd
+    void lateInit(const SdPage& rSrcPage);
ebc4bd
+
ebc4bd
 public:
ebc4bd
     TYPEINFO_OVERRIDE();
ebc4bd
 
ebc4bd
     SdPage(SdDrawDocument& rNewDoc, bool bMasterPage=false);
ebc4bd
-    SdPage(const SdPage& rSrcPage);
ebc4bd
     virtual ~SdPage();
ebc4bd
     virtual SdrPage* Clone() const SAL_OVERRIDE;
ebc4bd
     virtual SdrPage* Clone(SdrModel* pNewModel) const SAL_OVERRIDE;
ebc4bd
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
ebc4bd
index 450c646..57f4699 100644
ebc4bd
--- a/sd/source/core/sdpage2.cxx
ebc4bd
+++ b/sd/source/core/sdpage2.cxx
ebc4bd
@@ -377,15 +377,6 @@ SdPage::SdPage(const SdPage& rSrcPage)
ebc4bd
     mePageKind           = rSrcPage.mePageKind;
ebc4bd
     meAutoLayout         = rSrcPage.meAutoLayout;
ebc4bd
 
ebc4bd
-    // use shape list directly to preserve constness of rSrcPage
ebc4bd
-    const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList();
ebc4bd
-    for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin();
ebc4bd
-         aIter != rShapeList.end(); ++aIter )
ebc4bd
-    {
ebc4bd
-        SdrObject* pObj = *aIter;
ebc4bd
-        InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
ebc4bd
-    }
ebc4bd
-
ebc4bd
     mbSelected           = false;
ebc4bd
     mnTransitionType    = rSrcPage.mnTransitionType;
ebc4bd
     mnTransitionSubtype = rSrcPage.mnTransitionSubtype;
ebc4bd
@@ -410,10 +401,24 @@ SdPage::SdPage(const SdPage& rSrcPage)
ebc4bd
     mnPaperBin           = rSrcPage.mnPaperBin;
ebc4bd
     meOrientation        = rSrcPage.meOrientation;
ebc4bd
 
ebc4bd
+    mpPageLink           = NULL;    // is set when inserting via ConnectLink()
ebc4bd
+}
ebc4bd
+
ebc4bd
+void SdPage::lateInit(const SdPage& rSrcPage)
ebc4bd
+{
ebc4bd
+    FmFormPage::lateInit(rSrcPage);
ebc4bd
+
ebc4bd
+    // use shape list directly to preserve constness of rSrcPage
ebc4bd
+    const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList();
ebc4bd
+    for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin();
ebc4bd
+         aIter != rShapeList.end(); ++aIter )
ebc4bd
+    {
ebc4bd
+        SdrObject* pObj = *aIter;
ebc4bd
+        InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj));
ebc4bd
+    }
ebc4bd
+
ebc4bd
     // header footer
ebc4bd
     setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() );
ebc4bd
-
ebc4bd
-    mpPageLink           = NULL;    // is set when inserting via ConnectLink()
ebc4bd
 }
ebc4bd
 
ebc4bd
 
ebc4bd
@@ -433,6 +438,7 @@ SdrPage* SdPage::Clone(SdrModel* pNewModel) const
ebc4bd
     (void)pNewModel;
ebc4bd
 
ebc4bd
     SdPage* pNewPage = new SdPage(*this);
ebc4bd
+    pNewPage->lateInit( *this );
ebc4bd
 
ebc4bd
     cloneAnimations( *pNewPage );
ebc4bd
 
ebc4bd
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
ebc4bd
index eee59ad..ef50b3d 100644
ebc4bd
--- a/svx/source/engine3d/obj3d.cxx
ebc4bd
+++ b/svx/source/engine3d/obj3d.cxx
ebc4bd
@@ -91,11 +91,18 @@ E3dObjList::E3dObjList(SdrModel* pNewModel, SdrPage* pNewPage, E3dObjList* pNewU
ebc4bd
 {
ebc4bd
 }
ebc4bd
 
ebc4bd
-E3dObjList::E3dObjList(const E3dObjList& rSrcList)
ebc4bd
-:   SdrObjList(rSrcList)
ebc4bd
+E3dObjList::E3dObjList(const E3dObjList&)
ebc4bd
+:   SdrObjList()
ebc4bd
 {
ebc4bd
 }
ebc4bd
 
ebc4bd
+E3dObjList* E3dObjList::Clone() const
ebc4bd
+{
ebc4bd
+    E3dObjList* const pObjList = new E3dObjList(*this);
ebc4bd
+    pObjList->lateInit(*this);
ebc4bd
+    return pObjList;
ebc4bd
+}
ebc4bd
+
ebc4bd
 E3dObjList::~E3dObjList()
ebc4bd
 {
ebc4bd
 }
ebc4bd
diff --git a/svx/source/form/fmpage.cxx b/svx/source/form/fmpage.cxx
ebc4bd
index 365dfd3..96c3baa 100644
ebc4bd
--- a/svx/source/form/fmpage.cxx
ebc4bd
+++ b/svx/source/form/fmpage.cxx
ebc4bd
@@ -66,6 +66,12 @@ FmFormPage::FmFormPage(const FmFormPage& rPage)
ebc4bd
            :SdrPage(rPage)
ebc4bd
            ,m_pImpl(new FmFormPageImpl( *this ) )
ebc4bd
 {
ebc4bd
+}
ebc4bd
+
ebc4bd
+void FmFormPage::lateInit(const FmFormPage& rPage)
ebc4bd
+{
ebc4bd
+    SdrPage::lateInit( rPage );
ebc4bd
+
ebc4bd
     m_pImpl->initFrom( rPage.GetImpl() );
ebc4bd
     m_sPageName = rPage.m_sPageName;
ebc4bd
 }
ebc4bd
@@ -113,8 +119,9 @@ void FmFormPage::SetModel(SdrModel* pNewModel)
ebc4bd
 
ebc4bd
 SdrPage* FmFormPage::Clone() const
ebc4bd
 {
ebc4bd
-    return new FmFormPage(*this);
ebc4bd
-    // hier fehlt noch ein kopieren der Objekte
ebc4bd
+    FmFormPage* const pNewPage = new FmFormPage(*this);
ebc4bd
+    pNewPage->lateInit(*this);
ebc4bd
+    return pNewPage;
ebc4bd
 }
ebc4bd
 
ebc4bd
 
ebc4bd
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
ebc4bd
index 94139448..da27d4a 100644
ebc4bd
--- a/svx/source/svdraw/svdpage.cxx
ebc4bd
+++ b/svx/source/svdraw/svdpage.cxx
ebc4bd
@@ -88,7 +88,7 @@ SdrObjList::SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewU
ebc4bd
     eListKind=SDROBJLIST_UNKNOWN;
ebc4bd
 }
ebc4bd
 
ebc4bd
-SdrObjList::SdrObjList(const SdrObjList& rSrcList):
ebc4bd
+SdrObjList::SdrObjList():
ebc4bd
     maList(),
ebc4bd
     mpNavigationOrder(),
ebc4bd
     mbIsNavigationOrderDirty(false)
ebc4bd
@@ -101,7 +101,6 @@ SdrObjList::SdrObjList(const SdrObjList& rSrcList):
ebc4bd
     bRectsDirty=false;
ebc4bd
     pOwnerObj=NULL;
ebc4bd
     eListKind=SDROBJLIST_UNKNOWN;
ebc4bd
-    *this=rSrcList;
ebc4bd
 }
ebc4bd
 
ebc4bd
 SdrObjList::~SdrObjList()
ebc4bd
@@ -115,9 +114,18 @@ SdrObjList::~SdrObjList()
ebc4bd
     Clear(); // delete contents of container
ebc4bd
 }
ebc4bd
 
ebc4bd
-void SdrObjList::operator=(const SdrObjList& rSrcList)
ebc4bd
+SdrObjList* SdrObjList::Clone() const
ebc4bd
 {
ebc4bd
-    Clear();
ebc4bd
+    SdrObjList* const pObjList = new SdrObjList();
ebc4bd
+    pObjList->lateInit(*this);
ebc4bd
+    return pObjList;
ebc4bd
+}
ebc4bd
+
ebc4bd
+void SdrObjList::lateInit(const SdrObjList& rSrcList)
ebc4bd
+{
ebc4bd
+    // this function is only supposed to be called once, right after construction
ebc4bd
+    assert(maList.empty());
ebc4bd
+
ebc4bd
     eListKind=rSrcList.eListKind;
ebc4bd
     CopyObjects(rSrcList);
ebc4bd
 }
ebc4bd
@@ -1246,31 +1254,6 @@ SdrPage::SdrPage(const SdrPage& rSrcPage)
ebc4bd
     mbPageBorderOnlyLeftRight(rSrcPage.mbPageBorderOnlyLeftRight)
ebc4bd
 {
ebc4bd
     aPrefVisiLayers.SetAll();
ebc4bd
-    eListKind = (mbMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
ebc4bd
-
ebc4bd
-    // copy things from source
ebc4bd
-    // Warning: this leads to slicing (see issue 93186) and has to be
ebc4bd
-    // removed as soon as possible.
ebc4bd
-    *this = rSrcPage;
ebc4bd
-    OSL_ENSURE(mpSdrPageProperties,
ebc4bd
-        "SdrPage::SdrPage: operator= did not create needed SdrPageProperties (!)");
ebc4bd
-
ebc4bd
-    // be careful and correct eListKind, a member of SdrObjList which
ebc4bd
-    // will be changed by the SdrOIbjList::operator= before...
ebc4bd
-    eListKind = (mbMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
ebc4bd
-
ebc4bd
-    // The previous assignment to *this may have resulted in a call to
ebc4bd
-    // createUnoPage at a partially initialized (sliced) SdrPage object.
ebc4bd
-    // Due to the vtable being not yet fully set-up at this stage,
ebc4bd
-    // createUnoPage() may have been called at the wrong class.
ebc4bd
-    // To force a call to the right createUnoPage() at a later time when the
ebc4bd
-    // new object is full constructed mxUnoPage is disposed now.
ebc4bd
-    uno::Reference<lang::XComponent> xComponent (mxUnoPage, uno::UNO_QUERY);
ebc4bd
-    if (xComponent.is())
ebc4bd
-    {
ebc4bd
-        mxUnoPage = NULL;
ebc4bd
-        xComponent->dispose();
ebc4bd
-    }
ebc4bd
 }
ebc4bd
 
ebc4bd
 SdrPage::~SdrPage()
ebc4bd
@@ -1319,20 +1302,10 @@ SdrPage::~SdrPage()
ebc4bd
 
ebc4bd
 }
ebc4bd
 
ebc4bd
-SdrPage& SdrPage::operator=(const SdrPage& rSrcPage)
ebc4bd
+void SdrPage::lateInit(const SdrPage& rSrcPage)
ebc4bd
 {
ebc4bd
-    if( this == &rSrcPage )
ebc4bd
-        return *this;
ebc4bd
-    if(mpViewContact)
ebc4bd
-    {
ebc4bd
-        delete mpViewContact;
ebc4bd
-        mpViewContact = 0L;
ebc4bd
-    }
ebc4bd
-
ebc4bd
-    // Joe also sets some parameters for the class this one
ebc4bd
-    // is derived from. SdrObjList does the same bad handling of
ebc4bd
-    // copy constructor and operator=, so i better let it stand here.
ebc4bd
-    pPage = this;
ebc4bd
+    assert(!mpViewContact);
ebc4bd
+    assert(!mpSdrPageProperties);
ebc4bd
 
ebc4bd
     // copy all the local parameters to make this instance
ebc4bd
     // a valid copy of source page before copying and inserting
ebc4bd
@@ -1361,21 +1334,7 @@ SdrPage& SdrPage::operator=(const SdrPage& rSrcPage)
ebc4bd
     mbObjectsNotPersistent = rSrcPage.mbObjectsNotPersistent;
ebc4bd
 
ebc4bd
     {
ebc4bd
-        // #i111122# delete SdrPageProperties when model is different
ebc4bd
-        if(mpSdrPageProperties && GetModel() != rSrcPage.GetModel())
ebc4bd
-        {
ebc4bd
-            delete mpSdrPageProperties;
ebc4bd
-            mpSdrPageProperties = 0;
ebc4bd
-        }
ebc4bd
-
ebc4bd
-        if(!mpSdrPageProperties)
ebc4bd
-        {
ebc4bd
-            mpSdrPageProperties = new SdrPageProperties(*this);
ebc4bd
-        }
ebc4bd
-        else
ebc4bd
-        {
ebc4bd
-            mpSdrPageProperties->ClearItem(0);
ebc4bd
-        }
ebc4bd
+        mpSdrPageProperties = new SdrPageProperties(*this);
ebc4bd
 
ebc4bd
         if(!IsMasterPage())
ebc4bd
         {
ebc4bd
@@ -1385,9 +1344,12 @@ SdrPage& SdrPage::operator=(const SdrPage& rSrcPage)
ebc4bd
         mpSdrPageProperties->SetStyleSheet(rSrcPage.getSdrPageProperties().GetStyleSheet());
ebc4bd
     }
ebc4bd
 
ebc4bd
-    // Now copy the contained objects (by cloning them)
ebc4bd
-    SdrObjList::operator=(rSrcPage);
ebc4bd
-    return *this;
ebc4bd
+    // Now copy the contained objects
ebc4bd
+    SdrObjList::lateInit(rSrcPage);
ebc4bd
+
ebc4bd
+    // be careful and correct eListKind, a member of SdrObjList which
ebc4bd
+    // will be changed by the SdrObjList::lateInit before...
ebc4bd
+    eListKind = (mbMaster) ? SDROBJLIST_MASTERPAGE : SDROBJLIST_DRAWPAGE;
ebc4bd
 }
ebc4bd
 
ebc4bd
 SdrPage* SdrPage::Clone() const
ebc4bd
@@ -1399,7 +1361,7 @@ SdrPage* SdrPage::Clone(SdrModel* pNewModel) const
ebc4bd
 {
ebc4bd
     if (pNewModel==NULL) pNewModel=pModel;
ebc4bd
     SdrPage* pPage2=new SdrPage(*pNewModel);
ebc4bd
-    *pPage2=*this;
ebc4bd
+    pPage2->lateInit(*this);
ebc4bd
     return pPage2;
ebc4bd
 }
ebc4bd
 
ebc4bd
diff --git a/sw/inc/dpage.hxx b/sw/inc/dpage.hxx
ebc4bd
index 54aa789..8284f6e 100644
ebc4bd
--- a/sw/inc/dpage.hxx
ebc4bd
+++ b/sw/inc/dpage.hxx
ebc4bd
@@ -28,6 +28,9 @@ class SwDoc;
ebc4bd
 
ebc4bd
 class SwDPage : public FmFormPage, public SdrObjUserCall
ebc4bd
 {
ebc4bd
+    SwDPage(const SwDPage&) SAL_DELETED_FUNCTION;
ebc4bd
+    SwDPage &operator=(const SwDPage&) SAL_DELETED_FUNCTION;
ebc4bd
+
ebc4bd
     SdrPageGridFrameList*   pGridLst;
ebc4bd
     SwDoc&                  rDoc;
ebc4bd
 
ebc4bd
-- 
ebc4bd
2.1.0
ebc4bd