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

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


 sc/source/ui/Accessibility/AccessibleDocument.cxx |    9 +----
 sc/source/ui/dbgui/consdlg.cxx                    |    6 +--
 sc/source/ui/dbgui/filtdlg.cxx                    |   19 +++++------
 sc/source/ui/docshell/dbdocfun.cxx                |   38 +++++++++++-----------
 sc/source/ui/docshell/docsh5.cxx                  |   10 +++--
 sc/source/ui/inc/AccessibleDocument.hxx           |    2 -
 sc/source/ui/inc/autofmt.hxx                      |    2 -
 sc/source/ui/inc/consdlg.hxx                      |    4 +-
 sc/source/ui/inc/filtdlg.hxx                      |    6 +--
 sc/source/ui/inc/undoblk.hxx                      |    4 +-
 sc/source/ui/inc/undodat.hxx                      |    7 ++--
 sc/source/ui/miscdlgs/autofmt.cxx                 |    2 -
 sc/source/ui/undo/undoblk2.cxx                    |    6 +--
 sc/source/ui/undo/undodat.cxx                     |    9 ++---
 14 files changed, 61 insertions(+), 63 deletions(-)

New commits:
commit a30e805bf782207a91a22519180801c21561253d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 27 10:30:47 2018 +0200

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

diff --git a/sc/source/ui/dbgui/consdlg.cxx b/sc/source/ui/dbgui/consdlg.cxx
index dc3338ddd5ab..8205ba0439b7 100644
--- a/sc/source/ui/dbgui/consdlg.cxx
+++ b/sc/source/ui/dbgui/consdlg.cxx
@@ -115,8 +115,8 @@ ScConsolidateDlg::~ScConsolidateDlg()
 
 void ScConsolidateDlg::dispose()
 {
-    delete [] pAreaData;
-    delete pRangeUtil;
+    pAreaData.reset();
+    pRangeUtil.reset();
     pLbFunc.clear();
     pLbConsAreas.clear();
     pLbDataArea.clear();
@@ -216,7 +216,7 @@ void ScConsolidateDlg::Init()
 
     if ( nAreaDataCount > 0 )
     {
-        pAreaData = new ScAreaData[nAreaDataCount];
+        pAreaData.reset( new ScAreaData[nAreaDataCount] );
 
         OUString aStrName;
         sal_uInt16 nAt = 0;
diff --git a/sc/source/ui/inc/consdlg.hxx b/sc/source/ui/inc/consdlg.hxx
index 04108aeed887..f7dd2eab7d5a 100644
--- a/sc/source/ui/inc/consdlg.hxx
+++ b/sc/source/ui/inc/consdlg.hxx
@@ -79,8 +79,8 @@ private:
     ScConsolidateParam  theConsData;
     ScViewData&         rViewData;
     ScDocument*         pDoc;
-    ScRangeUtil*        pRangeUtil;
-    ScAreaData*         pAreaData;
+    std::unique_ptr<ScRangeUtil>  pRangeUtil;
+    std::unique_ptr<ScAreaData[]> pAreaData;
     size_t              nAreaDataCount;
     sal_uInt16          nWhichCons;
 
commit e53ed47e9d9eb8bde2054943db8655ec12ace128
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 27 14:18:28 2018 +0200

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

diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 3a726d31ec27..9f9eccaef9e0 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <o3tl/make_unique.hxx>
 #include <sfx2/app.hxx>
 #include <vcl/weld.hxx>
 #include <vcl/waitobj.hxx>
@@ -69,9 +70,9 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange )
     ScDBCollection* pDocColl = rDoc.GetDBCollection();
     bool bUndo (rDoc.IsUndoEnabled());
 
-    ScDBCollection* pUndoColl = nullptr;
+    std::unique_ptr<ScDBCollection> pUndoColl;
     if (bUndo)
-        pUndoColl = new ScDBCollection( *pDocColl );
+        pUndoColl.reset( new ScDBCollection( *pDocColl ) );
 
     std::unique_ptr<ScDBData> pNew(new ScDBData( rName, rRange.aStart.Tab(),
                                     rRange.aStart.Col(), rRange.aStart.Row(),
@@ -98,15 +99,14 @@ bool ScDBDocFunc::AddDBRange( const OUString& rName, const ScRange& rRange )
 
     if (!bOk)
     {
-        delete pUndoColl;
         return false;
     }
 
     if (bUndo)
     {
-        ScDBCollection* pRedoColl = new ScDBCollection( *pDocColl );
         rDocShell.GetUndoManager()->AddUndoAction(
-                        new ScUndoDBData( &rDocShell, pUndoColl, pRedoColl ) );
+                        new ScUndoDBData( &rDocShell, std::move(pUndoColl),
+                            o3tl::make_unique<ScDBCollection>( *pDocColl ) ) );
     }
 
     aModificator.SetDocumentModified();
@@ -127,9 +127,9 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
     {
         ScDocShellModificator aModificator( rDocShell );
 
-        ScDBCollection* pUndoColl = nullptr;
+        std::unique_ptr<ScDBCollection> pUndoColl;
         if (bUndo)
-            pUndoColl = new ScDBCollection( *pDocColl );
+            pUndoColl.reset( new ScDBCollection( *pDocColl ) );
 
         rDoc.PreprocessDBDataUpdate();
         rDBs.erase(iter);
@@ -137,9 +137,9 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
 
         if (bUndo)
         {
-            ScDBCollection* pRedoColl = new ScDBCollection( *pDocColl );
             rDocShell.GetUndoManager()->AddUndoAction(
-                            new ScUndoDBData( &rDocShell, pUndoColl, pRedoColl ) );
+                            new ScUndoDBData( &rDocShell, std::move(pUndoColl),
+                                o3tl::make_unique<ScDBCollection>( *pDocColl ) ) );
         }
 
         aModificator.SetDocumentModified();
@@ -181,9 +181,9 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
         {
             if (bUndo)
             {
-                ScDBCollection* pRedoColl = new ScDBCollection( *pDocColl );
                 rDocShell.GetUndoManager()->AddUndoAction(
-                                new ScUndoDBData( &rDocShell, pUndoColl.release(), pRedoColl ) );
+                                new ScUndoDBData( &rDocShell, std::move(pUndoColl),
+                                    o3tl::make_unique<ScDBCollection>( *pDocColl ) ) );
             }
             else
                 pUndoColl.reset();
@@ -222,9 +222,9 @@ void ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
         rNewData.GetArea(aNewRange);
         bool bAreaChanged = ( aOldRange != aNewRange );     // then a recompilation is needed
 
-        ScDBCollection* pUndoColl = nullptr;
+        std::unique_ptr<ScDBCollection> pUndoColl;
         if (bUndo)
-            pUndoColl = new ScDBCollection( *pDocColl );
+            pUndoColl.reset( new ScDBCollection( *pDocColl ) );
 
         *pData = rNewData;
         if (bAreaChanged)
@@ -232,9 +232,9 @@ void ScDBDocFunc::ModifyDBData( const ScDBData& rNewData )
 
         if (bUndo)
         {
-            ScDBCollection* pRedoColl = new ScDBCollection( *pDocColl );
             rDocShell.GetUndoManager()->AddUndoAction(
-                            new ScUndoDBData( &rDocShell, pUndoColl, pRedoColl ) );
+                            new ScUndoDBData( &rDocShell, std::move(pUndoColl),
+                                o3tl::make_unique<ScDBCollection>( *pDocColl ) ) );
         }
 
         aModificator.SetDocumentModified();
@@ -246,7 +246,7 @@ void ScDBDocFunc::ModifyAllDBData( const ScDBCollection& rNewColl, const std::ve
     ScDocShellModificator aModificator(rDocShell);
     ScDocument& rDoc = rDocShell.GetDocument();
     ScDBCollection* pOldColl = rDoc.GetDBCollection();
-    ScDBCollection* pUndoColl = nullptr;
+    std::unique_ptr<ScDBCollection> pUndoColl;
     bool bRecord = rDoc.IsUndoEnabled();
 
     std::vector<ScRange>::const_iterator iter;
@@ -260,7 +260,7 @@ void ScDBDocFunc::ModifyAllDBData( const ScDBCollection& rNewColl, const std::ve
     }
 
     if (bRecord)
-        pUndoColl = new ScDBCollection( *pOldColl );
+        pUndoColl.reset( new ScDBCollection( *pOldColl ) );
 
     //  register target in SBA no longer necessary
 
@@ -274,9 +274,9 @@ void ScDBDocFunc::ModifyAllDBData( const ScDBCollection& rNewColl, const std::ve
 
     if (bRecord)
     {
-        ScDBCollection* pRedoColl = new ScDBCollection(rNewColl);
         rDocShell.GetUndoManager()->AddUndoAction(
-            new ScUndoDBData(&rDocShell, pUndoColl, pRedoColl));
+            new ScUndoDBData(&rDocShell, std::move(pUndoColl),
+                o3tl::make_unique<ScDBCollection>(rNewColl)));
     }
 }
 
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 06fe4e22c7ba..5a7734749b5a 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -55,6 +55,7 @@
 #include <clipparam.hxx>
 #include <rowheightcontext.hxx>
 #include <refupdatecontext.hxx>
+#include <o3tl/make_unique.hxx>
 
 using com::sun::star::script::XLibraryContainer;
 using com::sun::star::script::vba::XVBACompatibility;
@@ -286,12 +287,12 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe
         }
         else
         {
-            ScDBCollection* pUndoColl = nullptr;
+            std::unique_ptr<ScDBCollection> pUndoColl;
 
             if (eMode==SC_DB_IMPORT)
             {
                 m_aDocument.PreprocessDBDataUpdate();
-                pUndoColl = new ScDBCollection( *pColl );   // Undo for import range
+                pUndoColl.reset( new ScDBCollection( *pColl ) );   // Undo for import range
 
                 OUString aImport = ScResId( STR_DBNAME_IMPORT );
                 long nCount = 0;
@@ -323,8 +324,9 @@ ScDBData* ScDocShell::GetDBData( const ScRange& rMarked, ScGetDBMode eMode, ScGe
             {
                 m_aDocument.CompileHybridFormula();
 
-                ScDBCollection* pRedoColl = new ScDBCollection( *pColl );
-                GetUndoManager()->AddUndoAction( new ScUndoDBData( this, pUndoColl, pRedoColl ) );
+                GetUndoManager()->AddUndoAction( new ScUndoDBData( this,
+                        std::move(pUndoColl),
+                        o3tl::make_unique<ScDBCollection>( *pColl ) ) );
             }
 
             //  no longer needed to register new range at the Sba
diff --git a/sc/source/ui/inc/undodat.hxx b/sc/source/ui/inc/undodat.hxx
index 6f377013d53c..092936461e36 100644
--- a/sc/source/ui/inc/undodat.hxx
+++ b/sc/source/ui/inc/undodat.hxx
@@ -266,7 +266,8 @@ class ScUndoDBData: public ScSimpleUndo
 {
 public:
                     ScUndoDBData( ScDocShell* pNewDocShell,
-                            ScDBCollection* pNewUndoColl, ScDBCollection* pNewRedoColl );
+                            std::unique_ptr<ScDBCollection> pNewUndoColl,
+                            std::unique_ptr<ScDBCollection> pNewRedoColl );
     virtual         ~ScUndoDBData() override;
 
     virtual void    Undo() override;
@@ -277,8 +278,8 @@ public:
     virtual OUString GetComment() const override;
 
 private:
-    ScDBCollection* pUndoColl;
-    ScDBCollection* pRedoColl;
+    std::unique_ptr<ScDBCollection> pUndoColl;
+    std::unique_ptr<ScDBCollection> pRedoColl;
 };
 
 class ScUndoImportData: public ScSimpleUndo
diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx
index a53d2c6fa616..ea4cacef499c 100644
--- a/sc/source/ui/undo/undodat.cxx
+++ b/sc/source/ui/undo/undodat.cxx
@@ -954,17 +954,16 @@ bool ScUndoAutoFilter::CanRepeat(SfxRepeatTarget& /* rTarget */) const
 
 // change database sections (dialog)
 ScUndoDBData::ScUndoDBData( ScDocShell* pNewDocShell,
-                            ScDBCollection* pNewUndoColl, ScDBCollection* pNewRedoColl ) :
+                            std::unique_ptr<ScDBCollection> pNewUndoColl,
+                            std::unique_ptr<ScDBCollection> pNewRedoColl ) :
     ScSimpleUndo( pNewDocShell ),
-    pUndoColl( pNewUndoColl ),
-    pRedoColl( pNewRedoColl )
+    pUndoColl( std::move(pNewUndoColl) ),
+    pRedoColl( std::move(pNewRedoColl) )
 {
 }
 
 ScUndoDBData::~ScUndoDBData()
 {
-    delete pUndoColl;
-    delete pRedoColl;
 }
 
 OUString ScUndoDBData::GetComment() const
commit 9954df6905804fb2bd72072a7e44145508b86a8d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 27 14:06:34 2018 +0200

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

diff --git a/sc/source/ui/inc/autofmt.hxx b/sc/source/ui/inc/autofmt.hxx
index b5eb205b4b67..358df72ff6c9 100644
--- a/sc/source/ui/inc/autofmt.hxx
+++ b/sc/source/ui/inc/autofmt.hxx
@@ -73,7 +73,7 @@ private:
     const OUString          aStrMid;
     const OUString          aStrSouth;
     const OUString          aStrSum;
-    SvNumberFormatter*      pNumFmt;
+    std::unique_ptr<SvNumberFormatter> pNumFmt;
 
     SAL_DLLPRIVATE void Init();
     SAL_DLLPRIVATE void DoPaint(vcl::RenderContext& rRenderContext);
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index a1eab0e5b4f2..bf96690b54f6 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -90,7 +90,7 @@ ScAutoFmtPreview::~ScAutoFmtPreview()
 
 void ScAutoFmtPreview::dispose()
 {
-    delete pNumFmt;
+    pNumFmt.reset();
     vcl::Window::dispose();
 }
 
commit 0d41681eef154f8208e9764f0a459ae79d033164
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 27 14:05:27 2018 +0200

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

diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx
index 0c2f5891bc85..7fd2ad69d6ad 100644
--- a/sc/source/ui/inc/undoblk.hxx
+++ b/sc/source/ui/inc/undoblk.hxx
@@ -383,8 +383,8 @@ private:
     SCCOLROW        nEnd;
     SCTAB           nStartTab;
     SCTAB           nEndTab;
-    ScDocument*     pUndoDoc;
-    ScOutlineTable* pUndoTab;
+    std::unique_ptr<ScDocument>     pUndoDoc;
+    std::unique_ptr<ScOutlineTable> pUndoTab;
     std::vector<sc::ColRowSpan> maRanges;
     sal_uInt16      nNewSize;
     bool            bWidth;
diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx
index 0bde3c5a7f1d..a6fcc01b6881 100644
--- a/sc/source/ui/undo/undoblk2.cxx
+++ b/sc/source/ui/undo/undoblk2.cxx
@@ -60,8 +60,8 @@ ScUndoWidthOrHeight::ScUndoWidthOrHeight( ScDocShell* pNewDocShell,
 
 ScUndoWidthOrHeight::~ScUndoWidthOrHeight()
 {
-    delete pUndoDoc;
-    delete pUndoTab;
+    pUndoDoc.reset();
+    pUndoTab.reset();
     DeleteSdrUndoAction( pDrawUndo );
 }
 
@@ -95,7 +95,7 @@ void ScUndoWidthOrHeight::Undo()
 
     //! outlines from all tables?
     if (pUndoTab)                                           // Outlines are included when saving ?
-        rDoc.SetOutlineTable( nStartTab, pUndoTab );
+        rDoc.SetOutlineTable( nStartTab, pUndoTab.get() );
 
     ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
     SCTAB nTabCount = rDoc.GetTableCount();
commit 2037e85b790b9cb9e563a66b79bd549e328b8b4f
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 27 13:56:55 2018 +0200

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

diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 6e7ef136ea65..fe60737e8252 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -1417,7 +1417,7 @@ void ScAccessibleDocument::PreInit()
 void ScAccessibleDocument::Init()
 {
     if(!mpChildrenShapes)
-        mpChildrenShapes = new ScChildrenShapes(this, mpViewShell, meSplitPos);
+        mpChildrenShapes.reset( new ScChildrenShapes(this, mpViewShell, meSplitPos) );
 }
 
 ScAccessibleDocument::~ScAccessibleDocument()
@@ -1443,8 +1443,7 @@ void SAL_CALL ScAccessibleDocument::disposing()
         mpViewShell->RemoveAccessibilityObject(*this);
         mpViewShell = nullptr;
     }
-    if (mpChildrenShapes)
-        DELETEZ(mpChildrenShapes);
+    mpChildrenShapes.reset();
 
     ScAccessibleDocumentBase::disposing();
 }
