diff options
author | David Tardon <dtardon@redhat.com> | 2014-12-03 22:01:57 +0100 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-12-04 23:10:24 +0100 |
commit | 9638e6207c7fc48712b1b238177462c00f5011e8 (patch) | |
tree | 5b4f30ee6fc163e52ab0cb5bf179d6f55ff261bd /sd | |
parent | 34e456a2b030eb2e80ae5ca87e81896cc8240bff (diff) |
ooo#93212 avoid slicing during construction of SdrPage
Also hide copy ctor and assignment operator of all derived classes, to
ensure that Clone() is the only method to make copies of them.
Change-Id: Icb3b50c63b086abe8c9add32e3041fe19692d20b
Diffstat (limited to 'sd')
-rw-r--r-- | sd/inc/sdpage.hxx | 6 | ||||
-rw-r--r-- | sd/source/core/sdpage2.cxx | 28 |
2 files changed, 22 insertions, 12 deletions
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx index 767cf3907a67..13ec1c2c380b 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -98,6 +98,8 @@ namespace sd { class SD_DLLPUBLIC SdPage : public FmFormPage, public SdrObjUserCall { + SdPage& operator=(const SdPage&) SAL_DELETED_FUNCTION; + friend class SdGenericDrawPage; friend class SdDrawPage; friend class sd::UndoAnimation; @@ -153,11 +155,13 @@ protected: sal_Int32 mnTransitionFadeColor; double mfTransitionDuration; + SdPage(const SdPage& rSrcPage); + void lateInit(const SdPage& rSrcPage); + public: TYPEINFO_OVERRIDE(); SdPage(SdDrawDocument& rNewDoc, bool bMasterPage=false); - SdPage(const SdPage& rSrcPage); virtual ~SdPage(); virtual SdrPage* Clone() const SAL_OVERRIDE; virtual SdrPage* Clone(SdrModel* pNewModel) const SAL_OVERRIDE; diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index 450c646f5cbe..57f46990f44e 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -377,15 +377,6 @@ SdPage::SdPage(const SdPage& rSrcPage) mePageKind = rSrcPage.mePageKind; meAutoLayout = rSrcPage.meAutoLayout; - // use shape list directly to preserve constness of rSrcPage - const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList(); - for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin(); - aIter != rShapeList.end(); ++aIter ) - { - SdrObject* pObj = *aIter; - InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj)); - } - mbSelected = false; mnTransitionType = rSrcPage.mnTransitionType; mnTransitionSubtype = rSrcPage.mnTransitionSubtype; @@ -410,10 +401,24 @@ SdPage::SdPage(const SdPage& rSrcPage) mnPaperBin = rSrcPage.mnPaperBin; meOrientation = rSrcPage.meOrientation; + mpPageLink = NULL; // is set when inserting via ConnectLink() +} + +void SdPage::lateInit(const SdPage& rSrcPage) +{ + FmFormPage::lateInit(rSrcPage); + + // use shape list directly to preserve constness of rSrcPage + const std::list< SdrObject* >& rShapeList = rSrcPage.maPresentationShapeList.getList(); + for( std::list< SdrObject* >::const_iterator aIter = rShapeList.begin(); + aIter != rShapeList.end(); ++aIter ) + { + SdrObject* pObj = *aIter; + InsertPresObj(GetObj(pObj->GetOrdNum()), rSrcPage.GetPresObjKind(pObj)); + } + // header footer setHeaderFooterSettings( rSrcPage.getHeaderFooterSettings() ); - - mpPageLink = NULL; // is set when inserting via ConnectLink() } /************************************************************************* @@ -433,6 +438,7 @@ SdrPage* SdPage::Clone(SdrModel* pNewModel) const (void)pNewModel; SdPage* pNewPage = new SdPage(*this); + pNewPage->lateInit( *this ); cloneAnimations( *pNewPage ); |