diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-15 16:18:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-17 10:16:35 +0200 |
commit | 11814957b081957b86c76113e1686a922d4188ba (patch) | |
tree | deac75e85fbad3413538600ff55daa77af2eb3a4 | |
parent | cf52cc9a0b1c8d46c9beb1d3583a77090a72314d (diff) |
loplugin:useuniqueptr in SvxIconChoiceCtrl_Impl
Change-Id: I42538502dd9cdd86739f56b7bd668038daf696a8
-rw-r--r-- | svtools/source/contnr/imivctl.hxx | 6 | ||||
-rw-r--r-- | svtools/source/contnr/imivctl1.cxx | 17 |
2 files changed, 11 insertions, 12 deletions
diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 5ba8627ed6e8..2920288c91bc 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -168,11 +168,11 @@ class SvxIconChoiceCtrl_Impl Size aDefaultTextSize; Size aOutputSize; // Pixel VclPtr<SvtIconChoiceCtrl> pView; - IcnCursor_Impl* pImpCursor; - IcnGridMap_Impl* pGridMap; + std::unique_ptr<IcnCursor_Impl> pImpCursor; + std::unique_ptr<IcnGridMap_Impl> pGridMap; long nMaxVirtWidth; // max. width aVirtOutputSize for ALIGN_TOP long nMaxVirtHeight; // max. height aVirtOutputSize for ALIGN_LEFT - SvxIconChoiceCtrlEntryList_impl* pZOrderList; + std::unique_ptr<SvxIconChoiceCtrlEntryList_impl> pZOrderList; SvxIconChoiceCtrlColumnInfoMap* m_pColumns; VclPtr<IcnViewEdit_Impl> pEdit; WinBits nWinBits; diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 3686ac96bba0..266941dcf6d8 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -116,7 +116,7 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( bHighlightFramePressed = false; eSelectionMode = SelectionMode::Multiple; pView = pCurView; - pZOrderList = new SvxIconChoiceCtrlEntryList_impl; + pZOrderList.reset( new SvxIconChoiceCtrlEntryList_impl ); ePositionMode = SvxIconChoiceCtrlPositionMode::Free; SetStyle( nWinStyle ); nFlags = IconChoiceFlags::NONE; @@ -128,8 +128,8 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( pDDBufDev = nullptr; pDDTempDev = nullptr; eTextMode = SvxIconChoiceCtrlTextMode::Short; - pImpCursor = new IcnCursor_Impl( this ); - pGridMap = new IcnGridMap_Impl( this ); + pImpCursor.reset( new IcnCursor_Impl( this ) ); + pGridMap.reset( new IcnGridMap_Impl( this ) ); aVerSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) ); aHorSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) ); @@ -173,9 +173,9 @@ SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl() Clear(false); StopEditTimer(); CancelUserEvents(); - delete pZOrderList; - delete pImpCursor; - delete pGridMap; + pZOrderList.reset(); + pImpCursor.reset(); + pGridMap.reset(); pDDDev.disposeAndClear(); pDDBufDev.disposeAndClear(); pDDTempDev.disposeAndClear(); @@ -658,7 +658,7 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const too rRenderContext.Push(PushFlags::CLIPREGION); rRenderContext.SetClipRegion(vcl::Region(rRect)); - SvxIconChoiceCtrlEntryList_impl* pNewZOrderList = new SvxIconChoiceCtrlEntryList_impl; + std::unique_ptr<SvxIconChoiceCtrlEntryList_impl> pNewZOrderList( new SvxIconChoiceCtrlEntryList_impl ); std::unique_ptr<SvxIconChoiceCtrlEntryList_impl> pPaintedEntries(new SvxIconChoiceCtrlEntryList_impl); size_t nPos = 0; @@ -678,8 +678,7 @@ void SvxIconChoiceCtrl_Impl::Paint(vcl::RenderContext& rRenderContext, const too nCount--; nPos++; } - delete pZOrderList; - pZOrderList = pNewZOrderList; + pZOrderList = std::move( pNewZOrderList ); nCount = pPaintedEntries->size(); if (nCount) { |