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

Noel Grandin noel.grandin at collabora.co.uk
Thu Jun 28 06:29:28 UTC 2018


 sc/source/ui/dbgui/sfiltdlg.cxx |   20 +++++++++-----------
 sc/source/ui/inc/filtdlg.hxx    |    6 +++---
 2 files changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 02e02fc032ee43d49cfda05eb0a30e5a21dc3ec2
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 27 10:34:12 2018 +0200

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

diff --git a/sc/source/ui/dbgui/sfiltdlg.cxx b/sc/source/ui/dbgui/sfiltdlg.cxx
index a1bff449513d..8a8cfc91ee9c 100644
--- a/sc/source/ui/dbgui/sfiltdlg.cxx
+++ b/sc/source/ui/dbgui/sfiltdlg.cxx
@@ -95,7 +95,7 @@ ScSpecialFilterDlg::ScSpecialFilterDlg( SfxBindings* pB, SfxChildWindow* pCW, vc
     pEdFilterArea->GrabFocus();
 
     // hack: control of RefInput
-    pIdle = new Idle("Special Filter Dialog");
+    pIdle.reset( new Idle("Special Filter Dialog") );
     // FIXME: this is an abomination
     pIdle->SetPriority( TaskPriority::LOWEST );
     pIdle->SetInvokeHandler( LINK( this, ScSpecialFilterDlg, TimeOutHdl ) );
@@ -114,13 +114,13 @@ void ScSpecialFilterDlg::dispose()
     for ( sal_Int32 i=1; i<nEntries; ++i )
         delete static_cast<OUString*>(pLbFilterArea->GetEntryData( i ));
 
-    delete pOptionsMgr;
+    pOptionsMgr.reset();
 
-    delete pOutItem;
+    pOutItem.reset();
 
     // hack: control of RefInput
     pIdle->Stop();
-    delete pIdle;
+    pIdle.reset();
 
     pLbFilterArea.clear();
     pEdFilterArea.clear();
@@ -195,7 +195,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
 
     // let options be initialized:
 
-    pOptionsMgr  = new ScFilterOptionsMgr(
+    pOptionsMgr.reset( new ScFilterOptionsMgr(
                             pViewData,
                             theQueryData,
                             pBtnCase,
@@ -209,7 +209,7 @@ void ScSpecialFilterDlg::Init( const SfxItemSet& rArgSet )
                             pRbCopyArea,
                             pFtDbAreaLabel,
                             pFtDbArea,
-                            aStrUndefined );
+                            aStrUndefined ) );
 
     //  special filter always needs column headers
     pBtnHeader->Check();
@@ -275,11 +275,9 @@ void ScSpecialFilterDlg::SetActive()
 ScQueryItem* ScSpecialFilterDlg::GetOutputItem( const ScQueryParam& rParam,
                                                 const ScRange& rSource )
 {
-    if ( pOutItem ) DELETEZ( pOutItem );
-    pOutItem = new ScQueryItem( nWhichQuery, &rParam );
+    pOutItem.reset(new ScQueryItem( nWhichQuery, &rParam ));
     pOutItem->SetAdvancedQuerySource( &rSource );
-
-    return pOutItem;
+    return pOutItem.get();
 }
 
 bool ScSpecialFilterDlg::IsRefInputMode() const
@@ -402,7 +400,7 @@ IMPL_LINK( ScSpecialFilterDlg, TimeOutHdl, Timer*, _pIdle, void )
 {
     // every 50ms check whether RefInputMode is still true
 
-    if( (_pIdle == pIdle) && IsActive() )
+    if( (_pIdle == pIdle.get()) && IsActive() )
     {
         if( pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus() )
         {
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index 1505a0bec22f..c257236e8e40 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -195,11 +195,11 @@ private:
     VclPtr<OKButton>        pBtnOk;
     VclPtr<CancelButton>    pBtnCancel;
 
-    ScFilterOptionsMgr* pOptionsMgr;
+    std::unique_ptr<ScFilterOptionsMgr> pOptionsMgr;
 
     const sal_uInt16    nWhichQuery;
     const ScQueryParam  theQueryData;
-    ScQueryItem*        pOutItem;
+    std::unique_ptr<ScQueryItem> pOutItem;
     ScViewData*         pViewData;
     ScDocument*         pDoc;
 
@@ -207,7 +207,7 @@ private:
     bool                bRefInputMode;
 
     // Hack: RefInput control
-    Idle*  pIdle;
+    std::unique_ptr<Idle> pIdle;
 
 private:
     void            Init( const SfxItemSet& rArgSet );


More information about the Libreoffice-commits mailing list