@@ -1539,9 +1538,7 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
 
             // Shapes / form controls after reload not accessible, rebuild the
             // mpChildrenShapes variable.
-            if (mpChildrenShapes)
-                DELETEZ(mpChildrenShapes);
-            mpChildrenShapes = new ScChildrenShapes( this, mpViewShell, meSplitPos );
+            mpChildrenShapes.reset( new ScChildrenShapes( this, mpViewShell, meSplitPos ) );
 
             AccessibleEventObject aEvent;
             aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN;
diff --git a/sc/source/ui/inc/AccessibleDocument.hxx b/sc/source/ui/inc/AccessibleDocument.hxx
index 102c1ab903e0..e2ada8048adf 100644
--- a/sc/source/ui/inc/AccessibleDocument.hxx
+++ b/sc/source/ui/inc/AccessibleDocument.hxx
@@ -229,7 +229,7 @@ private:
     ScTabViewShell* mpViewShell;
     ScSplitPos      meSplitPos;
     rtl::Reference<ScAccessibleSpreadsheet> mpAccessibleSpreadsheet;
-    ScChildrenShapes* mpChildrenShapes;
+    std::unique_ptr<ScChildrenShapes> mpChildrenShapes;
     ScAccessibleEditObject* mpTempAccEdit;
     css::uno::Reference<css::accessibility::XAccessible> mxTempAcc;
     tools::Rectangle maVisArea;
