diff options
37 files changed, 447 insertions, 504 deletions
diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 44171c6bd966..f7918d2ba4d2 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -330,7 +330,7 @@ bool SelectionHelper::findNamedParent( SdrObject*& pInOutObject while( pObj && !ObjectIdentifier::isCID( aName ) ) { - SdrObjList* pObjList = pObj->GetObjList(); + SdrObjList* pObjList = pObj->getParentOfSdrObject(); if( !pObjList ) return false; SdrObject* pOwner = pObjList->GetOwnerObj(); diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx index 7ad18848d4cd..099c4b3aad63 100644 --- a/include/svx/obj3d.hxx +++ b/include/svx/obj3d.hxx @@ -36,10 +36,7 @@ #include <basegfx/vector/b2enums.hxx> #include <svx/svxdllapi.h> - -// Forward declaration - - +// Forward declarations class SfxPoolItem; class Viewport3D; class E3dScene; @@ -71,30 +68,6 @@ public: /************************************************************************* |* -|* List for 3D objects -|* -\************************************************************************/ - -class E3dObjList final : public SdrObjList -{ -public: - E3dObjList(); - SVX_DLLPUBLIC virtual ~E3dObjList() override; - - virtual E3dObjList* CloneSdrObjList(SdrModel* pNewModel = nullptr) const override; - - virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override; - virtual void InsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override; - virtual SdrObject* NbcRemoveObject(size_t nObjNum) override; - virtual SdrObject* RemoveObject(size_t nObjNum) override; - -private: - E3dObjList &operator=(const E3dObjList& rSrcList) = delete; - E3dObjList(const E3dObjList& rSrcList) = delete; -}; - -/************************************************************************* -|* |* Base class for 3D objects |* \************************************************************************/ @@ -106,14 +79,11 @@ private: friend class sdr::properties::E3dProperties; // Allow everything for E3dObjList and E3dDragMethod - friend class E3dObjList; friend class E3dDragMethod; protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; - E3dObjList maSubList; // child objects - basegfx::B3DRange maLocalBoundVol; // surrounding volume of the object (from the geometry generation) basegfx::B3DHomMatrix maTransformation; // local transformation basegfx::B3DHomMatrix maFullTransform; // global transformation (including. parents) @@ -122,11 +92,10 @@ private: bool mbTfHasChanged : 1; bool mbIsSelected : 1; - protected: - void SetTransformChanged(); +protected: virtual void NewObjectInserted(const E3dObject* p3DObj); virtual void StructureChanged(); - basegfx::B3DRange RecalcBoundVolume() const; + virtual basegfx::B3DRange RecalcBoundVolume() const; protected: // E3dObject is only a helper class (for E3DScene and E3DCompoundObject) @@ -135,31 +104,18 @@ protected: E3dObject(SdrModel& rSdrModel); public: + virtual void SetTransformChanged(); virtual void RecalcSnapRect() override; - virtual void SetRectsDirty(bool bNotMyself = false) override; virtual ~E3dObject() override; virtual SdrInventor GetObjInventor() const override; virtual sal_uInt16 GetObjIdentifier() const override; - virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; - - virtual void NbcSetLayer(SdrLayerID nLayer) override; - - virtual void SetObjList(SdrObjList* pNewObjList) override; - virtual void SetPage(SdrPage* pNewPage) override; virtual void NbcMove(const Size& rSize) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - virtual SdrObjList* GetSubList() const override; - - // Insert 3D object into the group; transfer to other owner! - void Insert3DObj(E3dObject* p3DObj); - void Remove3DObj(E3dObject const * p3DObj); - E3dObject* GetParentObj() const; virtual E3dScene* GetScene() const; - const basegfx::B3DRange& GetBoundVolume() const; void InvalidateBoundVolume(); @@ -192,7 +148,7 @@ public: // get/set the selection bool GetSelected() const { return mbIsSelected; } - void SetSelected(bool bNew); + virtual void SetSelected(bool bNew); // break up virtual bool IsBreakObjPossible(); diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index eef2c0422ba9..3c54bf83b2b6 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -56,7 +56,7 @@ class Imp3DDepthRemapper; |* \************************************************************************/ -class SVX_DLLPUBLIC E3dScene : public E3dObject +class SVX_DLLPUBLIC E3dScene : public E3dObject, public SdrObjList { private: // to allow sdr::properties::E3dSceneProperties access to StructureChanged() @@ -168,6 +168,27 @@ public: void ResumeReportingDirtyRects(); void SetAllSceneRectsDirty(); + // set selection fropm E3dObject (temporary flag for 3D actions) + virtual void SetSelected(bool bNew) override; + + // derived from SdrObjList + virtual void NbcInsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override; + virtual void InsertObject(SdrObject* pObj, size_t nPos=SAL_MAX_SIZE) override; + virtual SdrObject* NbcRemoveObject(size_t nObjNum) override; + virtual SdrObject* RemoveObject(size_t nObjNum) override; + + // needed for group functionality + virtual void SetRectsDirty(bool bNotMyself = false) override; + virtual void NbcSetLayer(SdrLayerID nLayer) override; + virtual void setParentOfSdrObject(SdrObjList* pNewObjList) override; + virtual void SetPage(SdrPage* pNewPage) override; + virtual SdrObjList* GetSubList() const override; + void Insert3DObj(E3dObject* p3DObj); + void Remove3DObj(E3dObject const * p3DObj); + virtual void SetTransformChanged() override; + +protected: + virtual basegfx::B3DRange RecalcBoundVolume() const override; }; #endif // INCLUDED_SVX_SCENE3D_HXX diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 6cf9336ea014..618b6b37495a 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -383,8 +383,8 @@ public: // this method is only for access from Property objects virtual void SetBoundRectDirty(); - virtual void SetObjList(SdrObjList* pNewObjList); - SdrObjList* GetObjList() const { return pObjList;} + virtual void setParentOfSdrObject(SdrObjList* pNewObjList); + SdrObjList* getParentOfSdrObject() const { return mpParentOfSdrObject;} virtual void SetPage(SdrPage* pNewPage); SdrPage* GetPage() const { return pPage;} @@ -992,7 +992,7 @@ private: struct Impl; std::unique_ptr<Impl> mpImpl; Point aGridOffset; // hack (Calc) - SdrObjList* pObjList; // list that includes this object + SdrObjList* mpParentOfSdrObject; // list that includes this object sal_uInt32 nOrdNum; // order number of the object in the list std::unique_ptr<SfxGrabBagItem> pGrabBagItem; // holds the GrabBagItem property // Position in the navigation order. SAL_MAX_UINT32 when not used. diff --git a/include/svx/svdogrp.hxx b/include/svx/svdogrp.hxx index 7f0fb234f972..118f91a0a9eb 100644 --- a/include/svx/svdogrp.hxx +++ b/include/svx/svdogrp.hxx @@ -47,7 +47,7 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual SdrLayerID GetLayer() const override; virtual void NbcSetLayer(SdrLayerID nLayer) override; - virtual void SetObjList(SdrObjList* pNewObjList) override; + virtual void setParentOfSdrObject(SdrObjList* pNewObjList) override; virtual void SetPage(SdrPage* pNewPage) override; virtual SdrObjList* GetSubList() const override; diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index 1ea8f1f57358..3e8fcb54f880 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -73,9 +73,9 @@ protected: friend class SdrObjListIter; friend class SdrEditView; SdrObjList* pUpList; /// parent list - SdrPage* pPage; /// Page containing the list, may be "this". + SdrPage* mpPage; /// Page containing the list, may be "this". SdrObject* pOwnerObj; /// OwnerObject, if it's list of a Group object. - tools::Rectangle aOutRect; + tools::Rectangle maOutRect; tools::Rectangle aSnapRect; SdrObjListKind eListKind; bool bObjOrdNumsDirty; @@ -83,7 +83,7 @@ friend class SdrEditView; protected: void RecalcRects(); - void lateInitSdrObjList(const SdrObjList& rSrcList, SdrModel* pNewModel = nullptr); + void copyDataFromSdrObjList(const SdrObjList& rSrcList, SdrModel* pNewModel = nullptr); private: /// simple ActionChildInserted forwarder to have it on a central place diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 77f19b2e39c5..40cfd3c9a1b3 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -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->GetObjList()) ) + if( pObject && pObject->GetPage() && (pObject->GetPage() == pObject->getParentOfSdrObject()) ) { // Is there a previous object? const size_t nOrdNum = pObject->GetOrdNum(); diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index cf062dd513dd..c09607cef932 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -410,7 +410,7 @@ void ScChildrenShapes::Notify(SfxBroadcaster&, const SfxHint& rHint) { SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject()); if (pObj && /*(pObj->GetLayer() != SC_LAYER_INTERN) && */(pObj->GetPage() == GetDrawPage()) && - (pObj->GetPage() == pObj->GetObjList()) ) //only do something if the object lies direct on the page + (pObj->GetPage() == pObj->getParentOfSdrObject()) ) //only do something if the object lies direct on the page { switch (pSdrHint->GetKind()) { diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index 59f60cb21323..305ca6e9a585 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -406,7 +406,7 @@ EffectSequence::iterator ImplFindEffect( MainSequencePtr const & pMainSequence, static bool implIsInsideGroup( SdrObject const * pObj ) { - return pObj && pObj->GetObjList() && pObj->GetObjList()->GetUpList(); + return pObj && pObj->getParentOfSdrObject() && pObj->getParentOfSdrObject()->GetUpList(); } void EffectMigration::SetAnimationEffect( SvxShape* pShape, AnimationEffect eEffect ) diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 472814b48f9a..fc60775f6cef 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -663,7 +663,7 @@ SfxStyleSheet* SdPage::GetStyleSheetForPresObj(PresObjKind eObjKind) const slides masterpage */ SdStyleSheet* SdPage::getPresentationStyle( sal_uInt32 nHelpId ) const { - OUString aStyleName( pPage->GetLayoutName() ); + OUString aStyleName( mpPage->GetLayoutName() ); const OUString aSep( SD_LT_SEPARATOR ); sal_Int32 nIndex = aStyleName.indexOf(aSep); if( nIndex != -1 ) @@ -1054,7 +1054,7 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind) const bool bUndo = pDoc->IsUndoEnabled(); if( bUndo ) pDoc->AddUndo(pDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject)); - SdrObjList* pOL = pObject->GetObjList(); + SdrObjList* pOL = pObject->getParentOfSdrObject(); pOL->RemoveObject(pObject->GetOrdNumDirect()); if( !bUndo ) diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index c54d991ba42a..165d67b87516 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -325,7 +325,7 @@ MotionPathTag::MotionPathTag( CustomAnimationPane& rPane, ::sd::View& rView, con if( pPage ) { mpPathObj->SetPage( pPage ); - mpPathObj->SetObjList( pPage ); + mpPathObj->setParentOfSdrObject( pPage ); } XDash aDash( css::drawing::DashStyle_RECT, 1, 80, 1, 80, 80); diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 588f4449c8a3..33e9928cafc5 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -447,7 +447,7 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c if(!(aValue >>= nNavOrder)) throw lang::IllegalArgumentException(); - SdrObjList* pObjList = pObj->GetObjList(); + SdrObjList* pObjList = pObj->getParentOfSdrObject(); if( pObjList ) pObjList->SetObjectNavigationPosition( *pObj, (nNavOrder < 0) ? SAL_MAX_UINT32 : static_cast< sal_uInt32 >( nNavOrder ) ); break; diff --git a/svx/inc/sdr/properties/e3dproperties.hxx b/svx/inc/sdr/properties/e3dproperties.hxx index 8b90440a9c5a..2a6eb0e9e4cc 100644 --- a/svx/inc/sdr/properties/e3dproperties.hxx +++ b/svx/inc/sdr/properties/e3dproperties.hxx @@ -48,9 +48,6 @@ namespace sdr // Clone() operator, normally just calls the local copy constructor virtual std::unique_ptr<BaseProperties> Clone(SdrObject& rObj) const override; - - // set a new StyleSheet and broadcast - virtual void SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) override; }; } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index 959ecf1f0c49..93cad1bbe6c7 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -76,102 +76,15 @@ #include <svx/sdr/contact/viewcontactofe3dscene.hxx> #include <svx/e3dsceneupdater.hxx> - using namespace com::sun::star; - -// List for 3D-Objects -E3dObjList::E3dObjList() -: SdrObjList(nullptr) -{ -} - -E3dObjList* E3dObjList::CloneSdrObjList(SdrModel* pNewModel) const -{ - E3dObjList* pObjList = new E3dObjList(); - pObjList->lateInitSdrObjList(*this, pNewModel); - return pObjList; -} - -E3dObjList::~E3dObjList() -{ -} - -void E3dObjList::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 && dynamic_cast<const E3dObject*>(pObj)) - { - // Normal 3D object, insert means - // call parent - SdrObjList::NbcInsertObject(pObj, nPos); - } - else - { - // No 3D object, inserted a page in place in a scene ... - GetOwnerObj()->GetPage()->InsertObject(pObj, nPos); - } -} - -void E3dObjList::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); - - E3dScene* pScene = static_cast<E3dObject*>(GetOwnerObj())->GetScene(); - if(pScene) - { - pScene->Cleanup3DDepthMapper(); - } -} - -SdrObject* E3dObjList::NbcRemoveObject(size_t nObjNum) -{ - DBG_ASSERT(dynamic_cast<const E3dObject*>(GetOwnerObj()), "Remove 3D object from Parent != 3DObject"); - - // call parent - SdrObject* pRetval = SdrObjList::NbcRemoveObject(nObjNum); - - E3dScene* pScene = static_cast<E3dObject*>(GetOwnerObj())->GetScene(); - if(pScene) - { - pScene->Cleanup3DDepthMapper(); - } - - return pRetval; -} - -SdrObject* E3dObjList::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); - - E3dScene* pScene = static_cast<E3dObject*>(GetOwnerObj())->GetScene(); - if(pScene) - { - pScene->Cleanup3DDepthMapper(); - } - - return pRetval; -} - - sdr::properties::BaseProperties* E3dObject::CreateObjectSpecificProperties() { return new sdr::properties::E3dProperties(*this); } - E3dObject::E3dObject(SdrModel& rSdrModel) : SdrAttrObj(rSdrModel), - maSubList(), maLocalBoundVol(), maTransformation(), maFullTransform(), @@ -179,8 +92,6 @@ E3dObject::E3dObject(SdrModel& rSdrModel) mbIsSelected(false) { bIs3DObj = true; - maSubList.SetOwnerObj(this); - maSubList.SetListKind(SdrObjListKind::GroupObj); bClosedObj = true; } @@ -194,20 +105,9 @@ void E3dObject::SetSelected(bool bNew) { mbIsSelected = bNew; } - - for(size_t a = 0; a < maSubList.GetObjCount(); ++a) - { - E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a)); - - if(pCandidate) - { - pCandidate->SetSelected(bNew); - } - } } // Break, default implementations - bool E3dObject::IsBreakObjPossible() { return false; @@ -218,24 +118,6 @@ SdrAttrObj* E3dObject::GetBreakObj() return nullptr; } -// SetRectsDirty must be done through the local SdrSubList - -void E3dObject::SetRectsDirty(bool bNotMyself) -{ - // call parent - SdrAttrObj::SetRectsDirty(bNotMyself); - - for(size_t a = 0; a < maSubList.GetObjCount(); ++a) - { - E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a)); - - if(pCandidate) - { - pCandidate->SetRectsDirty(bNotMyself); - } - } -} - SdrInventor E3dObject::GetObjInventor() const { return SdrInventor::E3d; @@ -247,7 +129,6 @@ sal_uInt16 E3dObject::GetObjIdentifier() const } // Determine the capabilities of the object - void E3dObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const { rInfo.bResizeFreeAllowed = true; @@ -275,35 +156,6 @@ void E3dObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const rInfo.bCanConvToPolyLineToArea = false; } -void E3dObject::NbcSetLayer(SdrLayerID nLayer) -{ - SdrAttrObj::NbcSetLayer(nLayer); - - for(size_t a = 0; a < maSubList.GetObjCount(); ++a) - { - E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a)); - - if(pCandidate) - { - pCandidate->NbcSetLayer(nLayer); - } - } -} - -// Set ObjList also on SubList - -void E3dObject::SetObjList(SdrObjList* pNewObjList) -{ - SdrObject::SetObjList(pNewObjList); - maSubList.SetUpList(pNewObjList); -} - -void E3dObject::SetPage(SdrPage* pNewPage) -{ - SdrAttrObj::SetPage(pNewPage); - maSubList.SetPage(pNewPage); -} - // resize object, used from old 2d interfaces, e.g. in Move/Scale dialog (F4) void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { @@ -354,9 +206,7 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti SetTransform(aObjTrans); } - // Move object in 2D is needed when using cursor keys - void E3dObject::NbcMove(const Size& rSize) { // Movement in X, Y in the eye coordinate system @@ -407,31 +257,13 @@ void E3dObject::NbcMove(const Size& rSize) SetTransform(aTranslate * GetTransform()); } -// Return the sublist, but only if it contains objects! - -SdrObjList* E3dObject::GetSubList() const -{ - return &const_cast< E3dObjList& >(maSubList); -} - void E3dObject::RecalcSnapRect() { maSnapRect = tools::Rectangle(); - - for(size_t a = 0; a < maSubList.GetObjCount(); ++a) - { - E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a)); - - if(pCandidate) - { - maSnapRect.Union(pCandidate->GetSnapRect()); - } - } } // Inform the parent about insertion of a 3D object, so that the parent is able // treat the particular objects in a special way (eg Light / Label in E3dScene) - void E3dObject::NewObjectInserted(const E3dObject* p3DObj) { if(GetParentObj()) @@ -440,7 +272,6 @@ void E3dObject::NewObjectInserted(const E3dObject* p3DObj) // Inform parent of changes in the structure (eg by transformation), in this // process the object in which the change has occurred is returned. - void E3dObject::StructureChanged() { if ( GetParentObj() ) @@ -450,90 +281,46 @@ void E3dObject::StructureChanged() } } -void E3dObject::Insert3DObj(E3dObject* p3DObj) -{ - DBG_ASSERT(p3DObj, "Insert3DObj with NULL-pointer!"); - SdrPage* pPg = pPage; - maSubList.InsertObject(p3DObj); - pPage = pPg; - InvalidateBoundVolume(); - NewObjectInserted(p3DObj); - StructureChanged(); -} - -void E3dObject::Remove3DObj(E3dObject const * p3DObj) +E3dObject* E3dObject::GetParentObj() const { - DBG_ASSERT(p3DObj, "Remove3DObj with NULL-pointer!"); + E3dObject* pRetval = nullptr; - if(p3DObj->GetParentObj() == this) + if(getParentOfSdrObject() && getParentOfSdrObject()->GetOwnerObj()) { - SdrPage* pPg = pPage; - maSubList.RemoveObject(p3DObj->GetOrdNum()); - pPage = pPg; - - InvalidateBoundVolume(); - StructureChanged(); + pRetval = dynamic_cast<E3dObject*>(getParentOfSdrObject()->GetOwnerObj()); } -} -E3dObject* E3dObject::GetParentObj() const -{ - E3dObject* pRetval = nullptr; - - if(GetObjList() - && GetObjList()->GetOwnerObj() - && dynamic_cast<const E3dObject*>(GetObjList()->GetOwnerObj())) - pRetval = static_cast<E3dObject*>(GetObjList()->GetOwnerObj()); return pRetval; } // Determine the top-level scene object - E3dScene* E3dObject::GetScene() const { if(GetParentObj()) + { return GetParentObj()->GetScene(); + } + return nullptr; } // Calculate enclosed volume, including all child objects - basegfx::B3DRange E3dObject::RecalcBoundVolume() const { basegfx::B3DRange aRetval; - const size_t nObjCnt(maSubList.GetObjCount()); + const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact()); - if(nObjCnt) + if(pVCOfE3D) { - for(size_t a = 0; a < nObjCnt; ++a) - { - const E3dObject* p3DObject = dynamic_cast< const E3dObject* >(maSubList.GetObj(a)); - - if(p3DObject) - { - basegfx::B3DRange aLocalRange(p3DObject->GetBoundVolume()); - aLocalRange.transform(p3DObject->GetTransform()); - aRetval.expand(aLocalRange); - } - } - } - else - { - // single 3D object - const sdr::contact::ViewContactOfE3d* pVCOfE3D = dynamic_cast< const sdr::contact::ViewContactOfE3d* >(&GetViewContact()); + // BoundVolume is without 3D object transformation, use correct sequence + const drawinglayer::primitive3d::Primitive3DContainer xLocalSequence(pVCOfE3D->getVIP3DSWithoutObjectTransform()); - if(pVCOfE3D) + if(!xLocalSequence.empty()) { - // BoundVolume is without 3D object transformation, use correct sequence - const drawinglayer::primitive3d::Primitive3DContainer xLocalSequence(pVCOfE3D->getVIP3DSWithoutObjectTransform()); + const uno::Sequence< beans::PropertyValue > aEmptyParameters; + const drawinglayer::geometry::ViewInformation3D aLocalViewInformation3D(aEmptyParameters); - if(!xLocalSequence.empty()) - { - const uno::Sequence< beans::PropertyValue > aEmptyParameters; - const drawinglayer::geometry::ViewInformation3D aLocalViewInformation3D(aEmptyParameters); - - aRetval = xLocalSequence.getB3DRange(aLocalViewInformation3D); - } + aRetval = xLocalSequence.getB3DRange(aLocalViewInformation3D); } } @@ -541,7 +328,6 @@ basegfx::B3DRange E3dObject::RecalcBoundVolume() const } // Get enclosed volume and possibly recalculate it - const basegfx::B3DRange& E3dObject::GetBoundVolume() const { if(maLocalBoundVol.isEmpty()) @@ -558,26 +344,14 @@ void E3dObject::InvalidateBoundVolume() } // Pass on the changes in transformation to all child objects - void E3dObject::SetTransformChanged() { InvalidateBoundVolume(); mbTfHasChanged = true; - - for(size_t a = 0; a < maSubList.GetObjCount(); ++a) - { - E3dObject* pCandidate = dynamic_cast< E3dObject* >(maSubList.GetObj(a)); - - if(pCandidate) - { - pCandidate->SetTransformChanged(); - } - } } // Define the hierarchical transformation over all Parents, store in // maFullTransform and return them - const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const { if(mbTfHasChanged) @@ -596,7 +370,6 @@ const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const return maFullTransform; } - void E3dObject::NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix) { if(maTransformation != rMatrix) @@ -608,7 +381,6 @@ void E3dObject::NbcSetTransform(const basegfx::B3DHomMatrix& rMatrix) } // Set transformation matrix with repaint broadcast - void E3dObject::SetTransform(const basegfx::B3DHomMatrix& rMatrix) { if(rMatrix != maTransformation) @@ -627,7 +399,6 @@ basegfx::B3DPolyPolygon E3dObject::CreateWireframe() const } // Get the name of the object (singular) - OUString E3dObject::TakeObjNameSingul() const { OUStringBuffer sName(ImpGetResStr(STR_ObjNameSingulObj3d)); @@ -644,7 +415,6 @@ OUString E3dObject::TakeObjNameSingul() const } // Get the name of the object (plural) - OUString E3dObject::TakeObjNamePlural() const { return ImpGetResStr(STR_ObjNamePluralObj3d); @@ -655,27 +425,25 @@ E3dObject* E3dObject::Clone(SdrModel* pTargetModel) const return CloneHelper< E3dObject >(pTargetModel); } -E3dObject& E3dObject::operator=(const E3dObject& rObj) +E3dObject& E3dObject::operator=(const E3dObject& rSource) { - if( this == &rObj ) - return *this; - SdrObject::operator=(rObj); - - if (rObj.GetSubList()) + if(this != &rSource) { - maSubList.CopyObjects(*rObj.GetSubList()); - } + // call parent + SdrAttrObj::operator=(rSource); - // BoundVol can be copied since also the children are copied - maLocalBoundVol = rObj.maLocalBoundVol; - maTransformation = rObj.maTransformation; + // BoundVol can be copied since also the children are copied + maLocalBoundVol = rSource.maLocalBoundVol; + maTransformation = rSource.maTransformation; - // Because the parent may have changed, definitely redefine the total - // transformation next time - SetTransformChanged(); + // Because the parent may have changed, definitely redefine the total + // transformation next time + SetTransformChanged(); + + // Copy selection status + mbIsSelected = rSource.mbIsSelected; + } - // Copy selection status - mbIsSelected = rObj.mbIsSelected; return *this; } @@ -704,14 +472,12 @@ void E3dObject::RestGeoData(const SdrObjGeoData& rGeo) // This is however a correct implementation, because everything that has // happened is a rotation around the axis perpendicular to the screen and that // is regardless of how the scene has been rotated up until now. - void E3dObject::NbcRotate(const Point& rRef, long nAngle, double sn, double cs) { // So currently the glue points are defined relative to the scene aOutRect. // Before turning the glue points are defined relative to the page. They // take no part in the rotation of the scene. To ensure this, there is the // SetGlueReallyAbsolute(sal_True); - double fAngleInRad = nAngle/100.0 * F_PI180; basegfx::B3DHomMatrix aRotateZ; @@ -891,7 +657,6 @@ E3dCompoundObject& E3dCompoundObject::operator=(const E3dCompoundObject& rObj) } // convert given basegfx::B3DPolyPolygon to screen coor - basegfx::B2DPolyPolygon E3dCompoundObject::TransformToScreenCoor(const basegfx::B3DPolyPolygon& rCandidate) { const uno::Sequence< beans::PropertyValue > aEmptyParameters; @@ -912,11 +677,11 @@ basegfx::B2DPolyPolygon E3dCompoundObject::TransformToScreenCoor(const basegfx:: bool E3dCompoundObject::IsAOrdNumRemapCandidate(E3dScene*& prScene) const { - if(GetObjList() - && GetObjList()->GetOwnerObj() - && dynamic_cast<const E3dObject*>(GetObjList()->GetOwnerObj())) + if(getParentOfSdrObject() + && getParentOfSdrObject()->GetOwnerObj() + && dynamic_cast<const E3dObject*>(getParentOfSdrObject()->GetOwnerObj())) { - prScene = static_cast<E3dScene*>(GetObjList()->GetOwnerObj()); + prScene = static_cast<E3dScene*>(getParentOfSdrObject()->GetOwnerObj()); return true; } diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 38961d3ccfa8..2ff169357836 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -172,11 +172,15 @@ sdr::contact::ViewContact* E3dScene::CreateObjectSpecificViewContact() E3dScene::E3dScene(SdrModel& rSdrModel) : E3dObject(rSdrModel), + SdrObjList(), aCamera(basegfx::B3DPoint(0.0, 0.0, 4.0), basegfx::B3DPoint()), mp3DDepthRemapper(nullptr), bDrawOnlySelected(false), mbSkipSettingDirty(false) { + SetOwnerObj(this); + SetListKind(SdrObjListKind::GroupObj); + // Set defaults SetDefaultAttributes(); } @@ -367,9 +371,9 @@ void E3dScene::removeAllNonSelectedObjects() { E3DModifySceneSnapRectUpdater aUpdater(this); - for(size_t a = 0; a < maSubList.GetObjCount(); ++a) + for(size_t a = 0; a < GetObjCount(); ++a) { - SdrObject* pObj = maSubList.GetObj(a); + SdrObject* pObj = GetObj(a); if(pObj) { @@ -403,7 +407,7 @@ void E3dScene::removeAllNonSelectedObjects() if(bRemoveObject) { - maSubList.NbcRemoveObject(pObj->GetOrdNum()); + NbcRemoveObject(pObj->GetOrdNum()); a--; SdrObject::Free(pObj); } @@ -416,35 +420,28 @@ E3dScene* E3dScene::Clone(SdrModel* pTargetModel) const return CloneHelper< E3dScene >(pTargetModel); } -E3dScene& E3dScene::operator=(const E3dScene& rObj) +E3dScene& E3dScene::operator=(const E3dScene& rSource) { - if( this == &rObj ) - return *this; - E3dObject::operator=(rObj); - - aCamera = rObj.aCamera; - - aCameraSet = rObj.aCameraSet; - static_cast<sdr::properties::E3dSceneProperties&>(GetProperties()).SetSceneItemsFromCamera(); + if(this != &rSource) + { + // call parent + E3dObject::operator=(rSource); - InvalidateBoundVolume(); - RebuildLists(); - SetRectsDirty(); + // copy local data + if (rSource.GetSubList()) + { + CopyObjects(*rSource.GetSubList()); + } - ImpCleanup3DDepthMapper(); + aCamera = rSource.aCamera; + aCameraSet = rSource.aCameraSet; + static_cast<sdr::properties::E3dSceneProperties&>(GetProperties()).SetSceneItemsFromCamera(); + InvalidateBoundVolume(); + RebuildLists(); + ImpCleanup3DDepthMapper(); + GetViewContact().ActionChanged(); + } - // #i101941# - // After a Scene as model object is cloned, the used - // ViewContactOfE3dScene is created and partially used - // to calculate Bound/SnapRects, but - since quite some - // values are buffered at the VC - not really well - // initialized. It would be possible to always watch for - // preconditions of buffered data, but this would be expensive - // and would create a lot of short living data structures. - // It is currently better to flush that data, e.g. by using - // ActionChanged at the VC which will for this class - // flush that cached data and initialize its valid reconstruction - GetViewContact().ActionChanged(); return *this; } @@ -470,7 +467,7 @@ void E3dScene::RebuildLists() // first delete SdrLayerID nCurrLayerID = GetLayer(); - SdrObjListIter a3DIterator(maSubList, SdrIterMode::Flat); + SdrObjListIter a3DIterator(static_cast< SdrObjList& >(*this), SdrIterMode::Flat); // then examine all the objects in the scene while ( a3DIterator.IsMore() ) @@ -640,14 +637,25 @@ void E3dScene::RecalcSnapRect() { // The Scene itself is a member of another scene, get the SnapRect // as a composite object + // call parent E3dObject::RecalcSnapRect(); + + for(size_t a = 0; a < GetObjCount(); ++a) + { + E3dObject* pCandidate(dynamic_cast< E3dObject* >(GetObj(a))); + + if(pCandidate) + { + maSnapRect.Union(pCandidate->GetSnapRect()); + } + } } } bool E3dScene::IsBreakObjPossible() { // Break scene, if all members are able to break - SdrObjListIter a3DIterator(maSubList, SdrIterMode::DeepWithGroups); + SdrObjListIter a3DIterator(static_cast< SdrObjList& >(*this), SdrIterMode::DeepWithGroups); while ( a3DIterator.IsMore() ) { @@ -706,4 +714,189 @@ void E3dScene::BrkCreate(SdrDragStat& /*rStat*/) { } +void E3dScene::SetSelected(bool bNew) +{ + // call parent + E3dObject::SetSelected(bNew); + + for(size_t a(0); a < GetObjCount(); a++) + { + E3dObject* pCandidate(dynamic_cast< E3dObject* >(GetObj(a))); + + if(pCandidate) + { + pCandidate->SetSelected(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)) + { + // Normal 3D object, insert means + // call parent + SdrObjList::NbcInsertObject(pObj, nPos); + } + else + { + // No 3D object, inserted a page in place in a scene ... + GetOwnerObj()->GetPage()->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); + + Cleanup3DDepthMapper(); +} + +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); + + Cleanup3DDepthMapper(); + + return pRetval; +} + +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); + + Cleanup3DDepthMapper(); + + return pRetval; +} + +void E3dScene::SetRectsDirty(bool bNotMyself) +{ + // call parent + E3dObject::SetRectsDirty(bNotMyself); + + for(size_t a = 0; a < GetObjCount(); ++a) + { + E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a)); + + if(pCandidate) + { + pCandidate->SetRectsDirty(bNotMyself); + } + } +} + +void E3dScene::NbcSetLayer(SdrLayerID nLayer) +{ + // call parent + E3dObject::NbcSetLayer(nLayer); + + for(size_t a = 0; a < GetObjCount(); ++a) + { + E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a)); + + if(pCandidate) + { + pCandidate->NbcSetLayer(nLayer); + } + } +} + +void E3dScene::setParentOfSdrObject(SdrObjList* pNewObjList) +{ + // call parent + E3dObject::setParentOfSdrObject(pNewObjList); + + SetUpList(pNewObjList); +} + +void E3dScene::SetPage(SdrPage* pNewPage) +{ + // call parent + E3dObject::SetPage(pNewPage); + + // set at SdrObjList + SdrObjList::SetPage(pNewPage); +} + +SdrObjList* E3dScene::GetSubList() const +{ + return const_cast< E3dScene* >(this); +} + +void E3dScene::Insert3DObj(E3dObject* p3DObj) +{ + DBG_ASSERT(p3DObj, "Insert3DObj with NULL-pointer!"); + SdrPage* pPg = pPage; + InsertObject(p3DObj); + pPage = pPg; + InvalidateBoundVolume(); + NewObjectInserted(p3DObj); + StructureChanged(); +} + +void E3dScene::Remove3DObj(E3dObject const * p3DObj) +{ + DBG_ASSERT(p3DObj, "Remove3DObj with NULL-pointer!"); + + if(p3DObj->GetParentObj() == this) + { + SdrPage* pPg = pPage; + RemoveObject(p3DObj->GetOrdNum()); + pPage = pPg; + + InvalidateBoundVolume(); + StructureChanged(); + } +} + +basegfx::B3DRange E3dScene::RecalcBoundVolume() const +{ + basegfx::B3DRange aRetval; + const size_t nObjCnt(GetObjCount()); + + for(size_t a = 0; a < nObjCnt; ++a) + { + const E3dObject* p3DObject = dynamic_cast< const E3dObject* >(GetObj(a)); + + if(p3DObject) + { + basegfx::B3DRange aLocalRange(p3DObject->GetBoundVolume()); + aLocalRange.transform(p3DObject->GetTransform()); + aRetval.expand(aLocalRange); + } + } + + return aRetval; +} + +void E3dScene::SetTransformChanged() +{ + // call parent + E3dObject::SetTransformChanged(); + + for(size_t a = 0; a < GetObjCount(); ++a) + { + E3dObject* pCandidate = dynamic_cast< E3dObject* >(GetObj(a)); + + if(pCandidate) + { + pCandidate->SetTransformChanged(); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 31d6c36bb44c..62724e184dd0 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -581,7 +581,7 @@ bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene const * pSrcScene, E3dSce pNewCompoundObj->SetTransform(aModifyingTransform * aNewObjectTrans); // fill and insert new object - pNewCompoundObj->SetPage(pDstScene->GetPage()); + pNewCompoundObj->SetPage(pDstScene->E3dObject::GetPage()); pNewCompoundObj->NbcSetLayer(pCompoundObj->GetLayer()); pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->GetStyleSheet(), true); pDstScene->Insert3DObj(pNewCompoundObj); diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx index 14a7efed54c6..67ba3c507967 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx @@ -87,7 +87,7 @@ ViewContact& ViewContactOfSdrObj::GetViewContact(sal_uInt32 nIndex) const ViewContact* ViewContactOfSdrObj::GetParentContact() const { ViewContact* pRetval = nullptr; - SdrObjList* pObjList = GetSdrObject().GetObjList(); + SdrObjList* pObjList = GetSdrObject().getParentOfSdrObject(); if(pObjList) { diff --git a/svx/source/sdr/properties/e3dproperties.cxx b/svx/source/sdr/properties/e3dproperties.cxx index 8666191f0c54..a86421656d26 100644 --- a/svx/source/sdr/properties/e3dproperties.cxx +++ b/svx/source/sdr/properties/e3dproperties.cxx @@ -73,21 +73,6 @@ namespace sdr // local changes rObj.StructureChanged(); } - - void E3dProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) - { - // call parent - AttributeProperties::SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr); - - // propagate call to contained objects - const SdrObjList* pSub = static_cast<const E3dObject&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); - - for(size_t a = 0; a < nCount; ++a) - { - pSub->GetObj(a)->GetProperties().SetStyleSheet(pNewStyleSheet, bDontRemoveHardAttr); - } - } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx index 52f1207ebd44..696e42b78f19 100644 --- a/svx/source/sdr/properties/e3dsceneproperties.cxx +++ b/svx/source/sdr/properties/e3dsceneproperties.cxx @@ -67,8 +67,9 @@ namespace sdr } // collect all ItemSets of contained 3d objects - const SdrObjList* pSub = static_cast<const E3dScene&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -108,8 +109,9 @@ namespace sdr void E3dSceneProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems) { // Set SDRATTR_3DOBJ_ range at contained objects. - const SdrObjList* pSub = static_cast<const E3dScene&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); if(nCount) { @@ -144,8 +146,9 @@ namespace sdr void E3dSceneProperties::SetMergedItem(const SfxPoolItem& rItem) { - const SdrObjList* pSub = static_cast<const E3dScene&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -158,8 +161,9 @@ namespace sdr void E3dSceneProperties::ClearMergedItem(const sal_uInt16 nWhich) { - const SdrObjList* pSub = static_cast<const E3dScene&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -230,8 +234,9 @@ namespace sdr void E3dSceneProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) { - const SdrObjList* pSub = static_cast<const E3dScene&>(GetSdrObject()).GetSubList(); - const sal_uInt32 nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -243,8 +248,9 @@ namespace sdr { SfxStyleSheet* pRetval = nullptr; - const SdrObjList* pSub = static_cast<const E3dScene&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const E3dScene&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { diff --git a/svx/source/sdr/properties/groupproperties.cxx b/svx/source/sdr/properties/groupproperties.cxx index 39130e8b5326..410e2c641f48 100644 --- a/svx/source/sdr/properties/groupproperties.cxx +++ b/svx/source/sdr/properties/groupproperties.cxx @@ -83,8 +83,9 @@ namespace sdr } // collect all ItemSets in mpItemSet - const SdrObjList* pSub = static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -115,8 +116,9 @@ namespace sdr void GroupProperties::SetMergedItemSet(const SfxItemSet& rSet, bool bClearAllItems) { // iterate over contained SdrObjects - const SdrObjList* pSub = static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -156,8 +158,9 @@ namespace sdr void GroupProperties::SetMergedItem(const SfxPoolItem& rItem) { - const SdrObjList* pSub = static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -167,8 +170,9 @@ namespace sdr void GroupProperties::ClearMergedItem(const sal_uInt16 nWhich) { - const SdrObjList* pSub = static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -206,8 +210,9 @@ namespace sdr { SfxStyleSheet* pRetval = nullptr; - const SdrObjList* pSub = static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -232,8 +237,9 @@ namespace sdr void GroupProperties::SetStyleSheet(SfxStyleSheet* pNewStyleSheet, bool bDontRemoveHardAttr) { - const SdrObjList* pSub = static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { @@ -248,8 +254,9 @@ namespace sdr void GroupProperties::ForceStyleToHardAttributes() { - const SdrObjList* pSub = static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList(); - const size_t nCount(pSub->GetObjCount()); + const SdrObjList* pSub(static_cast<const SdrObjGroup&>(GetSdrObject()).GetSubList()); + OSL_ENSURE(nullptr != pSub, "Children of SdrObject expected (!)"); + const size_t nCount(nullptr == pSub ? 0 : pSub->GetObjCount()); for(size_t a = 0; a < nCount; ++a) { diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index f90894df9902..f22c780640d0 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -719,7 +719,7 @@ std::vector<SdrObject*> SdrEditView::DeleteMarkedList(SdrMarkList const& rMark) --nm; SdrMark* pM = rMark.GetMark(nm); SdrObject* pObj = pM->GetMarkedSdrObj(); - SdrObjList* pOL = pObj->GetObjList(); + SdrObjList* pOL = pObj->getParentOfSdrObject(); const size_t nOrdNum(pObj->GetOrdNumDirect()); bool bIs3D = dynamic_cast< E3dObject* >(pObj); @@ -791,7 +791,7 @@ void SdrEditView::DeleteMarkedObj() // in the first run, add all found parents, but only once SdrMark* pMark = rMarkList.GetMark(a); SdrObject* pObject = pMark->GetMarkedSdrObj(); - SdrObject* pParent = pObject->GetObjList()->GetOwnerObj(); + SdrObject* pParent = pObject->getParentOfSdrObject()->GetOwnerObj(); if(pParent) { @@ -1003,7 +1003,7 @@ void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrO pSdrView->SdrEndTextEdit(); } - SdrObjList* pOL=pOldObj->GetObjList(); + SdrObjList* pOL=pOldObj->getParentOfSdrObject(); const bool bUndo = IsUndoEnabled(); if( bUndo ) AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pOldObj,*pNewObj)); diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index ef63499a1eb8..a3ef121d777c 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -82,7 +82,7 @@ void SdrEditView::MovMarkedToTop() --nm; SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL!=pOL0) { nNewPos = pOL->GetObjCount()-1; @@ -169,7 +169,7 @@ void SdrEditView::MovMarkedToBtm() { SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL!=pOL0) { nNewPos=0; @@ -285,7 +285,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) SdrObject* pObj=pM->GetMarkedSdrObj(); if (pObj!=pRefObj) { - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL!=pOL0) { nNewPos=pOL->GetObjCount()-1; @@ -305,7 +305,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) } if (pRefObj!=nullptr) { - if (pRefObj->GetObjList()==pObj->GetObjList()) + if (pRefObj->getParentOfSdrObject()==pObj->getParentOfSdrObject()) { const size_t nMaxOrd=pRefObj->GetOrdNum(); // sadly doesn't work any other way if (nNewPos>nMaxOrd) @@ -382,7 +382,7 @@ void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj) SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); if (pObj!=pRefObj) { - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL!=pOL0) { nNewPos=0; pOL0=pOL; @@ -395,7 +395,7 @@ void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj) if (nNewPos>nNowPos) nNewPos=nNowPos; // nor go into the other direction } if (pRefObj!=nullptr) { - if (pRefObj->GetObjList()==pObj->GetObjList()) { + if (pRefObj->getParentOfSdrObject()==pObj->getParentOfSdrObject()) { const size_t nMinOrd=pRefObj->GetOrdNum(); // sadly doesn't work any differently if (nNewPos<nMinOrd) nNewPos=nMinOrd; // neither go faster... if (nNewPos>nNowPos) nNewPos=nNowPos; // nor go into the other direction @@ -482,7 +482,7 @@ void SdrEditView::ImpCheckToTopBtmPossible() if (nCount==1) { // special-casing for single selection SdrObject* pObj=GetMarkedObjectByIndex(0); - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); SAL_WARN_IF(!pOL, "svx", "Object somehow has no ObjList"); size_t nMax = pOL ? pOL->GetObjCount() : 0; size_t nMin = 0; @@ -504,7 +504,7 @@ void SdrEditView::ImpCheckToTopBtmPossible() size_t nPos0 = 0; for (size_t nm = 0; !bToBtmPossible && nm<nCount; ++nm) { // check 'send to background' SdrObject* pObj=GetMarkedObjectByIndex(nm); - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL!=pOL0) { nPos0 = 0; pOL0=pOL; @@ -519,7 +519,7 @@ void SdrEditView::ImpCheckToTopBtmPossible() for (size_t nm=nCount; !bToTopPossible && nm>0; ) { // check 'bring to front' --nm; SdrObject* pObj=GetMarkedObjectByIndex(nm); - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL!=pOL0) { nPos0=pOL->GetObjCount(); pOL0=pOL; @@ -1029,7 +1029,7 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) nInsPos = pObj->GetOrdNum() + 1; pInsPV = pM->GetPageView(); - pInsOL = pObj->GetObjList(); + pInsOL = pObj->getParentOfSdrObject(); // #i76891# use single iteration from SJ here which works on SdrObjects and takes // groups into account by itself @@ -1278,7 +1278,7 @@ void SdrEditView::CombineMarkedObjects(bool bNoPolyPoly) --a; SdrMark* pM = GetSdrMarkByIndex(a); SdrObject* pObj = pM->GetMarkedSdrObj(); - SdrObjList* pThisOL = pObj->GetObjList(); + SdrObjList* pThisOL = pObj->getParentOfSdrObject(); if(pCurrentOL != pThisOL) { @@ -1300,7 +1300,7 @@ void SdrEditView::CombineMarkedObjects(bool bNoPolyPoly) { nInsPos = pObj->GetOrdNum() + 1; pInsPV = pM->GetPageView(); - pInsOL = pObj->GetObjList(); + pInsOL = pObj->getParentOfSdrObject(); } aRemoveMerker.InsertEntry(SdrMark(pObj, pM->GetPageView())); @@ -1677,7 +1677,7 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines) SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL!=pOL0) { pOL0=pOL; pObj->GetOrdNum(); } // make sure OrdNums are correct! if (ImpCanDismantle(pObj,bMakeLines)) { aRemoveMerker.InsertEntry(SdrMark(pObj,pM->GetPageView())); @@ -1768,7 +1768,7 @@ void SdrEditView::GroupMarked() pDstLst=pGrp->GetSubList(); DBG_ASSERT(pDstLst!=nullptr,"Alleged group object doesn't return object list."); } - pSrcLst=pObj->GetObjList(); + pSrcLst=pObj->getParentOfSdrObject(); if (pSrcLst!=pSrcLst0) { if (pSrcLst->IsObjOrdNumsDirty()) @@ -1919,7 +1919,7 @@ SdrObject* SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLine SdrObject* pNewObj = pObj->ConvertToPolyObj(bPath, bLineToArea); if (pNewObj!=nullptr) { - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); DBG_ASSERT(pOL!=nullptr,"ConvertTo: Object doesn't return object list"); if (pOL!=nullptr) { @@ -2037,7 +2037,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); const size_t nInsPos=pObj->GetOrdNum()+1; SdrGrafObj* pGraf= dynamic_cast<SdrGrafObj*>( pObj ); SdrOle2Obj* pOle2= dynamic_cast<SdrOle2Obj*>( pObj ); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index d03a55fe4b11..5b41d59ca7d3 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1518,10 +1518,10 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) delete pDelUndo; } eRet=SdrEndTextEditKind::Deleted; - DBG_ASSERT(pTEObj->GetObjList()!=nullptr,"SdrObjEditView::SdrEndTextEdit(): Fatal: Object edited doesn't have an ObjList!"); - if (pTEObj->GetObjList()!=nullptr) + DBG_ASSERT(pTEObj->getParentOfSdrObject()!=nullptr,"SdrObjEditView::SdrEndTextEdit(): Fatal: Object edited doesn't have an ObjList!"); + if (pTEObj->getParentOfSdrObject()!=nullptr) { - pTEObj->GetObjList()->RemoveObject(pTEObj->GetOrdNum()); + pTEObj->getParentOfSdrObject()->RemoveObject(pTEObj->GetOrdNum()); CheckMarked(); // remove selection immediately... } } diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx index 25ee096abe2d..c1bcf353d536 100644 --- a/svx/source/svdraw/svdmark.cxx +++ b/svx/source/svdraw/svdmark.cxx @@ -123,8 +123,8 @@ static bool ImpSdrMarkListSorter(SdrMark* const& lhs, SdrMark* const& rhs) { SdrObject* pObj1 = lhs->GetMarkedSdrObj(); SdrObject* pObj2 = rhs->GetMarkedSdrObj(); - SdrObjList* pOL1 = pObj1 ? pObj1->GetObjList() : nullptr; - SdrObjList* pOL2 = pObj2 ? pObj2->GetObjList() : nullptr; + SdrObjList* pOL1 = pObj1 ? pObj1->getParentOfSdrObject() : nullptr; + SdrObjList* pOL2 = pObj2 ? pObj2->getParentOfSdrObject() : nullptr; if (pOL1 == pOL2) { @@ -307,8 +307,8 @@ void SdrMarkList::InsertEntry(const SdrMark& rMark, bool bChkSort) maList.push_back(pCopy); // now check if the sort is ok - const SdrObjList* pLastOL = pLastObj!=nullptr ? pLastObj->GetObjList() : nullptr; - const SdrObjList* pNewOL = pNewObj !=nullptr ? pNewObj ->GetObjList() : nullptr; + const SdrObjList* pLastOL = pLastObj!=nullptr ? pLastObj->getParentOfSdrObject() : nullptr; + const SdrObjList* pNewOL = pNewObj !=nullptr ? pNewObj->getParentOfSdrObject() : nullptr; if(pLastOL == pNewOL) { diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 07a5b2876361..0bf87a21f6e7 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1512,7 +1512,7 @@ bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev) if (pTopMarkHit==nullptr) return MarkObj(rPnt,sal_uInt16(nTol)); SdrObject* pTopObjHit=pTopMarkHit->GetMarkedSdrObj(); - SdrObjList* pObjList=pTopObjHit->GetObjList(); + SdrObjList* pObjList=pTopObjHit->getParentOfSdrObject(); SdrPageView* pPV=pTopMarkHit->GetPageView(); // find lowermost of the selected objects that is hit by rPnt // and is placed on the same PageView as pTopMarkHit diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 4157679c1089..9090fb255a5c 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -295,7 +295,7 @@ SdrObject::SdrObject(SdrModel& rSdrModel) ,pUserCall(nullptr) ,pPlusData(nullptr) ,mpImpl(new Impl) - ,pObjList(nullptr) + ,mpParentOfSdrObject(nullptr) ,nOrdNum(0) ,pGrabBagItem(nullptr) ,mnNavigationPosition(SAL_MAX_UINT32) @@ -401,14 +401,19 @@ void SdrObject::SetRectsDirty(bool bNotMyself) SetBoundRectDirty(); bSnapRectDirty=true; } - if (pObjList!=nullptr) { - pObjList->SetRectsDirty(); + + if (nullptr != getParentOfSdrObject()) + { + getParentOfSdrObject()->SetRectsDirty(); } } -void SdrObject::SetObjList(SdrObjList* pNewObjList) +void SdrObject::setParentOfSdrObject(SdrObjList* pNewObjList) { - pObjList=pNewObjList; + if(getParentOfSdrObject() != pNewObjList) + { + mpParentOfSdrObject = pNewObjList; + } } @@ -623,7 +628,7 @@ SdrObjList* SdrObject::GetSubList() const SdrObject* SdrObject::GetUpGroup() const { - return pObjList!=nullptr ? pObjList->GetOwnerObj() : nullptr; + return nullptr != getParentOfSdrObject() ? getParentOfSdrObject()->GetOwnerObj() : nullptr; } void SdrObject::SetName(const OUString& rStr) @@ -760,9 +765,11 @@ OUString SdrObject::GetDescription() const sal_uInt32 SdrObject::GetOrdNum() const { - if (pObjList!=nullptr) { - if (pObjList->IsObjOrdNumsDirty()) { - pObjList->RecalcObjOrdNums(); + if (nullptr != getParentOfSdrObject()) + { + if (getParentOfSdrObject()->IsObjOrdNumsDirty()) + { + getParentOfSdrObject()->RecalcObjOrdNums(); } } else const_cast<SdrObject*>(this)->nOrdNum=0; return nOrdNum; @@ -795,7 +802,7 @@ void SdrObject::SetGrabBagItem(const css::uno::Any& rVal) sal_uInt32 SdrObject::GetNavigationPosition() { - if (pObjList!=nullptr && pObjList->RecalcNavigationPositions()) + if (nullptr != getParentOfSdrObject() && getParentOfSdrObject()->RecalcNavigationPositions()) { return mnNavigationPosition; } @@ -2652,8 +2659,10 @@ void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& { SdrObject* pGroup = nullptr; - if( pObjList && pObjList->GetListKind() == SdrObjListKind::GroupObj ) - pGroup = pObjList->GetOwnerObj(); + if(nullptr != getParentOfSdrObject() && SdrObjListKind::GroupObj == getParentOfSdrObject()->GetListKind()) + { + pGroup = getParentOfSdrObject()->GetOwnerObj(); + } if ( pUserCall ) { @@ -2699,12 +2708,16 @@ void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect ); } - if( pGroup->GetObjList() && - pGroup->GetObjList()->GetListKind() == SdrObjListKind::GroupObj && - pGroup != pObjList->GetOwnerObj() ) - pGroup = pObjList->GetOwnerObj(); + if( pGroup->getParentOfSdrObject() && + pGroup->getParentOfSdrObject()->GetListKind() == SdrObjListKind::GroupObj && + pGroup != getParentOfSdrObject()->GetOwnerObj() ) + { + pGroup = getParentOfSdrObject()->GetOwnerObj(); + } else + { pGroup = nullptr; + } } // notify our UNO shape listeners diff --git a/svx/source/svdraw/svdogrp.cxx b/svx/source/svdraw/svdogrp.cxx index 6311106c4e2f..9476a5074613 100644 --- a/svx/source/svdraw/svdogrp.cxx +++ b/svx/source/svdraw/svdogrp.cxx @@ -160,9 +160,9 @@ void SdrObjGroup::NbcSetLayer(SdrLayerID nLayer) } -void SdrObjGroup::SetObjList(SdrObjList* pNewObjList) +void SdrObjGroup::setParentOfSdrObject(SdrObjList* pNewObjList) { - SdrObject::SetObjList(pNewObjList); + SdrObject::setParentOfSdrObject(pNewObjList); maSdrObjList.SetUpList(pNewObjList); } diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 2dff0a900148..5d143e34f0e2 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -76,7 +76,7 @@ SdrObjList::SdrObjList(SdrPage* pNewPage) mbIsNavigationOrderDirty(false) { maList.reserve(InitialObjectContainerCapacity); - pPage=pNewPage; + mpPage=pNewPage; pUpList=nullptr; bObjOrdNumsDirty=false; bRectsDirty=false; @@ -92,11 +92,11 @@ SdrObjList::~SdrObjList() SdrObjList* SdrObjList::CloneSdrObjList(SdrModel* pNewModel) const { SdrObjList* pObjList = new SdrObjList(); - pObjList->lateInitSdrObjList(*this, pNewModel); + pObjList->copyDataFromSdrObjList(*this, pNewModel); return pObjList; } -void SdrObjList::lateInitSdrObjList(const SdrObjList& rSrcList, SdrModel* pNewModel) +void SdrObjList::copyDataFromSdrObjList(const SdrObjList& rSrcList, SdrModel* pNewModel) { // this function is only supposed to be called once, right after construction assert(maList.empty()); @@ -119,7 +119,7 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList, SdrModel* pNewModel) if(nullptr != pDO) { - pDO->SetPage(pPage); + pDO->SetPage(mpPage); NbcInsertObject(pDO, SAL_MAX_SIZE); } else @@ -143,8 +143,8 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList, SdrModel* pNewModel) if (pSrcEdge!=nullptr) { SdrObject* pSrcNode1=pSrcEdge->GetConnectedNode(true); SdrObject* pSrcNode2=pSrcEdge->GetConnectedNode(false); - if (pSrcNode1!=nullptr && pSrcNode1->GetObjList()!=pSrcEdge->GetObjList()) pSrcNode1=nullptr; // can't do this - if (pSrcNode2!=nullptr && pSrcNode2->GetObjList()!=pSrcEdge->GetObjList()) pSrcNode2=nullptr; // across all lists (yet) + if (pSrcNode1!=nullptr && pSrcNode1->getParentOfSdrObject()!=pSrcEdge->getParentOfSdrObject()) pSrcNode1=nullptr; // can't do this + if (pSrcNode2!=nullptr && pSrcNode2->getParentOfSdrObject()!=pSrcEdge->getParentOfSdrObject()) pSrcNode2=nullptr; // across all lists (yet) if (pSrcNode1!=nullptr || pSrcNode2!=nullptr) { SdrObject* pEdgeObjTmp=GetObj(no); SdrEdgeObj* pDstEdge=dynamic_cast<SdrEdgeObj*>( pEdgeObjTmp ); @@ -214,7 +214,7 @@ void SdrObjList::Clear() } // sent remove hint (after removal, see RemoveObject()) - SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj, pPage); + SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj, mpPage); pObj->getSdrModelFromSdrObject().Broadcast(aHint); // delete the object itself @@ -229,17 +229,17 @@ void SdrObjList::Clear() SdrPage* SdrObjList::GetPage() const { - return pPage; + return mpPage; } void SdrObjList::SetPage(SdrPage* pNewPage) { - if (pPage!=pNewPage) { - pPage=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(pPage); + pObj->SetPage(mpPage); } } } @@ -256,16 +256,16 @@ void SdrObjList::RecalcObjOrdNums() void SdrObjList::RecalcRects() { - aOutRect=tools::Rectangle(); - aSnapRect=aOutRect; + maOutRect=tools::Rectangle(); + aSnapRect=maOutRect; const size_t nCount = GetObjCount(); for (size_t i=0; i<nCount; ++i) { SdrObject* pObj=GetObj(i); if (i==0) { - aOutRect=pObj->GetCurrentBoundRect(); + maOutRect=pObj->GetCurrentBoundRect(); aSnapRect=pObj->GetSnapRect(); } else { - aOutRect.Union(pObj->GetCurrentBoundRect()); + maOutRect.Union(pObj->GetCurrentBoundRect()); aSnapRect.Union(pObj->GetSnapRect()); } } @@ -300,15 +300,15 @@ void SdrObjList::NbcInsertObject(SdrObject* pObj, size_t nPos) if (nPos<nCount) bObjOrdNumsDirty=true; pObj->SetOrdNum(nPos); - pObj->SetObjList(this); - pObj->SetPage(pPage); + pObj->setParentOfSdrObject(this); + pObj->SetPage(mpPage); // Inform the parent about change to allow invalidations at // evtl. existing parent visualisations impChildInserted(*pObj); if (!bRectsDirty) { - aOutRect.Union(pObj->GetCurrentBoundRect()); + maOutRect.Union(pObj->GetCurrentBoundRect()); aSnapRect.Union(pObj->GetSnapRect()); } pObj->SetInserted(true); // calls the UserCall (among others) @@ -370,7 +370,7 @@ SdrObject* SdrObjList::NbcRemoveObject(size_t nObjNum) DBG_ASSERT(pObj->IsInserted(),"The object does not have the status Inserted."); pObj->SetInserted(false); // calls UserCall, among other - pObj->SetObjList(nullptr); + pObj->setParentOfSdrObject(nullptr); pObj->SetPage(nullptr); if (!bObjOrdNumsDirty) { // optimizing for the case that the last object has to be removed if (nObjNum+1!=nCount) { @@ -411,7 +411,7 @@ SdrObject* SdrObjList::RemoveObject(size_t nObjNum) pObj->getSdrModelFromSdrObject().SetChanged(); pObj->SetInserted(false); // calls, among other things, the UserCall - pObj->SetObjList(nullptr); + pObj->setParentOfSdrObject(nullptr); pObj->SetPage(nullptr); if (!bObjOrdNumsDirty) { // optimization for the case that the last object is removed if (nObjNum+1!=nCount) { @@ -444,7 +444,7 @@ 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->SetObjList(nullptr); + pObj->setParentOfSdrObject(nullptr); pObj->SetPage(nullptr); ReplaceObjectInContainer(*pNewObj,nObjNum); @@ -452,8 +452,8 @@ SdrObject* SdrObjList::NbcReplaceObject(SdrObject* pNewObj, size_t nObjNum) pObj->GetViewContact().flushViewObjectContacts(); pNewObj->SetOrdNum(nObjNum); - pNewObj->SetObjList(this); - pNewObj->SetPage(pPage); + pNewObj->setParentOfSdrObject(this); + pNewObj->SetPage(mpPage); // Inform the parent about change to allow invalidations at // evtl. existing parent visualisations @@ -491,7 +491,7 @@ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, size_t nObjNum) } pObj->SetInserted(false); - pObj->SetObjList(nullptr); + pObj->setParentOfSdrObject(nullptr); pObj->SetPage(nullptr); ReplaceObjectInContainer(*pNewObj,nObjNum); @@ -499,8 +499,8 @@ SdrObject* SdrObjList::ReplaceObject(SdrObject* pNewObj, size_t nObjNum) pObj->GetViewContact().flushViewObjectContacts(); pNewObj->SetOrdNum(nObjNum); - pNewObj->SetObjList(this); - pNewObj->SetPage(pPage); + pNewObj->setParentOfSdrObject(this); + pNewObj->SetPage(mpPage); // Inform the parent about change to allow invalidations at // evtl. existing parent visualisations @@ -567,14 +567,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 aOutRect in empty state to represent an invalid state, thus + // just maOutRect in empty state to represent an invalid state, thus // it's a step in the right direction. - if (bRectsDirty || aOutRect.IsEmpty()) + if (bRectsDirty || maOutRect.IsEmpty()) { const_cast<SdrObjList*>(this)->RecalcRects(); const_cast<SdrObjList*>(this)->bRectsDirty=false; } - return aOutRect; + return maOutRect; } void SdrObjList::NbcReformatAllTextObjects() @@ -647,7 +647,7 @@ SdrObject* SdrObjList::GetObj(size_t nNum) const bool SdrObjList::IsReadOnly() const { bool bRet = false; - if (pPage!=nullptr && pPage!=this) bRet=pPage->IsReadOnly(); + if (mpPage!=nullptr && mpPage!=this) bRet=mpPage->IsReadOnly(); return bRet; } @@ -1212,7 +1212,7 @@ void SdrPage::lateInit(const SdrPage& rSrcPage) } // Now copy the contained objects - SdrObjList::lateInitSdrObjList(rSrcPage, &getSdrModelFromSdrPage()); + SdrObjList::copyDataFromSdrObjList(rSrcPage, &getSdrModelFromSdrPage()); // be careful and correct eListKind, a member of SdrObjList which // will be changed by the SdrObjList::lateInit before... diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx index fb1eee822d25..76d30c43d145 100644 --- a/svx/source/svdraw/svdpagv.cxx +++ b/svx/source/svdraw/svdpagv.cxx @@ -901,7 +901,7 @@ void SdrPageView::CheckCurrentGroup() SdrObject* pGrp(GetCurrentGroup()); while(nullptr != pGrp && - (!pGrp->IsInserted() || nullptr == pGrp->GetObjList() || nullptr == pGrp->GetPage())) + (!pGrp->IsInserted() || nullptr == pGrp->getParentOfSdrObject() || nullptr == pGrp->GetPage())) { // anything outside of the borders? pGrp = pGrp->GetUpGroup(); diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index 22720cfb4ca4..6dc3788ab30e 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -656,7 +656,7 @@ SdrUndoObjList::SdrUndoObjList(SdrObject& rNewObj, bool bOrdNumDirect) : SdrUndoObj(rNewObj) , bOwner(false) { - pObjList=pObj->GetObjList(); + pObjList=pObj->getParentOfSdrObject(); if (bOrdNumDirect) { nOrdNum=pObj->GetOrdNumDirect(); @@ -856,7 +856,7 @@ SdrUndoReplaceObj::SdrUndoReplaceObj(SdrObject& rOldObj1, SdrObject& rNewObj1, b { SetOldOwner(true); - pObjList=pObj->GetObjList(); + pObjList=pObj->getParentOfSdrObject(); if (bOrdNumDirect) { nOrdNum=pObj->GetOrdNumDirect(); @@ -983,7 +983,7 @@ void SdrUndoObjOrdNum::Undo() // Trigger PageChangeCall ImpShowPageOfThisObject(); - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL==nullptr) { OSL_FAIL("UndoObjOrdNum: pObj does not have an ObjList."); @@ -994,7 +994,7 @@ void SdrUndoObjOrdNum::Undo() void SdrUndoObjOrdNum::Redo() { - SdrObjList* pOL=pObj->GetObjList(); + SdrObjList* pOL=pObj->getParentOfSdrObject(); if (pOL==nullptr) { OSL_FAIL("RedoObjOrdNum: pObj does not have an ObjList."); diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index d9eb52432957..8bfea2399a26 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -743,8 +743,8 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co rVEvt.eEvent=eEvent; #ifdef DGB_UTIL if (rVEvt.pRootObj!=NULL) { - if (rVEvt.pRootObj->GetObjList()!=rVEvt.pPV->GetObjList()) { - OSL_FAIL("SdrView::PickAnything(): pRootObj->GetObjList()!=pPV->GetObjList() !"); + if (rVEvt.pRootObj->getParentOfSdrObject()!=rVEvt.pPV->GetObjList()) { + OSL_FAIL("SdrView::PickAnything(): pRootObj->getParentOfSdrObject()!=pPV->GetObjList() !"); } } #endif diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index 34106635f1cb..8b351899d54a 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -199,7 +199,7 @@ void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape pSdrShape = mxPage->CreateSdrObject_( xShape ); if( pSdrShape->IsInserted() ) - pSdrShape->GetObjList()->RemoveObject( pSdrShape->GetOrdNum() ); + pSdrShape->getParentOfSdrObject()->RemoveObject( pSdrShape->GetOrdNum() ); GetSdrObject()->GetSubList()->InsertObject(pSdrShape, nPos); // TTTT Was created using mpModel in CreateSdrObject_ above @@ -242,10 +242,10 @@ void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xS if( pShape ) pSdrShape = pShape->GetSdrObject(); - if( !HasSdrObject() || pSdrShape == nullptr || pSdrShape->GetObjList()->GetOwnerObj() != GetSdrObject() ) + if( !HasSdrObject() || pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->GetOwnerObj() != GetSdrObject() ) throw uno::RuntimeException(); - SdrObjList& rList = *pSdrShape->GetObjList(); + SdrObjList& rList = *pSdrShape->getParentOfSdrObject(); const size_t nObjCount = rList.GetObjCount(); size_t nObjNum = 0; diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx index 663dcc9f6bd9..9f694bd8a130 100644 --- a/svx/source/unodraw/unoshap3.cxx +++ b/svx/source/unodraw/unoshap3.cxx @@ -150,12 +150,12 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha throw uno::RuntimeException(); SdrObject* pSdrShape = pShape->GetSdrObject(); - if(pSdrShape == nullptr || pSdrShape->GetObjList()->GetOwnerObj() != GetSdrObject()) + if(pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->GetOwnerObj() != GetSdrObject()) { throw uno::RuntimeException(); } - SdrObjList& rList = *pSdrShape->GetObjList(); + SdrObjList& rList = *pSdrShape->getParentOfSdrObject(); const size_t nObjCount = rList.GetObjCount(); size_t nObjNum = 0; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 33afa53635a4..1d567bae7caf 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2088,7 +2088,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl sal_Int32 nNewOrdNum = 0; if(rValue >>= nNewOrdNum) { - SdrObjList* pObjList = GetSdrObject()->GetObjList(); + SdrObjList* pObjList = GetSdrObject()->getParentOfSdrObject(); if( pObjList ) { SdrObject* pCheck = @@ -3671,9 +3671,9 @@ uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent() { ::SolarMutexGuard aGuard; - if( HasSdrObject() && GetSdrObject()->GetObjList() ) + if( HasSdrObject() && GetSdrObject()->getParentOfSdrObject() ) { - SdrObjList* pObjList = GetSdrObject()->GetObjList(); + SdrObjList* pObjList = GetSdrObject()->getParentOfSdrObject(); switch (pObjList->GetListKind()) { diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index dfe4d11c834a..849787aedc01 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -928,7 +928,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc ) Imp()->GetDrawView()->InsertObjectAtView( pNew, *Imp()->GetPageView() ); Point aGrpAnchor( 0, 0 ); - SdrObjList* pList = pNew->GetObjList(); + SdrObjList* pList = pNew->getParentOfSdrObject(); if ( pList ) { SdrObject* pOwner = pList->GetOwnerObj(); @@ -1276,7 +1276,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SdrModel& _rModel ) if( pOle2Obj ) { // found an ole2 shape - SdrObjList* pObjList = pOle2Obj->GetObjList(); + SdrObjList* pObjList = pOle2Obj->getParentOfSdrObject(); // get its graphic Graphic aGraphic; diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 870009758321..b1b897f32d84 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1502,7 +1502,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool // If an object inside a group is selected, we want to // iterate over the group members. if ( ! pStartObj->GetUserCall() ) - pList = pStartObj->GetObjList(); + pList = pStartObj->getParentOfSdrObject(); } else { diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index e0244ca88a32..5f5d9c0d4c0d 100644 --- a/sw/source/filter/xml/swxml.cxx +++ b/sw/source/filter/xml/swxml.cxx @@ -447,7 +447,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs(SwDoc& _rDoc) if( pOle2Obj ) { // found an ole2 shape - SdrObjList* pObjList = pOle2Obj->GetObjList(); + SdrObjList* pObjList = pOle2Obj->getParentOfSdrObject(); // get its graphic Graphic aGraphic; |