diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-22 14:13:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-25 09:13:21 +0200 |
commit | f2ab7b0ddbd324b3f98e4244bb56254bf030ac3d (patch) | |
tree | c8d4db58e2625b8432cfeed0e30871dab5d61ff9 /sd/source/ui/view | |
parent | a3c2e5c2ad7ee26044e47277149a15653647eb0e (diff) |
loplugin:useuniqueptr in ViewIteratorImpl
Change-Id: Ia17fbfbbb76d035c669e797c98a095667187ee80
Reviewed-on: https://gerrit.libreoffice.org/56337
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/view')
-rw-r--r-- | sd/source/ui/view/OutlinerIterator.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index 434f488b463c..ee805e17c8a9 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -553,7 +553,7 @@ IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const if (mpObjectIterator != nullptr) { - pIterator->mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward); + pIterator->mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward) ); // No direct way to set the object iterator to the current object. pIterator->maPosition.mxObject.reset(nullptr); @@ -561,7 +561,7 @@ IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const pIterator->maPosition.mxObject.reset(pIterator->mpObjectIterator->Next()); } else - pIterator->mpObjectIterator = nullptr; + pIterator->mpObjectIterator.reset(); return pIterator; } @@ -598,7 +598,7 @@ void ViewIteratorImpl::GotoNextText() SetPage (maPosition.mnPageIndex-1); if (mpPage != nullptr) - mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward); + mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward) ); if (mpObjectIterator!=nullptr && mpObjectIterator->IsMore()) maPosition.mxObject.reset(mpObjectIterator->Next()); else @@ -650,9 +650,9 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex) // Set up object list iterator. if (mpPage != nullptr) - mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward); + mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward) ); else - mpObjectIterator = nullptr; + mpObjectIterator.reset(); // Get object pointer. if (mpObjectIterator!=nullptr && mpObjectIterator->IsMore()) @@ -675,11 +675,10 @@ void ViewIteratorImpl::Reverse() IteratorImplBase::Reverse (); // Create reversed object list iterator. - delete mpObjectIterator; if (mpPage != nullptr) - mpObjectIterator = new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward); + mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward) ); else - mpObjectIterator = nullptr; + mpObjectIterator.reset(); // Move iterator to the current object. ::tools::WeakReference<SdrObject> xObject = maPosition.mxObject; |