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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jul 17 12:03:43 UTC 2018


 compilerplugins/clang/useuniqueptr.cxx |    3 +++
 sc/source/ui/inc/tabview.hxx           |   12 ++++++------
 sc/source/ui/view/tabview.cxx          |    4 ++--
 sc/source/ui/view/tabview5.cxx         |   24 ++++++++++++------------
 4 files changed, 23 insertions(+), 20 deletions(-)

New commits:
commit 4c2d0b0d85eabc5228b3777d3519482c52a0f96b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 16 16:41:48 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 17 14:03:19 2018 +0200

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

diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index a9f60c47039f..df087bfeec11 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -82,6 +82,9 @@ public:
         // ODatabaseExport::m_aDestColumns
         if (fn == SRCDIR "/dbaccess/source/ui/misc/DExport.cxx")
             return;
+        // ScTabView::pDrawActual and pDrawOld
+        if (fn == SRCDIR "/sc/source/ui/view/tabview5.cxx")
+            return;
 
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
     }
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 4c321ec1653f..7dfcaea6de79 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -137,13 +137,13 @@ private:
     VclPtr<vcl::Window>             pFrameWin;              // First !!!
     ScViewData          aViewData;              // must be at the front !
 
-    ScViewSelectionEngine*  pSelEngine;
+    std::unique_ptr<ScViewSelectionEngine> pSelEngine;
     ScViewFunctionSet       aFunctionSet;
 
-    ScHeaderSelectionEngine* pHdrSelEng;
+    std::unique_ptr<ScHeaderSelectionEngine> pHdrSelEng;
     ScHeaderFunctionSet      aHdrFunc;
 
-    ScDrawView*         pDrawView;
+    std::unique_ptr<ScDrawView> pDrawView;
 
     Size                aFrameSize;             // passed on as for DoResize
     Point               aBorderPos;
@@ -346,13 +346,13 @@ public:
     const ScViewData&   GetViewData() const { return aViewData; }
 
     ScViewFunctionSet&      GetFunctionSet()    { return aFunctionSet; }
-    ScViewSelectionEngine*  GetSelEngine()      { return pSelEngine; }
+    ScViewSelectionEngine*  GetSelEngine()      { return pSelEngine.get(); }
 
     bool            SelMouseButtonDown( const MouseEvent& rMEvt );
 
-    ScDrawView*     GetScDrawView()         { return pDrawView; }
+    ScDrawView*     GetScDrawView()         { return pDrawView.get(); }
     // against CLOKs
-    SdrView*        GetSdrView()            { return pDrawView; }
+    SdrView*        GetSdrView()            { return pDrawView.get(); }
 
     bool            IsMinimized() const     { return bMinimized; }
 
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 5e53f937e102..d6a21853e616 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -1484,10 +1484,10 @@ void ScTabView::UpdateShow()
 
     if (bShowH && bHeader && !pColBar[SC_SPLIT_RIGHT])
         pColBar[SC_SPLIT_RIGHT] = VclPtr<ScColBar>::Create( pFrameWin, SC_SPLIT_RIGHT,
-                                                            &aHdrFunc, pHdrSelEng, this );
+                                                            &aHdrFunc, pHdrSelEng.get(), this );
     if (bShowV && bHeader && !pRowBar[SC_SPLIT_TOP])
         pRowBar[SC_SPLIT_TOP] = VclPtr<ScRowBar>::Create( pFrameWin, SC_SPLIT_TOP,
-                                                          &aHdrFunc, pHdrSelEng, this );
+                                                          &aHdrFunc, pHdrSelEng.get(), this );
 
         // show Windows
 
diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx
index 962fc20e5c9f..c4e7768da626 100644
--- a/sc/source/ui/view/tabview5.cxx
+++ b/sc/source/ui/view/tabview5.cxx
@@ -79,17 +79,17 @@ void ScTabView::Init()
         pGridWin[i] = nullptr;
     pGridWin[SC_SPLIT_BOTTOMLEFT] = VclPtr<ScGridWindow>::Create( pFrameWin, &aViewData, SC_SPLIT_BOTTOMLEFT );
 
