diff options
author | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-06-16 13:23:08 +0200 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@cib.de> | 2018-06-16 17:29:52 +0200 |
commit | 099eef24da24d638fdf2c747d28040c9b3a30780 (patch) | |
tree | a636f31a48033b3164db59e057ce68d22c708edb | |
parent | a4cd8bfea486327279d6d2a3bacc3e06e5df2745 (diff) |
AW080: Continued cleanups/remaps/corrections
Change-Id: I953f29e6a8d398e00884a600d6f4ceba880489a5
Reviewed-on: https://gerrit.libreoffice.org/55913
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
46 files changed, 495 insertions, 446 deletions
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx index b86980f47782..6330becfeb64 100644 --- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx +++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx @@ -200,8 +200,9 @@ SdrObject* DrawViewWrapper::getHitObject( const Point& rPnt ) const E3dObject* pE3d = dynamic_cast< E3dObject* >(pRet); if( pE3d ) { - E3dScene* pScene = pE3d->GetScene(); - if( pScene ) + E3dScene* pScene(pE3d->getRootE3dSceneFromE3dObject()); + + if(nullptr != pScene) { // prepare result vector and call helper std::vector< const E3dCompoundObject* > aHitList; diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index a1c09e85fc87..66bb107b185e 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -829,9 +829,15 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt ) awt::Size aPageSize( ChartModelHelper::getPageSize( getModel() ) ); tools::Rectangle aPageRect( 0,0,aPageSize.Width,aPageSize.Height ); - const E3dObject* pE3dObject = dynamic_cast< const E3dObject*>( pObj ); - if( pE3dObject ) - aObjectRect = pE3dObject->GetScene()->GetSnapRect(); + const E3dObject* pE3dObject(dynamic_cast< const E3dObject*>(pObj)); + if(nullptr != pE3dObject) + { + E3dScene* pScene(pE3dObject->getRootE3dSceneFromE3dObject()); + if(nullptr != pScene) + { + aObjectRect = pScene->GetSnapRect(); + } + } ActionDescriptionProvider::ActionType eActionType(ActionDescriptionProvider::ActionType::Move); if( !bIsMoveOnly && m_aSelection.isResizeableObjectSelected() ) diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 9be4ae4e3504..bc18ffe79334 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->getParentOfSdrObject(); + SdrObjList* pObjList = pObj->getParentSdrObjListFromSdrObject(); if( !pObjList ) return false; SdrObject* pOwner = pObjList->getSdrObjectFromSdrObjList(); @@ -549,14 +549,15 @@ E3dScene* SelectionHelper::getSceneToRotate( SdrObject* pObj ) } } - E3dScene* pScene = nullptr; + E3dScene* pScene(nullptr); + if(pRotateable) { SolarMutexGuard aSolarGuard; - pScene = pRotateable->GetScene(); + pScene = pRotateable->getRootE3dSceneFromE3dObject(); } - return pScene; + return pScene; } bool SelectionHelper::getMarkHandles( SdrHdlList& rHdlList ) diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 146373edd0b2..cab13732b6a9 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -487,8 +487,10 @@ void BarChart::createShapes() for (uno::Reference<drawing::XShape> const & rShape : aShapeSet) { E3dScene* pScene = lcl_getE3dScene(rShape); - if (pScene) - aSceneSet.insert(pScene->GetScene()); + if(nullptr != pScene) + { + aSceneSet.insert(pScene->getRootE3dSceneFromE3dObject()); + } } for (E3dScene* pScene : aSceneSet) { diff --git a/include/svx/obj3d.hxx b/include/svx/obj3d.hxx index bfb730d28df0..c452197053bd 100644 --- a/include/svx/obj3d.hxx +++ b/include/svx/obj3d.hxx @@ -75,9 +75,6 @@ public: class SVX_DLLPUBLIC E3dObject : public SdrAttrObj { private: - // to allow sdr::properties::E3dProperties access to StructureChanged() - friend class sdr::properties::E3dProperties; - // Allow everything for E3dObjList and E3dDragMethod friend class E3dDragMethod; @@ -93,10 +90,8 @@ private: bool mbIsSelected : 1; protected: - virtual void StructureChanged(); virtual basegfx::B3DRange RecalcBoundVolume() const; -protected: // E3dObject is only a helper class (for E3DScene and E3DCompoundObject) // and no instances should be created from anyone, so i move the constructors // to protected area @@ -106,6 +101,7 @@ protected: virtual ~E3dObject() override; public: + virtual void StructureChanged(); virtual void SetTransformChanged(); virtual void RecalcSnapRect() override; @@ -114,8 +110,10 @@ public: virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override; virtual void NbcMove(const Size& rSize) override; virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override; - E3dObject* GetParentObj() const; - virtual E3dScene* GetScene() const; + + E3dScene* getParentE3dSceneFromE3dObject() const; + virtual E3dScene* getRootE3dSceneFromE3dObject() const; + const basegfx::B3DRange& GetBoundVolume() const; void InvalidateBoundVolume(); @@ -203,8 +201,6 @@ public: // implemented mainly for the purposes of Clone() E3dCompoundObject& operator=(const E3dCompoundObject& rObj); - - bool IsAOrdNumRemapCandidate(E3dScene*& prScene) const; }; #endif // INCLUDED_SVX_OBJ3D_HXX diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index 9b8e4b4f88bd..13286caa6210 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -59,10 +59,6 @@ class Imp3DDepthRemapper; class SVX_DLLPUBLIC E3dScene : public E3dObject, public SdrObjList { -private: - // to allow sdr::properties::E3dSceneProperties access to StructureChanged() - friend class sdr::properties::E3dSceneProperties; - protected: virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() override; virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() override; @@ -78,13 +74,10 @@ protected: bool mbSkipSettingDirty : 1; - virtual void StructureChanged() override; - void RebuildLists(); virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override; -protected: void SetDefaultAttributes(); void ImpCleanup3DDepthMapper(); @@ -94,6 +87,8 @@ protected: public: E3dScene(SdrModel& rSdrModel); + virtual void StructureChanged() override; + // derived from SdrObjList virtual SdrPage* getSdrPageFromSdrObjList() const override; virtual SdrObject* getSdrObjectFromSdrObjList() const override; @@ -134,7 +129,7 @@ public: const Fraction& rYFact) override; virtual void RecalcSnapRect() override; - virtual E3dScene* GetScene() const override; + virtual E3dScene* getRootE3dSceneFromE3dObject() const override; void SetCamera(const Camera3D& rNewCamera); const Camera3D& GetCamera() const { return aCamera; } void removeAllNonSelectedObjects(); diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index 2f1273716bbe..21529b482147 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -345,9 +345,14 @@ public: // SdrModel/SdrPage access on SdrObject level SdrPage* getSdrPageFromSdrObject() const; SdrModel& getSdrModelFromSdrObject() const; - SdrObjList* getParentOfSdrObject() const; + + // access to possible children (SdrObjGroup/E3dScene) virtual SdrObjList* getChildrenOfSdrObject() const; + // access to parent + SdrObjList* getParentSdrObjListFromSdrObject() const; + SdrObject* getParentSdrObjectFromSdrObject() const; + private: // only allow SetParentAtSdrObjectFromSdrObjList to call setParentOfSdrObject friend void SetParentAtSdrObjectFromSdrObjList(SdrObject& rSdrObject, SdrObjList* pNew); @@ -428,7 +433,6 @@ public: // for group objects bool IsGroupObject() const; virtual SdrObjList* GetSubList() const; - SdrObject* GetUpGroup() const; /// The order number (aka ZOrder, aka z-index) determines whether a /// SdrObject is located above or below another. Objects are painted from diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index fd18f444d21d..0703baa363a3 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->getSdrPageFromSdrObject() && (pObject->getSdrPageFromSdrObject() == pObject->getParentOfSdrObject()->getSdrPageFromSdrObjList()) ) + if( pObject && pObject->getSdrPageFromSdrObject() && (pObject->getSdrPageFromSdrObject() == pObject->getParentSdrObjListFromSdrObject()->getSdrPageFromSdrObjList()) ) { // 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 87614409999b..6e7ef136ea65 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -409,7 +409,7 @@ void ScChildrenShapes::Notify(SfxBroadcaster&, const SfxHint& rHint) { SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject()); 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 + (pObj->getSdrPageFromSdrObject() == pObj->getParentSdrObjListFromSdrObject()) ) //only do something if the object lies direct on the page { switch (pSdrHint->GetKind()) { @@ -1063,7 +1063,7 @@ bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawing::X if( pMarkedObj ) { uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY); - pUpObj = pMarkedObj->GetUpGroup(); + pUpObj = pMarkedObj->getParentSdrObjectFromSdrObject(); if( pMarkedObj == pFocusedObj ) { diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index 6fd8671755fa..369de3136adb 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -419,7 +419,7 @@ static bool implIsInsideGroup( SdrObject const * pObj ) return false; } - SdrObjList* pSdrObjList(pObj->getParentOfSdrObject()); + SdrObjList* pSdrObjList(pObj->getParentSdrObjListFromSdrObject()); if(nullptr == pSdrObjList) { diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 5755ce31a413..539932c8e9dc 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -1055,7 +1055,7 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind) const bool bUndo = pDoc->IsUndoEnabled(); if( bUndo ) pDoc->AddUndo(pDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pObject)); - SdrObjList* pOL = pObject->getParentOfSdrObject(); + SdrObjList* pOL = pObject->getParentSdrObjListFromSdrObject(); pOL->RemoveObject(pObject->GetOrdNumDirect()); if( !bUndo ) diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx index 6f73d9799102..62f49e13d060 100644 --- a/sd/source/ui/unoidl/unoobj.cxx +++ b/sd/source/ui/unoidl/unoobj.cxx @@ -448,7 +448,7 @@ void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const c if(!(aValue >>= nNavOrder)) throw lang::IllegalArgumentException(); - SdrObjList* pObjList = pObj->getParentOfSdrObject(); + SdrObjList* pObjList = pObj->getParentSdrObjListFromSdrObject(); if( pObjList ) pObjList->SetObjectNavigationPosition( *pObj, (nNavOrder < 0) ? SAL_MAX_UINT32 : static_cast< sal_uInt32 >( nNavOrder ) ); break; diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index da50d27cac19..19d9c2fed299 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -1319,11 +1319,11 @@ AccessibleShape::getGroupPosition( const uno::Any& ) // Compute object's group level. sal_Int32 nGroupLevel = 0; - SdrObject * pUper = pObj->GetUpGroup(); + SdrObject * pUper = pObj->getParentSdrObjectFromSdrObject(); while( pUper ) { ++nGroupLevel; - pUper = pUper->GetUpGroup(); + pUper = pUper->getParentSdrObjectFromSdrObject(); } css::uno::Reference<XAccessibleContext> xParentContext = xParent->getAccessibleContext(); @@ -1345,8 +1345,8 @@ AccessibleShape::getGroupPosition( const uno::Any& ) } SdrObjList *pGrpList = nullptr; - if( pObj->GetUpGroup() ) - pGrpList = pObj->GetUpGroup()->GetSubList(); + if( pObj->getParentSdrObjectFromSdrObject() ) + pGrpList = pObj->getParentSdrObjectFromSdrObject()->GetSubList(); else return aRet; diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 5e070abb6c43..255b667da859 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -78,10 +78,10 @@ E3dDragMethod::E3dDragMethod ( // get transformations aNewUnit.maInitTransform = aNewUnit.maTransform = pE3dObj->GetTransform(); - if(pE3dObj->GetParentObj()) + if(nullptr != pE3dObj->getParentE3dSceneFromE3dObject()) { // get transform between object and world, normally scene transform - aNewUnit.maInvDisplayTransform = aNewUnit.maDisplayTransform = pE3dObj->GetParentObj()->GetFullTransform(); + aNewUnit.maInvDisplayTransform = aNewUnit.maDisplayTransform = pE3dObj->getParentE3dSceneFromE3dObject()->GetFullTransform(); aNewUnit.maInvDisplayTransform.invert(); } @@ -225,18 +225,23 @@ void E3dDragMethod::CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlay if(nPlyCnt) { - const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mr3DObj.GetScene()->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); - const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation()); - const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform); + const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject()); + + if(nullptr != pScene) + { + const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); + const basegfx::B3DHomMatrix aWorldToView(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection() * aViewInfo3D.getOrientation()); + const basegfx::B3DHomMatrix aTransform(aWorldToView * rCandidate.maDisplayTransform); - // transform to relative scene coordinates - basegfx::B2DPolyPolygon aPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aCandidate, aTransform)); + // transform to relative scene coordinates + basegfx::B2DPolyPolygon aPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aCandidate, aTransform)); - // transform to 2D view coordinates - aPolyPolygon.transform(rVCScene.getObjectTransformation()); + // transform to 2D view coordinates + aPolyPolygon.transform(rVCScene.getObjectTransformation()); - aResult.append(aPolyPolygon); + aResult.append(aPolyPolygon); + } } } } @@ -262,9 +267,9 @@ E3dDragRotate::E3dDragRotate(SdrDragView &_rView, if(nCnt) { - const E3dScene *pScene = maGrp[0].mr3DObj.GetScene(); + const E3dScene* pScene(maGrp[0].mr3DObj.getRootE3dSceneFromE3dObject()); - if(pScene) + if(nullptr != pScene) { const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); @@ -387,33 +392,38 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt) aRotMat.rotate(fHAngle, 0.0, 0.0); } - // Transformation in eye coordinates, there rotate then and back - const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mr3DObj.GetScene()->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); - basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); - aInverseOrientation.invert(); + const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject()); - basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform); - aTransMat *= aViewInfo3D.getOrientation(); - aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ()); - aTransMat *= aRotMat; - aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ()); - aTransMat *= aInverseOrientation; - aTransMat *= rCandidate.maInvDisplayTransform; + if(nullptr != pScene) + { + // Transformation in eye coordinates, there rotate then and back + const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); + basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); + aInverseOrientation.invert(); - // ...and apply - rCandidate.maTransform *= aTransMat; + basegfx::B3DHomMatrix aTransMat(rCandidate.maDisplayTransform); + aTransMat *= aViewInfo3D.getOrientation(); + aTransMat.translate(-maGlobalCenter.getX(), -maGlobalCenter.getY(), -maGlobalCenter.getZ()); + aTransMat *= aRotMat; + aTransMat.translate(maGlobalCenter.getX(), maGlobalCenter.getY(), maGlobalCenter.getZ()); + aTransMat *= aInverseOrientation; + aTransMat *= rCandidate.maInvDisplayTransform; - if(mbMoveFull) - { - E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj); - rCandidate.mr3DObj.SetTransform(rCandidate.maTransform); - } - else - { - Hide(); - rCandidate.maWireframePoly.transform(aTransMat); - Show(); + // ...and apply + rCandidate.maTransform *= aTransMat; + + if(mbMoveFull) + { + E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj); + rCandidate.mr3DObj.SetTransform(rCandidate.maTransform); + } + else + { + Hide(); + rCandidate.maWireframePoly.transform(aTransMat); + Show(); + } } } maLastPos = rPnt; @@ -505,64 +515,69 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt) for(sal_uInt32 nOb(0); nOb < nCnt; nOb++) { E3dDragMethodUnit& rCandidate = maGrp[nOb]; - const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mr3DObj.GetScene()->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); + const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject()); - // move coor from 2d world to 3d Eye - basegfx::B2DPoint aGlobalMoveHead2D(static_cast<double>(rPnt.X() - maLastPos.X()), static_cast<double>(rPnt.Y() - maLastPos.Y())); - basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0); - basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); + if(nullptr != pScene) + { + const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); - aInverseSceneTransform.invert(); - aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D; - aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D; + // move coor from 2d world to 3d Eye + basegfx::B2DPoint aGlobalMoveHead2D(static_cast<double>(rPnt.X() - maLastPos.X()), static_cast<double>(rPnt.Y() - maLastPos.Y())); + basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0); + basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); - basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5); - basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5); - basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); - aInverseViewToEye.invert(); + aInverseSceneTransform.invert(); + aGlobalMoveHead2D = aInverseSceneTransform * aGlobalMoveHead2D; + aGlobalMoveTail2D = aInverseSceneTransform * aGlobalMoveTail2D; - aMoveHead3D = aInverseViewToEye * aMoveHead3D; - aMoveTail3D = aInverseViewToEye * aMoveTail3D; + basegfx::B3DPoint aMoveHead3D(aGlobalMoveHead2D.getX(), aGlobalMoveHead2D.getY(), 0.5); + basegfx::B3DPoint aMoveTail3D(aGlobalMoveTail2D.getX(), aGlobalMoveTail2D.getY(), 0.5); + basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); + aInverseViewToEye.invert(); - // eventually switch movement from XY to XZ plane - if(nModifier & KEY_MOD2) - { - double fZwi = aMoveHead3D.getY(); - aMoveHead3D.setY(aMoveHead3D.getZ()); - aMoveHead3D.setZ(fZwi); + aMoveHead3D = aInverseViewToEye * aMoveHead3D; + aMoveTail3D = aInverseViewToEye * aMoveTail3D; - fZwi = aMoveTail3D.getY(); - aMoveTail3D.setY(aMoveTail3D.getZ()); - aMoveTail3D.setZ(fZwi); - } + // eventually switch movement from XY to XZ plane + if(nModifier & KEY_MOD2) + { + double fZwi = aMoveHead3D.getY(); + aMoveHead3D.setY(aMoveHead3D.getZ()); + aMoveHead3D.setZ(fZwi); - // Motion vector from eye coordinates to parent coordinates - basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); - aInverseOrientation.invert(); - basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation); + fZwi = aMoveTail3D.getY(); + aMoveTail3D.setY(aMoveTail3D.getZ()); + aMoveTail3D.setZ(fZwi); + } - aMoveHead3D = aCompleteTrans * aMoveHead3D; - aMoveTail3D = aCompleteTrans* aMoveTail3D; + // Motion vector from eye coordinates to parent coordinates + basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); + aInverseOrientation.invert(); + basegfx::B3DHomMatrix aCompleteTrans(rCandidate.maInvDisplayTransform * aInverseOrientation); - // build transformation - basegfx::B3DHomMatrix aTransMat; - basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D); - aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ()); + aMoveHead3D = aCompleteTrans * aMoveHead3D; + aMoveTail3D = aCompleteTrans* aMoveTail3D; - // ...and apply - rCandidate.maTransform *= aTransMat; + // build transformation + basegfx::B3DHomMatrix aTransMat; + basegfx::B3DPoint aTranslate(aMoveHead3D - aMoveTail3D); + aTransMat.translate(aTranslate.getX(), aTranslate.getY(), aTranslate.getZ()); - if(mbMoveFull) - { - E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj); - rCandidate.mr3DObj.SetTransform(rCandidate.maTransform); - } - else - { - Hide(); - rCandidate.maWireframePoly.transform(aTransMat); - Show(); + // ...and apply + rCandidate.maTransform *= aTransMat; + + if(mbMoveFull) + { + E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj); + rCandidate.mr3DObj.SetTransform(rCandidate.maTransform); + } + else + { + Hide(); + rCandidate.maWireframePoly.transform(aTransMat); + Show(); + } } } } @@ -577,113 +592,117 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt) { E3dDragMethodUnit& rCandidate = maGrp[nOb]; const basegfx::B3DPoint aObjectCenter(rCandidate.mr3DObj.GetBoundVolume().getCenter()); + const E3dScene* pScene(rCandidate.mr3DObj.getRootE3dSceneFromE3dObject()); - // transform from 2D world view to 3D eye - const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mr3DObj.GetScene()->GetViewContact()); - const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); - - basegfx::B2DPoint aGlobalScaleStart2D(static_cast<double>(aStartPos.X()), static_cast<double>(aStartPos.Y())); - basegfx::B2DPoint aGlobalScaleNext2D(static_cast<double>(rPnt.X()), static_cast<double>(rPnt.Y())); - basegfx::B2DPoint aGlobalScaleFixPos2D(static_cast<double>(maScaleFixPos.X()), static_cast<double>(maScaleFixPos.Y())); - basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); - - aInverseSceneTransform.invert(); - aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D; - aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D; - aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D; - - basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ()); - basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ()); - basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ()); - basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); - - aInverseViewToEye.invert(); - basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D); - basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D); - basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D); - - // constraints? - switch(meWhatDragHdl) + if(nullptr != pScene) { - case SdrHdlKind::Left: - case SdrHdlKind::Right: - // to constrain on X -> Y equal - aScNext.setY(aScFixPos.getY()); - break; - case SdrHdlKind::Upper: - case SdrHdlKind::Lower: - // constrain to Y -> X equal - aScNext.setX(aScFixPos.getX()); - break; - default: - break; - } - - // get scale vector in eye coordinates - basegfx::B3DPoint aScaleVec(aScStart - aScFixPos); - aScaleVec.setZ(1.0); + // transform from 2D world view to 3D eye + const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); + const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); + + basegfx::B2DPoint aGlobalScaleStart2D(static_cast<double>(aStartPos.X()), static_cast<double>(aStartPos.Y())); + basegfx::B2DPoint aGlobalScaleNext2D(static_cast<double>(rPnt.X()), static_cast<double>(rPnt.Y())); + basegfx::B2DPoint aGlobalScaleFixPos2D(static_cast<double>(maScaleFixPos.X()), static_cast<double>(maScaleFixPos.Y())); + basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); + + aInverseSceneTransform.invert(); + aGlobalScaleStart2D = aInverseSceneTransform * aGlobalScaleStart2D; + aGlobalScaleNext2D = aInverseSceneTransform * aGlobalScaleNext2D; + aGlobalScaleFixPos2D = aInverseSceneTransform * aGlobalScaleFixPos2D; + + basegfx::B3DPoint aGlobalScaleStart3D(aGlobalScaleStart2D.getX(), aGlobalScaleStart2D.getY(), aObjectCenter.getZ()); + basegfx::B3DPoint aGlobalScaleNext3D(aGlobalScaleNext2D.getX(), aGlobalScaleNext2D.getY(), aObjectCenter.getZ()); + basegfx::B3DPoint aGlobalScaleFixPos3D(aGlobalScaleFixPos2D.getX(), aGlobalScaleFixPos2D.getY(), aObjectCenter.getZ()); + basegfx::B3DHomMatrix aInverseViewToEye(aViewInfo3D.getDeviceToView() * aViewInfo3D.getProjection()); + + aInverseViewToEye.invert(); + basegfx::B3DPoint aScStart(aInverseViewToEye * aGlobalScaleStart3D); + basegfx::B3DPoint aScNext(aInverseViewToEye * aGlobalScaleNext3D); + basegfx::B3DPoint aScFixPos(aInverseViewToEye * aGlobalScaleFixPos3D); + + // constraints? + switch(meWhatDragHdl) + { + case SdrHdlKind::Left: + case SdrHdlKind::Right: + // to constrain on X -> Y equal + aScNext.setY(aScFixPos.getY()); + break; + case SdrHdlKind::Upper: + case SdrHdlKind::Lower: + // constrain to Y -> X equal + aScNext.setX(aScFixPos.getX()); + break; + default: + break; + } - if(aScaleVec.getX() != 0.0) - { - aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX()); - } - else - { - aScaleVec.setX(1.0); - } + // get scale vector in eye coordinates + basegfx::B3DPoint aScaleVec(aScStart - aScFixPos); + aScaleVec.setZ(1.0); - if(aScaleVec.getY() != 0.0) - { - aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY()); - } - else - { - aScaleVec.setY(1.0); - } + if(aScaleVec.getX() != 0.0) + { + aScaleVec.setX((aScNext.getX() - aScFixPos.getX()) / aScaleVec.getX()); + } + else + { + aScaleVec.setX(1.0); + } - // SHIFT-key used? - if(getSdrDragView().IsOrtho()) - { - if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY())) + if(aScaleVec.getY() != 0.0) { - // X is biggest - aScaleVec.setY(aScaleVec.getX()); + aScaleVec.setY((aScNext.getY() - aScFixPos.getY()) / aScaleVec.getY()); } else { - // Y is biggest - aScaleVec.setX(aScaleVec.getY()); + aScaleVec.setY(1.0); } - } - // build transformation - basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); - aInverseOrientation.invert(); + // SHIFT-key used? + if(getSdrDragView().IsOrtho()) + { + if(fabs(aScaleVec.getX()) > fabs(aScaleVec.getY())) + { + // X is biggest + aScaleVec.setY(aScaleVec.getX()); + } + else + { + // Y is biggest + aScaleVec.setX(aScaleVec.getY()); + } + } - basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform; - aNewTrans *= rCandidate.maDisplayTransform; - aNewTrans *= aViewInfo3D.getOrientation(); - aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ()); - aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ()); - aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ()); - aNewTrans *= aInverseOrientation; - aNewTrans *= rCandidate.maInvDisplayTransform; + // build transformation + basegfx::B3DHomMatrix aInverseOrientation(aViewInfo3D.getOrientation()); + aInverseOrientation.invert(); - // ...and apply - rCandidate.maTransform = aNewTrans; + basegfx::B3DHomMatrix aNewTrans = rCandidate.maInitTransform; + aNewTrans *= rCandidate.maDisplayTransform; + aNewTrans *= aViewInfo3D.getOrientation(); + aNewTrans.translate(-aScFixPos.getX(), -aScFixPos.getY(), -aScFixPos.getZ()); + aNewTrans.scale(aScaleVec.getX(), aScaleVec.getY(), aScaleVec.getZ()); + aNewTrans.translate(aScFixPos.getX(), aScFixPos.getY(), aScFixPos.getZ()); + aNewTrans *= aInverseOrientation; + aNewTrans *= rCandidate.maInvDisplayTransform; - if(mbMoveFull) - { - E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj); - rCandidate.mr3DObj.SetTransform(rCandidate.maTransform); - } - else - { - Hide(); - rCandidate.maWireframePoly.clear(); - rCandidate.maWireframePoly = rCandidate.mr3DObj.CreateWireframe(); - rCandidate.maWireframePoly.transform(rCandidate.maTransform); - Show(); + // ...and apply + rCandidate.maTransform = aNewTrans; + + if(mbMoveFull) + { + E3DModifySceneSnapRectUpdater aUpdater(&rCandidate.mr3DObj); + rCandidate.mr3DObj.SetTransform(rCandidate.maTransform); + } + else + { + Hide(); + rCandidate.maWireframePoly.clear(); + rCandidate.maWireframePoly = rCandidate.mr3DObj.CreateWireframe(); + rCandidate.maWireframePoly.transform(rCandidate.maTransform); + Show(); + } } } } diff --git a/svx/source/engine3d/e3dsceneupdater.cxx b/svx/source/engine3d/e3dsceneupdater.cxx index 28c472727e17..189889b2af79 100644 --- a/svx/source/engine3d/e3dsceneupdater.cxx +++ b/svx/source/engine3d/e3dsceneupdater.cxx @@ -31,9 +31,9 @@ E3DModifySceneSnapRectUpdater::E3DModifySceneSnapRectUpdater(const SdrObject* pO // Secure old 3D transformation stack before modification if(const E3dObject* pE3dObject = dynamic_cast< const E3dObject* >(pObject)) { - mpScene = pE3dObject->GetScene(); + mpScene = pE3dObject->getRootE3dSceneFromE3dObject(); - if(mpScene && mpScene->GetScene() == mpScene) + if(nullptr != mpScene && mpScene->getRootE3dSceneFromE3dObject() == mpScene) { // if there is a scene and it's the outmost scene, get current 3D range const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(mpScene->GetViewContact()); diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index db71e75da574..329d327b97de 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -100,13 +100,13 @@ E3dScene* fillViewInformation3DForCompoundObject(drawinglayer::geometry::ViewInf // transformation for the correct complete ObjectTransformation. For historical reasons, the // root scene's own object transformation is part of the scene's ViewTransformation, o do not // add it. For more details, see ViewContactOfE3dScene::createViewInformation3D. - E3dScene* pParentScene = dynamic_cast< E3dScene* >(rCandidate.GetParentObj()); - E3dScene* pRootScene = nullptr; + E3dScene* pParentScene(rCandidate.getParentE3dSceneFromE3dObject()); + E3dScene* pRootScene(nullptr); basegfx::B3DHomMatrix aInBetweenSceneMatrix; while(pParentScene) { - E3dScene* pParentParentScene = dynamic_cast< E3dScene* >(pParentScene->GetParentObj()); + E3dScene* pParentParentScene(pParentScene->getParentE3dSceneFromE3dObject()); if(pParentParentScene) { diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx index c32f6f74b703..228fc5876d20 100644 --- a/svx/source/engine3d/helperminimaldepth3d.cxx +++ b/svx/source/engine3d/helperminimaldepth3d.cxx @@ -155,7 +155,7 @@ double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject) if(!aPrimitives.empty()) { - const E3dScene* pScene = rObject.GetScene(); + const E3dScene* pScene(rObject.getRootE3dSceneFromE3dObject()); if(pScene) { @@ -170,12 +170,12 @@ double getMinimalDepthInViewCoordinates(const E3dCompoundObject& rObject) // some Scene SdrObjects lying in-between which may need to be added. This is e.g. used in chart, // and generally allowed in 3d scenes an their 3d object hierarchy basegfx::B3DHomMatrix aInBetweenSceneMatrix; - E3dScene* pParentScene = dynamic_cast< E3dScene* >(rObject.GetParentObj()); + E3dScene* pParentScene(rObject.getParentE3dSceneFromE3dObject()); while(pParentScene && pParentScene != pScene) { aInBetweenSceneMatrix = pParentScene->GetTransform() * aInBetweenSceneMatrix; - pParentScene = dynamic_cast< E3dScene* >(pParentScene->GetParentObj()); + pParentScene = pParentScene->getParentE3dSceneFromE3dObject(); } // build new ViewInformation containing all transforms diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index b4b8b876cd7d..01d57b94d3d6 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -160,10 +160,12 @@ void E3dObject::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { // Movement in X, Y in the eye coordinate system - E3dScene* pScene = GetScene(); + E3dScene* pScene(getRootE3dSceneFromE3dObject()); - if(!pScene) + if(nullptr == pScene) + { return; + } // transform pos from 2D world to 3D eye const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); @@ -210,18 +212,21 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti void E3dObject::NbcMove(const Size& rSize) { // Movement in X, Y in the eye coordinate system - E3dScene* pScene = GetScene(); + E3dScene* pScene(getRootE3dSceneFromE3dObject()); - if(!pScene) + if(nullptr == pScene) + { return; + } //Dimensions of the scene in 3D and 2D for comparison tools::Rectangle aRect = pScene->GetSnapRect(); - basegfx::B3DHomMatrix aInvDispTransform; - if(GetParentObj()) + E3dScene* pParent(getParentE3dSceneFromE3dObject()); + + if(nullptr != pParent) { - aInvDispTransform = GetParentObj()->GetFullTransform(); + aInvDispTransform = pParent->GetFullTransform(); aInvDispTransform.invert(); } @@ -266,31 +271,28 @@ void E3dObject::RecalcSnapRect() // process the object in which the change has occurred is returned. void E3dObject::StructureChanged() { - if ( GetParentObj() ) + E3dScene* pParent(getParentE3dSceneFromE3dObject()); + + if(nullptr != pParent) { - GetParentObj()->InvalidateBoundVolume(); - GetParentObj()->StructureChanged(); + pParent->InvalidateBoundVolume(); + pParent->StructureChanged(); } } -E3dObject* E3dObject::GetParentObj() const +E3dScene* E3dObject::getParentE3dSceneFromE3dObject() const { - E3dObject* pRetval = nullptr; - - if(getParentOfSdrObject()) - { - pRetval = dynamic_cast< E3dObject* >(getParentOfSdrObject()->getSdrObjectFromSdrObjList()); - } - - return pRetval; + return dynamic_cast< E3dScene* >(getParentSdrObjectFromSdrObject()); } // Determine the top-level scene object -E3dScene* E3dObject::GetScene() const +E3dScene* E3dObject::getRootE3dSceneFromE3dObject() const { - if(GetParentObj()) + E3dScene* pParent(getParentE3dSceneFromE3dObject()); + + if(nullptr != pParent) { - return GetParentObj()->GetScene(); + return pParent->getRootE3dSceneFromE3dObject(); } return nullptr; @@ -349,10 +351,11 @@ const basegfx::B3DHomMatrix& E3dObject::GetFullTransform() const if(mbTfHasChanged) { basegfx::B3DHomMatrix aNewFullTransformation(maTransformation); + E3dScene* pParent(getParentE3dSceneFromE3dObject()); - if ( GetParentObj() ) + if(nullptr != pParent) { - aNewFullTransformation = GetParentObj()->GetFullTransform() * aNewFullTransformation; + aNewFullTransformation = pParent->GetFullTransform() * aNewFullTransformation; } const_cast< E3dObject* >(this)->maFullTransform = aNewFullTransformation; @@ -667,15 +670,4 @@ basegfx::B2DPolyPolygon E3dCompoundObject::TransformToScreenCoor(const basegfx:: return aRetval; } -bool E3dCompoundObject::IsAOrdNumRemapCandidate(E3dScene*& prScene) const -{ - if(getParentOfSdrObject() && getParentOfSdrObject()->getSdrObjectFromSdrObjList()) - { - prScene = static_cast< E3dScene* >(getParentOfSdrObject()->getSdrObjectFromSdrObjList()); - return true; - } - - return false; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index cd9ac07e5219..c98ea6d97dca 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -280,7 +280,7 @@ sal_uInt16 E3dScene::GetObjIdentifier() const void E3dScene::SetBoundRectDirty() { - E3dScene* pScene = GetScene(); + E3dScene* pScene(getRootE3dSceneFromE3dObject()); if(pScene == this) { @@ -354,20 +354,28 @@ void E3dScene::StructureChanged() { E3dObject::StructureChanged(); - if (!GetScene()->mbSkipSettingDirty) + E3dScene* pScene(getRootE3dSceneFromE3dObject()); + + if(nullptr != pScene && !pScene->mbSkipSettingDirty) + { SetRectsDirty(); + } ImpCleanup3DDepthMapper(); } // Determine the overall scene object -E3dScene* E3dScene::GetScene() const +E3dScene* E3dScene::getRootE3dSceneFromE3dObject() const { - if(GetParentObj()) - return GetParentObj()->GetScene(); - else - return const_cast<E3dScene*>(this); + E3dScene* pParent(getParentE3dSceneFromE3dObject()); + + if(nullptr != pParent) + { + return pParent->getRootE3dSceneFromE3dObject(); + } + + return const_cast< E3dScene* >(this); } void E3dScene::removeAllNonSelectedObjects() @@ -456,17 +464,32 @@ E3dScene& E3dScene::operator=(const E3dScene& rSource) void E3dScene::SuspendReportingDirtyRects() { - GetScene()->mbSkipSettingDirty = true; + E3dScene* pScene(getRootE3dSceneFromE3dObject()); + + if(nullptr != pScene) + { + pScene->mbSkipSettingDirty = true; + } } void E3dScene::ResumeReportingDirtyRects() { - GetScene()->mbSkipSettingDirty = false; + E3dScene* pScene(getRootE3dSceneFromE3dObject()); + + if(nullptr != pScene) + { + pScene->mbSkipSettingDirty = false; + } } void E3dScene::SetAllSceneRectsDirty() { - GetScene()->SetRectsDirty(); + E3dScene* pScene(getRootE3dSceneFromE3dObject()); + + if(nullptr != pScene) + { + pScene->SetRectsDirty(); + } } // Rebuild Light- and label- object lists rebuild (after loading, allocation) @@ -634,7 +657,7 @@ void E3dScene::NbcRotate(const Point& rRef, long nAngle, double sn, double cs) void E3dScene::RecalcSnapRect() { - E3dScene* pScene = GetScene(); + E3dScene* pScene(getRootE3dSceneFromE3dObject()); if(pScene == this) { diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index f663874efaf8..2e5849b710bb 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -248,16 +248,22 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const if(pObj && dynamic_cast< const E3dCompoundObject*>(pObj) != nullptr) { // related scene - pScene = static_cast<E3dCompoundObject*>(pObj)->GetScene(); - if(pScene && !IsObjMarked(pScene)) + pScene = static_cast<E3dCompoundObject*>(pObj)->getRootE3dSceneFromE3dObject(); + + if(nullptr != pScene && !IsObjMarked(pScene)) + { bSpecialHandling = true; + } } // Reset all selection flags if(pObj && dynamic_cast< const E3dObject*>(pObj) != nullptr) { - pScene = static_cast<E3dObject*>(pObj)->GetScene(); - if(pScene) + pScene = static_cast<E3dObject*>(pObj)->getRootE3dSceneFromE3dObject(); + + if(nullptr != pScene) + { pScene->SetSelected(false); + } } } @@ -271,9 +277,12 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const if(pObj && dynamic_cast< const E3dCompoundObject*>(pObj) != nullptr) { // related scene - pScene = static_cast<E3dCompoundObject*>(pObj)->GetScene(); - if(pScene) + pScene = static_cast<E3dCompoundObject*>(pObj)->getRootE3dSceneFromE3dObject(); + + if(nullptr != pScene) + { pScene->SetSelected(false); + } } } @@ -285,11 +294,11 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const // Select object E3dObject* p3DObj = static_cast<E3dObject*>(pObj); p3DObj->SetSelected(true); - pScene = p3DObj->GetScene(); + pScene = p3DObj->getRootE3dSceneFromE3dObject(); } } - if(pScene) + if(nullptr != pScene) { // code from parent SortMarkedObjects(); @@ -306,9 +315,12 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const if(pObj && dynamic_cast< const E3dCompoundObject*>(pObj) != nullptr) { // related scene - pScene = static_cast<E3dCompoundObject*>(pObj)->GetScene(); - if(pScene) + pScene = static_cast<E3dCompoundObject*>(pObj)->getRootE3dSceneFromE3dObject(); + + if(nullptr != pScene) + { pScene->SetSelected(false); + } } } } @@ -337,9 +349,9 @@ SdrModel* E3dView::GetMarkedObjModel() const { // if the object is selected, but it's scene not, // we need special handling - pScene = static_cast<const E3dCompoundObject*>(pObj)->GetScene(); + pScene = static_cast<const E3dCompoundObject*>(pObj)->getRootE3dSceneFromE3dObject(); - if(pScene && !IsObjMarked(pScene)) + if(nullptr != pScene && !IsObjMarked(pScene)) { bSpecialHandling = true; } @@ -348,9 +360,9 @@ SdrModel* E3dView::GetMarkedObjModel() const if(pObj && dynamic_cast< const E3dObject*>(pObj) != nullptr) { // reset all selection flags at 3D objects - pScene = static_cast<const E3dObject*>(pObj)->GetScene(); + pScene = static_cast<const E3dObject*>(pObj)->getRootE3dSceneFromE3dObject(); - if(pScene) + if(nullptr != pScene) { pScene->SetSelected(false); } @@ -394,9 +406,9 @@ SdrModel* E3dView::GetMarkedObjModel() const if(pObj && dynamic_cast< const E3dObject* >(pObj) != nullptr) { - pScene = static_cast<E3dObject*>(pObj)->GetScene(); + pScene = static_cast<E3dObject*>(pObj)->getRootE3dSceneFromE3dObject(); - if(pScene && !IsObjMarked(pScene) && GetSdrPageView()) + if(nullptr != pScene && !IsObjMarked(pScene) && GetSdrPageView()) { const_cast<E3dView*>(this)->MarkObj(pScene, GetSdrPageView(), false, true); } @@ -1201,10 +1213,15 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrObject *pObj = GetMarkedObjectByIndex(nObjs); if(pObj) { - if(dynamic_cast< const E3dScene*>(pObj) != nullptr && static_cast<E3dScene*>(pObj)->GetScene() == pObj) + if(nullptr != dynamic_cast< const E3dScene* >(pObj) && static_cast< E3dScene* >(pObj)->getRootE3dSceneFromE3dObject() == pObj) + { bThereAreRootScenes = true; + } + if(dynamic_cast< const E3dObject* >(pObj) != nullptr) + { bThereAre3DObjects = true; + } } } if( bThereAre3DObjects ) diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx index 353e18794886..d042186c4d73 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx @@ -86,7 +86,7 @@ ViewContact& ViewContactOfSdrObj::GetViewContact(sal_uInt32 nIndex) const ViewContact* ViewContactOfSdrObj::GetParentContact() const { ViewContact* pRetval = nullptr; - SdrObjList* pObjList = GetSdrObject().getParentOfSdrObject(); + SdrObjList* pObjList = GetSdrObject().getParentSdrObjListFromSdrObject(); if(pObjList) { diff --git a/svx/source/sdr/properties/e3dcompoundproperties.cxx b/svx/source/sdr/properties/e3dcompoundproperties.cxx index c19377f8e2d4..a7e4395665b7 100644 --- a/svx/source/sdr/properties/e3dcompoundproperties.cxx +++ b/svx/source/sdr/properties/e3dcompoundproperties.cxx @@ -50,9 +50,9 @@ namespace sdr { // include Items of scene this object belongs to const E3dCompoundObject& rObj = static_cast<const E3dCompoundObject&>(GetSdrObject()); - E3dScene* pScene = rObj.GetScene(); + E3dScene* pScene(rObj.getRootE3dSceneFromE3dObject()); - if(pScene) + if(nullptr != pScene) { // force ItemSet GetObjectItemSet(); @@ -71,9 +71,9 @@ namespace sdr { // Set scene specific items at scene E3dCompoundObject& rObj = static_cast<E3dCompoundObject&>(GetSdrObject()); - E3dScene* pScene = rObj.GetScene(); + E3dScene* pScene(rObj.getRootE3dSceneFromE3dObject()); - if(pScene) + if(nullptr != pScene) { // force ItemSet GetObjectItemSet(); diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index a5dc2ec795b9..788f4a0eb660 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -727,7 +727,7 @@ std::vector<SdrObject*> SdrEditView::DeleteMarkedList(SdrMarkList const& rMark) --nm; SdrMark* pM = rMark.GetMark(nm); SdrObject* pObj = pM->GetMarkedSdrObj(); - SdrObjList* pOL = pObj->getParentOfSdrObject(); + SdrObjList* pOL = pObj->getParentSdrObjListFromSdrObject(); const size_t nOrdNum(pObj->GetOrdNumDirect()); bool bIs3D = dynamic_cast< E3dObject* >(pObj); @@ -799,7 +799,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->getParentOfSdrObject()->getSdrObjectFromSdrObjList()); + SdrObject* pParent(pObject->getParentSdrObjectFromSdrObject()); if(pParent) { @@ -1012,7 +1012,7 @@ void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrO pSdrView->SdrEndTextEdit(); } - SdrObjList* pOL=pOldObj->getParentOfSdrObject(); + SdrObjList* pOL=pOldObj->getParentSdrObjListFromSdrObject(); 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 de3ebe183928..18c4ebf0ca03 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -83,7 +83,7 @@ void SdrEditView::MovMarkedToTop() --nm; SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { nNewPos = pOL->GetObjCount()-1; @@ -170,7 +170,7 @@ void SdrEditView::MovMarkedToBtm() { SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { nNewPos=0; @@ -286,7 +286,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) SdrObject* pObj=pM->GetMarkedSdrObj(); if (pObj!=pRefObj) { - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { nNewPos=pOL->GetObjCount()-1; @@ -306,7 +306,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) } if (pRefObj!=nullptr) { - if (pRefObj->getParentOfSdrObject()==pObj->getParentOfSdrObject()) + if (pRefObj->getParentSdrObjListFromSdrObject()==pObj->getParentSdrObjListFromSdrObject()) { const size_t nMaxOrd=pRefObj->GetOrdNum(); // sadly doesn't work any other way if (nNewPos>nMaxOrd) @@ -383,7 +383,7 @@ void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj) SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); if (pObj!=pRefObj) { - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { nNewPos=0; pOL0=pOL; @@ -396,7 +396,7 @@ void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj) if (nNewPos>nNowPos) nNewPos=nNowPos; // nor go into the other direction } if (pRefObj!=nullptr) { - if (pRefObj->getParentOfSdrObject()==pObj->getParentOfSdrObject()) { + if (pRefObj->getParentSdrObjListFromSdrObject()==pObj->getParentSdrObjListFromSdrObject()) { 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 @@ -483,7 +483,7 @@ void SdrEditView::ImpCheckToTopBtmPossible() if (nCount==1) { // special-casing for single selection SdrObject* pObj=GetMarkedObjectByIndex(0); - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); SAL_WARN_IF(!pOL, "svx", "Object somehow has no ObjList"); size_t nMax = pOL ? pOL->GetObjCount() : 0; size_t nMin = 0; @@ -505,7 +505,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->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { nPos0 = 0; pOL0=pOL; @@ -520,7 +520,7 @@ void SdrEditView::ImpCheckToTopBtmPossible() for (size_t nm=nCount; !bToTopPossible && nm>0; ) { // check 'bring to front' --nm; SdrObject* pObj=GetMarkedObjectByIndex(nm); - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { nPos0=pOL->GetObjCount(); pOL0=pOL; @@ -1026,7 +1026,7 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) nInsPos = pObj->GetOrdNum() + 1; pInsPV = pM->GetPageView(); - pInsOL = pObj->getParentOfSdrObject(); + pInsOL = pObj->getParentSdrObjListFromSdrObject(); // #i76891# use single iteration from SJ here which works on SdrObjects and takes // groups into account by itself @@ -1275,7 +1275,7 @@ void SdrEditView::CombineMarkedObjects(bool bNoPolyPoly) --a; SdrMark* pM = GetSdrMarkByIndex(a); SdrObject* pObj = pM->GetMarkedSdrObj(); - SdrObjList* pThisOL = pObj->getParentOfSdrObject(); + SdrObjList* pThisOL = pObj->getParentSdrObjListFromSdrObject(); if(pCurrentOL != pThisOL) { @@ -1297,7 +1297,7 @@ void SdrEditView::CombineMarkedObjects(bool bNoPolyPoly) { nInsPos = pObj->GetOrdNum() + 1; pInsPV = pM->GetPageView(); - pInsOL = pObj->getParentOfSdrObject(); + pInsOL = pObj->getParentSdrObjListFromSdrObject(); } aRemoveMerker.InsertEntry(SdrMark(pObj, pM->GetPageView())); @@ -1674,7 +1674,7 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines) SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { pOL0=pOL; pObj->GetOrdNum(); } // make sure OrdNums are correct! if (ImpCanDismantle(pObj,bMakeLines)) { aRemoveMerker.InsertEntry(SdrMark(pObj,pM->GetPageView())); @@ -1765,7 +1765,7 @@ void SdrEditView::GroupMarked() pDstLst=pGrp->GetSubList(); DBG_ASSERT(pDstLst!=nullptr,"Alleged group object doesn't return object list."); } - pSrcLst=pObj->getParentOfSdrObject(); + pSrcLst=pObj->getParentSdrObjListFromSdrObject(); if (pSrcLst!=pSrcLst0) { if (pSrcLst->IsObjOrdNumsDirty()) @@ -1916,7 +1916,7 @@ SdrObject* SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bPath, bool bLine SdrObject* pNewObj = pObj->ConvertToPolyObj(bPath, bLineToArea); if (pNewObj!=nullptr) { - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); DBG_ASSERT(pOL!=nullptr,"ConvertTo: Object doesn't return object list"); if (pOL!=nullptr) { @@ -2033,7 +2033,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); const size_t nInsPos=pObj->GetOrdNum()+1; sal_uIntPtr nInsAnz=0; tools::Rectangle aLogicRect; diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index fc0de4bdcf29..ff40fc85c5a9 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1513,10 +1513,10 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) delete pDelUndo; } eRet=SdrEndTextEditKind::Deleted; - DBG_ASSERT(pTEObj->getParentOfSdrObject()!=nullptr,"SdrObjEditView::SdrEndTextEdit(): Fatal: Object edited doesn't have an ObjList!"); - if (pTEObj->getParentOfSdrObject()!=nullptr) + DBG_ASSERT(pTEObj->getParentSdrObjListFromSdrObject()!=nullptr,"SdrObjEditView::SdrEndTextEdit(): Fatal: Object edited doesn't have an ObjList!"); + if (pTEObj->getParentSdrObjListFromSdrObject()!=nullptr) { - pTEObj->getParentOfSdrObject()->RemoveObject(pTEObj->GetOrdNum()); + pTEObj->getParentSdrObjListFromSdrObject()->RemoveObject(pTEObj->GetOrdNum()); CheckMarked(); // remove selection immediately... } } diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx index 562b14ff1b78..08277af19f76 100644 --- a/svx/source/svdraw/svdmark.cxx +++ b/svx/source/svdraw/svdmark.cxx @@ -123,8 +123,8 @@ static bool ImpSdrMarkListSorter(std::unique_ptr<SdrMark> const& lhs, std::uniqu { SdrObject* pObj1 = lhs->GetMarkedSdrObj(); SdrObject* pObj2 = rhs->GetMarkedSdrObj(); - SdrObjList* pOL1 = pObj1 ? pObj1->getParentOfSdrObject() : nullptr; - SdrObjList* pOL2 = pObj2 ? pObj2->getParentOfSdrObject() : nullptr; + SdrObjList* pOL1 = pObj1 ? pObj1->getParentSdrObjListFromSdrObject() : nullptr; + SdrObjList* pOL2 = pObj2 ? pObj2->getParentSdrObjListFromSdrObject() : nullptr; if (pOL1 == pOL2) { @@ -297,8 +297,8 @@ void SdrMarkList::InsertEntry(const SdrMark& rMark, bool bChkSort) maList.emplace_back(new SdrMark(rMark)); // now check if the sort is ok - const SdrObjList* pLastOL = pLastObj!=nullptr ? pLastObj->getParentOfSdrObject() : nullptr; - const SdrObjList* pNewOL = pNewObj !=nullptr ? pNewObj->getParentOfSdrObject() : nullptr; + const SdrObjList* pLastOL = pLastObj!=nullptr ? pLastObj->getParentSdrObjListFromSdrObject() : nullptr; + const SdrObjList* pNewOL = pNewObj !=nullptr ? pNewObj->getParentSdrObjListFromSdrObject() : nullptr; if(pLastOL == pNewOL) { diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index ea0255ba2865..56d415047b54 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1511,7 +1511,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->getParentOfSdrObject(); + SdrObjList* pObjList=pTopObjHit->getParentSdrObjListFromSdrObject(); SdrPageView* pPV=pTopMarkHit->GetPageView(); // find lowermost of the selected objects that is hit by rPnt // and is placed on the same PageView as pTopMarkHit @@ -1528,11 +1528,12 @@ bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev) SdrObject* pBtmObjHit=pBtmMarkHit->GetMarkedSdrObj(); const size_t nObjCount = pObjList->GetObjCount(); - size_t nSearchBeg = 0; - E3dScene* pScene = nullptr; - SdrObject* pObjHit = bPrev ? pBtmObjHit : pTopObjHit; - bool bRemap = dynamic_cast< const E3dCompoundObject* >(pObjHit) != nullptr - && static_cast<E3dCompoundObject*>(pObjHit)->IsAOrdNumRemapCandidate(pScene); + size_t nSearchBeg(0); + E3dScene* pScene(nullptr); + SdrObject* pObjHit(bPrev ? pBtmObjHit : pTopObjHit); + const bool bRemap( + nullptr != dynamic_cast< const E3dCompoundObject* >(pObjHit) + && nullptr != (pScene = dynamic_cast< E3dScene* >(pObjHit->getParentSdrObjectFromSdrObject()))); if(bPrev) { @@ -1752,13 +1753,16 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT rpRootObj=nullptr; if (pOL!=nullptr) { - bool bBack(nOptions & SdrSearchOptions::BACKWARD); - bool bRemap(pOL->getSdrObjectFromSdrObjList() && dynamic_cast< const E3dScene* >(pOL->getSdrObjectFromSdrObjList()) != nullptr); - E3dScene* pRemapScene = (bRemap ? static_cast< E3dScene* >(pOL->getSdrObjectFromSdrObjList()) : nullptr); + const bool bBack(nOptions & SdrSearchOptions::BACKWARD); + const bool bRemap( + nullptr != pOL->getSdrObjectFromSdrObjList() + && nullptr != dynamic_cast< const E3dScene* >(pOL->getSdrObjectFromSdrObjList())); + const E3dScene* pRemapScene(bRemap ? static_cast< E3dScene* >(pOL->getSdrObjectFromSdrObjList()) : nullptr); + const size_t nObjCount(pOL->GetObjCount()); + size_t nObjNum(bBack ? 0 : nObjCount); - const size_t nObjCount=pOL->GetObjCount(); - size_t nObjNum=bBack ? 0 : nObjCount; - while (pRet==nullptr && (bBack ? nObjNum<nObjCount : nObjNum>0)) { + while (pRet==nullptr && (bBack ? nObjNum<nObjCount : nObjNum>0)) + { if (!bBack) nObjNum--; SdrObject* pObj; diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 91e405dc497f..f936e8c4bf3b 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -281,9 +281,9 @@ void SdrObject::ActionChanged() const SdrPage* SdrObject::getSdrPageFromSdrObject() const { - if(getParentOfSdrObject()) + if(getParentSdrObjListFromSdrObject()) { - return getParentOfSdrObject()->getSdrPageFromSdrObjList(); + return getParentSdrObjListFromSdrObject()->getSdrPageFromSdrObjList(); } return nullptr; @@ -296,7 +296,7 @@ SdrModel& SdrObject::getSdrModelFromSdrObject() const void SdrObject::setParentOfSdrObject(SdrObjList* pNewObjList) { - if(getParentOfSdrObject() != pNewObjList) + if(getParentSdrObjListFromSdrObject() != pNewObjList) { // remember current page SdrPage* pOldPage(getSdrPageFromSdrObject()); @@ -315,7 +315,7 @@ void SdrObject::setParentOfSdrObject(SdrObjList* pNewObjList) } } -SdrObjList* SdrObject::getParentOfSdrObject() const +SdrObjList* SdrObject::getParentSdrObjListFromSdrObject() const { return mpParentOfSdrObject; } @@ -446,9 +446,9 @@ void SdrObject::SetRectsDirty(bool bNotMyself, bool bRecursive) bSnapRectDirty=true; } - if (bRecursive && nullptr != getParentOfSdrObject()) + if (bRecursive && nullptr != getParentSdrObjListFromSdrObject()) { - getParentOfSdrObject()->SetSdrObjListRectsDirty(); + getParentSdrObjListFromSdrObject()->SetSdrObjListRectsDirty(); } } @@ -645,9 +645,16 @@ SdrObjList* SdrObject::GetSubList() const return nullptr; } -SdrObject* SdrObject::GetUpGroup() const +SdrObject* SdrObject::getParentSdrObjectFromSdrObject() const { - return nullptr != getParentOfSdrObject() ? getParentOfSdrObject()->getSdrObjectFromSdrObjList() : nullptr; + SdrObjList* pParent(getParentSdrObjListFromSdrObject()); + + if(nullptr == pParent) + { + return nullptr; + } + + return pParent->getSdrObjectFromSdrObjList(); } void SdrObject::SetName(const OUString& rStr) @@ -784,11 +791,11 @@ OUString SdrObject::GetDescription() const sal_uInt32 SdrObject::GetOrdNum() const { - if (nullptr != getParentOfSdrObject()) + if (nullptr != getParentSdrObjListFromSdrObject()) { - if (getParentOfSdrObject()->IsObjOrdNumsDirty()) + if (getParentSdrObjListFromSdrObject()->IsObjOrdNumsDirty()) { - getParentOfSdrObject()->RecalcObjOrdNums(); + getParentSdrObjListFromSdrObject()->RecalcObjOrdNums(); } } else const_cast<SdrObject*>(this)->nOrdNum=0; return nOrdNum; @@ -821,7 +828,7 @@ void SdrObject::SetGrabBagItem(const css::uno::Any& rVal) sal_uInt32 SdrObject::GetNavigationPosition() { - if (nullptr != getParentOfSdrObject() && getParentOfSdrObject()->RecalcNavigationPositions()) + if (nullptr != getParentSdrObjListFromSdrObject() && getParentSdrObjListFromSdrObject()->RecalcNavigationPositions()) { return mnNavigationPosition; } @@ -2675,66 +2682,48 @@ void SdrObject::SetUserCall(SdrObjUserCall* pUser) void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& rBoundRect) const { - SdrObject* pGroup = nullptr; - - if(nullptr != getParentOfSdrObject()) // && SdrObjListKind::GroupObj == getParentOfSdrObject()->GetListKind()) - { - pGroup = getParentOfSdrObject()->getSdrObjectFromSdrObjList(); - } + SdrObject* pGroup(getParentSdrObjectFromSdrObject()); if ( pUserCall ) { pUserCall->Changed( *this, eUserCall, rBoundRect ); } - while( pGroup ) + if(nullptr != pGroup && pGroup->GetUserCall()) { // broadcast to group - if( pGroup->GetUserCall() ) - { - SdrUserCallType eChildUserType = SdrUserCallType::ChildChangeAttr; + SdrUserCallType eChildUserType = SdrUserCallType::ChildChangeAttr; - switch( eUserCall ) - { - case SdrUserCallType::MoveOnly: - eChildUserType = SdrUserCallType::ChildMoveOnly; - break; - - case SdrUserCallType::Resize: - eChildUserType = SdrUserCallType::ChildResize; - break; + switch( eUserCall ) + { + case SdrUserCallType::MoveOnly: + eChildUserType = SdrUserCallType::ChildMoveOnly; + break; - case SdrUserCallType::ChangeAttr: - eChildUserType = SdrUserCallType::ChildChangeAttr; - break; + case SdrUserCallType::Resize: + eChildUserType = SdrUserCallType::ChildResize; + break; - case SdrUserCallType::Delete: - eChildUserType = SdrUserCallType::ChildDelete; - break; + case SdrUserCallType::ChangeAttr: + eChildUserType = SdrUserCallType::ChildChangeAttr; + break; - case SdrUserCallType::Inserted: - eChildUserType = SdrUserCallType::ChildInserted; - break; + case SdrUserCallType::Delete: + eChildUserType = SdrUserCallType::ChildDelete; + break; - case SdrUserCallType::Removed: - eChildUserType = SdrUserCallType::ChildRemoved; - break; + case SdrUserCallType::Inserted: + eChildUserType = SdrUserCallType::ChildInserted; + break; - default: break; - } + case SdrUserCallType::Removed: + eChildUserType = SdrUserCallType::ChildRemoved; + break; - pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect ); + default: break; } - if( pGroup->getParentOfSdrObject() && - pGroup != getParentOfSdrObject()->getSdrObjectFromSdrObjList() ) - { - pGroup = getParentOfSdrObject()->getSdrObjectFromSdrObjList(); - } - else - { - pGroup = nullptr; - } + pGroup->GetUserCall()->Changed( *this, eChildUserType, rBoundRect ); } // notify our UNO shape listeners diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 6c6bd36eda83..2573b58f0505 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -201,8 +201,8 @@ void SdrObjList::CopyObjects(const SdrObjList& rSrcList) if (pSrcEdge!=nullptr) { SdrObject* pSrcNode1=pSrcEdge->GetConnectedNode(true); SdrObject* pSrcNode2=pSrcEdge->GetConnectedNode(false); - 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 && pSrcNode1->getParentSdrObjListFromSdrObject()!=pSrcEdge->getParentSdrObjListFromSdrObject()) pSrcNode1=nullptr; // can't do this + if (pSrcNode2!=nullptr && pSrcNode2->getParentSdrObjListFromSdrObject()!=pSrcEdge->getParentSdrObjListFromSdrObject()) pSrcNode2=nullptr; // across all lists (yet) if (pSrcNode1!=nullptr || pSrcNode2!=nullptr) { SdrObject* pEdgeObjTmp=GetObj(no); SdrEdgeObj* pDstEdge=dynamic_cast<SdrEdgeObj*>( pEdgeObjTmp ); diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx index b5052c422502..1f9a53a8d323 100644 --- a/svx/source/svdraw/svdpagv.cxx +++ b/svx/source/svdraw/svdpagv.cxx @@ -826,7 +826,7 @@ void SdrPageView::LeaveOneGroup() GetView().GlueInvalidate(); SdrObject* pLastGroup = GetCurrentGroup(); - SdrObject* pParentGroup = GetCurrentGroup()->GetUpGroup(); + SdrObject* pParentGroup = GetCurrentGroup()->getParentSdrObjectFromSdrObject(); SdrObjList* pParentList = GetPage(); if(pParentGroup) @@ -872,8 +872,8 @@ void SdrPageView::LeaveAllGroup() // find and select uppermost group if(pLastGroup) { - while(pLastGroup->GetUpGroup()) - pLastGroup = pLastGroup->GetUpGroup(); + while(pLastGroup->getParentSdrObjectFromSdrObject()) + pLastGroup = pLastGroup->getParentSdrObjectFromSdrObject(); if(GetView().GetSdrPageView()) GetView().MarkObj(pLastGroup, GetView().GetSdrPageView()); @@ -895,7 +895,7 @@ sal_uInt16 SdrPageView::GetEnteredLevel() const SdrObject* pGrp=GetCurrentGroup(); while (pGrp!=nullptr) { nCount++; - pGrp=pGrp->GetUpGroup(); + pGrp=pGrp->getParentSdrObjectFromSdrObject(); } return nCount; } @@ -905,10 +905,10 @@ void SdrPageView::CheckCurrentGroup() SdrObject* pGrp(GetCurrentGroup()); while(nullptr != pGrp && - (!pGrp->IsInserted() || nullptr == pGrp->getParentOfSdrObject() || nullptr == pGrp->getSdrPageFromSdrObject())) + (!pGrp->IsInserted() || nullptr == pGrp->getParentSdrObjListFromSdrObject() || nullptr == pGrp->getSdrPageFromSdrObject())) { // anything outside of the borders? - pGrp = pGrp->GetUpGroup(); + pGrp = pGrp->getParentSdrObjectFromSdrObject(); } if(pGrp != GetCurrentGroup()) diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index b70efa10699c..9741dd1ab5c3 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->getParentOfSdrObject(); + pObjList=pObj->getParentSdrObjListFromSdrObject(); if (bOrdNumDirect) { nOrdNum=pObj->GetOrdNumDirect(); @@ -857,7 +857,7 @@ SdrUndoReplaceObj::SdrUndoReplaceObj(SdrObject& rOldObj1, SdrObject& rNewObj1, b { SetOldOwner(true); - pObjList=pObj->getParentOfSdrObject(); + pObjList=pObj->getParentSdrObjListFromSdrObject(); if (bOrdNumDirect) { nOrdNum=pObj->GetOrdNumDirect(); @@ -984,7 +984,7 @@ void SdrUndoObjOrdNum::Undo() // Trigger PageChangeCall ImpShowPageOfThisObject(); - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL==nullptr) { OSL_FAIL("UndoObjOrdNum: pObj does not have an ObjList."); @@ -995,7 +995,7 @@ void SdrUndoObjOrdNum::Undo() void SdrUndoObjOrdNum::Redo() { - SdrObjList* pOL=pObj->getParentOfSdrObject(); + SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); 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 d41766e62b9c..47e6af06b353 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -405,7 +405,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co if (pObj!=pHitObj) { SdrObject* pObjTmp=nullptr; - pObjTmp=pHitObj->GetUpGroup(); + pObjTmp=pHitObj->getParentSdrObjectFromSdrObject(); if (pObjTmp==pObj) pObjTmp=nullptr; while (pObjTmp!=nullptr) { @@ -414,7 +414,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co bMid=true; pMidObj=pObjTmp; } - pObjTmp=pObjTmp->GetUpGroup(); + pObjTmp=pObjTmp->getParentSdrObjectFromSdrObject(); if (pObjTmp==pObj) pObjTmp=nullptr; } } @@ -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->getParentOfSdrObject()!=rVEvt.pPV->GetObjList()) { - OSL_FAIL("SdrView::PickAnything(): pRootObj->getParentOfSdrObject()!=pPV->GetObjList() !"); + if (rVEvt.pRootObj->getParentSdrObjListFromSdrObject()!=rVEvt.pPV->GetObjList()) { + OSL_FAIL("SdrView::PickAnything(): pRootObj->getParentSdrObjListFromSdrObject()!=pPV->GetObjList() !"); } } #endif diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index 5fa231086cf8..9de0da13904f 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->getParentOfSdrObject()->RemoveObject( pSdrShape->GetOrdNum() ); + pSdrShape->getParentSdrObjListFromSdrObject()->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->getParentOfSdrObject()->getSdrObjectFromSdrObjList() != GetSdrObject() ) + if( !HasSdrObject() || pSdrShape == nullptr || pSdrShape->getParentSdrObjectFromSdrObject() != GetSdrObject() ) throw uno::RuntimeException(); - SdrObjList& rList = *pSdrShape->getParentOfSdrObject(); + SdrObjList& rList = *pSdrShape->getParentSdrObjListFromSdrObject(); 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 331ff5b6888b..40859838ebd7 100644 --- a/svx/source/unodraw/unoshap3.cxx +++ b/svx/source/unodraw/unoshap3.cxx @@ -149,12 +149,12 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha throw uno::RuntimeException(); SdrObject* pSdrShape = pShape->GetSdrObject(); - if(pSdrShape == nullptr || pSdrShape->getParentOfSdrObject()->getSdrObjectFromSdrObjList() != GetSdrObject()) + if(pSdrShape == nullptr || pSdrShape->getParentSdrObjectFromSdrObject() != GetSdrObject()) { throw uno::RuntimeException(); } - SdrObjList& rList = *pSdrShape->getParentOfSdrObject(); + SdrObjList& rList = *pSdrShape->getParentSdrObjListFromSdrObject(); 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 12d8b49765fc..49d40324d252 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -2151,7 +2151,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl sal_Int32 nNewOrdNum = 0; if(rValue >>= nNewOrdNum) { - SdrObjList* pObjList = GetSdrObject()->getParentOfSdrObject(); + SdrObjList* pObjList = GetSdrObject()->getParentSdrObjListFromSdrObject(); if( pObjList ) { SdrObject* pCheck = @@ -3742,7 +3742,7 @@ uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent() if(nullptr != pSdrObject) { - const SdrObjList* pParentSdrObjList(GetSdrObject()->getParentOfSdrObject()); + const SdrObjList* pParentSdrObjList(GetSdrObject()->getParentSdrObjListFromSdrObject()); if(nullptr != pParentSdrObjList) { diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 9ea331e1e2b6..3ab340928a27 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -2610,9 +2610,9 @@ void SwAccessibleMap::InvalidateCursorPosition( const SwFrame *pFrame ) ::rtl::Reference < ::accessibility::AccessibleShape > pAccShapeImpl = GetContextImpl(pObj,nullptr,false); if (!pAccShapeImpl.is()) { - while (pObj && pObj->GetUpGroup()) + while (pObj && pObj->getParentSdrObjectFromSdrObject()) { - pObj = pObj->GetUpGroup(); + pObj = pObj->getParentSdrObjectFromSdrObject(); } if (pObj != nullptr) { diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 5ea865f618d1..a2b251843439 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -202,7 +202,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) const SdrMarkList &rMrkList = rDrawView.GetMarkedObjectList(); SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); - bool bNoGroup = ( nullptr == pObj->GetUpGroup() ); + bool bNoGroup = ( nullptr == pObj->getParentSdrObjectFromSdrObject() ); SwDrawContact* pNewContact = nullptr; if( bNoGroup ) { @@ -317,7 +317,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) { pFormatsAndObjs = new std::vector< std::pair< SwDrawFrameFormat*, SdrObject* > >[nMarkCount]; SdrObject *pMyObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); - if( !pMyObj->GetUpGroup() ) + if( !pMyObj->getParentSdrObjectFromSdrObject() ) { for ( size_t i = 0; i < nMarkCount; ++i ) { @@ -429,7 +429,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) if( rMrkList.GetMarkCount() && bDelMarked ) { SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); - if( !pObj->GetUpGroup() ) + if( !pObj->getParentSdrObjectFromSdrObject() ) { SwUndoDrawDelete *const pUndo = (!GetIDocumentUndoRedo().DoesUndo()) diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 457229b88f66..06eff1e33958 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -726,7 +726,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, OSL_ENSURE( getIDocumentLayoutAccess().GetCurrentLayout(), "No layout!" ); if ( !_rMrkList.GetMarkCount() || - _rMrkList.GetMark( 0 )->GetMarkedSdrObj()->GetUpGroup() ) + _rMrkList.GetMark( 0 )->GetMarkedSdrObj()->getParentSdrObjectFromSdrObject() ) { return false; } diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 41cd1ebef26f..132d8f83662e 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -175,7 +175,7 @@ SwRect GetBoundRectOfAnchoredObj( const SdrObject* pObj ) SwContact* GetUserCall( const SdrObject* pObj ) { SdrObject *pTmp; - while ( !pObj->GetUserCall() && nullptr != (pTmp = pObj->GetUpGroup()) ) + while ( !pObj->GetUserCall() && nullptr != (pTmp = pObj->getParentSdrObjectFromSdrObject()) ) pObj = pTmp; assert((!pObj->GetUserCall() || nullptr != dynamic_cast<const SwContact*>(pObj->GetUserCall())) && "<::GetUserCall(..)> - wrong type of found object user call." ); @@ -1223,12 +1223,12 @@ void SwDrawContact::Changed_( const SdrObject& rObj, // If drawing object is a member of a group, the adjustment // of the positioning and the alignment attributes has to // be done for the top group object. - if ( rObj.GetUpGroup() ) + if ( rObj.getParentSdrObjectFromSdrObject() ) { - const SdrObject* pGroupObj = rObj.GetUpGroup(); - while ( pGroupObj->GetUpGroup() ) + const SdrObject* pGroupObj = rObj.getParentSdrObjectFromSdrObject(); + while ( pGroupObj->getParentSdrObjectFromSdrObject() ) { - pGroupObj = pGroupObj->GetUpGroup(); + pGroupObj = pGroupObj->getParentSdrObjectFromSdrObject(); } // use geometry of drawing object aObjRect = pGroupObj->GetSnapRect(); diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index 60511cda2594..94c384b57486 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -429,7 +429,7 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, size_t nOldPos, size_t nNewPos ) { // nothing to do for group members - if ( pObj->GetUpGroup() ) + if ( pObj->getParentSdrObjectFromSdrObject() ) { return; } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index a834f4b9cdd2..e814863e8279 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -190,7 +190,7 @@ void SwFEShell::Copy( SwDoc* pClpDoc, const OUString* pNewClpText ) SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); if( Imp()->GetDrawView()->IsGroupEntered() || - ( !pObj->GetUserCall() && pObj->GetUpGroup()) ) + ( !pObj->GetUserCall() && pObj->getParentSdrObjectFromSdrObject()) ) { SfxItemSet aSet( pClpDoc->GetAttrPool(), aFrameFormatSetRange ); @@ -377,7 +377,7 @@ bool SwFEShell::CopyDrawSel( SwFEShell* pDestShell, const Point& rSttPt, if( bRet ) { if( pSrcDrwView->IsGroupEntered() || - ( !pObj->GetUserCall() && pObj->GetUpGroup()) ) + ( !pObj->GetUserCall() && pObj->getParentSdrObjectFromSdrObject()) ) { SfxItemSet aSet( pDestDoc->GetAttrPool(),aFrameFormatSetRange); aSet.Put( aAnchor ); @@ -927,7 +927,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc ) Imp()->GetDrawView()->InsertObjectAtView( pNew, *Imp()->GetPageView() ); Point aGrpAnchor( 0, 0 ); - SdrObjList* pList = pNew->getParentOfSdrObject(); + SdrObjList* pList = pNew->getParentSdrObjListFromSdrObject(); if ( pList ) { SdrObjGroup* pOwner(dynamic_cast< SdrObjGroup* >(pList->getSdrObjectFromSdrObjList())); @@ -1275,7 +1275,7 @@ static void lcl_ConvertSdrOle2ObjsToSdrGrafObjs( SdrModel& _rModel ) if( pOle2Obj ) { // found an ole2 shape - SdrObjList* pObjList = pOle2Obj->getParentOfSdrObject(); + SdrObjList* pObjList = pOle2Obj->getParentSdrObjListFromSdrObject(); // get its graphic Graphic aGraphic; diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 4d4f00718cb4..d6c53ed68834 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1202,7 +1202,7 @@ bool SwFEShell::IsObjSameLevelWithMarked(const SdrObject* pObj) const if (pM) { SdrObject* pMarkObj = pM->GetMarkedSdrObj(); - if (pMarkObj && pMarkObj->GetUpGroup() == pObj->GetUpGroup()) + if (pMarkObj && pMarkObj->getParentSdrObjectFromSdrObject() == pObj->getParentSdrObjectFromSdrObject()) return true; } } @@ -1229,7 +1229,7 @@ void SwFEShell::EndTextEdit() pTmp = pObj; pUserCall->Changed( *pTmp, SdrUserCallType::Resize, pTmp->GetLastBoundRect() ); } - if ( !pObj->GetUpGroup() ) + if ( !pObj->getParentSdrObjectFromSdrObject() ) { if ( SdrEndTextEditKind::ShouldBeDeleted == pView->SdrEndTextEdit(true) ) { @@ -1504,7 +1504,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->getParentOfSdrObject(); + pList = pStartObj->getParentSdrObjListFromSdrObject(); } else { @@ -1767,10 +1767,10 @@ bool SwFEShell::ImpEndCreate() return false; } - if( rSdrObj.GetUpGroup() ) + if( rSdrObj.getParentSdrObjectFromSdrObject() ) { Point aTmpPos( rSdrObj.GetSnapRect().TopLeft() ); - Point aNewAnchor( rSdrObj.GetUpGroup()->GetAnchorPos() ); + Point aNewAnchor( rSdrObj.getParentSdrObjectFromSdrObject()->GetAnchorPos() ); // OD 2004-04-05 #i26791# - direct object positioning for group members rSdrObj.NbcSetRelativePos( aTmpPos - aNewAnchor ); rSdrObj.NbcSetAnchorPos( aNewAnchor ); @@ -2255,7 +2255,7 @@ void SwFEShell::ChgAnchor( RndStdIds eAnchorId, bool bSameOnly, bool bPosCorr ) OSL_ENSURE( Imp()->HasDrawView(), "ChgAnchor without DrawView?" ); const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); if( rMrkList.GetMarkCount() && - !rMrkList.GetMark( 0 )->GetMarkedSdrObj()->GetUpGroup() ) + !rMrkList.GetMark( 0 )->GetMarkedSdrObj()->getParentSdrObjectFromSdrObject() ) { StartAllAction(); @@ -2388,9 +2388,9 @@ bool SwFEShell::IsGroupAllowed() const { const SdrObject* pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); if ( i ) - bIsGroupAllowed = pObj->GetUpGroup() == pUpGroup; + bIsGroupAllowed = pObj->getParentSdrObjectFromSdrObject() == pUpGroup; else - pUpGroup = pObj->GetUpGroup(); + pUpGroup = pObj->getParentSdrObjectFromSdrObject(); if ( bIsGroupAllowed ) bIsGroupAllowed = HasSuitableGroupingAnchor(pObj); diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index 7102805291fe..a9f376f62d67 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -1781,7 +1781,7 @@ uno::Sequence< beans::PropertyState > SwXShape::getPropertyStates( SdrObject* pObject = pSvxShape ? pSvxShape->GetSdrObject() : nullptr; if(pObject) { - bGroupMember = pObject->GetUpGroup() != nullptr; + bGroupMember = pObject->getParentSdrObjectFromSdrObject() != nullptr; bFormControl = pObject->GetObjInventor() == SdrInventor::FmForm; } const OUString* pNames = aPropertyNames.getConstArray(); @@ -2123,7 +2123,7 @@ void SwXShape::dispose() // correct assertion and refine it for safety reason. OSL_ENSURE( !pObj || dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr || - pObj->GetUpGroup() || + pObj->getParentSdrObjectFromSdrObject() || pObj == pFormat->FindSdrObject(), "<SwXShape::dispose(..) - different 'master' drawing objects!!" ); // perform delete of draw frame format *not* @@ -2132,7 +2132,7 @@ void SwXShape::dispose() // of a group if ( pObj && dynamic_cast<const SwDrawVirtObj*>( pObj) == nullptr && - !pObj->GetUpGroup() && + !pObj->getParentSdrObjectFromSdrObject() && pObj->IsInserted() ) { if (pFormat->GetAnchor().GetAnchorId() == RndStdIds::FLY_AS_CHAR) @@ -2376,12 +2376,12 @@ SdrObject* SwXShape::GetTopGroupObj( SvxShape* _pSvxShape ) if ( pSvxShape ) { SdrObject* pSdrObj = pSvxShape->GetSdrObject(); - if ( pSdrObj && pSdrObj->GetUpGroup() ) + if ( pSdrObj && pSdrObj->getParentSdrObjectFromSdrObject() ) { - pTopGroupObj = pSdrObj->GetUpGroup(); - while ( pTopGroupObj->GetUpGroup() ) + pTopGroupObj = pSdrObj->getParentSdrObjectFromSdrObject(); + while ( pTopGroupObj->getParentSdrObjectFromSdrObject() ) { - pTopGroupObj = pTopGroupObj->GetUpGroup(); + pTopGroupObj = pTopGroupObj->getParentSdrObjectFromSdrObject(); } } } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 31beefff762e..50a59c00c442 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1102,7 +1102,7 @@ void SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj, if( m_bObj ) { if( bMakeSdrGrafObj && pTextObj && - pTextObj->GetUpGroup() ) + pTextObj->getParentSdrObjectFromSdrObject() ) { // use SdrOleObj/SdrGrafObj instead of // SdrTextObj in this Group @@ -1121,7 +1121,7 @@ void SwWW8ImplReader::InsertTxbxText(SdrTextObj* pTextObj, pNew->SetLogicRect( pTextObj->GetCurrentBoundRect() ); pNew->SetLayer( pTextObj->GetLayer() ); - pTextObj->GetUpGroup()->GetSubList()-> + pTextObj->getParentSdrObjectFromSdrObject()->GetSubList()-> ReplaceObject(pNew, pTextObj->GetOrdNum()); } else @@ -2831,7 +2831,7 @@ SwFrameFormat* SwWW8ImplReader::MungeTextIntoDrawBox(SvxMSDffImportRec *pRecord, pSdrTextObj->GetSnapRect().GetHeight()); // Object is part of a group? - SdrObject* pGroupObject = pSdrTextObj->GetUpGroup(); + SdrObject* pGroupObject = pSdrTextObj->getParentSdrObjectFromSdrObject(); const size_t nOrdNum = pSdrTextObj->GetOrdNum(); bool bEraseThisObject; diff --git a/sw/source/filter/ww8/ww8graf2.cxx b/sw/source/filter/ww8/ww8graf2.cxx index 338b27aebe6a..b35ec366cd5b 100644 --- a/sw/source/filter/ww8/ww8graf2.cxx +++ b/sw/source/filter/ww8/ww8graf2.cxx @@ -336,7 +336,7 @@ void SwWW8ImplReader::ReplaceObj(const SdrObject &rReplaceObj, SdrObject &rSubObj) { // Insert SdrGrafObj instead of SdrTextObj into this group - if (SdrObject* pGroupObject = rReplaceObj.GetUpGroup()) + if (SdrObject* pGroupObject = rReplaceObj.getParentSdrObjectFromSdrObject()) { SdrObjList* pObjectList = pGroupObject->GetSubList(); @@ -657,7 +657,7 @@ SwFrameFormat* SwWW8ImplReader::ImportGraf(SdrTextObj const * pTextObj, } bool bTextObjWasGrouped = false; - if (pOldFlyFormat && pTextObj && pTextObj->GetUpGroup()) + if (pOldFlyFormat && pTextObj && pTextObj->getParentSdrObjectFromSdrObject()) bTextObjWasGrouped = true; if (bTextObjWasGrouped) diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx index cdeee03a3a96..928df235531b 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->getParentOfSdrObject(); + SdrObjList* pObjList = pOle2Obj->getParentSdrObjListFromSdrObject(); // get its graphic Graphic aGraphic; |