From da95e7ae392368ca414be5c62a08879221cb71e9 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 29 May 2024 13:09:02 +0200 Subject: SortMarkedObjects() -> GetMarkedObjectList().ForceSort() In order to reduce number of calls to GetMarkedObjectList() later on Change-Id: Ia74949a47308f95607881a7d44c8c26404902745 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168217 Tested-by: Jenkins Reviewed-by: Xisco Fauli Tested-by: Xisco Fauli --- include/svx/svdmrkv.hxx | 1 - reportdesign/source/ui/report/ViewsWindow.cxx | 2 +- sd/source/ui/view/sdview3.cxx | 2 +- svx/source/engine3d/view3d.cxx | 2 +- svx/source/svdraw/svdedtv.cxx | 4 ++-- svx/source/svdraw/svdedtv1.cxx | 2 +- svx/source/svdraw/svdedtv2.cxx | 26 +++++++++++++------------- svx/source/svdraw/svdmrkv.cxx | 12 ++++++------ svx/source/svdraw/svdmrkv1.cxx | 10 +++++----- svx/source/svdraw/svdpoev.cxx | 8 ++++---- svx/source/svdraw/svdview.cxx | 4 ++-- svx/source/svdraw/svdxcgv.cxx | 4 ++-- sw/source/core/draw/dview.cxx | 2 +- 13 files changed, 39 insertions(+), 40 deletions(-) diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx index 92c788b1a828..51620a78c6b8 100644 --- a/include/svx/svdmrkv.hxx +++ b/include/svx/svdmrkv.hxx @@ -261,7 +261,6 @@ public: // returns SAL_MAX_SIZE if not found SdrPageView* GetSdrPageViewOfMarkedByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetPageView(); } SdrObject* GetMarkedObjectByIndex(size_t nNum) const { return GetMarkedObjectList().GetMark(nNum)->GetMarkedSdrObj(); } - void SortMarkedObjects() const { GetMarkedObjectList().ForceSort(); } bool AreObjectsMarked() const { return 0 != GetMarkedObjectList().GetMarkCount(); } // Get a list of all those links which are connected to marked nodes, diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index d5e7d7b8c930..7c79896e82e0 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -627,7 +627,7 @@ void OViewsWindow::collectRectangles(TRectangleMap& _rSortRectangles) OSectionView& rView = rxSection->getReportSection().getSectionView(); if ( rView.AreObjectsMarked() ) { - rView.SortMarkedObjects(); + rView.GetMarkedObjectList().ForceSort(); const size_t nCount = rView.GetMarkedObjectList().GetMarkCount(); for (size_t i=0; i < nCount; ++i) { diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 02cdd653fc5f..79401ef28aea 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -401,7 +401,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if( !pPV->IsLayerLocked( aLayer ) ) { pOwnData->SetInternalMove( true ); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); for( size_t nM = 0; nM < GetMarkedObjectList().GetMarkCount(); ++nM ) { diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 384cf5f2d550..8dff357af689 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -276,7 +276,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const if(nullptr != pScene) { // code from parent - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); pScene->SetDrawOnlySelected(true); pScene->SingleObjectPainter(rOut); diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 581b9216531b..c6d058b4a644 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -491,7 +491,7 @@ void SdrEditView::CheckPossibilities() return; ImpResetPossibilityFlags(); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const size_t nMarkCount = GetMarkedObjectList().GetMarkCount(); if (nMarkCount != 0) { @@ -904,7 +904,7 @@ void SdrEditView::DeleteMarkedObj() void SdrEditView::CopyMarkedObj() { - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); SdrMarkList aSourceObjectsForCopy(GetMarkedObjectList()); // The following loop is used instead of MarkList::Merge(), to be diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 2e349d273d44..93762f675f73 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -1869,7 +1869,7 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert) if (eHor==SdrHorAlign::NONE && eVert==SdrVertAlign::NONE) return; - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); if (!GetMarkedObjectList().GetMarkCount()) return; diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 449e1b5535ae..0dd553ad3518 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -80,7 +80,7 @@ void SdrEditView::MovMarkedToTop() if( bUndo ) BegUndo(SvxResId(STR_EditMovToTop),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::MoveToTop); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); for (size_t nm=0; nmGetOrdNum(); @@ -168,7 +168,7 @@ void SdrEditView::MovMarkedToBtm() if( bUndo ) BegUndo(SvxResId(STR_EditMovToBtm),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::MoveToBottom); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); for (size_t nm=0; nmGetOrdNum(); @@ -263,7 +263,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) if( bUndo ) BegUndo(SvxResId(STR_EditPutToTop),GetMarkedObjectList().GetMarkDescription(),SdrRepeatFunc::PutToTop); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); if (pRefObj!=nullptr) { @@ -280,7 +280,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) if (nRefMark!=SAL_MAX_SIZE) { GetMarkedObjectListWriteAccess().InsertEntry(aRefMark); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); } } for (size_t nm=0; nm 0; ) @@ -2228,7 +2228,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) GetMarkedObjectListWriteAccess().InsertEntry(*aNewMarked.GetMark(a)); } - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); } if (bUndo) diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index bc18b67694fe..3995d2e616d0 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -224,7 +224,7 @@ void SdrMarkView::ModelHasChanged() // In another View 2, the ObjOrder is changed (e. g. MovToTop()) // Then we need to re-sort MarkList. GetMarkedObjectListWriteAccess().SetUnsorted(); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); mbMrkPntDirty=true; UndirtyMrkPnt(); SdrView* pV=static_cast(this); @@ -2028,7 +2028,7 @@ bool SdrMarkView::MarkNextObj(bool bPrev) return false; } - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); size_t nChgMarkNum = SAL_MAX_SIZE; // number of the MarkEntry we want to replace size_t nSearchObjNum = bPrev ? 0 : SAL_MAX_SIZE; @@ -2076,7 +2076,7 @@ bool SdrMarkView::MarkNextObj(bool bPrev) bool SdrMarkView::MarkNextObj(const Point& rPnt, short nTol, bool bPrev) { - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); nTol=ImpGetHitTolLogic(nTol,nullptr); SdrMark* pTopMarkHit=nullptr; SdrMark* pBtmMarkHit=nullptr; @@ -2216,7 +2216,7 @@ void SdrMarkView::MarkObj(const tools::Rectangle& rRect, bool bUnmark) } } if (bFnd) { - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); MarkListHasChanged(); AdjustMarkHdl(); } @@ -2488,7 +2488,7 @@ 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 - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); if (ppRootObj!=nullptr) *ppRootObj=nullptr; if (pbHitPassDirect!=nullptr) *pbHitPassDirect=true; SdrObject* pRet = nullptr; @@ -2591,7 +2591,7 @@ SdrObject* SdrMarkView::PickObj(const Point& rPnt, short nTol, SdrPageView*& rpP bool SdrMarkView::PickMarkedObj(const Point& rPnt, SdrObject*& rpObj, SdrPageView*& rpPV, SdrSearchOptions nOptions) const { - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const bool bBoundCheckOn2ndPass(nOptions & SdrSearchOptions::PASS2BOUND); rpObj=nullptr; rpPV=nullptr; diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx index 03c239ac2a54..dd628afc16ad 100644 --- a/svx/source/svdraw/svdmrkv1.cxx +++ b/svx/source/svdraw/svdmrkv1.cxx @@ -187,7 +187,7 @@ bool SdrMarkView::MarkPoints(const tools::Rectangle* pRect, bool bUnmark) { ForceUndirtyMrkPnt(); bool bChgd=false; - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const SdrObject* pObj0=nullptr; const SdrPageView* pPV0=nullptr; SdrMark* pM=nullptr; @@ -231,7 +231,7 @@ bool SdrMarkView::MarkPoints(const tools::Rectangle* pRect, bool bUnmark) void SdrMarkView::MarkNextPoint() { ForceUndirtyMrkPnt(); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); } const tools::Rectangle& SdrMarkView::GetMarkedPointsRect() const @@ -395,7 +395,7 @@ bool SdrMarkView::MarkGluePoints(const tools::Rectangle* pRect, bool bUnmark) if (!IsGluePointEditMode() && !bUnmark) return false; ForceUndirtyMrkPnt(); bool bChgd=false; - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); for (size_t nMarkNum=0; nMarkNum0) { @@ -535,7 +535,7 @@ SdrHdl* SdrMarkView::GetGluePointHdl(const SdrObject* pObj, sal_uInt16 nId) cons void SdrMarkView::MarkNextGluePoint() { ForceUndirtyMrkPnt(); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); } const tools::Rectangle& SdrMarkView::GetMarkedGluePointsRect() const diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx index 7185e0bc81ba..e30d06f27380 100644 --- a/svx/source/svdraw/svdpoev.cxx +++ b/svx/source/svdraw/svdpoev.cxx @@ -192,7 +192,7 @@ void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind) if(!HasMarkedPoints()) return; - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const bool bUndo = IsUndoEnabled(); if( bUndo ) @@ -226,7 +226,7 @@ void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind) if(!HasMarkedPoints()) return; - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const bool bUndo = IsUndoEnabled(); if( bUndo ) @@ -289,7 +289,7 @@ void SdrPolyEditView::DeleteMarkedPoints() return; BrkAction(); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const size_t nMarkCount=GetMarkedObjectList().GetMarkCount(); const bool bUndo = IsUndoEnabled(); @@ -337,7 +337,7 @@ void SdrPolyEditView::RipUpAtMarkedPoints() if(!HasMarkedPoints()) return; - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const size_t nMarkCount(GetMarkedObjectList().GetMarkCount()); const bool bUndo = IsUndoEnabled(); diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index c8bf0484502d..f20e6006845c 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -855,10 +855,10 @@ bool SdrView::DoMouseEvent(const SdrViewEvent& rVEvt) if (rVEvt.mbPrevNextMark) { bRet=MarkNextObj(aLogicPos, mnHitTolLog, rVEvt.mbMarkPrev); } else { - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const size_t nCount0=GetMarkedObjectList().GetMarkCount(); bRet=MarkObj(aLogicPos, mnHitTolLog, rVEvt.mbAddMark); - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); const size_t nCount1=GetMarkedObjectList().GetMarkCount(); bUnmark=nCount1 SdrExchangeView::GetMarkedObjects() const { - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); ::std::vector< SdrObject* > aRetval; ::std::vector< ::std::vector< SdrMark* > > aObjVectors( 2 ); @@ -727,7 +727,7 @@ std::unique_ptr SdrExchangeView::CreateMarkedObjModel() const { // Sorting the MarkList here might be problematic in the future, so // use a copy. - SortMarkedObjects(); + GetMarkedObjectList().ForceSort(); std::unique_ptr pNewModel(GetModel().AllocModel()); rtl::Reference pNewPage = pNewModel->AllocPage(false); pNewModel->InsertPage(pNewPage.get()); diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index d98f90487cc2..6e688df3eacd 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -973,7 +973,7 @@ void SwDrawView::ReplaceMarkedDrawVirtObjs( SdrMarkView& _rMarkView ) aMarkedObjs.pop_back(); } // sort marked list in order to assure consistent state in drawing layer - _rMarkView.SortMarkedObjects(); + _rMarkView.GetMarkedObjectList().ForceSort(); } SfxViewShell* SwDrawView::GetSfxViewShell() const -- cgit v1.2.3