SOSAW080: Derive SdrObjGroup from SdrObjList

Also simplify parent/child relationships, get rid
of double data (SdrPage/Parent infos in SdrObjects,
also in SdrObjList). This is all not needed - when a
SdrObject is inserted to a SdrPage, get SdrPage by
traveling over parents (no double info, member as soon
as inserted, ...).
More cleanups/reworks included, will need some more
cleanups, too.

Stabilizing: SetRectsDirty/DefaultStyleSheet

Had to correct the SetRectsDirty stuff for 3D due to
going down the hierarchy while the 2D implementation
goes the other direction -> endless loops. Added special
handling for 3D stuff for now (will be chnaged again when
SnapRect is no longer needed at SdrObject level).
Also had to adapt how the DefaultStyleSheet is set at
incarnated SdrObjects - better: their properties. Since
we now always have a SdrModel, it is possible to correctly
initialize with the correct default StyleSheet from that
SdrModel.
This needs to be done after ForceDefaultAttributes and in a
way that again deletes Items that are set in the StyleSheet.
This leads to an error in CppunitTest_sd_import_tests where
I checked tdf100491 - it is okay and thus I change the control
instance of the imported, XML-dumped file.
The less hard attributes, the better for Styles in general.

Cleanup of comments for last two commits

Corrected SvxShape::getParent()

Needed to get the direct parent, so test for SdrObject
first (to get SdrObjGroup/E3DScene), for SdrPage second

Fixed CppunitTest_sc_subsequent_export_test

Several problems arose. The used SdrCaptionObj was
Cloned, but the clone not inserted to a SdrPage. This
leads to not being able to access a UNO API imlementation
of the SdrPage (SvxPage) on lower levels.
It worked before due to SdrObject having a SdrPage*
additionally to being added to a SdrPage - this is exactly
the main cleanup this change does.
Looked for why it is cloned, could see no reasons. The
SdrCaptionObj exists during all im/export, not difference
to other SdrObjects (that do not get cloned). It is not
changed in any way. It *might* be to suppress a crash that
happened due to UNO API Service emfio/emfio not being
available in the UnitTest scenario. Interestingly it
did not crash with the cloned SdrCaptionObj, but the
Graphic exported was probably wrong.
Fixed by no longer Cloning the SdrCaptionObj and adding
emfio/emfio UNO API Service.

d139f821a5b39535a3e7b9c6261df7e18f8ae8ac
910e7f4bc628a715fda7545dffaf3369d5e76ea0
ca1de01b723051e09ac37d7ec7bba978beea41c5
3a76da1471dfe75e69847f64a6a3519ad21c8c9c

