diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-24 11:10:00 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-25 12:03:48 +0200 |
commit | 5da6001918536d3d4c71410ea7e28caf3192897d (patch) | |
tree | e86b0b0ece52130378b2fbf6277226c138b787f7 | |
parent | 16ebb85eef0656482207f8030a3abead37cea867 (diff) |
loplugin:useuniqueptr in SwPageGridExample
Change-Id: Ie173b7ea280e922ed7aaaec6efca08ad0d95ffd0
Reviewed-on: https://gerrit.libreoffice.org/57940
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/source/uibase/frmdlg/colex.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/inc/colex.hxx | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index af1d833346d5..493d96cc3090 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -496,6 +496,10 @@ Size SwColumnOnlyExample::GetOptimalSize() const return LogicToPixel(Size(75, 46), MapMode(MapUnit::MapAppFont)); } +SwPageGridExample::SwPageGridExample(vcl::Window* pPar) + : SwPageExample(pPar) +{} + SwPageGridExample::~SwPageGridExample() { disposeOnce(); @@ -503,7 +507,7 @@ SwPageGridExample::~SwPageGridExample() void SwPageGridExample::dispose() { - delete pGridItem; + pGridItem.reset(); SwPageExample::dispose(); } @@ -609,10 +613,10 @@ void SwPageGridExample::DrawPage(vcl::RenderContext& rRenderContext, const Point void SwPageGridExample::UpdateExample( const SfxItemSet& rSet ) { - DELETEZ(pGridItem); + pGridItem.reset(); //get the grid information if(SfxItemState::DEFAULT <= rSet.GetItemState(RES_TEXTGRID)) - pGridItem = static_cast<SwTextGridItem*>(rSet.Get(RES_TEXTGRID).Clone()); + pGridItem.reset(static_cast<SwTextGridItem*>(rSet.Get(RES_TEXTGRID).Clone())); SwPageExample::UpdateExample(rSet); } diff --git a/sw/source/uibase/inc/colex.hxx b/sw/source/uibase/inc/colex.hxx index db65f85f13b2..4aa5d2ec3487 100644 --- a/sw/source/uibase/inc/colex.hxx +++ b/sw/source/uibase/inc/colex.hxx @@ -47,18 +47,14 @@ class SwTextGridItem; class SW_DLLPUBLIC SwPageGridExample : public SwPageExample { - SwTextGridItem* pGridItem; + std::unique_ptr<SwTextGridItem> pGridItem; protected: virtual void DrawPage(vcl::RenderContext& rRenderContext, const Point& rPoint, const bool bSecond, const bool bEnabled) override; public: - SwPageGridExample(vcl::Window* pPar) - : SwPageExample(pPar) - , pGridItem(nullptr) - {} - + SwPageGridExample(vcl::Window* pPar); virtual ~SwPageGridExample() override; virtual void dispose() override; void UpdateExample( const SfxItemSet& rSet ); |