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

Noel Grandin noel.grandin at collabora.co.uk
Tue May 29 12:03:30 UTC 2018


 svx/source/fmcomp/gridcell.cxx |   14 +++++++-------
 svx/source/inc/gridcell.hxx    |    6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 0611e0643101c9282934de872249b438bd1a7f53
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu May 17 15:39:53 2018 +0200

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

diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 8767b3efb0b5..deff8c93ffd8 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -1060,8 +1060,8 @@ DbTextField::DbTextField(DbGridColumn& _rColumn)
 
 DbTextField::~DbTextField( )
 {
-    DELETEZ( m_pPainterImplementation );
-    DELETEZ( m_pEdit );
+    m_pPainterImplementation.reset();
+    m_pEdit.reset();
 }
 
 
@@ -1102,18 +1102,18 @@ void DbTextField::Init( vcl::Window& rParent, const Reference< XRowSet >& xCurso
     if ( bIsMultiLine )
     {
         m_pWindow = VclPtr<MultiLineTextCell>::Create( &rParent, nStyle );
-        m_pEdit = new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pWindow.get() ) );
+        m_pEdit.reset(new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pWindow.get() ) ));
 
         m_pPainter = VclPtr<MultiLineTextCell>::Create( &rParent, nStyle );
-        m_pPainterImplementation = new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pPainter.get() ) );
+        m_pPainterImplementation.reset(new MultiLineEditImplementation( *static_cast< MultiLineTextCell* >( m_pPainter.get() ) ));
     }
     else
     {
         m_pWindow = VclPtr<Edit>::Create( &rParent, nStyle );
-        m_pEdit = new EditImplementation( *static_cast< Edit* >( m_pWindow.get() ) );
+        m_pEdit.reset(new EditImplementation( *static_cast< Edit* >( m_pWindow.get() ) ));
 
         m_pPainter = VclPtr<Edit>::Create( &rParent, nStyle );
-        m_pPainterImplementation = new EditImplementation( *static_cast< Edit* >( m_pPainter.get() ) );
+        m_pPainterImplementation.reset(new EditImplementation( *static_cast< Edit* >( m_pPainter.get() ) ));
     }
 
     if ( WB_LEFT == nStyle )
@@ -1135,7 +1135,7 @@ void DbTextField::Init( vcl::Window& rParent, const Reference< XRowSet >& xCurso
 
 CellControllerRef DbTextField::CreateController() const
 {
-    return new EditCellController( m_pEdit );
+    return new EditCellController( m_pEdit.get() );
 }
 
 
diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx
index 7574d90dbac2..1368e9a19a66 100644
--- a/svx/source/inc/gridcell.hxx
+++ b/svx/source/inc/gridcell.hxx
@@ -377,8 +377,8 @@ protected:
 
 class DbTextField : public DbLimitedLengthField
 {
-    ::svt::IEditImplementation* m_pEdit;
-    ::svt::IEditImplementation* m_pPainterImplementation;
+    std::unique_ptr<::svt::IEditImplementation> m_pEdit;
+    std::unique_ptr<::svt::IEditImplementation> m_pPainterImplementation;
     bool                    m_bIsSimpleEdit;
 
 protected:
@@ -387,7 +387,7 @@ protected:
 public:
     DbTextField(DbGridColumn& _rColumn);
 
-    ::svt::IEditImplementation* GetEditImplementation() { return m_pEdit; }
+    ::svt::IEditImplementation* GetEditImplementation() { return m_pEdit.get(); }
     bool                    IsSimpleEdit() const { return m_bIsSimpleEdit; }
 
     virtual void Init( vcl::Window& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override;


More information about the Libreoffice-commits mailing list