diff options
-rw-r--r-- | basctl/source/dlged/propbrw.cxx | 8 | ||||
-rw-r--r-- | reportdesign/source/ui/report/propbrw.cxx | 8 | ||||
-rw-r--r-- | sc/inc/ChartTools.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/unoobj/ChartTools.cxx | 8 | ||||
-rw-r--r-- | sd/source/ui/inc/OutlinerIteratorImpl.hxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/OutlinerIterator.cxx | 38 | ||||
-rw-r--r-- | svx/source/form/fmshimp.cxx | 8 |
7 files changed, 40 insertions, 39 deletions
diff --git a/basctl/source/dlged/propbrw.cxx b/basctl/source/dlged/propbrw.cxx index f95157d4f7d7..1bdc03811958 100644 --- a/basctl/source/dlged/propbrw.cxx +++ b/basctl/source/dlged/propbrw.cxx @@ -242,11 +242,11 @@ Sequence< Reference< XInterface > > { SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj(); - std::unique_ptr<SdrObjListIter> pGroupIterator; + std::optional<SdrObjListIter> oGroupIterator; if (pCurrent->IsGroupObject()) { - pGroupIterator.reset(new SdrObjListIter(pCurrent->GetSubList())); - pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr; + oGroupIterator.emplace(pCurrent->GetSubList()); + pCurrent = oGroupIterator->IsMore() ? oGroupIterator->Next() : nullptr; } while (pCurrent) @@ -259,7 +259,7 @@ Sequence< Reference< XInterface > > } // next element - pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr; + pCurrent = oGroupIterator && oGroupIterator->IsMore() ? oGroupIterator->Next() : nullptr; } } diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 41893a9a35ed..60e45e1fefc2 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -274,11 +274,11 @@ uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const Sdr { SdrObject* pCurrent = _rMarkList.GetMark(i)->GetMarkedSdrObj(); - ::std::unique_ptr<SdrObjListIter> pGroupIterator; + ::std::optional<SdrObjListIter> oGroupIterator; if (pCurrent->IsGroupObject()) { - pGroupIterator.reset(new SdrObjListIter(pCurrent->GetSubList())); - pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr; + oGroupIterator.emplace(pCurrent->GetSubList()); + pCurrent = oGroupIterator->IsMore() ? oGroupIterator->Next() : nullptr; } while (pCurrent) @@ -288,7 +288,7 @@ uno::Sequence< Reference<uno::XInterface> > PropBrw::CreateCompPropSet(const Sdr aSets.push_back(CreateComponentPair(pObj)); // next element - pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr; + pCurrent = oGroupIterator && oGroupIterator->IsMore() ? oGroupIterator->Next() : nullptr; } } return uno::Sequence< Reference<uno::XInterface> >(aSets.data(), aSets.size()); diff --git a/sc/inc/ChartTools.hxx b/sc/inc/ChartTools.hxx index 4738c669390e..4f1accb1bbf8 100644 --- a/sc/inc/ChartTools.hxx +++ b/sc/inc/ChartTools.hxx @@ -17,6 +17,7 @@ #include <svx/svditer.hxx> #include <tools/long.hxx> #include "types.hxx" +#include <optional> class ScDocShell; class SdrOle2Obj; @@ -32,7 +33,7 @@ enum class ChartSourceType class ChartIterator { private: - std::unique_ptr<SdrObjListIter> m_pIterator; + std::optional<SdrObjListIter> m_oIterator; ChartSourceType m_eChartSourceType; public: ChartIterator(ScDocShell* pDocShell, SCTAB nTab, ChartSourceType eChartSourceType); diff --git a/sc/source/ui/unoobj/ChartTools.cxx b/sc/source/ui/unoobj/ChartTools.cxx index 6ce72bd9e792..e9fdc996a386 100644 --- a/sc/source/ui/unoobj/ChartTools.cxx +++ b/sc/source/ui/unoobj/ChartTools.cxx @@ -67,15 +67,15 @@ ChartIterator::ChartIterator(ScDocShell* pDocShell, SCTAB nTab, ChartSourceType SdrPage* pPage = pDrawLayer->GetPage(sal_uInt16(nTab)); if (!pPage) return; - m_pIterator.reset(new SdrObjListIter(pPage, SdrIterMode::DeepNoGroups)); + m_oIterator.emplace(pPage, SdrIterMode::DeepNoGroups); } SdrOle2Obj* ChartIterator::next() { - if (!m_pIterator) + if (!m_oIterator) return nullptr; - SdrObject* pObject = m_pIterator->Next(); + SdrObject* pObject = m_oIterator->Next(); while (pObject) { if (pObject->GetObjIdentifier() == SdrObjKind::OLE2 && ScDocument::IsChart(pObject)) @@ -90,7 +90,7 @@ SdrOle2Obj* ChartIterator::next() else if (!xPivotTableDataProvider.is() && m_eChartSourceType == ChartSourceType::CELL_RANGE) return pOleObject; } - pObject = m_pIterator->Next(); + pObject = m_oIterator->Next(); } return nullptr; } diff --git a/sd/source/ui/inc/OutlinerIteratorImpl.hxx b/sd/source/ui/inc/OutlinerIteratorImpl.hxx index 97249464dc03..84b11e47b636 100644 --- a/sd/source/ui/inc/OutlinerIteratorImpl.hxx +++ b/sd/source/ui/inc/OutlinerIteratorImpl.hxx @@ -19,12 +19,12 @@ #pragma once +#include <svx/svditer.hxx> #include <OutlinerIterator.hxx> -#include <memory> +#include <optional> class SdDrawDocument; class SdPage; -class SdrObjListIter; namespace sd { @@ -199,7 +199,7 @@ private: /// Pointer to the page associated with the current page index. May be NULL. SdPage* mpPage; /// Iterator of all objects on the current page. - std::unique_ptr<SdrObjListIter> mpObjectIterator; + std::optional<SdrObjListIter> moObjectIterator; // Don't use this operator. ViewIteratorImpl& operator= (const ViewIteratorImpl&) = delete; diff --git a/sd/source/ui/view/OutlinerIterator.cxx b/sd/source/ui/view/OutlinerIterator.cxx index ac3f1bc29601..a7cd6cf66bf2 100644 --- a/sd/source/ui/view/OutlinerIterator.cxx +++ b/sd/source/ui/view/OutlinerIterator.cxx @@ -544,17 +544,17 @@ IteratorImplBase* ViewIteratorImpl::Clone (IteratorImplBase* pObject) const IteratorImplBase::Clone (pObject); - if (mpObjectIterator != nullptr) + if (moObjectIterator) { - pIterator->mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward) ); + pIterator->moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward); // No direct way to set the object iterator to the current object. pIterator->maPosition.mxObject = nullptr; - while (pIterator->mpObjectIterator->IsMore() && pIterator->maPosition.mxObject.get()!=maPosition.mxObject.get()) - pIterator->maPosition.mxObject = pIterator->mpObjectIterator->Next(); + while (pIterator->moObjectIterator->IsMore() && pIterator->maPosition.mxObject.get()!=maPosition.mxObject.get()) + pIterator->maPosition.mxObject = pIterator->moObjectIterator->Next(); } else - pIterator->mpObjectIterator.reset(); + pIterator->moObjectIterator.reset(); return pIterator; } @@ -578,8 +578,8 @@ void ViewIteratorImpl::GotoNextText() } } - if (mpObjectIterator != nullptr && mpObjectIterator->IsMore()) - maPosition.mxObject = mpObjectIterator->Next(); + if (moObjectIterator && moObjectIterator->IsMore()) + maPosition.mxObject = moObjectIterator->Next(); else maPosition.mxObject = nullptr; @@ -591,9 +591,9 @@ void ViewIteratorImpl::GotoNextText() SetPage (maPosition.mnPageIndex-1); if (mpPage != nullptr) - mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward) ); - if (mpObjectIterator!=nullptr && mpObjectIterator->IsMore()) - maPosition.mxObject = mpObjectIterator->Next(); + moObjectIterator.emplace( mpPage, SdrIterMode::DeepNoGroups, !mbDirectionIsForward ); + if (moObjectIterator && moObjectIterator->IsMore()) + maPosition.mxObject = moObjectIterator->Next(); else maPosition.mxObject = nullptr; } @@ -643,13 +643,13 @@ void ViewIteratorImpl::SetPage (sal_Int32 nPageIndex) // Set up object list iterator. if (mpPage != nullptr) - mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward) ); + moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward); else - mpObjectIterator.reset(); + moObjectIterator.reset(); // Get object pointer. - if (mpObjectIterator!=nullptr && mpObjectIterator->IsMore()) - maPosition.mxObject = mpObjectIterator->Next(); + if (moObjectIterator && moObjectIterator->IsMore()) + maPosition.mxObject = moObjectIterator->Next(); else maPosition.mxObject = nullptr; @@ -669,19 +669,19 @@ void ViewIteratorImpl::Reverse() // Create reversed object list iterator. if (mpPage != nullptr) - mpObjectIterator.reset( new SdrObjListIter(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward) ); + moObjectIterator.emplace(mpPage, SdrIterMode::DeepNoGroups, ! mbDirectionIsForward); else - mpObjectIterator.reset(); + moObjectIterator.reset(); // Move iterator to the current object. ::unotools::WeakReference<SdrObject> xObject = std::move(maPosition.mxObject); maPosition.mxObject = nullptr; - if (!mpObjectIterator) + if (!moObjectIterator) return; - while (mpObjectIterator->IsMore() && maPosition.mxObject.get() != xObject.get()) - maPosition.mxObject = mpObjectIterator->Next(); + while (moObjectIterator->IsMore() && maPosition.mxObject.get() != xObject.get()) + maPosition.mxObject = moObjectIterator->Next(); } //===== DocumentIteratorImpl ============================================ diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 3b5d896cd0a0..8e7278f7e3fe 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -286,11 +286,11 @@ namespace { SdrObject* pCurrent = _rMarkList.GetMark( i )->GetMarkedSdrObj(); - std::unique_ptr<SdrObjListIter> pGroupIterator; + std::optional<SdrObjListIter> oGroupIterator; if ( pCurrent->IsGroupObject() ) { - pGroupIterator.reset(new SdrObjListIter( pCurrent->GetSubList() )); - pCurrent = pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr; + oGroupIterator.emplace( pCurrent->GetSubList() ); + pCurrent = oGroupIterator->IsMore() ? oGroupIterator->Next() : nullptr; } while ( pCurrent ) @@ -306,7 +306,7 @@ namespace } // next element - pCurrent = pGroupIterator && pGroupIterator->IsMore() ? pGroupIterator->Next() : nullptr; + pCurrent = oGroupIterator && oGroupIterator->IsMore() ? oGroupIterator->Next() : nullptr; } } } |