-    pSelEngine = new ScViewSelectionEngine( pGridWin[SC_SPLIT_BOTTOMLEFT], this,
-                                                SC_SPLIT_BOTTOMLEFT );
-    aFunctionSet.SetSelectionEngine( pSelEngine );
+    pSelEngine.reset( new ScViewSelectionEngine( pGridWin[SC_SPLIT_BOTTOMLEFT], this,
+                                                SC_SPLIT_BOTTOMLEFT ) );
+    aFunctionSet.SetSelectionEngine( pSelEngine.get() );
 
-    pHdrSelEng = new ScHeaderSelectionEngine( pFrameWin, &aHdrFunc );
+    pHdrSelEng.reset( new ScHeaderSelectionEngine( pFrameWin, &aHdrFunc ) );
 
     pColBar[SC_SPLIT_LEFT] = VclPtr<ScColBar>::Create( pFrameWin, SC_SPLIT_LEFT,
-                                                       &aHdrFunc, pHdrSelEng, this );
+                                                       &aHdrFunc, pHdrSelEng.get(), this );
     pColBar[SC_SPLIT_RIGHT] = nullptr;
     pRowBar[SC_SPLIT_BOTTOM] = VclPtr<ScRowBar>::Create( pFrameWin, SC_SPLIT_BOTTOM,
-                                                         &aHdrFunc, pHdrSelEng, this );
+                                                         &aHdrFunc, pHdrSelEng.get(), this );
     pRowBar[SC_SPLIT_TOP] = nullptr;
     for (i=0; i<2; i++)
         pColOutline[i] = pRowOutline[i] = nullptr;
@@ -193,16 +193,16 @@ ScTabView::~ScTabView()
             }
 
         pDrawView->HideSdrPage();
-        delete pDrawView;
+        pDrawView.reset();
     }
 
-    delete pSelEngine;
+    pSelEngine.reset();
 
     mxInputHintOO.reset();
     for (i=0; i<4; i++)
         pGridWin[i].disposeAndClear();
 
-    delete pHdrSelEng;
+    pHdrSelEng.reset();
 
     for (i=0; i<2; i++)
     {
@@ -233,7 +233,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode )
         OSL_ENSURE(pLayer, "Where is the Draw Layer ??");
 
         sal_uInt16 i;
-        pDrawView = new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT], &aViewData );
+        pDrawView.reset( new ScDrawView( pGridWin[SC_SPLIT_BOTTOMLEFT], &aViewData ) );
         for (i=0; i<4; i++)
             if (pGridWin[i])
             {
@@ -250,7 +250,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode )
                                             // so that immediately can be drawn
             }
         SfxRequest aSfxRequest(SID_OBJECT_SELECT, SfxCallMode::SLOT, aViewData.GetViewShell()->GetPool());
-        SetDrawFuncPtr(new FuSelection(*aViewData.GetViewShell(), GetActiveWin(), pDrawView,
+        SetDrawFuncPtr(new FuSelection(*aViewData.GetViewShell(), GetActiveWin(), pDrawView.get(),
                                        pLayer,aSfxRequest));
 
         //  used when switching back from page preview: restore saved design mode state
@@ -261,7 +261,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode )
         //  register at FormShell
         FmFormShell* pFormSh = aViewData.GetViewShell()->GetFormShell();
         if (pFormSh)
-            pFormSh->SetView(pDrawView);
+            pFormSh->SetView(pDrawView.get());
 
         if (aViewData.GetViewShell()->HasAccessibilityObjects())
             aViewData.GetViewShell()->BroadcastAccessibility(SfxHint(SfxHintId::ScAccMakeDrawLayer));


More information about the Libreoffice-commits mailing list