[Libreoffice-commits] core.git: svtools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 18 07:09:08 UTC 2018


 svtools/source/contnr/imivctl.hxx  |    8 ++++----
 svtools/source/contnr/imivctl1.cxx |   22 ++++++++--------------
 2 files changed, 12 insertions(+), 18 deletions(-)

New commits:
commit 98f98eed80d538edaa74acaa767840326ab10025
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 17 16:21:50 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Sep 18 09:08:45 2018 +0200

    loplugin:useuniqueptr in SvxIconChoiceCtrl_Impl
    
    Change-Id: Icb13a87a8a55c89d4852a31c7708eb3596d9f689
    Reviewed-on: https://gerrit.libreoffice.org/60630
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

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<ScrollBar>       aHorSBar;
     VclPtr<ScrollBarBox>    aScrBarBox;
     tools::Rectangle               aCurSelectionRect;
-    std::vector<tools::Rectangle*> aSelectedRectList;
+    std::vector<tools::Rectangle> 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<tools::Rectangle*>* pOtherRects
+                            std::vector<tools::Rectangle>* pOtherRects
                         );
 
     void                SelectRange(
@@ -411,14 +411,14 @@ public:
     void                HideDDIcon();
 
     static bool         IsOver(
-                            std::vector<tools::Rectangle*>* pSelectedRectList,
+                            std::vector<tools::Rectangle>* pSelectedRectList,
                             const tools::Rectangle& rEntryBoundRect
                         );
 
     void                SelectRect(
                             const tools::Rectangle&,
                             bool bAdd,
-                            std::vector<tools::Rectangle*>* pOtherRects
+                            std::vector<tools::Rectangle>* 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<tools::Rectangle*>* pOtherRects )
+    bool bAdd, std::vector<tools::Rectangle>* 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<tools::Rectangle*>* pOtherRects )
+    std::vector<tools::Rectangle>* pOtherRects )
 {
     aCurSelectionRect = rRect;
     if( !pZOrderList || !pZOrderList->size() )
@@ -2607,13 +2607,13 @@ void SvxIconChoiceCtrl_Impl::SelectRange(
     }
 }
 
-bool SvxIconChoiceCtrl_Impl::IsOver( std::vector<tools::Rectangle*>* pRectList, const tools::Rectangle& rBoundRect )
+bool SvxIconChoiceCtrl_Impl::IsOver( std::vector<tools::Rectangle>* 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();
 }
 


More information about the Libreoffice-commits mailing list