include/svx/svdmrkv.hxx                      |    3 -
 sc/source/ui/drawfunc/drawsh5.cxx            |    4 +-
 sc/source/ui/drawfunc/fuins1.cxx             |    2 -
 sc/source/ui/view/cliputil.cxx               |    2 -
 sc/source/ui/view/gridwin.cxx                |    2 -
 sc/source/ui/view/tabvwshb.cxx               |    6 +--
 sd/qa/unit/misc-tests.cxx                    |    6 ++-
 sd/qa/unit/tiledrendering/tiledrendering.cxx |    2 -
 sd/source/ui/view/drviews2.cxx               |    6 +--
 sd/source/ui/view/sdview.cxx                 |    6 +--
 sd/source/ui/view/sdview2.cxx                |    4 +-
 svx/source/engine3d/view3d.cxx               |   44 ++++++++++++++-------------
 svx/source/engine3d/view3d1.cxx              |    6 +--
 svx/source/svdraw/svddrgv.cxx                |   16 ++++-----
 svx/source/svdraw/svdedtv.cxx                |    6 +--
 svx/source/svdraw/svdedtv1.cxx               |    6 +--
 svx/source/svdraw/svdedtv2.cxx               |   24 +++++++-------
 svx/source/svdraw/svdedxv.cxx                |    8 +++-
 svx/source/svdraw/svdmrkv.cxx                |   16 ++++-----
 svx/source/svdraw/svdview.cxx                |    6 +--
 svx/source/svdraw/svdxcgv.cxx                |    8 ++--
 sw/source/uibase/shells/drawsh.cxx           |    2 -
 sw/source/uibase/shells/drwbassh.cxx         |    4 +-
 sw/source/uibase/uiview/viewdlg2.cxx         |    6 +--
 sw/source/uibase/utlui/content.cxx           |    2 -
 25 files changed, 101 insertions(+), 96 deletions(-)

