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/svdmark.cxx | |
parent | 1b277a37c5ad219d2e275df1289ccfbce27183ee (diff) |
simplify mark points and gluepoints management
Change-Id: I52070cfe4909a13189d9c130114d98565ced9089
Diffstat (limited to 'svx/source/svdraw/svdmark.cxx')
-rw-r--r-- | svx/source/svdraw/svdmark.cxx | 64 |
1 files changed, 9 insertions, 55 deletions
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx index cf53729d5cbb..3f1db23bdf4b 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; |