[Libreoffice-commits] core.git: include/svx sd/source svx/source

Caolán McNamara caolanm at redhat.com
Tue Nov 8 11:23:33 UTC 2016


 include/svx/svdmark.hxx                   |   36 --
 sd/source/ui/animations/motionpathtag.cxx |   67 +---
 svx/source/svdraw/svddrgmt.cxx            |   21 -
 svx/source/svdraw/svdglev.cxx             |   34 +-
 svx/source/svdraw/svdmark.cxx             |   64 ----
 svx/source/svdraw/svdmrkv.cxx             |   48 +--
 svx/source/svdraw/svdmrkv1.cxx            |   94 +++---
 svx/source/svdraw/svdpoev.cxx             |  409 ++++++++++++++----------------
 8 files changed, 337 insertions(+), 436 deletions(-)

New commits:
commit 8bff616ae65f67f2eb2e6b81f1dbbbe2f9f7f5d9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Nov 8 10:25:25 2016 +0000

    simplify mark points and gluepoints management
    
    Change-Id: I52070cfe4909a13189d9c130114d98565ced9089

diff --git a/include/svx/svdmark.hxx b/include/svx/svdmark.hxx
index 0771489..39a5eb3 100644
--- a/include/svx/svdmark.hxx
+++ b/include/svx/svdmark.hxx
@@ -48,8 +48,8 @@ protected:
     sal_Int64                                           mnTimeStamp;
     SdrObject*                                          mpSelectedSdrObject; // the selected object
     SdrPageView*                                        mpPageView;
-    SdrUShortCont*                                      mpPoints;     // Selected Points
-    SdrUShortCont*                                      mpGluePoints; // Selected Gluepoints (their Id's)
+    SdrUShortCont                                       maPoints;     // Selected Points
+    SdrUShortCont                                       maGluePoints; // Selected Gluepoints (their Id's)
     bool                                                mbCon1;       // for Connectors
     bool                                                mbCon2;       // for Connectors
     sal_uInt16                                          mnUser;       // E.g. for CopyObjects, also copy Edges
@@ -107,40 +107,24 @@ public:
         return mnUser;
     }
 
-    const SdrUShortCont* GetMarkedPoints() const
+    const SdrUShortCont& GetMarkedPoints() const
     {
-        return mpPoints;
+        return maPoints;
     }
 
-    const SdrUShortCont* GetMarkedGluePoints() const
+    const SdrUShortCont& GetMarkedGluePoints() const
     {
-        return mpGluePoints;
+        return maGluePoints;
     }
 
-    SdrUShortCont* GetMarkedPoints()
+    SdrUShortCont& GetMarkedPoints()
     {
-        return mpPoints;
+        return maPoints;
     }
 
