From 98f98eed80d538edaa74acaa767840326ab10025 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 17 Sep 2018 16:21:50 +0200 Subject: loplugin:useuniqueptr in SvxIconChoiceCtrl_Impl Change-Id: Icb13a87a8a55c89d4852a31c7708eb3596d9f689 Reviewed-on: https://gerrit.libreoffice.org/60630 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svtools/source/contnr/imivctl.hxx | 8 ++++---- svtools/source/contnr/imivctl1.cxx | 22 ++++++++-------------- 2 files changed, 12 insertions(+), 18 deletions(-) (limited to 'svtools') diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index f519d4cdc452..e1f9c62d5e30 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -157,7 +157,7 @@ class SvxIconChoiceCtrl_Impl VclPtr aHorSBar; VclPtr aScrBarBox; tools::Rectangle aCurSelectionRect; - std::vector aSelectedRectList; + std::vector aSelectedRectList; Idle aEditIdle; // for editing in place Idle aAutoArrangeIdle; Idle aDocRectChangedIdle; @@ -245,7 +245,7 @@ class SvxIconChoiceCtrl_Impl SvxIconChoiceCtrlEntry* pEntry1, SvxIconChoiceCtrlEntry* pEntry2, bool bAdd, - std::vector* pOtherRects + std::vector* pOtherRects ); void SelectRange( @@ -411,14 +411,14 @@ public: void HideDDIcon(); static bool IsOver( - std::vector* pSelectedRectList, + std::vector* pSelectedRectList, const tools::Rectangle& rEntryBoundRect ); void SelectRect( const tools::Rectangle&, bool bAdd, - std::vector* pOtherRects + std::vector* pOtherRects ); bool IsTextHit( SvxIconChoiceCtrlEntry* pEntry, const Point& rDocPos ); diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index cb54e36d0a73..43157a9f2365 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -2456,7 +2456,7 @@ static tools::Rectangle GetHotSpot( const tools::Rectangle& rRect ) } void SvxIconChoiceCtrl_Impl::SelectRect( SvxIconChoiceCtrlEntry* pEntry1, SvxIconChoiceCtrlEntry* pEntry2, - bool bAdd, std::vector* pOtherRects ) + bool bAdd, std::vector* pOtherRects ) { DBG_ASSERT(pEntry1 && pEntry2,"SelectEntry: Invalid Entry-Ptr"); tools::Rectangle aRect( GetEntryBoundRect( pEntry1 ) ); @@ -2465,7 +2465,7 @@ void SvxIconChoiceCtrl_Impl::SelectRect( SvxIconChoiceCtrlEntry* pEntry1, SvxIco } void SvxIconChoiceCtrl_Impl::SelectRect( const tools::Rectangle& rRect, bool bAdd, - std::vector* pOtherRects ) + std::vector* pOtherRects ) { aCurSelectionRect = rRect; if( !pZOrderList || !pZOrderList->size() ) @@ -2607,13 +2607,13 @@ void SvxIconChoiceCtrl_Impl::SelectRange( } } -bool SvxIconChoiceCtrl_Impl::IsOver( std::vector* pRectList, const tools::Rectangle& rBoundRect ) +bool SvxIconChoiceCtrl_Impl::IsOver( std::vector* pRectList, const tools::Rectangle& rBoundRect ) { const sal_uInt16 nCount = pRectList->size(); for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) { - tools::Rectangle* pRect = (*pRectList)[ nCur ]; - if( rBoundRect.IsOver( *pRect )) + tools::Rectangle& rRect = (*pRectList)[ nCur ]; + if( rBoundRect.IsOver( rRect )) return true; } return false; @@ -2630,19 +2630,13 @@ void SvxIconChoiceCtrl_Impl::AddSelectedRect( SvxIconChoiceCtrlEntry* pEntry1, void SvxIconChoiceCtrl_Impl::AddSelectedRect( const tools::Rectangle& rRect ) { - tools::Rectangle* pRect = new tools::Rectangle( rRect ); - pRect->Justify(); - aSelectedRectList.push_back( pRect ); + tools::Rectangle newRect = rRect; + newRect.Justify(); + aSelectedRectList.push_back( newRect ); } void SvxIconChoiceCtrl_Impl::ClearSelectedRectList() { - const sal_uInt16 nCount = aSelectedRectList.size(); - for( sal_uInt16 nCur = 0; nCur < nCount; nCur++ ) - { - tools::Rectangle* pRect = aSelectedRectList[ nCur ]; - delete pRect; - } aSelectedRectList.clear(); } -- cgit