diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-11-08 10:25:25 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-11-08 11:22:58 +0000 |
commit | 8bff616ae65f67f2eb2e6b81f1dbbbe2f9f7f5d9 (patch) | |
tree | f64ce79243db7b919e46a7f0399dc94f09eb0eeb /svx/source/svdraw/svdglev.cxx | |
parent | 1b277a37c5ad219d2e275df1289ccfbce27183ee (diff) |
simplify mark points and gluepoints management
Change-Id: I52070cfe4909a13189d9c130114d98565ced9089
Diffstat (limited to 'svx/source/svdraw/svdglev.cxx')
-rw-r--r-- | svx/source/svdraw/svdglev.cxx | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx index a5978c1e6873..fa46fb917624 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); |