-    SdrUShortCont* GetMarkedGluePoints()
+    SdrUShortCont& GetMarkedGluePoints()
     {
-        return mpGluePoints;
-    }
-
-    SdrUShortCont* ForceMarkedPoints()
-    {
-        if(!mpPoints)
-            mpPoints = new SdrUShortCont;
-
-        return mpPoints;
-    }
-
-    SdrUShortCont* ForceMarkedGluePoints()
-    {
-        if(!mpGluePoints)
-            mpGluePoints = new SdrUShortCont;
-
-        return mpGluePoints;
+        return maGluePoints;
     }
 
     sal_Int64 getTimeStamp() const
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index da51c1e..cbf0a7f 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -775,8 +775,8 @@ sal_uLong MotionPathTag::GetMarkedPointCount() const
 {
     if( mpMark )
     {
-        const SdrUShortCont* pPts=mpMark->GetMarkedPoints();
-        return pPts ? pPts->size() : 0;
+        const SdrUShortCont& rPts = mpMark->GetMarkedPoints();
+        return rPts.size();
     }
     else
     {
@@ -792,7 +792,6 @@ bool MotionPathTag::MarkPoint(SdrHdl& rHdl, bool bUnmark )
         SmartHdl* pSmartHdl = dynamic_cast< SmartHdl* >( &rHdl );
         if( pSmartHdl && pSmartHdl->getTag().get() == this )
         {
-            mpMark->ForceMarkedPoints();
             if (mrView.MarkPointHelper(&rHdl,mpMark,bUnmark))
             {
                 mrView.MarkListHasChanged();
@@ -907,7 +906,7 @@ void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList )
             {
                 SdrHdlList aTemp( rHandlerList.GetView() );
                 mpPathObj->AddToHdlList( aTemp );
-                const SdrUShortCont* pMrkPnts=mpMark->GetMarkedPoints();
+                const SdrUShortCont& rMrkPnts = mpMark->GetMarkedPoints();
 
                 for( size_t nHandle = 0; nHandle < aTemp.GetHdlCount(); ++nHandle )
                 {
@@ -923,7 +922,7 @@ void MotionPathTag::addCustomHandles( SdrHdlList& rHandlerList )
 
                     rHandlerList.AddHdl( pSmartHdl );
 
-                    const bool bSelected= pMrkPnts && pMrkPnts->find( sal_uInt16(nHandle) ) != pMrkPnts->end();
+                    const bool bSelected = rMrkPnts.find( sal_uInt16(nHandle) ) != rMrkPnts.end();
                     pSmartHdl->SetSelected(bSelected);
 
                     if( mrView.IsPlusHandlesAlwaysVisible() || bSelected )
@@ -1016,10 +1015,8 @@ void MotionPathTag::deselect()
 
     if( mpMark )
     {
-        SdrUShortCont* pPts = mpMark->GetMarkedPoints();
-
-        if( pPts )
-            pPts->clear();
+        SdrUShortCont& rPts = mpMark->GetMarkedPoints();
+        rPts.clear();
     }
 
     selectionChanged();
@@ -1042,22 +1039,18 @@ void MotionPathTag::DeleteMarkedPoints()
     {
         mrView.BrkAction();
 
-        SdrUShortCont* pPts = mpMark->GetMarkedPoints();
-
-        if( pPts )
+        SdrUShortCont& rPts = mpMark->GetMarkedPoints();
+        PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
+        if (aEditor.DeletePoints(rPts))
         {
-            PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
-            if( aEditor.DeletePoints( *pPts ) )
+            if( aEditor.GetPolyPolygon().count() )
             {
-                if( aEditor.GetPolyPolygon().count() )
-                {
-                    mpPathObj->SetPathPoly( aEditor.GetPolyPolygon() );
-                }
-
-                mrView.UnmarkAllPoints();
-                mrView.MarkListHasChanged();
-                mrView.updateHandles();
+                mpPathObj->SetPathPoly( aEditor.GetPolyPolygon() );
             }
+
+            mrView.UnmarkAllPoints();
+            mrView.MarkListHasChanged();
+            mrView.updateHandles();
         }
     }
 }
@@ -1098,16 +1091,13 @@ void MotionPathTag::SetMarkedSegmentsKind(SdrPathSegmentKind eKind)
 {
     if(mpPathObj && isSelected() && (GetMarkedPointCount() != 0))
     {
-        SdrUShortCont* pPts = mpMark->GetMarkedPoints();
-        if(pPts)
+        SdrUShortCont& rPts = mpMark->GetMarkedPoints();
+        PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
+        if (aEditor.SetSegmentsKind(eKind, rPts))
         {
-            PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
-            if(aEditor.SetSegmentsKind( eKind, *pPts ) )
-            {
-                mpPathObj->SetPathPoly(aEditor.GetPolyPolygon());
-                mrView.MarkListHasChanged();
-                mrView.updateHandles();
-            }
+            mpPathObj->SetPathPoly(aEditor.GetPolyPolygon());
+            mrView.MarkListHasChanged();
+            mrView.updateHandles();
         }
     }
 }
@@ -1151,16 +1141,13 @@ void MotionPathTag::SetMarkedPointsSmooth(SdrPathSmoothKind eKind)
 
     if(mpPathObj && mpMark && isSelected() && (GetMarkedPointCount() != 0))
     {
-        SdrUShortCont* pPts = mpMark->GetMarkedPoints();
-        if(pPts)
+        SdrUShortCont& rPts = mpMark->GetMarkedPoints();
+        PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
+        if (aEditor.SetPointsSmooth(eFlags, rPts))
         {
-            PolyPolygonEditor aEditor( mpPathObj->GetPathPoly(), mpPathObj->IsClosed() );
-            if(aEditor.SetPointsSmooth( eFlags, *pPts ) )
-            {
-                mpPathObj->SetPathPoly(aEditor.GetPolyPolygon());
-                mrView.MarkListHasChanged();
-                mrView.updateHandles();
-            }
+            mpPathObj->SetPathPoly(aEditor.GetPolyPolygon());
+            mrView.MarkListHasChanged();
+            mrView.updateHandles();
         }
     }
 }
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index b1d509a..bc40e1d 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -475,9 +475,9 @@ void SdrDragMethod::createSdrDragEntries_PointDrag()
 
         if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
         {
-            const SdrUShortCont* pPts = pM->GetMarkedPoints();
+            const SdrUShortCont& rPts = pM->GetMarkedPoints();
 
-            if(pPts && !pPts->empty())
+            if (!rPts.empty())
             {
                 const SdrObject* pObj = pM->GetMarkedSdrObj();
                 const SdrPathObj* pPath = dynamic_cast< const SdrPathObj* >(pObj);
@@ -488,7 +488,7 @@ void SdrDragMethod::createSdrDragEntries_PointDrag()
 
                     if(aPathXPP.count())
                     {
-                        for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
+                        for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
                         {
                             sal_uInt32 nPolyNum, nPointNum;
                             const sal_uInt16 nObjPt = *it;
@@ -521,16 +521,16 @@ void SdrDragMethod::createSdrDragEntries_GlueDrag()
 
         if(pM->GetPageView() == getSdrDragView().GetSdrPageView())
         {
-            const SdrUShortCont* pPts = pM->GetMarkedGluePoints();
+            const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
 
-            if(pPts && !pPts->empty())
+            if (!rPts.empty())
             {
                 const SdrObject* pObj = pM->GetMarkedSdrObj();
                 const SdrGluePointList* pGPL = pObj->GetGluePointList();
 
-                if(pGPL)
+                if (pGPL)
                 {
-                    for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
+                    for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
                     {
                         const sal_uInt16 nObjPt = *it;
                         const sal_uInt16 nGlueNum(pGPL->FindGluePoint(nObjPt));
@@ -1652,16 +1652,15 @@ void SdrDragMove::MoveSdrDrag(const Point& rNoSnapPnt_)
             for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum)
             {
                 const SdrMark* pM=rML.GetMark(nMarkNum);
-                const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
-                const size_t nPointCount=pPts==nullptr ? 0 : pPts->size();
+                const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
 
-                if (nPointCount!=0)
+                if (!rPts.empty())
                 {
                     const SdrObject* pObj=pM->GetMarkedSdrObj();
                     const SdrGluePointList* pGPL=pObj->GetGluePointList();
                     Rectangle aBound(pObj->GetCurrentBoundRect());
 
-                    for (SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
+                    for (SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
                     {
                         sal_uInt16 nId = *it;
                         sal_uInt16 nGlueNum=pGPL->FindGluePoint(nId);
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx
index a5978c1..fa46fb9 100644
--- a/svx/source/svdraw/svdglev.cxx
+++ b/svx/source/svdraw/svdglev.cxx
@@ -46,9 +46,9 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
     for (size_t nm=0; nm<nMarkCount; ++nm) {
         SdrMark* pM=GetSdrMarkByIndex(nm);
         SdrObject* pObj=pM->GetMarkedSdrObj();
-        const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
-        size_t nPointCount=pPts==nullptr ? 0 : pPts->size();
-        if (nPointCount!=0) {
+        const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+        if (!rPts.empty())
+        {
             SdrGluePointList* pGPL=nullptr;
             if (bConst) {
                 const SdrGluePointList* pConstGPL=pObj->GetGluePointList();
@@ -61,7 +61,7 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co
                 if(!bConst && IsUndoEnabled() )
                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
 
-                for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
+                for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
                 {
                     sal_uInt16 nPtId=*it;
                     sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
@@ -229,9 +229,8 @@ void SdrGlueEditView::DeleteMarkedGluePoints()
     {
         SdrMark* pM=GetSdrMarkByIndex(nm);
         SdrObject* pObj=pM->GetMarkedSdrObj();
-        const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
-        size_t nPointCount=pPts==nullptr ? 0 : pPts->size();
-        if (nPointCount!=0)
+        const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+        if (!rPts.empty())
         {
             SdrGluePointList* pGPL=pObj->ForceGluePointList();
             if (pGPL!=nullptr)
@@ -239,7 +238,7 @@ void SdrGlueEditView::DeleteMarkedGluePoints()
                 if( bUndo )
                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
 
-                for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
+                for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
                 {
                     sal_uInt16 nPtId=*it;
                     sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
@@ -273,17 +272,16 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
     {
         SdrMark* pM=GetSdrMarkByIndex(nm);
         SdrObject* pObj=pM->GetMarkedSdrObj();
-        SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+        SdrUShortCont& rPts = pM->GetMarkedGluePoints();
         SdrGluePointList* pGPL=pObj->ForceGluePointList();
-        size_t nPointCount=pPts==nullptr ? 0 : pPts->size();
-        if (nPointCount!=0 && pGPL!=nullptr)
+        if (!rPts.empty() && pGPL!=nullptr)
         {
             if( bUndo )
                 AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
 
             SdrUShortCont aIdsToErase;
             SdrUShortCont aIdsToInsert;
-            for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
+            for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
             {
                 sal_uInt16 nPtId=*it;
                 sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
@@ -297,9 +295,8 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints()
                 }
             }
             for(SdrUShortCont::const_iterator it = aIdsToErase.begin(); it != aIdsToErase.end(); ++it)
-                pPts->erase(*it);
-            pPts->insert(aIdsToInsert.begin(), aIdsToInsert.end());
-
+                rPts.erase(*it);
+            rPts.insert(aIdsToInsert.begin(), aIdsToInsert.end());
         }
     }
     if( bUndo )
@@ -316,16 +313,15 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const vo
     for (size_t nm=0; nm<nMarkCount; ++nm) {
         SdrMark* pM=GetSdrMarkByIndex(nm);
         SdrObject* pObj=pM->GetMarkedSdrObj();
-        const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
-        size_t nPointCount=pPts==nullptr ? 0 : pPts->size();
-        if (nPointCount!=0) {
+        const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+        if (!rPts.empty()) {
             SdrGluePointList* pGPL=pObj->ForceGluePointList();
             if (pGPL!=nullptr)
             {
                 if( IsUndoEnabled() )
                     AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
 
-                for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
+                for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
                 {
                     sal_uInt16 nPtId=*it;
                     sal_uInt16 nGlueIdx=pGPL->FindGluePoint(nPtId);
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index cf53729..3f1db23 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -46,8 +46,6 @@ void SdrMark::setTime()
 SdrMark::SdrMark(SdrObject* pNewObj, SdrPageView* pNewPageView)
 :   mpSelectedSdrObject(pNewObj),
     mpPageView(pNewPageView),
-    mpPoints(nullptr),
-    mpGluePoints(nullptr),
     mbCon1(false),
     mbCon2(false),
     mnUser(0)
@@ -64,8 +62,6 @@ SdrMark::SdrMark(const SdrMark& rMark)
     mnTimeStamp(0),
     mpSelectedSdrObject(nullptr),
     mpPageView(nullptr),
-    mpPoints(nullptr),
-    mpGluePoints(nullptr),
     mbCon1(false),
     mbCon2(false),
     mnUser(0)
@@ -75,13 +71,10 @@ SdrMark::SdrMark(const SdrMark& rMark)
 
 SdrMark::~SdrMark()
 {
-    if(mpSelectedSdrObject)
+    if (mpSelectedSdrObject)
     {
         mpSelectedSdrObject->RemoveObjectUser( *this );
     }
-
-    delete mpPoints;
-    delete mpGluePoints;
 }
 
 void SdrMark::ObjectInDestruction(const SdrObject& rObject)
@@ -110,56 +103,18 @@ void SdrMark::SetMarkedSdrObj(SdrObject* pNewObj)
 SdrMark& SdrMark::operator=(const SdrMark& rMark)
 {
     SetMarkedSdrObj(rMark.mpSelectedSdrObject);
+
     mnTimeStamp = rMark.mnTimeStamp;
     mpPageView = rMark.mpPageView;
     mbCon1 = rMark.mbCon1;
     mbCon2 = rMark.mbCon2;
     mnUser = rMark.mnUser;
-
-    if(!rMark.mpPoints)
-    {
-        if(mpPoints)
-        {
-            delete mpPoints;
-            mpPoints = nullptr;
-        }
-    }
-    else
-    {
-        if(!mpPoints)
-        {
-            mpPoints = new SdrUShortCont(*rMark.mpPoints);
-        }
-        else
-        {
-            *mpPoints = *rMark.mpPoints;
-        }
-    }
-
-    if(!rMark.mpGluePoints)
-    {
-        if(mpGluePoints)
-        {
-            delete mpGluePoints;
-            mpGluePoints = nullptr;
-        }
-    }
-    else
-    {
-        if(!mpGluePoints)
-        {
-            mpGluePoints = new SdrUShortCont(*rMark.mpGluePoints);
-        }
-        else
-        {
-            *mpGluePoints = *rMark.mpGluePoints;
-        }
-    }
+    maPoints = rMark.maPoints;
+    maGluePoints = rMark.maGluePoints;
 
     return *this;
 }
 
-
 static bool ImpSdrMarkListSorter(SdrMark* const& lhs, SdrMark* const& rhs)
 {
     SdrObject* pObj1 = lhs->GetMarkedSdrObj();
@@ -549,17 +504,16 @@ const OUString& SdrMarkList::GetPointMarkDescription(bool bGlue) const
     for(size_t nMarkNum = 0; nMarkNum < nMarkCount; ++nMarkNum)
     {
         const SdrMark* pMark = GetMark(nMarkNum);
-        const SdrUShortCont* pPts = bGlue ? pMark->GetMarkedGluePoints() : pMark->GetMarkedPoints();
-        const size_t nCount(pPts ? pPts->size() : 0);
+        const SdrUShortCont& rPts = bGlue ? pMark->GetMarkedGluePoints() : pMark->GetMarkedPoints();
 
-        if(nCount)
+        if (!rPts.empty())
         {
             if(n1stMarkNum == SAL_MAX_SIZE)
             {
                 n1stMarkNum = nMarkNum;
             }
 
-            nMarkPtAnz += nCount;
+            nMarkPtAnz += rPts.size();
             nMarkPtObjAnz++;
         }
 
@@ -611,9 +565,9 @@ const OUString& SdrMarkList::GetPointMarkDescription(bool bGlue) const
             for(size_t i = n1stMarkNum + 1; i < GetMarkCount() && bEq; ++i)
             {
                 const SdrMark* pMark2 = GetMark(i);
-                const SdrUShortCont* pPts = bGlue ? pMark2->GetMarkedGluePoints() : pMark2->GetMarkedPoints();
+                const SdrUShortCont& rPts = bGlue ? pMark2->GetMarkedGluePoints() : pMark2->GetMarkedPoints();
 
-                if(pPts && !pPts->empty() && pMark2->GetMarkedSdrObj())
+                if (!rPts.empty() && pMark2->GetMarkedSdrObj())
                 {
                     OUString aStr1(pMark2->GetMarkedSdrObj()->TakeObjNamePlural());
                     bEq = aNam == aStr1;
diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx
index 2c83aa4..cadb11a 100644
--- a/svx/source/svdraw/svdmrkv.cxx
+++ b/svx/source/svdraw/svdmrkv.cxx
@@ -853,7 +853,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
                     pObj->AddToHdlList(maHdlList);
                     const size_t nSiz1=maHdlList.GetHdlCount();
                     bool bPoly=pObj->IsPolyObj();
-                    const SdrUShortCont* pMrkPnts=pM->GetMarkedPoints();
+                    const SdrUShortCont& rMrkPnts = pM->GetMarkedPoints();
                     for (size_t i=nSiz0; i<nSiz1; ++i)
                     {
                         SdrHdl* pHdl=maHdlList.GetHdl(i);
@@ -864,8 +864,7 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
 
                         if (bPoly)
                         {
-                            bool bSelected=pMrkPnts!=nullptr
-                                      && pMrkPnts->find( sal_uInt16(i-nSiz0) ) != pMrkPnts->end();
+                            bool bSelected= rMrkPnts.find( sal_uInt16(i-nSiz0) ) != rMrkPnts.end();
                             pHdl->SetSelected(bSelected);
                             if (mbPlusHdlAlways || bSelected)
                             {
@@ -893,29 +892,26 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell)
         {
             const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
             SdrObject* pObj=pM->GetMarkedSdrObj();
+            const SdrGluePointList* pGPL=pObj->GetGluePointList();
+            if (!pGPL)
+                continue;
+
             SdrPageView* pPV=pM->GetPageView();
-            const SdrUShortCont* pMrkGlue=pM->GetMarkedGluePoints();
-            if (pMrkGlue!=nullptr)
+            const SdrUShortCont& rMrkGlue=pM->GetMarkedGluePoints();
+            for (SdrUShortCont::const_iterator it = rMrkGlue.begin(); it != rMrkGlue.end(); ++it)
             {
-                const SdrGluePointList* pGPL=pObj->GetGluePointList();
-                if (pGPL!=nullptr)
+                sal_uInt16 nId=*it;
+                //nNum changed to nNumGP because already used in for loop
+                sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
+                if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
                 {
-                    for(SdrUShortCont::const_iterator it = pMrkGlue->begin(); it != pMrkGlue->end(); ++it)
-                    {
-                        sal_uInt16 nId=*it;
-                        //nNum changed to nNumGP because already used in for loop
-                        sal_uInt16 nNumGP=pGPL->FindGluePoint(nId);
-                        if (nNumGP!=SDRGLUEPOINT_NOTFOUND)
-                        {
-                            const SdrGluePoint& rGP=(*pGPL)[nNumGP];
-                            Point aPos(rGP.GetAbsolutePos(*pObj));
-                            SdrHdl* pGlueHdl=new SdrHdl(aPos,SdrHdlKind::Glue);
-                            pGlueHdl->SetObj(pObj);
-                            pGlueHdl->SetPageView(pPV);
-                            pGlueHdl->SetObjHdlNum(nId);
-                            maHdlList.AddHdl(pGlueHdl);
-                        }
-                    }
+                    const SdrGluePoint& rGP=(*pGPL)[nNumGP];
+                    Point aPos(rGP.GetAbsolutePos(*pObj));
+                    SdrHdl* pGlueHdl=new SdrHdl(aPos,SdrHdlKind::Glue);
+                    pGlueHdl->SetObj(pObj);
+                    pGlueHdl->SetPageView(pPV);
+                    pGlueHdl->SetObjHdlNum(nId);
+                    maHdlList.AddHdl(pGlueHdl);
                 }
             }
         }
@@ -1285,10 +1281,8 @@ void SdrMarkView::CheckMarked()
         else
         {
             if (!IsGluePointEditMode()) { // selected glue points only in GlueEditMode
-                SdrUShortCont* pPts=pM->GetMarkedGluePoints();
-                if (pPts!=nullptr) {
-                    pPts->clear();
-                }
+                SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+                rPts.clear();
             }
         }
     }
diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx
index 319d7ed..cd833e7 100644
--- a/svx/source/svdraw/svdmrkv1.cxx
+++ b/svx/source/svdraw/svdmrkv1.cxx
@@ -75,8 +75,8 @@ bool SdrMarkView::HasMarkedPoints() const
         if (nMarkCount<=static_cast<size_t>(mnFrameHandlesLimit)) {
             for (size_t nMarkNum=0; nMarkNum<nMarkCount && !bRet; ++nMarkNum) {
                 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
-                const SdrUShortCont* pPts=pM->GetMarkedPoints();
-                bRet=pPts!=nullptr && !pPts->empty();
+                const SdrUShortCont& rPts = pM->GetMarkedPoints();
+                bRet = !rPts.empty();
             }
         }
     }
@@ -92,8 +92,8 @@ sal_uIntPtr SdrMarkView::GetMarkedPointCount() const
         if (nMarkCount<=static_cast<size_t>(mnFrameHandlesLimit)) {
             for (size_t nMarkNum=0; nMarkNum<nMarkCount; ++nMarkNum) {
                 const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
-                const SdrUShortCont* pPts=pM->GetMarkedPoints();
-                if (pPts!=nullptr) nCount+=pPts->size();
+                const SdrUShortCont& rPts = pM->GetMarkedPoints();
+                nCount += rPts.size();
             }
         }
     }
@@ -130,17 +130,17 @@ bool SdrMarkView::ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark)
         pMark=GetSdrMarkByIndex(nMarkNum);
     }
     const sal_uInt32 nHdlNum(pHdl->GetObjHdlNum());
-    SdrUShortCont* pPts=pMark->ForceMarkedPoints();
+    SdrUShortCont& rPts=pMark->GetMarkedPoints();
     if (!bUnmark)
     {
-        pPts->insert((sal_uInt16)nHdlNum);
+        rPts.insert((sal_uInt16)nHdlNum);
     }
     else
     {
-        SdrUShortCont::const_iterator it = pPts->find( (sal_uInt16)nHdlNum );
-        if (it != pPts->end())
+        SdrUShortCont::const_iterator it = rPts.find( (sal_uInt16)nHdlNum );
+        if (it != rPts.end())
         {
-            pPts->erase(it);
+            rPts.erase(it);
         }
         else
         {
@@ -196,7 +196,6 @@ bool SdrMarkView::MarkPoint(SdrHdl& rHdl, bool bUnmark)
         const size_t nMarkNum=TryToFindMarkedObject(pObj);
         if (nMarkNum!=SAL_MAX_SIZE) {
             SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
-            pM->ForceMarkedPoints();
             if (ImpMarkPoint(&rHdl,pM,bUnmark)) {
                 MarkListHasChanged();
                 bRet=true;
@@ -229,7 +228,6 @@ bool SdrMarkView::MarkPoints(const Rectangle* pRect, bool bUnmark)
                     pM=GetSdrMarkByIndex(nMarkNum);
                     pObj0=pObj;
                     pPV0=pPV;
-                    pM->ForceMarkedPoints();
                 } else {
 #ifdef DBG_UTIL
                     if (pObj->IsInserted()) {
@@ -318,52 +316,52 @@ void SdrMarkView::UndirtyMrkPnt() const
         SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
         const SdrObject* pObj=pM->GetMarkedSdrObj();
         // PolyPoints
-        SdrUShortCont* pPts=pM->GetMarkedPoints();
-        if (pPts!=nullptr) {
+        {
+            SdrUShortCont& rPts = pM->GetMarkedPoints();
             if (pObj->IsPolyObj()) {
                 // Remove invalid selected points, that is, all
                 // entries above the number of points in the object.
                 sal_uInt32 nMax(pObj->GetPointCount());
 
-                SdrUShortCont::const_iterator it = pPts->lower_bound(nMax);
-                if( it != pPts->end() )
+                SdrUShortCont::const_iterator it = rPts.lower_bound(nMax);
+                if( it != rPts.end() )
                 {
-                    pPts->erase(it, pPts->end() );
+                    rPts.erase(it, rPts.end());
                     bChg = true;
                 }
             }
             else
             {
                 OSL_FAIL("SdrMarkView::UndirtyMrkPnt(): Selected points on an object that is not a PolyObj!");
-                if(pPts && !pPts->empty())
+                if (!rPts.empty())
                 {
-                    pPts->clear();
+                    rPts.clear();
                     bChg = true;
                 }
             }
         }
 
         // GluePoints
-        pPts=pM->GetMarkedGluePoints();
-        const SdrGluePointList* pGPL=pObj->GetGluePointList();
-        if (pPts!=nullptr) {
+        {
+            SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+            const SdrGluePointList* pGPL=pObj->GetGluePointList();
             if (pGPL!=nullptr) {
                 // Remove invalid selected glue points, that is, all entries
                 // (IDs) that aren't contained in the GluePointList of the
                 // object
-                for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); )
+                for(SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); )
                 {
                     sal_uInt16 nId=*it;
                     if (pGPL->FindGluePoint(nId)==SDRGLUEPOINT_NOTFOUND) {
-                        it = pPts->erase(it);
+                        it = rPts.erase(it);
                         bChg=true;
                     }
                     else
                         ++it;
                 }
             } else {
-                if (pPts!=nullptr && !pPts->empty()) {
-                    pPts->clear(); // object doesn't have any glue points (any more)
+                if (!rPts.empty()) {
+                    rPts.clear(); // object doesn't have any glue points (any more)
                     bChg=true;
                 }
             }
@@ -408,8 +406,8 @@ bool SdrMarkView::HasMarkedGluePoints() const
     const size_t nMarkCount=GetMarkedObjectCount();
     for (size_t nMarkNum=0; nMarkNum<nMarkCount && !bRet; ++nMarkNum) {
         const SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
-        const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
-        bRet=pPts!=nullptr && !pPts->empty();
+        const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+        bRet = !rPts.empty();
     }
     return bRet;
 }
@@ -425,14 +423,14 @@ bool SdrMarkView::MarkGluePoints(const Rectangle* pRect, bool bUnmark)
         SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
         const SdrObject* pObj=pM->GetMarkedSdrObj();
         const SdrGluePointList* pGPL=pObj->GetGluePointList();
-        SdrUShortCont* pPts=pM->GetMarkedGluePoints();
+        SdrUShortCont& rPts = pM->GetMarkedGluePoints();
         if (bUnmark && pRect==nullptr) { // UnmarkAll
-            if (pPts!=nullptr && !pPts->empty()) {
-                pPts->clear();
+            if (!rPts.empty()) {
+                rPts.clear();
                 bChgd=true;
             }
         } else {
-            if (pGPL!=nullptr && (pPts!=nullptr || !bUnmark)) {
+            if (pGPL!=nullptr) {
                 sal_uInt16 nGPAnz=pGPL->GetCount();
                 for (sal_uInt16 nGPNum=0; nGPNum<nGPAnz; nGPNum++) {
                     const SdrGluePoint& rGP=(*pGPL)[nGPNum];
@@ -442,16 +440,14 @@ bool SdrMarkView::MarkGluePoints(const Rectangle* pRect, bool bUnmark)
                     {
                         Point aPos(rGP.GetAbsolutePos(*pObj));
                         if (pRect==nullptr || pRect->IsInside(aPos)) {
-                            if (pPts==nullptr)
-                                pPts=pM->ForceMarkedGluePoints();
-                            bool bContains = pPts->find( rGP.GetId() ) != pPts->end();
+                            bool bContains = rPts.find( rGP.GetId() ) != rPts.end();
                             if (!bUnmark && !bContains) {
                                 bChgd=true;
-                                pPts->insert(rGP.GetId());
+                                rPts.insert(rGP.GetId());
                             }
                             if (bUnmark && bContains) {
                                 bChgd=true;
-                                pPts->erase(rGP.GetId());
+                                rPts.erase(rGP.GetId());
                             }
                         }
                     }
@@ -511,17 +507,15 @@ bool SdrMarkView::MarkGluePoint(const SdrObject* pObj, sal_uInt16 nId, const Sdr
         const size_t nMarkPos=TryToFindMarkedObject(pObj);
         if (nMarkPos!=SAL_MAX_SIZE) {
             SdrMark* pM=GetSdrMarkByIndex(nMarkPos);
-            SdrUShortCont* pPts=bUnmark ? pM->GetMarkedGluePoints() : pM->ForceMarkedGluePoints();
-            if (pPts!=nullptr) {
-                bool bContains = pPts->find( nId ) != pPts->end();
-                if (!bUnmark && !bContains) {
-                    bChgd=true;
-                    pPts->insert(nId);
-                }
-                if (bUnmark && bContains) {
-                    bChgd=true;
-                    pPts->erase(nId);
-                }
+            SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+            bool bContains = rPts.find( nId ) != rPts.end();
+            if (!bUnmark && !bContains) {
+                bChgd=true;
+                rPts.insert(nId);
+            }
+            if (bUnmark && bContains) {
+                bChgd=true;
+                rPts.erase(nId);
             }
         } else {
             // TODO: implement implicit selection of objects
@@ -541,10 +535,8 @@ bool SdrMarkView::IsGluePointMarked(const SdrObject* pObj, sal_uInt16 nId) const
     const size_t nPos=TryToFindMarkedObject(pObj); // casting to NonConst
     if (nPos!=SAL_MAX_SIZE) {
         const SdrMark* pM=GetSdrMarkByIndex(nPos);
-        const SdrUShortCont* pPts=pM->GetMarkedGluePoints();
-        if (pPts!=nullptr) {
-            bRet = pPts->find( nId ) != pPts->end();
-        }
+        const SdrUShortCont& rPts = pM->GetMarkedGluePoints();
+        bRet = rPts.find( nId ) != rPts.end();
     }
     return bRet;
 }
diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx
index b61d285..b8b0356 100644
--- a/svx/source/svdraw/svdpoev.cxx
+++ b/svx/source/svdraw/svdpoev.cxx
@@ -79,95 +79,93 @@ void SdrPolyEditView::ImpCheckPolyPossibilities()
 void SdrPolyEditView::CheckPolyPossibilitiesHelper( SdrMark* pM, bool& b1stSmooth, bool& b1stSegm, bool& bCurve, bool& bSmoothFuz, bool& bSegmFuz, basegfx::B2VectorContinuity& eSmooth )
 {
     SdrObject* pObj = pM->GetMarkedSdrObj();
-    SdrUShortCont* pPts = pM->GetMarkedPoints();
     SdrPathObj* pPath = dynamic_cast<SdrPathObj*>( pObj );
 
-    if(pPath && pPts)
+    if (!pPath)
+        return;
+
+    SdrUShortCont& rPts = pM->GetMarkedPoints();
+    if (rPts.empty())
+        return;
+
+    const bool bClosed(pPath->IsClosed());
+    bSetMarkedPointsSmoothPossible = true;
+
+    if (bClosed)
+    {
+        bSetMarkedSegmentsKindPossible = true;
+    }
+
+    for (SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
     {
-        const sal_uInt32 nMarkedPointCount(pPts->size());
+        sal_uInt32 nNum(*it);
+        sal_uInt32 nPolyNum, nPntNum;
 
-        if(nMarkedPointCount)
+        if(PolyPolygonEditor::GetRelativePolyPoint(pPath->GetPathPoly(), nNum, nPolyNum, nPntNum))
         {
-            bool bClosed(pPath->IsClosed());
-            bSetMarkedPointsSmoothPossible = true;
+            const basegfx::B2DPolygon aLocalPolygon(pPath->GetPathPoly().getB2DPolygon(nPolyNum));
+            bool bCanSegment(bClosed || nPntNum < aLocalPolygon.count() - 1L);
 
-            if(bClosed)
+            if(!bSetMarkedSegmentsKindPossible && bCanSegment)
             {
                 bSetMarkedSegmentsKindPossible = true;
             }
 
-            for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
+            if(!bSmoothFuz)
             {
-                sal_uInt32 nNum(*it);
-                sal_uInt32 nPolyNum, nPntNum;
-
-                if(PolyPolygonEditor::GetRelativePolyPoint(pPath->GetPathPoly(), nNum, nPolyNum, nPntNum))
+                if (b1stSmooth)
+                {
+                    b1stSmooth = false;
+                    eSmooth = basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum);
+                }
+                else
                 {
-                    const basegfx::B2DPolygon aLocalPolygon(pPath->GetPathPoly().getB2DPolygon(nPolyNum));
-                    bool bCanSegment(bClosed || nPntNum < aLocalPolygon.count() - 1L);
+                    bSmoothFuz = (eSmooth != basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum));
+                }
+            }
 
-                    if(!bSetMarkedSegmentsKindPossible && bCanSegment)
-                    {
-                        bSetMarkedSegmentsKindPossible = true;
-                    }
+            if(!bSegmFuz)
+            {
+                if(bCanSegment)
+                {
+                    bool bCrv(aLocalPolygon.isNextControlPointUsed(nPntNum));
 
-                    if(!bSmoothFuz)
+                    if(b1stSegm)
                     {
-                        if (b1stSmooth)
-                        {
-                            b1stSmooth = false;
-                            eSmooth = basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum);
-                        }
-                        else
-                        {
-                            bSmoothFuz = (eSmooth != basegfx::tools::getContinuityInPoint(aLocalPolygon, nPntNum));
-                        }
+                        b1stSegm = false;
+                        bCurve = bCrv;
                     }
-
-                    if(!bSegmFuz)
+                    else
                     {
-                        if(bCanSegment)
-                        {
-                            bool bCrv(aLocalPolygon.isNextControlPointUsed(nPntNum));
-
-                            if(b1stSegm)
-                            {
-                                b1stSegm = false;
-                                bCurve = bCrv;
-                            }
-                            else
-                            {
-                                bSegmFuz = (bCrv != bCurve);
-                            }
-                        }
+                        bSegmFuz = (bCrv != bCurve);
                     }
                 }
             }
+        }
+    }
 
-            if(!b1stSmooth && !bSmoothFuz)
-            {
-                if(basegfx::B2VectorContinuity::NONE == eSmooth)
-                {
-                    eMarkedPointsSmooth = SdrPathSmoothKind::Angular;
-                }
-
-                if(basegfx::B2VectorContinuity::C1 == eSmooth)
-                {
-                    eMarkedPointsSmooth = SdrPathSmoothKind::Asymmetric;
-                }
+    if(!b1stSmooth && !bSmoothFuz)
+    {
+        if(basegfx::B2VectorContinuity::NONE == eSmooth)
+        {
+            eMarkedPointsSmooth = SdrPathSmoothKind::Angular;
+        }
 
-                if(basegfx::B2VectorContinuity::C2 == eSmooth)
-                {
-                    eMarkedPointsSmooth = SdrPathSmoothKind::Symmetric;
-                }
-            }
+        if(basegfx::B2VectorContinuity::C1 == eSmooth)
+        {
+            eMarkedPointsSmooth = SdrPathSmoothKind::Asymmetric;
+        }
 
-            if(!b1stSegm && !bSegmFuz)
-            {
-                eMarkedSegmentsKind = (bCurve) ? SdrPathSegmentKind::Curve : SdrPathSegmentKind::Line;
-            }
+        if(basegfx::B2VectorContinuity::C2 == eSmooth)
+        {
+            eMarkedPointsSmooth = SdrPathSmoothKind::Symmetric;
         }
     }
+
+    if(!b1stSegm && !bSegmFuz)
+    {
+        eMarkedSegmentsKind = (bCurve) ? SdrPathSegmentKind::Curve : SdrPathSegmentKind::Line;
+    }
 }
 
 void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind)
@@ -204,18 +202,17 @@ void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind)
         {
             --nMarkNum;
             SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
-            SdrUShortCont* pPts = pM->GetMarkedPoints();
             SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
+            if (!pPath)
+                continue;
 
-            if(pPts && pPath)
+            SdrUShortCont& rPts = pM->GetMarkedPoints();
+            PolyPolygonEditor aEditor(pPath->GetPathPoly(), pPath->IsClosed());
+            if (aEditor.SetPointsSmooth(eFlags, rPts))
             {
-                PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
-                if(aEditor.SetPointsSmooth( eFlags, *pPts ) )
-                {
-                    if( bUndo )
-                        AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
-                    pPath->SetPathPoly(aEditor.GetPolyPolygon());
-                }
+                if( bUndo )
+                    AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
+                pPath->SetPathPoly(aEditor.GetPolyPolygon());
             }
         }
 
@@ -239,18 +236,16 @@ void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind)
         {
             --nMarkNum;
             SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
-            SdrUShortCont* pPts = pM->GetMarkedPoints();
             SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
-
-            if(pPts && pPath)
+            if (!pPath)
+                continue;
+            SdrUShortCont& rPts = pM->GetMarkedPoints();
+            PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
+            if (aEditor.SetSegmentsKind(eKind, rPts))
             {
-                PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
-                if(aEditor.SetSegmentsKind( eKind, *pPts ) )
-                {
-                    if( bUndo )
-                        AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
-                    pPath->SetPathPoly(aEditor.GetPolyPolygon());
-                }
+                if( bUndo )
+                    AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath));
+                pPath->SetPathPoly(aEditor.GetPolyPolygon());
             }
         }
 
@@ -307,30 +302,29 @@ void SdrPolyEditView::DeleteMarkedPoints()
         {
             --nMarkNum;
             SdrMark* pM=GetSdrMarkByIndex(nMarkNum);
-            SdrUShortCont* pPts=pM->GetMarkedPoints();
             SdrPathObj* pPath = dynamic_cast< SdrPathObj* >( pM->GetMarkedSdrObj() );
+            if (!pPath)
+                continue;
 
-            if( pPath && pPts )
+            SdrUShortCont& rPts = pM->GetMarkedPoints();
+            PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
+            if (aEditor.DeletePoints(rPts))
             {
-                PolyPolygonEditor aEditor( pPath->GetPathPoly(), pPath->IsClosed() );
-                if( aEditor.DeletePoints( *pPts ) )
+                if( aEditor.GetPolyPolygon().count() )
                 {
-                    if( aEditor.GetPolyPolygon().count() )
-                    {
-                        if( bUndo )
-                            AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath ));
-                        pPath->SetPathPoly( aEditor.GetPolyPolygon() );
-                    }
-                    else
+                    if( bUndo )
+                        AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath ));
+                    pPath->SetPathPoly( aEditor.GetPolyPolygon() );
+                }
+                else
+                {
+                    if( bUndo )
+                        AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pPath ) );
+                    pM->GetPageView()->GetObjList()->RemoveObject(pPath->GetOrdNum());
+                    if( !bUndo )
                     {
-                        if( bUndo )
-                            AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pPath ) );
-                        pM->GetPageView()->GetObjList()->RemoveObject(pPath->GetOrdNum());
-                        if( !bUndo )
-                        {
-                            SdrObject* pObj = pPath;
-                            SdrObject::Free(pObj);
-                        }
+                        SdrObject* pObj = pPath;
+                        SdrObject::Free(pObj);
                     }
                 }
             }
@@ -358,55 +352,55 @@ void SdrPolyEditView::RipUpAtMarkedPoints()
         {
             --nMarkNum;
             SdrMark* pM = GetSdrMarkByIndex(nMarkNum);
-            SdrUShortCont* pPts = pM->GetMarkedPoints();
             SdrPathObj* pObj = dynamic_cast<SdrPathObj*>( pM->GetMarkedSdrObj() );
+            if (!pObj)
+                continue;
+
+            SdrUShortCont& rPts = pM->GetMarkedPoints();
+
+            if( bUndo )
+                AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+            bool bKorregFlag(false);
+            sal_uInt32 nMax(pObj->GetHdlCount());
 
-            if(pPts && pObj)
+            for(SdrUShortCont::const_reverse_iterator it = rPts.rbegin(); it != rPts.rend(); ++it)
             {
-                if( bUndo )
-                    AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
-                bool bKorregFlag(false);
-                sal_uInt32 nMax(pObj->GetHdlCount());
+                sal_uInt32 nNewPt0Idx(0L);
+                SdrObject* pNeuObj = pObj->RipPoint(*it, nNewPt0Idx);
 
-                for(SdrUShortCont::const_reverse_iterator it = pPts->rbegin(); it != pPts->rend(); ++it)
+                if(pNeuObj)
                 {
-                    sal_uInt32 nNewPt0Idx(0L);
-                    SdrObject* pNeuObj = pObj->RipPoint(*it, nNewPt0Idx);
+                    SdrInsertReason aReason(SdrInsertReasonKind::ViewCall);
+                    pM->GetPageView()->GetObjList()->InsertObject(pNeuObj, pObj->GetOrdNum() + 1, &aReason);
+                    if( bUndo )
+                        AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNeuObj));
+                    MarkObj(pNeuObj, pM->GetPageView(), false, true);
+                }
 
-                    if(pNeuObj)
+                if(nNewPt0Idx)
+                {
+                    // correction necessary?
+                    DBG_ASSERT(!bKorregFlag,"Multiple index corrections at SdrPolyEditView::RipUp().");
+                    if(!bKorregFlag)
                     {
-                        SdrInsertReason aReason(SdrInsertReasonKind::ViewCall);
-                        pM->GetPageView()->GetObjList()->InsertObject(pNeuObj, pObj->GetOrdNum() + 1, &aReason);
-                        if( bUndo )
-                            AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNeuObj));
-                        MarkObj(pNeuObj, pM->GetPageView(), false, true);
-                    }
+                        bKorregFlag = true;
 
-                    if(nNewPt0Idx)
-                    {
-                        // correction necessary?
-                        DBG_ASSERT(!bKorregFlag,"Multiple index corrections at SdrPolyEditView::RipUp().");
-                        if(!bKorregFlag)
+                        SdrUShortCont aReplaceSet;
+                        for(SdrUShortCont::const_iterator it2 = rPts.begin(); it2 != rPts.end(); ++it2)
                         {
-                            bKorregFlag = true;
+                            sal_uInt32 nPntNum(*it2);
+                            nPntNum += nNewPt0Idx;
 
-                            SdrUShortCont aReplaceSet;
-                            for(SdrUShortCont::const_iterator it2 = pPts->begin(); it2 != pPts->end(); ++it2)
+                            if(nPntNum >= nMax)
                             {
-                                sal_uInt32 nPntNum(*it2);
-                                nPntNum += nNewPt0Idx;
-
-                                if(nPntNum >= nMax)
-                                {
-                                    nPntNum -= nMax;
-                                }
-
-                                aReplaceSet.insert( (sal_uInt16)nPntNum );
+                                nPntNum -= nMax;
                             }
-                            pPts->swap(aReplaceSet);
 
-                            it = pPts->rbegin();
+                            aReplaceSet.insert( (sal_uInt16)nPntNum );
                         }
+                        rPts.swap(aReplaceSet);
+
+                        it = rPts.rbegin();
                     }
                 }
             }
@@ -429,33 +423,32 @@ bool SdrPolyEditView::IsRipUpAtMarkedPointsPossible() const
         const SdrMark* pMark = GetSdrMarkByIndex(a);
         const SdrPathObj* pMarkedPathObject = dynamic_cast< const SdrPathObj* >(pMark->GetMarkedSdrObj());
 
-        if(pMarkedPathObject)
+        if (!pMarkedPathObject)
+            continue;
+
+        const SdrUShortCont& rSelectedPoints = pMark->GetMarkedPoints();
+        if (rSelectedPoints.empty())
+            continue;
+
+        const basegfx::B2DPolyPolygon& rPathPolyPolygon = pMarkedPathObject->GetPathPoly();
+
+        if(1 == rPathPolyPolygon.count())
         {
-            const SdrUShortCont* pSelectedPoints = pMark->GetMarkedPoints();
+            // #i76617# Do not yet use basegfx::B2DPolygon since curve definitions
+            // are different and methods need to be changed thoroughly with interaction rework
+            const tools::Polygon aPathPolygon(rPathPolyPolygon.getB2DPolygon(0));
+            const sal_uInt16 nPointCount(aPathPolygon.GetSize());
 
-            if(pSelectedPoints && !pSelectedPoints->empty())
+            if(nPointCount >= 3)
             {
-                const basegfx::B2DPolyPolygon& rPathPolyPolygon = pMarkedPathObject->GetPathPoly();
+                bRetval = pMarkedPathObject->IsClosedObj(); // #i76617#
 
-                if(1 == rPathPolyPolygon.count())
+                for(SdrUShortCont::const_iterator it = rSelectedPoints.begin();
+                    !bRetval && it != rSelectedPoints.end(); ++it)
                 {
-                    // #i76617# Do not yet use basegfx::B2DPolygon since curve definitions
-                    // are different and methods need to be changed thoroughly with interaction rework
-                    const tools::Polygon aPathPolygon(rPathPolyPolygon.getB2DPolygon(0));
-                    const sal_uInt16 nPointCount(aPathPolygon.GetSize());
+                    const sal_uInt16 nMarkedPointNum(*it);
 
-                    if(nPointCount >= 3)
-                    {
-                        bRetval = pMarkedPathObject->IsClosedObj(); // #i76617#
-
-                        for(SdrUShortCont::const_iterator it = pSelectedPoints->begin();
-                            !bRetval && it != pSelectedPoints->end(); ++it)
-                        {
-                            const sal_uInt16 nMarkedPointNum(*it);
-
-                            bRetval = (nMarkedPointNum > 0 && nMarkedPointNum < nPointCount - 1);
-                        }
-                    }
+                    bRetval = (nMarkedPointNum > 0 && nMarkedPointNum < nPointCount - 1);
                 }
             }
         }
@@ -541,67 +534,69 @@ void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void*
     {
         SdrMark* pM=GetSdrMarkByIndex(nm);
         SdrObject* pObj=pM->GetMarkedSdrObj();
-        const SdrUShortCont* pPts=pM->GetMarkedPoints();
-        sal_uIntPtr nPointCount=pPts==nullptr ? 0 : pPts->size();
         SdrPathObj* pPath=dynamic_cast<SdrPathObj*>( pObj );
-        if (nPointCount!=0 && pPath!=nullptr)
-        {
-            if( bUndo )
-                AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
+        if (!pPath)
+            continue;
 
-            basegfx::B2DPolyPolygon aXPP(pPath->GetPathPoly());
+        const SdrUShortCont& rPts = pM->GetMarkedPoints();
+        if (rPts.empty())
+            continue;
 
-            for(SdrUShortCont::const_iterator it = pPts->begin(); it != pPts->end(); ++it)
-            {
-                sal_uInt32 nPt = *it;
-                sal_uInt32 nPolyNum, nPointNum;
+        if( bUndo )
+            AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
 
-                if(PolyPolygonEditor::GetRelativePolyPoint(aXPP, nPt, nPolyNum, nPointNum))
-                {
-                    //#i83671# used nLocalPointNum (which was the polygon point count)
-                    // instead of the point index (nPointNum). This of course leaded
-                    // to a wrong point access to the B2DPolygon.
-                    basegfx::B2DPolygon aNewXP(aXPP.getB2DPolygon(nPolyNum));
-                    Point aPos, aC1, aC2;
-                    bool bC1(false);
-                    bool bC2(false);
-
-                    const basegfx::B2DPoint aB2DPos(aNewXP.getB2DPoint(nPointNum));
-                    aPos = Point(FRound(aB2DPos.getX()), FRound(aB2DPos.getY()));
-
-                    if(aNewXP.isPrevControlPointUsed(nPointNum))
-                    {
-                        const basegfx::B2DPoint aB2DC1(aNewXP.getPrevControlPoint(nPointNum));
-                        aC1 = Point(FRound(aB2DC1.getX()), FRound(aB2DC1.getY()));
-                        bC1 = true;
-                    }
+        basegfx::B2DPolyPolygon aXPP(pPath->GetPathPoly());
 
-                    if(aNewXP.isNextControlPointUsed(nPointNum))
-                    {
-                        const basegfx::B2DPoint aB2DC2(aNewXP.getNextControlPoint(nPointNum));
-                        aC2 = Point(FRound(aB2DC2.getX()), FRound(aB2DC2.getY()));
-                        bC2 = true;
-                    }
+        for (SdrUShortCont::const_iterator it = rPts.begin(); it != rPts.end(); ++it)
+        {
+            sal_uInt32 nPt = *it;
+            sal_uInt32 nPolyNum, nPointNum;
+
+            if(PolyPolygonEditor::GetRelativePolyPoint(aXPP, nPt, nPolyNum, nPointNum))
+            {
+                //#i83671# used nLocalPointNum (which was the polygon point count)
+                // instead of the point index (nPointNum). This of course leaded
+                // to a wrong point access to the B2DPolygon.
+                basegfx::B2DPolygon aNewXP(aXPP.getB2DPolygon(nPolyNum));
+                Point aPos, aC1, aC2;
+                bool bC1(false);
+                bool bC2(false);
+
+                const basegfx::B2DPoint aB2DPos(aNewXP.getB2DPoint(nPointNum));
+                aPos = Point(FRound(aB2DPos.getX()), FRound(aB2DPos.getY()));
+
+                if(aNewXP.isPrevControlPointUsed(nPointNum))
+                {
+                    const basegfx::B2DPoint aB2DC1(aNewXP.getPrevControlPoint(nPointNum));
+                    aC1 = Point(FRound(aB2DC1.getX()), FRound(aB2DC1.getY()));
+                    bC1 = true;
+                }
 
-                    (*pTrFunc)(aPos,&aC1,&aC2,p1,p2,p3,p4);
-                    aNewXP.setB2DPoint(nPointNum, basegfx::B2DPoint(aPos.X(), aPos.Y()));
+                if(aNewXP.isNextControlPointUsed(nPointNum))
+                {
+                    const basegfx::B2DPoint aB2DC2(aNewXP.getNextControlPoint(nPointNum));
+                    aC2 = Point(FRound(aB2DC2.getX()), FRound(aB2DC2.getY()));
+                    bC2 = true;
+                }
 
-                    if (bC1)
-                    {
-                        aNewXP.setPrevControlPoint(nPointNum, basegfx::B2DPoint(aC1.X(), aC1.Y()));
-                    }
+                (*pTrFunc)(aPos,&aC1,&aC2,p1,p2,p3,p4);
+                aNewXP.setB2DPoint(nPointNum, basegfx::B2DPoint(aPos.X(), aPos.Y()));
 
-                    if (bC2)
-                    {
-                        aNewXP.setNextControlPoint(nPointNum, basegfx::B2DPoint(aC2.X(), aC2.Y()));
-                    }
+                if (bC1)
+                {
+                    aNewXP.setPrevControlPoint(nPointNum, basegfx::B2DPoint(aC1.X(), aC1.Y()));
+                }
 
-                    aXPP.setB2DPolygon(nPolyNum, aNewXP);
+                if (bC2)
+                {
+                    aNewXP.setNextControlPoint(nPointNum, basegfx::B2DPoint(aC2.X(), aC2.Y()));
                 }
-            }
 
-            pPath->SetPathPoly(aXPP);
+                aXPP.setB2DPolygon(nPolyNum, aNewXP);
+            }
         }
+
+        pPath->SetPathPoly(aXPP);
     }
 }
 


More information about the Libreoffice-commits mailing list