Change-Id: I986586e326b563acebf00d931a7084c6eb09e5f8
Reviewed-on: https://gerrit.libreoffice.org/54689
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Reviewed-on: https://gerrit.libreoffice.org/60535
Tested-by: Jenkins
diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx
index 5588752..1e6b11d 100644
--- a/basctl/source/dlged/dlged.cxx
+++ b/basctl/source/dlged/dlged.cxx
@@ -615,8 +615,7 @@ void DlgEditor::CreateDefaultObject()
    SdrObject* pObj = SdrObjFactory::MakeNewObject(
        *pDlgEdModel,
        pDlgEdView->GetCurrentObjInventor(),
        pDlgEdView->GetCurrentObjIdentifier(),
        pDlgEdPage);
        pDlgEdView->GetCurrentObjIdentifier());

    if (DlgEdObj* pDlgEdObj = dynamic_cast<DlgEdObj*>(pObj))
    {
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 008260b..8052f3c 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -955,7 +955,7 @@ bool DlgEdObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
void DlgEdObj::SetDefaults()
{
    // set parent form
    pDlgEdForm = static_cast<DlgEdPage*>(GetPage())->GetDlgEdForm();
    pDlgEdForm = static_cast<DlgEdPage*>(getSdrPageFromSdrObject())->GetDlgEdForm();

    if ( pDlgEdForm )
    {
@@ -1379,7 +1379,7 @@ void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt )

void DlgEdForm::UpdateStep()
{
    SdrPage* pSdrPage = GetPage();
    SdrPage* pSdrPage = getSdrPageFromSdrObject();

    if ( pSdrPage )
    {
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx
index 65bc605..7456630 100644
--- a/basctl/source/dlged/propbrw.cxx
+++ b/basctl/source/dlged/propbrw.cxx
@@ -251,7 +251,7 @@ Sequence< Reference< XInterface > >
        std::unique_ptr<SdrObjListIter> pGroupIterator;
        if (pCurrent->IsGroupObject())
        {
            pGroupIterator.reset(new SdrObjListIter(*pCurrent->GetSubList()));
            pGroupIterator.reset(new SdrObjListIter(pCurrent->GetSubList()));
            pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr;
        }

diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 0616dba..59444c9 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -393,7 +393,7 @@ void ChartController::impl_PasteShapes( SdrModel* pModel )
            for ( sal_uInt16 i = 0; i < nCount; ++i )
            {
                const SdrPage* pPage = pModel->GetPage( i );
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
                while ( aIter.IsMore() )
                {
                    SdrObject* pObj(aIter.Next());
@@ -402,8 +402,6 @@ void ChartController::impl_PasteShapes( SdrModel* pModel )

                    if ( pNewObj )
                    {
                        pNewObj->SetPage( pDestPage );

                        // set position
                        Reference< drawing::XShape > xShape( pNewObj->getUnoShape(), uno::UNO_QUERY );
                        if ( xShape.is() )
diff --git a/chart2/source/controller/main/ChartTransferable.cxx b/chart2/source/controller/main/ChartTransferable.cxx
index 4888c480..90660c0 100644
--- a/chart2/source/controller/main/ChartTransferable.cxx
+++ b/chart2/source/controller/main/ChartTransferable.cxx
@@ -130,7 +130,7 @@ bool ChartTransferable::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, voi
                    for ( sal_uInt16 i = 0; i < nCount; ++i )
                    {
                        const SdrPage* pPage = pMarkedObjModel->GetPage( i );
                        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
                        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
                        while ( aIter.IsMore() )
                        {
                            SdrObject* pObj = aIter.Next();
diff --git a/chart2/source/controller/main/DrawCommandDispatch.cxx b/chart2/source/controller/main/DrawCommandDispatch.cxx
index 6c59620..b1fb795 100644
--- a/chart2/source/controller/main/DrawCommandDispatch.cxx
+++ b/chart2/source/controller/main/DrawCommandDispatch.cxx
@@ -429,8 +429,7 @@ SdrObject* DrawCommandDispatch::createDefaultObject( const sal_uInt16 nID )
            pObj = SdrObjFactory::MakeNewObject(
                pDrawModelWrapper->getSdrModel(),
                pDrawViewWrapper->GetCurrentObjInventor(),
                pDrawViewWrapper->GetCurrentObjIdentifier(),
                pPage);
                pDrawViewWrapper->GetCurrentObjIdentifier());

            if ( pObj )
            {
diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx
index f7918d2..9be4ae4 100644
--- a/chart2/source/controller/main/SelectionHelper.cxx
+++ b/chart2/source/controller/main/SelectionHelper.cxx
@@ -333,7 +333,7 @@ bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject
        SdrObjList* pObjList = pObj->getParentOfSdrObject();
        if( !pObjList )
            return false;
        SdrObject* pOwner = pObjList->GetOwnerObj();
        SdrObject* pOwner = pObjList->getSdrObjectFromSdrObjList();
        if( !pOwner )
            return false;
        pObj = pOwner;
@@ -483,7 +483,7 @@ SdrObject* SelectionHelper::getMarkHandlesObject( SdrObject* pObj )
    SdrObjList* pSubList = pObj->GetSubList();
    if(pSubList)
    {
        SdrObjListIter aIterator(*pSubList, SdrIterMode::Flat);
        SdrObjListIter aIterator(pSubList, SdrIterMode::Flat);
        while (aIterator.IsMore())
        {
            SdrObject* pMarkHandles = SelectionHelper::getMarkHandlesObject( aIterator.Next() );
@@ -508,7 +508,7 @@ SdrObject* SelectionHelper::getObjectToMark()
        SdrObjList* pSubList = pObj->GetSubList();
        if(pSubList)
        {
            SdrObjListIter aIterator(*pSubList, SdrIterMode::Flat);
            SdrObjListIter aIterator(pSubList, SdrIterMode::Flat);
            while (aIterator.IsMore())
            {
                SdrObject* pMarkHandles = SelectionHelper::getMarkHandlesObject( aIterator.Next() );
@@ -539,7 +539,7 @@ E3dScene* SelectionHelper::getSceneToRotate( SdrObject* pObj )
            SdrObjList* pSubList = pObj->GetSubList();
            if(pSubList)
            {
                SdrObjListIter aIterator(*pSubList, SdrIterMode::DeepWithGroups);
                SdrObjListIter aIterator(pSubList, SdrIterMode::DeepWithGroups);
                while( aIterator.IsMore() && !pRotateable )
                {
                    SdrObject* pSubObj = aIterator.Next();
@@ -628,7 +628,7 @@ bool SelectionHelper::getMarkHandles( SdrHdlList& rHdlList )
        return false;
    }

    SdrObjListIter aIterator(*pSubList, SdrIterMode::Flat);
    SdrObjListIter aIterator(pSubList, SdrIterMode::Flat);

    while (aIterator.IsMore())
    {
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx
index db2c64d..2e390b7 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -1015,7 +1015,7 @@ ImplEESdrObject::ImplEESdrObject( ImplEESdrWriter& rEx,
    mbEmptyPresObj( false ),
    mbOOXML(bOOXML)
{
    SdrPage* pPage = rObj.GetPage();
    SdrPage* pPage = rObj.getSdrPageFromSdrObject();
    DBG_ASSERT( pPage, "ImplEESdrObject::ImplEESdrObject: no SdrPage" );
    if( pPage && rEx.ImplInitPage( *pPage ) )
    {
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index c9818b2..cc2fc42 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -7573,7 +7573,7 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, const sal_uInt32
    std::set< sal_Int32 > aRows;
    std::set< sal_Int32 > aColumns;

    SdrObjListIter aGroupIter( *pSubList, SdrIterMode::DeepNoGroups, false );
    SdrObjListIter aGroupIter( pSubList, SdrIterMode::DeepNoGroups, false );
    while( aGroupIter.IsMore() )
    {
        const SdrObject* pObj( aGroupIter.Next() );
diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx
index 044b27d..1ebf4ac 100644
--- a/include/svx/scene3d.hxx
+++ b/include/svx/scene3d.hxx
@@ -95,6 +95,14 @@ protected:
public:
    E3dScene(SdrModel& rSdrModel);

    // derived from SdrObjList
    virtual SdrPage* getSdrPageFromSdrObjList() const override;
    virtual SdrObject* getSdrObjectFromSdrObjList() const override;
    virtual SdrModel& getSdrModelFromSdrObjList() const override;

    // derived from SdrObject
    virtual SdrObjList* getChildrenOfSdrObject() const override;

    virtual void SetBoundRectDirty() override;

    // access to cleanup of depth mapper
@@ -180,10 +188,12 @@ public:
    virtual SdrObject* RemoveObject(size_t nObjNum) override;

    // needed for group functionality
    virtual void SetRectsDirty(bool bNotMyself = false) override;
    virtual void SetRectsDirty(bool bNotMyself = false, bool bRecursive = true) override;
    virtual void NbcSetLayer(SdrLayerID nLayer) override;
    virtual void setParentOfSdrObject(SdrObjList* pNewObjList) override;
    virtual void SetPage(SdrPage* pNewPage) override;

    // react on model/page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;

    virtual SdrObjList* GetSubList() const override;
    void Insert3DObj(E3dObject* p3DObj);
    void Remove3DObj(E3dObject const * p3DObj);
diff --git a/include/svx/sdr/properties/properties.hxx b/include/svx/sdr/properties/properties.hxx
index 5f9a634..bdb2976 100644
--- a/include/svx/sdr/properties/properties.hxx
+++ b/include/svx/sdr/properties/properties.hxx
@@ -82,6 +82,8 @@ namespace sdr
            SdrObject&                                      mrObject;

        protected:
            // apply the correct SfyStyleSheet from SdrObject's SdrModel
            virtual void applyDefaultStyleSheetFromSdrModel();

            // create a new object specific itemset with object specific ranges.
            virtual std::unique_ptr<SfxItemSet> CreateObjectSpecificItemSet(SfxItemPool& pPool) = 0;
diff --git a/include/svx/svditer.hxx b/include/svx/svditer.hxx
index 6f87776..e89efcc 100644
--- a/include/svx/svditer.hxx
+++ b/include/svx/svditer.hxx
@@ -27,6 +27,7 @@

class SdrObjList;
class SdrObject;
class SdrPage;
class SdrMarkList;

// SdrObjListIter methods:
@@ -37,41 +38,36 @@ enum class SdrIterMode { Flat, DeepWithGroups, DeepNoGroups };

class SVX_DLLPUBLIC SdrObjListIter
{
    std::vector<SdrObject*>     maObjList;
    sal_uInt32                  mnIndex;
    bool                        mbReverse;
    std::vector< const SdrObject* > maObjList;
    size_t                          mnIndex;
    bool                            mbReverse;
    bool                            mbUseZOrder;

    void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder);
    void ImpProcessObjectList(const SdrObjList& rSdrObjList, SdrIterMode eMode);
    void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode);
    void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder);
    void ImpProcessObj(const SdrObject& rSdrObject, SdrIterMode eMode);

public:
    explicit SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
    /** This variant lets the user choose the order in which to travel over
        the objects.
        @param bUseZOrder
            When <TRUE/> then the z-order defines the order of iteration.
            Otherwise the navigation position as returned by
            SdrObject::GetNavigationPosition() is used.
    */
    SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode);
    explicit SdrObjListIter(const SdrObjList* pObjList, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
    explicit SdrObjListIter(const SdrObjList* pObjList, bool bUseZOrder, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);

    /* SJ: the following function can now be used with every
       SdrObject and is no longer limited to group objects */
    explicit SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = SdrIterMode::DeepNoGroups);
    explicit SdrObjListIter(const SdrObject& rSdrObject, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
    explicit SdrObjListIter(const SdrPage* pSdrPage, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);

    /** Iterates over a list of marked objects received from the SdrMarkView. */
    /** Iterates over a list of marked objects received from the SdrMarkView. TTTT used in sc */
    explicit SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = SdrIterMode::DeepNoGroups);

    void Reset() { mnIndex = (mbReverse ? maObjList.size() : 0L); }
    bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.size())); }
    SdrObject* Next()
    {
        sal_uInt32 idx = (mbReverse ? --mnIndex : mnIndex++);
        return idx < maObjList.size() ? maObjList[idx] : nullptr;
        const size_t idx(mbReverse ? --mnIndex : mnIndex++);
        return (idx < maObjList.size()) ? const_cast< SdrObject* >(maObjList[idx]) : nullptr;
    }

    sal_uInt32 Count() { return maObjList.size(); }
    size_t Count() { return maObjList.size(); }
};

#endif // INCLUDED_SVX_SVDITER_HXX
diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx
index 364b8ce..e82e501 100644
--- a/include/svx/svdoashp.hxx
+++ b/include/svx/svdoashp.hxx
@@ -224,7 +224,8 @@ public:

    virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const override;

    virtual void SetPage( SdrPage* pNewPage ) override;
    // react on model/page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;

    virtual SdrObjGeoData *NewGeoData() const override;
    virtual void SaveGeoData(SdrObjGeoData &rGeo) const override;
diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 00b1152..d99f3f3 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -343,8 +343,20 @@ public:
    // A SdrObject always needs a SdrModel for lifetime (Pool, ...)
    SdrObject(SdrModel& rSdrModel);

    // SdrModel access on SdrObject level
    SdrModel& getSdrModelFromSdrObject() const { return mrSdrModelFromSdrObject; }
    // SdrModel/SdrPage access on SdrObject level
    virtual SdrPage* getSdrPageFromSdrObject() const;
    SdrModel& getSdrModelFromSdrObject() const;
    SdrObjList* getParentOfSdrObject() const;
    virtual SdrObjList* getChildrenOfSdrObject() const;

private:
    // only allow SetParentAtSdrObjectFromSdrObjList to call setParentOfSdrObject
    friend void SetParentAtSdrObjectFromSdrObjList(SdrObject& rSdrObject, SdrObjList* pNew);
    SVX_DLLPRIVATE void setParentOfSdrObject(SdrObjList* pNew);

public:
    // react on model/page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage);

    void AddObjectUser(sdr::ObjectUser& rNewUser);
    void RemoveObjectUser(sdr::ObjectUser& rOldUser);
@@ -373,7 +385,7 @@ public:
    ///
    /// This is needed for instance for NbcMove, because usually one moves SnapRect and aOutRect
    /// at the same time to avoid recomputation.
    virtual void SetRectsDirty(bool bNotMyself = false);
    virtual void SetRectsDirty(bool bNotMyself = false, bool bRecursive = true);

    // frees the SdrObject pointed to by the argument
    // In case the object has an SvxShape, which has the ownership of the object, it
@@ -383,11 +395,6 @@ public:
    // this method is only for access from Property objects
    virtual void SetBoundRectDirty();

    virtual void setParentOfSdrObject(SdrObjList* pNewObjList);
    SdrObjList* getParentOfSdrObject() const { return mpParentOfSdrObject;}

    virtual void SetPage(SdrPage* pNewPage);
    SdrPage* GetPage() const { return pPage;}
    SfxItemPool & GetObjectItemPool() const;

    void AddListener(SfxListener& rListener);
@@ -909,9 +916,8 @@ public:
    void setSuitableOutlinerBg(Outliner& rOutliner) const;

protected:
    tools::Rectangle                   aOutRect;     // surrounding rectangle for Paint (incl. LineWdt, ...)
    tools::Rectangle            aOutRect;     // surrounding rectangle for Paint (incl. LineWdt, ...)
    Point                       aAnchor;      // anchor position (Writer)
    SdrPage*                    pPage;
    SdrObjUserCall*             pUserCall;
    std::unique_ptr<SdrObjPlusData>
                                pPlusData;    // Broadcaster, UserData, connectors, ... (this is the Bitsack)
@@ -1074,7 +1080,6 @@ public:
        SdrModel& rSdrModel,
        SdrInventor nInventor,
        sal_uInt16 nObjIdentifier,
        SdrPage* pPage = nullptr,
        const tools::Rectangle* pSnapRect = nullptr);

    static void InsertMakeObjectHdl(Link<SdrObjCreatorParams, SdrObject*> const & rLink);
diff --git a/include/svx/svdoedge.hxx b/include/svx/svdoedge.hxx
index e142a4a..3669633 100644
--- a/include/svx/svdoedge.hxx
+++ b/include/svx/svdoedge.hxx
@@ -192,6 +192,9 @@ protected:
public:
    SdrEdgeObj(SdrModel& rSdrModel);

    // react on model/page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;

    SdrObjConnection& GetConnection(bool bTail1) { return *(bTail1 ? &aCon1 : &aCon2); }
    virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
    virtual sal_uInt16 GetObjIdentifier() const override;
diff --git a/include/svx/svdograf.hxx b/include/svx/svdograf.hxx
index e07864d..1718b96 100644
--- a/include/svx/svdograf.hxx
+++ b/include/svx/svdograf.hxx
@@ -197,7 +197,8 @@ public:

    bool                    HasGDIMetaFile() const;

    virtual void            SetPage(SdrPage* pNewPage) override;
    // react on model/page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;

    bool isEmbeddedVectorGraphicData() const;
    GDIMetaFile getMetafileFromEmbeddedVectorGraphicData() const;
diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx
index 2901ee8..53f4107 100644
--- a/include/svx/svdogrp.hxx
+++ b/include/svx/svdogrp.hxx
@@ -29,13 +29,12 @@
class SfxItemSet;

//   SdrObjGroup
class SVX_DLLPUBLIC SdrObjGroup final : public SdrObject
class SVX_DLLPUBLIC SdrObjGroup final : public SdrObject, public SdrObjList
{
private:
    virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override;
    virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override;

    SdrObjList                  maSdrObjList;   // sub list (children)
    Point                       aRefPoint;      // Reference point inside the object group

private:
@@ -45,13 +44,23 @@ private:
public:
    SdrObjGroup(SdrModel& rSdrModel);

    // derived from SdrObjList
    virtual SdrPage* getSdrPageFromSdrObjList() const override;
    virtual SdrObject* getSdrObjectFromSdrObjList() const override;
    virtual SdrModel& getSdrModelFromSdrObjList() const override;

    // derived from SdrObject
    virtual SdrObjList* getChildrenOfSdrObject() const override;

    virtual void SetBoundRectDirty() override;
    virtual sal_uInt16 GetObjIdentifier() const override;
    virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
    virtual SdrLayerID GetLayer() const override;
    virtual void NbcSetLayer(SdrLayerID nLayer) override;
    virtual void setParentOfSdrObject(SdrObjList* pNewObjList) override;
    virtual void SetPage(SdrPage* pNewPage) override;

    // react on model/page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;

    virtual SdrObjList* GetSubList() const override;

    virtual const tools::Rectangle& GetCurrentBoundRect() const override;
diff --git a/include/svx/svdoole2.hxx b/include/svx/svdoole2.hxx
index 7dc190b..c7a108c 100644
--- a/include/svx/svdoole2.hxx
+++ b/include/svx/svdoole2.hxx
@@ -120,7 +120,8 @@ public:

    void AbandonObject();

    virtual void SetPage(SdrPage* pNewPage) override;
    // react on model/page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;

    /** Change the IsClosedObj attribute

diff --git a/include/svx/svdotext.hxx b/include/svx/svdotext.hxx
index 912780c..7be26b5 100644
--- a/include/svx/svdotext.hxx
+++ b/include/svx/svdotext.hxx
@@ -435,7 +435,9 @@ public:
    SdrTextAniKind GetTextAniKind() const;
    SdrTextAniDirection GetTextAniDirection() const;

    virtual void SetPage(SdrPage* pNewPage) override;
    // react on model/page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;

    virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
    virtual sal_uInt16 GetObjIdentifier() const override;

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 5d978c0..e095f95 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -72,18 +72,14 @@ private:
protected:
friend class SdrObjListIter;
friend class SdrEditView;
    SdrObjList* pUpList;   /// parent list
    SdrPage*    mpPage;     /// Page containing the list, may be "this".
    SdrObject*  pOwnerObj; /// OwnerObject, if it's list of a Group object.
    tools::Rectangle   maOutRect;
    tools::Rectangle   aSnapRect;
    SdrObjListKind eListKind;
    bool        bObjOrdNumsDirty;
    bool        bRectsDirty;

    tools::Rectangle    maSdrObjListOutRect;
    tools::Rectangle    maSdrObjListSnapRect;
    bool                mbObjOrdNumsDirty;
    bool                mbRectsDirty;

protected:
    void RecalcRects();
    void copyDataFromSdrObjList(const SdrObjList& rSrcList);

private:
    /// simple ActionChildInserted forwarder to have it on a central place
@@ -95,43 +91,46 @@ private:
    // (e.g. SdrPage)
    void impClearSdrObjList(bool bBroadcast);

public:
    SdrObjList(SdrPage* pNewPage = nullptr);
protected:
    // protected constructor to make clear that this class should only
    // be used as base for derivations, not naked. See getSdrModelFromSdrObjList
    // which is pure virtual to force this, too
    SdrObjList();
    virtual ~SdrObjList();

public:
    // SdrModel/SdrPage access on SdrObjList level
    virtual SdrPage* getSdrPageFromSdrObjList() const;
    virtual SdrObject* getSdrObjectFromSdrObjList() const;
    virtual SdrModel& getSdrModelFromSdrObjList() const = 0;

    void CopyObjects(const SdrObjList& rSrcList);

    // tdf#116879 clean up everything (without Undo), plus broadcasting
    // changes. Split to this call and a private one (impClearSdrObjList)
    // that allows cleanup without broadcasting in the destructor
    void ClearSdrObjList();

    SdrObjListKind GetListKind() const                  { return eListKind; }
    void           SetListKind(SdrObjListKind eNewKind) { eListKind=eNewKind; }
    SdrObjList*    GetUpList() const                    { return pUpList; }
    void           SetUpList(SdrObjList* pNewUpList)    { pUpList=pNewUpList; }
    SdrObject*     GetOwnerObj() const                  { return pOwnerObj; }
    void           SetOwnerObj(SdrObject* pNewOwner)    { pOwnerObj=pNewOwner; }
    SdrPage*       GetPage() const;
    void           SetPage(SdrPage* pNewPage);
    void    ClearSdrObjList();

    /// recalculate order numbers / ZIndex
    void           RecalcObjOrdNums();
    bool           IsObjOrdNumsDirty() const        { return bObjOrdNumsDirty; }
    bool           IsObjOrdNumsDirty() const        { return mbObjOrdNumsDirty; }
    virtual void   NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE);
    virtual void   InsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE);

    /// remove from list without delete
    virtual SdrObject* NbcRemoveObject(size_t nObjNum);
    virtual SdrObject* RemoveObject(size_t nObjNum);

    /// Replace existing object by different one.
    /// Same as Remove(old)+Insert(new) but faster because the order numbers
    /// do not have to be set dirty.
    virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, size_t nObjNum);
    virtual SdrObject* ReplaceObject(SdrObject* pNewObj, size_t nObjNum);

    /// Modify ZOrder of an SdrObject
    virtual SdrObject* SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum);

    void SetRectsDirty();
    void SetSdrObjListRectsDirty();

    const tools::Rectangle& GetAllObjSnapRect() const;
    const tools::Rectangle& GetAllObjBoundRect() const;
@@ -160,6 +159,7 @@ public:
        removes the group object afterwards.
     */
    void FlattenGroups();

    /** Ungroup the object at the given index

        This method ungroups the content of the group object at the
@@ -282,9 +282,6 @@ private:
// Used for all methods which return a page number
#define SDRPAGE_NOTFOUND 0xFFFF


// class SdrPageGridFrame

/// for the snap-to-grid in Writer
class SdrPageGridFrame
{
@@ -314,9 +311,7 @@ public:
    const SdrPageGridFrame& operator[](sal_uInt16 nPos) const              { return *GetObject(nPos); }
};


// class SdrPageProperties

class SVX_DLLPUBLIC SdrPageProperties : public SfxListener, public svl::StyleSheetUser
{
private:
@@ -399,6 +394,7 @@ public:

    // SdrModel access on SdrPage level
    SdrModel& getSdrModelFromSdrPage() const { return mrSdrModelFromSdrPage; }
    virtual SdrModel& getSdrModelFromSdrObjList() const override;

protected:
    sdr::contact::ViewContact* CreateObjectSpecificViewContact();
@@ -444,8 +440,7 @@ protected:
    // #i93597#
    bool                mbPageBorderOnlyLeftRight : 1;

    void                SetUnoPage(css::uno::Reference<
                                   css::drawing::XDrawPage> const&);
    void SetUnoPage(css::uno::Reference<css::drawing::XDrawPage> const&);
    virtual css::uno::Reference< css::uno::XInterface > createUnoPage();

    // Copying of pages is split into two parts: construction and copying of page objects,
@@ -465,6 +460,9 @@ public:
    bool             IsInserted() const         { return mbInserted; }
    void             SetChanged();

    // derived from SdrObjList, returns this
    virtual SdrPage* getSdrPageFromSdrObjList() const override;

    // #i68775# React on PageNum changes (from Model in most cases)
    void SetPageNum(sal_uInt16 nNew);
    sal_uInt16 GetPageNum() const;
diff --git a/include/svx/svdtypes.hxx b/include/svx/svdtypes.hxx
index e3edbcc..38e41fa 100644
--- a/include/svx/svdtypes.hxx
+++ b/include/svx/svdtypes.hxx
@@ -64,20 +64,6 @@ typedef o3tl::strong_int<sal_uInt8,SdrLayerIDTag> SdrLayerID;
constexpr SdrLayerID SDRLAYER_NOTFOUND(0xff);

/*
 * Page + ObjList
 */
enum class SdrObjListKind {
    Unknown    = 0x00,
    // pure object lists:
    GroupObj   = 0x01,
    // Here is space for 12 more types of lists
    // Pages:
    DrawPage   = 0x10,
    MasterPage = 0x11
    // Here is space for 8 more types of pages
};   // reserved for Surrogate

/*
 * Repeat
 */
enum class SdrRepeatFunc {
diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx
index 4719149..16435cd 100644
--- a/reportdesign/source/core/sdr/RptObject.cxx
+++ b/reportdesign/source/core/sdr/RptObject.cxx
@@ -506,7 +506,7 @@ SdrInventor OCustomShape::GetObjInventor() const

SdrPage* OCustomShape::GetImplPage() const
{
    return GetPage();
    return getSdrPageFromSdrObject();
}

void OCustomShape::NbcMove( const Size& rSize )
@@ -652,7 +652,7 @@ SdrInventor OUnoObject::GetObjInventor() const

SdrPage* OUnoObject::GetImplPage() const
{
    return GetPage();
    return getSdrPageFromSdrObject();
}

void OUnoObject::NbcMove( const Size& rSize )
@@ -947,7 +947,7 @@ SdrInventor OOle2Obj::GetObjInventor() const

SdrPage* OOle2Obj::GetImplPage() const
{
    return GetPage();
    return getSdrPageFromSdrObject();
}

void OOle2Obj::NbcMove( const Size& rSize )
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index ea96a40..42c172c 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -842,7 +842,7 @@ void notifySystemWindow(vcl::Window const * _pWindow, vcl::Window* _pToRegister,
SdrObject* isOver(const tools::Rectangle& _rRect, SdrPage const & _rPage, SdrView const & _rView, bool _bAllObjects, SdrObject const * _pIgnore, sal_Int16 _nIgnoreType)
{
    SdrObject* pOverlappedObj = nullptr;
    SdrObjListIter aIter(_rPage,SdrIterMode::DeepNoGroups);
    SdrObjListIter aIter(&_rPage,SdrIterMode::DeepNoGroups);
    SdrObject* pObjIter = nullptr;

    while( !pOverlappedObj && (pObjIter = aIter.Next()) != nullptr )
@@ -883,7 +883,7 @@ bool checkArrayForOccurrence(SdrObject const * _pObjToCheck, SdrUnoObj* _pIgnore
SdrObject* isOver(const tools::Rectangle& _rRect,SdrPage const & _rPage,SdrView const & _rView,bool _bAllObjects, SdrUnoObj * _pIgnoreList[], int _nIgnoreListLength)
{
    SdrObject* pOverlappedObj = nullptr;
    SdrObjListIter aIter(_rPage,SdrIterMode::DeepNoGroups);
    SdrObjListIter aIter(&_rPage,SdrIterMode::DeepNoGroups);
    SdrObject* pObjIter = nullptr;

    while( !pOverlappedObj && (pObjIter = aIter.Next()) != nullptr )
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index 973e036..ab76f3f 100644
--- a/reportdesign/source/ui/report/ReportController.cxx
+++ b/reportdesign/source/ui/report/ReportController.cxx
@@ -3110,8 +3110,7 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
        pNewControl = SdrObjFactory::MakeNewObject(
            *m_aReportModel,
            SdrInventor::ReportDesign,
            _nObjectId,
            pSectionWindow->getReportSection().getPage());
            _nObjectId);
        xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY);
        OUString sCustomShapeType = getDesignView()->GetInsertObjString();
        if ( sCustomShapeType.isEmpty() )
@@ -3124,8 +3123,7 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co
        pNewControl = SdrObjFactory::MakeNewObject(
            *m_aReportModel,
            SdrInventor::ReportDesign,
            _nObjectId,
            pSectionWindow->getReportSection().getPage());
            _nObjectId);

        pNewControl->SetLogicRect(tools::Rectangle(3000,500,8000,5500)); // switch height and width
        xShapeProp.set(pNewControl->getUnoShape(),uno::UNO_QUERY_THROW);
diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx
index 62c9275..07f6d4b 100644
--- a/reportdesign/source/ui/report/ReportSection.cxx
+++ b/reportdesign/source/ui/report/ReportSection.cxx
@@ -266,10 +266,7 @@ void OReportSection::Paste(const uno::Sequence< beans::NamedValue >& _aAllreadyC
                        {
                            // Clone to target SdrModel
                            SdrObject* pNewObj(pObject->CloneSdrObject(*m_pModel.get()));

                            pNewObj->SetPage( m_pPage );
                            m_pPage->InsertObject(pNewObj, SAL_MAX_SIZE);

                            tools::Rectangle aRet(VCLPoint((*pCopiesIter)->getPosition()),VCLSize((*pCopiesIter)->getSize()));
                            aRet.setHeight(aRet.getHeight() + 1);
                            aRet.setWidth(aRet.getWidth() + 1);
@@ -418,7 +415,7 @@ void OReportSection::SelectAll(const sal_uInt16 _nObjectType)
        else
        {
            m_pView->UnmarkAll();
            SdrObjListIter aIter(*m_pPage,SdrIterMode::DeepNoGroups);
            SdrObjListIter aIter(m_pPage,SdrIterMode::DeepNoGroups);
            SdrObject* pObjIter = nullptr;
            while( (pObjIter = aIter.Next()) != nullptr )
            {
diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 72f74f2..5860c96 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -76,7 +76,7 @@ bool lcl_getNewRectSize(const tools::Rectangle& _aObjRect,long& _nXMov, long& _n
            }
            if (dynamic_cast<OUnoObject const *>(_pObj) != nullptr || dynamic_cast<OOle2Obj const *>(_pObj) != nullptr)
            {
                pOverlappedObj = isOver(aNewRect,*_pObj->GetPage(),*_pView,true,_pObj);
                pOverlappedObj = isOver(aNewRect,*_pObj->getSdrPageFromSdrObject(),*_pView,true,_pObj);
                if ( pOverlappedObj && _pObj != pOverlappedObj )
                {
                    tools::Rectangle aOverlappingRect = pOverlappedObj->GetSnapRect();
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index 0c465d1..2d07356 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -420,7 +420,7 @@ void DlgEdFunc::deactivateOle(bool _bSelect)
    for(sal_uLong i = 0 ; i< nCount;++i)
    {
        SdrOle2Obj* pObj = rObjCache[i];
        if ( m_pParent->getPage() == pObj->GetPage() )
        if ( m_pParent->getPage() == pObj->getSdrPageFromSdrObject() )
        {
            uno::Reference< embed::XEmbeddedObject > xObj = pObj->GetObjRef();
            if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::UI_ACTIVE )
@@ -567,7 +567,7 @@ bool DlgEdFunc::isRectangleHit(const MouseEvent& rMEvt)
        const SdrDragStat& rDragStat = m_rView.GetDragStat();
        if (rDragStat.GetDragMethod() != nullptr)
        {
            SdrObjListIter aIter(*m_pParent->getPage(),SdrIterMode::DeepNoGroups);
            SdrObjListIter aIter(m_pParent->getPage(),SdrIterMode::DeepNoGroups);
            SdrObject* pObjIter = nullptr;
            // loop through all marked objects and check if there new rect overlapps an old one.
            while( (pObjIter = aIter.Next()) != nullptr && !bIsSetPoint)
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index e8f17e0..08cc399 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -292,7 +292,7 @@ uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const Sdr
        ::std::unique_ptr<SdrObjListIter> pGroupIterator;
        if (pCurrent->IsGroupObject())
        {
            pGroupIterator.reset(new SdrObjListIter(*pCurrent->GetSubList()));
            pGroupIterator.reset(new SdrObjListIter(pCurrent->GetSubList()));
            pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr;
        }

diff --git a/sc/CppunitTest_sc_subsequent_export_test.mk b/sc/CppunitTest_sc_subsequent_export_test.mk
index 5afd437..aab2955 100644
--- a/sc/CppunitTest_sc_subsequent_export_test.mk
+++ b/sc/CppunitTest_sc_subsequent_export_test.mk
@@ -102,6 +102,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\
    vcl/vcl.common \
    xmloff/util/xo \
    xmlsecurity/util/xmlsecurity \
    emfio/emfio \
))

$(eval $(call gb_CppunitTest_use_components,sc_subsequent_export_test,\
diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx
index bb46fe8..bf92c9d 100644
--- a/sc/source/core/data/documen5.cxx
+++ b/sc/source/core/data/documen5.cxx
@@ -110,7 +110,7 @@ bool ScDocument::HasChartAtPoint( SCTAB nTab, const Point& rPos, OUString& rName
        SdrPage* pPage = mpDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
        OSL_ENSURE(pPage,"Page ?");

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -154,7 +154,7 @@ uno::Reference< chart2::XChartDocument > ScDocument::GetChartByName( const OUStr
            SdrPage* pPage = mpDrawLayer->GetPage(nTab);
            OSL_ENSURE(pPage,"Page ?");

            SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
            SdrObject* pObject = aIter.Next();
            while (pObject)
            {
@@ -219,7 +219,7 @@ void ScDocument::GetOldChartParameters( const OUString& rName,
        SdrPage* pPage = mpDrawLayer->GetPage(nTab);
        OSL_ENSURE(pPage,"Page ?");

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -266,7 +266,7 @@ void ScDocument::UpdateChartArea( const OUString& rChartName,
        SdrPage* pPage = mpDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
        OSL_ENSURE(pPage,"Page ?");

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -499,7 +499,7 @@ void ScDocument::SetChartRangeList( const OUString& rChartName,
        SdrPage* pPage = mpDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
        OSL_ENSURE(pPage,"Page ?");

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -554,7 +554,7 @@ uno::Reference< embed::XEmbeddedObject >
        SdrPage* pPage = mpDrawLayer->GetPage(nTab);
        OSL_ENSURE(pPage,"Page ?");

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -593,7 +593,7 @@ void ScDocument::UpdateChartListenerCollection()
        if (!pPage)
            continue;

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        ScChartListenerCollection::StringSetType& rNonOleObjects =
            pChartListenerCollection->getNonOleObjectNames();

diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index d7c0401..5433142 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -80,13 +80,12 @@ void ScDocument::TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDes

        if (pOldPage && pNewPage)
        {
            SdrObjListIter aIter( *pOldPage, SdrIterMode::Flat );
            SdrObjListIter aIter( pOldPage, SdrIterMode::Flat );
            SdrObject* pOldObject = aIter.Next();
            while (pOldObject)
            {
                // Clone to target SdrModel
                SdrObject* pNewObject(pOldObject->CloneSdrObject(*mpDrawLayer));
                pNewObject->SetPage(pNewPage);
                pNewObject->NbcMove(Size(0,0));
                pNewPage->InsertObject( pNewObject );

@@ -307,7 +306,7 @@ bool ScDocument::HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* p
            OSL_ENSURE(pPage,"Page ?");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
                SdrObjListIter aIter( pPage, SdrIterMode::Flat );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
@@ -333,7 +332,7 @@ void ScDocument::StartAnimations( SCTAB nTab )
    if (!pPage)
        return;

    SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pPage, SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    while (pObject)
    {
@@ -361,7 +360,7 @@ bool ScDocument::HasBackgroundDraw( SCTAB nTab, const tools::Rectangle& rMMRect 

    bool bFound = false;

    SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pPage, SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    while (pObject && !bFound)
    {
@@ -386,7 +385,7 @@ bool ScDocument::HasAnyDraw( SCTAB nTab, const tools::Rectangle& rMMRect ) const

    bool bFound = false;

    SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pPage, SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    while (pObject && !bFound)
    {
@@ -414,7 +413,7 @@ SdrObject* ScDocument::GetObjectAtPoint( SCTAB nTab, const Point& rPos )
        OSL_ENSURE(pPage,"Page ?");
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
            SdrObjListIter aIter( pPage, SdrIterMode::Flat );
            SdrObject* pObject = aIter.Next();
            while (pObject)
            {
@@ -538,7 +537,7 @@ bool ScDocument::HasDetectiveObjects(SCTAB nTab) const
        OSL_ENSURE(pPage,"Page ?");
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
            SdrObject* pObject = aIter.Next();
            while (pObject && !bFound)
            {
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index f952fe5..06a1a53 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -995,7 +995,7 @@ void ScDocument::SetLayoutRTL( SCTAB nTab, bool bRTL )
            OSL_ENSURE(pPage,"Page ?");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 0fae0c8..5fd0945 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -156,7 +156,7 @@ ScUndoAnchorData::~ScUndoAnchorData()
void ScUndoAnchorData::Undo()
{
    // Trigger Object Change
    if (pObj->IsInserted() && pObj->GetPage())
    if (pObj->IsInserted() && pObj->getSdrPageFromSdrObject())
    {
        SdrHint aHint(SdrHintKind::ObjectChange, *pObj);
        pObj->getSdrModelFromSdrObject().Broadcast(aHint);
@@ -176,7 +176,7 @@ void ScUndoAnchorData::Redo()
        ScDrawLayer::SetCellAnchoredFromPosition(*pObj, *mpDoc, mnTab, mbWasResizeWithCell);

    // Trigger Object Change
    if (pObj->IsInserted() && pObj->GetPage())
    if (pObj->IsInserted() && pObj->getSdrPageFromSdrObject())
    {
        SdrHint aHint(SdrHintKind::ObjectChange, *pObj);
        pObj->getSdrModelFromSdrObject().Broadcast(aHint);
@@ -449,7 +449,7 @@ void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos )
        SCTAB nOldTab = static_cast<SCTAB>(nOldPos);
        SCTAB nNewTab = static_cast<SCTAB>(nNewPos);

        SdrObjListIter aIter( *pOldPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pOldPage, SdrIterMode::Flat );
        SdrObject* pOldObject = aIter.Next();
        while (pOldObject)
        {
@@ -462,7 +462,6 @@ void ScDrawLayer::ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos )

            // Clone to target SdrModel
            SdrObject* pNewObject(pOldObject->CloneSdrObject(*this));
            pNewObject->SetPage(pNewPage);
            pNewObject->NbcMove(Size(0,0));
            pNewPage->InsertObject( pNewObject );
            ScDrawObjData* pNewData = GetObjData(pNewObject);
@@ -499,7 +498,7 @@ void ScDrawLayer::ResetTab( SCTAB nStart, SCTAB nEnd )
        if (!pPage)
            continue;

        SdrObjListIter aIter(*pPage, SdrIterMode::Flat);
        SdrObjListIter aIter(pPage, SdrIterMode::Flat);
        for (SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next())
        {
            ScDrawObjData* pData = GetObjData(pObj);
@@ -1076,7 +1075,7 @@ bool ScDrawLayer::GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) co
    OSL_ENSURE(pPage,"Page not found");
    if (pPage)
    {
        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -1297,7 +1296,7 @@ bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
    bool bFound = false;

    tools::Rectangle aObjRect;
    SdrObjListIter aIter( *pPage );
    SdrObjListIter aIter( pPage );
    SdrObject* pObject = aIter.Next();
    while ( pObject && !bFound )
    {
@@ -1333,7 +1332,7 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,

        std::unique_ptr<SdrObject*[]> ppObj(new SdrObject*[nObjCount]);

        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -1390,7 +1389,7 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )

                std::unique_ptr<SdrObject*[]> ppObj(new SdrObject*[nObjCount]);

                SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
                SdrObjListIter aIter( pPage, SdrIterMode::Flat );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
@@ -1437,7 +1436,7 @@ void ScDrawLayer::CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const tools::Rec
        ScDrawLayer* pDestModel = nullptr;
        SdrPage* pDestPage = nullptr;

        SdrObjListIter aIter( *pSrcPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pSrcPage, SdrIterMode::Flat );
        SdrObject* pOldObject = aIter.Next();
        while (pOldObject)
        {
@@ -1474,7 +1473,6 @@ void ScDrawLayer::CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const tools::Rec
                {
                    // Clone to target SdrModel
                    SdrObject* pNewObject(pOldObject->CloneSdrObject(*pDestModel));
                    pNewObject->SetPage(pDestPage);

                    uno::Reference< chart2::XChartDocument > xOldChart( ScChartHelper::GetChartFromSdrObject( pOldObject ) );
                    if(!xOldChart.is())//#i110034# do not move charts as they lose all their data references otherwise
@@ -1573,7 +1571,7 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const
    if ( !pSrcPage || !pDestPage )
        return;

    SdrObjListIter aIter( *pSrcPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pSrcPage, SdrIterMode::Flat );
    SdrObject* pOldObject = aIter.Next();

    ScDocument* pClipDoc = pClipModel->GetDocument();
@@ -1649,7 +1647,6 @@ void ScDrawLayer::CopyFromClip( ScDrawLayer* pClipModel, SCTAB nSourceTab, const
        {
            // Clone to target SdrModel
            SdrObject* pNewObject(pOldObject->CloneSdrObject(*this));
            pNewObject->SetPage(pDestPage);

            if ( bMirrorObj )
                MirrorRTL( pNewObject );        // first mirror, then move
@@ -1856,7 +1853,7 @@ SdrObject* ScDrawLayer::GetNamedObject( const OUString& rName, sal_uInt16 nId, S
        OSL_ENSURE(pPage,"Page ?");
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
            SdrObject* pObject = aIter.Next();
            while (pObject)
            {
@@ -1908,7 +1905,7 @@ void ScDrawLayer::EnsureGraphicNames()
        OSL_ENSURE(pPage,"Page ?");
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
            SdrObject* pObject = aIter.Next();

            /* The index passed to GetNewGraphicName() will be set to
@@ -2090,7 +2087,7 @@ ScDrawLayer::GetObjectsAnchoredToRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow
        return std::vector<SdrObject*>();

    std::vector<SdrObject*> aObjects;
    SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pPage, SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    ScRange aRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab);
    while (pObject)
@@ -2114,7 +2111,7 @@ ScDrawLayer::GetObjectsAnchoredToRange(SCTAB nTab, SCCOL nCol, SCROW nStartRow, 
        return std::map<SCROW, std::vector<SdrObject*>>();

    std::map<SCROW, std::vector<SdrObject*>> aRowObjects;
    SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pPage, SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    ScRange aRange( nCol, nStartRow, nTab, nCol, nEndRow, nTab);
    while (pObject)
@@ -2139,7 +2136,7 @@ bool ScDrawLayer::HasObjectsAnchoredInRange(const ScRange& rRange)
    if (!pPage || pPage->GetObjCount() < 1)
        return false;

    SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pPage, SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    while (pObject)
    {
diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx
index 307f0e8..4629bbd 100644
--- a/sc/source/core/data/postit.cxx
+++ b/sc/source/core/data/postit.cxx
@@ -382,7 +382,7 @@ void ScCaptionCreator::CreateCaption( bool bShown, bool bTailFront )
            aTextRect,
            aTailPos),
        [](SdrCaptionObj* pCaptionObj){
            SdrPage* pDrawPage(pCaptionObj->GetPage());
            SdrPage* pDrawPage(pCaptionObj->getSdrPageFromSdrObject());
            if (pDrawPage)
            {
                pDrawPage->RemoveObject(pCaptionObj->GetOrdNum());
@@ -444,8 +444,8 @@ ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& r
{
    SdrPage* pDrawPage = GetDrawPage();
    OSL_ENSURE( pDrawPage, "ScNoteCaptionCreator::ScNoteCaptionCreator - no drawing page" );
    OSL_ENSURE( pCaption->GetPage() == pDrawPage, "ScNoteCaptionCreator::ScNoteCaptionCreator - wrong drawing page in caption" );
    if( pDrawPage && (pCaption->GetPage() == pDrawPage) )
    OSL_ENSURE( pCaption->getSdrPageFromSdrObject() == pDrawPage, "ScNoteCaptionCreator::ScNoteCaptionCreator - wrong drawing page in caption" );
    if( pDrawPage && (pCaption->getSdrPageFromSdrObject() == pDrawPage) )
    {
        // store note position in user data of caption object
        ScCaptionUtil::SetCaptionUserData( *pCaption, rPos );
@@ -458,7 +458,7 @@ ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& r

void removeFromDrawPageAndFree( const std::shared_ptr< SdrCaptionObj >& pCaption, bool bIgnoreUndo = false )
{
    SdrPage* pDrawPage(pCaption->GetPage());
    SdrPage* pDrawPage(pCaption->getSdrPageFromSdrObject());
    SAL_WARN_IF( !pDrawPage, "sc.core", "ScCaptionPtr::removeFromDrawPageAndFree - object without drawing page");
    if (pDrawPage)
    {
@@ -882,7 +882,7 @@ ScPostIt* ScNoteUtil::CreateNoteFromCaption(
{
    ScNoteData aNoteData( true/*bShown*/ );
    aNoteData.m_pCaption.reset(pCaption, [](SdrCaptionObj* pCaptionObj) {
        SdrPage* pDrawPage(pCaptionObj->GetPage());
        SdrPage* pDrawPage(pCaptionObj->getSdrPageFromSdrObject());
        if (pDrawPage)
        {
            pDrawPage->RemoveObject(pCaptionObj->GetOrdNum());
diff --git a/sc/source/core/tool/charthelper.cxx b/sc/source/core/tool/charthelper.cxx
index 79140b9..6e71f37 100644
--- a/sc/source/core/tool/charthelper.cxx
+++ b/sc/source/core/tool/charthelper.cxx
@@ -52,7 +52,7 @@ sal_uInt16 lcl_DoUpdateCharts( ScDocument* pDoc )
        SdrPage* pPage = pModel->GetPage(nPageNo);
        OSL_ENSURE(pPage,"Page ?");

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -118,7 +118,7 @@ void ScChartHelper::AdjustRangesOfChartsOnDestinationPage( const ScDocument* pSr
    SdrPage* pDestPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nDestTab));
    if( pDestPage )
    {
        SdrObjListIter aIter( *pDestPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pDestPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        while( pObject )
        {
@@ -158,7 +158,7 @@ void ScChartHelper::UpdateChartsOnDestinationPage( ScDocument* pDestDoc, const S
    SdrPage* pDestPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nDestTab));
    if( pDestPage )
    {
        SdrObjListIter aIter( *pDestPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pDestPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        while( pObject )
        {
@@ -329,7 +329,7 @@ void ScChartHelper::FillProtectedChartRangesVector( ScRangeListVector& rRangesVe
{
    if ( pDocument && pPage )
    {
        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while ( pObject )
        {
@@ -343,7 +343,7 @@ void ScChartHelper::GetChartNames( ::std::vector< OUString >& rChartNames, const
{
    if ( pPage )
    {
        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while ( pObject )
        {
@@ -367,7 +367,7 @@ void ScChartHelper::CreateProtectedChartListenersAndNotify( ScDocument* pDoc, co
    {
        size_t nRangeListCount = rRangesVector.size();
        size_t nRangeList = 0;
        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while ( pObject )
        {
diff --git a/sc/source/core/tool/chartlock.cxx b/sc/source/core/tool/chartlock.cxx
index d33a82a..fe52a1a 100644
--- a/sc/source/core/tool/chartlock.cxx
+++ b/sc/source/core/tool/chartlock.cxx
@@ -53,7 +53,7 @@ std::vector< WeakReference< frame::XModel > > lcl_getAllLivingCharts( ScDocument
            SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
            OSL_ENSURE(pPage,"Page ?");

            SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
            SdrObject* pObject = aIter.Next();
            while (pObject)
            {
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index c2f7d1a..6e942483 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -390,7 +390,7 @@ bool ScDetectiveFunc::HasArrow( const ScAddress& rStart,
    OSL_ENSURE(pPage,"Page ?");

    bool bFound = false;
    SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pPage, SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    while (pObject && !bFound)
    {
@@ -671,7 +671,7 @@ void ScDetectiveFunc::DeleteArrowsAt( SCCOL nCol, SCROW nRow, bool bDestPnt )
        size_t nDelCount = 0;
        std::unique_ptr<SdrObject*[]> ppObj(new SdrObject*[nObjCount]);

        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -744,7 +744,7 @@ void ScDetectiveFunc::DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nR
        size_t nDelCount = 0;
        std::unique_ptr<SdrObject*[]> ppObj(new SdrObject*[nObjCount]);

        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -1246,7 +1246,7 @@ bool ScDetectiveFunc::DeleteAll( ScDetectiveDelete eWhat )
    {
        std::unique_ptr<SdrObject*[]> ppObj(new SdrObject*[nObjCount]);

        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
@@ -1418,7 +1418,7 @@ void ScDetectiveFunc::UpdateAllComments( ScDocument& rDoc )
        OSL_ENSURE( pPage, "Page ?" );
        if( pPage )
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
            SdrObjListIter aIter( pPage, SdrIterMode::Flat );
            for( SdrObject* pObject = aIter.Next(); pObject; pObject = aIter.Next() )
            {
                if ( ScDrawObjData* pData = ScDrawLayer::GetNoteCaptionData( pObject, nObjTab ) )
@@ -1459,7 +1459,7 @@ void ScDetectiveFunc::UpdateAllArrowColors()
        OSL_ENSURE( pPage, "Page ?" );
        if( pPage )
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
            SdrObjListIter aIter( pPage, SdrIterMode::Flat );
            for( SdrObject* pObject = aIter.Next(); pObject; pObject = aIter.Next() )
            {
                if ( pObject->GetLayer() == SC_LAYER_INTERN )
@@ -1536,7 +1536,7 @@ void ScDetectiveFunc::FindFrameForObject( const SdrObject* pObject, ScRange& rRa
    if (!pPage) return;

    // test if the object is a direct page member
    if( pObject && pObject->GetPage() && (pObject->GetPage() == pObject->getParentOfSdrObject()) )
    if( pObject && pObject->getSdrPageFromSdrObject() && (pObject->getSdrPageFromSdrObject() == pObject->getParentOfSdrObject()->getSdrPageFromSdrObjList()) )
    {
        // Is there a previous object?
        const size_t nOrdNum = pObject->GetOrdNum();
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 47a2a598..c41afaa 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -3200,7 +3200,7 @@ void XclImpSolverContainer::RemoveSdrObjectInfo( SdrObject& rSdrObj )
        if( SdrObjList* pSubList = pGroupObj->GetSubList() )
        {
            // iterate flat over the list because this function already works recursively
            SdrObjListIter aObjIt( *pSubList, SdrIterMode::Flat );
            SdrObjListIter aObjIt( pSubList, SdrIterMode::Flat );
            for( SdrObject* pChildObj = aObjIt.Next(); pChildObj; pChildObj = aObjIt.Next() )
                RemoveSdrObjectInfo( *pChildObj );
        }
diff --git a/sc/source/filter/html/htmlexp2.cxx b/sc/source/filter/html/htmlexp2.cxx
index 45743fb..1bda415 100644
--- a/sc/source/filter/html/htmlexp2.cxx
+++ b/sc/source/filter/html/htmlexp2.cxx
@@ -72,7 +72,7 @@ void ScHTMLExport::FillGraphList( const SdrPage* pPage, SCTAB nTab,
        tools::Rectangle aRect;
        if ( !bAll )
            aRect = pDoc->GetMMRect( nStartCol, nStartRow, nEndCol, nEndRow, nTab );
        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        while ( pObject )
        {
diff --git a/sc/source/filter/inc/xcl97rec.hxx b/sc/source/filter/inc/xcl97rec.hxx
index d335f68..d078128 100644
--- a/sc/source/filter/inc/xcl97rec.hxx
+++ b/sc/source/filter/inc/xcl97rec.hxx
@@ -158,11 +158,13 @@ public:
class XclObjComment : public XclObj
{
    ScAddress                   maScPos;
    std::unique_ptr< SdrCaptionObj, SdrObjectFreeOp >
                                mpCaption;

    // no need to use std::unique_ptr< SdrCaptionObj, SdrObjectFreeOp >
    SdrCaptionObj*              mpCaption;

    bool                        mbVisible;
    tools::Rectangle                   maFrom;
    tools::Rectangle                   maTo;
    tools::Rectangle            maFrom;
    tools::Rectangle            maTo;

public:
                                XclObjComment( XclExpObjectManager& rObjMgr,
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 28d1379..f71e235 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -497,7 +497,20 @@ void XclObj::SaveTextRecs( XclExpStream& rStrm )
XclObjComment::XclObjComment( XclExpObjectManager& rObjMgr, const tools::Rectangle& rRect, const EditTextObject& rEditObj, SdrCaptionObj* pCaption, bool bVisible, const ScAddress& rAddress, const tools::Rectangle &rFrom, const tools::Rectangle &rTo ) :
    XclObj( rObjMgr, EXC_OBJTYPE_NOTE, true )
            , maScPos( rAddress )
            , mpCaption( pCaption->CloneSdrObject(pCaption->getSdrModelFromSdrObject()) )

            // No need to CloneSdrObject(...) here, the SdrCaptionObj will exist
            // during the whole im/export time. Seems that this was done
            // initially to make UnitTest CppunitTest_sc_subsequent_export_test
            // work (better: not crash) which had not added emfio/emfio to
            // CppunitTest_sc_subsequent_export_test.mk and thus failed.
            // Probably the Graphic created from the Clone was wrong.
            // Problem with creating a Clone here is that it gets cloned, but not inserted to a
            // SdrPage. In deeper export layers this then goes wrong since without being inserted
            // to a Page, no SvxPage/UnoApiPage can be accessed. This was different in previous
            // revisions of the code in that a SdrObject could be *not* insterted, but have a
            // SdrPage*. That again was redundant, wrong and inconsequent.
            , mpCaption( pCaption )

            , mbVisible( bVisible )
            , maFrom ( rFrom )
            , maTo ( rTo )
@@ -675,7 +688,7 @@ void VmlCommentExporter::EndShape( sal_Int32 nShapeElement )

void XclObjComment::SaveXml( XclExpXmlStream& rStrm )
{
    VmlCommentExporter aCommentExporter( rStrm.GetCurrentStream(), maScPos, mpCaption.get(), mbVisible, maFrom, maTo );
    VmlCommentExporter aCommentExporter( rStrm.GetCurrentStream(), maScPos, mpCaption, mbVisible, maFrom, maTo );
    aCommentExporter.AddSdrObject( *mpCaption );
}

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index c09607c..640854d 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -409,8 +409,8 @@ void ScChildrenShapes::Notify(SfxBroadcaster&, const SfxHint& rHint)
    if (pSdrHint)
    {
        SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject());
        if (pObj && /*(pObj->GetLayer() != SC_LAYER_INTERN) && */(pObj->GetPage() == GetDrawPage()) &&
            (pObj->GetPage() == pObj->getParentOfSdrObject()) ) //only do something if the object lies direct on the page
        if (pObj && /*(pObj->GetLayer() != SC_LAYER_INTERN) && */(pObj->getSdrPageFromSdrObject() == GetDrawPage()) &&
            (pObj->getSdrPageFromSdrObject() == pObj->getParentOfSdrObject()) ) //only do something if the object lies direct on the page
        {
            switch (pSdrHint->GetKind())
            {
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 4b7d699c..aa45b54 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -691,7 +691,7 @@ void ScShapeChildren::Notify(SfxBroadcaster&, const SfxHint& rHint)
    if (pSdrHint)
    {
        SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject());
        if (pObj && (pObj->GetPage() == GetDrawPage()))
        if (pObj && (pObj->getSdrPageFromSdrObject() == GetDrawPage()))
        {
            switch (pSdrHint->GetKind())
            {
diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx
index 83b0c4d..06b1335 100644
--- a/sc/source/ui/app/client.cxx
+++ b/sc/source/ui/app/client.cxx
@@ -60,7 +60,7 @@ SdrOle2Obj* ScClient::GetDrawObj()
    for (sal_uInt16 nPNr=0; nPNr<nPages && !pOle2Obj; nPNr++)
    {
        SdrPage* pPage = pModel->GetPage(nPNr);
        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while (pObject && !pOle2Obj)
        {
diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx
index 8d00e3f..5b74ca0 100644
--- a/sc/source/ui/app/drwtrans.cxx
+++ b/sc/source/ui/app/drwtrans.cxx
@@ -91,7 +91,7 @@ ScDrawTransferObj::ScDrawTransferObj( SdrModel* pClipModel, ScDocShell* pContain
    SdrPage* pPage = m_pModel->GetPage(0);
    if (pPage)
    {
        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        if (pObject && !aIter.Next())               // exactly one object?
        {
@@ -262,7 +262,7 @@ static bool lcl_HasOnlyControls( SdrModel* pModel )
        SdrPage* pPage = pModel->GetPage(0);
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
            SdrObject* pObj = aIter.Next();
            if ( pObj )
            {
@@ -413,7 +413,7 @@ bool ScDrawTransferObj::GetData( const css::datatransfer::DataFlavor& rFlavor, c
            SdrPage* pPage = m_pModel->GetPage(0);
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
                SdrObjListIter aIter( pPage, SdrIterMode::Flat );
                SdrObject* pObject = aIter.Next();
                if (pObject && pObject->GetObjIdentifier() == OBJ_GRAF)
                {
@@ -472,8 +472,8 @@ bool ScDrawTransferObj::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, voi

                for(sal_uInt16 a(0); a < m_pModel->GetPageCount(); a++)
                {
                    const SdrPage* pPage = m_pModel->GetPage(a);
                    SdrObjListIter aIter(*pPage, SdrIterMode::DeepNoGroups);
                    const SdrPage* pPage(m_pModel->GetPage(a));
                    SdrObjListIter aIter(pPage, SdrIterMode::DeepNoGroups);

                    while(aIter.IsMore())
                    {
@@ -671,7 +671,7 @@ SdrOle2Obj* ScDrawTransferObj::GetSingleObject()
    SdrPage* pPage = m_pModel->GetPage(0);
    if (pPage)
    {
        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        SdrObject* pObject = aIter.Next();
        if (pObject && pObject->GetObjIdentifier() == OBJ_OLE2)
        {
@@ -731,7 +731,7 @@ void ScDrawTransferObj::InitDocShell()
        SdrPage* pPage = pDestModel->GetPage(0);
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
            SdrObject* pObject = aIter.Next();
            while (pObject)
            {
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index dfe591a..fa9257c 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -1369,7 +1369,7 @@ bool ScDBDocFunc::RemovePivotTable(ScDPObject& rDPObj, bool bRecord, bool bApi)
                {
                    rDoc.GetChartListenerCollection()->removeByName(pChartObject->GetName());
                    pModel->AddUndo(new SdrUndoDelObj(*pChartObject));
                    pChartObject->GetPage()->RemoveObject(pChartObject->GetOrdNum());
                    pChartObject->getSdrPageFromSdrObject()->RemoveObject(pChartObject->GetOrdNum());
                }
            }
        }
diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx
index aa3f425..b47b369 100644
--- a/sc/source/ui/drawfunc/fupoor.cxx
+++ b/sc/source/ui/drawfunc/fupoor.cxx
@@ -197,7 +197,7 @@ bool FuPoor::IsDetectiveHit( const Point& rLogicPos )
        return false;

    bool bFound = false;
    SdrObjListIter aIter( *pPV->GetObjList(), SdrIterMode::Flat );
    SdrObjListIter aIter( pPV->GetObjList(), SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    while (pObject && !bFound)
    {
diff --git a/sc/source/ui/drawfunc/fusel2.cxx b/sc/source/ui/drawfunc/fusel2.cxx
index 2da124c..a80a993 100644
--- a/sc/source/ui/drawfunc/fusel2.cxx
+++ b/sc/source/ui/drawfunc/fusel2.cxx
@@ -52,7 +52,7 @@ bool FuSelection::TestDetective( const SdrPageView* pPV, const Point& rPos )
        return false;

    bool bFound = false;
    SdrObjListIter aIter( *pPV->GetObjList(), SdrIterMode::Flat );
    SdrObjListIter aIter( pPV->GetObjList(), SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    while (pObject && !bFound)
    {
@@ -131,7 +131,7 @@ bool FuSelection::IsNoteCaptionClicked( const Point& rPos ) const
        bool bProtectDoc =  rDoc.IsTabProtected( nTab ) || (pDocSh && pDocSh->IsReadOnly());

        // search the last object (on top) in the object list
        SdrObjListIter aIter( *pPageView->GetObjList(), SdrIterMode::DeepNoGroups, true );
        SdrObjListIter aIter( pPageView->GetObjList(), SdrIterMode::DeepNoGroups, true );
        for( SdrObject* pObj = aIter.Next(); pObj; pObj = aIter.Next() )
        {
            if( pObj->GetLogicRect().IsInside( rPos ) )
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 6f71bd9..b4b9c46 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -186,7 +186,7 @@ OUString ScContentTree::getAltLongDescText( SvTreeListEntry* pEntry, bool isAltT
                    DBG_ASSERT(pPage,"Page ?");
                    if (pPage)
                    {
                        SdrObjListIter aIter( *pPage, eIter );
                        SdrObjListIter aIter( pPage, eIter );
                        SdrObject* pObject = aIter.Next();
                        while (pObject)
                        {
@@ -985,7 +985,7 @@ void ScContentTree::GetDrawNames( ScContentId nType )
            OSL_ENSURE(pPage,"Page ?");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, eIter );
                SdrObjListIter aIter( pPage, eIter );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
@@ -1171,7 +1171,7 @@ bool ScContentTree::DrawNamesChanged( ScContentId nType )
            OSL_ENSURE(pPage,"Page ?");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, eIter );
                SdrObjListIter aIter( pPage, eIter );
                SdrObject* pObject = aIter.Next();
                while (pObject && bEqual)
                {
diff --git a/sc/source/ui/uitest/uiobject.cxx b/sc/source/ui/uitest/uiobject.cxx
index 3e98e15..1026cdc 100644
--- a/sc/source/ui/uitest/uiobject.cxx
+++ b/sc/source/ui/uitest/uiobject.cxx
@@ -234,7 +234,7 @@ std::set<OUString> collect_charts(VclPtr<ScGridWindow> const & xGridWindow)
    if (!pPage)
        return aRet;

    SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
    SdrObjListIter aIter( pPage, SdrIterMode::Flat );
    SdrObject* pObject = aIter.Next();
    while (pObject)
    {
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 6e7c047..de71718 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -736,9 +736,9 @@ ScUndoSdrCaptionObj::~ScUndoSdrCaptionObj()

void ScUndoSdrCaptionObj::BroadcastSwitchToPage()
{
    if (m_pCaptionObj && m_pCaptionObj->IsInserted() && m_pCaptionObj->GetPage())
    if (m_pCaptionObj && m_pCaptionObj->IsInserted() && m_pCaptionObj->getSdrPageFromSdrObject())
    {
        SdrHint aHint(SdrHintKind::SwitchToPage, *m_pCaptionObj, m_pCaptionObj->GetPage());
        SdrHint aHint(SdrHintKind::SwitchToPage, *m_pCaptionObj, m_pCaptionObj->getSdrPageFromSdrObject());
        rMod.Broadcast(aHint);
    }
}
@@ -785,12 +785,12 @@ void ScUndoDelSdrCaptionObj::Undo()
    {
        Point aOwnerAnchorPos(0, 0);

        if (dynamic_cast< const SdrObjGroup* >(m_pObjList->GetOwnerObj()) != nullptr)
        if (dynamic_cast< const SdrObjGroup* >(m_pObjList->getSdrObjectFromSdrObjList()) != nullptr)
        {
            aOwnerAnchorPos = m_pObjList->GetOwnerObj()->GetAnchorPos();
            aOwnerAnchorPos = m_pObjList->getSdrObjectFromSdrObjList()->GetAnchorPos();
        }

        E3DModifySceneSnapRectUpdater aUpdater(m_pObjList->GetOwnerObj());
        E3DModifySceneSnapRectUpdater aUpdater(m_pObjList->getSdrObjectFromSdrObjList());
        m_pObjList->InsertObject(m_pCaptionObj.get(), m_nOrdNum);

        if(aOwnerAnchorPos.X() || aOwnerAnchorPos.Y())
@@ -861,7 +861,7 @@ void ScUndoNewSdrCaptionObj::Redo()
    {
        Point aAnchorPos( 0, 0 );

        if (dynamic_cast<const SdrObjGroup*>(m_pObjList->GetOwnerObj()) != nullptr)
        if (dynamic_cast<const SdrObjGroup*>(m_pObjList->getSdrObjectFromSdrObjList()) != nullptr)
        {
            aAnchorPos = m_pCaptionObj->GetAnchorPos();
        }
diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx
index e5b976e..f100abd 100644
--- a/sc/source/ui/undo/undotab.cxx
+++ b/sc/source/ui/undo/undotab.cxx
@@ -1457,7 +1457,7 @@ SdrObject* ScUndoRenameObject::GetObject()
            SdrPage* pPage = pDrawLayer->GetPage(nTab);
            assert(pPage && "Page ?");

            SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
            SdrObject* pObject = aIter.Next();
            while (pObject)
            {
diff --git a/sc/source/ui/unoobj/ChartTools.cxx b/sc/source/ui/unoobj/ChartTools.cxx
index 5243de9..2d2ef3b 100644
--- a/sc/source/ui/unoobj/ChartTools.cxx
+++ b/sc/source/ui/unoobj/ChartTools.cxx
@@ -72,7 +72,7 @@ ChartIterator::ChartIterator(ScDocShell* pDocShell, SCTAB nTab, ChartSourceType 
    SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(nTab));
    if (!pPage)
        return;
    m_pIterator.reset(new SdrObjListIter(*pPage, SdrIterMode::DeepNoGroups));
    m_pIterator.reset(new SdrObjListIter(pPage, SdrIterMode::DeepNoGroups));
}

SdrOle2Obj* ChartIterator::next()
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index 1c98dc4..c821975 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -95,7 +95,7 @@ ScChartObj* ScChartsObj::GetObjectByIndex_Impl(long nIndex) const
            if (pPage)
            {
                long nPos = 0;
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
@@ -307,7 +307,7 @@ sal_Int32 SAL_CALL ScChartsObj::getCount()
            OSL_ENSURE(pPage, "Page not found");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
@@ -372,7 +372,7 @@ uno::Sequence<OUString> SAL_CALL ScChartsObj::getElementNames()
            OSL_ENSURE(pPage, "Page not found");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 59f699d..1fd3c91 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -1467,7 +1467,7 @@ static bool lcl_ParseTarget( const OUString& rTarget, ScRange& rTargetRange, too
                OSL_ENSURE(pPage,"Page ?");
                if (pPage)
                {
                    SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
                    SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
                    SdrObject* pObject = aIter.Next();
                    while (pObject && !bRangeValid)
                    {
diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index 2279a2f..04ef95a 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -334,7 +334,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const 
        if (pObj)
        {
            ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
            SdrPage* pPage(pObj->GetPage());
            SdrPage* pPage(pObj->getSdrPageFromSdrObject());

            if ( pPage )
            {
@@ -466,7 +466,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const 
            if (pObj)
            {
                ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
                SdrPage* pPage(pObj->GetPage());
                SdrPage* pPage(pObj->getSdrPageFromSdrObject());

                if ( pPage )
                {
@@ -565,7 +565,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const 
            if (pObj)
            {
                ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
                SdrPage* pPage(pObj->GetPage());
                SdrPage* pPage(pObj->getSdrPageFromSdrObject());

                if ( pPage )
                {
@@ -662,7 +662,7 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
        if (pObj)
        {
            ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
            SdrPage* pPage(pObj->GetPage());
            SdrPage* pPage(pObj->getSdrPageFromSdrObject());

            if ( pPage )
            {
@@ -711,7 +711,7 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
        if (pObj)
        {
            ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
            SdrPage* pPage(pObj->GetPage());
            SdrPage* pPage(pObj->getSdrPageFromSdrObject());

            if ( pPage )
            {
@@ -771,7 +771,7 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName )
        if (pObj)
        {
            ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
            SdrPage* pPage(pObj->GetPage());
            SdrPage* pPage(pObj->getSdrPageFromSdrObject());

            if ( pPage )
            {
@@ -1005,7 +1005,7 @@ uno::Reference<text::XTextRange> SAL_CALL ScShapeObj::getAnchor()
    if( pObj )
    {
        ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
        SdrPage* pPage(pObj->GetPage());
        SdrPage* pPage(pObj->getSdrPageFromSdrObject());
        ScDocument* pDoc = rModel.GetDocument();

        if ( pPage && pDoc )
@@ -1248,7 +1248,7 @@ uno::Reference< uno::XInterface > SAL_CALL ScShapeObj::getParent()
    if( pObj )
    {
        ScDrawLayer& rModel(static_cast< ScDrawLayer& >(pObj->getSdrModelFromSdrObject()));
        SdrPage* pPage(pObj->GetPage());
        SdrPage* pPage(pObj->getSdrPageFromSdrObject());
        ScDocument* pDoc = rModel.GetDocument();

        if ( pPage && pDoc )
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index ec637f1..81c99ca 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -645,7 +645,7 @@ static void lcl_ShowObject( ScTabViewShell& rViewSh, const ScDrawView& rDrawView
        SdrPage* pPage = pModel->GetPage(i);
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
            SdrObject* pObject = aIter.Next();
            while (pObject && !bFound)
            {
@@ -776,7 +776,7 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection )
                {
                    lcl_ShowObject( *pViewSh, *pDrawView, pObj );
                    SdrPageView* pPV = pDrawView->GetSdrPageView();
                    if ( pPV && pObj->GetPage() == pPV->GetPage() )
                    if ( pPV && pObj->getSdrPageFromSdrObject() == pPV->GetPage() )
                    {
                        pDrawView->MarkObj( pObj, pPV );
                        bRet = true;
@@ -816,7 +816,7 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection )
                                        lcl_ShowObject( *pViewSh, *pDrawView, pObj );
                                        pPV = pDrawView->GetSdrPageView();
                                    }
                                    if ( pPV && pObj->GetPage() == pPV->GetPage() )
                                    if ( pPV && pObj->getSdrPageFromSdrObject() == pPV->GetPage() )
                                    {
                                        if (pDrawView->IsObjMarkable( pObj, pPV ))
                                            pDrawView->MarkObj( pObj, pPV );
diff --git a/sc/source/ui/view/dbfunc4.cxx b/sc/source/ui/view/dbfunc4.cxx
index be7ef40..786299e8 100644
--- a/sc/source/ui/view/dbfunc4.cxx
+++ b/sc/source/ui/view/dbfunc4.cxx
@@ -41,7 +41,7 @@ sal_uInt16 ScDBFunc::DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc, bo
        SdrPage* pPage = pModel->GetPage(nPageNo);
        OSL_ENSURE(pPage,"Page ?");

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
        SdrObject* pObject = aIter.Next();
        while (pObject)
        {
diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx
index efb0280..51b281c 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -655,7 +655,7 @@ SdrObject* ScDrawView::GetObjectByName(const OUString& rName)
            DBG_ASSERT(pPage,"Page ?");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
@@ -689,7 +689,7 @@ void ScDrawView::SelectCurrentViewObject( const OUString& rName )
            DBG_ASSERT(pPage,"Page ?");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
                SdrObject* pObject = aIter.Next();
                while (pObject && !pFound)
                {
@@ -743,7 +743,7 @@ bool ScDrawView::SelectObject( const OUString& rName )
            OSL_ENSURE(pPage,"Page ?");
            if (pPage)
            {
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
                SdrObject* pObject = aIter.Next();
                while (pObject && !pFound)
                {
diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx
index d081c87..887af7e 100644
--- a/sc/source/ui/view/tabvwshg.cxx
+++ b/sc/source/ui/view/tabvwshg.cxx
@@ -63,8 +63,8 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR
    SdrObject* pObj = SdrObjFactory::MakeNewObject(
        *pModel,
        SdrInventor::FmForm,
        OBJ_FM_BUTTON,
        pDrView->GetSdrPageView()->GetPage());
        OBJ_FM_BUTTON);

    SdrUnoObj* pUnoCtrl = dynamic_cast<SdrUnoObj*>( pObj );
    OSL_ENSURE( pUnoCtrl, "no SdrUnoObj");
    if( !pUnoCtrl )
diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx
index 85bf678..7a393f5 100644
--- a/sc/source/ui/view/viewfun5.cxx
+++ b/sc/source/ui/view/viewfun5.cxx
@@ -507,7 +507,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId,
            for (sal_uInt16 i=0; i<nPages; i++)
            {
                SdrPage* pPage = pModel->GetPage(i);
                SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
                SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
                SdrObject* pObject = aIter.Next();
                while (pObject)
                {
diff --git a/sc/source/ui/view/viewfun7.cxx b/sc/source/ui/view/viewfun7.cxx
index d0f56d1..4258b33 100644
--- a/sc/source/ui/view/viewfun7.cxx
+++ b/sc/source/ui/view/viewfun7.cxx
@@ -159,9 +159,6 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,

                if (pNewObj!=nullptr)
                {
                    // pNewObj->SetModel(pDrawModel);
                    pNewObj->SetPage(pDestPage);

                    //  copy graphics within the same model - always needs new name
                    if ( dynamic_cast<const SdrGrafObj*>( pNewObj) !=  nullptr && !bPasteIsMove )
                        pNewObj->SetName(static_cast<ScDrawLayer*>(pDrawModel)->GetNewGraphicName());
@@ -232,7 +229,7 @@ void ScViewFunc::PasteDraw( const Point& rLogicPos, SdrModel* pModel,
        // controls must be on SC_LAYER_CONTROLS
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
            SdrObject* pObject = aIter.Next();
            while (pObject)
            {
diff --git a/sd/qa/unit/data/xml/tdf100491_0.xml b/sd/qa/unit/data/xml/tdf100491_0.xml
old mode 100644
new mode 100755
index 0c250e6..7e9c390
--- a/sd/qa/unit/data/xml/tdf100491_0.xml
+++ b/sd/qa/unit/data/xml/tdf100491_0.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<XShapes>
 <XShape positionX="3680" positionY="2451" sizeX="6" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 3" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="3680" positionY="2451" sizeX="6" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 3" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -35,7 +35,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="4324" positionY="2449" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 4" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="4324" positionY="2449" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 4" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -70,7 +70,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="4947" positionY="2449" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 5" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="4947" positionY="2449" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 5" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -105,7 +105,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="9401" positionY="2435" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 6" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="9401" positionY="2435" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 6" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -140,7 +140,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="10043" positionY="2433" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 7" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="10043" positionY="2433" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 7" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -175,7 +175,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="10669" positionY="2435" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 8" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="10669" positionY="2435" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 8" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -210,7 +210,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="12466" positionY="2433" sizeX="6" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 9" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="12466" positionY="2433" sizeX="6" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 9" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -245,7 +245,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="13107" positionY="2431" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 10" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="13107" positionY="2431" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 10" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -280,7 +280,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="13731" positionY="2431" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 11" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="13731" positionY="2431" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 11" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -315,7 +315,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="15872" positionY="2431" sizeX="6" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 12" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="15872" positionY="2431" sizeX="6" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 12" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -350,7 +350,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="16513" positionY="2430" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 13" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="16513" positionY="2430" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 13" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -385,7 +385,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="17137" positionY="2430" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 14" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="17137" positionY="2430" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 14" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -420,7 +420,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="17772" positionY="2430" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 15" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="17772" positionY="2430" sizeX="5" sizeY="2988" type="com.sun.star.drawing.LineShape" name="Straight Connector 15" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -455,7 +455,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="6549" positionY="2438" sizeX="6" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 16" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="6549" positionY="2438" sizeX="6" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 16" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -490,7 +490,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="7193" positionY="2435" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 17" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="7193" positionY="2435" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 17" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
@@ -525,7 +525,7 @@
   <Line3 column1="0.000000" column2="0.000000" column3="1.000000"/>
  </Transformation>
 </XShape>
 <XShape positionX="7816" positionY="2435" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 18" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="CENTER" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
 <XShape positionX="7816" positionY="2435" sizeX="5" sizeY="2990" type="com.sun.star.drawing.LineShape" name="Straight Connector 18" fontHeight="18.000000" fontColor="ffffffff" textAutoGrowHeight="false" textAutoGrowWidth="false" textContourFrame="false" textFitToSize="NONE" textHorizontalAdjust="BLOCK" textVerticalAdjust="TOP" textLeftDistance="250" textRightDistance="250" textUpperDistance="125" textLowerDistance="125" textMaximumFrameHeight="0" textMaximumFrameWidth="0" textMinimumFrameHeight="0" textMinimumFrameWidth="0" textAnimationAmount="0" textAnimationCount="0" textAnimationDelay="0" textAnimationDirection="LEFT" textAnimationKind="NONE" textAnimationStartInside="false" textAnimationStopInside="false" textWritingMode="LR_TB" lineStyle="SOLID">
  <LineDash style="RECT" dots="1" dotLen="20" dashes="1" dashLen="20" distance="20"/>
  <LineStart>
   <pointSequence>
diff --git a/sd/source/core/CustomAnimationCloner.cxx b/sd/source/core/CustomAnimationCloner.cxx
index b87b46d..98896e6 100644
--- a/sd/source/core/CustomAnimationCloner.cxx
+++ b/sd/source/core/CustomAnimationCloner.cxx
@@ -91,8 +91,8 @@ namespace sd
            // create a dictionary to map source to cloned shapes
            if( pSourcePage && pTargetPage )
            {
                SdrObjListIter aSourceIter( *pSourcePage, SdrIterMode::DeepWithGroups );
                SdrObjListIter aTargetIter( *pTargetPage, SdrIterMode::DeepWithGroups );
                SdrObjListIter aSourceIter( pSourcePage, SdrIterMode::DeepWithGroups );
                SdrObjListIter aTargetIter( pTargetPage, SdrIterMode::DeepWithGroups );

                while( aSourceIter.IsMore() && aTargetIter.IsMore() )
                {
diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx
index 1473358..0b18595 100644
--- a/sd/source/core/CustomAnimationEffect.cxx
+++ b/sd/source/core/CustomAnimationEffect.cxx
@@ -1543,7 +1543,7 @@ void CustomAnimationEffect::updateSdrPathObjFromPath( SdrPathObj& rPathObj )
        SdrObject* pObj = GetSdrObjectFromXShape( getTargetShape() );
        if( pObj )
        {
            SdrPage* pPage = pObj->GetPage();
            SdrPage* pPage = pObj->getSdrPageFromSdrObject();
            if( pPage )
            {
                const Size aPageSize( pPage->GetSize() );
@@ -1583,7 +1583,7 @@ void CustomAnimationEffect::updatePathFromSdrPathObj( const SdrPathObj& rPathObj

        aPolyPoly.transform(basegfx::utils::createTranslateB2DHomMatrix(-aCenter.X(), -aCenter.Y()));

        SdrPage* pPage = pObj->GetPage();
        SdrPage* pPage = pObj->getSdrPageFromSdrObject();
        if( pPage )
        {
            const Size aPageSize( pPage->GetSize() );
diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx
index 305ca6e..6fd8671 100644
--- a/sd/source/core/EffectMigration.cxx
+++ b/sd/source/core/EffectMigration.cxx
@@ -406,14 +406,34 @@ EffectSequence::iterator ImplFindEffect( MainSequencePtr const & pMainSequence, 

static bool implIsInsideGroup( SdrObject const * pObj )
{
    return pObj && pObj->getParentOfSdrObject() && pObj->getParentOfSdrObject()->GetUpList();
    // TTTT for current state of transition, SdrObject has a parent*
    // to a SdrObjList. That may be a SdrPage or a SdrObjGroup, both
    // are already derived from SdrObjList. To finally check, use
    // the method 'getSdrObjectFromSdrObjList' - if it's not a SdrPage,
    // it will return SdrObjGroup or E3dScene -> SdrObject.
    // For future states, test for SdrObject. Trying to get the SdrPage
    // will in the future depend on the Object(this) to be inserted to a
    // SdrPage, regardless of e.g. being a group member.
    if(nullptr == pObj)
    {
        return false;
    }

    SdrObjList* pSdrObjList(pObj->getParentOfSdrObject());

    if(nullptr == pSdrObjList)
    {
        return false;
    }

    return (nullptr != pSdrObjList->getSdrObjectFromSdrObjList());
}

void EffectMigration::SetAnimationEffect( SvxShape* pShape, AnimationEffect eEffect )
{
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->getSdrPageFromSdrObject(),
                "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->getSdrPageFromSdrObject() )
        return;

    SdrObject* pObj = pShape->GetSdrObject();
@@ -432,7 +452,7 @@ void EffectMigration::SetAnimationEffect( SvxShape* pShape, AnimationEffect eEff
    const CustomAnimationPresets& rPresets = CustomAnimationPresets::getCustomAnimationPresets();

    CustomAnimationPresetPtr pPreset( rPresets.getEffectDescriptor( aPresetId ) );
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    if( pPreset.get() && pMainSequence.get() )
    {
@@ -487,7 +507,7 @@ void EffectMigration::SetAnimationEffect( SvxShape* pShape, AnimationEffect eEff
                {
                    CustomAnimationEffectPtr pEffect( new CustomAnimationEffect( xNode ) );
                    pEffect->setTarget( makeAny( xShape ) );
                    SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
                    SdPage* pPage = dynamic_cast< SdPage* >( pObj->getSdrPageFromSdrObject() );
                    const bool bManual = (pPage == nullptr) || (pPage->GetPresChange() == PRESCHANGE_MANUAL);
                    if( !bManual )
                        pEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
@@ -535,7 +555,7 @@ AnimationEffect EffectMigration::GetAnimationEffect( SvxShape* pShape )
    OUString aPresetSubType;

    SdrObject* pObj = pShape->GetSdrObject();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    if( pMainSequence.get() )
    {
@@ -573,9 +593,9 @@ AnimationEffect EffectMigration::GetAnimationEffect( SvxShape* pShape )

void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect eEffect )
{
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->getSdrPageFromSdrObject(),
                "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->getSdrPageFromSdrObject() )
        return;

    SdrObject* pObj = pShape->GetSdrObject();
@@ -603,7 +623,7 @@ void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect 
    // create an effect from this preset
    CustomAnimationPresetPtr pPreset( rPresets.getEffectDescriptor( aPresetId ) );

    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    if( pPreset.get() && pMainSequence.get() )
    {
@@ -652,7 +672,7 @@ void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect 
                        pShapeEffect->setDuration( 0.1 );
                        pMainSequence->append( pShapeEffect );

                        SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
                        SdPage* pPage = dynamic_cast< SdPage* >( pObj->getSdrPageFromSdrObject() );
                        if( pPage && pPage->GetPresChange() != PRESCHANGE_MANUAL )
                            pShapeEffect->setNodeType( EffectNodeType::AFTER_PREVIOUS );
                    }
@@ -661,7 +681,7 @@ void EffectMigration::SetTextAnimationEffect( SvxShape* pShape, AnimationEffect 

            if( pShapeEffect.get() )
            {
                SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
                SdPage* pPage = dynamic_cast< SdPage* >( pObj->getSdrPageFromSdrObject() );
                const bool bManual = (pPage == nullptr) || (pPage->GetPresChange() == PRESCHANGE_MANUAL);

                // now create effects for each paragraph
@@ -717,7 +737,7 @@ AnimationEffect EffectMigration::GetTextAnimationEffect( SvxShape* pShape )
    SdrObject* pObj = pShape->GetSdrObject();
    if( pObj )
    {
        sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
        sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

        if( pMainSequence.get() )
        {
@@ -800,9 +820,9 @@ double EffectMigration::ConvertAnimationSpeed( AnimationSpeed eSpeed )

void EffectMigration::SetAnimationSpeed( SvxShape* pShape, AnimationSpeed eSpeed )
{
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->getSdrPageFromSdrObject(),
                "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->getSdrPageFromSdrObject() )
        return;

    SdrObject* pObj = pShape->GetSdrObject();
@@ -811,7 +831,7 @@ void EffectMigration::SetAnimationSpeed( SvxShape* pShape, AnimationSpeed eSpeed

    double fDuration = ConvertAnimationSpeed( eSpeed );

    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    const Reference< XShape > xShape( pShape );

@@ -836,7 +856,7 @@ void EffectMigration::SetAnimationSpeed( SvxShape* pShape, AnimationSpeed eSpeed
AnimationSpeed EffectMigration::GetAnimationSpeed( SvxShape* pShape )
{
    SdrObject* pObj = pShape->GetSdrObject();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    const Reference< XShape > xShape( pShape );

@@ -876,16 +896,16 @@ AnimationSpeed EffectMigration::ConvertDuration( double fDuration )

void EffectMigration::SetDimColor( SvxShape* pShape, sal_Int32 nColor )
{
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->getSdrPageFromSdrObject(),
                "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->getSdrPageFromSdrObject() )
        return;

    SdrObject* pObj = pShape->GetSdrObject();
    if( implIsInsideGroup( pObj ) )
        return;

    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    const Reference< XShape > xShape( pShape );

@@ -914,9 +934,9 @@ sal_Int32 EffectMigration::GetDimColor( SvxShape* pShape )
    if( pShape )
    {
        SdrObject* pObj = pShape->GetSdrObject();
        if( pObj && pObj->GetPage() )
        if( pObj && pObj->getSdrPageFromSdrObject() )
        {
            sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
            sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

            const Reference< XShape > xShape( pShape );
            EffectSequence::iterator aIter;
@@ -940,16 +960,16 @@ sal_Int32 EffectMigration::GetDimColor( SvxShape* pShape )

void EffectMigration::SetDimHide( SvxShape* pShape, bool bDimHide )
{
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->getSdrPageFromSdrObject(),
                "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->getSdrPageFromSdrObject() )
        return;

    SdrObject* pObj = pShape->GetSdrObject();
    if( implIsInsideGroup( pObj ) )
        return;

    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    const Reference< XShape > xShape( pShape );

@@ -981,9 +1001,9 @@ bool EffectMigration::GetDimHide( SvxShape* pShape )
    if( pShape )
    {
        SdrObject* pObj = pShape->GetSdrObject();
        if( pObj && pObj->GetPage() )
        if( pObj && pObj->getSdrPageFromSdrObject() )
        {
            sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
            sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

            const Reference< XShape > xShape( pShape );

@@ -1007,9 +1027,9 @@ bool EffectMigration::GetDimHide( SvxShape* pShape )

void EffectMigration::SetDimPrevious( SvxShape* pShape, bool bDimPrevious )
{
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->GetPage(),
    DBG_ASSERT( pShape && pShape->GetSdrObject() && pShape->GetSdrObject()->getSdrPageFromSdrObject(),
                "sd::EffectMigration::SetAnimationEffect(), invalid argument!" );
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->getSdrPageFromSdrObject() )
        return;

    SdrObject* pObj = pShape->GetSdrObject();
@@ -1021,7 +1041,7 @@ void EffectMigration::SetDimPrevious( SvxShape* pShape, bool bDimPrevious )
    if( bDimPrevious )
        aColor <<= COL_LIGHTGRAY;

    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    const Reference< XShape > xShape( pShape );

@@ -1051,9 +1071,9 @@ bool EffectMigration::GetDimPrevious( SvxShape* pShape )
    if( pShape )
    {
        SdrObject* pObj = pShape->GetSdrObject();
        if( pObj && pObj->GetPage() )
        if( pObj && pObj->getSdrPageFromSdrObject() )
        {
            sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
            sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

            const Reference< XShape > xShape( pShape );

@@ -1077,11 +1097,11 @@ bool EffectMigration::GetDimPrevious( SvxShape* pShape )

void EffectMigration::SetPresentationOrder( SvxShape* pShape, sal_Int32 nNewPos )
{
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->GetPage() )
    if( !pShape || !pShape->GetSdrObject() || !pShape->GetSdrObject()->getSdrPageFromSdrObject() )
        return;

    SdrObject* pObj = pShape->GetSdrObject();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    EffectSequence& rSequence = pMainSequence->getSequence();
    sal_Int32 nPos;
@@ -1173,7 +1193,7 @@ sal_Int32 EffectMigration::GetPresentationOrder( SvxShape* pShape )
    sal_Int32 nPos = -1, nFound = -1;

    SdrObject* pObj = pShape->GetSdrObject();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

    EffectSequence& rSequence = pMainSequence->getSequence();

@@ -1208,7 +1228,7 @@ void EffectMigration::UpdateSoundEffect( SvxShape* pShape, SdAnimationInfo const
    if( pInfo )
    {
        SdrObject* pObj = pShape->GetSdrObject();
        sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
        sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

        const Reference< XShape > xShape( pShape );

@@ -1248,9 +1268,9 @@ OUString EffectMigration::GetSoundFile( SvxShape* pShape )
    if( pShape )
    {
        SdrObject* pObj = pShape->GetSdrObject();
        if( pObj && pObj->GetPage() )
        if( pObj && pObj->getSdrPageFromSdrObject() )
        {
            sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
            sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();

            const Reference< XShape > xShape( pShape );

@@ -1286,7 +1306,7 @@ void EffectMigration::SetAnimationPath( SvxShape* pShape, SdrPathObj const * pPa
        if( pObj )
        {
            const Reference< XShape > xShape( pShape );
            SdPage* pPage = dynamic_cast< SdPage* >(pPathObj->GetPage());
            SdPage* pPage = dynamic_cast< SdPage* >(pPathObj->getSdrPageFromSdrObject());
            if( pPage )
            {
                std::shared_ptr< sd::MainSequence > pMainSequence( pPage->getMainSequence() );
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 1a38fb0..e8c9b31 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -88,7 +88,7 @@ SdrObject* SdDrawDocument::GetObj(const OUString& rObjName) const
    while (nPage < nMaxPages && !pObjFound)
    {
        pPage = static_cast<const SdPage*>( GetPage(nPage) );
        SdrObjListIter aIter(*pPage, SdrIterMode::DeepWithGroups);
        SdrObjListIter aIter(pPage, SdrIterMode::DeepWithGroups);

        while (aIter.IsMore() && !pObjFound)
        {
@@ -113,7 +113,7 @@ SdrObject* SdDrawDocument::GetObj(const OUString& rObjName) const
    while (nPage < nMaxMasterPages && !pObjFound)
    {
        pPage = static_cast<const SdPage*>( GetMasterPage(nPage) );
        SdrObjListIter aIter(*pPage, SdrIterMode::DeepWithGroups);
        SdrObjListIter aIter(pPage, SdrIterMode::DeepWithGroups);

        while (aIter.IsMore() && !pObjFound)
        {
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 631796d..81312b1 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1027,7 +1027,7 @@ bool SdDrawDocument::InsertBookmarkAsObject(
                    pBMView->EndListening(*pBookmarkDoc);
                }

                pPage = pObj->GetPage();
                pPage = pObj->getSdrPageFromSdrObject();

                if (pPage->IsMasterPage())
                {
diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx
index b886954..2156113 100644
--- a/sd/source/core/drawdoc4.cxx
+++ b/sd/source/core/drawdoc4.cxx
@@ -789,7 +789,7 @@ void SdDrawDocument::StartOnlineSpelling(bool bForceSpelling)
// Fill OnlineSpelling list
void SdDrawDocument::FillOnlineSpellingList(SdPage const * pPage)
{
    SdrObjListIter aIter(*pPage, SdrIterMode::Flat);
    SdrObjListIter aIter(pPage, SdrIterMode::Flat);

    while (aIter.IsMore())
    {
@@ -806,8 +806,7 @@ void SdDrawDocument::FillOnlineSpellingList(SdPage const * pPage)
        else if (pObj->GetObjIdentifier() == OBJ_GRUP)
        {
            // Found a group object
            SdrObjListIter aGroupIter(*static_cast<SdrObjGroup*>(pObj)->GetSubList(),
                                      SdrIterMode::DeepNoGroups);
            SdrObjListIter aGroupIter(static_cast< SdrObjGroup* >(pObj)->GetSubList(), SdrIterMode::DeepNoGroups);

            bool bSubTextObjFound = false;

@@ -847,8 +846,7 @@ IMPL_LINK_NOARG(SdDrawDocument, OnlineSpellingHdl, Timer *, void)
            else if (pObj->GetObjIdentifier() == OBJ_GRUP)
            {
                // Found a group object
                SdrObjListIter aGroupIter(*static_cast<SdrObjGroup*>(pObj)->GetSubList(),
                                          SdrIterMode::DeepNoGroups);
                SdrObjListIter aGroupIter(static_cast< SdrObjGroup* >(pObj)->GetSubList(), SdrIterMode::DeepNoGroups);


                while (aGroupIter.IsMore())
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index 9683510..377b01a 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -664,7 +664,7 @@ SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const
    slides masterpage */
SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const
{
    OUString aStyleName( mpPage->GetLayoutName() );
    OUString aStyleName( GetLayoutName() );
    const OUString aSep( SD_LT_SEPARATOR );
    sal_Int32 nIndex = aStyleName.indexOf(aSep);
    if( nIndex != -1 )
@@ -2826,7 +2826,7 @@ bool SdPage::checkVisibility(

    if( ( pObj->GetObjInventor() == SdrInventor::Default ) && ( pObj->GetObjIdentifier() == OBJ_TEXT ) )
    {
           const SdPage* pCheckPage = dynamic_cast< const SdPage* >(pObj->GetPage());
           const SdPage* pCheckPage = dynamic_cast< const SdPage* >(pObj->getSdrPageFromSdrObject());

        if( pCheckPage )
        {
@@ -2873,7 +2873,7 @@ bool SdPage::checkVisibility(
    // i63977, do not print SdrpageObjs from master pages
    if( ( pObj->GetObjInventor() == SdrInventor::Default ) && ( pObj->GetObjIdentifier() == OBJ_PAGE ) )
    {
        if( pObj->GetPage() && pObj->GetPage()->IsMasterPage() )
        if( pObj->getSdrPageFromSdrObject() && pObj->getSdrPageFromSdrObject()->IsMasterPage() )
            return false;
    }

@@ -2953,7 +2953,7 @@ void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, 
    if( eLayout == AUTOLAYOUT_NONE )
    {
        // use layout from handout master
        SdrObjListIter aShapeIter (rHandoutMaster);
        SdrObjListIter aShapeIter(&rHandoutMaster);

        std::vector< ::tools::Rectangle > vSlidesAreas;
        while ( aShapeIter.IsMore() )
diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx
index ee1f750..15ba777 100644
--- a/sd/source/core/sdpage2.cxx
+++ b/sd/source/core/sdpage2.cxx
@@ -391,8 +391,8 @@ void SdPage::lateInit(const SdPage& rSrcPage)
    rSrcPage.cloneAnimations(*this);

    // fix user calls for duplicated slide
    SdrObjListIter aSourceIter( rSrcPage, SdrIterMode::DeepWithGroups );
    SdrObjListIter aTargetIter( *this, SdrIterMode::DeepWithGroups );
    SdrObjListIter aSourceIter( &rSrcPage, SdrIterMode::DeepWithGroups );
    SdrObjListIter aTargetIter( this, SdrIterMode::DeepWithGroups );

    while( aSourceIter.IsMore() && aTargetIter.IsMore() )
    {
@@ -477,7 +477,7 @@ void SdPage::getAlienAttributes( css::uno::Any& rAttributes )

void SdPage::RemoveEmptyPresentationObjects()
{
    SdrObjListIter  aShapeIter( *this, SdrIterMode::DeepWithGroups );
    SdrObjListIter  aShapeIter( this, SdrIterMode::DeepWithGroups );

    SdrObject* pShape;
    for( pShape = aShapeIter.Next(); pShape; pShape = aShapeIter.Next() )
diff --git a/sd/source/core/undo/undoobjects.cxx b/sd/source/core/undo/undoobjects.cxx
index d8db132..9a34268 100644
--- a/sd/source/core/undo/undoobjects.cxx
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -45,7 +45,7 @@ ViewShellId SdUndoAction::GetViewShellId() const

UndoRemovePresObjectImpl::UndoRemovePresObjectImpl( SdrObject& rObject )
{
    SdPage* pPage = dynamic_cast< SdPage* >( rObject.GetPage() );
    SdPage* pPage = dynamic_cast< SdPage* >( rObject.getSdrPageFromSdrObject() );
    if( pPage )
    {
        if( pPage->IsPresObj(&rObject) )
@@ -177,7 +177,7 @@ UndoObjectSetText::UndoObjectSetText( SdrObject& rObject, sal_Int32 nText )
, mbNewEmptyPresObj(false)
, mxSdrObject( &rObject )
{
    SdPage* pPage = dynamic_cast< SdPage* >( rObject.GetPage() );
    SdPage* pPage = dynamic_cast< SdPage* >( rObject.getSdrPageFromSdrObject() );
    if( pPage && pPage->hasAnimationNode() )
    {
        css::uno::Reference< css::drawing::XShape > xShape( rObject.getUnoShape(), css::uno::UNO_QUERY );
@@ -254,7 +254,7 @@ UndoObjectPresentationKind::UndoObjectPresentationKind(SdrObject& rObject)
:   SdrUndoObj(rObject)
,   meOldKind(PRESOBJ_NONE)
,   meNewKind(PRESOBJ_NONE)
,   mxPage( static_cast<SdPage*>(rObject.GetPage()) )
,   mxPage( static_cast<SdPage*>(rObject.getSdrPageFromSdrObject()) )
,   mxSdrObject( &rObject )
{
    DBG_ASSERT( mxPage.is(), "sd::UndoObjectPresentationKind::UndoObjectPresentationKind(), does not work for shapes without a slide!" );
@@ -307,7 +307,7 @@ void UndoAutoLayoutPosAndSize::Redo()

UndoGeoObject::UndoGeoObject( SdrObject& rNewObj )
: SdrUndoGeoObj( rNewObj )
, mxPage( static_cast<SdPage*>(rNewObj.GetPage()) )
, mxPage( static_cast<SdPage*>(rNewObj.getSdrPageFromSdrObject()) )
, mxSdrObject( &rNewObj )
{
}
@@ -348,7 +348,7 @@ void UndoGeoObject::Redo()

UndoAttrObject::UndoAttrObject( SdrObject& rObject, bool bStyleSheet1, bool bSaveText )
: SdrUndoAttrObj( rObject, bStyleSheet1, bSaveText )
, mxPage( static_cast<SdPage*>(rObject.GetPage()) )
, mxPage( static_cast<SdPage*>(rObject.getSdrPageFromSdrObject()) )
, mxSdrObject( &rObject )
{
}
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx
index f3dc165..7dd92d1 100644
--- a/sd/source/filter/html/htmlex.cxx
+++ b/sd/source/filter/html/htmlex.cxx
@@ -1294,7 +1294,7 @@ void HtmlExport::WriteTable(OUStringBuffer& aStr, SdrTableObj const * pTableObje
void HtmlExport::WriteObjectGroup(OUStringBuffer& aStr, SdrObjGroup const * pObjectGroup, SdrOutliner* pOutliner,
                                  const Color& rBackgroundColor, bool bHeadLine)
{
    SdrObjListIter aGroupIterator(*pObjectGroup->GetSubList(), SdrIterMode::DeepNoGroups);
    SdrObjListIter aGroupIterator(pObjectGroup->GetSubList(), SdrIterMode::DeepNoGroups);
    while (aGroupIterator.IsMore())
    {
        SdrObject* pCurrentObject = aGroupIterator.Next();
@@ -1560,7 +1560,7 @@ bool HtmlExport::CreateHtmlForPresPages()
        while (!bMasterDone)
        {
            // sal_True = backwards
            SdrObjListIter aIter(*pPage, SdrIterMode::DeepWithGroups, true);
            SdrObjListIter aIter(pPage, SdrIterMode::DeepWithGroups, true);

            SdrObject* pObject = aIter.Next();
            while (pObject)
@@ -1727,7 +1727,7 @@ bool HtmlExport::CreateHtmlForPresPages()
                            // is the bookmark a object?
                            pObj = mpDoc->GetObj( aURL );
                            if (pObj)
                                nPgNum = pObj->GetPage()->GetPageNum();
                                nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
                        }
                        if (nPgNum != SDRPAGE_NOTFOUND)
                        {
@@ -1813,7 +1813,7 @@ bool HtmlExport::CreateHtmlForPresPages()
                                // is the bookmark a object?
                                pObj = mpDoc->GetObj(pInfo->GetBookmark());
                                if (pObj)
                                    nPgNum = pObj->GetPage()->GetPageNum();
                                    nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
                            }

                            if( SDRPAGE_NOTFOUND != nPgNum )
diff --git a/sd/source/filter/ppt/ppt97animations.cxx b/sd/source/filter/ppt/ppt97animations.cxx
index d90cf8d..2f5b5ba 100644
--- a/sd/source/filter/ppt/ppt97animations.cxx
+++ b/sd/source/filter/ppt/ppt97animations.cxx
@@ -549,7 +549,7 @@ void Ppt97Animation::createAndSetCustomAnimationEffect( SdrObject* pObj )

    if( !HasEffect() )
        return;
    if( !pObj || !pObj->GetPage() )
    if( !pObj || !pObj->getSdrPageFromSdrObject() )
    {
        OSL_FAIL("no valid SdrObject or page found for ppt import");
        return;
@@ -561,7 +561,7 @@ void Ppt97Animation::createAndSetCustomAnimationEffect( SdrObject* pObj )
        OSL_FAIL("no XShape interface found for ppt import");
        return;
    }
    ::sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->GetPage())->getMainSequence();
    ::sd::MainSequencePtr pMainSequence = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject())->getMainSequence();
    if( !pMainSequence.get() )
    {
        OSL_FAIL("no MainSequence found for ppt import");
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 262abd6..cb0e17d 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -1841,7 +1841,7 @@ void ImplSdPPTImport::ImportPageEffect( SdPage* pPage, const bool bNewAnimations
        tAnimationVector aAnimationsOnThisPage;

        // add effects from page in correct order
        SdrObjListIter aSdrIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aSdrIter( pPage, SdrIterMode::Flat );
        while ( aSdrIter.IsMore() )
        {
            SdrObject* pObj = aSdrIter.Next();
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index b518925..64b2260 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -321,13 +321,6 @@ MotionPathTag::MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, con
    if (mxOrigin.is())
        maOriginPos = mxOrigin->getPosition();

    SdrPage* pPage = mrView.GetSdrPageView()->GetPage();
    if( pPage )
    {
        mpPathObj->SetPage( pPage );
        mpPathObj->setParentOfSdrObject( pPage );
    }

    XDash aDash( css::drawing::DashStyle_RECT, 1, 80, 1, 80, 80);
    OUString aEmpty( "?" );
    mpPathObj->SetMergedItem( XLineDashItem( aEmpty, aDash ) );
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 926bca36..6392abf 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -129,7 +129,7 @@ static SdPage* GetCurrentPage( sd::ViewShell const * pViewSh, EditFieldInfo cons

            if( pTextObj )
            {
                pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() );
                pPage = dynamic_cast< SdPage* >( pTextObj->getSdrPageFromSdrObject() );
            }
        }

diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx
index 5bb95259..b246741 100644
--- a/sd/source/ui/app/sdxfer.cxx
+++ b/sd/source/ui/app/sdxfer.cxx
@@ -344,7 +344,7 @@ static bool lcl_HasOnlyControls( SdrModel* pModel )
        SdrPage* pPage = pModel->GetPage(0);
        if (pPage)
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepNoGroups );
            SdrObjListIter aIter( pPage, SdrIterMode::DeepNoGroups );
            SdrObject* pObj = aIter.Next();
            if ( pObj )
            {
diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx
index 8e22517..99eea6a 100644
--- a/sd/source/ui/dlg/sdtreelb.cxx
+++ b/sd/source/ui/dlg/sdtreelb.cxx
@@ -265,7 +265,7 @@ OUString SdPageObjsTLB::getAltLongDescText(SvTreeListEntry* pEntry , bool isAltT
        const SdPage* pPage = static_cast<const SdPage*>( mpDoc->GetPage( pageNo ) );
        if( pPage->GetPageKind() != PageKind::Standard ) continue;
        if( pPage->GetName() !=  ParentName ) continue;
        SdrObjListIter aIter( *pPage, SdrIterMode::Flat );
        SdrObjListIter aIter( pPage, SdrIterMode::Flat );
        while( aIter.IsMore() )
        {
            pObj = aIter.Next();
@@ -524,7 +524,7 @@ void SdPageObjsTLB::AddShapeList (
        pUserData);

    SdrObjListIter aIter(
        rList,
        &rList,
        !rList.HasObjectNavigationOrder() /* use navigation order, if available */,
        SdrIterMode::Flat);

@@ -641,7 +641,7 @@ bool SdPageObjsTLB::IsEqualToShapeList(SvTreeListEntry*& pEntry, const SdrObjLis

    pEntry = Next(pEntry);

    SdrObjListIter aIter(rList,
    SdrObjListIter aIter(&rList,
                         !rList.HasObjectNavigationOrder() /* use navigation order, if available */,
                         SdrIterMode::Flat);

@@ -772,7 +772,7 @@ void SdPageObjsTLB::RequestingChildren( SvTreeListEntry* pFileEntry )
                                              TREELIST_APPEND,
                                              reinterpret_cast< void* >( 1 ) );

                    SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
                    SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );

                    while( aIter.IsMore() )
                    {
@@ -1269,7 +1269,7 @@ TriState SdPageObjsTLB::NotifyMoving(

    if (pTargetObject != nullptr && pSourceObject != nullptr)
    {
        SdrPage* pObjectList = pSourceObject->GetPage();
        SdrPage* pObjectList = pSourceObject->getSdrPageFromSdrObject();
        if (pObjectList != nullptr)
        {
            sal_uInt32 nNewPosition;
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 61c8b65..fb979fb 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -767,7 +767,7 @@ void DrawDocShell::GotoBookmark(const OUString& rBookmark)

                if (pObj)
                {
                    nPageNumber = pObj->GetPage()->GetPageNum();
                    nPageNumber = pObj->getSdrPageFromSdrObject()->GetPageNum();
                }
            }
        }
diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx
index 4a9d7cf..9a01c54 100644
--- a/sd/source/ui/docshell/docshell.cxx
+++ b/sd/source/ui/docshell/docshell.cxx
@@ -282,7 +282,7 @@ void DrawDocShell::GetState(SfxItemSet &rSet)
                sal_uInt16 nCount = mpDoc->GetPageCount();
                for ( sal_uInt16 itPage = 0; itPage < nCount && !bLanguageFound; itPage++ )
                {
                    SdrObjListIter aListIter(*mpDoc->GetPage(itPage), SdrIterMode::DeepWithGroups);
                    SdrObjListIter aListIter(mpDoc->GetPage(itPage), SdrIterMode::DeepWithGroups);
                    while ( aListIter.IsMore() && !bLanguageFound )
                    {
                        pObj = aListIter.Next();
diff --git a/sd/source/ui/func/fuconbez.cxx b/sd/source/ui/func/fuconbez.cxx
index cad7080..87ccd67 100644
--- a/sd/source/ui/func/fuconbez.cxx
+++ b/sd/source/ui/func/fuconbez.cxx
@@ -171,7 +171,7 @@ bool FuConstructBezierPolygon::MouseButtonUp(const MouseEvent& rMEvt )
    if( bCreated && maTargets.hasValue() )
    {
        SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >( mpView->GetSdrPageView()->GetObjList()->GetObj( nCount ) );
        SdPage* pPage = dynamic_cast< SdPage* >( pPathObj ? pPathObj->GetPage() : nullptr );
        SdPage* pPage = dynamic_cast< SdPage* >( pPathObj ? pPathObj->getSdrPageFromSdrObject() : nullptr );
        if( pPage )
        {
            std::shared_ptr< sd::MainSequence > pMainSequence( pPage->getMainSequence() );
diff --git a/sd/source/ui/func/fuinsert.cxx b/sd/source/ui/func/fuinsert.cxx
index 5814097..b66f4c1 100644
--- a/sd/source/ui/func/fuinsert.cxx
+++ b/sd/source/ui/func/fuinsert.cxx
@@ -385,7 +385,7 @@ void FuInsertOLE::DoExecute( SfxRequest& rReq )
            // if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj
            if( pPickObj )
            {
                SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
                SdPage* pPage = static_cast< SdPage* >(pPickObj->getSdrPageFromSdrObject());
                if(pPage && pPage->IsPresObj(pPickObj))
                {
                    pPage->InsertPresObj( pOleObj, ePresObjKind );
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index 3a18ec7..a8ba3eb 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -208,7 +208,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)

                    if(pActualPage)
                    {
                        SdrObjListIter aIter(*pActualPage, SdrIterMode::DeepNoGroups);
                        SdrObjListIter aIter(pActualPage, SdrIterMode::DeepNoGroups);

                        while(aIter.IsMore() && !pCandidate)
                        {
@@ -840,7 +840,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)

                    if(pActualPage)
                    {
                        SdrObjListIter aIter(*pActualPage, SdrIterMode::DeepNoGroups);
                        SdrObjListIter aIter(pActualPage, SdrIterMode::DeepNoGroups);

                        while(aIter.IsMore() && !pCandidate)
                        {
diff --git a/sd/source/ui/func/fusel.cxx b/sd/source/ui/func/fusel.cxx
index 93a1c7a..ea56b9e 100644
--- a/sd/source/ui/func/fusel.cxx
+++ b/sd/source/ui/func/fusel.cxx
@@ -331,7 +331,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)
                            // New: double click on selected Group object
                            // enter group
                            if ( ! bSelectionOnly
                                && pObj->GetPage() == pPV->GetPage())
                                && pObj->getSdrPageFromSdrObject() == pPV->GetPage())
                                bReturn = pPV->EnterGroup(pObj);
                        }
                    }
@@ -339,7 +339,7 @@ bool FuSelection::MouseButtonDown(const MouseEvent& rMEvt)

                // #i71727# replaced else here with two possibilities, once the original else (!pObj)
                // and also ignoring the found object when it's on a masterpage
                if(!pObj || (pObj->GetPage() && pObj->GetPage()->IsMasterPage()))
                if(!pObj || (pObj->getSdrPageFromSdrObject() && pObj->getSdrPageFromSdrObject()->IsMasterPage()))
                {
                    if(mpView->IsGroupEntered() && 2 == rMEvt.GetClicks())
                    {
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index 7402a93..8b6d0024 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -522,7 +522,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )

                                if( pPage )
                                {
                                    SdrObjListIter aIter( *pPage );
                                    SdrObjListIter aIter( pPage );
                                    while( aIter.IsMore() )
                                    {
                                        SdrObject* pObj = aIter.Next();
diff --git a/sd/source/ui/func/futext.cxx b/sd/source/ui/func/futext.cxx
index 3d50a81..f5e797c 100644
--- a/sd/source/ui/func/futext.cxx
+++ b/sd/source/ui/func/futext.cxx
@@ -1017,7 +1017,7 @@ void FuText::Deactivate()
void FuText::SetInEditMode(const MouseEvent& rMEvt, bool bQuickDrag)
{
    SdrPageView* pPV = mpView->GetSdrPageView();
    if( mxTextObj.is() && (mxTextObj->GetPage() == pPV->GetPage()) )
    if( mxTextObj.is() && (mxTextObj->getSdrPageFromSdrObject() == pPV->GetPage()) )
    {
        mpView->SetCurrentObj(OBJ_TEXT);

@@ -1150,7 +1150,7 @@ void FuText::DeleteDefaultText()
{
    if ( mxTextObj.is() && mxTextObj->IsEmptyPresObj() )
    {
        SdPage* pPage = static_cast<SdPage*>( mxTextObj->GetPage() );
        SdPage* pPage = static_cast<SdPage*>( mxTextObj->getSdrPageFromSdrObject() );

        if (pPage)
        {
diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx
index 0ab2165..d33d4dd 100644
--- a/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -1556,8 +1556,8 @@ sal_Int32 SlideshowImpl::getSlideNumberForBookmark( const OUString& rStrBookmark

        if( pObj )
        {
            nPgNum = pObj->GetPage()->GetPageNum();
            bIsMasterPage = pObj->GetPage()->IsMasterPage();
            nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
            bIsMasterPage = pObj->getSdrPageFromSdrObject()->IsMasterPage();
        }
    }

diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx
index 2d48bf5..e31fee0 100644
--- a/sd/source/ui/slidesorter/controller/SlsListener.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx
@@ -380,7 +380,7 @@ IMPL_LINK(Listener, EventMultiplexerCallback, ::sd::tools::EventMultiplexerEvent
            if (rEvent.mpUserData != nullptr)
            {
                const SdrObject* pObject = static_cast<const SdrObject*>(rEvent.mpUserData);
                HandleShapeModification(pObject->GetPage());
                HandleShapeModification(pObject->getSdrPageFromSdrObject());
            }
            break;

diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index 818cde2..4e68925 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -204,7 +204,7 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
        // if we have a pick obj we need to make this new ole a pres obj replacing the current pick obj
        if( pPickObj )
        {
            SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
            SdPage* pPage = static_cast< SdPage* >(pPickObj->getSdrPageFromSdrObject());
            if(pPage && pPage->IsPresObj(pPickObj))
            {
                pObj->SetUserCall( pPickObj->GetUserCall() );
diff --git a/sd/source/ui/tools/PreviewRenderer.cxx b/sd/source/ui/tools/PreviewRenderer.cxx
index 23717ea..76f980e 100644
--- a/sd/source/ui/tools/PreviewRenderer.cxx
+++ b/sd/source/ui/tools/PreviewRenderer.cxx
@@ -493,7 +493,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewRedirector::createRedirected
{
    SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();

    if (pObject==nullptr || pObject->GetPage() == nullptr)
    if (pObject==nullptr || pObject->getSdrPageFromSdrObject() == nullptr)
    {
        // not a SdrObject visualisation (maybe e.g. page) or no page
        return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
@@ -501,7 +501,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewRedirector::createRedirected
            rDisplayInfo);
    }

    const bool bDoCreateGeometry (pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true));
    const bool bDoCreateGeometry (pObject->getSdrPageFromSdrObject()->checkVisibility( rOriginal, rDisplayInfo, true));

    if ( ! bDoCreateGeometry
        && (pObject->GetObjInventor() != SdrInventor::Default || pObject->GetObjIdentifier() != OBJ_PAGE))
diff --git a/sd/source/ui/unoidl/SdUnoDrawView.cxx b/sd/source/ui/unoidl/SdUnoDrawView.cxx
index 09289a7..7eea541 100644
--- a/sd/source/ui/unoidl/SdUnoDrawView.cxx
+++ b/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -163,7 +163,7 @@ sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )
        if( pShape && (pShape->GetSdrObject() != nullptr) )
        {
            SdrObject* pObj = pShape->GetSdrObject();
            pSdrPage = pObj->GetPage();
            pSdrPage = pObj->getSdrPageFromSdrObject();
            aObjects.push_back( pObj );
        }
        else
@@ -194,9 +194,9 @@ sal_Bool SAL_CALL SdUnoDrawView::select( const Any& aSelection )

                    if( pSdrPage == nullptr )
                    {
                        pSdrPage = pObj->GetPage();
                        pSdrPage = pObj->getSdrPageFromSdrObject();
                    }
                    else if( pSdrPage != pObj->GetPage() )
                    else if( pSdrPage != pObj->getSdrPageFromSdrObject() )
                    {
                        bOk = false;
                        break;
@@ -263,10 +263,10 @@ Any SAL_CALL SdUnoDrawView::getSelection()
                    continue;

                SdrObject *pObj = pMark->GetMarkedSdrObj();
                if(pObj==nullptr || pObj->GetPage() == nullptr)
                if(pObj==nullptr || pObj->getSdrPageFromSdrObject() == nullptr)
                    continue;

                Reference< drawing::XDrawPage > xPage( pObj->GetPage()->getUnoPage(), UNO_QUERY);
                Reference< drawing::XDrawPage > xPage( pObj->getSdrPageFromSdrObject()->getUnoPage(), UNO_QUERY);

                if(!xPage.is())
                    continue;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 2c0c603..416e936 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1571,7 +1571,7 @@ sal_Int32 ImplPDFGetBookmarkPage( const OUString& rBookmark, SdDrawDocument cons
        // is the bookmark a object ?
        pObj = rDoc.GetObj( aBookmark );
        if (pObj)
            nPgNum = pObj->GetPage()->GetPageNum();
            nPgNum = pObj->getSdrPageFromSdrObject()->GetPageNum();
    }
    if ( nPgNum != SDRPAGE_NOTFOUND )
        nPage = ( nPgNum - 1 ) / 2;
@@ -1791,9 +1791,9 @@ drawinglayer::primitive2d::Primitive2DContainer ImplRenderPaintProc::createRedir
    {
        drawinglayer::primitive2d::Primitive2DContainer xRetval;

        if(pObject->GetPage())
        if(pObject->getSdrPageFromSdrObject())
        {
            if(pObject->GetPage()->checkVisibility(rOriginal, rDisplayInfo, false))
            if(pObject->getSdrPageFromSdrObject()->checkVisibility(rOriginal, rDisplayInfo, false))
            {
                if(IsVisible(pObject) && IsPrintable(pObject))
                {
@@ -2207,12 +2207,12 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
                                    if( pShape )
                                    {
                                        SdrObject* pObj = pShape->GetSdrObject();
                                        if( pObj && pObj->GetPage()
                                        if( pObj && pObj->getSdrPageFromSdrObject()
                                            && aImplRenderPaintProc.IsVisible( pObj )
                                                && aImplRenderPaintProc.IsPrintable( pObj ) )
                                        {
                                            if( !pPV )
                                                pPV = pView->ShowSdrPage( pObj->GetPage() );
                                                pPV = pView->ShowSdrPage( pObj->getSdrPageFromSdrObject() );

                                            if( pPV )
                                                pView->MarkObj( pObj, pPV );
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 5b0922b..72df58e 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -354,7 +354,7 @@ beans::PropertyState SAL_CALL SdXShape::getPropertyState( const OUString& Proper
    else
    {
        SdrObject* pObj = mpShape->GetSdrObject();
        if( pObj == nullptr || ( pObj->GetPage()->IsMasterPage() && pObj->IsEmptyPresObj() ) )
        if( pObj == nullptr || ( pObj->getSdrPageFromSdrObject()->IsMasterPage() && pObj->IsEmptyPresObj() ) )
            return beans::PropertyState_DEFAULT_VALUE;

        return mpShape->_getPropertyState( PropertyName );
@@ -492,7 +492,7 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c
                    if(bIsAnimation)
                    {
                        SdrObjGroup* pGroup = dynamic_cast< SdrObjGroup* >(pObj);
                        SdPage* pPage = pGroup ? dynamic_cast< SdPage* >(pGroup->GetPage()) : nullptr;
                        SdPage* pPage = pGroup ? dynamic_cast< SdPage* >(pGroup->getSdrPageFromSdrObject()) : nullptr;

                        if (pPage)
                        {
@@ -872,7 +872,7 @@ bool SdXShape::IsPresObj() const
    SdrObject* pObj = mpShape->GetSdrObject();
    if(pObj)
    {
        SdPage* pPage = dynamic_cast<SdPage* >(pObj->GetPage());
        SdPage* pPage = dynamic_cast<SdPage* >(pObj->getSdrPageFromSdrObject());
        if(pPage)
            return pPage->GetPresObjKind(pObj) != PRESOBJ_NONE;
    }
@@ -908,7 +908,7 @@ OUString SdXShape::GetPlaceholderText() const
    if( pObj == nullptr )
        return OUString();

    SdPage* pPage = dynamic_cast< SdPage* >(pObj->GetPage());
    SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject());
    DBG_ASSERT( pPage, "no page?" );
    if( pPage == nullptr )
        return OUString();
@@ -972,7 +972,7 @@ void SdXShape::SetEmptyPresObj(bool bEmpty)
                if( pOutliner == nullptr )
                    break;

                SdPage* pPage = dynamic_cast< SdPage* >(pObj->GetPage());
                SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject());
                DBG_ASSERT( pPage, "no page?" );
                if( pPage == nullptr )
                    break;
@@ -1011,7 +1011,7 @@ void SdXShape::SetMasterDepend( bool bDepend ) throw()
        {
            if( bDepend )
            {
                SdPage* pPage = dynamic_cast< SdPage* >(pObj->GetPage());
                SdPage* pPage = dynamic_cast< SdPage* >(pObj->getSdrPageFromSdrObject());
                pObj->SetUserCall( pPage );
            }
            else
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 2e9f5dd..77b904c 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -404,24 +404,6 @@ SdrObject * SdGenericDrawPage::CreateSdrObject_( const Reference< drawing::XShap
    if( !aType.startsWith( aPrefix ) )
    {
        SdrObject* pObj = SvxFmDrawPage::CreateSdrObject_( xShape );
        if( pObj && ( (pObj->GetObjInventor() != SdrInventor::Default) || (pObj->GetObjIdentifier() != OBJ_PAGE) ) )
        {
            SdDrawDocument& rDoc(static_cast< SdDrawDocument& >(GetPage()->getSdrModelFromSdrPage()));
            // #i119287# similar to the code in the SdrObject methods the graphic and ole
            // SdrObjects need another default style than the rest, see task. Adding here, too.
            // TTTT: Same as for #i119287#: Can be removed in branch aw080 again
            const bool bIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(pObj) !=  nullptr);
            const bool bIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(pObj) !=  nullptr);

            if(bIsSdrGrafObj || bIsSdrOle2Obj)
            {
                pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj(), true);
            }
            else
            {
                pObj->NbcSetStyleSheet(rDoc.GetDefaultStyleSheet(), true);
            }
        }
        return pObj;
    }

@@ -1902,7 +1884,7 @@ sal_Bool SAL_CALL SdPageLinkTargets::hasElements()
    SdPage* pPage = mpUnoPage->GetPage();
    if( pPage != nullptr )
    {
        SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );

        while( aIter.IsMore() )
        {
@@ -1948,7 +1930,7 @@ Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
    SdPage* pPage = mpUnoPage->GetPage();
    if( pPage != nullptr )
    {
        SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
        while( aIter.IsMore() )
        {
            SdrObject* pObj = aIter.Next();
@@ -1965,7 +1947,7 @@ Sequence< OUString > SAL_CALL SdPageLinkTargets::getElementNames()
    {
        OUString* pStr = aSeq.getArray();

        SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
        SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );
        while( aIter.IsMore() )
        {
            SdrObject* pObj = aIter.Next();
@@ -1993,7 +1975,7 @@ SdrObject* SdPageLinkTargets::FindObject( const OUString& rName ) const throw()
    if( pPage == nullptr )
        return nullptr;

    SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
    SdrObjListIter aIter( pPage, SdrIterMode::DeepWithGroups );

    while( aIter.IsMore() )
    {
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
index b94f071..ecb42f8 100644
--- a/sd/source/ui/view/DocumentRenderer.cxx
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -952,7 +952,7 @@ namespace {

            // Collect the page objects of the handout master.
            std::vector<SdrPageObj*> aHandoutPageObjects;
            SdrObjListIter aShapeIter (rHandoutPage);
            SdrObjListIter aShapeIter (&rHandoutPage);
            while (aShapeIter.IsMore())
            {
                SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
@@ -1803,7 +1803,7 @@ private:

        // Count page shapes.
        sal_uInt32 nShapeCount (0);
        SdrObjListIter aShapeIter (rHandoutPage);
        SdrObjListIter aShapeIter (&rHandoutPage);
        while (aShapeIter.IsMore())
        {
            SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx
index c9cc081..434f488 100644
--- a/sd/source/ui/view/OutlinerIterator.cxx
+++ b/sd/source/ui/view/OutlinerIterator.cxx
@@ -553,7 +553,7 @@ IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const

    if (mpObjectIterator != nullptr)
    {
        pIterator->mpObjectIterator = new SdrObjListIter(*mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward);
        pIterator->mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward);

        // No direct way to set the object iterator to the current object.
        pIterator->maPosition.mxObject.reset(nullptr);
@@ -598,7 +598,7 @@ void ViewIteratorImpl::GotoNextText()
            SetPage (maPosition.mnPageIndex-1);

        if (mpPage != nullptr)
            mpObjectIterator = new SdrObjListIter(*mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward);
            mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward);
        if (mpObjectIterator!=nullptr && mpObjectIterator->IsMore())
            maPosition.mxObject.reset(mpObjectIterator->Next());
        else
@@ -650,7 +650,7 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex)

    // Set up object list iterator.
    if (mpPage != nullptr)
        mpObjectIterator = new SdrObjListIter(*mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward);
        mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward);
    else
        mpObjectIterator = nullptr;

@@ -677,7 +677,7 @@ void ViewIteratorImpl::Reverse()
    // Create reversed object list iterator.
    delete mpObjectIterator;
    if (mpPage != nullptr)
        mpObjectIterator = new SdrObjListIter(*mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward);
        mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward);
    else
        mpObjectIterator = nullptr;

diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index 95a4807..cdb8b2d 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -540,7 +540,7 @@ void DrawView::DeleteMarked()
            SdrObject* pObj = aList.GetMark(nMark)->GetMarkedSdrObj();
            if( pObj && !pObj->IsEmptyPresObj() && pObj->GetUserCall() )
            {
                pPage = static_cast< SdPage* >( pObj->GetPage() );
                pPage = static_cast< SdPage* >( pObj->getSdrPageFromSdrObject() );
                if (pPage)
                {
                    PresObjKind ePresObjKind(pPage->GetPresObjKind(pObj));
diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx
index 5ac6d84..f8aca14 100644
--- a/sd/source/ui/view/drviews4.cxx
+++ b/sd/source/ui/view/drviews4.cxx
@@ -148,7 +148,7 @@ bool DrawViewShell::KeyInput (const KeyEvent& rKEvt, ::sd::Window* pWin)
                GetView()->SdrEndTextEdit();

                // look for a new candidate, a successor of pOldObj
                SdrObjListIter aIter(*pActualPage, SdrIterMode::DeepNoGroups);
                SdrObjListIter aIter(pActualPage, SdrIterMode::DeepNoGroups);
                bool bDidVisitOldObject(false);

                while(aIter.IsMore() && !pCandidate)
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 8b69d36..0792f0cc 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -655,7 +655,7 @@ void DrawViewShell::FuDeleteSelectedObjects()
        for (size_t i=0; i < rMarkList.GetMarkCount(); ++i)
        {
            SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
            SdPage* pPage = static_cast<SdPage*>(pObj->GetPage());
            SdPage* pPage = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject());
            PresObjKind eKind = pPage->GetPresObjKind(pObj);
            if (eKind == PRESOBJ_FOOTER || eKind == PRESOBJ_HEADER ||
                eKind == PRESOBJ_DATETIME || eKind == PRESOBJ_SLIDENUMBER)
@@ -668,7 +668,7 @@ void DrawViewShell::FuDeleteSelectedObjects()
        {
            //Unmark object
            mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView(), true);
            SdPage* pPage = static_cast<SdPage*>(pObj->GetPage());
            SdPage* pPage = static_cast<SdPage*>(pObj->getSdrPageFromSdrObject());
            //remove placeholder from master page
            pPage->DestroyDefaultPresObj(pPage->GetPresObjKind(pObj));
        }
@@ -1540,8 +1540,8 @@ void DrawViewShell::InsertURLButton(const OUString& rURL, const OUString& rText,
            SdrObjFactory::MakeNewObject(
                GetView()->getSdrModelFromSdrView(),
                SdrInventor::FmForm,
                OBJ_FM_BUTTON,
                mpDrawView->GetSdrPageView()->GetPage()));
                OBJ_FM_BUTTON)); //,
                //mpDrawView->GetSdrPageView()->GetPage()));

        Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
        Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 835474e..369c6b42 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -195,20 +195,20 @@ drawinglayer::primitive2d::Primitive2DContainer ViewRedirector::createRedirected
    SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
    drawinglayer::primitive2d::Primitive2DContainer xRetval;

    if(pObject && pObject->GetPage())
    if(pObject && pObject->getSdrPageFromSdrObject())
    {
        const bool bDoCreateGeometry(pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true ));
        const bool bDoCreateGeometry(pObject->getSdrPageFromSdrObject()->checkVisibility( rOriginal, rDisplayInfo, true ));

        if(!bDoCreateGeometry && !(( pObject->GetObjInventor() == SdrInventor::Default ) && ( pObject->GetObjIdentifier() == OBJ_PAGE )) )
            return xRetval;

        PresObjKind eKind(PRESOBJ_NONE);
        const bool bSubContentProcessing(rDisplayInfo.GetSubContentActive());
        const bool bIsMasterPageObject(pObject->GetPage()->IsMasterPage());
        const bool bIsMasterPageObject(pObject->getSdrPageFromSdrObject()->IsMasterPage());
        const bool bIsPrinting(rOriginal.GetObjectContact().isOutputToPrinter());
        const SdrPageView* pPageView = rOriginal.GetObjectContact().TryToGetSdrPageView();
        const SdrPage* pVisualizedPage = GetSdrPageFromXDrawPage(rOriginal.GetObjectContact().getViewInformation2D().getVisualizedPage());
        const SdPage* pObjectsSdPage = dynamic_cast< SdPage* >(pObject->GetPage());
        const SdPage* pObjectsSdPage = dynamic_cast< SdPage* >(pObject->getSdrPageFromSdrObject());
        const bool bIsInsidePageObj(pPageView && pPageView->GetPage() != pVisualizedPage);

        // check if we need to draw a placeholder border. Never do it for
@@ -554,7 +554,7 @@ bool View::IsPresObjSelected(bool bOnPage, bool bOnMasterPage, bool bCheckPresOb

        if ( pObj && ( bCheckPresObjListOnly || pObj->IsEmptyPresObj() || pObj->GetUserCall() ) )
        {
            pPage = static_cast<SdPage*>( pObj->GetPage() );
            pPage = static_cast<SdPage*>( pObj->getSdrPageFromSdrObject() );
            bMasterPage = pPage && pPage->IsMasterPage();

            if ( (bMasterPage && bOnMasterPage) || (!bMasterPage && bOnPage) )
@@ -652,7 +652,7 @@ bool View::SdrBeginTextEdit(
    SdrOutliner* pOutl, OutlinerView* pGivenOutlinerView,
    bool bDontDeleteOutliner, bool bOnlyOneView, bool bGrabFocus )
{
    SdrPage* pPage = pObj ? pObj->GetPage() : nullptr;
    SdrPage* pPage = pObj ? pObj->getSdrPageFromSdrObject() : nullptr;
    bool bMasterPage = pPage && pPage->IsMasterPage();

    GetViewShell()->GetViewShellBase().GetEventMultiplexer()->MultiplexEvent(
@@ -735,7 +735,7 @@ bool View::SdrBeginTextEdit(
    if (bMasterPage && bReturn && pOutl)
    {
        const SdrTextObj* pTextObj = pOutl->GetTextObj();
        const SdPage* pSdPage = pTextObj ? static_cast<const SdPage*>(pTextObj->GetPage()) : nullptr;
        const SdPage* pSdPage = pTextObj ? static_cast<const SdPage*>(pTextObj->getSdrPageFromSdrObject()) : nullptr;
        const PresObjKind eKind = pSdPage ? pSdPage->GetPresObjKind(const_cast<SdrTextObj*>(pTextObj)) : PRESOBJ_NONE;
        switch (eKind)
        {
@@ -779,7 +779,7 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally)
        SdrTextObj* pObj = xObj.get();
        if( pObj && pObj->HasText() )
        {
            SdrPage* pPage = pObj->GetPage();
            SdrPage* pPage = pObj->getSdrPageFromSdrObject();
            if( !pPage || !pPage->IsMasterPage() )
                pObj->SetEmptyPresObj( false );
        }
@@ -800,7 +800,7 @@ SdrEndTextEditKind View::SdrEndTextEdit(bool bDontDeleteReally)

        }

        SdPage* pPage = dynamic_cast< SdPage* >( xObj->GetPage() );
        SdPage* pPage = dynamic_cast< SdPage* >( xObj->getSdrPageFromSdrObject() );
        if( pPage )
            pPage->onEndTextEdit( xObj.get() );
    }
@@ -818,7 +818,7 @@ bool View::RestoreDefaultText( SdrTextObj* pTextObj )
    {
        if( !pTextObj->HasText() )
        {
            SdPage* pPage = dynamic_cast< SdPage* >( pTextObj->GetPage() );
            SdPage* pPage = dynamic_cast< SdPage* >( pTextObj->getSdrPageFromSdrObject() );

            if(pPage)
            {
@@ -1068,7 +1068,7 @@ IMPL_LINK( View, OnParagraphInsertedHdl, ::Outliner::ParagraphHdlParam, aParam, 

    if( aParam.pPara && pObj )
    {
        SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
        SdPage* pPage = dynamic_cast< SdPage* >( pObj->getSdrPageFromSdrObject() );
        if( pPage )
            pPage->onParagraphInserted( aParam.pOutliner, aParam.pPara, pObj );
    }
@@ -1083,7 +1083,7 @@ IMPL_LINK( View, OnParagraphRemovingHdl, ::Outliner::ParagraphHdlParam, aParam, 

    if( aParam.pPara && pObj )
    {
        SdPage* pPage = dynamic_cast< SdPage* >( pObj->GetPage() );
        SdPage* pPage = dynamic_cast< SdPage* >( pObj->getSdrPageFromSdrObject() );
        if( pPage )
            pPage->onParagraphRemoving( aParam.pOutliner, aParam.pPara, pObj );
    }
@@ -1201,10 +1201,10 @@ void View::OnEndPasteOrDrop( PasteOrDropInfos* pInfo )
    /* Style Sheet handling */
    SdrTextObj* pTextObj = GetTextEditObject();
    SdrOutliner* pOutliner = GetTextEditOutliner();
    if( !pOutliner || !pTextObj || !pTextObj->GetPage() )
    if( !pOutliner || !pTextObj || !pTextObj->getSdrPageFromSdrObject() )
        return;

    SdPage* pPage = static_cast< SdPage* >( pTextObj->GetPage() );
    SdPage* pPage = static_cast< SdPage* >( pTextObj->getSdrPageFromSdrObject() );
    const PresObjKind eKind = pPage->GetPresObjKind(pTextObj);

    // outline kinds are taken care of in Outliner::ImplSetLevelDependentStyleSheet
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 29c3c2b..45905d2 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -275,7 +275,7 @@ void View::DoPaste (::sd::Window* pWindow)
        const_cast< OutlinerView* >(pOLV)->PasteSpecial();

        SdrObject*  pObj = GetTextEditObject();
        SdPage*     pPage = static_cast<SdPage*>( pObj ? pObj->GetPage() : nullptr );
        SdPage*     pPage = static_cast<SdPage*>( pObj ? pObj->getSdrPageFromSdrObject() : nullptr );
        ::Outliner* pOutliner = pOLV->GetOutliner();

        if( pOutliner)
@@ -405,10 +405,10 @@ void View::DragFinished( sal_Int8 nDropAction )
            SdrMark* pM=mpDragSrcMarkList->GetMark(nm);
            SdrObject* pObj=pM->GetMarkedSdrObj();

            if( pObj && pObj->GetPage() )
            if( pObj && pObj->getSdrPageFromSdrObject() )
            {
                const size_t nOrdNum = pObj->GetOrdNumDirect();
                SdrObject* pChkObj = pObj->GetPage()->RemoveObject(nOrdNum);
                SdrObject* pChkObj = pObj->getSdrPageFromSdrObject()->RemoveObject(nOrdNum);
                DBG_ASSERT(pChkObj==pObj,"pChkObj!=pObj in RemoveObject()");
            }
        }
@@ -538,7 +538,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge

                    if (pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()))
                    {
                        SdPage* pPage = static_cast<SdPage*>( pPickObj->GetPage() );
                        SdPage* pPage = static_cast<SdPage*>( pPickObj->getSdrPageFromSdrObject() );

                        if( pPage && pPage->IsMasterPage() )
                            bIsPresTarget = pPage->IsPresObj( pPickObj );
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index 4100fe9..634e59e 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -646,7 +646,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
            SdDrawDocument* pWorkModel = const_cast<SdDrawDocument*>(pOwnData->GetWorkDocument());
            SdPage*         pWorkPage = pWorkModel->GetSdPage( 0, PageKind::Standard );

            pWorkPage->SetRectsDirty();
            pWorkPage->SetSdrObjListRectsDirty();

            // #i120393# Clipboard data uses full object geometry range
            const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
@@ -816,7 +816,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                {
                    SdrPage* pWorkPage = pModel->GetSdPage( 0, PageKind::Standard );

                    pWorkPage->SetRectsDirty();
                    pWorkPage->SetSdrObjListRectsDirty();

                    if( pOwnData )
                    {
@@ -890,7 +890,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                    SdDrawDocument* pModel = xDocShRef->GetDoc();
                    SdPage*         pWorkPage = pModel->GetSdPage( 0, PageKind::Standard );

                    pWorkPage->SetRectsDirty();
                    pWorkPage->SetSdrObjListRectsDirty();

                    if( pOwnData )
                    {
@@ -1228,7 +1228,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                                                    pWorkModel->GetSdPage( 0, PageKind::Standard ) :
                                                    pWorkModel->GetPage( 0 ) );

                pWorkPage->SetRectsDirty();
                pWorkPage->SetSdrObjListRectsDirty();

                // #i120393# Clipboard data uses full object geometry range
                const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
@@ -1260,7 +1260,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                                                pWorkModel->GetSdPage( 0, PageKind::Standard ) :
                                                pWorkModel->GetPage( 0 ) );

            pWorkPage->SetRectsDirty();
            pWorkPage->SetSdrObjListRectsDirty();

            // #i120393# Clipboard data uses full object geometry range
            const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
@@ -1309,7 +1309,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
                                                    pWorkModel->GetSdPage( 0, PageKind::Standard ) :
                                                    pWorkModel->GetPage( 0 ) );

                pWorkPage->SetRectsDirty();
                pWorkPage->SetSdrObjListRectsDirty();

                // #i120393# Clipboard data uses full object geometry range
                const Size aSize( pWorkPage->GetAllObjBoundRect().GetSize() );
diff --git a/sd/source/ui/view/sdview4.cxx b/sd/source/ui/view/sdview4.cxx
index 9d1cb05..fa9a48e 100644
--- a/sd/source/ui/view/sdview4.cxx
+++ b/sd/source/ui/view/sdview4.cxx
@@ -106,7 +106,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
        if( IsUndoEnabled() )
            BegUndo(SdResId(STR_INSERTGRAPHIC));

        SdPage* pPage = static_cast<SdPage*>( pPickObj->GetPage() );
        SdPage* pPage = static_cast<SdPage*>( pPickObj->getSdrPageFromSdrObject() );

        if( bIsGraphic )
        {
@@ -214,7 +214,7 @@ SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,

        if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()) )
        {
            SdPage* pP = static_cast< SdPage* >( pPickObj->GetPage() );
            SdPage* pP = static_cast< SdPage* >( pPickObj->getSdrPageFromSdrObject() );

            if ( pP && pP->IsMasterPage() )
                bIsPresTarget = pP->IsPresObj(pPickObj);
@@ -342,7 +342,7 @@ SdrMediaObj* View::InsertMediaObj( const OUString& rMediaURL, const OUString& rM
        bool bIsPres = false;
        if( pPickObj )
        {
            SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
            SdPage* pPage = static_cast< SdPage* >(pPickObj->getSdrPageFromSdrObject());
            bIsPres = pPage && pPage->IsPresObj(pPickObj);
            if( bIsPres )
            {
diff --git a/svx/inc/sdr/properties/attributeproperties.hxx b/svx/inc/sdr/properties/attributeproperties.hxx
index 138d7a2..aa02c94 100644
--- a/svx/inc/sdr/properties/attributeproperties.hxx
+++ b/svx/inc/sdr/properties/attributeproperties.hxx
@@ -31,9 +31,6 @@ namespace sdr
    {
        class AttributeProperties : public DefaultProperties, public SfxListener, public svl::StyleSheetUser
        {
            // get the correct (#119287#) default SfyStyleSheet from SdrObject's SdrModel
            SfxStyleSheet* ImpGetDefaultStyleSheet() const;

            // core to set parent at SfxItemSet and to execute the hard attribute computations
            void ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr);

diff --git a/svx/inc/sdr/properties/graphicproperties.hxx b/svx/inc/sdr/properties/graphicproperties.hxx
index 7f81ebd..d8744dc 100644
--- a/svx/inc/sdr/properties/graphicproperties.hxx
+++ b/svx/inc/sdr/properties/graphicproperties.hxx
@@ -30,6 +30,9 @@ namespace sdr
        class GraphicProperties : public RectangleProperties
        {
        protected:
            // apply the correct SfyStyleSheet from SdrObject's SdrModel
            virtual void applyDefaultStyleSheetFromSdrModel() override;

            // create a new itemset
            virtual std::unique_ptr<SfxItemSet> CreateObjectSpecificItemSet(SfxItemPool& rPool) override;

diff --git a/svx/inc/sdr/properties/oleproperties.hxx b/svx/inc/sdr/properties/oleproperties.hxx
index 3c932e3..2aa081d 100644
--- a/svx/inc/sdr/properties/oleproperties.hxx
+++ b/svx/inc/sdr/properties/oleproperties.hxx
@@ -30,6 +30,9 @@ namespace sdr
        class OleProperties : public RectangleProperties
        {
        protected:
            // apply the correct SfyStyleSheet from SdrObject's SdrModel
            virtual void applyDefaultStyleSheetFromSdrModel() override;

        public:
            // basic constructor
            explicit OleProperties(SdrObject& rObj);
diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
index 003a43f..2a62c0a 100644
--- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx
@@ -255,8 +255,6 @@ SdrObject* EnhancedCustomShapeEngine::ImplForceGroupWithText(
                pRenderedShape = new SdrObjGroup(rSdrObjCustomShape.getSdrModelFromSdrObject());
                static_cast<SdrObjGroup*>(pRenderedShape)->GetSubList()->NbcInsertObject( pTmp );
            }

            pRenderedShape->SetPage(rSdrObjCustomShape.GetPage());
        }
    }

diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx
index 09dbdf4..db71e75 100644
--- a/svx/source/engine3d/helperhittest3d.cxx
+++ b/svx/source/engine3d/helperhittest3d.cxx
@@ -162,7 +162,7 @@ void getAllHit3DObjectsSortedFrontToBack(
    o_rResult.clear();
    SdrObjList* pList = rScene.GetSubList();

    if(pList && pList->GetObjCount())
    if(nullptr != pList && 0 != pList->GetObjCount())
    {
        // prepare relative HitPoint. To do so, get the VC of the 3DScene and from there
        // the Scene's 2D transformation. Multiplying with the inverse transformation
@@ -175,7 +175,7 @@ void getAllHit3DObjectsSortedFrontToBack(
        // check if test point is inside scene's area at all
        if(aRelativePoint.getX() >= 0.0 && aRelativePoint.getX() <= 1.0 && aRelativePoint.getY() >= 0.0 && aRelativePoint.getY() <= 1.0)
        {
            SdrObjListIter aIterator(*pList, SdrIterMode::DeepNoGroups);
            SdrObjListIter aIterator(pList, SdrIterMode::DeepNoGroups);
            ::std::vector< ImplPairDephAndObject > aDepthAndObjectResults;
            const uno::Sequence< beans::PropertyValue > aEmptyParameters;
            drawinglayer::geometry::ViewInformation3D aViewInfo3D(aEmptyParameters);
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 522bf6d..670dbb9 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -285,9 +285,9 @@ E3dObject* E3dObject::GetParentObj() const
{
    E3dObject* pRetval = nullptr;

    if(getParentOfSdrObject() && getParentOfSdrObject()->GetOwnerObj())
    if(getParentOfSdrObject())
    {
        pRetval = dynamic_cast<E3dObject*>(getParentOfSdrObject()->GetOwnerObj());
        pRetval = dynamic_cast< E3dObject* >(getParentOfSdrObject()->getSdrObjectFromSdrObjList());
    }

    return pRetval;
@@ -677,11 +677,9 @@ basegfx::B2DPolyPolygon E3dCompoundObject::TransformToScreenCoor(const basegfx::

bool E3dCompoundObject::IsAOrdNumRemapCandidate(E3dScene*& prScene) const
{
    if(getParentOfSdrObject()
        && getParentOfSdrObject()->GetOwnerObj()
        && dynamic_cast<const E3dObject*>(getParentOfSdrObject()->GetOwnerObj()))
    if(getParentOfSdrObject() && getParentOfSdrObject()->getSdrObjectFromSdrObjList())
    {
        prScene = static_cast<E3dScene*>(getParentOfSdrObject()->GetOwnerObj());
        prScene = static_cast< E3dScene* >(getParentOfSdrObject()->getSdrObjectFromSdrObjList());
        return true;
    }

diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index 01fa06c..465cdbd 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -178,9 +178,6 @@ E3dScene::E3dScene(SdrModel& rSdrModel)
    bDrawOnlySelected(false),
    mbSkipSettingDirty(false)
{
    SetOwnerObj(this);
    SetListKind(SdrObjListKind::GroupObj);

    // Set defaults
    SetDefaultAttributes();
}
@@ -218,6 +215,26 @@ E3dScene::~E3dScene()
    ImpCleanup3DDepthMapper();
}

SdrPage* E3dScene::getSdrPageFromSdrObjList() const
{
    return getSdrPageFromSdrObject();
}

SdrObject* E3dScene::getSdrObjectFromSdrObjList() const
{
    return const_cast< E3dScene* >(this);
}

SdrModel& E3dScene::getSdrModelFromSdrObjList() const
{
    return getSdrModelFromSdrObject();
}

SdrObjList* E3dScene::getChildrenOfSdrObject() const
{
    return const_cast< E3dScene* >(this);
}

basegfx::B2DPolyPolygon E3dScene::TakeXorPoly() const
{
    const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(GetViewContact());
@@ -467,14 +484,13 @@ void E3dScene::SetAllSceneRectsDirty()
void E3dScene::RebuildLists()
{
    // first delete
    SdrLayerID nCurrLayerID = GetLayer();

    SdrObjListIter a3DIterator(static_cast< SdrObjList& >(*this), SdrIterMode::Flat);
    const SdrLayerID nCurrLayerID(GetLayer());
    SdrObjListIter a3DIterator(GetSubList(), SdrIterMode::Flat);

    // then examine all the objects in the scene
    while ( a3DIterator.IsMore() )
    while(a3DIterator.IsMore())
    {
        E3dObject* p3DObj = static_cast<E3dObject*>(a3DIterator.Next());
        E3dObject* p3DObj(static_cast< E3dObject* >(a3DIterator.Next()));
        p3DObj->NbcSetLayer(nCurrLayerID);
        NewObjectInserted(p3DObj);
    }
@@ -657,7 +673,7 @@ void E3dScene::RecalcSnapRect()
bool E3dScene::IsBreakObjPossible()
{
    // Break scene, if all members are able to break
    SdrObjListIter a3DIterator(static_cast< SdrObjList& >(*this), SdrIterMode::DeepWithGroups);
    SdrObjListIter a3DIterator(GetSubList(), SdrIterMode::DeepWithGroups);

    while ( a3DIterator.IsMore() )
    {
@@ -734,11 +750,8 @@ void E3dScene::SetSelected(bool bNew)

void E3dScene::NbcInsertObject(SdrObject* pObj, size_t nPos)
{
    // Get owner
    DBG_ASSERT(dynamic_cast<const E3dObject*>(GetOwnerObj()), "Insert 3D object in parent != 3DObject");

    // Is it even a 3D object?
    if(pObj && nullptr != dynamic_cast< const E3dObject* >(pObj))
    if(nullptr != dynamic_cast< const E3dObject* >(pObj))
    {
        // Normal 3D object, insert means
        // call parent
@@ -747,14 +760,12 @@ void E3dScene::NbcInsertObject(SdrObject* pObj, size_t nPos)
    else
    {
        // No 3D object, inserted a page in place in a scene ...
        GetOwnerObj()->GetPage()->InsertObject(pObj, nPos);
        getSdrObjectFromSdrObjList()->getSdrPageFromSdrObject()->InsertObject(pObj, nPos);
    }
}

void E3dScene::InsertObject(SdrObject* pObj, size_t nPos)
{
    OSL_ENSURE(dynamic_cast<const E3dObject*>(GetOwnerObj()), "Insert 3D object in non-3D Parent");

    // call parent
    SdrObjList::InsertObject(pObj, nPos);

@@ -763,8 +774,6 @@ void E3dScene::InsertObject(SdrObject* pObj, size_t nPos)

SdrObject* E3dScene::NbcRemoveObject(size_t nObjNum)
{
    DBG_ASSERT(dynamic_cast<const E3dObject*>(GetOwnerObj()), "Remove 3D object from Parent != 3DObject");

    // call parent
    SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum);

@@ -775,8 +784,6 @@ SdrObject* E3dScene::NbcRemoveObject(size_t nObjNum)

SdrObject* E3dScene::RemoveObject(size_t nObjNum)
{
    OSL_ENSURE(dynamic_cast<const E3dObject*>(GetOwnerObj()), "3D object is removed from non-3D Parent");

    // call parent
    SdrObject* pRetval = SdrObjList::RemoveObject(nObjNum);

@@ -785,10 +792,10 @@ SdrObject* E3dScene::RemoveObject(size_t nObjNum)
    return pRetval;
}

void E3dScene::SetRectsDirty(bool bNotMyself)
void E3dScene::SetRectsDirty(bool bNotMyself, bool bRecursive)
{
    // call parent
    E3dObject::SetRectsDirty(bNotMyself);
    E3dObject::SetRectsDirty(bNotMyself, bRecursive);

    for(size_t a = 0; a < GetObjCount(); ++a)
    {
@@ -796,7 +803,7 @@ void E3dScene::SetRectsDirty(bool bNotMyself)

        if(pCandidate)
        {
            pCandidate->SetRectsDirty(bNotMyself);
            pCandidate->SetRectsDirty(bNotMyself, false);
        }
    }
}
@@ -817,21 +824,27 @@ void E3dScene::NbcSetLayer(SdrLayerID nLayer)
    }
}

void E3dScene::setParentOfSdrObject(SdrObjList* pNewObjList)
void E3dScene::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    // call parent
    E3dObject::setParentOfSdrObject(pNewObjList);
    if(pOldPage != pNewPage)
    {
        // call parent
        E3dObject::handlePageChange(pOldPage, pNewPage);

    SetUpList(pNewObjList);
}
        for(size_t a(0); a < GetObjCount(); a++)
        {
            E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a));

void E3dScene::SetPage(SdrPage* pNewPage)
{
    // call parent
    E3dObject::SetPage(pNewPage);

    // set at SdrObjList
    SdrObjList::SetPage(pNewPage);
            if(pCandidate)
            {
                pCandidate->handlePageChange(pOldPage, pNewPage);
            }
            else
            {
                OSL_ENSURE(false, "E3dScene::handlePageChange invalid object list (!)");
            }
        }
    }
}

SdrObjList* E3dScene::GetSubList() const
@@ -842,9 +855,7 @@ SdrObjList* E3dScene::GetSubList() const
void E3dScene::Insert3DObj(E3dObject* p3DObj)
{
    DBG_ASSERT(p3DObj, "Insert3DObj with NULL-pointer!");
    SdrPage* pPg = pPage;
    InsertObject(p3DObj);
    pPage = pPg;
    InvalidateBoundVolume();
    NewObjectInserted(p3DObj);
    StructureChanged();
@@ -856,10 +867,7 @@ void E3dScene::Remove3DObj(E3dObject const * p3DObj)

    if(p3DObj->GetParentObj() == this)
    {
        SdrPage* pPg = pPage;
        RemoveObject(p3DObj->GetOrdNum());
        pPage = pPg;

        InvalidateBoundVolume();
        StructureChanged();
    }
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 7431cb2..8be7aae 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -456,10 +456,10 @@ bool E3dView::Paste(
        return false;

    // Get owner of the list
    SdrObject* pOwner = pDstList->GetOwnerObj();
    if(pOwner && dynamic_cast< const E3dScene* >(pOwner) !=  nullptr)
    E3dScene* pDstScene(dynamic_cast< E3dScene* >(pDstList->getSdrObjectFromSdrObjList()));

    if(nullptr != pDstScene)
    {
        E3dScene* pDstScene = static_cast<E3dScene*>(pOwner);
        BegUndo(SvxResId(RID_SVX_3D_UNDO_EXCHANGE_PASTE));

        // Copy all objects from E3dScenes and insert them directly
@@ -581,7 +581,6 @@ bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene const * pSrcScene, E3dSce
                    pNewCompoundObj->SetTransform(aModifyingTransform * aNewObjectTrans);

                    // fill and insert new object
                    pNewCompoundObj->SetPage(pDstScene->E3dObject::GetPage());
                    pNewCompoundObj->NbcSetLayer(pCompoundObj->GetLayer());
                    pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->GetStyleSheet(), true);
                    pDstScene->Insert3DObj(pNewCompoundObj);
@@ -655,7 +654,7 @@ void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj)
        if(rTextColorItem.GetValue() == COL_BLACK)
        {
            //For black text objects, the color set to gray
            if(pObj->GetPage())
            if(pObj->getSdrPageFromSdrObject())
            {
                // if black is only default attribute from
                // pattern set it hard so that it is used in undo.
@@ -685,8 +684,11 @@ void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj)
            && !nLineWidth
            && eFillStyle != drawing::FillStyle_NONE)
        {
            if(pObj->GetPage() && GetModel()->IsUndoEnabled() )
            if(pObj->getSdrPageFromSdrObject() && GetModel()->IsUndoEnabled() )
            {
                AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj));
            }

            pObj->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
            pObj->SetMergedItem(XLineWidthItem(0));
        }
@@ -1035,7 +1037,7 @@ void E3dView::DoDepthArrange(E3dScene const * pScene, double fDepth)
    if(pScene && pScene->GetSubList() && pScene->GetSubList()->GetObjCount() > 1)
    {
        SdrObjList* pSubList = pScene->GetSubList();
        SdrObjListIter aIter(*pSubList, SdrIterMode::Flat);
        SdrObjListIter aIter(pSubList, SdrIterMode::Flat);
        E3dDepthLayer* pBaseLayer = nullptr;
        E3dDepthLayer* pLayer = nullptr;
        sal_Int32 nNumLayers = 0;
@@ -1550,7 +1552,7 @@ void E3dView::BreakSingle3DObj(E3dObject* pObj)
    if(dynamic_cast< const E3dScene* >(pObj) !=  nullptr)
    {
        SdrObjList* pSubList = pObj->GetSubList();
        SdrObjListIter aIter(*pSubList, SdrIterMode::Flat);
        SdrObjListIter aIter(pSubList, SdrIterMode::Flat);

        while(aIter.IsMore())
        {
diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx
index 8b3ee18..cb9b4ca 100644
--- a/svx/source/form/fmobj.cxx
+++ b/svx/source/form/fmobj.cxx
@@ -164,26 +164,21 @@ void FmFormObj::impl_isolateControlModel_nothrow()
}


void FmFormObj::SetPage(SdrPage* _pNewPage)
void FmFormObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    if ( GetPage() == _pNewPage )
    {
        SdrUnoObj::SetPage(_pNewPage);
        return;
    }

    FmFormPage* pOldFormPage = dynamic_cast<FmFormPage*>( GetPage()  );
    FmFormPage* pOldFormPage(dynamic_cast< FmFormPage* >(getSdrPageFromSdrObject()));
    if ( pOldFormPage )
        pOldFormPage->GetImpl().formObjectRemoved( *this );

    FmFormPage* pNewFormPage = dynamic_cast<FmFormPage*>( _pNewPage  );
    FmFormPage* pNewFormPage = dynamic_cast<FmFormPage*>( pNewPage  );
    if ( !pNewFormPage )
    {   // Maybe it makes sense to create an environment history here : if somebody set's our page to NULL, and we have a valid page before,
    {
        // Maybe it makes sense to create an environment history here : if somebody set's our page to NULL, and we have a valid page before,
        // me may want to remember our place within the old page. For this we could create a new m_xEnvironmentHistory to store it.
        // So the next SetPage with a valid new page would restore that environment within the new page.
        // But for the original Bug (#57300#) we don't need that, so I omit it here. Maybe this will be implemented later.
        impl_isolateControlModel_nothrow();
        SdrUnoObj::SetPage(_pNewPage);
        SdrUnoObj::handlePageChange(pOldPage, pNewPage);
        return;
    }

@@ -195,7 +190,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
    // do we have a history ? (from :Clone)
    if ( m_xEnvironmentHistory.is() )
    {
        // the element in m_xEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within _pNewPage->GetForms)
        // the element in m_xEnvironmentHistory which is equivalent to my new parent (which (perhaps) has to be created within pNewPage->GetForms)
        // is the right-most element in the tree.
        Reference< XIndexContainer > xRightMostLeaf( m_xEnvironmentHistory, UNO_QUERY_THROW );
        try
@@ -268,7 +263,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
    }

    // now set the page
    SdrUnoObj::SetPage(_pNewPage);
    SdrUnoObj::handlePageChange(pOldPage, pNewPage);

    // place my model within the new parent container
    if (xNewParent.is())
@@ -284,6 +279,7 @@ void FmFormObj::SetPage(SdrPage* _pNewPage)
                if (nPos > -1)
                    xOldParent->removeByIndex(nPos);
            }

            // and insert into the new container
            xNewParent->insertByIndex(xNewParent->getCount(), makeAny(xMeAsFormComp));

@@ -614,7 +610,7 @@ void FmFormObj::SetUnoControlModel( const Reference< css::awt::XControlModel >& 
{
    SdrUnoObj::SetUnoControlModel( _rxModel );

    FmFormPage* pFormPage = dynamic_cast<FmFormPage*>( GetPage()  );
    FmFormPage* pFormPage(dynamic_cast< FmFormPage* >(getSdrPageFromSdrObject()));
    if ( pFormPage )
        pFormPage->GetImpl().formModelAssigned( *this );

@@ -627,10 +623,10 @@ bool FmFormObj::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )
    bool bResult = SdrUnoObj::EndCreate(rStat, eCmd);
    if ( bResult && SdrCreateCmd::ForceEnd == eCmd && rStat.GetView() )
    {
        if ( pPage )
        {
            FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pPage );
        FmFormPage* pFormPage(dynamic_cast< FmFormPage* >(getSdrPageFromSdrObject()));

        if (nullptr != pFormPage)
        {
            try
            {
                Reference< XFormComponent >  xContent( xUnoControlModel, UNO_QUERY_THROW );
@@ -640,7 +636,7 @@ bool FmFormObj::EndCreate( SdrDragStat& rStat, SdrCreateCmd eCmd )

                if ( !xParentForm.is() )
                {   // model is not yet part of a form component hierarchy
                    xParentForm.set( rPage.GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
                    xParentForm.set( pFormPage->GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
                    xFormToInsertInto.set( xParentForm, UNO_QUERY_THROW );
                }

diff --git a/svx/source/form/fmpgeimp.cxx b/svx/source/form/fmpgeimp.cxx
index d72e39a..a6e23f2 100644
--- a/svx/source/form/fmpgeimp.cxx
+++ b/svx/source/form/fmpgeimp.cxx
@@ -166,8 +166,8 @@ void FmFormPageImpl::initFrom( FmFormPageImpl& i_foreignImpl )
        aVisitor.process( FormComponentPair( xForeignForms, m_xForms ), aAssignmentProcessor );

        // assign the cloned models to their SdrObjects
        SdrObjListIter aForeignIter( i_foreignImpl.m_rPage );
        SdrObjListIter aOwnIter( m_rPage );
        SdrObjListIter aForeignIter( &i_foreignImpl.m_rPage );
        SdrObjListIter aOwnIter( &m_rPage );

        OSL_ENSURE( aForeignIter.IsMore() == aOwnIter.IsMore(), "FmFormPageImpl::FmFormPageImpl: inconsistent number of objects (1)!" );
        while ( aForeignIter.IsMore() && aOwnIter.IsMore() )
@@ -278,7 +278,7 @@ Reference< XMap > FmFormPageImpl::impl_createControlShapeMap_nothrow()
            ::cppu::UnoType< XControlShape >::get()
        ).get(), UNO_SET_THROW );

        SdrObjListIter aPageIter( m_rPage );
        SdrObjListIter aPageIter( &m_rPage );
        while ( aPageIter.IsMore() )
        {
            // only FmFormObjs are what we're interested in
diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx
index d23f5f8..4a77bfc 100644
--- a/svx/source/form/fmshell.cxx
+++ b/svx/source/form/fmshell.cxx
@@ -1274,7 +1274,7 @@ namespace
{
    SdrUnoObj* lcl_findUnoObject( const SdrObjList& _rObjList, const Reference< XControlModel >& _rxModel )
    {
        SdrObjListIter aIter( _rObjList );
        SdrObjListIter aIter( &_rObjList );
        while ( aIter.IsMore() )
        {
            SdrObject* pObject = aIter.Next();
diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx
index 560b2fa..606d503 100644
--- a/svx/source/form/fmshimp.cxx
+++ b/svx/source/form/fmshimp.cxx
@@ -288,7 +288,7 @@ namespace
            std::unique_ptr<SdrObjListIter> pGroupIterator;
            if ( pCurrent->IsGroupObject() )
            {
                pGroupIterator.reset(new SdrObjListIter( *pCurrent->GetSubList() ));
                pGroupIterator.reset(new SdrObjListIter( pCurrent->GetSubList() ));
                pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr;
            }

@@ -577,7 +577,7 @@ bool isControlList(const SdrMarkList& rMarkList)
        {
            if (pObj->IsGroupObject())
            {
                SdrObjListIter aIter(*pObj->GetSubList());
                SdrObjListIter aIter(pObj->GetSubList());
                while (aIter.IsMore() && bControlList)
                {
                    bControlList = SdrInventor::FmForm == aIter.Next()->GetObjInventor();
@@ -1100,7 +1100,7 @@ bool FmXFormShell::executeControlConversionSlot_Lock(const Reference<XFormCompon
            Reference< XInterface > xNormalizedObject( _rxObject, UNO_QUERY );

            FmFormObj* pFormObject = nullptr;
            SdrObjListIter aPageIter( *pFormPage );
            SdrObjListIter aPageIter( pFormPage );
            while ( aPageIter.IsMore() )
            {
                SdrObject* pCurrent = aPageIter.Next();
@@ -2349,7 +2349,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest_Lock, FmSearchContext&, rfmscCont
    // Search all SdrControls of this page...
    OUString sControlSource, aName;

    SdrObjListIter aPageIter( *pCurrentPage );
    SdrObjListIter aPageIter( pCurrentPage );
    while ( aPageIter.IsMore() )
    {
        SdrObject* pCurrent = aPageIter.Next();
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index b29e553..5a7ce3f 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -340,7 +340,7 @@ void FmXUndoEnvironment::Inserted(SdrObject* pObj)
    }
    else if (pObj->IsGroupObject())
    {
        SdrObjListIter aIter(*pObj->GetSubList());
        SdrObjListIter aIter(pObj->GetSubList());
        while ( aIter.IsMore() )
            Inserted( aIter.Next() );
    }
@@ -392,7 +392,7 @@ void FmXUndoEnvironment::Inserted(FmFormObj* pObj)
    // is the control still assigned to a form
    Reference< XInterface >  xModel(pObj->GetUnoControlModel(), UNO_QUERY);
    Reference< XFormComponent >  xContent(xModel, UNO_QUERY);
    if (xContent.is() && pObj->GetPage())
    if (xContent.is() && pObj->getSdrPageFromSdrObject())
    {
        // if the component doesn't belong to a form, yet, find one to insert into
        if (!xContent->getParent().is())
@@ -401,7 +401,7 @@ void FmXUndoEnvironment::Inserted(FmFormObj* pObj)
            {
                Reference< XIndexContainer > xObjectParent = pObj->GetOriginalParent();

                FmFormPage& rPage = dynamic_cast< FmFormPage& >( *pObj->GetPage() );
                FmFormPage& rPage(dynamic_cast< FmFormPage& >( *pObj->getSdrPageFromSdrObject()));
                Reference< XIndexAccess >  xForms( rPage.GetForms(), UNO_QUERY_THROW );

                Reference< XIndexContainer > xNewParent;
@@ -454,7 +454,7 @@ void FmXUndoEnvironment::Removed(SdrObject* pObj)
    }
    else if (pObj->IsGroupObject())
    {
        SdrObjListIter aIter(*pObj->GetSubList());
        SdrObjListIter aIter(pObj->GetSubList());
        while ( aIter.IsMore() )
            Removed( aIter.Next() );
    }
diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx
index 6acd8b8..1d9aadc 100644
--- a/svx/source/form/fmview.cxx
+++ b/svx/source/form/fmview.cxx
@@ -273,7 +273,7 @@ void FmFormView::ChangeDesignMode(bool bDesign)
            // redraw UNO objects
            if ( GetSdrPageView() )
            {
                SdrObjListIter aIter(*pCurPage);
                SdrObjListIter aIter(pCurPage);
                while( aIter.IsMore() )
                {
                    SdrObject* pObj = aIter.Next();
diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx
index 9547171..f31659e 100644
--- a/svx/source/form/fmvwimp.cxx
+++ b/svx/source/form/fmvwimp.cxx
@@ -885,7 +885,7 @@ namespace
        {
            Reference< XInterface > xNormalizedForm( _rxForm, UNO_QUERY_THROW );

            SdrObjListIter aSdrObjectLoop( _rPage, SdrIterMode::DeepNoGroups );
            SdrObjListIter aSdrObjectLoop( &_rPage, SdrIterMode::DeepNoGroups );
            while ( aSdrObjectLoop.IsMore() )
            {
                FmFormObj* pFormObject = FmFormObj::GetFormObject( aSdrObjectLoop.Next() );
@@ -1539,7 +1539,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
    const Reference< XPropertySet >& _rxField,
    const Reference< XNumberFormats >& _rxNumberFormats, sal_uInt16 _nControlObjectID,
    const OUString& _rFieldPostfix, SdrInventor _nInventor, sal_uInt16 _nLabelObjectID,
    SdrPage* _pLabelPage, SdrPage* _pControlPage, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
    SdrPage* /*_pLabelPage*/, SdrPage* /*_pControlPage*/, SdrModel* _pModel, SdrUnoObj*& _rpLabel, SdrUnoObj*& _rpControl)
{
    sal_Int32 nDataType = 0;
    OUString sFieldName;
@@ -1584,8 +1584,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
            SdrObjFactory::MakeNewObject(
                *_pModel,
                _nInventor,
                _nLabelObjectID,
                _pLabelPage)));
                _nLabelObjectID)));

        OSL_ENSURE( pLabel.get(), "FmXFormView::createControlLabelPair: could not create the label!" );

@@ -1617,8 +1616,7 @@ bool FmXFormView::createControlLabelPair( OutputDevice const & _rOutDev, sal_Int
        SdrObjFactory::MakeNewObject(
            *_pModel,
             _nInventor,
             _nControlObjectID,
             _pControlPage)));
             _nControlObjectID)));

    OSL_ENSURE( pControl.get(), "FmXFormView::createControlLabelPair: could not create the control!" );

@@ -1782,7 +1780,7 @@ void FmXFormView::saveMarkList()
            {
                if ( pObj->IsGroupObject() )
                {
                    SdrObjListIter aIter( *pObj->GetSubList() );
                    SdrObjListIter aIter( pObj->GetSubList() );
                    bool bMixed = false;
                    while ( aIter.IsMore() && !bMixed )
                        bMixed = ( aIter.Next()->GetObjInventor() != SdrInventor::FmForm );
@@ -1866,7 +1864,7 @@ void FmXFormView::restoreMarkList( SdrMarkList& _rRestoredMarkList )
        // it is important that the objects of the mark list are not accessed,
        // because they can be already destroyed
        SdrPageView* pCurPageView = m_pView->GetSdrPageView();
        SdrObjListIter aPageIter( *pPage );
        SdrObjListIter aPageIter( pPage );
        bool bFound = true;

        // do all objects still exist
@@ -1877,7 +1875,7 @@ void FmXFormView::restoreMarkList( SdrMarkList& _rRestoredMarkList )
            SdrObject* pObj  = pMark->GetMarkedSdrObj();
            if (pObj->IsGroupObject())
            {
                SdrObjListIter aIter(*pObj->GetSubList());
                SdrObjListIter aIter(pObj->GetSubList());
                while (aIter.IsMore() && bFound)
                    bFound = lcl_hasObject(aPageIter, aIter.Next());
            }
diff --git a/svx/source/form/navigatortree.cxx b/svx/source/form/navigatortree.cxx
index 864a669..ca83164 100644
--- a/svx/source/form/navigatortree.cxx
+++ b/svx/source/form/navigatortree.cxx
@@ -93,7 +93,7 @@ namespace svxform

        _rMapping.clear();

        SdrObjListIter aIter( *_pPage );
        SdrObjListIter aIter( _pPage );
        while ( aIter.IsMore() )
        {
            SdrObject* pSdrObject = aIter.Next();
@@ -2049,7 +2049,7 @@ namespace svxform
        SdrPage*        pPage           = pPageView->GetPage();
        //FmFormPage*     pFormPage       = dynamic_cast< FmFormPage* >( pPage );

        SdrObjListIter aIter( *pPage );
        SdrObjListIter aIter( pPage );
        while ( aIter.IsMore() )
        {
            SdrObject* pSdrObject = aIter.Next();
@@ -2110,7 +2110,7 @@ namespace svxform
        SdrPage*        pPage           = pPageView->GetPage();

        bool bPaint = false;
        SdrObjListIter aIter( *pPage );
        SdrObjListIter aIter( pPage );
        while ( aIter.IsMore() )
        {
            SdrObject* pSdrObject = aIter.Next();
diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx
index 0b9a98d..01136bf 100644
--- a/svx/source/form/navigatortreemodel.cxx
+++ b/svx/source/form/navigatortreemodel.cxx
@@ -704,7 +704,7 @@ namespace svxform
        }
        else if ( pObj->IsGroupObject() )
        {
            SdrObjListIter aIter( *pObj->GetSubList() );
            SdrObjListIter aIter( pObj->GetSubList() );
            while ( aIter.IsMore() )
                InsertSdrObj( aIter.Next() );
        }
@@ -730,7 +730,7 @@ namespace svxform
        }
        else if ( pObj->IsGroupObject() )
        {
            SdrObjListIter aIter( *pObj->GetSubList() );
            SdrObjListIter aIter( pObj->GetSubList() );
            while ( aIter.IsMore() )
                RemoveSdrObj( aIter.Next() );
        }
diff --git a/svx/source/inc/fmobj.hxx b/svx/source/inc/fmobj.hxx
index 0533327..476c3c5 100644
--- a/svx/source/inc/fmobj.hxx
+++ b/svx/source/inc/fmobj.hxx
@@ -70,7 +70,8 @@ public:
    SAL_DLLPRIVATE void ClearObjEnv();

public:
    SAL_DLLPRIVATE virtual void SetPage(SdrPage* pNewPage) override;
    // react on page change
    virtual void handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage) override;

    SAL_DLLPRIVATE virtual SdrInventor GetObjInventor() const override;
    SAL_DLLPRIVATE virtual sal_uInt16 GetObjIdentifier() const override;
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index badb9f4..bbd8f48 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -339,15 +339,15 @@ namespace sdr

            if(pActiveGroupList)
            {
                if(dynamic_cast<const SdrPage*>( pActiveGroupList) !=  nullptr)
                if(nullptr != pActiveGroupList->getSdrPageFromSdrObjList())
                {
                    // It's a Page itself
                    return &(static_cast<SdrPage*>(pActiveGroupList)->GetViewContact());
                    return &(pActiveGroupList->getSdrPageFromSdrObjList()->GetViewContact());
                }
                else if(pActiveGroupList->GetOwnerObj())
                else if(pActiveGroupList->getSdrObjectFromSdrObjList())
                {
                    // Group object
                    return &(pActiveGroupList->GetOwnerObj()->GetViewContact());
                    return &(pActiveGroupList->getSdrObjectFromSdrObjList()->GetViewContact());
                }
            }
            else if(GetSdrPage())
diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
index 67ba3c5..6d3dfb2 100644
--- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx
@@ -99,9 +99,9 @@ ViewContact* ViewContactOfSdrObj::GetParentContact() const
        else
        {
            // Is a group?
            if(pObjList->GetOwnerObj())
            if(pObjList->getSdrObjectFromSdrObjList())
            {
                pRetval = &(pObjList->GetOwnerObj()->GetViewContact());
                pRetval = &(pObjList->getSdrObjectFromSdrObjList()->GetViewContact());
            }
        }
    }
diff --git a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
index 3c75981..9cf85e5 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpathobj.cxx
@@ -96,7 +96,7 @@ namespace sdr
                //width/height to avoid oom and massive churn generating a huge
                //polygon chain to cover the length in applyLineDashing if this
                //line is dashed
                const SdrPage* pPage = GetPathObj().GetPage();
                const SdrPage* pPage(GetPathObj().getSdrPageFromSdrObject());
                sal_Int32 nPageWidth = pPage ? pPage->GetWidth() : 0;
                sal_Int32 nPageHeight = pPage ? pPage->GetHeight() : 0;

diff --git a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
index f6e425f..db34c85 100644
--- a/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofgraphic.cxx
@@ -248,7 +248,7 @@ namespace sdr
            {
                // sometimes it is needed that each graphic is completely available and swapped in
                // for these cases a ForceSwapIn is called later at the graphic object
                if ( rGrafObj.GetPage() && rGrafObj.GetPage()->IsMasterPage() )
                if ( rGrafObj.getSdrPageFromSdrObject() && rGrafObj.getSdrPageFromSdrObject()->IsMasterPage() )
                {
                    // #i102380# force Swap-In for GraphicObjects on MasterPage to have a nicer visualisation
                    bDoAsynchronGraphicLoading = false;
diff --git a/svx/source/sdr/properties/attributeproperties.cxx b/svx/source/sdr/properties/attributeproperties.cxx
index 3c4ae37..e8eaf5b 100644
--- a/svx/source/sdr/properties/attributeproperties.cxx
+++ b/svx/source/sdr/properties/attributeproperties.cxx
@@ -44,32 +44,11 @@
#include <svx/svdmodel.hxx>
#include <svx/svdtrans.hxx>
#include <svx/svdpage.hxx>
#include <svx/svdograf.hxx>
#include <svx/svdoole2.hxx>

namespace sdr
{
    namespace properties
    {
        SfxStyleSheet* AttributeProperties::ImpGetDefaultStyleSheet() const
        {
            // use correct default stylesheet #119287#
            const SdrGrafObj* pIsSdrGrafObj(dynamic_cast< const SdrGrafObj* >(&GetSdrObject()));
            const SdrOle2Obj* pIsSdrOle2Obj(dynamic_cast< const SdrOle2Obj* >(&GetSdrObject()));
            SfxStyleSheet* pRetval(nullptr);

            if(pIsSdrGrafObj || pIsSdrOle2Obj)
            {
                pRetval = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj();
            }
            else
            {
                pRetval = GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet();
            }

            return pRetval;
        }

        void AttributeProperties::ImpSetParentAtSfxItemSet(bool bDontRemoveHardAttr)
        {
            if(HasSfxItemSet() && mpStyleSheet)
@@ -269,25 +248,29 @@ namespace sdr

            if(!bHadSfxItemSet)
            {
                if(GetStyleSheet())
                // SfxItemSet was created and ForceDefaultAttributes() is done.
                // We now need to set a default SfxStyleSheet at the SdrObject. This
                // is possible now since we always have the SdrModel in SdrObject,
                // so use applyDefaultStyleSheetFromSdrModel() which will do the
                // right thing in each derivation of BaseProperties.
                // We also need to 'rescue' mpStyleSheet if it is already set,
                // which means a SfxStyleSheet was already set/ocopied but not
                // yet set at the SdrObject. See copy-constructor and how it remembers
                // the SfxStyleSheet there. This time, do not reset the
                // attributes already set - this is done above.
                SfxStyleSheet* pImplicitelyAlreadySet(mpStyleSheet);

                // Set missing defaults and do RemoveHardAttributes. This is
                // important, it deletes again the attributes set in
                // ForceDefaultAttributes() which are set in the default
                // SfxStyleSheet.
                const_cast< AttributeProperties* >(this)->applyDefaultStyleSheetFromSdrModel();

                if(pImplicitelyAlreadySet)
                {
                    // Late-Init of setting parent to SfxStyleSheet after
                    // it's creation. See copy-constructor and how it remembers
                    // the SfxStyleSheet there.
                    // It is necessary to reset mpStyleSheet to nullptr to
                    // not trigger alarm inside ImpAddStyleSheet (!)
                    SfxStyleSheet* pNew(mpStyleSheet);
                    const_cast< AttributeProperties* >(this)->mpStyleSheet = nullptr;
                    const_cast< AttributeProperties* >(this)->ImpAddStyleSheet(
                        pNew,
                        true);
                }
                else
                {
                    // Set missing defaults and do not RemoveHardAttributes
                    const_cast< AttributeProperties* >(this)->ImpAddStyleSheet(
                        ImpGetDefaultStyleSheet(),
                        true);
                    // it's creation.
                    const_cast< AttributeProperties* >(this)->SetStyleSheet(pImplicitelyAlreadySet, true);
                }
            }

@@ -544,7 +527,7 @@ namespace sdr
            const SdrObject& rObj(GetSdrObject());
            if (rObj.IsInserted())
            {
                const SdrPage* const pPage(rObj.GetPage());
                const SdrPage* const pPage(rObj.getSdrPageFromSdrObject());
                if (pPage && pPage->IsInserted())
                    return true;
            }
diff --git a/svx/source/sdr/properties/graphicproperties.cxx b/svx/source/sdr/properties/graphicproperties.cxx
index 6c624a4..2c606b8 100644
--- a/svx/source/sdr/properties/graphicproperties.cxx
+++ b/svx/source/sdr/properties/graphicproperties.cxx
@@ -27,12 +27,27 @@
#include <editeng/eeitem.hxx>
#include <svx/svdograf.hxx>
#include <svx/sdgcpitm.hxx>

#include <svx/svdmodel.hxx>

namespace sdr
{
    namespace properties
    {
        void GraphicProperties::applyDefaultStyleSheetFromSdrModel()
        {
            SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());

            if(pStyleSheet)
            {
                SetStyleSheet(pStyleSheet, false);
            }
            else
            {
                SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
                SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
            }
        }

        // create a new itemset
        std::unique_ptr<SfxItemSet> GraphicProperties::CreateObjectSpecificItemSet(SfxItemPool& rPool)
        {
diff --git a/svx/source/sdr/properties/itemsettools.cxx b/svx/source/sdr/properties/itemsettools.cxx
index 7c3bea8..63b0ca7 100644
--- a/svx/source/sdr/properties/itemsettools.cxx
+++ b/svx/source/sdr/properties/itemsettools.cxx
@@ -36,7 +36,7 @@ namespace sdr
        {
            if (const SdrObjGroup* pGroupObj = dynamic_cast<const SdrObjGroup*>(&rObj))
            {
                SdrObjListIter aIter(*pGroupObj, SdrIterMode::DeepNoGroups);
                SdrObjListIter aIter(pGroupObj->GetSubList(), SdrIterMode::DeepNoGroups);
                maRectangles.reserve(aIter.Count());

                while(aIter.IsMore())
diff --git a/svx/source/sdr/properties/oleproperties.cxx b/svx/source/sdr/properties/oleproperties.cxx
index f740e9c..096e3e2e 100644
--- a/svx/source/sdr/properties/oleproperties.cxx
+++ b/svx/source/sdr/properties/oleproperties.cxx
@@ -17,17 +17,32 @@
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
 */


#include <sdr/properties/oleproperties.hxx>
#include <svl/itemset.hxx>
#include <svx/xfillit0.hxx>
#include <svx/xlineit0.hxx>

#include <svx/svdobj.hxx>
#include <svx/svdmodel.hxx>

namespace sdr
{
    namespace properties
    {
        void OleProperties::applyDefaultStyleSheetFromSdrModel()
        {
            SfxStyleSheet* pStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());

            if(pStyleSheet)
            {
                SetStyleSheet(pStyleSheet, false);
            }
            else
            {
                SetMergedItem(XFillStyleItem(com::sun::star::drawing::FillStyle_NONE));
                SetMergedItem(XLineStyleItem(com::sun::star::drawing::LineStyle_NONE));
            }
        }

        OleProperties::OleProperties(SdrObject& rObj)
        :   RectangleProperties(rObj)
        {
diff --git a/svx/source/sdr/properties/properties.cxx b/svx/source/sdr/properties/properties.cxx
index 256e6ea..9670c74 100644
--- a/svx/source/sdr/properties/properties.cxx
+++ b/svx/source/sdr/properties/properties.cxx
@@ -24,6 +24,7 @@
#include <svx/svditer.hxx>
#include <svx/xfillit0.hxx>
#include <vcl/outdev.hxx>
#include <svx/svdmodel.hxx>

using namespace com::sun::star;

@@ -40,6 +41,11 @@ namespace sdr
        {
        }

        void BaseProperties::applyDefaultStyleSheetFromSdrModel()
        {
            SetStyleSheet(GetSdrObject().getSdrModelFromSdrObject().GetDefaultStyleSheet(), false);
        }

        const SdrObject& BaseProperties::GetSdrObject() const
        {
            return mrObject;
diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx
index 9a49559..070d20d 100644
--- a/svx/source/svdraw/svdcrtv.cxx
+++ b/svx/source/svdraw/svdcrtv.cxx
@@ -402,19 +402,13 @@ bool SdrCreateView::ImpBegCreateObj(SdrInventor nInvent, sal_uInt16 nIdent, cons
            if(pPreparedFactoryObject)
            {
                pCurrentCreate = pPreparedFactoryObject;

                if(pCreatePV->GetPage())
                {
                    pCurrentCreate->SetPage(pCreatePV->GetPage());
                }
            }
            else
            {
                pCurrentCreate = SdrObjFactory::MakeNewObject(
                    *mpModel,
                    nInvent,
                    nIdent,
                    pCreatePV->GetPage());
                    nIdent);
            }

            Point aPnt(rPnt);
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index 78ade77..980399c0 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -789,9 +789,9 @@ void SdrEditView::DeleteMarkedObj()
            for(size_t a = 0; a < nCount; ++a)
            {
                // in the first run, add all found parents, but only once
                SdrMark* pMark = rMarkList.GetMark(a);
                SdrObject* pObject = pMark->GetMarkedSdrObj();
                SdrObject* pParent = pObject->getParentOfSdrObject()->GetOwnerObj();
                SdrMark* pMark(rMarkList.GetMark(a));
                SdrObject* pObject(pMark->GetMarkedSdrObj());
                SdrObject* pParent(pObject->getParentOfSdrObject()->getSdrObjectFromSdrObjList());

                if(pParent)
                {
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index cffae4f..666fac2 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -143,10 +143,10 @@ std::vector< SdrUndoAction* > SdrEditView::CreateConnectorUndo( SdrObject& rO )

    if ( rO.GetBroadcaster() )
    {
        const SdrPage* pPage = rO.GetPage();
        const SdrPage* pPage = rO.getSdrPageFromSdrObject();
        if ( pPage )
        {
            SdrObjListIter aIter( *pPage, SdrIterMode::DeepWithGroups );
            SdrObjListIter aIter(pPage, SdrIterMode::DeepWithGroups);
            while( aIter.IsMore() )
            {
                SdrObject* pPartObj = aIter.Next();
@@ -600,7 +600,7 @@ void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookM
        if (bNoContortion || pOL==nullptr) {
            ImpCrookObj(pO,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
        } else {
            SdrObjListIter aIter(*pOL,SdrIterMode::DeepNoGroups);
            SdrObjListIter aIter(pOL,SdrIterMode::DeepNoGroups);
            while (aIter.IsMore()) {
                SdrObject* pO1=aIter.Next();
                ImpCrookObj(pO1,rRef,rRad,eMode,bVertical,bNoContortion,bRotate,aMarkRect);
@@ -674,7 +674,7 @@ void SdrEditView::DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon&
        if (bNoContortion || pOL==nullptr) {
            ImpDistortObj(pO,aRefRect,rDistortedRect,bNoContortion);
        } else {
            SdrObjListIter aIter(*pOL,SdrIterMode::DeepNoGroups);
            SdrObjListIter aIter(pOL,SdrIterMode::DeepNoGroups);
            while (aIter.IsMore()) {
                SdrObject* pO1=aIter.Next();
                ImpDistortObj(pO1,aRefRect,rDistortedRect,bNoContortion);
@@ -1805,7 +1805,7 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert)
        if (nMarkCount==1)
        {   // align single object to page
            const SdrObject* pObj=GetMarkedObjectByIndex(0);
            const SdrPage* pPage=pObj->GetPage();
            const SdrPage* pPage=pObj->getSdrPageFromSdrObject();
            const SdrPageGridFrameList* pGFL=pPage->GetGridFrameList(GetSdrPageViewOfMarkedByIndex(0),&(pObj->GetSnapRect()));
            const SdrPageGridFrame* pFrame=nullptr;
            if (pGFL!=nullptr && pGFL->GetCount()!=0)
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 53f109a..7f1f061 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -540,7 +540,7 @@ void SdrEditView::ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest) 
    if (pSource!=nullptr) {
        SdrObjList* pOL=pSource->GetSubList();
        if (pOL!=nullptr && !pSource->Is3DObj()) { // get first non-group object from group
            SdrObjListIter aIter(*pOL,SdrIterMode::DeepNoGroups);
            SdrObjListIter aIter(pOL,SdrIterMode::DeepNoGroups);
            pSource=aIter.Next();
        }
    }
@@ -586,7 +586,7 @@ bool SdrEditView::ImpCanConvertForCombine(const SdrObject* pObj)

    if(pOL && !pObj->Is3DObj())
    {
        SdrObjListIter aIter(*pOL, SdrIterMode::DeepNoGroups);
        SdrObjListIter aIter(pOL, SdrIterMode::DeepNoGroups);

        while(aIter.IsMore())
        {
@@ -629,7 +629,7 @@ basegfx::B2DPolyPolygon SdrEditView::ImpGetPolyPolygon1(const SdrObject* pObj)

            if(pOL)
            {
                SdrObjListIter aIter(*pOL, SdrIterMode::DeepNoGroups);
                SdrObjListIter aIter(pOL, SdrIterMode::DeepNoGroups);

                while(aIter.IsMore())
                {
@@ -666,7 +666,7 @@ basegfx::B2DPolyPolygon SdrEditView::ImpGetPolyPolygon(const SdrObject* pObj)
    if(pOL && !pObj->Is3DObj())
    {
        basegfx::B2DPolyPolygon aRetval;
        SdrObjListIter aIter(*pOL, SdrIterMode::DeepNoGroups);
        SdrObjListIter aIter(pOL, SdrIterMode::DeepNoGroups);

        while(aIter.IsMore())
        {
@@ -1433,7 +1433,7 @@ bool SdrEditView::ImpCanDismantle(const SdrObject* pObj, bool bMakeLines)
    if(pOL)
    {
        // group object -- check all members if they're PathObjs
        SdrObjListIter aIter(*pOL, SdrIterMode::DeepNoGroups);
        SdrObjListIter aIter(pOL, SdrIterMode::DeepNoGroups);

        while(aIter.IsMore() && !bOtherObjs)
        {
@@ -1685,7 +1685,7 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines)
            size_t nPos=nPos0+1;
            SdrObjList* pSubList=pObj->GetSubList();
            if (pSubList!=nullptr && !pObj->Is3DObj()) {
                SdrObjListIter aIter(*pSubList,SdrIterMode::DeepNoGroups);
                SdrObjListIter aIter(pSubList,SdrIterMode::DeepNoGroups);
                while (aIter.IsMore()) {
                    const SdrObject* pObj1=aIter.Next();
                    ImpDismantleOneObject(pObj1,*pOL,nPos,pPV,bMakeLines);
@@ -1970,7 +1970,7 @@ void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea)
            SdrPageView* pPV=pM->GetPageView();
            if (pObj->IsGroupObject() && !pObj->Is3DObj()) {
                SdrObject* pGrp=pObj;
                SdrObjListIter aIter(*pGrp,SdrIterMode::DeepNoGroups);
                SdrObjListIter aIter(*pGrp, SdrIterMode::DeepNoGroups);
                while (aIter.IsMore()) {
                    pObj=aIter.Next();
                    ImpConvertOneObj(pObj,bPath,bLineToArea);
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 93d317f..fc0de4b 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1240,7 +1240,7 @@ bool SdrObjEditView::SdrBeginTextEdit(
                    // Register an outliner view for all other sdr views that
                    // show the same page, so that when the text edit changes,
                    // all interested windows get an invalidation.
                    SdrViewIter aIter(pObj->GetPage());
                    SdrViewIter aIter(pObj->getSdrPageFromSdrObject());
                    for (SdrView* pView = aIter.FirstView(); pView; pView = aIter.NextView())
                    {
                        if (pView == this)
diff --git a/svx/source/svdraw/svdetc.cxx b/svx/source/svdraw/svdetc.cxx
index fb8aab8..526b3ca 100644
--- a/svx/source/svdraw/svdetc.cxx
+++ b/svx/source/svdraw/svdetc.cxx
@@ -518,7 +518,7 @@ namespace
        Color& rCol)
    {
        bool bRet(false);
        bool bMaster(rList.GetPage() && rList.GetPage()->IsMasterPage());
        bool bMaster(rList.getSdrPageFromSdrObjList() && rList.getSdrPageFromSdrObjList()->IsMasterPage());

        for(size_t no(rList.GetObjCount()); !bRet && no > 0; )
        {
diff --git a/svx/source/svdraw/svditer.cxx b/svx/source/svdraw/svditer.cxx
index 859b9d3..2e8b8a8 100644
--- a/svx/source/svdraw/svditer.cxx
+++ b/svx/source/svdraw/svditer.cxx
@@ -24,73 +24,117 @@
#include <svx/svdmark.hxx>
#include <svx/scene3d.hxx>

SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, bool bReverse)
:   mnIndex(0),
    mbReverse(bReverse)
SdrObjListIter::SdrObjListIter(const SdrObjList* pObjList, SdrIterMode eMode, bool bReverse)
:   maObjList(),
    mnIndex(0),
    mbReverse(bReverse),
    mbUseZOrder(true)
{
    ImpProcessObjectList(rObjList, eMode, true);
    if(nullptr != pObjList)
    {
        ImpProcessObjectList(*pObjList, eMode);
    }

    Reset();
}

SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode)
:   mnIndex(0),
    mbReverse(false)
SdrObjListIter::SdrObjListIter(const SdrObjList* pObjList, bool bUseZOrder, SdrIterMode eMode, bool bReverse)
:   maObjList(),
    mnIndex(0),
    mbReverse(bReverse),
    mbUseZOrder(bUseZOrder)
{
    ImpProcessObjectList(rObjList, eMode, bUseZOrder);
    if(nullptr != pObjList)
    {
        // correct when we have no ObjectNavigationOrder
        if(!mbUseZOrder && !pObjList->HasObjectNavigationOrder())
        {
            mbUseZOrder = false;
        }

        ImpProcessObjectList(*pObjList, eMode);
    }

    Reset();
}

SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode )
:   mnIndex(0),
    mbReverse(false)
SdrObjListIter::SdrObjListIter(const SdrObject& rSdrObject, SdrIterMode eMode, bool bReverse)
:   maObjList(),
    mnIndex(0),
    mbReverse(bReverse),
    mbUseZOrder(true)
{
    if ( dynamic_cast<const SdrObjGroup*>(&rObj) !=  nullptr )
        ImpProcessObjectList(*rObj.GetSubList(), eMode, true);
    else
        maObjList.push_back(const_cast<SdrObject*>(&rObj));
    ImpProcessObj(rSdrObject, eMode);
    Reset();
}

SdrObjListIter::SdrObjListIter(const SdrPage* pSdrPage, SdrIterMode eMode, bool bReverse)
:   maObjList(),
    mnIndex(0),
    mbReverse(bReverse),
    mbUseZOrder(true)
{
    if(nullptr != pSdrPage)
    {
        ImpProcessObjectList(*dynamic_cast< const SdrObjList* >(pSdrPage), eMode);
    }

    Reset();
}

SdrObjListIter::SdrObjListIter( const SdrMarkList& rMarkList, SdrIterMode eMode )
:   mnIndex(0),
    mbReverse(false)
:   maObjList(),
    mnIndex(0),
    mbReverse(false),
    mbUseZOrder(true)
{
    ImpProcessMarkList(rMarkList, eMode);
    Reset();
}

void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder)
{
    for( size_t nIdx = 0, nCount = rObjList.GetObjCount(); nIdx < nCount; ++nIdx )
void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode)
{    for(size_t nIdx(0), nCount(rObjList.GetObjCount()); nIdx < nCount; ++nIdx)
    {
        SdrObject* pObj = bUseZOrder ?
            rObjList.GetObj( nIdx ) : rObjList.GetObjectForNavigationPosition( nIdx );
        OSL_ASSERT( pObj != nullptr );
        if( pObj )
            ImpProcessObj( pObj, eMode, bUseZOrder );
        const SdrObject* pSdrObject(mbUseZOrder
            ? rObjList.GetObj(nIdx)
            : rObjList.GetObjectForNavigationPosition(nIdx));

        if(nullptr == pSdrObject)
        {
            OSL_ENSURE(false, "SdrObjListIter: corrupted SdrObjList (!)");
        }
        else
        {
            ImpProcessObj(*pSdrObject, eMode);
        }
    }
}

void SdrObjListIter::ImpProcessMarkList( const SdrMarkList& rMarkList, SdrIterMode eMode )
void SdrObjListIter::ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode)
{
    for( size_t nIdx = 0, nCount = rMarkList.GetMarkCount(); nIdx < nCount; ++nIdx )
    {
        if( SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj() )
            ImpProcessObj( pObj, eMode, false );
        {
            ImpProcessObj(*pObj, eMode);
        }
    }
}

void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder)
void SdrObjListIter::ImpProcessObj(const SdrObject& rSdrObject, SdrIterMode eMode)
{
    bool bIsGroup = pObj->IsGroupObject();
    // 3D objects are not group objects, IsGroupObject()
    // only tests if pSub is not null ptr :-(
    if( bIsGroup && dynamic_cast<const E3dObject* >(pObj) != nullptr && dynamic_cast<const E3dScene* >(pObj) == nullptr)
        bIsGroup = false;
    const SdrObjList* pChildren(rSdrObject.getChildrenOfSdrObject());
    const bool bIsGroup(nullptr != pChildren);

    if( !bIsGroup || (eMode != SdrIterMode::DeepNoGroups) )
        maObjList.push_back(pObj);
    if(!bIsGroup || (SdrIterMode::DeepNoGroups != eMode))
    {
        maObjList.push_back(&rSdrObject);
    }

    if( bIsGroup && (eMode != SdrIterMode::Flat) )
        ImpProcessObjectList( *pObj->GetSubList(), eMode, bUseZOrder );
    if(bIsGroup && (SdrIterMode::Flat != eMode))
    {
        ImpProcessObjectList(*pChildren, eMode);
    }
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 00901af..562b14f 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -762,7 +762,7 @@ namespace sdr
                                SfxListener* pLst = pBC->GetListener(nl);
                                SdrEdgeObj* pEdge = dynamic_cast<SdrEdgeObj*>( pLst );

                                if(pEdge && pEdge->IsInserted() && pEdge->GetPage() == pCandidate->GetPage())
                                if(pEdge && pEdge->IsInserted() && pEdge->getSdrPageFromSdrObject() == pCandidate->getSdrPageFromSdrObject())
                                {
                                    SdrMark aM(pEdge, maMarkedObjectList.GetMark(a)->GetPageView());

diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 1b17da7..bde6714 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -2061,7 +2061,7 @@ SdrHint::SdrHint(SdrHintKind eNewHint)
SdrHint::SdrHint(SdrHintKind eNewHint, const SdrObject& rNewObj)
:   meHint(eNewHint),
    mpObj(&rNewObj),
    mpPage(rNewObj.GetPage())
    mpPage(rNewObj.getSdrPageFromSdrObject())
{
}

diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index f8ad135..ea0255b 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1753,8 +1753,8 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT
    if (pOL!=nullptr)
    {
        bool bBack(nOptions & SdrSearchOptions::BACKWARD);
        bool bRemap(pOL->GetOwnerObj() && dynamic_cast< const E3dScene* >(pOL->GetOwnerObj()) != nullptr);
        E3dScene* pRemapScene = (bRemap ? static_cast<E3dScene*>(pOL->GetOwnerObj()) : nullptr);
        bool bRemap(pOL->getSdrObjectFromSdrObjList() && dynamic_cast< const E3dScene* >(pOL->getSdrObjectFromSdrObjList()) != nullptr);
        E3dScene* pRemapScene = (bRemap ? static_cast< E3dScene* >(pOL->getSdrObjectFromSdrObjList()) : nullptr);

        const size_t nObjCount=pOL->GetObjCount();
        size_t nObjNum=bBack ? 0 : nObjCount;
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index a6a4a75..23308b4 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -2836,11 +2836,12 @@ void SdrObjCustomShape::NbcSetStyleSheet( SfxStyleSheet* pNewStyleSheet, bool bD
    SdrObject::NbcSetStyleSheet( pNewStyleSheet, bDontRemoveHardAttr );
}

void SdrObjCustomShape::SetPage( SdrPage* pNewPage )
void SdrObjCustomShape::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    SdrTextObj::SetPage( pNewPage );
    // call parent
    SdrTextObj::handlePageChange(pOldPage, pNewPage);

    if( pNewPage )
    if(nullptr != pNewPage)
    {
        // invalidating rectangles by SetRectsDirty is not sufficient,
        // AdjustTextFrameWidthAndHeight() also has to be made, both
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 2ee6999..5b313c9 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -279,6 +279,52 @@ void SdrObject::ActionChanged() const
    GetViewContact().ActionChanged();
}

SdrPage* SdrObject::getSdrPageFromSdrObject() const
{
    if(getParentOfSdrObject())
    {
        return getParentOfSdrObject()->getSdrPageFromSdrObjList();
    }

    return nullptr;
}

SdrModel& SdrObject::getSdrModelFromSdrObject() const
{
    return mrSdrModelFromSdrObject;
}

void SdrObject::setParentOfSdrObject(SdrObjList* pNewObjList)
{
    if(getParentOfSdrObject() != pNewObjList)
    {
        // remember current page
        SdrPage* pOldPage(getSdrPageFromSdrObject());

        // set new parent
        mpParentOfSdrObject = pNewObjList;

        // get new page
        SdrPage* pNewPage(getSdrPageFromSdrObject());

        // broadcast page change over objects if needed
        if(pOldPage != pNewPage)
        {
            handlePageChange(pOldPage, pNewPage);
        }
    }
}

SdrObjList* SdrObject::getParentOfSdrObject() const
{
    return mpParentOfSdrObject;
}

SdrObjList* SdrObject::getChildrenOfSdrObject() const
{
    // default has no children
    return nullptr;
}

void SdrObject::SetBoundRectDirty()
{
@@ -289,7 +335,6 @@ void SdrObject::SetBoundRectDirty()
SdrObject::SdrObject(SdrModel& rSdrModel)
:   mpFillGeometryDefiningShape(nullptr)
    ,mrSdrModelFromSdrObject(rSdrModel)
    ,pPage(nullptr)
    ,pUserCall(nullptr)
    ,pPlusData(nullptr)
    ,mpImpl(new Impl)
@@ -393,48 +438,22 @@ void SdrObject::Free( SdrObject*& _rpObject )
    delete pObject;
}

void SdrObject::SetRectsDirty(bool bNotMyself)
void SdrObject::SetRectsDirty(bool bNotMyself, bool bRecursive)
{
    if (!bNotMyself) {
    if (!bNotMyself)
    {
        SetBoundRectDirty();
        bSnapRectDirty=true;
    }

    if (nullptr != getParentOfSdrObject())
    if (bRecursive && nullptr != getParentOfSdrObject())
    {
        getParentOfSdrObject()->SetRectsDirty();
        getParentOfSdrObject()->SetSdrObjListRectsDirty();
    }
}

void SdrObject::setParentOfSdrObject(SdrObjList* pNewObjList)
void SdrObject::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    if(getParentOfSdrObject() != pNewObjList)
    {
        mpParentOfSdrObject = pNewObjList;
    }
}


void SdrObject::SetPage(SdrPage* pNewPage)
{
    SdrModel* pOldModel(&getSdrModelFromSdrObject());
    SdrPage* pOldPage(pPage);

    pPage = pNewPage;

    // TTTT Possibility here to add a warning for the future -> SdrModel
    // of SdrObject (this) and SdrPage. It is added to *have* the
    // same SdrModel
    // if(nullptr != pPage)
    // {
    //     SdrModel* pMod(&pPage->getSdrModelFromSdrPage());
    //
    //     if(pMod != &getSdrModelFromSdrObject())
    //     {
    //         SetModel(pMod);
    //     }
    // }

    // The creation of the UNO shape in SdrObject::getUnoShape is influenced
    // by pPage, so when the page changes we need to discard the cached UNO
    // shape so that a new one will be created.
@@ -447,16 +466,18 @@ void SdrObject::SetPage(SdrPage* pNewPage)
    // good to think about if this is really needed - it *seems* to be intended
    // for a xShape being a on-demand-creatable resource - wit hthe argument that
    // the SdrPage/UnoPage used influences the SvxShape creation. This uses
    // resources and would be nice to get rid of anyways.
    if (pOldPage != pPage && !(pOldPage && pPage && pOldModel == &getSdrModelFromSdrObject()))
    // ressources and would be nice to get rid of anyways.
    if(nullptr == pOldPage || nullptr == pNewPage)
    {
        SvxShape* const pShape(getSvxShape());

        if (pShape && !pShape->HasSdrObjectOwnership())
        {
            setUnoShape(nullptr);
        }
    }
}


// init global static itempool
SdrItemPool* SdrObject::mpGlobalItemPool = nullptr;

@@ -626,7 +647,7 @@ SdrObjList* SdrObject::GetSubList() const

SdrObject* SdrObject::GetUpGroup() const
{
    return nullptr != getParentOfSdrObject() ? getParentOfSdrObject()->GetOwnerObj() : nullptr;
    return nullptr != getParentOfSdrObject() ? getParentOfSdrObject()->getSdrObjectFromSdrObjList() : nullptr;
}

void SdrObject::SetName(const OUString& rStr)
@@ -921,7 +942,7 @@ void SdrObject::SingleObjectPainter(OutputDevice& rOut) const
    sdr::contact::SdrObjectVector aObjectVector;
    aObjectVector.push_back(const_cast< SdrObject* >(this));

    sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aObjectVector, GetPage());
    sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aObjectVector, getSdrPageFromSdrObject());
    sdr::contact::DisplayInfo aDisplayInfo;

    aPainter.ProcessDisplay(aDisplayInfo);
@@ -957,7 +978,6 @@ SdrObject& SdrObject::operator=(const SdrObject& rObj)
    // draw object, an SdrObject needs to be provided, as in the normal constructor.
    mpProperties = rObj.GetProperties().Clone(*this);

    pPage = rObj.pPage;
    aOutRect=rObj.aOutRect;
    mnLayerID = rObj.mnLayerID;
    aAnchor =rObj.aAnchor;
@@ -2045,7 +2065,9 @@ void SdrObject::NbcApplyNotPersistAttr(const SfxItemSet& rAttr)
    if (rAttr.GetItemState(SDRATTR_LAYERNAME,true,&pPoolItem)==SfxItemState::SET)
    {
        OUString aLayerName = static_cast<const SdrLayerNameItem*>(pPoolItem)->GetValue();
        const SdrLayerAdmin& rLayAd(nullptr != pPage ? pPage->GetLayerAdmin() : getSdrModelFromSdrObject().GetLayerAdmin());
        const SdrLayerAdmin& rLayAd(nullptr != getSdrPageFromSdrObject()
            ? getSdrPageFromSdrObject()->GetLayerAdmin()
            : getSdrModelFromSdrObject().GetLayerAdmin());
        const SdrLayer* pLayer = rLayAd.GetLayer(aLayerName);

        if(nullptr != pLayer)
@@ -2114,7 +2136,9 @@ void SdrObject::TakeNotPersistAttr(SfxItemSet& rAttr) const
    }

    rAttr.Put(SdrLayerIdItem(GetLayer()));
    const SdrLayerAdmin& rLayAd(nullptr != pPage ? pPage->GetLayerAdmin() : getSdrModelFromSdrObject().GetLayerAdmin());
    const SdrLayerAdmin& rLayAd(nullptr != getSdrPageFromSdrObject()
        ? getSdrPageFromSdrObject()->GetLayerAdmin()
        : getSdrModelFromSdrObject().GetLayerAdmin());
    const SdrLayer* pLayer = rLayAd.GetLayerPerID(GetLayer());
    if(nullptr != pLayer)
    {
@@ -2653,9 +2677,9 @@ void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& 
{
    SdrObject* pGroup = nullptr;

    if(nullptr != getParentOfSdrObject() && SdrObjListKind::GroupObj == getParentOfSdrObject()->GetListKind())
    if(nullptr != getParentOfSdrObject()) // && SdrObjListKind::GroupObj == getParentOfSdrObject()->GetListKind())
    {
        pGroup = getParentOfSdrObject()->GetOwnerObj();
        pGroup = getParentOfSdrObject()->getSdrObjectFromSdrObjList();
    }

    if ( pUserCall )
@@ -2702,11 +2726,10 @@ void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& 
            pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect );
        }

        if( pGroup->getParentOfSdrObject()                                       &&
            pGroup->getParentOfSdrObject()->GetListKind() == SdrObjListKind::GroupObj &&
            pGroup != getParentOfSdrObject()->GetOwnerObj() )
        if( pGroup->getParentOfSdrObject() &&
            pGroup != getParentOfSdrObject()->getSdrObjectFromSdrObjList() )
        {
            pGroup = getParentOfSdrObject()->GetOwnerObj();
            pGroup = getParentOfSdrObject()->getSdrObjectFromSdrObjList();
        }
        else
        {
@@ -2792,9 +2815,9 @@ css::uno::Reference< css::uno::XInterface > SdrObject::getUnoShape()
    if( !xShape.is() )
    {
        OSL_ENSURE( mpSvxShape == nullptr, "SdrObject::getUnoShape: XShape already dead, but still an IMPL pointer!" );
        if ( pPage )
        if ( getSdrPageFromSdrObject() )
        {
            uno::Reference< uno::XInterface > xPage( pPage->getUnoPage() );
            uno::Reference< uno::XInterface > xPage( getSdrPageFromSdrObject()->getUnoPage() );
            if( xPage.is() )
            {
                SvxDrawPage* pDrawPage = SvxDrawPage::getImplementation(xPage);
@@ -2996,7 +3019,6 @@ SdrObject* SdrObjFactory::MakeNewObject(
    SdrModel& rSdrModel,
    SdrInventor nInventor,
    sal_uInt16 nIdentifier,
    SdrPage* pPage,
    const tools::Rectangle* pSnapRect)
{
    SdrObject* pObj(nullptr);
@@ -3126,11 +3148,6 @@ SdrObject* SdrObjFactory::MakeNewObject(
        return nullptr;
    }

    if(nullptr != pPage)
    {
        pObj->SetPage(pPage);
    }

    if(bSetSnapRect && nullptr != pSnapRect)
    {
        pObj->SetSnapRect(*pSnapRect);
diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx
index 575b31e5..860b4f0 100644
--- a/svx/source/svdraw/svdoedge.cxx
+++ b/svx/source/svdraw/svdoedge.cxx
@@ -182,6 +182,20 @@ SdrEdgeObj::~SdrEdgeObj()
    SdrEdgeObj::DisconnectFromNode(false);
}

void SdrEdgeObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    // call parent
    SdrTextObj::handlePageChange(pOldPage, pNewPage);

    if(nullptr != GetConnection(true).GetObject() || nullptr != GetConnection(false).GetObject())
    {
        // check broadcasters; when we are not inserted we do not need broadcasters
        // TTTT not yet added, but keep hint to do this here
        // mpCon1->ownerPageChange();
        // mpCon2->ownerPageChange();
    }
}

void SdrEdgeObj::ImpSetAttrToEdgeInfo()
{
    const SfxItemSet& rSet = GetObjectItemSet();
@@ -471,8 +485,14 @@ void SdrEdgeObj::DisconnectFromNode(bool bTail1)

SdrObject* SdrEdgeObj::GetConnectedNode(bool bTail1) const
{
    SdrObject* pObj=GetConnection(bTail1).pObj;
    if (pObj!=nullptr && (pObj->GetPage()!=pPage || !pObj->IsInserted())) pObj=nullptr;
    SdrObject* pObj(GetConnection(bTail1).pObj);

    if(nullptr != pObj
        && (pObj->getSdrPageFromSdrObject() != getSdrPageFromSdrObject() || !pObj->IsInserted()))
    {
        pObj = nullptr;
    }

    return pObj;
}

@@ -481,7 +501,9 @@ bool SdrEdgeObj::CheckNodeConnection(bool bTail1) const
    bool bRet = false;
    const SdrObjConnection& rCon=GetConnection(bTail1);
    sal_uInt16 nPointCount=pEdgeTrack->GetPointCount();
    if (rCon.pObj!=nullptr && rCon.pObj->GetPage()==pPage && nPointCount!=0) {

    if(nullptr != rCon.pObj && rCon.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject() && 0 != nPointCount)
    {
        const SdrGluePointList* pGPL=rCon.pObj->GetGluePointList();
        sal_uInt16 nConAnz=pGPL==nullptr ? 0 : pGPL->GetCount();
        sal_uInt16 nGesAnz=nConAnz+8;
@@ -707,12 +729,12 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
    }

    // #i54102# To allow interactive preview, do also if not inserted
    bool bCon1=rCon1.pObj!=nullptr && rCon1.pObj->GetPage()==pPage;
    bool bCon2=rCon2.pObj!=nullptr && rCon2.pObj->GetPage()==pPage;

    const bool bCon1(nullptr != rCon1.pObj && rCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
    const bool bCon2(nullptr != rCon2.pObj && rCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
    const SfxItemSet& rSet = GetObjectItemSet();

    if (bCon1) {
    if (bCon1)
    {
        if (rCon1.pObj==static_cast<SdrObject const *>(this))
        {
            // check, just in case
@@ -722,44 +744,50 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
        {
            aBoundRect1 = rCon1.pObj->GetCurrentBoundRect();
        }

        aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y());
        aBewareRect1=aBoundRect1;

        sal_Int32 nH = rSet.Get(SDRATTR_EDGENODE1HORZDIST).GetValue();
        sal_Int32 nV = rSet.Get(SDRATTR_EDGENODE1VERTDIST).GetValue();

        aBewareRect1.AdjustLeft( -nH );
        aBewareRect1.AdjustRight(nH );
        aBewareRect1.AdjustTop( -nV );
        aBewareRect1.AdjustBottom(nV );
    } else {
    }
    else
    {
        aBoundRect1=tools::Rectangle(aPt1,aPt1);
        aBoundRect1.Move(rCon1.aObjOfs.X(),rCon1.aObjOfs.Y());
        aBewareRect1=aBoundRect1;
    }
    if (bCon2) {
        if (rCon2.pObj==static_cast<SdrObject const *>(this)) { // check, just in case

    if (bCon2)
    {
        if (rCon2.pObj==static_cast<SdrObject const *>(this))
        { // check, just in case
            aBoundRect2=aOutRect;
        }
        else
        {
            aBoundRect2 = rCon2.pObj->GetCurrentBoundRect();
        }

        aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y());
        aBewareRect2=aBoundRect2;

        sal_Int32 nH = rSet.Get(SDRATTR_EDGENODE2HORZDIST).GetValue();
        sal_Int32 nV = rSet.Get(SDRATTR_EDGENODE2VERTDIST).GetValue();

        aBewareRect2.AdjustLeft( -nH );
        aBewareRect2.AdjustRight(nH );
        aBewareRect2.AdjustTop( -nV );
        aBewareRect2.AdjustBottom(nV );
    } else {
    }
    else
    {
        aBoundRect2=tools::Rectangle(aPt2,aPt2);
        aBoundRect2.Move(rCon2.aObjOfs.X(),rCon2.aObjOfs.Y());
        aBewareRect2=aBoundRect2;
    }

    XPolygon aBestXP;
    sal_uIntPtr nBestQual=0xFFFFFFFF;
    SdrEdgeInfoRec aBestInfo;
@@ -771,30 +799,39 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const XPolygon& rTrack0, SdrObjConnection&
    sal_uInt16 nBestAuto2=0;
    sal_uInt16 nCount1=bAuto1 ? 4 : 1;
    sal_uInt16 nCount2=bAuto2 ? 4 : 1;
    for (sal_uInt16 nNum1=0; nNum1<nCount1; nNum1++) {

    for (sal_uInt16 nNum1=0; nNum1<nCount1; nNum1++)
    {
        if (bAuto1) rCon1.nConId=nNum1;
        if (bCon1 && rCon1.TakeGluePoint(aGP1)) {
        if (bCon1 && rCon1.TakeGluePoint(aGP1))
        {
            aPt1=aGP1.GetPos();
            nEsc1=aGP1.GetEscDir();
            if (nEsc1==SdrEscapeDirection::SMART) nEsc1=ImpCalcEscAngle(rCon1.pObj,aPt1-rCon1.aObjOfs);
        }
        for (sal_uInt16 nNum2=0; nNum2<nCount2; nNum2++) {
        for (sal_uInt16 nNum2=0; nNum2<nCount2; nNum2++)
        {
            if (bAuto2) rCon2.nConId=nNum2;
            if (bCon2 && rCon2.TakeGluePoint(aGP2)) {
            if (bCon2 && rCon2.TakeGluePoint(aGP2))
            {
                aPt2=aGP2.GetPos();
                nEsc2=aGP2.GetEscDir();
                if (nEsc2==SdrEscapeDirection::SMART) nEsc2=ImpCalcEscAngle(rCon2.pObj,aPt2-rCon2.aObjOfs);
            }
            for (long nA1=0; nA1<36000; nA1+=9000) {
            for (long nA1=0; nA1<36000; nA1+=9000)
            {
                SdrEscapeDirection nE1 = nA1==0 ? SdrEscapeDirection::RIGHT : nA1==9000 ? SdrEscapeDirection::TOP : nA1==18000 ? SdrEscapeDirection::LEFT : nA1==27000 ? SdrEscapeDirection::BOTTOM : SdrEscapeDirection::SMART;
                for (long nA2=0; nA2<36000; nA2+=9000) {
                for (long nA2=0; nA2<36000; nA2+=9000)
                {
                    SdrEscapeDirection nE2 = nA2==0 ? SdrEscapeDirection::RIGHT : nA2==9000 ? SdrEscapeDirection::TOP : nA2==18000 ? SdrEscapeDirection::LEFT : nA2==27000 ? SdrEscapeDirection::BOTTOM : SdrEscapeDirection::SMART;
                    if ((nEsc1&nE1) && (nEsc2&nE2)) {
                    if ((nEsc1&nE1) && (nEsc2&nE2))
                    {
                        sal_uIntPtr nQual=0;
                        SdrEdgeInfoRec aInfo;
                        if (pInfo!=nullptr) aInfo=*pInfo;
                        XPolygon aXP(ImpCalcEdgeTrack(aPt1,nA1,aBoundRect1,aBewareRect1,aPt2,nA2,aBoundRect2,aBewareRect2,&nQual,&aInfo));
                        if (nQual<nBestQual) {
                        if (nQual<nBestQual)
                        {
                            aBestXP=aXP;
                            nBestQual=nQual;
                            aBestInfo=aInfo;
@@ -1581,8 +1618,8 @@ void SdrEdgeObj::Notify(SfxBroadcaster& rBC, const SfxHint& rHint)
            ImpSetAttrToEdgeInfo(); // when changing templates, copy values from Pool to aEdgeInfo
        }
        if (bDataChg                                ||
            (bObj1 && aCon1.pObj->GetPage()==pPage) ||
            (bObj2 && aCon2.pObj->GetPage()==pPage) ||
            (bObj1 && aCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject()) ||
            (bObj2 && aCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject()) ||
            (pSdrHint && pSdrHint->GetKind()==SdrHintKind::ObjectRemoved))
        {
            // broadcasting only, if on the same page
@@ -2271,8 +2308,8 @@ void SdrEdgeObj::NbcRotate(const Point& rRef, long nAngle, double sn, double cs)
    else
    {
        // handle start and end point if not connected
        bool bCon1=aCon1.pObj!=nullptr && aCon1.pObj->GetPage()==pPage;
        bool bCon2=aCon2.pObj!=nullptr && aCon2.pObj->GetPage()==pPage;
        const bool bCon1(nullptr != aCon1.pObj && aCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
        const bool bCon2(nullptr != aCon2.pObj && aCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());

        if(!bCon1 && pEdgeTrack)
        {
@@ -2302,8 +2339,8 @@ void SdrEdgeObj::NbcMirror(const Point& rRef1, const Point& rRef2)
    else
    {
        // handle start and end point if not connected
        bool bCon1=aCon1.pObj!=nullptr && aCon1.pObj->GetPage()==pPage;
        bool bCon2=aCon2.pObj!=nullptr && aCon2.pObj->GetPage()==pPage;
        const bool bCon1(nullptr != aCon1.pObj && aCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
        const bool bCon2(nullptr != aCon2.pObj && aCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());

        if(!bCon1 && pEdgeTrack)
        {
@@ -2333,8 +2370,8 @@ void SdrEdgeObj::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShea
    else
    {
        // handle start and end point if not connected
        bool bCon1=aCon1.pObj!=nullptr && aCon1.pObj->GetPage()==pPage;
        bool bCon2=aCon2.pObj!=nullptr && aCon2.pObj->GetPage()==pPage;
        const bool bCon1(nullptr != aCon1.pObj && aCon1.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());
        const bool bCon2(nullptr != aCon2.pObj && aCon2.pObj->getSdrPageFromSdrObject() == getSdrPageFromSdrObject());

        if(!bCon1 && pEdgeTrack)
        {
diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx
index 04f7cef..6b0b2bc 100644
--- a/svx/source/svdraw/svdograf.cxx
+++ b/svx/source/svdraw/svdograf.cxx
@@ -987,10 +987,10 @@ void SdrGrafObj::RestGeoData(const SdrObjGeoData& rGeo)
    bMirrored=rGGeo.bMirrored;
}

void SdrGrafObj::SetPage( SdrPage* pNewPage )
void SdrGrafObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    bool bRemove = pNewPage == nullptr && pPage != nullptr;
    bool bInsert = pNewPage != nullptr && pPage == nullptr;
    const bool bRemove(pNewPage == nullptr && pOldPage != nullptr);
    const bool bInsert(pNewPage != nullptr && pOldPage == nullptr);

    if( bRemove )
    {
@@ -1002,30 +1002,13 @@ void SdrGrafObj::SetPage( SdrPage* pNewPage )
            ImpDeregisterLink();
    }

    if(!GetStyleSheet() && pNewPage)
    {
        // #i119287# Set default StyleSheet for SdrGrafObj here, it is different from 'Default'. This
        // needs to be done before the style 'Default' is set from the :SetModel() call which is triggered
        // from the following :SetPage().
        // TTTT: Needs to be moved in branch aw080 due to having a SdrModel from the beginning, is at this
        // place for convenience currently (works in both versions, is not in the way)
        SfxStyleSheet* pSheet(pNewPage->getSdrModelFromSdrPage().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj());

        if(pSheet)
        {
            SetStyleSheet(pSheet, false);
        }
        else
        {
            SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
            SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
        }
    }

    SdrRectObj::SetPage( pNewPage );
    // call parent
    SdrRectObj::handlePageChange(pOldPage, pNewPage);

    if (!aFileName.isEmpty() && bInsert)
    {
        ImpRegisterLink();
    }
}

void SdrGrafObj::StartAnimation()
diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx
index 47a71bd..919909f 100644
--- a/svx/source/svdraw/svdogrp.cxx
+++ b/svx/source/svdraw/svdogrp.cxx
@@ -64,11 +64,9 @@ sdr::contact::ViewContact* SdrObjGroup::CreateObjectSpecificViewContact()

SdrObjGroup::SdrObjGroup(SdrModel& rSdrModel)
:   SdrObject(rSdrModel),
    maSdrObjList(),
    SdrObjList(),
    aRefPoint(0, 0)
{
    maSdrObjList.SetOwnerObj(this);
    maSdrObjList.SetListKind(SdrObjListKind::GroupObj);
    bClosedObj=false;
}

@@ -76,12 +74,32 @@ SdrObjGroup::~SdrObjGroup()
{
}

SdrPage* SdrObjGroup::getSdrPageFromSdrObjList() const
{
    return getSdrPageFromSdrObject();
}

SdrObject* SdrObjGroup::getSdrObjectFromSdrObjList() const
{
    return const_cast< SdrObjGroup* >(this);
}

SdrModel& SdrObjGroup::getSdrModelFromSdrObjList() const
{
    return getSdrModelFromSdrObject();
}

SdrObjList* SdrObjGroup::getChildrenOfSdrObject() const
{
    return const_cast< SdrObjGroup* >(this);
}

void SdrObjGroup::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
{
    rInfo.bNoContortion=false;
    const size_t nObjCount = maSdrObjList.GetObjCount();
    const size_t nObjCount(GetObjCount());
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
        SdrObject* pObj(GetObj(i));
        SdrObjTransformInfoRec aInfo;
        pObj->TakeObjInfo(aInfo);
        if (!aInfo.bMoveAllowed            ) rInfo.bMoveAllowed            =false;
@@ -140,50 +158,46 @@ SdrLayerID SdrObjGroup::GetLayer() const
{
    bool b1st = true;
    SdrLayerID nLay = SdrObject::GetLayer();
    const size_t nObjCount = maSdrObjList.GetObjCount();
    const size_t nObjCount(GetObjCount());
    for (size_t i=0; i<nObjCount; ++i) {
        SdrLayerID nLay1=maSdrObjList.GetObj(i)->GetLayer();
        SdrLayerID nLay1(GetObj(i)->GetLayer());
        if (b1st) { nLay=nLay1; b1st = false; }
        else if (nLay1!=nLay) return SdrLayerID(0);
    }
    return nLay;
}


void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer)
{
    SdrObject::NbcSetLayer(nLayer);
    const size_t nObjCount = maSdrObjList.GetObjCount();
    const size_t nObjCount(GetObjCount());
    for (size_t i=0; i<nObjCount; ++i) {
        maSdrObjList.GetObj(i)->NbcSetLayer(nLayer);
        GetObj(i)->NbcSetLayer(nLayer);
    }
}


void SdrObjGroup::setParentOfSdrObject(SdrObjList* pNewObjList)
void SdrObjGroup::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    SdrObject::setParentOfSdrObject(pNewObjList);
    maSdrObjList.SetUpList(pNewObjList);
}
    // call patrent
    SdrObject::handlePageChange(pOldPage, pNewPage);


void SdrObjGroup::SetPage(SdrPage* pNewPage)
{
    SdrObject::SetPage(pNewPage);
    maSdrObjList.SetPage(pNewPage);
    for(size_t i(0); i < GetObjCount(); i++)
    {
        GetObj(i)->handlePageChange(pOldPage, pNewPage);
    }
}

SdrObjList* SdrObjGroup::GetSubList() const
{
    return const_cast< SdrObjList* >(&maSdrObjList);
    return const_cast< SdrObjGroup* >(this);
}

const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const
{
    // <aOutRect> has to contain the bounding rectangle
    if ( maSdrObjList.GetObjCount()!=0 )
    if(0 != GetObjCount())
    {
        const_cast<SdrObjGroup*>(this)->aOutRect = maSdrObjList.GetAllObjBoundRect();
        const_cast< SdrObjGroup* >(this)->aOutRect = GetAllObjBoundRect();
    }

    return aOutRect;
@@ -192,9 +206,9 @@ const tools::Rectangle& SdrObjGroup::GetCurrentBoundRect() const
const tools::Rectangle& SdrObjGroup::GetSnapRect() const
{
    // <aOutRect> has to contain the bounding rectangle
    if ( maSdrObjList.GetObjCount()!=0 )
    if(0 != GetObjCount())
    {
        return maSdrObjList.GetAllObjSnapRect();
        return GetAllObjSnapRect();
    }
    else
    {
@@ -221,8 +235,7 @@ SdrObjGroup& SdrObjGroup::operator=(const SdrObjGroup& rObj)
        // #i36404# Copy SubList, init model and page first
        const SdrObjList& rSourceSubList(*rObj.GetSubList());

        maSdrObjList.SetPage(rSourceSubList.GetPage());
        maSdrObjList.CopyObjects(rSourceSubList);
        CopyObjects(rSourceSubList);

        // tdf#116979: needed here, we need bSnapRectDirty to be true
        // which it is after using SdrObject::operator= (see above),
@@ -240,7 +253,7 @@ OUString SdrObjGroup::TakeObjNameSingul() const
{
    OUStringBuffer sName;

    if(!maSdrObjList.GetObjCount())
    if(0 == GetObjCount())
    {
        sName.append(SvxResId(STR_ObjNameSingulGRUPEMPTY));
    }
@@ -265,7 +278,7 @@ OUString SdrObjGroup::TakeObjNameSingul() const

OUString SdrObjGroup::TakeObjNamePlural() const
{
    if (maSdrObjList.GetObjCount()==0)
    if(0 == GetObjCount())
        return SvxResId(STR_ObjNamePluralGRUPEMPTY);
    return SvxResId(STR_ObjNamePluralGRUP);
}
@@ -279,11 +292,11 @@ void SdrObjGroup::RecalcSnapRect()
basegfx::B2DPolyPolygon SdrObjGroup::TakeXorPoly() const
{
    basegfx::B2DPolyPolygon aRetval;
    const size_t nObjCount(maSdrObjList.GetObjCount());
    const size_t nObjCount(GetObjCount());

    for(size_t a = 0; a < nObjCount; ++a)
    {
        SdrObject* pObj = maSdrObjList.GetObj(a);
        SdrObject* pObj(GetObj(a));
        aRetval.append(pObj->TakeXorPoly());
    }

@@ -312,9 +325,9 @@ long SdrObjGroup::GetRotateAngle() const
{
    long nRetval(0);

    if(maSdrObjList.GetObjCount())
    if(0 != GetObjCount())
    {
        SdrObject* pObj = maSdrObjList.GetObj(0);
        SdrObject* pObj(GetObj(0));

        nRetval = pObj->GetRotateAngle();
    }
@@ -327,9 +340,9 @@ long SdrObjGroup::GetShearAngle(bool /*bVertical*/) const
{
    long nRetval(0);

    if(maSdrObjList.GetObjCount())
    if(0 != GetObjCount())
    {
        SdrObject* pObj = maSdrObjList.GetObj(0);
        SdrObject* pObj(GetObj(0));

        nRetval = pObj->GetShearAngle();
    }
@@ -367,13 +380,18 @@ void SdrObjGroup::NbcSetLogicRect(const tools::Rectangle& rRect)
void SdrObjGroup::NbcMove(const Size& rSiz)
{
    aRefPoint.Move(rSiz);
    if (maSdrObjList.GetObjCount()!=0) {
        const size_t nObjCount = maSdrObjList.GetObjCount();
        for (size_t i=0; i<nObjCount; ++i) {
            SdrObject* pObj=maSdrObjList.GetObj(i);
    const size_t nObjCount(GetObjCount());

    if(0 != nObjCount)
    {
        for (size_t i=0; i<nObjCount; ++i)
        {
            SdrObject* pObj(GetObj(i));
            pObj->NbcMove(rSiz);
        }
    } else {
    }
    else
    {
        aOutRect.Move(rSiz);
        SetRectsDirty();
    }
@@ -397,14 +415,20 @@ void SdrObjGroup::NbcResize(const Point& rRef, const Fraction& xFact, const Frac
            NbcMirrorGluePoints(aRef1,aRef2);
        }
    }

    ResizePoint(aRefPoint,rRef,xFact,yFact);
    if (maSdrObjList.GetObjCount()!=0) {
        const size_t nObjCount = maSdrObjList.GetObjCount();
        for (size_t i=0; i<nObjCount; ++i) {
            SdrObject* pObj=maSdrObjList.GetObj(i);

    const size_t nObjCount(GetObjCount());
    if(0 != nObjCount)
    {
        for (size_t i=0; i<nObjCount; ++i)
        {
            SdrObject* pObj(GetObj(i));
            pObj->NbcResize(rRef,xFact,yFact);
        }
    } else {
    }
    else
    {
        ResizeRect(aOutRect,rRef,xFact,yFact);
        SetRectsDirty();
    }
@@ -415,11 +439,14 @@ void SdrObjGroup::NbcRotate(const Point& rRef, long nAngle, double sn, double cs
{
    SetGlueReallyAbsolute(true);
    RotatePoint(aRefPoint,rRef,sn,cs);
    const size_t nObjCount = maSdrObjList.GetObjCount();
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
    const size_t nObjCount(GetObjCount());

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        pObj->NbcRotate(rRef,nAngle,sn,cs);
    }

    NbcRotateGluePoints(rRef,nAngle,sn,cs);
    SetGlueReallyAbsolute(false);
}
@@ -429,11 +456,14 @@ void SdrObjGroup::NbcMirror(const Point& rRef1, const Point& rRef2)
{
    SetGlueReallyAbsolute(true);
    MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
    const size_t nObjCount = maSdrObjList.GetObjCount();
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
    const size_t nObjCount(GetObjCount());

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        pObj->NbcMirror(rRef1,rRef2);
    }

    NbcMirrorGluePoints(rRef1,rRef2);
    SetGlueReallyAbsolute(false);
}
@@ -443,11 +473,14 @@ void SdrObjGroup::NbcShear(const Point& rRef, long nAngle, double tn, bool bVShe
{
    SetGlueReallyAbsolute(true);
    ShearPoint(aRefPoint,rRef,tn);
    const size_t nObjCount = maSdrObjList.GetObjCount();
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
    const size_t nObjCount(GetObjCount());

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        pObj->NbcShear(rRef,nAngle,tn,bVShear);
    }

    NbcShearGluePoints(rRef,tn,bVShear);
    SetGlueReallyAbsolute(false);
}
@@ -458,9 +491,11 @@ void SdrObjGroup::NbcSetAnchorPos(const Point& rPnt)
    aAnchor=rPnt;
    Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
    aRefPoint.Move(aSiz);
    const size_t nObjCount=maSdrObjList.GetObjCount();
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
    const size_t nObjCount(GetObjCount());

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        pObj->NbcSetAnchorPos(rPnt);
    }
}
@@ -502,18 +537,27 @@ void SdrObjGroup::Move(const Size& rSiz)
    if (rSiz.Width()!=0 || rSiz.Height()!=0) {
        tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
        aRefPoint.Move(rSiz);
        if (maSdrObjList.GetObjCount()!=0) {
        const size_t nObjCount(GetObjCount());

        if(0 != nObjCount)
        {
            // first move the connectors, then everything else
            const size_t nObjCount = maSdrObjList.GetObjCount();
            for (size_t i=0; i<nObjCount; ++i) {
                SdrObject* pObj=maSdrObjList.GetObj(i);
                if (pObj->IsEdgeObj()) pObj->Move(rSiz);
            for (size_t i=0; i<nObjCount; ++i)
            {
                SdrObject* pObj(GetObj(i));
                if (pObj->IsEdgeObj())
                    pObj->Move(rSiz);
            }
            for (size_t i=0; i<nObjCount; ++i) {
                SdrObject* pObj=maSdrObjList.GetObj(i);
                if (!pObj->IsEdgeObj()) pObj->Move(rSiz);

            for (size_t i=0; i<nObjCount; ++i)
            {
                SdrObject* pObj(GetObj(i));
                if (!pObj->IsEdgeObj())
                    pObj->Move(rSiz);
            }
        } else {
        }
        else
        {
            aOutRect.Move(rSiz);
            SetRectsDirty();
        }
@@ -545,18 +589,27 @@ void SdrObjGroup::Resize(const Point& rRef, const Fraction& xFact, const Fractio
        }
        tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
        ResizePoint(aRefPoint,rRef,xFact,yFact);
        if (maSdrObjList.GetObjCount()!=0) {
        const size_t nObjCount(GetObjCount());

        if(0 != nObjCount)
        {
            // move the connectors first, everything else afterwards
            const size_t nObjCount = maSdrObjList.GetObjCount();
            for (size_t i=0; i<nObjCount; ++i) {
                SdrObject* pObj=maSdrObjList.GetObj(i);
                if (pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
            for (size_t i=0; i<nObjCount; ++i)
            {
                SdrObject* pObj(GetObj(i));
                if (pObj->IsEdgeObj())
                    pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
            }
            for (size_t i=0; i<nObjCount; ++i) {
                SdrObject* pObj=maSdrObjList.GetObj(i);
                if (!pObj->IsEdgeObj()) pObj->Resize(rRef,xFact,yFact,bUnsetRelative);

            for (size_t i=0; i<nObjCount; ++i)
            {
                SdrObject* pObj(GetObj(i));
                if (!pObj->IsEdgeObj())
                    pObj->Resize(rRef,xFact,yFact,bUnsetRelative);
            }
        } else {
        }
        else
        {
            ResizeRect(aOutRect,rRef,xFact,yFact);
            SetRectsDirty();
        }
@@ -577,15 +630,22 @@ void SdrObjGroup::Rotate(const Point& rRef, long nAngle, double sn, double cs)
    tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
    RotatePoint(aRefPoint,rRef,sn,cs);
    // move the connectors first, everything else afterwards
    const size_t nObjCount = maSdrObjList.GetObjCount();
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
        if (pObj->IsEdgeObj()) pObj->Rotate(rRef,nAngle,sn,cs);
    const size_t nObjCount(GetObjCount());

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        if (pObj->IsEdgeObj())
            pObj->Rotate(rRef,nAngle,sn,cs);
    }
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
        if (!pObj->IsEdgeObj()) pObj->Rotate(rRef,nAngle,sn,cs);

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        if (!pObj->IsEdgeObj())
            pObj->Rotate(rRef,nAngle,sn,cs);
    }

    NbcRotateGluePoints(rRef,nAngle,sn,cs);
    SetGlueReallyAbsolute(false);
    SetChanged();
@@ -600,15 +660,22 @@ void SdrObjGroup::Mirror(const Point& rRef1, const Point& rRef2)
    tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
    MirrorPoint(aRefPoint,rRef1,rRef2); // implementation missing in SvdEtc!
    // move the connectors first, everything else afterwards
    const size_t nObjCount = maSdrObjList.GetObjCount();
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
        if (pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);
    const size_t nObjCount(GetObjCount());

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        if (pObj->IsEdgeObj())
            pObj->Mirror(rRef1,rRef2);
    }
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
        if (!pObj->IsEdgeObj()) pObj->Mirror(rRef1,rRef2);

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        if (!pObj->IsEdgeObj())
            pObj->Mirror(rRef1,rRef2);
    }

    NbcMirrorGluePoints(rRef1,rRef2);
    SetGlueReallyAbsolute(false);
    SetChanged();
@@ -626,15 +693,22 @@ void SdrObjGroup::Shear(const Point& rRef, long nAngle, double tn, bool bVShear)
    tools::Rectangle aBoundRect0; if (pUserCall!=nullptr) aBoundRect0=GetLastBoundRect();
    ShearPoint(aRefPoint,rRef,tn);
    // move the connectors first, everything else afterwards
    const size_t nObjCount = maSdrObjList.GetObjCount();
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
        if (pObj->IsEdgeObj()) pObj->Shear(rRef,nAngle,tn,bVShear);
    const size_t nObjCount(GetObjCount());

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        if (pObj->IsEdgeObj())
            pObj->Shear(rRef,nAngle,tn,bVShear);
    }
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
        if (!pObj->IsEdgeObj()) pObj->Shear(rRef,nAngle,tn,bVShear);

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        if (!pObj->IsEdgeObj())
            pObj->Shear(rRef,nAngle,tn,bVShear);
    }

    NbcShearGluePoints(rRef,tn,bVShear);
    SetGlueReallyAbsolute(false);
    SetChanged();
@@ -652,16 +726,24 @@ void SdrObjGroup::SetAnchorPos(const Point& rPnt)
    Size aSiz(rPnt.X()-aAnchor.X(),rPnt.Y()-aAnchor.Y());
    aRefPoint.Move(aSiz);
    // move the connectors first, everything else afterwards
    const size_t nObjCount = maSdrObjList.GetObjCount();
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj=maSdrObjList.GetObj(i);
        if (pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);
    const size_t nObjCount(GetObjCount());

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        if (pObj->IsEdgeObj())
            pObj->SetAnchorPos(rPnt);
    }
    for (size_t i=0; i<nObjCount; ++i) {
        SdrObject* pObj = maSdrObjList.GetObj(i);
        if (!pObj->IsEdgeObj()) pObj->SetAnchorPos(rPnt);

    for (size_t i=0; i<nObjCount; ++i)
    {
        SdrObject* pObj(GetObj(i));
        if (!pObj->IsEdgeObj())
            pObj->SetAnchorPos(rPnt);
    }
    if (bChg) {

    if (bChg)
    {
        SetChanged();
        BroadcastObjectChange();
        SendUserCall(SdrUserCallType::MoveOnly,aBoundRect0);
@@ -685,22 +767,23 @@ void SdrObjGroup::SetRelativePos(const Point& rPnt)

void SdrObjGroup::NbcReformatText()
{
    maSdrObjList.NbcReformatAllTextObjects();
    NbcReformatAllTextObjects();
}

void SdrObjGroup::ReformatText()
{
    maSdrObjList.ReformatAllTextObjects();
    ReformatAllTextObjects();
}

SdrObject* SdrObjGroup::DoConvertToPolyObj(bool bBezier, bool bAddText) const
{
    SdrObject* pGroup = new SdrObjGroup(getSdrModelFromSdrObject());
    const size_t nObjCount(GetObjCount());

    for(size_t a=0; a<maSdrObjList.GetObjCount(); ++a)
    for(size_t a=0; a < nObjCount; ++a)
    {
        SdrObject* pIterObj = maSdrObjList.GetObj(a);
        SdrObject* pResult = pIterObj->DoConvertToPolyObj(bBezier, bAddText);
        SdrObject* pIterObj(GetObj(a));
        SdrObject* pResult(pIterObj->DoConvertToPolyObj(bBezier, bAddText));

        // pResult can be NULL e.g. for empty objects
        if( pResult )
@@ -716,8 +799,8 @@ void SdrObjGroup::dumpAsXml(xmlTextWriterPtr pWriter) const
    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);

    SdrObject::dumpAsXml(pWriter);
    SdrObjList::dumpAsXml(pWriter);

    maSdrObjList.dumpAsXml(pWriter);
    xmlTextWriterEndElement(pWriter);
}

diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 30a41a8..cddbd32 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -1238,38 +1238,23 @@ SdrObject* SdrOle2Obj::DoConvertToPolyObj(bool bBezier, bool bAddText) const
    return nullptr;
}

void SdrOle2Obj::SetPage(SdrPage* pNewPage)
void SdrOle2Obj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    bool bRemove=pNewPage==nullptr && pPage!=nullptr;
    bool bInsert=pNewPage!=nullptr && pPage==nullptr;
    const bool bRemove(pNewPage == nullptr && pOldPage != nullptr);
    const bool bInsert(pNewPage != nullptr && pOldPage == nullptr);

    if (bRemove && mpImpl->mbConnected )
        Disconnect();

    if(!GetStyleSheet() && pNewPage)
    {
        // #i119287# Set default StyleSheet for SdrGrafObj here, it is different from 'Default'. This
        // needs to be done before the style 'Default' is set from the :SetModel() call which is triggered
        // from the following :SetPage().
        // TTTT: Needs to be moved in branch aw080 due to having a SdrModel from the beginning, is at this
        // place for convenience currently (works in both versions, is not in the way)
        SfxStyleSheet* pSheet = pNewPage->getSdrModelFromSdrPage().GetDefaultStyleSheetForSdrGrafObjAndSdrOle2Obj();

        if(pSheet)
        {
            SetStyleSheet(pSheet, false);
        }
        else
        {
            SetMergedItem(XFillStyleItem(drawing::FillStyle_NONE));
            SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE));
        }
        Disconnect();
    }

    SdrRectObj::SetPage(pNewPage);
    // call parent
    SdrRectObj::handlePageChange(pOldPage, pNewPage);

    if (bInsert && !mpImpl->mbConnected )
    {
        Connect();
    }
}

void SdrOle2Obj::SetObjRef( const css::uno::Reference < css::embed::XEmbeddedObject >& rNewObjRef )
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 9469e7984..41bd67e 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -452,19 +452,22 @@ bool SdrTextObj::HasTextImpl( SdrOutliner const * pOutliner )
    return bRet;
}

void SdrTextObj::SetPage(SdrPage* pNewPage)
void SdrTextObj::handlePageChange(SdrPage* pOldPage, SdrPage* pNewPage)
{
    bool bRemove=pNewPage==nullptr && pPage!=nullptr;
    bool bInsert=pNewPage!=nullptr && pPage==nullptr;
    bool bLinked=IsLinkedText();
    const bool bRemove(pNewPage == nullptr && pOldPage != nullptr);
    const bool bInsert(pNewPage != nullptr && pOldPage == nullptr);
    const bool bLinked(IsLinkedText());

    if (bLinked && bRemove) {
    if (bLinked && bRemove)
    {
        ImpDeregisterLink();
    }

    SdrAttrObj::SetPage(pNewPage);
    // call parent
    SdrAttrObj::handlePageChange(pOldPage, pNewPage);

    if (bLinked && bInsert) {
    if (bLinked && bInsert)
    {
        ImpRegisterLink();
    }
}
@@ -1949,7 +1952,7 @@ void ImpUpdateChainLinks(SdrTextObj *pTextObj, OUString const& aNextLinkName)
        return;
    }

    SdrPage *pPage = pTextObj->GetPage();
    SdrPage *pPage(pTextObj->getSdrPageFromSdrObject());
    assert(pPage);
    SdrTextObj *pNextTextObj = dynamic_cast< SdrTextObj * >
                                (ImpGetObjByName(pPage, aNextLinkName));
diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx
index ede3f67..750a5b8 100644
--- a/svx/source/svdraw/svdotextdecomposition.cxx
+++ b/svx/source/svdraw/svdotextdecomposition.cxx
@@ -859,7 +859,7 @@ void SdrObject::setSuitableOutlinerBg(::Outliner& rOutliner) const

    if (drawing::FillStyle_NONE == pBackgroundFillSet->Get(XATTR_FILLSTYLE).GetValue())
    {
        SdrPage *pOwnerPage = GetPage();
        SdrPage *pOwnerPage = getSdrPageFromSdrObject();
        if (pOwnerPage)
        {
            pBackgroundFillSet = &pOwnerPage->getSdrPageProperties().GetItemSet();
@@ -1443,16 +1443,19 @@ void SdrTextObj::impHandleChainingEventsDuringDecomposition(SdrOutliner &rOutlin
    TextChainFlow aTxtChainFlow(const_cast<SdrTextObj*>(this));
    bool bIsOverflow;

#ifdef DBG_UTIL
    // Some debug output
    size_t nObjCount = pPage->GetObjCount();
    for (size_t i = 0; i < nObjCount; i++) {
        SdrTextObj *pCurObj = static_cast<SdrTextObj *>(pPage->GetObj(i));

        if (pCurObj == this) {
    size_t nObjCount(getSdrPageFromSdrObject()->GetObjCount());
    for (size_t i = 0; i < nObjCount; i++)
    {
        SdrTextObj* pCurObj(dynamic_cast< SdrTextObj* >(getSdrPageFromSdrObject()->GetObj(i)));
        if(pCurObj == this)
        {
            SAL_INFO("svx.chaining", "Working on TextBox " << i);
            break;
        }
    }
#endif

    aTxtChainFlow.CheckForFlowEvents(&rOutliner);

diff --git a/svx/source/svdraw/svdouno.cxx b/svx/source/svdraw/svdouno.cxx
index 3a1cb78..94bd1cf 100644
--- a/svx/source/svdraw/svdouno.cxx
+++ b/svx/source/svdraw/svdouno.cxx
@@ -485,8 +485,8 @@ uno::Reference< awt::XControl > SdrUnoObj::GetUnoControl(const SdrView& _rView, 
    uno::Reference< awt::XControl > xControl;

    SdrPageView* pPageView = _rView.GetSdrPageView();
    OSL_ENSURE( pPageView && GetPage() == pPageView->GetPage(), "SdrUnoObj::GetUnoControl: This object is not displayed in that particular view!" );
    if ( !pPageView || GetPage() != pPageView->GetPage() )
    OSL_ENSURE( pPageView && getSdrPageFromSdrObject() == pPageView->GetPage(), "SdrUnoObj::GetUnoControl: This object is not displayed in that particular view!" );
    if ( !pPageView || getSdrPageFromSdrObject() != pPageView->GetPage() )
        return nullptr;

    SdrPageWindow* pPageWindow = pPageView->FindPageWindow( _rOut );
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 1b25b3f..cf3ae4d 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -66,22 +66,28 @@ public:
        : ::std::vector<tools::WeakReference<SdrObject>>(nInitialSize) {};
};


static const sal_Int32 InitialObjectContainerCapacity (64);

////////////////////////////////////////////////////////////////////////////////////////////////////
// helper to allow changing parent at SdrObject, but only from SdrObjList

SdrObjList::SdrObjList(SdrPage* pNewPage)
void SetParentAtSdrObjectFromSdrObjList(SdrObject& rSdrObject, SdrObjList* pNew)
{
    rSdrObject.setParentOfSdrObject(pNew);
}

//////////////////////////////////////////////////////////////////////////////

SdrObjList::SdrObjList()
:   maList(),
    maSdrObjListOutRect(),
    maSdrObjListSnapRect(),
    mbObjOrdNumsDirty(false),
    mbRectsDirty(false),
    mxNavigationOrder(),
    mbIsNavigationOrderDirty(false)
{
    maList.reserve(InitialObjectContainerCapacity);
    mpPage=pNewPage;
    pUpList=nullptr;
    bObjOrdNumsDirty=false;
    bRectsDirty=false;
    pOwnerObj=nullptr;
    eListKind=SdrObjListKind::Unknown;
}

void SdrObjList::impClearSdrObjList(bool bBroadcast)
@@ -91,7 +97,7 @@ void SdrObjList::impClearSdrObjList(bool bBroadcast)
    while(!maList.empty())
    {
        // remove last object from list
        SdrObject* pObj = maList.back();
        SdrObject* pObj(maList.back());
        RemoveObjectFromContainer(maList.size()-1);

        // flushViewObjectContacts() is done since SdrObject::Free is not guaranteed
@@ -106,7 +112,8 @@ void SdrObjList::impClearSdrObjList(bool bBroadcast)
            }

            // sent remove hint (after removal, see RemoveObject())
            SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj, mpPage);
            // TTTT SdrPage not needed, can be accessed using SdrObject
            SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj, getSdrPageFromSdrObjList());
            pObj->getSdrModelFromSdrObject().Broadcast(aHint);
        }

@@ -132,12 +139,16 @@ SdrObjList::~SdrObjList()
    impClearSdrObjList(false);
}

void SdrObjList::copyDataFromSdrObjList(const SdrObjList& rSrcList)
SdrPage* SdrObjList::getSdrPageFromSdrObjList() const
{
    // this function is only supposed to be called once, right after construction
    assert(maList.empty());
    eListKind=rSrcList.eListKind;
    CopyObjects(rSrcList);
    // default is no page and returns zero
    return nullptr;
}

SdrObject* SdrObjList::getSdrObjectFromSdrObjList() const
{
    // default is no SdrObject (SdrObjGroup)
    return nullptr;
}

void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
@@ -145,20 +156,20 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
    // clear SdrObjects with broadcasting
    ClearSdrObjList();

    bObjOrdNumsDirty = false;
    bRectsDirty = false;
    mbObjOrdNumsDirty = false;
    mbRectsDirty = false;
    size_t nCloneErrCnt(0);
    const size_t nCount(rSrcList.GetObjCount());

    if(nullptr == GetOwnerObj() && nullptr == GetPage())
    if(nullptr == getSdrObjectFromSdrObjList() && nullptr == getSdrPageFromSdrObjList())
    {
        OSL_ENSURE(false, "SdrObjList which is not part of SdrPage or SdrObject (!)");
        return;
    }

    SdrModel& rTargetSdrModel(nullptr == GetOwnerObj()
        ? GetPage()->getSdrModelFromSdrPage()
        : GetOwnerObj()->getSdrModelFromSdrObject());
    SdrModel& rTargetSdrModel(nullptr == getSdrObjectFromSdrObjList()
        ? getSdrPageFromSdrObjList()->getSdrModelFromSdrPage()
        : getSdrObjectFromSdrObjList()->getSdrModelFromSdrObject());

    for (size_t no(0); no < nCount; ++no)
    {
@@ -167,7 +178,6 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList)

        if(nullptr != pDO)
        {
            pDO->SetPage(mpPage);
            NbcInsertObject(pDO, SAL_MAX_SIZE);
        }
        else
@@ -242,23 +252,6 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
    }
}

SdrPage* SdrObjList::GetPage() const
{
    return mpPage;
}

void SdrObjList::SetPage(SdrPage* pNewPage)
{
    if (mpPage!=pNewPage) {
        mpPage=pNewPage;
        const size_t nCount = GetObjCount();
        for (size_t no=0; no<nCount; ++no) {
            SdrObject* pObj=GetObj(no);
            pObj->SetPage(mpPage);
        }
    }
}

void SdrObjList::RecalcObjOrdNums()
{
    const size_t nCount = GetObjCount();
@@ -266,30 +259,35 @@ void SdrObjList::RecalcObjOrdNums()
        SdrObject* pObj=GetObj(no);
        pObj->SetOrdNum(no);
    }
    bObjOrdNumsDirty=false;
    mbObjOrdNumsDirty=false;
}

void SdrObjList::RecalcRects()
{
    maOutRect=tools::Rectangle();
    aSnapRect=maOutRect;
    maSdrObjListOutRect=tools::Rectangle();
    maSdrObjListSnapRect=maSdrObjListOutRect;
    const size_t nCount = GetObjCount();
    for (size_t i=0; i<nCount; ++i) {
        SdrObject* pObj=GetObj(i);
        if (i==0) {
            maOutRect=pObj->GetCurrentBoundRect();
            aSnapRect=pObj->GetSnapRect();
            maSdrObjListOutRect=pObj->GetCurrentBoundRect();
            maSdrObjListSnapRect=pObj->GetSnapRect();
        } else {
            maOutRect.Union(pObj->GetCurrentBoundRect());
            aSnapRect.Union(pObj->GetSnapRect());
            maSdrObjListOutRect.Union(pObj->GetCurrentBoundRect());
            maSdrObjListSnapRect.Union(pObj->GetSnapRect());
        }
    }
}

void SdrObjList::SetRectsDirty()
void SdrObjList::SetSdrObjListRectsDirty()
{
    bRectsDirty=true;
    if (pUpList!=nullptr) pUpList->SetRectsDirty();
    mbRectsDirty=true;
    SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());

    if(nullptr != pParentSdrObject)
    {
        pParentSdrObject->SetRectsDirty();
    }
}

void SdrObjList::impChildInserted(SdrObject const & rChild)
@@ -313,18 +311,17 @@ void SdrObjList::NbcInsertObject(SdrObject* pObj, size_t nPos)
    if (nPos>nCount) nPos=nCount;
    InsertObjectIntoContainer(*pObj,nPos);

    if (nPos<nCount) bObjOrdNumsDirty=true;
    if (nPos<nCount) mbObjOrdNumsDirty=true;
    pObj->SetOrdNum(nPos);
    pObj->setParentOfSdrObject(this);
    pObj->SetPage(mpPage);
    SetParentAtSdrObjectFromSdrObjList(*pObj, this);

    // Inform the parent about change to allow invalidations at
    // evtl. existing parent visualisations
    impChildInserted(*pObj);

    if (!bRectsDirty) {
        maOutRect.Union(pObj->GetCurrentBoundRect());
        aSnapRect.Union(pObj->GetSnapRect());
    if (!mbRectsDirty) {
        maSdrObjListOutRect.Union(pObj->GetCurrentBoundRect());
        maSdrObjListSnapRect.Union(pObj->GetSnapRect());
    }
    pObj->SetInserted(true); // calls the UserCall (among others)
}
@@ -336,7 +333,7 @@ void SdrObjList::InsertObject(SdrObject* pObj, size_t nPos)
    if(pObj)
    {
        // if anchor is used, reset it before grouping
        if(GetOwnerObj())
        if(getSdrObjectFromSdrObjList())
        {
            const Point& rAnchorPos = pObj->GetAnchorPos();
            if(rAnchorPos.X() || rAnchorPos.Y())
@@ -348,15 +345,17 @@ void SdrObjList::InsertObject(SdrObject* pObj, size_t nPos)

        // In case the object is inserted into a group and doesn't overlap with
        // the group's other members, it needs an own repaint.
        if(pOwnerObj)
        SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());

        if(pParentSdrObject)
        {
            // only repaint here
            pOwnerObj->ActionChanged();
            pParentSdrObject->ActionChanged();
        }

        // TODO: We need a different broadcast here!
        // Repaint from object number ... (heads-up: GroupObj)
        if(pObj->GetPage())
        if(pObj->getSdrPageFromSdrObject())
        {
            SdrHint aHint(SdrHintKind::ObjectInserted, *pObj);
            pObj->getSdrModelFromSdrObject().Broadcast(aHint);
@@ -379,20 +378,22 @@ SdrObject* SdrObjList::NbcRemoveObject(size_t nObjNum)
    RemoveObjectFromContainer(nObjNum);

    DBG_ASSERT(pObj!=nullptr,"Could not find object to remove.");
    if (pObj!=nullptr) {
    if (pObj!=nullptr)
    {
        // flushViewObjectContacts() clears the VOC's and those invalidate
        pObj->GetViewContact().flushViewObjectContacts();

        DBG_ASSERT(pObj->IsInserted(),"The object does not have the status Inserted.");
        pObj->SetInserted(false); // calls UserCall, among other
        pObj->setParentOfSdrObject(nullptr);
        pObj->SetPage(nullptr);
        if (!bObjOrdNumsDirty) { // optimizing for the case that the last object has to be removed
        SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
        if (!mbObjOrdNumsDirty)
        {
            // optimizing for the case that the last object has to be removed
            if (nObjNum+1!=nCount) {
                bObjOrdNumsDirty=true;
                mbObjOrdNumsDirty=true;
            }
        }
        SetRectsDirty();
        SetSdrObjListRectsDirty();
    }
    return pObj;
}
@@ -417,7 +418,7 @@ SdrObject* SdrObjList::RemoveObject(size_t nObjNum)
        DBG_ASSERT(pObj->IsInserted(),"The object does not have the status Inserted.");

        // TODO: We need a different broadcast here.
        if (pObj->GetPage()!=nullptr)
        if (pObj->getSdrPageFromSdrObject()!=nullptr)
        {
            SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj);
            pObj->getSdrModelFromSdrObject().Broadcast(aHint);
@@ -426,20 +427,24 @@ SdrObject* SdrObjList::RemoveObject(size_t nObjNum)
        pObj->getSdrModelFromSdrObject().SetChanged();

        pObj->SetInserted(false); // calls, among other things, the UserCall
        pObj->setParentOfSdrObject(nullptr);
        pObj->SetPage(nullptr);
        if (!bObjOrdNumsDirty) { // optimization for the case that the last object is removed
        SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);

        if (!mbObjOrdNumsDirty)
        {
            // optimization for the case that the last object is removed
            if (nObjNum+1!=nCount) {
                bObjOrdNumsDirty=true;
                mbObjOrdNumsDirty=true;
            }
        }
        SetRectsDirty();

        if(pOwnerObj && !GetObjCount())
        SetSdrObjListRectsDirty();
        SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());

        if(pParentSdrObject && !GetObjCount())
        {
            // empty group created; it needs to be repainted since it's
            // visualization changes
            pOwnerObj->ActionChanged();
            pParentSdrObject->ActionChanged();
        }
    }
    return pObj;
@@ -459,23 +464,21 @@ SdrObject* SdrObjList::NbcReplaceObject(SdrObject* pNewObj, size_t nObjNum)
    if (pObj!=nullptr) {
        DBG_ASSERT(pObj->IsInserted(),"SdrObjList::ReplaceObject: the object does not have status Inserted.");
        pObj->SetInserted(false);
        pObj->setParentOfSdrObject(nullptr);
        pObj->SetPage(nullptr);
        SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
        ReplaceObjectInContainer(*pNewObj,nObjNum);

        // flushViewObjectContacts() clears the VOC's and those invalidate
        pObj->GetViewContact().flushViewObjectContacts();

        pNewObj->SetOrdNum(nObjNum);
        pNewObj->setParentOfSdrObject(this);
        pNewObj->SetPage(mpPage);
        SetParentAtSdrObjectFromSdrObjList(*pNewObj, this);

        // Inform the parent about change to allow invalidations at
        // evtl. existing parent visualisations
        impChildInserted(*pNewObj);

        pNewObj->SetInserted(true);
        SetRectsDirty();
        SetSdrObjListRectsDirty();
    }
    return pObj;
}
@@ -499,23 +502,21 @@ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, size_t nObjNum)
        DBG_ASSERT(pObj->IsInserted(),"SdrObjList::ReplaceObject: the object does not have status Inserted.");

        // TODO: We need a different broadcast here.
        if (pObj->GetPage()!=nullptr)
        if (pObj->getSdrPageFromSdrObject()!=nullptr)
        {
            SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj);
            pObj->getSdrModelFromSdrObject().Broadcast(aHint);
        }

        pObj->SetInserted(false);
        pObj->setParentOfSdrObject(nullptr);
        pObj->SetPage(nullptr);
        SetParentAtSdrObjectFromSdrObjList(*pObj, nullptr);
        ReplaceObjectInContainer(*pNewObj,nObjNum);

        // flushViewObjectContacts() clears the VOC's and those invalidate
        pObj->GetViewContact().flushViewObjectContacts();

        pNewObj->SetOrdNum(nObjNum);
        pNewObj->setParentOfSdrObject(this);
        pNewObj->SetPage(mpPage);
        SetParentAtSdrObjectFromSdrObjList(*pNewObj, this);

        // Inform the parent about change to allow invalidations at
        // evtl. existing parent visualisations
@@ -524,14 +525,14 @@ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, size_t nObjNum)
        pNewObj->SetInserted(true);

        // TODO: We need a different broadcast here.
        if (pNewObj->GetPage()!=nullptr) {
        if (pNewObj->getSdrPageFromSdrObject()!=nullptr) {
            SdrHint aHint(SdrHintKind::ObjectInserted, *pNewObj);
            pNewObj->getSdrModelFromSdrObject().Broadcast(aHint);
        }

        pNewObj->getSdrModelFromSdrObject().SetChanged();

        SetRectsDirty();
        SetSdrObjListRectsDirty();
    }
    return pObj;
}
@@ -558,10 +559,10 @@ SdrObject* SdrObjList::SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
        pObj->ActionChanged();

        pObj->SetOrdNum(nNewObjNum);
        bObjOrdNumsDirty=true;
        mbObjOrdNumsDirty=true;

        // TODO: We need a different broadcast here.
        if (pObj->GetPage()!=nullptr)
        if (pObj->getSdrPageFromSdrObject()!=nullptr)
            pObj->getSdrModelFromSdrObject().Broadcast(SdrHint(SdrHintKind::ObjectChange, *pObj));
        pObj->getSdrModelFromSdrObject().SetChanged();
    }
@@ -570,11 +571,11 @@ SdrObject* SdrObjList::SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)

const tools::Rectangle& SdrObjList::GetAllObjSnapRect() const
{
    if (bRectsDirty) {
    if (mbRectsDirty) {
        const_cast<SdrObjList*>(this)->RecalcRects();
        const_cast<SdrObjList*>(this)->bRectsDirty=false;
        const_cast<SdrObjList*>(this)->mbRectsDirty=false;
    }
    return aSnapRect;
    return maSdrObjListSnapRect;
}

const tools::Rectangle& SdrObjList::GetAllObjBoundRect() const
@@ -582,14 +583,14 @@ const tools::Rectangle& SdrObjList::GetAllObjBoundRect() const
    // #i106183# for deep group hierarchies like in chart2, the invalidates
    // through the hierarchy are not correct; use a 2nd hint for the needed
    // recalculation. Future versions will have no bool flag at all, but
    // just maOutRect in empty state to represent an invalid state, thus
    // just maSdrObjListOutRect in empty state to represent an invalid state, thus
    // it's a step in the right direction.
    if (bRectsDirty || maOutRect.IsEmpty())
    if (mbRectsDirty || maSdrObjListOutRect.IsEmpty())
    {
        const_cast<SdrObjList*>(this)->RecalcRects();
        const_cast<SdrObjList*>(this)->bRectsDirty=false;
        const_cast<SdrObjList*>(this)->mbRectsDirty=false;
    }
    return maOutRect;
    return maSdrObjListOutRect;
}

void SdrObjList::NbcReformatAllTextObjects()
@@ -620,7 +621,7 @@ void SdrObjList::ReformatAllTextObjects()
void SdrObjList::ReformatAllEdgeObjects()
{
    // #i120437# go over whole hierarchy, not only over object level null (seen from grouping)
    SdrObjListIter aIter(*this, SdrIterMode::DeepNoGroups);
    SdrObjListIter aIter(this, SdrIterMode::DeepNoGroups);

    while(aIter.IsMore())
    {
@@ -661,8 +662,19 @@ SdrObject* SdrObjList::GetObj(size_t nNum) const

bool SdrObjList::IsReadOnly() const
{
    bool bRet = false;
    if (mpPage!=nullptr && mpPage!=this) bRet=mpPage->IsReadOnly();
    bool bRet(false);
    SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());

    if(nullptr != pParentSdrObject)
    {
        SdrPage* pSdrPage(pParentSdrObject->getSdrPageFromSdrObject());

        if(nullptr != pSdrPage)
        {
            bRet = pSdrPage->IsReadOnly();
        }
    }

    return bRet;
}

@@ -847,7 +859,9 @@ void SdrObjList::SetNavigationOrder (const uno::Reference<container::XIndexAcces
        mbIsNavigationOrderDirty = true;
    }
    else
    {
        ClearObjectNavigationOrder();
    }
}


@@ -873,7 +887,7 @@ void SdrObjList::InsertObjectIntoContainer (
        maList.push_back(&rObject);
    else
        maList.insert(maList.begin()+nInsertPosition, &rObject);
    bObjOrdNumsDirty=true;
    mbObjOrdNumsDirty=true;
}


@@ -908,7 +922,7 @@ void SdrObjList::ReplaceObjectInContainer (
    }

    maList[nObjectPosition] = &rNewObject;
    bObjOrdNumsDirty=true;
    mbObjOrdNumsDirty=true;
}


@@ -935,7 +949,7 @@ void SdrObjList::RemoveObjectFromContainer (
    }

    maList.erase(maList.begin()+nObjectPosition);
    bObjOrdNumsDirty=true;
    mbObjOrdNumsDirty=true;
}

void SdrObjList::dumpAsXml(xmlTextWriterPtr pWriter) const
@@ -1118,7 +1132,7 @@ void SdrPageProperties::SetStyleSheet(SfxStyleSheet* pStyleSheet)

SdrPage::SdrPage(SdrModel& rModel, bool bMasterPage)
:   tools::WeakBase(),
    SdrObjList(this),
    SdrObjList(),
    maPageUsers(),
    mpViewContact(nullptr),
    mrSdrModelFromSdrPage(rModel),
@@ -1140,8 +1154,6 @@ SdrPage::SdrPage(SdrModel& rModel, bool bMasterPage)
    mbPageBorderOnlyLeftRight(false)
{
    aPrefVisiLayers.SetAll();
    eListKind = bMasterPage ? SdrObjListKind::MasterPage : SdrObjListKind::DrawPage;

    mpSdrPageProperties.reset(new SdrPageProperties(*this));
}

@@ -1182,11 +1194,14 @@ SdrPage::~SdrPage()
    mpSdrPageProperties.reset();
}

SdrModel& SdrPage::getSdrModelFromSdrObjList() const
{
    return getSdrModelFromSdrPage();
}

void SdrPage::lateInit(const SdrPage& rSrcPage)
{
    assert(!mpViewContact);
    // SdrPageProperties get set by SdrPage::SdrPage already, so do not assert anymore
    // assert(!mpSdrPageProperties);
    assert(!mxUnoPage.is());

    // copy all the local parameters to make this instance
@@ -1227,11 +1242,10 @@ void SdrPage::lateInit(const SdrPage& rSrcPage)
    }

    // Now copy the contained objects
    SdrObjList::copyDataFromSdrObjList(rSrcPage);

    // be careful and correct eListKind, a member of SdrObjList which
    // will be changed by the SdrObjList::lateInit before...
    eListKind = (mbMaster) ? SdrObjListKind::MasterPage : SdrObjListKind::DrawPage;
    if(0 != rSrcPage.GetObjCount())
    {
        CopyObjects(rSrcPage);
    }
}

SdrPage* SdrPage::CloneSdrPage(SdrModel& rTargetModel) const
@@ -1424,6 +1438,10 @@ void SdrPage::SetChanged()
    getSdrModelFromSdrPage().SetChanged();
}

SdrPage* SdrPage::getSdrPageFromSdrObjList() const
{
    return const_cast< SdrPage* >(this);
}

// MasterPage interface

@@ -1515,7 +1533,7 @@ void SdrPage::SetInserted( bool bIns )
        mbInserted = bIns;

        // #i120437# go over whole hierarchy, not only over object level null (seen from grouping)
        SdrObjListIter aIter(*this, SdrIterMode::DeepNoGroups);
        SdrObjListIter aIter(this, SdrIterMode::DeepNoGroups);

         while ( aIter.IsMore() )
        {
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 76d30c4..b5052c4 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -665,8 +665,12 @@ bool SdrPageView::IsObjMarkable(SdrObject const * pObj) const
            return true;
        }
    }
    if (!pObj->Is3DObj() && pObj->GetPage()!=GetPage())
        return false; // Obj suddenly in different Page
    if (!pObj->Is3DObj() && pObj->getSdrPageFromSdrObject() != GetPage())
    {
        // Obj suddenly in different Page
        return false;
    }

    // the layer has to be visible and must not be locked
    SdrLayerID nL = pObj->GetLayer();
    if (!aLayerVisi.IsSet(nL))
@@ -901,7 +905,7 @@ void SdrPageView::CheckCurrentGroup()
    SdrObject* pGrp(GetCurrentGroup());

    while(nullptr != pGrp &&
        (!pGrp->IsInserted() || nullptr == pGrp->getParentOfSdrObject() || nullptr == pGrp->GetPage()))
        (!pGrp->IsInserted() || nullptr == pGrp->getParentOfSdrObject() || nullptr == pGrp->getSdrPageFromSdrObject()))
    {
        // anything outside of the borders?
        pGrp = pGrp->GetUpGroup();
diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx
index 10aacc3..1dc96f0 100644
--- a/svx/source/svdraw/svdsnpv.cxx
+++ b/svx/source/svdraw/svdsnpv.cxx
@@ -325,7 +325,7 @@ SdrSnap SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const
        sal_uInt32 nMaxFrameSnapCount=200;

        // go back to SdrIterMode::DeepNoGroups runthrough for snap to object comparisons
        SdrObjListIter aIter(*pPV->GetPage(),SdrIterMode::DeepNoGroups,true);
        SdrObjListIter aIter(pPV->GetPage(),SdrIterMode::DeepNoGroups,true);

        while (aIter.IsMore() && (nMaxPointSnapCount>0 || nMaxFrameSnapCount>0)) {
            SdrObject* pO=aIter.Next();
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index c08bd77..b70efa1 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -237,9 +237,9 @@ void SdrUndoObj::ImpTakeDescriptionStr(const char* pStrCacheID, OUString& rStr, 
// common call method for possible change of the page when UNDO/REDO is triggered
void SdrUndoObj::ImpShowPageOfThisObject()
{
    if(pObj && pObj->IsInserted() && pObj->GetPage())
    if(pObj && pObj->IsInserted() && pObj->getSdrPageFromSdrObject())
    {
        SdrHint aHint(SdrHintKind::SwitchToPage, *pObj, pObj->GetPage());
        SdrHint aHint(SdrHintKind::SwitchToPage, *pObj, pObj->getSdrPageFromSdrObject());
        pObj->getSdrModelFromSdrObject().Broadcast(aHint);
    }
}
@@ -700,12 +700,12 @@ void SdrUndoRemoveObj::Undo()
        // position of the target object.
        Point aOwnerAnchorPos(0, 0);

        if (dynamic_cast<const SdrObjGroup*>(pObjList->GetOwnerObj()) != nullptr)
        if (dynamic_cast< const SdrObjGroup* >(pObjList->getSdrObjectFromSdrObjList()) != nullptr)
        {
            aOwnerAnchorPos = pObjList->GetOwnerObj()->GetAnchorPos();
            aOwnerAnchorPos = pObjList->getSdrObjectFromSdrObjList()->GetAnchorPos();
        }

        E3DModifySceneSnapRectUpdater aUpdater(pObjList->GetOwnerObj());
        E3DModifySceneSnapRectUpdater aUpdater(pObjList->getSdrObjectFromSdrObjList());
        pObjList->InsertObject(pObj,nOrdNum);

        // #i11426#
@@ -759,7 +759,8 @@ void SdrUndoInsertObj::Redo()
        // which becomes a member of a group, because its cleared in method
        // <InsertObject(..)>. Needed for correct Redo in Writer. (#i45952#)
        Point aAnchorPos( 0, 0 );
        if (dynamic_cast<const SdrObjGroup*>(pObjList->GetOwnerObj()) != nullptr)

        if (dynamic_cast<const SdrObjGroup*>(pObjList->getSdrObjectFromSdrObjList()) != nullptr)
        {
            aAnchorPos = pObj->GetAnchorPos();
        }
diff --git a/svx/source/svdraw/svdviter.cxx b/svx/source/svdraw/svdviter.cxx
index d77f7a3..1d4c9b0 100644
--- a/svx/source/svdraw/svdviter.cxx
+++ b/svx/source/svdraw/svdviter.cxx
@@ -48,7 +48,7 @@ SdrViewIter::SdrViewIter(const SdrObject* pObject)
{
    mpObject = pObject;
    mpModel = pObject ? &pObject->getSdrModelFromSdrObject() : nullptr;
    mpPage = pObject ? pObject->GetPage() : nullptr;
    mpPage = pObject ? pObject->getSdrPageFromSdrObject() : nullptr;

    if(!mpModel || !mpPage)
    {
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 67ec403..f549df4 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -115,7 +115,7 @@ bool SdrExchangeView::ImpGetPasteLayer(const SdrObjList* pObjList, SdrLayerID& r
    bool bRet=false;
    rLayer=SdrLayerID(0);
    if (pObjList!=nullptr) {
        const SdrPage* pPg=pObjList->GetPage();
        const SdrPage* pPg=pObjList->getSdrPageFromSdrObjList();
        if (pPg!=nullptr) {
            rLayer=pPg->GetLayerAdmin().GetLayerID(maActualLayer);
            if (rLayer==SDRLAYER_NOTFOUND) rLayer=SdrLayerID(0);
@@ -142,7 +142,7 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList*
    bool bUnmark = (nOptions & (SdrInsertFlags::DONTMARK|SdrInsertFlags::ADDMARK))==SdrInsertFlags::NONE && !IsTextEdit();
    if (bUnmark) UnmarkAllObj();
    tools::Rectangle aTextRect(0,0,500,500);
    SdrPage* pPage=pLst->GetPage();
    SdrPage* pPage=pLst->getSdrPageFromSdrObjList();
    if (pPage!=nullptr) {
        aTextRect.SetSize(pPage->GetSize());
    }
@@ -182,7 +182,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, EETextFormat eFormat, const Point&
    bool bUnmark=(nOptions&(SdrInsertFlags::DONTMARK|SdrInsertFlags::ADDMARK))==SdrInsertFlags::NONE && !IsTextEdit();
    if (bUnmark) UnmarkAllObj();
    tools::Rectangle aTextRect(0,0,500,500);
    SdrPage* pPage=pLst->GetPage();
    SdrPage* pPage=pLst->getSdrPageFromSdrObjList();
    if (pPage!=nullptr) {
        aTextRect.SetSize(pPage->GetSize());
    }
@@ -320,10 +320,9 @@ bool SdrExchangeView::Paste(
                }

                // #i39861#
                pNewObj->SetPage(pDstLst->GetPage());
                pNewObj->NbcMove(aSiz);

                const SdrPage* pPg = pDstLst->GetPage();
                const SdrPage* pPg = pDstLst->getSdrPageFromSdrObjList();

                if(pPg)
                {
@@ -702,7 +701,7 @@ void SdrExchangeView::DrawMarkedObj(OutputDevice& rOut) const

    if(aSdrObjects.size())
    {
        sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aSdrObjects, aSdrObjects[0]->GetPage());
        sdr::contact::ObjectContactOfObjListPainter aPainter(rOut, aSdrObjects, aSdrObjects[0]->getSdrPageFromSdrObject());
        sdr::contact::DisplayInfo aDisplayInfo;

        // do processing
@@ -755,7 +754,6 @@ SdrModel* SdrExchangeView::GetMarkedObjModel() const

        if(pNewObj)
        {
            pNewObj->SetPage(pNewPage);
            pNewPage->InsertObject(pNewObj, SAL_MAX_SIZE);

            // #i13033#
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index cf73f2a..6d7a5ec 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -1879,7 +1879,7 @@ void SvxTableController::EditCell(const CellPos& rPos, vcl::Window* pWindow, Tbl

    SdrTableObj& rTableObj(*mxTableObj.get());

    if(rTableObj.GetPage() == pPV->GetPage())
    if(rTableObj.getSdrPageFromSdrObject() == pPV->GetPage())
    {
        bool bEmptyOutliner = false;

diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx
index 29003a6..1c2d236d 100644
--- a/svx/source/tbxctrls/fontworkgallery.cxx
+++ b/svx/source/tbxctrls/fontworkgallery.cxx
@@ -226,7 +226,7 @@ void FontWorkGalleryDialog::insertSelectedFontwork()
                    // TTTT: This also *might* be the hidden reason for the strange code at the
                    // end of SdrObject::SetPage that tries to delete the SvxShape under some
                    // circumstances...
                    pNewObject->SetPage(nullptr);
                    // pNewObject->SetPage(nullptr);

                    tools::Rectangle aObjRect( pNewObject->GetLogicRect() );
                    tools::Rectangle aVisArea = pOutDev->PixelToLogic(tools::Rectangle(Point(0,0), pOutDev->GetOutputSizePixel()));
diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index 11337bb..2f7d808 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -302,8 +302,11 @@ drawinglayer::primitive2d::Primitive2DContainer ImplExportCheckVisisbilityRedire
    if(pObject)
    {
        SdrPage* pPage = mpCurrentPage;
        if( pPage == nullptr )
            pPage = pObject->GetPage();

        if(nullptr == pPage)
        {
            pPage = pObject->getSdrPageFromSdrObject();
        }

        if( (pPage == nullptr) || pPage->checkVisibility(rOriginal, rDisplayInfo, false) )
        {
@@ -1181,7 +1184,7 @@ void SAL_CALL GraphicExporter::setSourceDocument( const Reference< lang::XCompon
            {
                mxShapes->getByIndex( nIndex ) >>= xShape;
                pObj = GetSdrObjectFromXShape( xShape );
                bOk = pObj && pObj->GetPage() == pPage;
                bOk = pObj && pObj->getSdrPageFromSdrObject() == pPage;
            }

            if( !bOk )
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index d77df5f..8f25245 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -510,7 +510,6 @@ SdrObject* SvxDrawPage::CreateSdrObject_(const Reference< drawing::XShape > & xS
        *mpModel,
        nInventor,
        nType,
        mpPage,
        &aRect);

    if (!pNewObj)
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 571145c..6214ef5 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -243,7 +243,7 @@ void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xS
    if( pShape )
        pSdrShape = pShape->GetSdrObject();

    if( !HasSdrObject() || pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->GetOwnerObj() != GetSdrObject() )
    if( !HasSdrObject() || pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->getSdrObjectFromSdrObjList() != GetSdrObject() )
        throw uno::RuntimeException();

    SdrObjList& rList = *pSdrShape->getParentOfSdrObject();
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 9f694bd..3988d66 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -150,7 +150,7 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha
        throw uno::RuntimeException();

    SdrObject* pSdrShape = pShape->GetSdrObject();
    if(pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->GetOwnerObj() != GetSdrObject())
    if(pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->getSdrObjectFromSdrObjList() != GetSdrObject())
    {
        throw uno::RuntimeException();
    }
@@ -280,7 +280,7 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte
            aSceneTAR.maRect = pScene->GetSnapRect();

            // rescue object transformations
            SdrObjListIter aIter(*pScene->GetSubList(), SdrIterMode::DeepWithGroups);
            SdrObjListIter aIter(pScene->GetSubList(), SdrIterMode::DeepWithGroups);
            std::vector<basegfx::B3DHomMatrix*> aObjTrans;
            while(aIter.IsMore())
            {
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index c1fc650..f2bfa4f 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -691,12 +691,12 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
    DBG_TESTSOLARMUTEX();
    uno::Any aAny;

    if( !HasSdrObject() || !GetSdrObject()->IsInserted() || nullptr == GetSdrObject()->GetPage() )
    if( !HasSdrObject() || !GetSdrObject()->IsInserted() || nullptr == GetSdrObject()->getSdrPageFromSdrObject() )
        return aAny;

    ScopedVclPtrInstance< VirtualDevice > pVDev;
    pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
    SdrPage* pPage = GetSdrObject()->GetPage();
    SdrPage* pPage = GetSdrObject()->getSdrPageFromSdrObject();

    std::unique_ptr<E3dView> pView(
        new E3dView(
@@ -1344,13 +1344,13 @@ void SAL_CALL SvxShape::dispose()
        EndListening( pObject->getSdrModelFromSdrObject() );
        bool bFreeSdrObject = false;

        if ( pObject->IsInserted() && pObject->GetPage() )
        if ( pObject->IsInserted() && pObject->getSdrPageFromSdrObject() )
        {
            OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
                // normally, we are allowed to free the SdrObject only if we have its ownership.
                // Why isn't this checked here?

            SdrPage* pPage = pObject->GetPage();
            SdrPage* pPage = pObject->getSdrPageFromSdrObject();
            // delete the SdrObject from the page
            const size_t nCount = pPage->GetObjCount();
            for ( size_t nNum = 0; nNum < nCount; ++nNum )
@@ -3739,28 +3739,47 @@ uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent()
{
    ::SolarMutexGuard aGuard;
    const SdrObject* pSdrObject(GetSdrObject());

    if( HasSdrObject() && GetSdrObject()->getParentOfSdrObject() )
    if(nullptr != pSdrObject)
    {
        SdrObjList* pObjList = GetSdrObject()->getParentOfSdrObject();
        const SdrObjList* pParentSdrObjList(GetSdrObject()->getParentOfSdrObject());

        switch (pObjList->GetListKind())
        if(nullptr != pParentSdrObjList)
        {
            case SdrObjListKind::GroupObj:
                if (SdrObjGroup *pGroup = dynamic_cast<SdrObjGroup*>(pObjList->GetOwnerObj()))
                    return pGroup->getUnoShape();
                else if (E3dScene *pScene = dynamic_cast<E3dScene*>(pObjList->GetOwnerObj()))
                    return pScene->getUnoShape();
                break;
            case SdrObjListKind::DrawPage:
            case SdrObjListKind::MasterPage:
                return dynamic_cast<SdrPage&>(*pObjList).getUnoPage();
            default:
                OSL_FAIL( "SvxShape::getParent(  ): unexpected SdrObjListKind" );
                break;
            // SdrObject is member of a SdrObjList. That may be a SdrObject
            // (SdrObjGroup or E3dScene) or a SdrPage.
            // Check for SdrObject first - using getSdrPageFromSdrObjList
            // *will* get the SdrPage even when the SdrObject is deep buried
            // in a construct of SdrObjGroup.
            // We want to ask for the direct parent here...
            SdrObject* pParentSdrObject(pParentSdrObjList->getSdrObjectFromSdrObjList());

            if(nullptr != pParentSdrObject)
            {
                // SdrObject is member of a SdrObject-based Group (SdrObjGroup or E3dScene).
                return pParentSdrObject->getUnoShape();
            }
            else
            {
                SdrPage* pParentSdrPage(pParentSdrObjList->getSdrPageFromSdrObjList());

                if(nullptr != pParentSdrPage)
                {
                    // SdrObject is inserted to a SdrPage. Since
                    // we checked for getSdrObjectFromSdrObjList first,
                    // we can even say that it is directly member of that
                    // SdrPage.
                    return pParentSdrPage->getUnoPage();
                }
            }

            // not member of any SdrObjList, no parent
            OSL_FAIL( "SvxShape::getParent(  ): unexpected Parent SdrObjList" );
        }
    }

    // no SdrObject, no parent
    return uno::Reference<uno::XInterface>();
}

diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 5c9f669..af313e1 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -540,7 +540,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
        mbDataValid = false;
    }

    if( mpObject && mpText && !mbDataValid && mpObject->IsInserted() && mpObject->GetPage() )
    if( mpObject && mpText && !mbDataValid && mpObject->IsInserted() && mpObject->getSdrPageFromSdrObject() )
    {
        mpTextForwarder->flushCache();

@@ -555,7 +555,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
        else
            pOutlinerParaObject = mpText->GetOutlinerParaObject();

        if( pOutlinerParaObject && ( bOwnParaObj || !mpObject->IsEmptyPresObj() || mpObject->GetPage()->IsMasterPage() ) )
        if( pOutlinerParaObject && ( bOwnParaObj || !mpObject->IsEmptyPresObj() || mpObject->getSdrPageFromSdrObject()->IsMasterPage() ) )
        {
            mpOutliner->SetText( *pOutlinerParaObject );

@@ -579,7 +579,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder()
            if( pPool )
                mpOutliner->SetStyleSheetPool( pPool );

            SfxStyleSheet* pStyleSheet = mpObject->GetPage()->GetTextStyleSheetForObject( mpObject );
            SfxStyleSheet* pStyleSheet = mpObject->getSdrPageFromSdrObject()->GetTextStyleSheetForObject( mpObject );
            if( pStyleSheet )
                mpOutliner->SetStyleSheet( 0, pStyleSheet );

diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 2acd8c4..5ea865f 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -577,7 +577,7 @@ namespace docfunc
        {
            const SdrPage& rSdrPage( *(p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );

            SdrObjListIter aIter( rSdrPage, SdrIterMode::Flat );
            SdrObjListIter aIter( &rSdrPage, SdrIterMode::Flat );
            while( aIter.IsMore() )
            {
                SdrObject* pObj( aIter.Next() );
@@ -602,7 +602,7 @@ namespace docfunc
        {
            const SdrPage& rSdrPage( *(p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );

            SdrObjListIter aIter( rSdrPage, SdrIterMode::Flat );
            SdrObjListIter aIter( &rSdrPage, SdrIterMode::Flat );
            while( aIter.IsMore() )
            {
                SdrObject* pObj( aIter.Next() );
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 4ca1ec9..0eff340 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -214,7 +214,7 @@ uno::Any SwTextBoxHelper::getByIndex(SdrPage const* pPage, sal_Int32 nIndex)

sal_Int32 SwTextBoxHelper::getOrdNum(const SdrObject* pObject)
{
    if (const SdrPage* pPage = pObject->GetPage())
    if (const SdrPage* pPage = pObject->getSdrPageFromSdrObject())
    {
        sal_Int32 nOrder = 0; // Current logical order.
        for (std::size_t i = 0; i < pPage->GetObjCount(); ++i)
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index d3d36b1..637c7b4 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -484,8 +484,8 @@ SwFlyDrawContact::~SwFlyDrawContact()
    if ( mpMasterObj )
    {
        mpMasterObj->SetUserCall( nullptr );
        if ( mpMasterObj->GetPage() )
            mpMasterObj->GetPage()->RemoveObject( mpMasterObj->GetOrdNum() );
        if ( mpMasterObj->getSdrPageFromSdrObject() )
            mpMasterObj->getSdrPageFromSdrObject()->RemoveObject( mpMasterObj->GetOrdNum() );
    }
}

@@ -531,7 +531,7 @@ SwVirtFlyDrawObj* SwFlyDrawContact::CreateNewRef(SwFlyFrame* pFly, SwFlyFrameFor
    // After creating the first Reference the Masters are removed from the
    // List and are not important anymore.
    SdrPage* pPg(nullptr);
    if(nullptr != (pPg = pContact->GetMaster()->GetPage()))
    if(nullptr != (pPg = pContact->GetMaster()->getSdrPageFromSdrObject()))
    {
        const size_t nOrdNum = pContact->GetMaster()->GetOrdNum();
        pPg->ReplaceObject(pDrawObj, nOrdNum);
@@ -2232,14 +2232,14 @@ void SwDrawVirtObj::AddToDrawingPage()
    // insert 'virtual' drawing object into page, set layer and user call.
    SdrPage* pDrawPg;
    // #i27030# - apply order number of referenced object
    if ( nullptr != ( pDrawPg = pOrgMasterSdrObj->GetPage() ) )
    if ( nullptr != ( pDrawPg = pOrgMasterSdrObj->getSdrPageFromSdrObject() ) )
    {
        // #i27030# - apply order number of referenced object
        pDrawPg->InsertObject( this, GetReferencedObj().GetOrdNum() );
    }
    else
    {
        pDrawPg = GetPage();
        pDrawPg = getSdrPageFromSdrObject();
        if ( pDrawPg )
        {
            pDrawPg->SetObjectOrdNum( GetOrdNumDirect(),
@@ -2256,9 +2256,9 @@ void SwDrawVirtObj::AddToDrawingPage()
void SwDrawVirtObj::RemoveFromDrawingPage()
{
    SetUserCall( nullptr );
    if ( GetPage() )
    if ( getSdrPageFromSdrObject() )
    {
        GetPage()->RemoveObject( GetOrdNum() );
        getSdrPageFromSdrObject()->RemoveObject( GetOrdNum() );
    }
}

@@ -2266,7 +2266,7 @@ void SwDrawVirtObj::RemoveFromDrawingPage()
bool SwDrawVirtObj::IsConnected() const
{
    bool bRetVal = GetAnchorFrame() &&
                   ( GetPage() && GetUserCall() );
                   ( getSdrPageFromSdrObject() && GetUserCall() );

    return bRetVal;
}
diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx
index af64373..3646aca 100644
--- a/sw/source/core/draw/dflyobj.cxx
+++ b/sw/source/core/draw/dflyobj.cxx
@@ -431,8 +431,8 @@ SwVirtFlyDrawObj::SwVirtFlyDrawObj(

SwVirtFlyDrawObj::~SwVirtFlyDrawObj()
{
    if ( GetPage() )    //Withdraw SdrPage the responsibility.
        GetPage()->RemoveObject( GetOrdNum() );
    if ( getSdrPageFromSdrObject() )    //Withdraw SdrPage the responsibility.
        getSdrPageFromSdrObject()->RemoveObject( GetOrdNum() );
}

const SwFrameFormat *SwVirtFlyDrawObj::GetFormat() const
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 169febf..60511cd 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -316,7 +316,7 @@ sal_uInt32 SwDrawView::GetMaxChildOrdNum( const SwFlyFrame& _rParentObj,
{
    sal_uInt32 nMaxChildOrdNum = _rParentObj.GetDrawObj()->GetOrdNum();

    const SdrPage* pDrawPage = _rParentObj.GetDrawObj()->GetPage();
    const SdrPage* pDrawPage = _rParentObj.GetDrawObj()->getSdrPageFromSdrObject();
    OSL_ENSURE( pDrawPage,
            "<SwDrawView::GetMaxChildOrdNum(..) - missing drawing page at parent object - crash!" );

diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index 478bb78..804ae7d 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -931,11 +931,11 @@ bool SwFEShell::Paste( SwDoc* pClpDoc )
                            SdrObjList* pList = pNew->getParentOfSdrObject();
                            if ( pList )
                            {
                                SdrObject* pOwner = pList->GetOwnerObj();
                                if ( pOwner )
                                SdrObjGroup* pOwner(dynamic_cast< SdrObjGroup* >(pList->getSdrObjectFromSdrObjList()));

                                if(nullptr != pOwner)
                                {
                                    SdrObjGroup* pThisGroup = dynamic_cast<SdrObjGroup*>( pOwner );
                                    aGrpAnchor = pThisGroup->GetAnchorPos();
                                    aGrpAnchor = pOwner->GetAnchorPos();
                                }
                            }

@@ -1269,7 +1269,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SdrModel& _rModel )
    {
        // setup object iterator in order to iterate through all objects
        // including objects in group objects, but exclusive group objects.
        SdrObjListIter aIter(*(_rModel.GetPage( nPgNum )));
        SdrObjListIter aIter(_rModel.GetPage(nPgNum));
        while( aIter.IsMore() )
        {
            SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( aIter.Next() );
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index f339af8..4d4f007 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1526,7 +1526,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool 

        OSL_ENSURE( pList, "No object list to iterate" );

        SdrObjListIter aObjIter( *pList, bFlat ? SdrIterMode::Flat : SdrIterMode::DeepNoGroups );
        SdrObjListIter aObjIter( pList, bFlat ? SdrIterMode::Flat : SdrIterMode::DeepNoGroups );
        while ( aObjIter.IsMore() )
        {
            SdrObject* pObj = aObjIter.Next();
@@ -1579,7 +1579,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool 
                        (aCurPos.getX() < aPos.getX())) ) // " reverse
            {
                aBestPos = Point( nTmp, nTmp );
                SdrObjListIter aTmpIter( *pList, bFlat ? SdrIterMode::Flat : SdrIterMode::DeepNoGroups );
                SdrObjListIter aTmpIter( pList, bFlat ? SdrIterMode::Flat : SdrIterMode::DeepNoGroups );
                while ( aTmpIter.IsMore() )
                {
                    SdrObject* pTmpObj = aTmpIter.Next();
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 8ae2ec3..36bc46b 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -825,8 +825,8 @@ void SwPageFrame::AppendFlyToPage( SwFlyFrame *pNew )
    {
        //#i119945# set pFly's OrdNum to _rNewObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
        sal_uInt32 nNewNum = pObj->GetOrdNumDirect();
        if ( pObj->GetPage() )
            pObj->GetPage()->SetObjectOrdNum( pFly->GetVirtDrawObj()->GetOrdNumDirect(), nNewNum );
        if ( pObj->getSdrPageFromSdrObject() )
            pObj->getSdrPageFromSdrObject()->SetObjectOrdNum( pFly->GetVirtDrawObj()->GetOrdNumDirect(), nNewNum );
        else
            pFly->GetVirtDrawObj()->SetOrdNum( nNewNum );
    }
@@ -1060,8 +1060,8 @@ void SwPageFrame::AppendDrawObjToPage( SwAnchoredObject& _rNewObj )
    {
        //#i119945# set pFly's OrdNum to _rNewObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
        sal_uInt32 nNewNum = _rNewObj.GetDrawObj()->GetOrdNumDirect();
        if ( _rNewObj.GetDrawObj()->GetPage() )
            _rNewObj.DrawObj()->GetPage()->SetObjectOrdNum( pFlyFrame->GetVirtDrawObj()->GetOrdNumDirect(), nNewNum );
        if ( _rNewObj.GetDrawObj()->getSdrPageFromSdrObject() )
            _rNewObj.DrawObj()->getSdrPageFromSdrObject()->SetObjectOrdNum( pFlyFrame->GetVirtDrawObj()->GetOrdNumDirect(), nNewNum );
        else
            pFlyFrame->GetVirtDrawObj()->SetOrdNum( nNewNum );
    }
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 1fce351..5c5ea5d 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -993,7 +993,7 @@ void AppendObj(SwFrame *const pFrame, SwPageFrame *const pPage, SwFrameFormat *c
                }
                if ( pSdrObj )
                {
                    if ( !pSdrObj->GetPage() )
                    if ( !pSdrObj->getSdrPageFromSdrObject() )
                    {
                        pFormat->getIDocumentDrawModelAccess().GetDrawModel()->GetPage(0)->
                                InsertObject(pSdrObj, pSdrObj->GetOrdNumDirect());
@@ -2756,10 +2756,10 @@ static void lcl_Regist( SwPageFrame *pPage, const SwFrame *pAnch )
        const SwFlyFrame* pFly = pAnch->FindFlyFrame();
        if ( pFly &&
             pObj->GetDrawObj()->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() &&
             pObj->GetDrawObj()->GetPage() )
             pObj->GetDrawObj()->getSdrPageFromSdrObject() )
        {
            //#i119945# set pFly's OrdNum to pObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
            pObj->DrawObj()->GetPage()->SetObjectOrdNum( pFly->GetVirtDrawObj()->GetOrdNumDirect(),
            pObj->DrawObj()->getSdrPageFromSdrObject()->SetObjectOrdNum( pFly->GetVirtDrawObj()->GetOrdNumDirect(),
                                                         pObj->GetDrawObj()->GetOrdNumDirect() );
        }
    }
diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx
index 8b15895..8b7413e 100644
--- a/sw/source/filter/html/htmldrawreader.cxx
+++ b/sw/source/filter/html/htmldrawreader.cxx
@@ -358,8 +358,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
    m_pMarquee = SdrObjFactory::MakeNewObject(
        *pModel,
        SdrInventor::Default,
        OBJ_TEXT,
        pPg);
        OBJ_TEXT);

    if( !m_pMarquee )
        return;
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index a5bd0bc..75e05dd 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -758,20 +758,6 @@ void DocxSdrExport::endDMLAnchorInline(const SwFrameFormat* pFrameFormat)

void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrameFormat& rFrameFormat)
{
    bool bSwapInPage = false;
    if (!sdrObj->GetPage())
    {
        if (SdrModel* pModel
            = m_pImpl->m_rExport.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel())
        {
            if (SdrPage* pPage = pModel->GetPage(0))
            {
                bSwapInPage = true;
                const_cast<SdrObject*>(sdrObj)->SetPage(pPage);
            }
        }
    }

    m_pImpl->m_pSerializer->startElementNS(XML_w, XML_pict, FSEND);
    m_pImpl->m_pDrawingML->SetFS(m_pImpl->m_pSerializer);
    // See WinwordAnchoring::SetAnchoring(), these are not part of the SdrObject, have to be passed around manually.
@@ -782,9 +768,6 @@ void DocxSdrExport::writeVMLDrawing(const SdrObject* sdrObj, const SwFrameFormat
        *sdrObj, rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(), rHoriOri.GetRelationOrient(),
        rVertOri.GetRelationOrient(), true);
    m_pImpl->m_pSerializer->endElementNS(XML_w, XML_pict);

    if (bSwapInPage)
        const_cast<SdrObject*>(sdrObj)->SetPage(nullptr);
}

bool lcl_isLockedCanvas(const uno::Reference<drawing::XShape>& xShape)
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index edd2830..74061a7 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1900,20 +1900,6 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi
            const SdrObject* pSdrObj = rFrame.GetFrameFormat().FindRealSdrObject();
            if (pSdrObj)
            {
                bool bSwapInPage = false;
                if (!pSdrObj->GetPage())
                {
                    if (SwDrawModel* pModel
                        = m_rExport.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel())
                    {
                        if (SdrPage* pPage = pModel->GetPage(0))
                        {
                            bSwapInPage = true;
                            const_cast<SdrObject*>(pSdrObj)->SetPage(pPage);
                        }
                    }
                }

                m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_FIELD "{");
                m_aRunText->append(OOO_STRING_SVTOOLS_RTF_IGNORE);
                m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLDINST);
@@ -1925,9 +1911,6 @@ void RtfAttributeOutput::OutputFlyFrame_Impl(const ww8::Frame& rFrame, const Poi

                m_aRunText->append('}');
                m_aRunText->append('}');

                if (bSwapInPage)
                    const_cast<SdrObject*>(pSdrObj)->SetPage(nullptr);
            }
        }
        break;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 81e72a5..af91c72 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2294,23 +2294,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt)
                    const SdrObject* pSdrObj = rFormat.FindRealSdrObject();
                    if (pSdrObj)
                    {
                        bool bSwapInPage = false;
                        if (!pSdrObj->GetPage())
                        {
                            if (SwDrawModel* pModel = rWrt.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel())
                            {
                                if (SdrPage *pPage = pModel->GetPage(0))
                                {
                                    bSwapInPage = true;
                                    const_cast<SdrObject*>(pSdrObj)->SetPage(pPage);
                                }
                            }
                        }

                        nShapeId = AddSdrObject(*pSdrObj);

                        if (bSwapInPage)
                            const_cast<SdrObject*>(pSdrObj)->SetPage(nullptr);
                    }
#if OSL_DEBUG_LEVEL > 0
                    else
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 36a4aea..1fe71b7 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -2867,7 +2867,7 @@ SwFrameFormat* SwWW8ImplReader::MungeTextIntoDrawBox(SvxMSDffImportRec *pRecord,
                // remove the object from Z-Order list
                m_xMSDffManager->RemoveFromShapeOrder( pSdrTextObj );
                // take the object from the drawing page
                if( pSdrTextObj->GetPage() )
                if( pSdrTextObj->getSdrPageFromSdrObject() )
                    m_pDrawPg->RemoveObject( pSdrTextObj->GetOrdNum() );
                // and delete FrameFormat, because replaced by graphic
                // (this also deletes the object)
@@ -3095,7 +3095,7 @@ SwFlyFrameFormat* SwWW8ImplReader::ImportReplaceableDrawables( SdrObject* &rpObj
    // remove old object from Z-Order-List
    m_xMSDffManager->RemoveFromShapeOrder( rpObject );
    // remove from Drawing-Page
    if( rpObject->GetPage() )
    if( rpObject->getSdrPageFromSdrObject() )
        m_pDrawPg->RemoveObject( rpObject->GetOrdNum() );

    // and delete the object
diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx
index 56de45b6..17c0b5e 100644
--- a/sw/source/filter/ww8/ww8graf2.cxx
+++ b/sw/source/filter/ww8/ww8graf2.cxx
@@ -713,7 +713,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj,
                                pOurNewObject );

                            // delete and destroy old SdrGrafObj from page
                            if (pObject->GetPage())
                            if (pObject->getSdrPageFromSdrObject())
                                m_pDrawPg->RemoveObject(pObject->GetOrdNum());
                            SdrObject::Free( pObject );
                        }
@@ -725,7 +725,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj,
                    m_xMSDffManager->RemoveFromShapeOrder( pObject );

                // also delete this from the page if not grouped
                if (pTextObj && !bTextObjWasGrouped && pTextObj->GetPage())
                if (pTextObj && !bTextObjWasGrouped && pTextObj->getSdrPageFromSdrObject())
                    m_pDrawPg->RemoveObject( pTextObj->GetOrdNum() );
            }
            m_xMSDffManager->EnableFallbackStream();
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index b04e2ed..cdeee03 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -440,7 +440,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc)
        const SdrPage& rSdrPage( *(_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );

        // iterate recursive with group objects over all shapes on the draw page
        SdrObjListIter aIter( rSdrPage );
        SdrObjListIter aIter( &rSdrPage );
        while( aIter.IsMore() )
        {
            SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( aIter.Next() );
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 2eac04a..3bbe209 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -628,7 +628,7 @@ bool SwTransferable::WriteObject( tools::SvRef<SotStorageStream>& xStream,
            for(sal_uInt16 a(0); a < pModel->GetPageCount(); a++)
            {
                const SdrPage* pPage = pModel->GetPage(a);
                SdrObjListIter aIter(*pPage, SdrIterMode::DeepNoGroups);
                SdrObjListIter aIter(pPage, SdrIterMode::DeepNoGroups);

                while(aIter.IsMore())
                {
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index 7951c4e..ca3cd38 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -596,7 +596,7 @@ IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxObjectNameDialog&
    {
        bRet = true;
        SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess().GetDrawModel();
        SdrObjListIter aIter( *(pModel->GetPage(0)), SdrIterMode::DeepWithGroups );
        SdrObjListIter aIter( pModel->GetPage(0), SdrIterMode::DeepWithGroups );
        while( aIter.IsMore() )
        {
            SdrObject* pTempObj = aIter.Next();
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 88b27cb..1348a5f 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -306,7 +306,7 @@ sal_Bool SwXTextView::select(const uno::Any& aInterface)
        for (SdrObject* pSdrObject : sdrObjects)
        {
            // GetSelectableFromAny did not check pSdrObject is in right doc!
            if (pPV && pSdrObject->GetPage() == pPV->GetPage())
            if (pPV && pSdrObject->getSdrPageFromSdrObject() == pPV->GetPage())
            {
                pDrawView->MarkObj(pSdrObject, pPV);
                bRet = true;