New commits:
commit 2d362fab91fb70fbe7026c1e96452fe06fa5736e
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed May 29 14:03:00 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu May 30 08:44:27 2024 +0200

    GetMarkedObjectByIndex -> GetMarkedObjectList().GetMark()->GetMarkedSdrObj()
    
    In order to reduce number of calls to GetMarkedObjectList() later on
    
    Change-Id: I57ab7d2d8edd98da5175bd1066dfab0fa2cc888e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168220
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 4271466ec329..5e008b3d9095 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -258,7 +258,6 @@ protected:
 public:
     // all available const methods for read access to selection
     const SdrMarkList& GetMarkedObjectList() const { return 
maSdrViewSelection.GetMarkedObjectList(); }
-    SdrObject* GetMarkedObjectByIndex(size_t nNum) const { return 
GetMarkedObjectList().GetMark(nNum)->GetMarkedSdrObj(); }
     bool AreObjectsMarked() const { return 0 != 
GetMarkedObjectList().GetMarkCount(); }
 
     // Get a list of all those links which are connected to marked nodes,
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx 
b/sc/source/ui/drawfunc/drawsh5.cxx
index e4edfd455f4f..c82b01bcc23e 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -509,7 +509,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
                 if(1 == pView->GetMarkedObjectList().GetMarkCount())
                 {
                     // #i68101#
-                    SdrObject* pSelected = pView->GetMarkedObjectByIndex(0);
+                    SdrObject* pSelected = 
pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                     assert(pSelected && "ScDrawShell::ExecDrawFunc: 
nMarkCount, but no object (!)");
 
                     if(SC_LAYER_INTERN != pSelected->GetLayer())
@@ -582,7 +582,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
             {
                 if(1 == pView->GetMarkedObjectList().GetMarkCount())
                 {
-                    SdrObject* pSelected = pView->GetMarkedObjectByIndex(0);
+                    SdrObject* pSelected = 
pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                     assert(pSelected && "ScDrawShell::ExecDrawFunc: 
nMarkCount, but no object (!)");
 
                     if(SC_LAYER_INTERN != pSelected->GetLayer())
diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx
index 1152eaf10024..d58eb090b384 100644
--- a/sc/source/ui/drawfunc/fuins1.cxx
+++ b/sc/source/ui/drawfunc/fuins1.cxx
@@ -131,7 +131,7 @@ static void lcl_InsertGraphic( const Graphic& rGraphic,
     // style for other objects
     if(pDrawView && 1 == pDrawView->GetMarkedObjectList().GetMarkCount())
     {
-        SdrObject* pPickObj = pDrawView->GetMarkedObjectByIndex(0);
+        SdrObject* pPickObj = 
pDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
 
         if(pPickObj)
         {
diff --git a/sc/source/ui/view/cliputil.cxx b/sc/source/ui/view/cliputil.cxx
index b1e14127e2d3..ec507c91c3a4 100644
--- a/sc/source/ui/view/cliputil.cxx
+++ b/sc/source/ui/view/cliputil.cxx
@@ -87,7 +87,7 @@ void ScClipUtil::PasteFromClipboard( ScViewData& rViewData, 
ScTabViewShell* pTab
             ScDrawView* pDrawView = pTabViewShell->GetScDrawView();
             if(pDrawView && 1 == 
pDrawView->GetMarkedObjectList().GetMarkCount())
             {
-                SdrObject* pPickObj = pDrawView->GetMarkedObjectByIndex(0);
+                SdrObject* pPickObj = 
pDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 if(pPickObj)
                 {
                     ScDrawLayer::SetCellAnchoredFromPosition( *pPickObj,  
rThisDoc, nThisTab, false );
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 3b48b2adda9e..3b453fbb32cc 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4956,7 +4956,7 @@ void ScGridWindow::PasteSelection( const Point& rPosPixel 
)
         const size_t nCount = pDrawView->GetMarkedObjectList().GetMarkCount();
         for (size_t i = 0; i < nCount; ++i)
         {
-            SdrObject* pObj = pDrawView->GetMarkedObjectByIndex(i);
+            SdrObject* pObj = 
pDrawView->GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj();
             if (pObj && pObj->GetLogicRect().Contains(aLogicPos))
             {
                 // Inside an active drawing object.  Bail out.
diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx
index 7b34b1fce5d8..bbf98297f9c8 100644
--- a/sc/source/ui/view/tabvwshb.cxx
+++ b/sc/source/ui/view/tabvwshb.cxx
@@ -707,7 +707,7 @@ bool ScTabViewShell::IsSignatureLineSelected()
     if (pSdrView->GetMarkedObjectList().GetMarkCount() != 1)
         return false;
 
-    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    SdrObject* pPickObj = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     if (!pPickObj)
         return false;
 
@@ -727,7 +727,7 @@ bool ScTabViewShell::IsQRCodeSelected()
     if (pSdrView->GetMarkedObjectList().GetMarkCount() != 1)
         return false;
 
-    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    SdrObject* pPickObj = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     if (!pPickObj)
         return false;
 
@@ -753,7 +753,7 @@ bool ScTabViewShell::IsSignatureLineSigned()
     if (pSdrView->GetMarkedObjectList().GetMarkCount() != 1)
         return false;
 
-    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    SdrObject* pPickObj = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     if (!pPickObj)
         return false;
 
diff --git a/sd/qa/unit/misc-tests.cxx b/sd/qa/unit/misc-tests.cxx
index 69cd0205dc4d..d038e2e8880e 100644
--- a/sd/qa/unit/misc-tests.cxx
+++ b/sd/qa/unit/misc-tests.cxx
@@ -795,7 +795,8 @@ void SdMiscTest::testTdf130988()
     pView->MarkNextObj();
     pView->ConvertMarkedObjTo3D(false, basegfx::B2DPoint(8000.0, -3000.0),
                                 basegfx::B2DPoint(3000.0, -8000.0));
-    E3dScene* pObj = dynamic_cast<E3dScene*>(pView->GetMarkedObjectByIndex(0));
+    E3dScene* pObj
+        = 
dynamic_cast<E3dScene*>(pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
     CPPUNIT_ASSERT(pObj);
 
     // Error was, that the created 3D object had a wrong path. Instead 
examining
@@ -820,7 +821,8 @@ void SdMiscTest::testTdf131033()
     pView->MarkNextObj();
     pView->ConvertMarkedObjTo3D(false, basegfx::B2DPoint(11000.0, -5000.0),
                                 basegfx::B2DPoint(11000.0, -9000.0));
-    E3dScene* pObj = dynamic_cast<E3dScene*>(pView->GetMarkedObjectByIndex(0));
+    E3dScene* pObj
+        = 
dynamic_cast<E3dScene*>(pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
     CPPUNIT_ASSERT(pObj);
 
     // Error was, that the 2D representation of the scene did not contain the 
default 20°
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index c013df072c17..0c7d5e87d1cd 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1428,7 +1428,7 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testTdf118354)
     Scheduler::ProcessEventsToIdle();
 
     SdrView* pView = pViewShell->GetView();
-    auto pMarkedObj = 
dynamic_cast<sdr::table::SdrTableObj*>(pView->GetMarkedObjectByIndex(0));
+    auto pMarkedObj = 
dynamic_cast<sdr::table::SdrTableObj*>(pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
     CPPUNIT_ASSERT_EQUAL(pMarkedObj, pTableObject);
 }
 
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 39daf6b00cbf..ff53390f23d3 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -1139,7 +1139,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
                         // as one of the next tasks.
                         if(1 == 
mpDrawView->GetMarkedObjectList().GetMarkCount())
                         {
-                            const SdrGrafObj* pSdrGrafObj = dynamic_cast< 
const SdrGrafObj* >(mpDrawView->GetMarkedObjectByIndex(0));
+                            const SdrGrafObj* pSdrGrafObj = dynamic_cast< 
const SdrGrafObj* 
>(mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
 
                             if(pSdrGrafObj && 
pSdrGrafObj->isEmbeddedVectorGraphicData())
                             {
@@ -2665,7 +2665,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             if(1 == mpDrawView->GetMarkedObjectList().GetMarkCount())
             {
                 // #i68101#
-                rtl::Reference<SdrObject> pSelected = 
mpDrawView->GetMarkedObjectByIndex(0);
+                rtl::Reference<SdrObject> pSelected = 
mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, 
but no object (!)");
                 OUString aName(pSelected->GetName());
 
@@ -2703,7 +2703,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
         {
             if(1 == mpDrawView->GetMarkedObjectList().GetMarkCount())
             {
-                rtl::Reference<SdrObject> pSelected = 
mpDrawView->GetMarkedObjectByIndex(0);
+                rtl::Reference<SdrObject> pSelected = 
mpDrawView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 OSL_ENSURE(pSelected, "DrawViewShell::FuTemp03: nMarkCount, 
but no object (!)");
                 OUString aTitle(pSelected->GetTitle());
                 OUString aDescription(pSelected->GetDescription());
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index de33dab73649..f5b45b6fe9ac 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -870,7 +870,7 @@ void View::SetMarkedOriginalSize()
 
     for( size_t i = 0; i < nCount; ++i )
     {
-        SdrObject* pObj = GetMarkedObjectByIndex(i);
+        SdrObject* pObj = GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj();
 
         if( pObj->GetObjInventor() == SdrInventor::Default )
         {
@@ -1199,7 +1199,7 @@ bool View::ShouldToggleOn(
     const size_t nMarkCount = GetMarkedObjectList().GetMarkCount();
     for (size_t nIndex = 0; nIndex < nMarkCount && !bToggleOn; ++nIndex)
     {
-        SdrTextObj* pTextObj = 
DynCastSdrTextObj(GetMarkedObjectByIndex(nIndex));
+        SdrTextObj* pTextObj = 
DynCastSdrTextObj(GetMarkedObjectList().GetMark(nIndex)->GetMarkedSdrObj());
         if (!pTextObj || pTextObj->IsTextEditActive())
             continue;
         if( dynamic_cast< const SdrTableObj *>( pTextObj ) !=  nullptr)
@@ -1270,7 +1270,7 @@ void View::ChangeMarkedObjectsBulletsNumbering(
     const size_t nMarkCount = GetMarkedObjectList().GetMarkCount();
     for (size_t nIndex = 0; nIndex < nMarkCount; ++nIndex)
     {
-        SdrTextObj* pTextObj = 
DynCastSdrTextObj(GetMarkedObjectByIndex(nIndex));
+        SdrTextObj* pTextObj = 
DynCastSdrTextObj(GetMarkedObjectList().GetMark(nIndex)->GetMarkedSdrObj());
         if (!pTextObj || pTextObj->IsTextEditActive())
             continue;
         if( dynamic_cast< SdrTableObj *>( pTextObj ) !=  nullptr)
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index 561723063ad6..f8013c3bcadd 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -106,7 +106,7 @@ css::uno::Reference< css::datatransfer::XTransferable > 
View::CreateClipboardDat
 
     if( GetMarkedObjectList().GetMarkCount() == 1 )
     {
-        SdrObject* pObj = GetMarkedObjectByIndex(0);
+        SdrObject* pObj = GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
 
         if( auto pOle2Obj = dynamic_cast<SdrOle2Obj *>( pObj ) )
             if( pOle2Obj->GetObjRef() )
@@ -152,7 +152,7 @@ css::uno::Reference< css::datatransfer::XTransferable > 
View::CreateDragDataObje
 
     if( GetMarkedObjectList().GetMarkCount() == 1 )
     {
-        SdrObject* pObj = GetMarkedObjectByIndex( 0 );
+        SdrObject* pObj = GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
 
         if( auto pOle2Obj = dynamic_cast<SdrOle2Obj *>( pObj ) )
             if( pOle2Obj->GetObjRef() )
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 12e12d653491..55787cc4a2df 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -102,7 +102,7 @@ 
Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView)
         {
             for(size_t a = 0; a < mnCount; ++a)
             {
-                SdrObject* pObject = mrView.GetMarkedObjectByIndex(a);
+                SdrObject* pObject = 
mrView.GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
 
                 if(pObject)
                 {
@@ -119,7 +119,7 @@ 
Impl3DMirrorConstructOverlay::Impl3DMirrorConstructOverlay(const E3dView& rView)
 
         for(size_t a = 0; a < mnCount; ++a)
         {
-            SdrObject* pObject = mrView.GetMarkedObjectByIndex(a);
+            SdrObject* pObject = 
mrView.GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
             mpPolygons[mnCount - (a + 1)] = pObject->TakeXorPoly();
         }
     }
@@ -220,7 +220,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
     const size_t nCnt = GetMarkedObjectList().GetMarkCount();
     for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
     {
-        SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+        SdrObject *pObj = 
GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj();
         if(auto pCompoundObject = dynamic_cast<E3dCompoundObject*>(pObj))
         {
             // related scene
@@ -249,7 +249,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
         // objects
         for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
         {
-            SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+            SdrObject *pObj = 
GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj();
             if(auto pCompoundObject = dynamic_cast<E3dCompoundObject*>(pObj))
             {
                 // related scene
@@ -264,7 +264,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
 
         for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
         {
-            SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+            SdrObject *pObj = 
GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj();
             if(auto p3DObj = DynCastE3dObject(pObj))
             {
                 // Select object
@@ -286,7 +286,7 @@ void E3dView::DrawMarkedObj(OutputDevice& rOut) const
         // Reset selection flag
         for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
         {
-            SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+            SdrObject *pObj = 
GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj();
             if(auto pCompoundObject = dynamic_cast<E3dCompoundObject*>(pObj))
             {
                 // related scene
@@ -318,7 +318,7 @@ std::unique_ptr<SdrModel> E3dView::CreateMarkedObjModel() 
const
 
     for(size_t nObjs = 0; nObjs < nCount; ++nObjs)
     {
-        const SdrObject* pObj = GetMarkedObjectByIndex(nObjs);
+        const SdrObject* pObj = 
GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj();
 
         if(!bSpecialHandling)
             if(auto pCompoundObj = dynamic_cast< const 
E3dCompoundObject*>(pObj))
@@ -358,7 +358,7 @@ std::unique_ptr<SdrModel> E3dView::CreateMarkedObjModel() 
const
     // and collect SnapRect of selected objects
     for(size_t nObjs = 0; nObjs < nCount; ++nObjs)
     {
-        SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+        SdrObject *pObj = 
GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj();
 
         if(auto p3DObj = dynamic_cast<E3dCompoundObject*>(pObj))
         {
@@ -587,7 +587,7 @@ bool E3dView::IsConvertTo3DObjPossible() const
 
     for(size_t a=0; !bAny3D && a<GetMarkedObjectList().GetMarkCount(); ++a)
     {
-        SdrObject *pObj = GetMarkedObjectByIndex(a);
+        SdrObject *pObj = GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
         if(pObj)
         {
             ImpIsConvertTo3DPossible(pObj, bAny3D, bGroupSelected);
@@ -1168,7 +1168,7 @@ bool E3dView::BegDragObj(const Point& rPnt, OutputDevice* 
pOut,
             const size_t nCnt = GetMarkedObjectList().GetMarkCount();
             for(size_t nObjs = 0; nObjs < nCnt; ++nObjs)
             {
-                SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+                SdrObject *pObj = 
GetMarkedObjectList().GetMark(nObjs)->GetMarkedSdrObj();
                 if(pObj)
                 {
                     if( const E3dScene* pScene = DynCastE3dScene(pObj) )
@@ -1330,7 +1330,7 @@ void E3dView::Start3DCreation()
     basegfx::B2DRange aR;
     for(size_t nMark = 0; nMark < GetMarkedObjectList().GetMarkCount(); 
++nMark)
     {
-        SdrObject* pMark = GetMarkedObjectByIndex(nMark);
+        SdrObject* pMark = 
GetMarkedObjectList().GetMark(nMark)->GetMarkedSdrObj();
         basegfx::B2DPolyPolygon aXPP(pMark->TakeXorPoly());
         aR.expand(basegfx::utils::getRange(aXPP));
     }
@@ -1478,7 +1478,7 @@ bool E3dView::IsBreak3DObjPossible() const
     {
         for (size_t i = 0; i < nCount; ++i)
         {
-            SdrObject* pObj = GetMarkedObjectByIndex(i);
+            SdrObject* pObj = 
GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj();
 
             if (auto p3dObject = DynCastE3dObject(pObj))
             {
@@ -1510,7 +1510,7 @@ void E3dView::Break3DObj()
     BegUndo(SvxResId(RID_SVX_3D_UNDO_BREAK_LATHE));
     for(size_t a=0; a<nCount; ++a)
     {
-        E3dObject* pObj = static_cast<E3dObject*>(GetMarkedObjectByIndex(a));
+        E3dObject* pObj = 
static_cast<E3dObject*>(GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj());
         BreakSingle3DObj(pObj);
     }
     DeleteMarked();
@@ -1558,7 +1558,7 @@ void E3dView::CheckPossibilities()
     bool b3DObject = false;
     for(size_t nObjs = 0; (nObjs < nMarkCnt) && !bCompound; ++nObjs)
     {
-        SdrObject *pObj = GetMarkedObjectByIndex(nObjs);
+        SdrObject *pObj = 
GetMarkedObjectList().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 3b80a00c3337..db5466dd287b 100644
--- a/svx/source/engine3d/view3d1.cxx
+++ b/svx/source/engine3d/view3d1.cxx
@@ -38,7 +38,7 @@ void E3dView::ConvertMarkedToPolyObj()
 
     if (GetMarkedObjectList().GetMarkCount() == 1)
     {
-        SdrObject* pObj = GetMarkedObjectByIndex(0);
+        SdrObject* pObj = GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
 
         if (pObj)
         {
@@ -107,7 +107,7 @@ SfxItemSet E3dView::Get3DAttributes() const
 
     for(size_t a = 0; a < nMarkCnt; ++a)
     {
-        SdrObject* pObj = GetMarkedObjectByIndex(a);
+        SdrObject* pObj = GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
         Imp_E3dView_InorderRun3DObjects(*pObj, nSelectedItems);
     }
 
@@ -150,7 +150,7 @@ void E3dView::Set3DAttributes( const SfxItemSet& rAttr)
 
     for(size_t a = 0; a < nMarkCnt; ++a)
     {
-        SdrObject* pObj = GetMarkedObjectByIndex(a);
+        SdrObject* pObj = GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
         Imp_E3dView_InorderRun3DObjects(*pObj, nSelectedItems);
     }
 
diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx
index 0fb64eee11eb..0f41314f8c57 100644
--- a/svx/source/svdraw/svddrgv.cxx
+++ b/svx/source/svdraw/svddrgv.cxx
@@ -148,7 +148,7 @@ bool SdrDragView::TakeDragObjAnchorPos(Point& rPos, bool 
bTR ) const
         !IsDraggingPoints() && !IsDraggingGluePoints() && // not when moving 
points
         dynamic_cast<const SdrDragMovHdl*>( mpCurrentSdrDragMethod.get() ) ==  
nullptr) // not when moving handles
     {
-        SdrObject* pObj=GetMarkedObjectByIndex(0);
+        SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
         if (auto pCaptionObj = dynamic_cast<SdrCaptionObj*>(pObj))
         {
             Point aPt(pCaptionObj->GetTailPos());
@@ -210,7 +210,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, 
OutputDevice* pOut, SdrHdl* pHdl
         // Coordinate maybe affected by GridOffset, so we may need to
         // adapt to Model-coordinates here
         if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj
-            && getPossibleGridOffsetForSdrObject(aGridOffset, 
GetMarkedObjectByIndex(0), GetSdrPageView()))
+            && getPossibleGridOffsetForSdrObject(aGridOffset, 
GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), GetSdrPageView()))
             || (getPossibleGridOffsetForPosition(
             aGridOffset,
             basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
@@ -269,7 +269,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, 
OutputDevice* pOut, SdrHdl* pHdl
                             bool b3DObjSelected = false;
                             for(size_t a=0; !b3DObjSelected && 
a<GetMarkedObjectList().GetMarkCount(); ++a)
                             {
-                                SdrObject* pObj = GetMarkedObjectByIndex(a);
+                                SdrObject* pObj = 
GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
                                 if(DynCastE3dObject(pObj))
                                     b3DObjSelected = true;
                             }
@@ -417,7 +417,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, 
OutputDevice* pOut, SdrHdl* pHdl
                                 bool bSingleTextObjMark = false;    // SJ: 
#i100490#
                                 if ( GetMarkedObjectList().GetMarkCount() == 1 
)
                                 {
-                                    mpMarkedObj=GetMarkedObjectByIndex(0);
+                                    
mpMarkedObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                                     if ( mpMarkedObj &&
                                         DynCastSdrTextObj( mpMarkedObj) !=  
nullptr &&
                                         
static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame() )
@@ -433,7 +433,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, 
OutputDevice* pOut, SdrHdl* pHdl
                         {
                             if(SdrHdlKind::Move == meDragHdl)
                             {
-                                const bool bCustomShapeSelected(1 == 
GetMarkedObjectList().GetMarkCount() && dynamic_cast<const 
SdrObjCustomShape*>(GetMarkedObjectByIndex(0)) != nullptr);
+                                const bool bCustomShapeSelected(1 == 
GetMarkedObjectList().GetMarkCount() && dynamic_cast<const 
SdrObjCustomShape*>(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()) != 
nullptr);
 
                                 if(bCustomShapeSelected)
                                 {
@@ -442,7 +442,7 @@ bool SdrDragView::BegDragObj(const Point& rPnt, 
OutputDevice* pOut, SdrHdl* pHdl
                             }
                             else if(SdrHdlKind::Poly == meDragHdl)
                             {
-                                const bool bConnectorSelected(1 == 
GetMarkedObjectList().GetMarkCount() && dynamic_cast<const 
SdrEdgeObj*>(GetMarkedObjectByIndex(0)) != nullptr);
+                                const bool bConnectorSelected(1 == 
GetMarkedObjectList().GetMarkCount() && dynamic_cast<const 
SdrEdgeObj*>(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj()) != nullptr);
 
                                 if(bConnectorSelected)
                                 {
@@ -514,7 +514,7 @@ void SdrDragView::MovDragObj(const Point& rPnt)
     // Coordinate maybe affected by GridOffset, so we may need to
     // adapt to Model-coordinates here
     if((comphelper::LibreOfficeKit::isActive() && mpMarkedObj
-        && getPossibleGridOffsetForSdrObject(aGridOffset, 
GetMarkedObjectByIndex(0), GetSdrPageView()))
+        && getPossibleGridOffsetForSdrObject(aGridOffset, 
GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), GetSdrPageView()))
         || (getPossibleGridOffsetForPosition(
         aGridOffset,
         basegfx::B2DPoint(aPnt.X(), aPnt.Y()),
@@ -716,7 +716,7 @@ bool SdrDragView::IsInsGluePointPossible() const
         if (GetMarkedObjectList().GetMarkCount()==1)
         {
             // return sal_False, if only 1 object which is a connector.
-            const SdrObject* pObj=GetMarkedObjectByIndex(0);
+            const SdrObject* 
pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
             if (dynamic_cast<const SdrEdgeObj *>(pObj) == nullptr)
             {
                bRet=true;
diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx
index c6d058b4a644..f982a037b0f4 100644
--- a/svx/source/svdraw/svdedtv.cxx
+++ b/svx/source/svdraw/svdedtv.cxx
@@ -504,7 +504,7 @@ void SdrEditView::CheckPossibilities()
         {
             // check bCombinePossible more thoroughly
             // still missing ...
-            const SdrObject* pObj=GetMarkedObjectByIndex(0);
+            const SdrObject* 
pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
             //const SdrPathObj* pPath=dynamic_cast<SdrPathObj*>( pObj );
             bool bGroup=pObj->GetSubList()!=nullptr;
             bool bHasText=pObj->GetOutlinerParaObject()!=nullptr;
@@ -663,7 +663,7 @@ void SdrEditView::CheckPossibilities()
     // Don't allow moving glued connectors.
     // Currently only implemented for single selection.
     if (nMarkCount==1) {
-        SdrObject* pObj=GetMarkedObjectByIndex(0);
+        SdrObject* pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
         SdrEdgeObj* pEdge=dynamic_cast<SdrEdgeObj*>( pObj );
         if (pEdge!=nullptr) {
             SdrObject* pNode1=pEdge->GetConnectedNode(true);
@@ -675,7 +675,7 @@ void SdrEditView::CheckPossibilities()
     // Don't allow enter Diagrams
     if (1 == nMarkCount && m_bGrpEnterPossible)
     {
-        SdrObject* pCandidate(GetMarkedObjectByIndex(0));
+        SdrObject* 
pCandidate(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
 
         if(nullptr != pCandidate && pCandidate->isDiagram())
             m_bGrpEnterPossible = false;
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index ccdbfb03b58d..50f17849f164 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -910,7 +910,7 @@ void SdrEditView::MergeAttrFromMarked(SfxItemSet& rAttr, 
bool bOnlyHardAttr) con
     for(size_t a = 0; a < nMarkCount; ++a)
     {
         // #80277# merging was done wrong in the prev version
-        SdrObject *pObj = GetMarkedObjectByIndex(a);
+        SdrObject *pObj = GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
         if (!pObj)
         {
             continue;
@@ -1941,7 +1941,7 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, 
SdrVertAlign eVert)
     {
         if (nMarkCount==1)
         {   // align single object to page
-            const SdrObject* pObj=GetMarkedObjectByIndex(0);
+            const SdrObject* 
pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
             const SdrPage* pPage=pObj->getSdrPageFromSdrObject();
             const SdrPageGridFrameList* 
pGFL=pPage->GetGridFrameList(GetMarkedObjectList().GetMark(0)->GetPageView(),&(pObj->GetSnapRect()));
             const SdrPageGridFrame* pFrame=nullptr;
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index f3fedc30f7ad..a5976f135478 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -83,7 +83,7 @@ void SdrEditView::MovMarkedToTop()
     GetMarkedObjectList().ForceSort();
     for (size_t nm=0; nm<nCount; ++nm)
     { // All Ordnums have to be correct!
-        GetMarkedObjectByIndex(nm)->GetOrdNum();
+        GetMarkedObjectList().GetMark(nm)->GetMarkedSdrObj()->GetOrdNum();
     }
     bool bChg=false;
     SdrObjList* pOL0=nullptr;
@@ -171,7 +171,7 @@ void SdrEditView::MovMarkedToBtm()
     GetMarkedObjectList().ForceSort();
     for (size_t nm=0; nm<nCount; ++nm)
     { // All Ordnums have to be correct!
-        GetMarkedObjectByIndex(nm)->GetOrdNum();
+        GetMarkedObjectList().GetMark(nm)->GetMarkedSdrObj()->GetOrdNum();
     }
 
     bool bChg=false;
@@ -285,7 +285,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* 
pRefObj)
     }
     for (size_t nm=0; nm<nCount; ++nm)
     { // All Ordnums have to be correct!
-        GetMarkedObjectByIndex(nm)->GetOrdNum();
+        GetMarkedObjectList().GetMark(nm)->GetMarkedSdrObj()->GetOrdNum();
     }
     bool bChg=false;
     SdrObjList* pOL0=nullptr;
@@ -385,7 +385,7 @@ void SdrEditView::PutMarkedBehindObj(const SdrObject* 
pRefObj)
         }
     }
     for (size_t nm=0; nm<nCount; ++nm) { // All Ordnums have to be correct!
-        GetMarkedObjectByIndex(nm)->GetOrdNum();
+        GetMarkedObjectList().GetMark(nm)->GetMarkedSdrObj()->GetOrdNum();
     }
     bool bChg=false;
     SdrObjList* pOL0=nullptr;
@@ -456,11 +456,11 @@ void SdrEditView::ReverseOrderOfMarked()
         SdrObjList* 
pOL=GetMarkedObjectList().GetMark(a)->GetPageView()->GetObjList();
         size_t c=b;
         if (a<c) { // make sure OrdNums aren't dirty
-            GetMarkedObjectByIndex(a)->GetOrdNum();
+            GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj()->GetOrdNum();
         }
         while (a<c) {
-            SdrObject* pObj1=GetMarkedObjectByIndex(a);
-            SdrObject* pObj2=GetMarkedObjectByIndex(c);
+            SdrObject* 
pObj1=GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
+            SdrObject* 
pObj2=GetMarkedObjectList().GetMark(c)->GetMarkedSdrObj();
             const size_t nOrd1=pObj1->GetOrdNumDirect();
             const size_t nOrd2=pObj2->GetOrdNumDirect();
             if( bUndo )
@@ -493,7 +493,7 @@ void SdrEditView::ImpCheckToTopBtmPossible()
         return;
     if (nCount==1)
     { // special-casing for single selection
-        SdrObject* pObj=GetMarkedObjectByIndex(0);
+        SdrObject* pObj=GetMarkedObjectList().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 +515,7 @@ void SdrEditView::ImpCheckToTopBtmPossible()
         SdrObjList* pOL0=nullptr;
         size_t nPos0 = 0;
         for (size_t nm = 0; !m_bToBtmPossible && nm<nCount; ++nm) { // check 
'send to background'
-            SdrObject* pObj=GetMarkedObjectByIndex(nm);
+            SdrObject* 
pObj=GetMarkedObjectList().GetMark(nm)->GetMarkedSdrObj();
             SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
             if (pOL!=pOL0) {
                 nPos0 = 0;
@@ -530,7 +530,7 @@ void SdrEditView::ImpCheckToTopBtmPossible()
         nPos0 = SAL_MAX_SIZE;
         for (size_t nm=nCount; !m_bToTopPossible && nm>0; ) { // check 'bring 
to front'
             --nm;
-            SdrObject* pObj=GetMarkedObjectByIndex(nm);
+            SdrObject* 
pObj=GetMarkedObjectList().GetMark(nm)->GetMarkedSdrObj();
             SdrObjList* pOL=pObj->getParentSdrObjListFromSdrObject();
             if (pOL!=pOL0) {
                 nPos0=pOL->GetObjCount();
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 6422656791bd..a7d61b0c97f6 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -2324,7 +2324,8 @@ SvtScriptType SdrObjEditView::GetScriptType() const
 
         for (size_t i = 0; i < nMarkCount; ++i)
         {
-            OutlinerParaObject* pParaObj = 
GetMarkedObjectByIndex(i)->GetOutlinerParaObject();
+            OutlinerParaObject* pParaObj
+                = 
GetMarkedObjectList().GetMark(i)->GetMarkedSdrObj()->GetOutlinerParaObject();
 
             if (pParaObj)
             {
@@ -2366,7 +2367,8 @@ void SdrObjEditView::GetAttributes(SfxItemSet& 
rTargetSet, bool bOnlyHardAttr) c
             rTargetSet.Put(mpTextEditOutlinerView->GetAttribs(), false);
         }
 
-        if (GetMarkedObjectList().GetMarkCount() == 1 && 
GetMarkedObjectByIndex(0) == pText.get())
+        if (GetMarkedObjectList().GetMarkCount() == 1
+            && GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj() == 
pText.get())
         {
             MergeNotPersistAttrFromMarked(rTargetSet);
         }
@@ -2496,7 +2498,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& 
rSet, bool bReplaceAll)
                 pTextEditObj->SetMergedItemSetAndBroadcast(aSet, bReplaceAll);
 
                 if (GetMarkedObjectList().GetMarkCount() == 1
-                    && GetMarkedObjectByIndex(0) == pTextEditObj.get())
+                    && GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj() == 
pTextEditObj.get())
                 {
                     SetNotPersistAttrToMarked(aSet);
                 }
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 06c95d060fd1..d077171b53ab 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -606,7 +606,7 @@ bool SdrMarkView::ImpIsFrameHandles() const
     bool bStdDrag=meDragMode==SdrDragMode::Move;
     if (nMarkCount==1 && bStdDrag && bFrmHdl)
     {
-        const SdrObject* pObj=GetMarkedObjectByIndex(0);
+        const SdrObject* 
pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
         if (pObj && pObj->GetObjInventor()==SdrInventor::Default)
         {
             SdrObjKind nIdent=pObj->GetObjIdentifier();
@@ -716,7 +716,7 @@ bool 
SdrMarkView::dumpGluePointsToJSON(boost::property_tree::ptree& rTree)
         {
             if (!pObj)
                 continue;
-            if (pObj == GetMarkedObjectByIndex(0))
+            if (pObj == GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj())
                 continue;
             const SdrGluePointList* pGPL = pObj->GetGluePointList();
             bool VertexObject = !(pGPL && pGPL->GetCount());
@@ -934,7 +934,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, 
GetMarkedObjectByIndex(0), pPageView))
+            if(getPossibleGridOffsetForSdrObject(aGridOffset, 
GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj(), pPageView))
             {
                 Point p(aGridOffset.getX(), aGridOffset.getY());
                 if (convertMapMode)
@@ -1278,7 +1278,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* 
pOtherShell)
 
     if (nMarkCount==1)
     {
-        mpMarkedObj=GetMarkedObjectByIndex(0);
+        mpMarkedObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
 
         if(nullptr != mpMarkedObj)
         {
@@ -1622,7 +1622,7 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
             const size_t nMarkCount = GetMarkedObjectList().GetMarkCount();
             if(nMarkCount == 1)
             {
-                SdrObject* pObj = GetMarkedObjectByIndex(0);
+                SdrObject* pObj = 
GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 SdrModel& rModel = GetModel();
                 const SfxItemSet& rSet = pObj->GetMergedItemSet();
 
@@ -1684,7 +1684,7 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode)
             const size_t nMarkCount = GetMarkedObjectList().GetMarkCount();
             if(nMarkCount == 1)
             {
-                SdrObject* pObj = GetMarkedObjectByIndex(0);
+                SdrObject* pObj = 
GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 const SfxItemSet& rSet = pObj->GetMergedItemSet();
                 drawing::FillStyle eFillStyle = 
rSet.Get(XATTR_FILLSTYLE).GetValue();
 
@@ -2779,7 +2779,7 @@ void SdrMarkView::MarkListHasChanged()
     mbMarkedPointsRectsDirty=true;
     bool bOneEdgeMarked=false;
     if (GetMarkedObjectList().GetMarkCount()==1) {
-        const SdrObject* pObj=GetMarkedObjectByIndex(0);
+        const SdrObject* 
pObj=GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
         if (pObj->GetObjInventor()==SdrInventor::Default) {
             bOneEdgeMarked = pObj->GetObjIdentifier() == SdrObjKind::Edge;
         }
diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx
index f20e6006845c..ece2f48db3fd 100644
--- a/svx/source/svdraw/svdview.cxx
+++ b/svx/source/svdraw/svdview.cxx
@@ -1078,7 +1078,7 @@ PointerStyle SdrView::GetPreferredPointer(const Point& 
rMousePos, const OutputDe
                 // are 3D objects selected?
                 bool b3DObjSelected = false;
                 for (size_t a=0; !b3DObjSelected && 
a<GetMarkedObjectList().GetMarkCount(); ++a) {
-                    SdrObject* pObj = GetMarkedObjectByIndex(a);
+                    SdrObject* pObj = 
GetMarkedObjectList().GetMark(a)->GetMarkedSdrObj();
                     if(DynCastE3dObject(pObj))
                         b3DObjSelected = true;
                 }
@@ -1313,7 +1313,7 @@ SdrViewContext SdrView::GetContext() const
     {
         bool bPath=true;
         for( size_t nMarkNum = 0; nMarkNum < nMarkCount && bPath; ++nMarkNum )
-            if (dynamic_cast<const 
SdrPathObj*>(GetMarkedObjectByIndex(nMarkNum)) == nullptr)
+            if (dynamic_cast<const 
SdrPathObj*>(GetMarkedObjectList().GetMark(nMarkNum)->GetMarkedSdrObj()) == 
nullptr)
                 bPath=false;
 
         if( bPath )
@@ -1326,7 +1326,7 @@ SdrViewContext SdrView::GetContext() const
 
         for( size_t nMarkNum = 0; nMarkNum < nMarkCount && ( bGraf || bMedia 
); ++nMarkNum )
         {
-            const SdrObject* pMarkObj = GetMarkedObjectByIndex( nMarkNum );
+            const SdrObject* pMarkObj = 
GetMarkedObjectList().GetMark(nMarkNum)->GetMarkedSdrObj();
             DBG_ASSERT( pMarkObj, "SdrView::GetContext(), null pointer in mark 
list!" );
 
             if( !pMarkObj )
diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx
index 7039978f67b9..b8079ae9e5dd 100644
--- a/svx/source/svdraw/svdxcgv.cxx
+++ b/svx/source/svdraw/svdxcgv.cxx
@@ -436,7 +436,7 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool 
bNoVDevIfOneBmpMarked, const
         {
             if(bNoVDevIfOneBmpMarked)
             {
-                SdrObject*  pGrafObjTmp = GetMarkedObjectByIndex( 0 );
+                SdrObject*  pGrafObjTmp = 
GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 SdrGrafObj* pGrafObj = dynamic_cast<SdrGrafObj*>( pGrafObjTmp  
);
 
                 if( pGrafObj && ( pGrafObj->GetGraphicType() == 
GraphicType::Bitmap ) )
@@ -446,7 +446,7 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool 
bNoVDevIfOneBmpMarked, const
             }
             else
             {
-                const SdrGrafObj* pSdrGrafObj = dynamic_cast< const 
SdrGrafObj* >(GetMarkedObjectByIndex(0));
+                const SdrGrafObj* pSdrGrafObj = dynamic_cast< const 
SdrGrafObj* >(GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
 
                 if(pSdrGrafObj && pSdrGrafObj->isEmbeddedVectorGraphicData())
                 {
@@ -529,7 +529,7 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool 
bNoVDevIfOneMtfMarked) co
 
         if( bNoVDevIfOneMtfMarked )
         {
-            SdrObject*  pGrafObjTmp = GetMarkedObjectByIndex( 0 );
+            SdrObject*  pGrafObjTmp = 
GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
             SdrGrafObj* pGrafObj = ( GetMarkedObjectList().GetMarkCount() ==1 
) ? dynamic_cast<SdrGrafObj*>( pGrafObjTmp  ) : nullptr;
 
             if( pGrafObj )
@@ -585,7 +585,7 @@ Graphic SdrExchangeView::GetAllMarkedGraphic() const
     if( AreObjectsMarked() )
     {
         if( ( 1 == GetMarkedObjectList().GetMarkCount() ) && 
GetMarkedObjectList().GetMark( 0 ) )
-            aRet = SdrExchangeView::GetObjGraphic(*GetMarkedObjectByIndex(0));
+            aRet = 
SdrExchangeView::GetObjGraphic(*GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj());
         else
             aRet = GetMarkedObjMetaFile();
     }
diff --git a/sw/source/uibase/shells/drawsh.cxx 
b/sw/source/uibase/shells/drawsh.cxx
index d56fc7b458d5..2abfb9952395 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -86,7 +86,7 @@ SdrObject* SwDrawShell::IsSingleFillableNonOLESelected()
         return nullptr;
     }
 
-    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    SdrObject* pPickObj = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
 
     if(!pPickObj)
     {
diff --git a/sw/source/uibase/shells/drwbassh.cxx 
b/sw/source/uibase/shells/drwbassh.cxx
index 070354432bda..3ddd29689adf 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -607,7 +607,7 @@ void SwDrawBaseShell::Execute(SfxRequest& rReq)
             if(1 == pSdrView->GetMarkedObjectList().GetMarkCount())
             {
                 // #i68101#
-                rtl::Reference<SdrObject> pSelected = 
pSdrView->GetMarkedObjectByIndex(0);
+                rtl::Reference<SdrObject> pSelected = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 assert(pSelected && "DrawViewShell::FuTemp03: nMarkCount, but 
no object (!)");
                 OUString aOrigName(pSelected->GetName());
 
@@ -651,7 +651,7 @@ void SwDrawBaseShell::Execute(SfxRequest& rReq)
 
             if(1 == pSdrView->GetMarkedObjectList().GetMarkCount())
             {
-                rtl::Reference<SdrObject> pSelected = 
pSdrView->GetMarkedObjectByIndex(0);
+                rtl::Reference<SdrObject> pSelected = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
                 assert(pSelected && "DrawViewShell::FuTemp03: nMarkCount, but 
no object (!)");
                 OUString aTitle(pSelected->GetTitle());
                 OUString aDescription(pSelected->GetDescription());
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx 
b/sw/source/uibase/uiview/viewdlg2.cxx
index 0f3019e58412..6a583d18ad97 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -158,7 +158,7 @@ bool SwView::isSignatureLineSelected() const
     if (pSdrView->GetMarkedObjectList().GetMarkCount() != 1)
         return false;
 
-    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    SdrObject* pPickObj = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     if (!pPickObj)
         return false;
 
@@ -179,7 +179,7 @@ bool SwView::isSignatureLineSigned() const
     if (pSdrView->GetMarkedObjectList().GetMarkCount() != 1)
         return false;
 
-    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    SdrObject* pPickObj = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     if (!pPickObj)
         return false;
 
@@ -200,7 +200,7 @@ bool SwView::isQRCodeSelected() const
     if (pSdrView->GetMarkedObjectList().GetMarkCount() != 1)
         return false;
 
-    SdrObject* pPickObj = pSdrView->GetMarkedObjectByIndex(0);
+    SdrObject* pPickObj = 
pSdrView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
     if (!pPickObj)
         return false;
 
diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index edfcac1b63b0..5be9e50e753b 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -4319,7 +4319,7 @@ void SwContentTree::UpdateTracking()
                 {
                     for (size_t nIdx(0); nIdx < 
pSdrView->GetMarkedObjectList().GetMarkCount(); nIdx++)
                     {
-                        SdrObject* pSelected = 
pSdrView->GetMarkedObjectByIndex(nIdx);
+                        SdrObject* pSelected = 
pSdrView->GetMarkedObjectList().GetMark(nIdx)->GetMarkedSdrObj();
                         OUString aName(pSelected->GetName());
                         if (!aName.isEmpty())
                             lcl_SelectDrawObjectByName(*m_xTreeView, aName);
commit b1da1ef5766d1910b29d98b62a842ccfd7bacf08
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Wed May 29 13:56:39 2024 +0200
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu May 30 08:44:14 2024 +0200

    svx: GetSdrPageViewOfMarkedByIndex() -> ...
    
    ... GetMarkedObjectList().GetMark(nNum)->GetPageView()
    
    In order to reduce number of calls to GetMarkedObjectList() later on
    
    Change-Id: If79125cc13fff7b8944c50202e0564de6bf8302e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168219
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

diff --git a/include/svx/svdmrkv.hxx b/include/svx/svdmrkv.hxx
index 51620a78c6b8..4271466ec329 100644
--- a/include/svx/svdmrkv.hxx
+++ b/include/svx/svdmrkv.hxx
@@ -258,8 +258,6 @@ protected:
 public:
     // all available const methods for read access to selection
     const SdrMarkList& GetMarkedObjectList() const { return 
maSdrViewSelection.GetMarkedObjectList(); }
-    // 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(); }
     bool AreObjectsMarked() const { return 0 != 
GetMarkedObjectList().GetMarkCount(); }
 
diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx
index 8dff357af689..12e12d653491 100644
--- a/svx/source/engine3d/view3d.cxx
+++ b/svx/source/engine3d/view3d.cxx
@@ -945,12 +945,16 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const 
basegfx::B2DPoint& rPnt1
 
         // Insert scene instead of the first selected object and throw away
         // all the old objects
-        SdrObject* pRepObj = GetMarkedObjectByIndex(0);
-        SdrPageView* pPV = GetSdrPageViewOfMarkedByIndex(0);
-        MarkObj(pRepObj, pPV, true);
-        ReplaceObjectAtView(pRepObj, *pPV, pScene.get(), false);
-        DeleteMarked();
-        MarkObj(pScene.get(), pPV);
+        SdrMark* pMark = GetMarkedObjectList().GetMark(0);
+        if (pMark)
+        {
+            SdrObject* pRepObj = pMark->GetMarkedSdrObj();
+            SdrPageView* pPV = pMark->GetPageView();
+            MarkObj(pRepObj, pPV, true);
+            ReplaceObjectAtView(pRepObj, *pPV, pScene.get(), false);
+            DeleteMarked();
+            MarkObj(pScene.get(), pPV);
+        }
 
         // Rotate Rotation body around the axis of rotation
         if(!bExtrude && fRot3D != 0.0)
diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx
index 93762f675f73..ccdbfb03b58d 100644
--- a/svx/source/svdraw/svdedtv1.cxx
+++ b/svx/source/svdraw/svdedtv1.cxx
@@ -1943,7 +1943,7 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, 
SdrVertAlign eVert)
         {   // align single object to page
             const SdrObject* pObj=GetMarkedObjectByIndex(0);
             const SdrPage* pPage=pObj->getSdrPageFromSdrObject();
-            const SdrPageGridFrameList* 
pGFL=pPage->GetGridFrameList(GetSdrPageViewOfMarkedByIndex(0),&(pObj->GetSnapRect()));
+            const SdrPageGridFrameList* 
pGFL=pPage->GetGridFrameList(GetMarkedObjectList().GetMark(0)->GetPageView(),&(pObj->GetSnapRect()));
             const SdrPageGridFrame* pFrame=nullptr;
             if (pGFL!=nullptr && pGFL->GetCount()!=0)
             { // Writer
diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx
index 0dd553ad3518..f3fedc30f7ad 100644
--- a/svx/source/svdraw/svdedtv2.cxx
+++ b/svx/source/svdraw/svdedtv2.cxx
@@ -451,9 +451,9 @@ void SdrEditView::ReverseOrderOfMarked()
     do {
         // take into account selection across multiple PageViews
         size_t b=a+1;
-        while (b<nMarkCount && GetSdrPageViewOfMarkedByIndex(b) == 
GetSdrPageViewOfMarkedByIndex(a)) ++b;
+        while (b<nMarkCount && GetMarkedObjectList().GetMark(b)->GetPageView() 
== GetMarkedObjectList().GetMark(a)->GetPageView()) ++b;
         --b;
-        SdrObjList* pOL=GetSdrPageViewOfMarkedByIndex(a)->GetObjList();
+        SdrObjList* 
pOL=GetMarkedObjectList().GetMark(a)->GetPageView()->GetObjList();
         size_t c=b;
         if (a<c) { // make sure OrdNums aren't dirty
             GetMarkedObjectByIndex(a)->GetOrdNum();
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 3995d2e616d0..06c95d060fd1 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -1295,7 +1295,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* 
pOtherShell)
 
     if (nMarkCount>0)
     {
-        mpMarkedPV=GetSdrPageViewOfMarkedByIndex(0);
+        mpMarkedPV=GetMarkedObjectList().GetMark(0)->GetPageView();
 
         for (size_t nMarkNum=0; nMarkNum<nMarkCount && (mpMarkedPV!=nullptr || 
!bFrmHdl); ++nMarkNum)
         {

Reply via email to