diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-04 14:25:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-11 08:25:47 +0200 |
commit | b2c9f0045b62829d09607bb69cd6480ea18b6c25 (patch) | |
tree | 7ec041d588dd21d0adba27d5acce557536156835 /svx | |
parent | 5fc92b9232a8f8125477f4b458c2418829815e53 (diff) |
loplugin:useuniqueptr in GraphCtrl
Change-Id: I47299326467e31b72094a4fa7de6dbe8dd3ced7e
Reviewed-on: https://gerrit.libreoffice.org/55515
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/graphctl.cxx | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 91073760eaa3..435de61442d6 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -65,7 +65,7 @@ GraphCtrl::GraphCtrl( vcl::Window* pParent, WinBits nStyle ) : pModel ( nullptr ), pView ( nullptr ) { - pUserCall = new GraphCtrlUserCall( *this ); + pUserCall.reset(new GraphCtrlUserCall( *this )); aUpdateIdle.SetPriority( TaskPriority::LOWEST ); aUpdateIdle.SetInvokeHandler( LINK( this, GraphCtrl, UpdateHdl ) ); aUpdateIdle.Start(); @@ -88,12 +88,9 @@ void GraphCtrl::dispose() mpAccContext->disposing(); mpAccContext.clear(); } - delete pView; - pView = nullptr; - delete pModel; - pModel = nullptr; - delete pUserCall; - pUserCall = nullptr; + pView.reset(); + pModel.reset(); + pUserCall.reset(); Control::dispose(); } @@ -105,11 +102,8 @@ void GraphCtrl::SetSdrMode(bool bSdrMode) SetBackground( Wallpaper( rStyleSettings.GetWindowColor() ) ); SetMapMode( aMap100 ); - delete pView; - pView = nullptr; - - delete pModel; - pModel = nullptr; + pView.reset(); + pModel.reset(); if ( mbSdrMode ) InitSdrModel(); @@ -124,11 +118,11 @@ void GraphCtrl::InitSdrModel() SdrPage* pPage; // destroy old junk - delete pView; - delete pModel; + pView.reset(); + pModel.reset(); // Creating a Model - pModel = new SdrModel(); + pModel.reset(new SdrModel()); pModel->GetItemPool().FreezeIdRanges(); pModel->SetScaleUnit( aMap100.GetMapUnit() ); pModel->SetScaleFraction( Fraction( 1, 1 ) ); @@ -142,7 +136,7 @@ void GraphCtrl::InitSdrModel() pModel->SetChanged( false ); // Creating a View - pView = new GraphCtrlView(*pModel, this); + pView.reset(new GraphCtrlView(*pModel, this)); pView->SetWorkArea( tools::Rectangle( Point(), aGraphSize ) ); pView->EnableExtendedMouseEventDispatcher( true ); pView->ShowSdrPage(pView->GetModel()->GetPage(0)); @@ -157,7 +151,7 @@ void GraphCtrl::InitSdrModel() // Tell the accessibility object about the changes. if (mpAccContext.is()) - mpAccContext->setModelAndView (pModel, pView); + mpAccContext->setModelAndView (pModel.get(), pView.get()); } void GraphCtrl::SetGraphic( const Graphic& rGraphic, bool bNewModel ) @@ -614,7 +608,7 @@ void GraphCtrl::MouseButtonDown( const MouseEvent& rMEvt ) // We want to realize the insert if ( pCreateObj && !pCreateObj->GetUserCall() ) - pCreateObj->SetUserCall( pUserCall ); + pCreateObj->SetUserCall( pUserCall.get() ); SetPointer( pView->GetPreferredPointer( aLogPt, this ) ); } |