commit 4baf5adc8f397df0c52d6cba97c5de18682d9429
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Jun 27 13:55:01 2018 +0200

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

diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx
index 83f0aeb88a8c..311fd36031ba 100644
--- a/sc/source/ui/dbgui/filtdlg.cxx
+++ b/sc/source/ui/dbgui/filtdlg.cxx
@@ -106,7 +106,7 @@ ScFilterDlg::ScFilterDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pPar
     Init( rArgSet );
 
     // Hack: RefInput control
-    pTimer = new Timer("ScFilterTimer");
+    pTimer.reset( new Timer("ScFilterTimer") );
     pTimer->SetTimeout( 50 ); // Wait 50ms
     pTimer->SetInvokeHandler( LINK( this, ScFilterDlg, TimeOutHdl ) );
 }
@@ -118,12 +118,12 @@ ScFilterDlg::~ScFilterDlg()
 
 void ScFilterDlg::dispose()
 {
-    delete pOptionsMgr;
-    delete pOutItem;
+    pOptionsMgr.reset();
+    pOutItem.reset();
 
     // Hack: RefInput control
     pTimer->Stop();
-    delete pTimer;
+    pTimer.reset();
 
     pLbConnect1.clear();
     pLbField1.clear();
@@ -219,7 +219,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet )
     maConnLbArr.push_back(pLbConnect4);
 
     // Option initialization:
-    pOptionsMgr  = new ScFilterOptionsMgr(
+    pOptionsMgr.reset( new ScFilterOptionsMgr(
                             pViewData,
                             theQueryData,
                             pBtnCase,
@@ -233,7 +233,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet )
                             pRbCopyArea,
                             pFtDbAreaLabel,
                             pFtDbArea,
-                            aStrUndefined );
+                            aStrUndefined ) );
     // Read in field lists and select entries
 
     FillFieldLists();
@@ -654,10 +654,9 @@ ScQueryItem* ScFilterDlg::GetOutputItem()
 
     // only set the three - reset everything else
 
-    DELETEZ( pOutItem );
-    pOutItem = new ScQueryItem( nWhichQuery, &theParam );
+    pOutItem.reset( new ScQueryItem( nWhichQuery, &theParam ) );
 
-    return pOutItem;
+    return pOutItem.get();
 }
 
 bool ScFilterDlg::IsRefInputMode() const
@@ -722,7 +721,7 @@ IMPL_LINK( ScFilterDlg, TimeOutHdl, Timer*, _pTimer, void )
 {
     // Check if RefInputMode is still true every 50ms
 
-    if( _pTimer == pTimer && IsActive() )
+    if( _pTimer == pTimer.get() && IsActive() )
         bRefInputMode = (pEdCopyArea->HasFocus() || pRbCopyArea->HasFocus());
 
     if ( pExpander->get_expanded() )
diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx
index c257236e8e40..8200b1c4b242 100644
--- a/sc/source/ui/inc/filtdlg.hxx
+++ b/sc/source/ui/inc/filtdlg.hxx
@@ -114,11 +114,11 @@ private:
     const OUString aStrNotEmpty;
     const OUString aStrColumn;
 
-    ScFilterOptionsMgr* pOptionsMgr;
+    std::unique_ptr<ScFilterOptionsMgr> pOptionsMgr;
 
     const sal_uInt16        nWhichQuery;
     ScQueryParam        theQueryData;
-    ScQueryItem*        pOutItem;
+    std::unique_ptr<ScQueryItem> pOutItem;
     ScViewData*         pViewData;
     ScDocument*         pDoc;
     SCTAB               nSrcTab;
@@ -135,7 +135,7 @@ private:
     EntryListsMap m_EntryLists;
 
     // Hack: RefInput control
-    Timer*  pTimer;
+    std::unique_ptr<Timer>  pTimer;
 
 private:
     void            Init            ( const SfxItemSet& rArgSet );


More information about the Libreoffice-commits mailing list