From ac3f2bd367743cc28fe4728279c65125c6f30e7a Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 29 May 2024 18:30:33 +0200 Subject: svx: Reduce number of calls to GetMarkedObjectList() from 447 to 208 Change-Id: I7b289b61a4ec416b9809f1433bb7a824ef488cb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168227 Tested-by: Xisco Fauli Reviewed-by: Xisco Fauli --- svx/source/dialog/graphctl.cxx | 6 +- svx/source/dialog/imapwnd.cxx | 2 +- svx/source/engine3d/view3d.cxx | 89 ++++++++++++---------- svx/source/engine3d/view3d1.cxx | 9 ++- svx/source/svdraw/svddrgmt.cxx | 40 ++++++---- svx/source/svdraw/svddrgv.cxx | 30 ++++---- svx/source/svdraw/svdedtv.cxx | 37 ++++----- svx/source/svdraw/svdedtv1.cxx | 132 +++++++++++++++++++------------- svx/source/svdraw/svdedtv2.cxx | 163 ++++++++++++++++++++++------------------ svx/source/svdraw/svdedxv.cxx | 14 ++-- svx/source/svdraw/svdglev.cxx | 40 ++++++---- svx/source/svdraw/svdmrkv.cxx | 148 +++++++++++++++++++++--------------- svx/source/svdraw/svdmrkv1.cxx | 77 +++++++++++-------- svx/source/svdraw/svdpoev.cxx | 70 ++++++++++------- svx/source/svdraw/svdundo.cxx | 12 ++- svx/source/svdraw/svdview.cxx | 32 ++++---- svx/source/svdraw/svdxcgv.cxx | 33 ++++---- 17 files changed, 541 insertions(+), 393 deletions(-) (limited to 'svx') diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 31892b253b97..3d8d71f4d2e1 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -305,12 +305,13 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt ) { if ( mbSdrMode ) { + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); if ( pView->IsAction() ) { pView->BrkAction(); bProc = true; } - else if ( pView->GetMarkedObjectList().GetMarkCount() != 0 ) + else if ( rMarkList.GetMarkCount() != 0 ) { pView->UnmarkAllObj(); bProc = true; @@ -410,7 +411,8 @@ bool GraphCtrl::KeyInput( const KeyEvent& rKEvt ) nY = 0; } - if (pView->GetMarkedObjectList().GetMarkCount() != 0 && !aCode.IsMod1() ) + const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); + if (rMarkList.GetMarkCount() != 0 && !aCode.IsMod1() ) { if(aCode.IsMod2()) { diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index ffe1a047d859..0de8de06a050 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -504,7 +504,7 @@ bool IMapWindow::Command(const CommandEvent& rCEvt) mxPopupMenu->set_sensitive(u"url"_ustr, false); mxPopupMenu->set_sensitive(u"active"_ustr, false); mxPopupMenu->set_sensitive(u"macro"_ustr, false); - mxPopupMenu->set_sensitive(u"selectall"_ustr, pModel->GetPage(0)->GetObjCount() != pView->GetMarkedObjectList().GetMarkCount()); + mxPopupMenu->set_sensitive(u"selectall"_ustr, pModel->GetPage(0)->GetObjCount() != rMarkList.GetMarkCount()); if ( !nMarked ) { diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 3507bc1972bd..132eca98536b 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -88,9 +88,10 @@ public: Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView) : mrView(rView), - mnCount(rView.GetMarkedObjectList().GetMarkCount()), mpPolygons(nullptr) { + const SdrMarkList& rMarkList = mrView.GetMarkedObjectList(); + mnCount = rMarkList.GetMarkCount(); if(!mnCount) return; @@ -102,7 +103,7 @@ Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView) { for(size_t a = 0; a < mnCount; ++a) { - SdrObject* pObject = mrView.GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj(); + SdrObject* pObject = rMarkList.GetMark(a)->GetMarkedSdrObj(); if(pObject) { @@ -119,7 +120,7 @@ Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView) for(size_t a = 0; a < mnCount; ++a) { - SdrObject* pObject = mrView.GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj(); + SdrObject* pObject = rMarkList.GetMark(a)->GetMarkedSdrObj(); mpPolygons[mnCount - (a + 1)] = pObject->TakeXorPoly(); } } @@ -217,10 +218,11 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const bool bSpecialHandling = false; E3dScene *pScene = nullptr; - const size_t nCnt = GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCnt = rMarkList.GetMarkCount(); for(size_t nObjs = 0; nObjs < nCnt; ++nObjs) { - SdrObject *pObj = GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(nObjs)->GetMarkedSdrObj(); if(auto pCompoundObject = dynamic_cast(pObj)) { // related scene @@ -249,7 +251,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const // objects for(size_t nObjs = 0; nObjs < nCnt; ++nObjs) { - SdrObject *pObj = GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(nObjs)->GetMarkedSdrObj(); if(auto pCompoundObject = dynamic_cast(pObj)) { // related scene @@ -264,7 +266,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const for(size_t nObjs = 0; nObjs < nCnt; ++nObjs) { - SdrObject *pObj = GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(nObjs)->GetMarkedSdrObj(); if(auto p3DObj = DynCastE3dObject(pObj)) { // Select object @@ -276,7 +278,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const if(nullptr != pScene) { // code from parent - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); pScene->SetDrawOnlySelected(true); pScene->SingleObjectPainter(rOut); @@ -286,7 +288,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const // Reset selection flag for(size_t nObjs = 0; nObjs < nCnt; ++nObjs) { - SdrObject *pObj = GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(nObjs)->GetMarkedSdrObj(); if(auto pCompoundObject = dynamic_cast(pObj)) { // related scene @@ -313,12 +315,13 @@ std::unique_ptr E3dView::CreateMarkedObjModel() const { // Does 3D objects exist which scenes are not selected? bool bSpecialHandling(false); - const size_t nCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount(rMarkList.GetMarkCount()); E3dScene *pScene = nullptr; for(size_t nObjs = 0; nObjs < nCount; ++nObjs) { - const SdrObject* pObj = GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj(); + const SdrObject* pObj = rMarkList.GetMark(nObjs)->GetMarkedSdrObj(); if(!bSpecialHandling) if(auto pCompoundObj = dynamic_cast< const E3dCompoundObject*>(pObj)) @@ -358,7 +361,7 @@ std::unique_ptr E3dView::CreateMarkedObjModel() const // and collect SnapRect of selected objects for(size_t nObjs = 0; nObjs < nCount; ++nObjs) { - SdrObject *pObj = GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(nObjs)->GetMarkedSdrObj(); if(auto p3DObj = dynamic_cast(pObj)) { @@ -370,7 +373,7 @@ std::unique_ptr E3dView::CreateMarkedObjModel() const // create new mark list which contains all indirectly selected3d // scenes as selected objects - SdrMarkList aOldML(GetMarkedObjectList()); + SdrMarkList aOldML(rMarkList); SdrMarkList aNewML; SdrMarkList& rCurrentMarkList = const_cast(this)->GetMarkedObjectListWriteAccess(); rCurrentMarkList = aNewML; @@ -585,9 +588,10 @@ bool E3dView::IsConvertTo3DObjPossible() const bool bGroupSelected(false); bool bRetval(true); - for(size_t a=0; !bAny3D && aGetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(a)->GetMarkedSdrObj(); if(pObj) { ImpIsConvertTo3DPossible(pObj, bAny3D, bGroupSelected); @@ -812,7 +816,8 @@ void E3dView::ImpCreate3DObject(E3dScene* pScene, SdrObject* pObj, bool bExtrude void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1, const basegfx::B2DPoint& rPnt2) { - if(GetMarkedObjectList().GetMarkCount() == 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if(rMarkList.GetMarkCount() == 0) return; // Create undo @@ -821,7 +826,7 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 else BegUndo(SvxResId(RID_SVX_3D_UNDO_LATHE)); - SdrModel& rSdrModel(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()->getSdrModelFromSdrObject()); + SdrModel& rSdrModel(rMarkList.GetMark(0)->GetMarkedSdrObj()->getSdrModelFromSdrObject()); // Create a new scene for the created 3D object rtl::Reference pScene = new E3dScene(rSdrModel); @@ -877,9 +882,9 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 aInvLatheMat.invert(); // SnapRect extension enables mirroring in the axis of rotation - for(size_t a=0; aGetMarkedSdrObj(); tools::Rectangle aTurnRect = pObj->GetSnapRect(); basegfx::B2DPoint aRot; @@ -917,9 +922,9 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 // Walk through the selection and convert it into 3D, complete with // Conversion to SdrPathObject, also fonts - for(size_t a=0; aGetMarkedSdrObj(); ImpCreate3DObject(pScene.get(), pObj, bExtrude, fDepth, aLatheMat); @@ -945,7 +950,7 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 // Insert scene instead of the first selected object and throw away // all the old objects - SdrMark* pMark = GetMarkedObjectList().GetMark(0); + SdrMark* pMark = rMarkList.GetMark(0); if (pMark) { SdrObject* pRepObj = pMark->GetMarkedSdrObj(); @@ -1139,7 +1144,8 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl, short nMinMov, SdrDragMethod* pForcedMeth) { - if(Is3DRotationCreationActive() && GetMarkedObjectList().GetMarkCount()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if(Is3DRotationCreationActive() && rMarkList.GetMarkCount()) { // Determine all selected polygons and return the mirrored helper overlay mpMirrorOverlay->SetMirrorAxis(maRef1, maRef2); @@ -1160,15 +1166,15 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut, bOwnActionNecessary = false; } - if(bOwnActionNecessary && GetMarkedObjectList().GetMarkCount() > 0) + if(bOwnActionNecessary && rMarkList.GetMarkCount() > 0) { E3dDragConstraint eConstraint = E3dDragConstraint::XYZ; bool bThereAreRootScenes = false; bool bThereAre3DObjects = false; - const size_t nCnt = GetMarkedObjectList().GetMarkCount(); + const size_t nCnt = rMarkList.GetMarkCount(); for(size_t nObjs = 0; nObjs < nCnt; ++nObjs) { - SdrObject *pObj = GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(nObjs)->GetMarkedSdrObj(); if(pObj) { if( const E3dScene* pScene = DynCastE3dScene(pObj) ) @@ -1218,7 +1224,7 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut, // do not mask the allowed rotations eConstraint &= E3dDragConstraint::XYZ; - pForcedMeth = new E3dDragRotate(*this, GetMarkedObjectList(), eConstraint, IsSolidDragging()); + pForcedMeth = new E3dDragRotate(*this, rMarkList, eConstraint, IsSolidDragging()); } break; @@ -1226,7 +1232,7 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* pOut, { if(!bThereAreRootScenes) { - pForcedMeth = new E3dDragMove(*this, GetMarkedObjectList(), meDragHdl, eConstraint, IsSolidDragging()); + pForcedMeth = new E3dDragMove(*this, rMarkList, meDragHdl, eConstraint, IsSolidDragging()); } } break; @@ -1288,7 +1294,8 @@ void E3dView::InitScene(E3dScene* pScene, double fW, double fH, double fCamZ) void E3dView::Start3DCreation() { - if (!GetMarkedObjectList().GetMarkCount()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (!rMarkList.GetMarkCount()) return; //positioned @@ -1328,9 +1335,9 @@ void E3dView::Start3DCreation() // and then attach the marks at the top and bottom of the object basegfx::B2DRange aR; - for(size_t nMark = 0; nMark < GetMarkedObjectList().GetMarkCount(); ++nMark) + for(size_t nMark = 0; nMark < rMarkList.GetMarkCount(); ++nMark) { - SdrObject* pMark = GetMarkedObjectList().GetMark(nMark)->GetMarkedSdrObj(); + SdrObject* pMark = rMarkList.GetMark(nMark)->GetMarkedSdrObj(); basegfx::B2DPolyPolygon aXPP(pMark->TakeXorPoly()); aR.expand(basegfx::utils::getRange(aXPP)); } @@ -1368,7 +1375,7 @@ void E3dView::Start3DCreation() SetMarkHandles(nullptr); //HMHif (bVis) ShowMarkHdl(); - if (GetMarkedObjectList().GetMarkCount() != 0) MarkListHasChanged(); + if (rMarkList.GetMarkCount() != 0) MarkListHasChanged(); // Show mirror polygon IMMEDIATELY const SdrHdlList &aHdlList = GetHdlList(); @@ -1424,7 +1431,8 @@ void E3dView::End3DCreation(bool bUseDefaultValuesForMirrorAxes) { ResetCreationActive(); - if(GetMarkedObjectList().GetMarkCount() == 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if(rMarkList.GetMarkCount() == 0) return; if(bUseDefaultValuesForMirrorAxes) @@ -1472,13 +1480,14 @@ void E3dView::InitView () bool E3dView::IsBreak3DObjPossible() const { - const size_t nCount = GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount = rMarkList.GetMarkCount(); if (nCount > 0) { for (size_t i = 0; i < nCount; ++i) { - SdrObject* pObj = GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); if (auto p3dObject = DynCastE3dObject(pObj)) { @@ -1504,13 +1513,14 @@ void E3dView::Break3DObj() if(!IsBreak3DObjPossible()) return; + const SdrMarkList& rMarkList = GetMarkedObjectList(); // ALL selected objects are changed - const size_t nCount = GetMarkedObjectList().GetMarkCount(); + const size_t nCount = rMarkList.GetMarkCount(); BegUndo(SvxResId(RID_SVX_3D_UNDO_BREAK_LATHE)); for(size_t a=0; a(GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj()); + E3dObject* pObj = static_cast(rMarkList.GetMark(a)->GetMarkedSdrObj()); BreakSingle3DObj(pObj); } DeleteMarked(); @@ -1553,12 +1563,13 @@ void E3dView::CheckPossibilities() if(!(m_bGroupPossible || m_bUnGroupPossible || m_bGrpEnterPossible)) return; - const size_t nMarkCnt = GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCnt = rMarkList.GetMarkCount(); bool bCompound = false; bool b3DObject = false; for(size_t nObjs = 0; (nObjs < nMarkCnt) && !bCompound; ++nObjs) { - SdrObject *pObj = GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(nObjs)->GetMarkedSdrObj(); if(dynamic_cast< const E3dCompoundObject* >(pObj)) bCompound = true; if(DynCastE3dObject(pObj)) diff --git a/svx/source/engine3d/view3d1.cxx b/svx/source/engine3d/view3d1.cxx index db5466dd287b..6b206f684b74 100644 --- a/svx/source/engine3d/view3d1.cxx +++ b/svx/source/engine3d/view3d1.cxx @@ -36,9 +36,10 @@ void E3dView::ConvertMarkedToPolyObj() { rtl::Reference pNewObj; - if (GetMarkedObjectList().GetMarkCount() == 1) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() == 1) { - SdrObject* pObj = GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); if (pObj) { @@ -107,7 +108,7 @@ SfxItemSet E3dView::Get3DAttributes() const for(size_t a = 0; a < nMarkCnt; ++a) { - SdrObject* pObj = GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(a)->GetMarkedSdrObj(); Imp_E3dView_InorderRun3DObjects(*pObj, nSelectedItems); } @@ -150,7 +151,7 @@ void E3dView::Set3DAttributes( const SfxItemSet& rAttr) for(size_t a = 0; a < nMarkCnt; ++a) { - SdrObject* pObj = GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(a)->GetMarkedSdrObj(); Imp_E3dView_InorderRun3DObjects(*pObj, nSelectedItems); } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 995ef538a2f6..369559233843 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -361,7 +361,8 @@ void SdrDragMethod::insertNewlyCreatedOverlayObjectForSdrDragMethod( void SdrDragMethod::createSdrDragEntries_SolidDrag() { - const size_t nMarkCount(getSdrDragView().GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); SdrPageView* pPV = getSdrDragView().GetSdrPageView(); if(!pPV) @@ -369,7 +370,7 @@ void SdrDragMethod::createSdrDragEntries_SolidDrag() for(size_t a = 0; a < nMarkCount; ++a) { - SdrMark* pM = getSdrDragView().GetMarkedObjectList().GetMark(a); + SdrMark* pM = rMarkList.GetMark(a); if(pM->GetPageView() == pPV) { @@ -420,14 +421,15 @@ void SdrDragMethod::createSdrDragEntries_SolidDrag() void SdrDragMethod::createSdrDragEntries_PolygonDrag() { - const size_t nMarkCount(getSdrDragView().GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); bool bNoPolygons(getSdrDragView().IsNoDragXorPolys() || nMarkCount > SdrDragView::GetDragXorPolyLimit()); basegfx::B2DPolyPolygon aResult; sal_uInt32 nPointCount(0); for(size_t a = 0; !bNoPolygons && a < nMarkCount; ++a) { - SdrMark* pM = getSdrDragView().GetMarkedObjectList().GetMark(a); + SdrMark* pM = rMarkList.GetMark(a); if(pM->GetPageView() == getSdrDragView().GetSdrPageView()) { @@ -467,12 +469,13 @@ void SdrDragMethod::createSdrDragEntries_PolygonDrag() void SdrDragMethod::createSdrDragEntries_PointDrag() { - const size_t nMarkCount(getSdrDragView().GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); std::vector< basegfx::B2DPoint > aPositions; for(size_t nm = 0; nm < nMarkCount; ++nm) { - SdrMark* pM = getSdrDragView().GetMarkedObjectList().GetMark(nm); + SdrMark* pM = rMarkList.GetMark(nm); if(pM->GetPageView() == getSdrDragView().GetSdrPageView()) { @@ -512,12 +515,13 @@ void SdrDragMethod::createSdrDragEntries_PointDrag() void SdrDragMethod::createSdrDragEntries_GlueDrag() { - const size_t nMarkCount(getSdrDragView().GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); std::vector< basegfx::B2DPoint > aPositions; for(size_t nm = 0; nm < nMarkCount; ++nm) { - SdrMark* pM = getSdrDragView().GetMarkedObjectList().GetMark(nm); + SdrMark* pM = rMarkList.GetMark(nm); if(pM->GetPageView() == getSdrDragView().GetSdrPageView()) { @@ -1628,12 +1632,12 @@ void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_) if (getSdrDragView().IsDraggingGluePoints()) { // restrict gluepoints to the BoundRect of the Obj aPt1-=DragStat().GetStart(); - const SdrMarkList& rML=GetMarkedObjectList(); - const size_t nMarkCount=rML.GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount = rMarkList.GetMarkCount(); for (size_t nMarkNum=0; nMarkNumGetMarkedGluePoints(); if (!rPts.empty()) @@ -2712,7 +2716,8 @@ void SdrDragGradient::MoveSdrDrag(const Point& rPnt) } // new state - pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), false, false); + const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList(); + pIAOHandle->FromIAOToItem(rMarkList.GetMark(0)->GetMarkedSdrObj(), false, false); } bool SdrDragGradient::EndSdrDrag(bool /*bCopy*/) @@ -2721,7 +2726,8 @@ bool SdrDragGradient::EndSdrDrag(bool /*bCopy*/) Ref2() = pIAOHandle->Get2ndPos(); // new state - pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, true); + const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList(); + pIAOHandle->FromIAOToItem(rMarkList.GetMark(0)->GetMarkedSdrObj(), true, true); return true; } @@ -2739,7 +2745,8 @@ void SdrDragGradient::CancelSdrDrag() pIAOHandle->GetColorHdl2()->SetPos(DragStat().GetRef2()); // new state - pIAOHandle->FromIAOToItem(getSdrDragView().GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), true, false); + const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList(); + pIAOHandle->FromIAOToItem(rMarkList.GetMark(0)->GetMarkedSdrObj(), true, false); } PointerStyle SdrDragGradient::GetSdrDragPointer() const @@ -3335,11 +3342,12 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy) if (bCopy) getSdrDragView().CopyMarkedObj(); - const size_t nMarkCount=getSdrDragView().GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = getSdrDragView().GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); Point aCtr0(pO->GetSnapRect().Center()); Point aCtr1(aCtr0); diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index b7ae687d9d0c..d123e900e9c7 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -144,11 +144,12 @@ bool SdrDragView::TakeDragObjAnchorPos(Point& rPos, bool bTR ) const tools::Rectangle aR; TakeActionRect(aR); rPos = bTR ? aR.TopRight() : aR.TopLeft(); - if (GetMarkedObjectList().GetMarkCount()==1 && IsDragObj() && // only on single selection + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount()==1 && IsDragObj() && // only on single selection !IsDraggingPoints() && !IsDraggingGluePoints() && // not when moving points dynamic_cast( mpCurrentSdrDragMethod.get() ) == nullptr) // not when moving handles { - SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); if (auto pCaptionObj = dynamic_cast(pObj)) { Point aPt(pCaptionObj->GetTailPos()); @@ -206,11 +207,12 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl Point aPnt(rPnt); basegfx::B2DVector aGridOffset(0.0, 0.0); + const SdrMarkList& rMarkList = GetMarkedObjectList(); // Coordinate maybe affected by GridOffset, so we may need to // adapt to Model-coordinates here if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj - && getPossibleGridOffsetForSdrObject(aGridOffset, GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), GetSdrPageView())) + && getPossibleGridOffsetForSdrObject(aGridOffset, rMarkList.GetMark(0)->GetMarkedSdrObj(), GetSdrPageView())) || (getPossibleGridOffsetForPosition( aGridOffset, basegfx::B2DPoint(aPnt.X(), aPnt.Y()), @@ -267,9 +269,9 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl { // are 3D objects selected? bool b3DObjSelected = false; - for(size_t a=0; !b3DObjSelected && aGetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(a)->GetMarkedSdrObj(); if(DynCastE3dObject(pObj)) b3DObjSelected = true; } @@ -415,9 +417,9 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl } bool bSingleTextObjMark = false; // SJ: #i100490# - if ( GetMarkedObjectList().GetMarkCount() == 1 ) + if ( rMarkList.GetMarkCount() == 1 ) { - mpMarkedObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + mpMarkedObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); if ( mpMarkedObj && DynCastSdrTextObj( mpMarkedObj) != nullptr && static_cast(mpMarkedObj)->IsTextFrame() ) @@ -433,7 +435,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl { if(SdrHdlKind::Move == meDragHdl) { - const bool bCustomShapeSelected(1 == GetMarkedObjectList().GetMarkCount() && dynamic_cast(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()) != nullptr); + const bool bCustomShapeSelected(1 == rMarkList.GetMarkCount() && dynamic_cast(rMarkList.GetMark(0)->GetMarkedSdrObj()) != nullptr); if(bCustomShapeSelected) { @@ -442,7 +444,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, OutputDevice* pOut, SdrHdl* pHdl } else if(SdrHdlKind::Poly == meDragHdl) { - const bool bConnectorSelected(1 == GetMarkedObjectList().GetMarkCount() && dynamic_cast(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()) != nullptr); + const bool bConnectorSelected(1 == rMarkList.GetMarkCount() && dynamic_cast(rMarkList.GetMark(0)->GetMarkedSdrObj()) != nullptr); if(bConnectorSelected) { @@ -513,8 +515,9 @@ void SdrDragView::MovDragObj(const Point& rPnt) // Coordinate maybe affected by GridOffset, so we may need to // adapt to Model-coordinates here + const SdrMarkList& rMarkList = GetMarkedObjectList(); if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj - && getPossibleGridOffsetForSdrObject(aGridOffset, GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), GetSdrPageView())) + && getPossibleGridOffsetForSdrObject(aGridOffset, rMarkList.GetMark(0)->GetMarkedSdrObj(), GetSdrPageView())) || (getPossibleGridOffsetForPosition( aGridOffset, basegfx::B2DPoint(aPnt.X(), aPnt.Y()), @@ -711,12 +714,13 @@ bool SdrDragView::EndInsObjPoint(SdrCreateCmd eCmd) bool SdrDragView::IsInsGluePointPossible() const { bool bRet=false; - if (IsInsGluePointMode() && GetMarkedObjectList().GetMarkCount() != 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (IsInsGluePointMode() && rMarkList.GetMarkCount() != 0) { - if (GetMarkedObjectList().GetMarkCount()==1) + if (rMarkList.GetMarkCount()==1) { // return sal_False, if only 1 object which is a connector. - const SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + const SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); if (dynamic_cast(pObj) == nullptr) { bRet=true; diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index f982a037b0f4..15fff60a8490 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -490,9 +490,10 @@ void SdrEditView::CheckPossibilities() if (!m_bPossibilitiesDirty) return; + const SdrMarkList& rMarkList = GetMarkedObjectList(); ImpResetPossibilityFlags(); - GetMarkedObjectList().ForceSort(); - const size_t nMarkCount = GetMarkedObjectList().GetMarkCount(); + rMarkList.ForceSort(); + const size_t nMarkCount = rMarkList.GetMarkCount(); if (nMarkCount != 0) { m_bReverseOrderPossible = (nMarkCount >= 2); @@ -504,7 +505,7 @@ void SdrEditView::CheckPossibilities() { // check bCombinePossible more thoroughly // still missing ... - const SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + const SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); //const SdrPathObj* pPath=dynamic_cast( pObj ); bool bGroup=pObj->GetSubList()!=nullptr; bool bHasText=pObj->GetOutlinerParaObject()!=nullptr; @@ -534,7 +535,7 @@ void SdrEditView::CheckPossibilities() if(m_bGradientAllowed) { // gradient depends on fill style - const SdrMark* pM = GetMarkedObjectList().GetMark(0); + const SdrMark* pM = rMarkList.GetMark(0); const SdrObject* pObj = pM->GetMarkedSdrObj(); // may be group object, so get merged ItemSet @@ -557,7 +558,7 @@ void SdrEditView::CheckPossibilities() const SdrPageView* pPV0=nullptr; for (size_t nm=0; nmGetMarkedSdrObj(); const SdrPageView* pPV=pM->GetPageView(); if (pPV!=pPV0) { @@ -663,7 +664,7 @@ void SdrEditView::CheckPossibilities() // Don't allow moving glued connectors. // Currently only implemented for single selection. if (nMarkCount==1) { - SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); SdrEdgeObj* pEdge=dynamic_cast( pObj ); if (pEdge!=nullptr) { SdrObject* pNode1=pEdge->GetConnectedNode(true); @@ -675,7 +676,7 @@ void SdrEditView::CheckPossibilities() // Don't allow enter Diagrams if (1 == nMarkCount && m_bGrpEnterPossible) { - SdrObject* pCandidate(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()); + SdrObject* pCandidate(rMarkList.GetMark(0)->GetMarkedSdrObj()); if(nullptr != pCandidate && pCandidate->isDiagram()) m_bGrpEnterPossible = false; @@ -685,9 +686,10 @@ void SdrEditView::CheckPossibilities() void SdrEditView::ForceMarkedObjToAnotherPage() { + const SdrMarkList& rMarkList = GetMarkedObjectList(); bool bFlg=false; - for (size_t nm=0; nmGetMarkedSdrObj(); tools::Rectangle aObjRect(pObj->GetCurrentBoundRect()); tools::Rectangle aPgRect(pM->GetPageView()->GetPageRect()); @@ -796,26 +798,26 @@ static void lcl_LazyDelete(std::vector> & rLazyDelete) void SdrEditView::DeleteMarkedObj() { + const SdrMarkList& rMarkList = GetMarkedObjectList(); // #i110981# return when nothing is to be done at all - if(!GetMarkedObjectList().GetMarkCount()) + if(!rMarkList.GetMarkCount()) { return; } // moved breaking action and undo start outside loop BrkAction(); - BegUndo(SvxResId(STR_EditDelete),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::Delete); + BegUndo(SvxResId(STR_EditDelete),rMarkList.GetMarkDescription(),SdrRepeatFunc::Delete); std::vector> lazyDeleteObjects; // remove as long as something is selected. This allows to schedule objects for // removal for a next run as needed - while(GetMarkedObjectList().GetMarkCount()) + while(rMarkList.GetMarkCount()) { // vector to remember the parents which may be empty after object removal std::vector< SdrObject* > aParents; { - const SdrMarkList& rMarkList = GetMarkedObjectList(); const size_t nCount(rMarkList.GetMarkCount()); for(size_t a = 0; a < nCount; ++a) @@ -867,12 +869,12 @@ void SdrEditView::DeleteMarkedObj() // original stuff: remove selected objects. Handle clear will // do something only once - auto temp(DeleteMarkedList(GetMarkedObjectList())); + auto temp(DeleteMarkedList(rMarkList)); lazyDeleteObjects.insert(lazyDeleteObjects.end(), temp.begin(), temp.end()); GetMarkedObjectListWriteAccess().Clear(); maHdlList.Clear(); - while(!aParents.empty() && !GetMarkedObjectList().GetMarkCount()) + while(!aParents.empty() && !rMarkList.GetMarkCount()) { // iterate over remembered parents SdrObject* pParent = aParents.back(); @@ -904,9 +906,10 @@ void SdrEditView::DeleteMarkedObj() void SdrEditView::CopyMarkedObj() { - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); - SdrMarkList aSourceObjectsForCopy(GetMarkedObjectList()); + SdrMarkList aSourceObjectsForCopy(rMarkList); // The following loop is used instead of MarkList::Merge(), to be // able to flag the MarkEntries. const size_t nEdgeCnt = GetEdgesOfMarkedNodes().GetMarkCount(); diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 0f9e703517fe..cff6238b8005 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -76,8 +76,10 @@ void SdrEditView::SetMarkedObjRect(const tools::Rectangle& rRect) { DBG_ASSERT(!rRect.IsEmpty(),"SetMarkedObjRect() with an empty Rect does not make sense."); - if (rRect.IsEmpty()) return; - const size_t nCount=GetMarkedObjectList().GetMarkCount(); + if (rRect.IsEmpty()) + return; + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount=rMarkList.GetMarkCount(); if (nCount==0) return; tools::Rectangle aR0(GetMarkedObjRect()); DBG_ASSERT(!aR0.IsEmpty(),"SetMarkedObjRect(): GetMarkedObjRect() is empty."); @@ -100,7 +102,7 @@ void SdrEditView::SetMarkedObjRect(const tools::Rectangle& rRect) for (size_t nm=0; nmGetMarkedSdrObj(); if (bUndo) AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); @@ -182,6 +184,7 @@ void SdrEditView::AddUndoActions( std::vector< std::unique_ptr > void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy) { const bool bUndo = IsUndoEnabled(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); if( bUndo ) { @@ -190,16 +193,16 @@ void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy) if (bCopy) aStr += SvxResId(STR_EditWithCopy); // needs its own UndoGroup because of its parameters - BegUndo(aStr,GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::Move); + BegUndo(aStr,rMarkList.GetMarkDescription(),SdrRepeatFunc::Move); } if (bCopy) CopyMarkedObj(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); if( bUndo ) { @@ -228,10 +231,11 @@ void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, cons if (bCopy) CopyMarkedObj(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); if( bUndo ) { @@ -257,10 +261,11 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef, BegUndo(ImpGetDescriptionString(STR_EditResize)); } - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); if( bUndo ) { @@ -284,9 +289,10 @@ Degree100 SdrEditView::GetMarkedObjRotate() const { Degree100 nRetval(0); - if(GetMarkedObjectList().GetMarkCount()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if(rMarkList.GetMarkCount()) { - SdrMark* pM = GetMarkedObjectList().GetMark(0); + SdrMark* pM = rMarkList.GetMark(0); SdrObject* pO = pM->GetMarkedSdrObj(); nRetval = pO->GetRotateAngle(); @@ -311,7 +317,8 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, Degree100 nAngle, bool bCop double nSin = sin(toRadians(nAngle)); double nCos = cos(toRadians(nAngle)); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); if(nMarkCount) { @@ -319,7 +326,7 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, Degree100 nAngle, bool bCop for(size_t nm = 0; nm < nMarkCount; ++nm) { - SdrMark* pM = GetMarkedObjectList().GetMark(nm); + SdrMark* pM = rMarkList.GetMark(nm); SdrObject* pO = pM->GetMarkedSdrObj(); if( bUndo ) @@ -375,7 +382,8 @@ void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool b if (bCopy) CopyMarkedObj(); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); if(nMarkCount) { @@ -383,7 +391,7 @@ void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool b for(size_t nm = 0; nm < nMarkCount; ++nm) { - SdrMark* pM = GetMarkedObjectList().GetMark(nm); + SdrMark* pM = rMarkList.GetMark(nm); SdrObject* pO = pM->GetMarkedSdrObj(); if( bUndo ) @@ -436,9 +444,10 @@ Degree100 SdrEditView::GetMarkedObjShear() const bool b1st=true; bool bOk=true; Degree100 nAngle(0); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); Degree100 nAngle2=pO->GetShearAngle(); if (b1st) nAngle=nAngle2; @@ -468,10 +477,11 @@ void SdrEditView::ShearMarkedObj(const Point& rRef, Degree100 nAngle, bool bVShe CopyMarkedObj(); double nTan = tan(toRadians(nAngle)); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); if( bUndo ) { @@ -583,10 +593,11 @@ void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookM if (bCopy) CopyMarkedObj(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); if (bUndo) AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); @@ -657,10 +668,11 @@ void SdrEditView::DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& if (bCopy) CopyMarkedObj(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); if (bUndo) AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); @@ -768,10 +780,11 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr) const bool bUndo = IsUndoEnabled(); // TODO: check if WhichRange is necessary. - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); if (bUndo) AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); @@ -805,9 +818,10 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr) const Degree100 nShrAngle(0); bool bShrAngleDC=false; tools::Rectangle aSnapRect; tools::Rectangle aLogicRect; - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); if (nm==0) { nLayerId=pObj->GetLayer(); @@ -905,12 +919,13 @@ SfxItemSet SdrEditView::GetAttrFromMarked(bool bOnlyHardAttr) const void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, bool bOnlyHardAttr) const { - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); for(size_t a = 0; a < nMarkCount; ++a) { // #80277# merging was done wrong in the prev version - SdrObject *pObj = GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj(); + SdrObject *pObj = rMarkList.GetMark(a)->GetMarkedSdrObj(); if (!pObj) { continue; @@ -1061,7 +1076,8 @@ std::vector GetAllCharPropIds(std::span< const SfxPoolItem* const > void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) { - if (GetMarkedObjectList().GetMarkCount() == 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() == 0) return; #ifdef DBG_UTIL @@ -1125,7 +1141,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) BegUndo(ImpGetDescriptionString(STR_EditSetAttributes)); } - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const size_t nMarkCount(rMarkList.GetMarkCount()); std::vector< E3DModifySceneSnapRectUpdater* > aUpdaters; // create ItemSet without SfxItemState::INVALID. Put() @@ -1153,7 +1169,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) for (size_t nm=0; nmGetMarkedSdrObj(); if( bUndo ) @@ -1280,9 +1296,10 @@ SfxStyleSheet* SdrEditView::GetStyleSheetFromMarked() const { SfxStyleSheet* pRet=nullptr; bool b1st=true; - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj()->GetStyleSheet(); if (b1st) pRet=pSS; else if (pRet!=pSS) return nullptr; // different stylesheets @@ -1293,7 +1310,8 @@ SfxStyleSheet* SdrEditView::GetStyleSheetFromMarked() const void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr) { - if (GetMarkedObjectList().GetMarkCount() == 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() == 0) return; const bool bUndo = IsUndoEnabled(); @@ -1309,10 +1327,10 @@ void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRe BegUndo(aStr); } - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj())); @@ -1328,7 +1346,8 @@ void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRe void SdrEditView::GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const { - if(GetMarkedObjectList().GetMarkCount()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if(rMarkList.GetMarkCount()) { rTargetSet.Put(GetAttrFromMarked(bOnlyHardAttr), false); } @@ -1340,7 +1359,8 @@ void SdrEditView::GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) cons void SdrEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) { - if (GetMarkedObjectList().GetMarkCount()!=0) { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount()!=0) { SetAttrToMarked(rSet,bReplaceAll); } else { SdrMarkView::SetAttributes(rSet,bReplaceAll); @@ -1349,7 +1369,8 @@ void SdrEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) SfxStyleSheet* SdrEditView::GetStyleSheet() const { - if (GetMarkedObjectList().GetMarkCount()!=0) { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount()!=0) { return GetStyleSheetFromMarked(); } else { return SdrMarkView::GetStyleSheet(); @@ -1358,7 +1379,8 @@ SfxStyleSheet* SdrEditView::GetStyleSheet() const void SdrEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr) { - if (GetMarkedObjectList().GetMarkCount()!=0) { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount()!=0) { SetStyleSheetToMarked(pStyleSheet,bDontRemoveHardAttr); } else { SdrMarkView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); @@ -1375,7 +1397,8 @@ SfxItemSet SdrEditView::GetGeoAttrFromMarked() const SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE, SID_ATTR_TRANSFORM_PROTECT_POS, SID_ATTR_TRANSFORM_AUTOHEIGHT>); - if (GetMarkedObjectList().GetMarkCount() != 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() != 0) { SfxItemSet aMarkAttr(GetAttrFromMarked(false)); // because of AutoGrowHeight and corner radius tools::Rectangle aRect(GetMarkedObjRect()); @@ -1431,7 +1454,6 @@ SfxItemSet SdrEditView::GetGeoAttrFromMarked() const aRetSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_SHEAR_Y,nShearRefY)); // check every object whether it is protected - const SdrMarkList& rMarkList=GetMarkedObjectList(); const size_t nMarkCount=rMarkList.GetMarkCount(); SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); bool bPosProt=pObj->IsMoveProtect(); @@ -1713,7 +1735,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin ForcePossibilities(); - BegUndo(SvxResId(STR_EditTransform),GetMarkedObjectList().GetMarkDescription()); + BegUndo(SvxResId(STR_EditTransform),rMarkList.GetMarkDescription()); if (bSetAttr) { SetAttrToMarked(aSetAttr,false); @@ -1858,7 +1880,8 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin bool SdrEditView::IsAlignPossible() const { // at least two selected objects, at least one of them movable ForcePossibilities(); - const size_t nCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount=rMarkList.GetMarkCount(); if (nCount==0) return false; // nothing selected! if (nCount==1) return m_bMoveAllowed; // align single object to page return m_bOneOrMoreMovable; // otherwise: MarkCount>=2 @@ -1869,15 +1892,16 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert) if (eHor==SdrHorAlign::NONE && eVert==SdrVertAlign::NONE) return; - GetMarkedObjectList().ForceSort(); - if (!GetMarkedObjectList().GetMarkCount()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); + if (!rMarkList.GetMarkCount()) return; const bool bUndo = IsUndoEnabled(); if( bUndo ) { EndTextEditCurrentView(); - OUString aStr(GetMarkedObjectList().GetMarkDescription()); + OUString aStr(rMarkList.GetMarkDescription()); if (eHor==SdrHorAlign::NONE) { switch (eVert) @@ -1922,11 +1946,11 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert) } tools::Rectangle aBound; - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const size_t nMarkCount=rMarkList.GetMarkCount(); bool bHasFixed=false; for (size_t nm=0; nmGetMarkedSdrObj(); SdrObjTransformInfoRec aInfo; pObj->TakeObjInfo(aInfo); @@ -1941,9 +1965,9 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert) { if (nMarkCount==1) { // align single object to page - const SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + const SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); const SdrPage* pPage=pObj->getSdrPageFromSdrObject(); - const SdrPageGridFrameList* pGFL=pPage->GetGridFrameList(GetMarkedObjectList().GetMark(0)->GetPageView(),&(pObj->GetSnapRect())); + const SdrPageGridFrameList* pGFL=pPage->GetGridFrameList(rMarkList.GetMark(0)->GetPageView(),&(pObj->GetSnapRect())); const SdrPageGridFrame* pFrame=nullptr; if (pGFL!=nullptr && pGFL->GetCount()!=0) { // Writer @@ -1969,7 +1993,7 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert) Point aCenter(aBound.Center()); for (size_t nm=0; nmGetMarkedSdrObj(); SdrObjTransformInfoRec aInfo; pObj->TakeObjInfo(aInfo); diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 72e7c4737860..59c5bfe5af3e 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -71,19 +71,20 @@ void SdrEditView::ObjOrderChanged(SdrObject* /*pObj*/, size_t /*nOldPos*/, size_ void SdrEditView::MovMarkedToTop() { - const size_t nCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount=rMarkList.GetMarkCount(); if (nCount==0) return; const bool bUndo = IsUndoEnabled(); if( bUndo ) - BegUndo(SvxResId(STR_EditMovToTop),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::MoveToTop); + BegUndo(SvxResId(STR_EditMovToTop),rMarkList.GetMarkDescription(),SdrRepeatFunc::MoveToTop); - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); for (size_t nm=0; nmGetMarkedSdrObj()->GetOrdNum(); + rMarkList.GetMark(nm)->GetMarkedSdrObj()->GetOrdNum(); } bool bChg=false; SdrObjList* pOL0=nullptr; @@ -91,7 +92,7 @@ void SdrEditView::MovMarkedToTop() for (size_t nm=nCount; nm>0;) { --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) @@ -159,19 +160,20 @@ void SdrEditView::MovMarkedToTop() void SdrEditView::MovMarkedToBtm() { - const size_t nCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount=rMarkList.GetMarkCount(); if (nCount==0) return; const bool bUndo = IsUndoEnabled(); if( bUndo ) - BegUndo(SvxResId(STR_EditMovToBtm),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::MoveToBottom); + BegUndo(SvxResId(STR_EditMovToBtm),rMarkList.GetMarkDescription(),SdrRepeatFunc::MoveToBottom); - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); for (size_t nm=0; nmGetMarkedSdrObj()->GetOrdNum(); + rMarkList.GetMark(nm)->GetMarkedSdrObj()->GetOrdNum(); } bool bChg=false; @@ -179,7 +181,7 @@ void SdrEditView::MovMarkedToBtm() size_t nNewPos=0; for (size_t nm=0; nmGetMarkedSdrObj(); SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) @@ -255,37 +257,38 @@ void SdrEditView::PutMarkedToTop() void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) { - const size_t nCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount=rMarkList.GetMarkCount(); if (nCount==0) return; const bool bUndo = IsUndoEnabled(); if( bUndo ) - BegUndo(SvxResId(STR_EditPutToTop),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::PutToTop); + BegUndo(SvxResId(STR_EditPutToTop),rMarkList.GetMarkDescription(),SdrRepeatFunc::PutToTop); - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); if (pRefObj!=nullptr) { // Make "in front of the object" work, even if the // selected objects are already in front of the other object - const size_t nRefMark=GetMarkedObjectList().FindObject(pRefObj); + const size_t nRefMark=rMarkList.FindObject(pRefObj); SdrMark aRefMark; if (nRefMark!=SAL_MAX_SIZE) { - aRefMark=*GetMarkedObjectList().GetMark(nRefMark); + aRefMark=*rMarkList.GetMark(nRefMark); GetMarkedObjectListWriteAccess().DeleteMark(nRefMark); } PutMarkedToBtm(); if (nRefMark!=SAL_MAX_SIZE) { GetMarkedObjectListWriteAccess().InsertEntry(aRefMark); - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); } } for (size_t nm=0; nmGetMarkedSdrObj()->GetOrdNum(); + rMarkList.GetMark(nm)->GetMarkedSdrObj()->GetOrdNum(); } bool bChg=false; SdrObjList* pOL0=nullptr; @@ -293,7 +296,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) for (size_t nm=nCount; nm>0;) { --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); if (pObj!=pRefObj) { @@ -356,42 +359,43 @@ void SdrEditView::PutMarkedToBtm() void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj) { - const size_t nCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount=rMarkList.GetMarkCount(); if (nCount==0) return; const bool bUndo = IsUndoEnabled(); if( bUndo ) - BegUndo(SvxResId(STR_EditPutToBtm),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::PutToBottom); + BegUndo(SvxResId(STR_EditPutToBtm),rMarkList.GetMarkDescription(),SdrRepeatFunc::PutToBottom); - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); if (pRefObj!=nullptr) { // Make "behind the object" work, even if the // selected objects are already behind the other object - const size_t nRefMark=GetMarkedObjectList().FindObject(pRefObj); + const size_t nRefMark=rMarkList.FindObject(pRefObj); SdrMark aRefMark; if (nRefMark!=SAL_MAX_SIZE) { - aRefMark=*GetMarkedObjectList().GetMark(nRefMark); + aRefMark=*rMarkList.GetMark(nRefMark); GetMarkedObjectListWriteAccess().DeleteMark(nRefMark); } PutMarkedToTop(); if (nRefMark!=SAL_MAX_SIZE) { GetMarkedObjectListWriteAccess().InsertEntry(aRefMark); - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); } } for (size_t nm=0; nmGetMarkedSdrObj()->GetOrdNum(); + rMarkList.GetMark(nm)->GetMarkedSdrObj()->GetOrdNum(); } bool bChg=false; SdrObjList* pOL0=nullptr; size_t nNewPos=0; for (size_t nm=0; nmGetMarkedSdrObj(); if (pObj!=pRefObj) { SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); @@ -436,8 +440,9 @@ void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj) void SdrEditView::ReverseOrderOfMarked() { - GetMarkedObjectList().ForceSort(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); + const size_t nMarkCount=rMarkList.GetMarkCount(); if (nMarkCount<=0) return; @@ -445,22 +450,22 @@ void SdrEditView::ReverseOrderOfMarked() bool bUndo = IsUndoEnabled(); if( bUndo ) - BegUndo(SvxResId(STR_EditRevOrder),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::ReverseOrder); + BegUndo(SvxResId(STR_EditRevOrder),rMarkList.GetMarkDescription(),SdrRepeatFunc::ReverseOrder); size_t a=0; do { // take into account selection across multiple PageViews size_t b=a+1; - while (bGetPageView() == GetMarkedObjectList().GetMark(a)->GetPageView()) ++b; + while (bGetPageView() == rMarkList.GetMark(a)->GetPageView()) ++b; --b; - SdrObjList* pOL=GetMarkedObjectList().GetMark(a)->GetPageView()->GetObjList(); + SdrObjList* pOL=rMarkList.GetMark(a)->GetPageView()->GetObjList(); size_t c=b; if (aGetMarkedSdrObj()->GetOrdNum(); + rMarkList.GetMark(a)->GetMarkedSdrObj()->GetOrdNum(); } while (aGetMarkedSdrObj(); - SdrObject* pObj2=GetMarkedObjectList().GetMark(c)->GetMarkedSdrObj(); + SdrObject* pObj1=rMarkList.GetMark(a)->GetMarkedSdrObj(); + SdrObject* pObj2=rMarkList.GetMark(c)->GetMarkedSdrObj(); const size_t nOrd1=pObj1->GetOrdNumDirect(); const size_t nOrd2=pObj2->GetOrdNumDirect(); if( bUndo ) @@ -488,12 +493,13 @@ void SdrEditView::ReverseOrderOfMarked() void SdrEditView::ImpCheckToTopBtmPossible() { - const size_t nCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nCount=rMarkList.GetMarkCount(); if (nCount==0) return; if (nCount==1) { // special-casing for single selection - SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); SAL_WARN_IF(!pOL, "svx", "Object somehow has no ObjList"); size_t nMax = pOL ? pOL->GetObjCount() : 0; @@ -515,7 +521,7 @@ void SdrEditView::ImpCheckToTopBtmPossible() SdrObjList* pOL0=nullptr; size_t nPos0 = 0; for (size_t nm = 0; !m_bToBtmPossible && nmGetMarkedSdrObj(); + SdrObject* pObj=rMarkList.GetMark(nm)->GetMarkedSdrObj(); SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { nPos0 = 0; @@ -530,7 +536,7 @@ void SdrEditView::ImpCheckToTopBtmPossible() nPos0 = SAL_MAX_SIZE; for (size_t nm=nCount; !m_bToTopPossible && nm>0; ) { // check 'bring to front' --nm; - SdrObject* pObj=GetMarkedObjectList().GetMark(nm)->GetMarkedSdrObj(); + SdrObject* pObj=rMarkList.GetMark(nm)->GetMarkedSdrObj(); SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); if (pOL!=pOL0) { nPos0=pOL->GetObjCount(); @@ -773,7 +779,8 @@ typedef std::vector ImpDistributeEntryList; void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) { - const size_t nMark(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMark(rMarkList.GetMarkCount()); if(nMark <= 2) return; @@ -808,7 +815,7 @@ void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) for( size_t a = 0; a < nMark; ++a ) { - SdrMark* pMark = GetMarkedObjectList().GetMark(a); + SdrMark* pMark = rMarkList.GetMark(a); ImpDistributeEntry aNew; aNew.mpObj = pMark->GetMarkedSdrObj(); @@ -899,7 +906,7 @@ void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) for( size_t a = 0; a < nMark; ++a ) { - SdrMark* pMark = GetMarkedObjectList().GetMark(a); + SdrMark* pMark = rMarkList.GetMark(a); ImpDistributeEntry aNew; aNew.mpObj = pMark->GetMarkedSdrObj(); @@ -992,12 +999,13 @@ void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) { + const SdrMarkList& rMarkList = GetMarkedObjectList(); // #i73441# check content - if(GetMarkedObjectList().GetMarkCount() == 0) + if(rMarkList.GetMarkCount() == 0) return; SdrMarkList aRemove; - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); const bool bUndo = IsUndoEnabled(); @@ -1019,11 +1027,11 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) // mechanisms. In a next step the polygon clipper will even be able to clip curves... // ConvertMarkedToPolyObj(true); ConvertMarkedToPathObj(true); - OSL_ENSURE(GetMarkedObjectList().GetMarkCount() != 0, "no more objects selected after preparations (!)"); + OSL_ENSURE(rMarkList.GetMarkCount() != 0, "no more objects selected after preparations (!)"); - for(size_t a=0; aGetMarkedSdrObj(); if(ImpCanConvertForCombine(pObj)) @@ -1235,7 +1243,8 @@ void SdrEditView::CombineMarkedTextObjects() SdrOutliner& rDrawOutliner = getSdrModelFromSdrView().GetDrawOutliner(); - SdrObjListIter aIter( GetMarkedObjectList(), SdrIterMode::Flat); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + SdrObjListIter aIter( rMarkList, SdrIterMode::Flat); while ( aIter.IsMore() ) { SdrObject* pObj = aIter.Next(); @@ -1268,7 +1277,7 @@ void SdrEditView::CombineMarkedTextObjects() MarkListHasChanged(); AdjustMarkHdl(); - if ( GetMarkedObjectList().GetMarkCount() > 1 ) + if ( rMarkList.GetMarkCount() > 1 ) { rtl::Reference pReplacement = new SdrRectObj( getSdrModelFromSdrView(), SdrObjKind::Text ); pReplacement->SetOutlinerParaObject( rDrawOutliner.CreateParaObject() ); @@ -1327,16 +1336,17 @@ void SdrEditView::CombineMarkedObjects(bool bNoPolyPoly) SdrObjList* pCurrentOL = nullptr; SdrMarkList aRemoveBuffer; - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); size_t nInsPos = SAL_MAX_SIZE; SdrObjList* pInsOL = nullptr; SdrPageView* pInsPV = nullptr; const SdrObject* pAttrObj = nullptr; - for(size_t a = GetMarkedObjectList().GetMarkCount(); a; ) + for(size_t a = rMarkList.GetMarkCount(); a; ) { --a; - SdrMark* pM = GetMarkedObjectList().GetMark(a); + SdrMark* pM = rMarkList.GetMark(a); SdrObject* pObj = pM->GetMarkedSdrObj(); SdrObjList* pThisOL = pObj->getParentSdrObjListFromSdrObject(); @@ -1724,7 +1734,8 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines) // temporary MarkList SdrMarkList aRemoveBuffer; - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); const bool bUndo = IsUndoEnabled(); @@ -1737,9 +1748,9 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines) SdrObjList* pOL0=nullptr; const bool bWasLocked = GetModel().isLocked(); GetModel().setLock(true); - for (size_t nm=GetMarkedObjectList().GetMarkCount(); nm>0;) { + for (size_t nm=rMarkList.GetMarkCount(); nm>0;) { --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); @@ -1781,21 +1792,22 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines) void SdrEditView::GroupMarked() { - if (GetMarkedObjectList().GetMarkCount() == 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() == 0) return; - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); const bool bUndo = IsUndoEnabled(); if( bUndo ) { - BegUndo(SvxResId(STR_EditGroup),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::Group); + BegUndo(SvxResId(STR_EditGroup),rMarkList.GetMarkDescription(),SdrRepeatFunc::Group); - for(size_t nm = GetMarkedObjectList().GetMarkCount(); nm>0; ) + for(size_t nm = rMarkList.GetMarkCount(); nm>0; ) { // add UndoActions for all affected objects --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); SdrObject* pObj = pM->GetMarkedSdrObj(); AddUndoActions( CreateConnectorUndo( *pObj ) ); AddUndo(GetModel().GetSdrUndoFactory().CreateUndoRemoveObject( *pObj )); @@ -1819,10 +1831,10 @@ void SdrEditView::GroupMarked() // the group object is the last one in the list. size_t nInsPos=pSrcLst->GetObjCount(); bool bNeedInsPos=true; - for (size_t nm=GetMarkedObjectList().GetMarkCount(); nm>0;) + for (size_t nm=rMarkList.GetMarkCount(); nm>0;) { --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); if (pM->GetPageView()==pPV) { SdrObject* pObj=pM->GetMarkedSdrObj(); @@ -1892,9 +1904,10 @@ void SdrEditView::UnGroupMarked() OUString aName1; OUString aName; bool bNameOk=false; - for (size_t nm=GetMarkedObjectList().GetMarkCount(); nm>0;) { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + for (size_t nm=rMarkList.GetMarkCount(); nm>0;) { --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); SdrObject* pGrp=pM->GetMarkedSdrObj(); SdrObjList* pSrcLst=pGrp->GetSubList(); if (pSrcLst!=nullptr) { @@ -2031,11 +2044,12 @@ rtl::Reference SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bP void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea) { - if (GetMarkedObjectList().GetMarkCount() == 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() == 0) return; bool bMrkChg = false; - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const size_t nMarkCount=rMarkList.GetMarkCount(); TranslateId pDscrID; if(bLineToArea) { @@ -2044,23 +2058,23 @@ void SdrEditView::ImpConvertTo(bool bPath, bool bLineToArea) else pDscrID = STR_EditConvToContours; - BegUndo(SvxResId(pDscrID), GetMarkedObjectList().GetMarkDescription()); + BegUndo(SvxResId(pDscrID), rMarkList.GetMarkDescription()); } else { if (bPath) { if (nMarkCount==1) pDscrID=STR_EditConvToCurve; else pDscrID=STR_EditConvToCurves; - BegUndo(SvxResId(pDscrID),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::ConvertToPath); + BegUndo(SvxResId(pDscrID),rMarkList.GetMarkDescription(),SdrRepeatFunc::ConvertToPath); } else { if (nMarkCount==1) pDscrID=STR_EditConvToPoly; else pDscrID=STR_EditConvToPolys; - BegUndo(SvxResId(pDscrID),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::ConvertToPoly); + BegUndo(SvxResId(pDscrID),rMarkList.GetMarkDescription(),SdrRepeatFunc::ConvertToPoly); } } for (size_t nm=nMarkCount; nm>0;) { --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); if (pObj->IsGroupObject() && !pObj->Is3DObj()) { @@ -2115,10 +2129,11 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) if( bUndo ) BegUndo(u""_ustr, u""_ustr, SdrRepeatFunc::ImportMtf); - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); SdrMarkList aForTheDescription; SdrMarkList aNewMarked; - for (size_t nm =GetMarkedObjectList().GetMarkCount(); nm > 0; ) + for (size_t nm =rMarkList.GetMarkCount(); nm > 0; ) { // create Undo objects for all new objects // check for cancellation between the metafiles @@ -2130,7 +2145,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) } --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject(); @@ -2216,7 +2231,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); // remove object from selection and delete - GetMarkedObjectListWriteAccess().DeleteMark(GetMarkedObjectList().FindObject(pObj)); + GetMarkedObjectListWriteAccess().DeleteMark(rMarkList.FindObject(pObj)); pOL->RemoveObject(nInsPos-1); } } @@ -2229,7 +2244,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) GetMarkedObjectListWriteAccess().InsertEntry(*aNewMarked.GetMark(a)); } - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); } if (bUndo) diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index a7d61b0c97f6..6071fbc042bd 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -2320,12 +2320,13 @@ SvtScriptType SdrObjEditView::GetScriptType() const } else { - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); for (size_t i = 0; i < nMarkCount; ++i) { OutlinerParaObject* pParaObj - = GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj()->GetOutlinerParaObject(); + = rMarkList.GetMark(i)->GetMarkedSdrObj()->GetOutlinerParaObject(); if (pParaObj) { @@ -2367,8 +2368,8 @@ void SdrObjEditView::GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) c rTargetSet.Put(mpTextEditOutlinerView->GetAttribs(), false); } - if (GetMarkedObjectList().GetMarkCount() == 1 - && GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj() == pText.get()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() == 1 && rMarkList.GetMark(0)->GetMarkedSdrObj() == pText.get()) { MergeNotPersistAttrFromMarked(rTargetSet); } @@ -2497,8 +2498,9 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) pTextEditObj->SetMergedItemSetAndBroadcast(aSet, bReplaceAll); - if (GetMarkedObjectList().GetMarkCount() == 1 - && GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj() == pTextEditObj.get()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() == 1 + && rMarkList.GetMark(0)->GetMarkedSdrObj() == pTextEditObj.get()) { SetNotPersistAttrToMarked(aSet); } diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx index 20a560e32675..e2b2076b959a 100644 --- a/svx/source/svdraw/svdglev.cxx +++ b/svx/source/svdraw/svdglev.cxx @@ -41,9 +41,10 @@ SdrGlueEditView::~SdrGlueEditView() void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, const void* p1, const void* p2, const void* p3, const void* p4) { - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); const SdrUShortCont& rPts = pM->GetMarkedGluePoints(); if (!rPts.empty()) @@ -119,7 +120,8 @@ static void ImpSetEscDir(SdrGluePoint& rGP, const SdrObject* /*pObj*/, const voi void SdrGlueEditView::SetMarkedGluePointsEscDir(SdrEscapeDirection nThisEsc, bool bOn) { ForceUndirtyMrkPnt(); - BegUndo(SvxResId(STR_EditSetGlueEscDir),GetMarkedObjectList().GetGluePointMarkDescription()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(SvxResId(STR_EditSetGlueEscDir),rMarkList.GetGluePointMarkDescription()); ImpDoMarkedGluePoints(ImpSetEscDir,false,&nThisEsc,&bOn); EndUndo(); } @@ -159,7 +161,8 @@ static void ImpSetPercent(SdrGluePoint& rGP, const SdrObject* pObj, const void* void SdrGlueEditView::SetMarkedGluePointsPercent(bool bOn) { ForceUndirtyMrkPnt(); - BegUndo(SvxResId(STR_EditSetGluePercent),GetMarkedObjectList().GetGluePointMarkDescription()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(SvxResId(STR_EditSetGluePercent),rMarkList.GetGluePointMarkDescription()); ImpDoMarkedGluePoints(ImpSetPercent,false,&bOn); EndUndo(); } @@ -215,7 +218,8 @@ static void ImpSetAlign(SdrGluePoint& rGP, const SdrObject* pObj, const void* pb void SdrGlueEditView::SetMarkedGluePointsAlign(bool bVert, SdrAlign nAlign) { ForceUndirtyMrkPnt(); - BegUndo(SvxResId(STR_EditSetGlueAlign),GetMarkedObjectList().GetGluePointMarkDescription()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(SvxResId(STR_EditSetGlueAlign),rMarkList.GetGluePointMarkDescription()); ImpDoMarkedGluePoints(ImpSetAlign,false,&bVert,&nAlign); EndUndo(); } @@ -225,13 +229,14 @@ void SdrGlueEditView::DeleteMarkedGluePoints() BrkAction(); ForceUndirtyMrkPnt(); const bool bUndo = IsUndoEnabled(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); if( bUndo ) - BegUndo(SvxResId(STR_EditDelete),GetMarkedObjectList().GetGluePointMarkDescription(),SdrRepeatFunc::Delete); + BegUndo(SvxResId(STR_EditDelete),rMarkList.GetGluePointMarkDescription(),SdrRepeatFunc::Delete); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); const SdrUShortCont& rPts = pM->GetMarkedGluePoints(); if (!rPts.empty()) @@ -270,10 +275,11 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints() if( bUndo ) BegUndo(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); SdrUShortCont& rPts = pM->GetMarkedGluePoints(); SdrGluePointList* pGPL=pObj->ForceGluePointList(); @@ -311,9 +317,10 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints() void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const void* p1, const void* p2, const void* p3, const void* p4) { - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); const SdrUShortCont& rPts = pM->GetMarkedGluePoints(); if (!rPts.empty()) { @@ -354,7 +361,8 @@ void SdrGlueEditView::MoveMarkedGluePoints(const Size& rSiz, bool bCopy) ForceUndirtyMrkPnt(); OUString aStr(SvxResId(STR_EditMove)); if (bCopy) aStr += SvxResId(STR_EditWithCopy); - BegUndo(aStr,GetMarkedObjectList().GetGluePointMarkDescription(),SdrRepeatFunc::Move); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(aStr,rMarkList.GetGluePointMarkDescription(),SdrRepeatFunc::Move); if (bCopy) ImpCopyMarkedGluePoints(); ImpTransformMarkedGluePoints(ImpMove,&rSiz); EndUndo(); @@ -372,7 +380,8 @@ void SdrGlueEditView::ResizeMarkedGluePoints(const Point& rRef, const Fraction& ForceUndirtyMrkPnt(); OUString aStr(SvxResId(STR_EditResize)); if (bCopy) aStr+=SvxResId(STR_EditWithCopy); - BegUndo(aStr,GetMarkedObjectList().GetGluePointMarkDescription(),SdrRepeatFunc::Resize); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(aStr,rMarkList.GetGluePointMarkDescription(),SdrRepeatFunc::Resize); if (bCopy) ImpCopyMarkedGluePoints(); ImpTransformMarkedGluePoints(ImpResize,&rRef,&xFact,&yFact); EndUndo(); @@ -390,7 +399,8 @@ void SdrGlueEditView::RotateMarkedGluePoints(const Point& rRef, Degree100 nAngle ForceUndirtyMrkPnt(); OUString aStr(SvxResId(STR_EditRotate)); if (bCopy) aStr+=SvxResId(STR_EditWithCopy); - BegUndo(aStr,GetMarkedObjectList().GetGluePointMarkDescription(),SdrRepeatFunc::Rotate); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(aStr,rMarkList.GetGluePointMarkDescription(),SdrRepeatFunc::Rotate); if (bCopy) ImpCopyMarkedGluePoints(); double nSin = sin(toRadians(nAngle)); double nCos = cos(toRadians(nAngle)); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 256345560b30..1b44fb021edf 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -224,7 +224,8 @@ void SdrMarkView::ModelHasChanged() // In another View 2, the ObjOrder is changed (e. g. MovToTop()) // Then we need to re-sort MarkList. GetMarkedObjectListWriteAccess().SetUnsorted(); - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); mbMrkPntDirty=true; UndirtyMrkPnt(); SdrView* pV=static_cast(this); @@ -238,7 +239,8 @@ void SdrMarkView::ModelHasChanged() void SdrMarkView::modelHasChangedLOKit() { - if (GetMarkedObjectList().GetMarkCount() <= 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() <= 0) return; //TODO: Is MarkedObjRect valid at this point? @@ -601,12 +603,13 @@ void SdrMarkView::showMarkHandles() bool SdrMarkView::ImpIsFrameHandles() const { - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); bool bFrmHdl=nMarkCount>static_cast(mnFrameHandlesLimit) || mbForceFrameHandles; bool bStdDrag=meDragMode==SdrDragMode::Move; if (nMarkCount==1 && bStdDrag && bFrmHdl) { - const SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + const SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); if (pObj && pObj->GetObjInventor()==SdrInventor::Default) { SdrObjKind nIdent=pObj->GetObjIdentifier(); @@ -622,7 +625,7 @@ bool SdrMarkView::ImpIsFrameHandles() const if (meDragMode==SdrDragMode::Rotate) { // when rotating, use ObjOwn drag, if there's at least 1 PolyObj for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); bFrmHdl=!pObj->IsPolyObj(); } @@ -631,7 +634,7 @@ bool SdrMarkView::ImpIsFrameHandles() const if (!bFrmHdl) { // FrameHandles, if at least 1 Obj can't do SpecialDrag for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); bFrmHdl=!pObj->hasSpecialDrag(); } @@ -712,11 +715,12 @@ bool SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree) if (!pOL) return false; boost::property_tree::ptree elements; + const SdrMarkList& rMarkList = GetMarkedObjectList(); for (const rtl::Reference& pObj : *pOL) { if (!pObj) continue; - if (pObj == GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()) + if (pObj == rMarkList.GetMark(0)->GetMarkedSdrObj()) continue; const SdrGluePointList* pGPL = pObj->GetGluePointList(); bool VertexObject = !(pGPL && pGPL->GetCount()); @@ -902,9 +906,10 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S SdrPageView* pPageView = GetSdrPageView(); - if (GetMarkedObjectList().GetMarkCount()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount()) { - SdrMark* pM = GetMarkedObjectList().GetMark(0); + SdrMark* pM = rMarkList.GetMark(0); SdrObject* pO = pM->GetMarkedSdrObj(); Degree100 nRotAngle = pO->GetRotateAngle(); // true if we are dealing with a RotGrfFlyFrame @@ -934,7 +939,7 @@ void SdrMarkView::SetMarkHandlesForLOKit(tools::Rectangle const & rRect, const S // whether the shape is rotated or not, we will always have the correct gridOffset // Note that the gridOffset is calculated from the first selected obj basegfx::B2DVector aGridOffset(0.0, 0.0); - if(getPossibleGridOffsetForSdrObject(aGridOffset, GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), pPageView)) + if(getPossibleGridOffsetForSdrObject(aGridOffset, rMarkList.GetMark(0)->GetMarkedSdrObj(), pPageView)) { Point p(aGridOffset.getX(), aGridOffset.getY()); if (convertMapMode) @@ -1271,14 +1276,15 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) // There can be multiple mark views, but we're only interested in the one that has a window associated. const bool bTiledRendering = comphelper::LibreOfficeKit::isActive() && GetFirstOutputDevice() && GetFirstOutputDevice()->GetOutDevType() == OUTDEV_WINDOW; - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); bool bStdDrag=meDragMode==SdrDragMode::Move; bool bSingleTextObjMark=false; bool bLimitedRotation(false); if (nMarkCount==1) { - mpMarkedObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + mpMarkedObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); if(nullptr != mpMarkedObj) { @@ -1295,11 +1301,11 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) if (nMarkCount>0) { - mpMarkedPV=GetMarkedObjectList().GetMark(0)->GetPageView(); + mpMarkedPV=rMarkList.GetMark(0)->GetPageView(); for (size_t nMarkNum=0; nMarkNumGetPageView()) { @@ -1465,7 +1471,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) { for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); const size_t nSiz0=maHdlList.GetHdlCount(); @@ -1507,7 +1513,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) // GluePoint handles for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); const SdrGluePointList* pGPL=pObj->GetGluePointList(); if (!pGPL) @@ -1584,7 +1590,8 @@ void SdrMarkView::SetDragMode(SdrDragMode eMode) ForceRefToMarked(); SetMarkHandles(nullptr); { - if (GetMarkedObjectList().GetMarkCount() != 0) MarkListHasChanged(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() != 0) MarkListHasChanged(); } } } @@ -1619,10 +1626,11 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) case SdrDragMode::Transparence: { // add interactive transparency handle - const size_t nMarkCount = GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount = rMarkList.GetMarkCount(); if(nMarkCount == 1) { - SdrObject* pObj = GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); SdrModel& rModel = GetModel(); const SfxItemSet& rSet = pObj->GetMergedItemSet(); @@ -1681,10 +1689,11 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) case SdrDragMode::Gradient: { // add interactive gradient handle - const size_t nMarkCount = GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount = rMarkList.GetMarkCount(); if(nMarkCount == 1) { - SdrObject* pObj = GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); const SfxItemSet& rSet = pObj->GetMergedItemSet(); drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue(); @@ -1905,9 +1914,10 @@ SfxViewShell* SdrMarkView::GetSfxViewShell() const void SdrMarkView::CheckMarked() { - for (size_t nm=GetMarkedObjectList().GetMarkCount(); nm>0;) { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + for (size_t nm=rMarkList.GetMarkCount(); nm>0;) { --nm; - SdrMark* pM = GetMarkedObjectList().GetMark(nm); + SdrMark* pM = rMarkList.GetMark(nm); SdrObject* pObj = pM->GetMarkedSdrObj(); SdrPageView* pPV = pM->GetPageView(); bool bRaus = !pObj || !pPV->IsObjMarkable(pObj); @@ -1935,8 +1945,9 @@ void SdrMarkView::SetMarkRects() if(pPV) { - pPV->SetHasMarkedObj(GetMarkedObjectList().TakeSnapRect(pPV, pPV->MarkSnap())); - GetMarkedObjectList().TakeBoundRect(pPV, pPV->MarkBound()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + pPV->SetHasMarkedObj(rMarkList.TakeSnapRect(pPV, pPV->MarkSnap())); + rMarkList.TakeBoundRect(pPV, pPV->MarkBound()); } } @@ -1990,8 +2001,9 @@ bool SdrMarkView::IsMarkedObjHit(const Point& rPnt, short nTol) const { bool bRet=false; nTol=ImpGetHitTolLogic(nTol,nullptr); - for (size_t nm=0; nmGetMarkedSdrObj(),pM->GetPageView(),SdrSearchOptions::NONE,nullptr); } return bRet; @@ -2028,13 +2040,14 @@ bool SdrMarkView::MarkNextObj(bool bPrev) return false; } - GetMarkedObjectList().ForceSort(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); + const size_t nMarkCount=rMarkList.GetMarkCount(); size_t nChgMarkNum = SAL_MAX_SIZE; // number of the MarkEntry we want to replace size_t nSearchObjNum = bPrev ? 0 : SAL_MAX_SIZE; if (nMarkCount!=0) { nChgMarkNum=bPrev ? 0 : nMarkCount-1; - SdrMark* pM=GetMarkedObjectList().GetMark(nChgMarkNum); + SdrMark* pM=rMarkList.GetMark(nChgMarkNum); assert(pM != nullptr); if (pM->GetMarkedSdrObj() != nullptr) nSearchObjNum = pM->GetMarkedSdrObj()->GetNavigationPosition(); @@ -2052,7 +2065,7 @@ bool SdrMarkView::MarkNextObj(bool bPrev) SdrObject* pSearchObj = pSearchObjList->GetObjectForNavigationPosition(nSearchObjNum); if (IsObjMarkable(pSearchObj,pPageView)) { - if (GetMarkedObjectList().FindObject(pSearchObj)==SAL_MAX_SIZE) + if (rMarkList.FindObject(pSearchObj)==SAL_MAX_SIZE) { pMarkObj=pSearchObj; } @@ -2076,17 +2089,18 @@ bool SdrMarkView::MarkNextObj(bool bPrev) bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev) { - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); nTol=ImpGetHitTolLogic(nTol,nullptr); SdrMark* pTopMarkHit=nullptr; SdrMark* pBtmMarkHit=nullptr; size_t nTopMarkHit=0; size_t nBtmMarkHit=0; // find topmost of the selected objects that is hit by rPnt - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=nMarkCount; nm>0 && pTopMarkHit==nullptr;) { --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); if(CheckSingleSdrObjectHit(rPnt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pM->GetPageView(),SdrSearchOptions::NONE,nullptr)) { pTopMarkHit=pM; @@ -2102,7 +2116,7 @@ bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev) // find lowermost of the selected objects that is hit by rPnt // and is placed on the same PageView as pTopMarkHit for (size_t nm=0; nmGetPageView(); if (pPV2==pPV && CheckSingleSdrObjectHit(rPnt,sal_uInt16(nTol),pM->GetMarkedSdrObj(),pPV2,SdrSearchOptions::NONE,nullptr)) { @@ -2165,7 +2179,7 @@ bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev) if (CheckSingleSdrObjectHit(rPnt,sal_uInt16(nTol),pObj,pPV,SdrSearchOptions::TESTMARKABLE,nullptr)) { - if (GetMarkedObjectList().FindObject(pObj)==SAL_MAX_SIZE) { + if (rMarkList.FindObject(pObj)==SAL_MAX_SIZE) { pFndObj=pObj; } else { // TODO: for performance reasons set on to Top or Btm, if necessary @@ -2191,6 +2205,7 @@ void SdrMarkView::MarkObj(const tools::Rectangle& rRect, bool bUnmark) BrkAction(); SdrPageView* pPV = GetSdrPageView(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); if(pPV) { pObjList=pPV->GetObjList(); @@ -2205,7 +2220,7 @@ void SdrMarkView::MarkObj(const tools::Rectangle& rRect, bool bUnmark) bFnd=true; } } else { - const size_t nPos=GetMarkedObjectList().FindObject(pObj.get()); + const size_t nPos=rMarkList.FindObject(pObj.get()); if (nPos!=SAL_MAX_SIZE) { GetMarkedObjectListWriteAccess().DeleteMark(nPos); @@ -2216,7 +2231,7 @@ void SdrMarkView::MarkObj(const tools::Rectangle& rRect, bool bUnmark) } } if (bFnd) { - GetMarkedObjectList().ForceSort(); + rMarkList.ForceSort(); MarkListHasChanged(); AdjustMarkHdl(); } @@ -2255,7 +2270,8 @@ void collectUIInformation(const SdrObject* pObj) } else { - const size_t nPos=GetMarkedObjectList().FindObject(pObj); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nPos=rMarkList.FindObject(pObj); if (nPos!=SAL_MAX_SIZE) { GetMarkedObjectListWriteAccess().DeleteMark(nPos); @@ -2272,7 +2288,8 @@ void collectUIInformation(const SdrObject* pObj) bool SdrMarkView::IsObjMarked(SdrObject const * pObj) const { - return GetMarkedObjectList().FindObject(pObj)!=SAL_MAX_SIZE; + const SdrMarkList& rMarkList = GetMarkedObjectList(); + return rMarkList.FindObject(pObj)!=SAL_MAX_SIZE; } sal_uInt16 SdrMarkView::GetMarkHdlSizePixel() const @@ -2488,7 +2505,8 @@ SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpP SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpPV, SdrSearchOptions nOptions, SdrObject** ppRootObj, bool* pbHitPassDirect) const { // TODO: lacks a Pass2,Pass3 - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); if (ppRootObj!=nullptr) *ppRootObj=nullptr; if (pbHitPassDirect!=nullptr) *pbHitPassDirect=true; SdrObject* pRet = nullptr; @@ -2508,11 +2526,11 @@ SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpP pPV=static_cast(this)->GetTextEditPageView(); } if (bMarked) { - const size_t nMrkCnt=GetMarkedObjectList().GetMarkCount(); + const size_t nMrkCnt=rMarkList.GetMarkCount(); size_t nMrkNum=nMrkCnt; while (pHitObj==nullptr && nMrkNum>0) { nMrkNum--; - SdrMark* pM=GetMarkedObjectList().GetMark(nMrkNum); + SdrMark* pM=rMarkList.GetMark(nMrkNum); pObj=pM->GetMarkedSdrObj(); pPV=pM->GetPageView(); pHitObj=CheckSingleSdrObjectHit(rPnt,nTol,pObj,pPV,nOptions,nullptr); @@ -2559,7 +2577,7 @@ SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpP if (pbHitPassDirect!=nullptr) *pbHitPassDirect = false; nTmpOptions=nTmpOptions | SdrSearchOptions::IMPISMASTER; } - pHitObj=CheckSingleSdrObjectHit(rPnt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj,&(GetMarkedObjectList())); + pHitObj=CheckSingleSdrObjectHit(rPnt,nTol,pObjList,pPV,nTmpOptions,pMVisLay,pObj,&rMarkList); } } } @@ -2591,14 +2609,15 @@ SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpP bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions) const { - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); const bool bBoundCheckOn2ndPass(nOptions & SdrSearchOptions::PASS2BOUND); rpObj=nullptr; rpPV=nullptr; - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nMarkNum=nMarkCount; nMarkNum>0;) { --nMarkNum; - SdrMark* pM=GetMarkedObjectList().GetMark(nMarkNum); + SdrMark* pM=rMarkList.GetMark(nMarkNum); SdrPageView* pPV=pM->GetPageView(); SdrObject* pObj=pM->GetMarkedSdrObj(); if (CheckSingleSdrObjectHit(rPnt,mnHitTolLog,pObj,pPV,SdrSearchOptions::TESTMARKABLE,nullptr)) { @@ -2610,7 +2629,7 @@ bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie if (bBoundCheckOn2ndPass) { for (size_t nMarkNum=nMarkCount; nMarkNum>0;) { --nMarkNum; - SdrMark* pM=GetMarkedObjectList().GetMark(nMarkNum); + SdrMark* pM=rMarkList.GetMark(nMarkNum); SdrPageView* pPV=pM->GetPageView(); SdrObject* pObj=pM->GetMarkedSdrObj(); tools::Rectangle aRect(pObj->GetCurrentBoundRect()); @@ -2631,7 +2650,8 @@ bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageVie void SdrMarkView::UnmarkAllObj(SdrPageView const * pPV) { - if (GetMarkedObjectList().GetMarkCount()==0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount()==0) return; BrkAction(); @@ -2670,7 +2690,8 @@ void SdrMarkView::MarkAllObj(SdrPageView* pPV) } } - if(GetMarkedObjectList().GetMarkCount()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if(rMarkList.GetMarkCount()) { AdjustMarkHdl(); } @@ -2686,9 +2707,10 @@ void SdrMarkView::AdjustMarkHdl(SfxViewShell* pOtherShell) // BoundRect in model coordinates, no GridOffset added tools::Rectangle SdrMarkView::GetMarkedObjBoundRect() const { + const SdrMarkList& rMarkList = GetMarkedObjectList(); tools::Rectangle aRect; - for (size_t nm=0; nmGetMarkedSdrObj(); tools::Rectangle aR1(pO->GetCurrentBoundRect()); if (aRect.IsEmpty()) aRect=aR1; @@ -2700,11 +2722,12 @@ tools::Rectangle SdrMarkView::GetMarkedObjBoundRect() const // ObjRect in model coordinates, no GridOffset added const tools::Rectangle& SdrMarkView::GetMarkedObjRect() const { + const SdrMarkList& rMarkList = GetMarkedObjectList(); if (mbMarkedObjRectDirty) { const_cast(this)->mbMarkedObjRectDirty=false; tools::Rectangle aRect; - for (size_t nm=0; nmGetMarkedSdrObj(); if (!pO) continue; @@ -2725,17 +2748,18 @@ OUString SdrMarkView::ImpGetDescriptionString(TranslateId pStrCacheID, ImpGetDes if(nPos != -1) { + const SdrMarkList& rMarkList = GetMarkedObjectList(); if(nOpt == ImpGetDescriptionOptions::POINTS) { - sStr = sStr.replaceAt(nPos, 2, GetMarkedObjectList().GetPointMarkDescription()); + sStr = sStr.replaceAt(nPos, 2, rMarkList.GetPointMarkDescription()); } else if(nOpt == ImpGetDescriptionOptions::GLUEPOINTS) { - sStr = sStr.replaceAt(nPos, 2, GetMarkedObjectList().GetGluePointMarkDescription()); + sStr = sStr.replaceAt(nPos, 2, rMarkList.GetGluePointMarkDescription()); } else { - sStr = sStr.replaceAt(nPos, 2, GetMarkedObjectList().GetMarkDescription()); + sStr = sStr.replaceAt(nPos, 2, rMarkList.GetMarkDescription()); } } @@ -2754,10 +2778,11 @@ void SdrMarkView::EnterMarkedGroup() return; bool bEnter=false; - for (size_t nm = GetMarkedObjectList().GetMarkCount(); nm > 0 && !bEnter;) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + for (size_t nm = rMarkList.GetMarkCount(); nm > 0 && !bEnter;) { --nm; - SdrMark* pM=GetMarkedObjectList().GetMark(nm); + SdrMark* pM=rMarkList.GetMark(nm); if (pM->GetPageView()==pPV) { SdrObject* pObj=pM->GetMarkedSdrObj(); if (pObj->IsGroupObject()) { @@ -2778,8 +2803,9 @@ void SdrMarkView::MarkListHasChanged() mbMarkedObjRectDirty=true; mbMarkedPointsRectsDirty=true; bool bOneEdgeMarked=false; - if (GetMarkedObjectList().GetMarkCount()==1) { - const SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount()==1) { + const SdrObject* pObj=rMarkList.GetMark(0)->GetMarkedSdrObj(); if (pObj->GetObjInventor()==SdrInventor::Default) { bOneEdgeMarked = pObj->GetObjIdentifier() == SdrObjKind::Edge; } diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx index dd628afc16ad..d3607dffac81 100644 --- a/svx/source/svdraw/svdmrkv1.cxx +++ b/svx/source/svdraw/svdmrkv1.cxx @@ -31,10 +31,11 @@ bool SdrMarkView::HasMarkablePoints() const ForceUndirtyMrkPnt(); bool bRet=false; if (!ImpIsFrameHandles()) { - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); if (nMarkCount<=static_cast(mnFrameHandlesLimit)) { for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); bRet=pObj->IsPolyObj(); } @@ -48,10 +49,11 @@ sal_Int32 SdrMarkView::GetMarkablePointCount() const ForceUndirtyMrkPnt(); sal_Int32 nCount=0; if (!ImpIsFrameHandles()) { - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); if (nMarkCount<=static_cast(mnFrameHandlesLimit)) { for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); if (pObj->IsPolyObj()) { nCount+=pObj->GetPointCount(); @@ -67,10 +69,11 @@ bool SdrMarkView::HasMarkedPoints() const ForceUndirtyMrkPnt(); bool bRet=false; if (!ImpIsFrameHandles()) { - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); if (nMarkCount<=static_cast(mnFrameHandlesLimit)) { for (size_t nMarkNum=0; nMarkNumGetMarkedPoints(); bRet = !rPts.empty(); } @@ -103,10 +106,11 @@ bool SdrMarkView::ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark) if (pMark==nullptr) { - const size_t nMarkNum=GetMarkedObjectList().FindObject(pObj); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkNum=rMarkList.FindObject(pObj); if (nMarkNum==SAL_MAX_SIZE) return false; - pMark=GetMarkedObjectList().GetMark(nMarkNum); + pMark=rMarkList.GetMark(nMarkNum); } const sal_uInt32 nHdlNum(pHdl->GetObjHdlNum()); SdrUShortCont& rPts=pMark->GetMarkedPoints(); @@ -170,9 +174,10 @@ bool SdrMarkView::MarkPoint(SdrHdl& rHdl, bool bUnmark) bool bRet=false; const SdrObject* pObj=rHdl.GetObj(); if (IsPointMarkable(rHdl) && rHdl.IsSelected()==bUnmark) { - const size_t nMarkNum=GetMarkedObjectList().FindObject(pObj); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkNum=rMarkList.FindObject(pObj); if (nMarkNum!=SAL_MAX_SIZE) { - SdrMark* pM=GetMarkedObjectList().GetMark(nMarkNum); + SdrMark* pM=rMarkList.GetMark(nMarkNum); if (ImpMarkPoint(&rHdl,pM,bUnmark)) { MarkListHasChanged(); bRet=true; @@ -187,7 +192,8 @@ bool SdrMarkView::MarkPoints(const tools::Rectangle* pRect, bool bUnmark) { ForceUndirtyMrkPnt(); bool bChgd=false; - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); const SdrObject* pObj0=nullptr; const SdrPageView* pPV0=nullptr; SdrMark* pM=nullptr; @@ -200,9 +206,9 @@ bool SdrMarkView::MarkPoints(const tools::Rectangle* pRect, bool bUnmark) const SdrObject* pObj=pHdl->GetObj(); const SdrPageView* pPV=pHdl->GetPageView(); if (pObj!=pObj0 || pPV!=pPV0 || pM==nullptr) { // This section is for optimization, - const size_t nMarkNum=GetMarkedObjectList().FindObject(pObj); // so ImpMarkPoint() doesn't always + const size_t nMarkNum=rMarkList.FindObject(pObj); // so ImpMarkPoint() doesn't always if (nMarkNum!=SAL_MAX_SIZE) { // have to search the object in the MarkList. - pM=GetMarkedObjectList().GetMark(nMarkNum); + pM=rMarkList.GetMark(nMarkNum); pObj0=pObj; pPV0=pPV; } else { @@ -231,7 +237,8 @@ bool SdrMarkView::MarkPoints(const tools::Rectangle* pRect, bool bUnmark) void SdrMarkView::MarkNextPoint() { ForceUndirtyMrkPnt(); - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); } const tools::Rectangle& SdrMarkView::GetMarkedPointsRect() const @@ -288,9 +295,10 @@ void SdrMarkView::ImpSetPointsRects() const void SdrMarkView::UndirtyMrkPnt() const { bool bChg=false; - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); // PolyPoints { @@ -355,9 +363,10 @@ bool SdrMarkView::HasMarkableGluePoints() const bool bRet=false; if (IsGluePointEditMode()) { ForceUndirtyMrkPnt(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); const SdrGluePointList* pGPL=pObj->GetGluePointList(); @@ -381,9 +390,10 @@ bool SdrMarkView::HasMarkedGluePoints() const { ForceUndirtyMrkPnt(); bool bRet=false; - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nMarkNum=0; nMarkNumGetMarkedGluePoints(); bRet = !rPts.empty(); } @@ -395,10 +405,11 @@ bool SdrMarkView::MarkGluePoints(const tools::Rectangle* pRect, bool bUnmark) if (!IsGluePointEditMode() && !bUnmark) return false; ForceUndirtyMrkPnt(); bool bChgd=false; - GetMarkedObjectList().ForceSort(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nMarkNum=0; nMarkNumGetMarkedSdrObj(); const SdrGluePointList* pGPL=pObj->GetGluePointList(); SdrUShortCont& rPts = pM->GetMarkedGluePoints(); @@ -447,12 +458,13 @@ bool SdrMarkView::PickGluePoint(const Point& rPnt, SdrObject*& rpObj, sal_uInt16 OutputDevice* pOut=mpActualOutDev.get(); if (pOut==nullptr) pOut=GetFirstOutputDevice(); if (pOut==nullptr) return false; - GetMarkedObjectList().ForceSort(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); + const size_t nMarkCount=rMarkList.GetMarkCount(); size_t nMarkNum=nMarkCount; while (nMarkNum>0) { nMarkNum--; - const SdrMark* pM=GetMarkedObjectList().GetMark(nMarkNum); + const SdrMark* pM=rMarkList.GetMark(nMarkNum); SdrObject* pObj=pM->GetMarkedSdrObj(); SdrPageView* pPV=pM->GetPageView(); const SdrGluePointList* pGPL=pObj->GetGluePointList(); @@ -482,9 +494,10 @@ bool SdrMarkView::MarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, bool bUnm ForceUndirtyMrkPnt(); bool bChgd=false; if (pObj!=nullptr) { - const size_t nMarkPos=GetMarkedObjectList().FindObject(pObj); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkPos=rMarkList.FindObject(pObj); if (nMarkPos!=SAL_MAX_SIZE) { - SdrMark* pM=GetMarkedObjectList().GetMark(nMarkPos); + SdrMark* pM=rMarkList.GetMark(nMarkPos); SdrUShortCont& rPts = pM->GetMarkedGluePoints(); bool bContains = rPts.find( nId ) != rPts.end(); if (!bUnmark && !bContains) { @@ -510,9 +523,10 @@ bool SdrMarkView::IsGluePointMarked(const SdrObject* pObj, sal_uInt16 nId) const { ForceUndirtyMrkPnt(); bool bRet=false; - const size_t nPos=GetMarkedObjectList().FindObject(pObj); // casting to NonConst + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nPos=rMarkList.FindObject(pObj); // casting to NonConst if (nPos!=SAL_MAX_SIZE) { - const SdrMark* pM=GetMarkedObjectList().GetMark(nPos); + const SdrMark* pM=rMarkList.GetMark(nPos); const SdrUShortCont& rPts = pM->GetMarkedGluePoints(); bRet = rPts.find( nId ) != rPts.end(); } @@ -535,7 +549,8 @@ SdrHdl* SdrMarkView::GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) cons void SdrMarkView::MarkNextGluePoint() { ForceUndirtyMrkPnt(); - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); } const tools::Rectangle& SdrMarkView::GetMarkedGluePointsRect() const diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx index e30d06f27380..d6e3bcd22650 100644 --- a/svx/source/svdraw/svdpoev.cxx +++ b/svx/source/svdraw/svdpoev.cxx @@ -59,8 +59,9 @@ SdrPolyEditView::~SdrPolyEditView() void SdrPolyEditView::ImpCheckPolyPossibilities() { + const SdrMarkList& rMarkList = GetMarkedObjectList(); ImpResetPolyPossibilityFlags(); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const size_t nMarkCount(rMarkList.GetMarkCount()); if(!nMarkCount || ImpIsFrameHandles()) return; @@ -74,7 +75,7 @@ void SdrPolyEditView::ImpCheckPolyPossibilities() for(size_t nMarkNum = 0; nMarkNum < nMarkCount; ++nMarkNum) { - SdrMark* pM = GetMarkedObjectList().GetMark(nMarkNum); + SdrMark* pM = rMarkList.GetMark(nMarkNum); CheckPolyPossibilitiesHelper( pM, b1stSmooth, b1stSegm, bCurve, bSmoothFuz, bSegmFuz, eSmooth ); } } @@ -192,17 +193,18 @@ void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind) if(!HasMarkedPoints()) return; - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); const bool bUndo = IsUndoEnabled(); if( bUndo ) - BegUndo(SvxResId(STR_EditSetPointsSmooth), GetMarkedObjectList().GetPointMarkDescription()); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + BegUndo(SvxResId(STR_EditSetPointsSmooth), rMarkList.GetPointMarkDescription()); + const size_t nMarkCount(rMarkList.GetMarkCount()); for(size_t nMarkNum(nMarkCount); nMarkNum > 0;) { --nMarkNum; - SdrMark* pM = GetMarkedObjectList().GetMark(nMarkNum); + SdrMark* pM = rMarkList.GetMark(nMarkNum); SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() ); if (!pPath) continue; @@ -226,17 +228,18 @@ void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind) if(!HasMarkedPoints()) return; - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); const bool bUndo = IsUndoEnabled(); if( bUndo ) - BegUndo(SvxResId(STR_EditSetSegmentsKind), GetMarkedObjectList().GetPointMarkDescription()); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + BegUndo(SvxResId(STR_EditSetSegmentsKind), rMarkList.GetPointMarkDescription()); + const size_t nMarkCount(rMarkList.GetMarkCount()); for(size_t nMarkNum=nMarkCount; nMarkNum > 0;) { --nMarkNum; - SdrMark* pM = GetMarkedObjectList().GetMark(nMarkNum); + SdrMark* pM = rMarkList.GetMark(nMarkNum); SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() ); if (!pPath) continue; @@ -289,20 +292,21 @@ void SdrPolyEditView::DeleteMarkedPoints() return; BrkAction(); - GetMarkedObjectList().ForceSort(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); + const size_t nMarkCount=rMarkList.GetMarkCount(); const bool bUndo = IsUndoEnabled(); if( bUndo ) { // Description - BegUndo(SvxResId(STR_EditDelete),GetMarkedObjectList().GetPointMarkDescription(),SdrRepeatFunc::Delete); + BegUndo(SvxResId(STR_EditDelete),rMarkList.GetPointMarkDescription(),SdrRepeatFunc::Delete); } for (size_t nMarkNum=nMarkCount; nMarkNum>0;) { --nMarkNum; - SdrMark* pM=GetMarkedObjectList().GetMark(nMarkNum); + SdrMark* pM=rMarkList.GetMark(nMarkNum); SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() ); if (!pPath) continue; @@ -337,17 +341,18 @@ void SdrPolyEditView::RipUpAtMarkedPoints() if(!HasMarkedPoints()) return; - GetMarkedObjectList().ForceSort(); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); + const size_t nMarkCount(rMarkList.GetMarkCount()); const bool bUndo = IsUndoEnabled(); if( bUndo ) - BegUndo(SvxResId(STR_EditRipUp), GetMarkedObjectList().GetPointMarkDescription()); + BegUndo(SvxResId(STR_EditRipUp), rMarkList.GetPointMarkDescription()); for(size_t nMarkNum = nMarkCount; nMarkNum > 0;) { --nMarkNum; - SdrMark* pM = GetMarkedObjectList().GetMark(nMarkNum); + SdrMark* pM = rMarkList.GetMark(nMarkNum); SdrPathObj* pObj = dynamic_cast( pM->GetMarkedSdrObj() ); if (!pObj) continue; @@ -410,11 +415,12 @@ void SdrPolyEditView::RipUpAtMarkedPoints() bool SdrPolyEditView::IsRipUpAtMarkedPointsPossible() const { bool bRetval(false); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); for(size_t a = 0; a < nMarkCount; ++a) { - const SdrMark* pMark = GetMarkedObjectList().GetMark(a); + const SdrMark* pMark = rMarkList.GetMark(a); const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj()); if (!pMarkedPathObject) @@ -450,11 +456,12 @@ bool SdrPolyEditView::IsRipUpAtMarkedPointsPossible() const bool SdrPolyEditView::IsOpenCloseMarkedObjectsPossible() const { bool bRetval(false); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); for(size_t a = 0; a < nMarkCount; ++a) { - const SdrMark* pMark = GetMarkedObjectList().GetMark(a); + const SdrMark* pMark = rMarkList.GetMark(a); const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj()); if(pMarkedPathObject) @@ -481,11 +488,12 @@ SdrObjClosedKind SdrPolyEditView::GetMarkedObjectsClosedState() const { bool bOpen(false); bool bClosed(false); - const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount(rMarkList.GetMarkCount()); for(size_t a = 0; !(bOpen && bClosed) && a < nMarkCount; ++a) { - const SdrMark* pMark = GetMarkedObjectList().GetMark(a); + const SdrMark* pMark = rMarkList.GetMark(a); const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj()); if(pMarkedPathObject) @@ -519,10 +527,11 @@ void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void* { const bool bUndo = IsUndoEnabled(); - const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount=rMarkList.GetMarkCount(); for (size_t nm=0; nmGetMarkedSdrObj(); SdrPathObj* pPath=dynamic_cast( pObj ); if (!pPath) @@ -605,7 +614,8 @@ void SdrPolyEditView::MoveMarkedPoints(const Size& rSiz) { ForceUndirtyMrkPnt(); OUString aStr(SvxResId(STR_EditMove)); - BegUndo(aStr,GetMarkedObjectList().GetPointMarkDescription(),SdrRepeatFunc::Move); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(aStr,rMarkList.GetPointMarkDescription(),SdrRepeatFunc::Move); ImpTransformMarkedPoints(ImpMove,&rSiz); EndUndo(); AdjustMarkHdl(); @@ -622,7 +632,8 @@ void SdrPolyEditView::ResizeMarkedPoints(const Point& rRef, const Fraction& xFac { ForceUndirtyMrkPnt(); OUString aStr(SvxResId(STR_EditResize)); - BegUndo(aStr,GetMarkedObjectList().GetPointMarkDescription(),SdrRepeatFunc::Resize); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(aStr,rMarkList.GetPointMarkDescription(),SdrRepeatFunc::Resize); ImpTransformMarkedPoints(ImpResize,&rRef,&xFact,&yFact); EndUndo(); AdjustMarkHdl(); @@ -639,7 +650,8 @@ void SdrPolyEditView::RotateMarkedPoints(const Point& rRef, Degree100 nAngle) { ForceUndirtyMrkPnt(); OUString aStr(SvxResId(STR_EditResize)); - BegUndo(aStr,GetMarkedObjectList().GetPointMarkDescription(),SdrRepeatFunc::Rotate); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + BegUndo(aStr,rMarkList.GetPointMarkDescription(),SdrRepeatFunc::Rotate); double nSin = sin(toRadians(nAngle)); double nCos = cos(toRadians(nAngle)); ImpTransformMarkedPoints(ImpRotate,&rRef,&nAngle,&nSin,&nCos); diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx index af55855405d1..c7bb38d81ada 100644 --- a/svx/source/svdraw/svdundo.cxx +++ b/svx/source/svdraw/svdundo.cxx @@ -544,7 +544,8 @@ void SdrUndoMoveObj::SdrRepeat(SdrView& rView) bool SdrUndoMoveObj::CanSdrRepeat(SdrView& rView) const { - return rView.GetMarkedObjectList().GetMarkCount() != 0; + const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); + return rMarkList.GetMarkCount() != 0; } OUString SdrUndoMoveObj::GetSdrRepeatComment() const @@ -806,7 +807,8 @@ void SdrUndoDelObj::SdrRepeat(SdrView& rView) bool SdrUndoDelObj::CanSdrRepeat(SdrView& rView) const { - return rView.GetMarkedObjectList().GetMarkCount() != 0; + const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); + return rMarkList.GetMarkCount() != 0; } OUString SdrUndoDelObj::GetSdrRepeatComment() const @@ -1105,7 +1107,8 @@ OUString SdrUndoObjSetText::GetSdrRepeatComment() const void SdrUndoObjSetText::SdrRepeat(SdrView& rView) { - if (!(bNewTextAvailable && rView.GetMarkedObjectList().GetMarkCount() != 0)) + const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); + if (!(bNewTextAvailable && rMarkList.GetMarkCount() != 0)) return; const SdrMarkList& rML=rView.GetMarkedObjectList(); @@ -1138,7 +1141,8 @@ void SdrUndoObjSetText::SdrRepeat(SdrView& rView) bool SdrUndoObjSetText::CanSdrRepeat(SdrView& rView) const { bool bOk = false; - if (bNewTextAvailable && rView.GetMarkedObjectList().GetMarkCount() != 0) { + const SdrMarkList& rMarkList = rView.GetMarkedObjectList(); + if (bNewTextAvailable && rMarkList.GetMarkCount() != 0) { bOk=true; } return bOk; diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index a23dcc0c65ea..36e7fce43950 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -855,11 +855,12 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) if (rVEvt.mbPrevNextMark) { bRet=MarkNextObj(aLogicPos, mnHitTolLog, rVEvt.mbMarkPrev); } else { - GetMarkedObjectList().ForceSort(); - const size_t nCount0=GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); + const size_t nCount0=rMarkList.GetMarkCount(); bRet=MarkObj(aLogicPos, mnHitTolLog, rVEvt.mbAddMark); - GetMarkedObjectList().ForceSort(); - const size_t nCount1=GetMarkedObjectList().GetMarkCount(); + rMarkList.ForceSort(); + const size_t nCount1=rMarkList.GetMarkCount(); bUnmark=nCount1GetMarkedSdrObj(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + for (size_t a=0; !b3DObjSelected && aGetMarkedSdrObj(); if(DynCastE3dObject(pObj)) b3DObjSelected = true; } @@ -1201,7 +1203,8 @@ OUString SdrView::GetStatusText() } else if(IsMarkObj()) { - if(GetMarkedObjectList().GetMarkCount() != 0) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if(rMarkList.GetMarkCount() != 0) { aStr = SvxResId(STR_ViewMarkMoreObjs); } @@ -1274,7 +1277,8 @@ OUString SdrView::GetStatusText() if(aStr == STR_NOTHING) { - if (GetMarkedObjectList().GetMarkCount() != 0) { + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (rMarkList.GetMarkCount() != 0) { aStr = ImpGetDescriptionString(STR_ViewMarked); if (IsGluePointEditMode()) { if (HasMarkedGluePoints()) { @@ -1307,26 +1311,27 @@ SdrViewContext SdrView::GetContext() const if( IsGluePointEditMode() ) return SdrViewContext::GluePointEdit; - const size_t nMarkCount = GetMarkedObjectList().GetMarkCount(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + const size_t nMarkCount = rMarkList.GetMarkCount(); if( HasMarkablePoints() && !IsFrameHandles() ) { bool bPath=true; for( size_t nMarkNum = 0; nMarkNum < nMarkCount && bPath; ++nMarkNum ) - if (dynamic_cast(GetMarkedObjectList().GetMark(nMarkNum)->GetMarkedSdrObj()) == nullptr) + if (dynamic_cast(rMarkList.GetMark(nMarkNum)->GetMarkedSdrObj()) == nullptr) bPath=false; if( bPath ) return SdrViewContext::PointEdit; } - if( GetMarkedObjectList().GetMarkCount() ) + if( rMarkList.GetMarkCount() ) { bool bGraf = true, bMedia = true, bTable = true; for( size_t nMarkNum = 0; nMarkNum < nMarkCount && ( bGraf || bMedia ); ++nMarkNum ) { - const SdrObject* pMarkObj = GetMarkedObjectList().GetMark(nMarkNum)->GetMarkedSdrObj(); + const SdrObject* pMarkObj = rMarkList.GetMark(nMarkNum)->GetMarkedSdrObj(); DBG_ASSERT( pMarkObj, "SdrView::GetContext(), null pointer in mark list!" ); if( !pMarkObj ) @@ -1459,7 +1464,8 @@ bool SdrView::MoveShapeHandle(const sal_uInt32 handleNum, const Point& aEndPoint if (GetHdlList().IsMoveOutside()) return false; - if (!GetMarkedObjectList().GetMarkCount()) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if (!rMarkList.GetMarkCount()) return false; SdrHdl * pHdl = GetHdlList().GetHdl(handleNum); diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 696414b2108c..521d62cff417 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -430,13 +430,14 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked, const { BitmapEx aBmp; - if( GetMarkedObjectList().GetMarkCount() != 0 ) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if( rMarkList.GetMarkCount() != 0 ) { - if(1 == GetMarkedObjectList().GetMarkCount()) + if(1 == rMarkList.GetMarkCount()) { if(bNoVDevIfOneBmpMarked) { - SdrObject* pGrafObjTmp = GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); + SdrObject* pGrafObjTmp = rMarkList.GetMark(0)->GetMarkedSdrObj(); SdrGrafObj* pGrafObj = dynamic_cast( pGrafObjTmp ); if( pGrafObj && ( pGrafObj->GetGraphicType() == GraphicType::Bitmap ) ) @@ -446,7 +447,7 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked, const } else { - const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()); + const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(rMarkList.GetMark(0)->GetMarkedSdrObj()); if(pSdrGrafObj && pSdrGrafObj->isEmbeddedVectorGraphicData()) { @@ -521,7 +522,8 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co { GDIMetaFile aMtf; - if( GetMarkedObjectList().GetMarkCount() != 0 ) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if( rMarkList.GetMarkCount() != 0 ) { tools::Rectangle aBound( GetMarkedObjBoundRect() ); Size aBoundSize( aBound.GetWidth(), aBound.GetHeight() ); @@ -529,8 +531,8 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co if( bNoVDevIfOneMtfMarked ) { - SdrObject* pGrafObjTmp = GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(); - SdrGrafObj* pGrafObj = ( GetMarkedObjectList().GetMarkCount() ==1 ) ? dynamic_cast( pGrafObjTmp ) : nullptr; + SdrObject* pGrafObjTmp = rMarkList.GetMark(0)->GetMarkedSdrObj(); + SdrGrafObj* pGrafObj = ( rMarkList.GetMarkCount() ==1 ) ? dynamic_cast( pGrafObjTmp ) : nullptr; if( pGrafObj ) { @@ -582,10 +584,11 @@ Graphic SdrExchangeView::GetAllMarkedGraphic() const { Graphic aRet; - if( GetMarkedObjectList().GetMarkCount() != 0 ) + const SdrMarkList& rMarkList = GetMarkedObjectList(); + if( rMarkList.GetMarkCount() != 0 ) { - if( ( 1 == GetMarkedObjectList().GetMarkCount() ) && GetMarkedObjectList().GetMark( 0 ) ) - aRet = SdrExchangeView::GetObjGraphic(*GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()); + if( ( 1 == rMarkList.GetMarkCount() ) && rMarkList.GetMark( 0 ) ) + aRet = SdrExchangeView::GetObjGraphic(*rMarkList.GetMark(0)->GetMarkedSdrObj()); else aRet = GetMarkedObjMetaFile(); } @@ -677,7 +680,8 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) ::std::vector< SdrObject* > SdrExchangeView::GetMarkedObjects() const { - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); ::std::vector< SdrObject* > aRetval; ::std::vector< ::std::vector< SdrMark* > > aObjVectors( 2 ); @@ -686,9 +690,9 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject, bool bSVG) const SdrLayerAdmin& rLayerAdmin = GetModel().GetLayerAdmin(); const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName() ); - for( size_t n = 0, nCount = GetMarkedObjectList().GetMarkCount(); n < nCount; ++n ) + for( size_t n = 0, nCount = rMarkList.GetMarkCount(); n < nCount; ++n ) { - SdrMark* pMark = GetMarkedObjectList().GetMark( n ); + SdrMark* pMark = rMarkList.GetMark( n ); // paint objects on control layer on top of all other objects if( nControlLayerId == pMark->GetMarkedSdrObj()->GetLayer() ) @@ -727,7 +731,8 @@ std::unique_ptr SdrExchangeView::CreateMarkedObjModel() const { // Sorting the MarkList here might be problematic in the future, so // use a copy. - GetMarkedObjectList().ForceSort(); + const SdrMarkList& rMarkList = GetMarkedObjectList(); + rMarkList.ForceSort(); std::unique_ptr pNewModel(GetModel().AllocModel()); rtl::Reference pNewPage = pNewModel->AllocPage(false); pNewModel->InsertPage(pNewPage.get()); -- cgit