include/svx/float3d.hxx | 8 ++++---- include/svx/graphctl.hxx | 12 ++++++------ svx/source/dialog/graphctl.cxx | 30 ++++++++++++------------------ svx/source/engine3d/float3d.cxx | 18 +++++++++--------- svx/source/table/accessiblecell.cxx | 5 ++--- svx/source/table/accessiblecell.hxx | 2 +- 6 files changed, 34 insertions(+), 41 deletions(-)
New commits: commit e23678f58113b4bb6624a2c0cf3170bcd2d7577e Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jun 4 14:31:39 2018 +0200 loplugin:useuniqueptr in AccessibleCell Change-Id: I8502e7695ad9d28d57d1cb5c7f01c7bacd4a69aa Reviewed-on: https://gerrit.libreoffice.org/55517 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index 08754ad21160..75eba41d2d43 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -83,7 +83,7 @@ void AccessibleCell::Init() { // non-empty text -> use full-fledged edit source right away - mpText = new AccessibleTextHelper( o3tl::make_unique<SvxTextEditSource>(mxCell->GetObject(), mxCell.get(), *pView, *pWindow) ); + mpText.reset( new AccessibleTextHelper( o3tl::make_unique<SvxTextEditSource>(mxCell->GetObject(), mxCell.get(), *pView, *pWindow) ) ); if( mxCell.is() && mxCell.get()->IsActiveCell() ) mpText->SetFocus(); mpText->SetEventSource(this); @@ -520,8 +520,7 @@ void AccessibleCell::disposing() if (mpText != nullptr) { mpText->Dispose(); - delete mpText; - mpText = nullptr; + mpText.reset(); } // Cleanup. Remove references to objects to allow them to be diff --git a/svx/source/table/accessiblecell.hxx b/svx/source/table/accessiblecell.hxx index aae99550d083..780b68625fd6 100644 --- a/svx/source/table/accessiblecell.hxx +++ b/svx/source/table/accessiblecell.hxx @@ -119,7 +119,7 @@ protected: sal_Int32 mnIndexInParent; /// The accessible text engine. May be NULL if it can not be created. - AccessibleTextHelper* mpText; + std::unique_ptr<AccessibleTextHelper> mpText; sdr::table::CellRef mxCell; commit ee28d75d495c9e115397e0825b14bd3cbf67d5f3 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jun 4 14:30:16 2018 +0200 loplugin:useuniqueptr in Svx3DWin Change-Id: I529a486b7b60306293089b776202810f84ab0126 Reviewed-on: https://gerrit.libreoffice.org/55516 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/float3d.hxx b/include/svx/float3d.hxx index b79255a67b5d..7529fddec56a 100644 --- a/include/svx/float3d.hxx +++ b/include/svx/float3d.hxx @@ -170,14 +170,14 @@ private: ViewType3D eViewType; // Model, Page, View etc. for favourites - FmFormModel* pModel; + std::unique_ptr<FmFormModel> pModel; VclPtr<VirtualDevice> pVDev; SfxBindings* pBindings; - Svx3DCtrlItem* pControllerItem; + std::unique_ptr<Svx3DCtrlItem> pControllerItem; - SvxConvertTo3DItem* pConvertTo3DItem; - SvxConvertTo3DItem* pConvertTo3DLatheItem; + std::unique_ptr<SvxConvertTo3DItem> pConvertTo3DItem; + std::unique_ptr<SvxConvertTo3DItem> pConvertTo3DLatheItem; std::unique_ptr<Svx3DWinImpl> mpImpl; MapUnit ePoolUnit; diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index 615957ada6a4..4d840574eeee 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -212,9 +212,9 @@ Svx3DWin::Svx3DWin(SfxBindings* pInBindings, SfxChildWindow *pCW, vcl::Window* p m_pMtrDistance->SetUnit( eFUnit ); m_pMtrFocalLength->SetUnit( eFUnit ); - pControllerItem = new Svx3DCtrlItem(SID_3D_STATE, pBindings); - pConvertTo3DItem = new SvxConvertTo3DItem(SID_CONVERT_TO_3D, pBindings); - pConvertTo3DLatheItem = new SvxConvertTo3DItem(SID_CONVERT_TO_3D_LATHE_FAST, pBindings); + pControllerItem.reset( new Svx3DCtrlItem(SID_3D_STATE, pBindings) ); + pConvertTo3DItem.reset( new SvxConvertTo3DItem(SID_CONVERT_TO_3D, pBindings) ); + pConvertTo3DLatheItem.reset( new SvxConvertTo3DItem(SID_CONVERT_TO_3D_LATHE_FAST, pBindings) ); m_pBtnAssign->SetClickHdl( LINK( this, Svx3DWin, ClickAssignHdl ) ); m_pBtnUpdate->SetClickHdl( LINK( this, Svx3DWin, ClickUpdateHdl ) ); @@ -330,11 +330,11 @@ Svx3DWin::~Svx3DWin() void Svx3DWin::dispose() { pVDev.disposeAndClear(); - delete pModel; + pModel.reset(); - DELETEZ( pControllerItem ); - DELETEZ( pConvertTo3DItem ); - DELETEZ( pConvertTo3DLatheItem ); + pControllerItem.reset(); + pConvertTo3DItem.reset(); + pConvertTo3DLatheItem.reset(); mpImpl.reset(); @@ -2786,9 +2786,9 @@ void Svx3DWin::LBSelectColor( SvxColorListBox* pLb, const Color& rColor ) void Svx3DWin::UpdatePreview() { - if(nullptr == pModel) + if(!pModel) { - pModel = new FmFormModel(); + pModel.reset(new FmFormModel()); } // Get Itemset commit b2c9f0045b62829d09607bb69cd6480ea18b6c25 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Jun 4 14:25:01 2018 +0200 loplugin:useuniqueptr in GraphCtrl Change-Id: I47299326467e31b72094a4fa7de6dbe8dd3ced7e Reviewed-on: https://gerrit.libreoffice.org/55515 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/graphctl.hxx b/include/svx/graphctl.hxx index de9b0e7d9060..6803854983f3 100644 --- a/include/svx/graphctl.hxx +++ b/include/svx/graphctl.hxx @@ -58,7 +58,7 @@ class SVX_DLLPUBLIC GraphCtrl : public Control MapMode aMap100; Size aGraphSize; Point aMousePos; - GraphCtrlUserCall* pUserCall; + std::unique_ptr<GraphCtrlUserCall> pUserCall; SdrObjKind eObjKind; sal_uInt16 nPolyEdit; bool bEditMode; @@ -71,8 +71,8 @@ class SVX_DLLPUBLIC GraphCtrl : public Control protected: - SdrModel* pModel; - SdrView* pView; + std::unique_ptr<SdrModel> pModel; + std::unique_ptr<SdrView> pView; virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; virtual void Resize() override; @@ -87,7 +87,7 @@ protected: virtual void SdrObjChanged( const SdrObject& rObj ); virtual void MarkListHasChanged(); - SdrObjUserCall* GetSdrUserCall() { return pUserCall; } + SdrObjUserCall* GetSdrUserCall() { return pUserCall.get(); } public: @@ -108,8 +108,8 @@ public: void SetObjKind( const SdrObjKind eObjKind ); - SdrModel* GetSdrModel() const { return pModel; } - SdrView* GetSdrView() const { return pView; } + SdrModel* GetSdrModel() const { return pModel.get(); } + SdrView* GetSdrView() const { return pView.get(); } SdrObject* GetSelectedSdrObject() const; bool IsChanged() const { return mbSdrMode && pModel->IsChanged(); } 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 ) ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits