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

Noel Grandin noel.grandin at collabora.co.uk
Mon Mar 26 08:58:14 UTC 2018


 sd/source/ui/inc/OutlineViewShell.hxx |    2 +-
 sd/source/ui/inc/ViewShell.hxx        |    4 ++--
 sd/source/ui/view/outlnvs2.cxx        |   24 ++++++++++++------------
 sd/source/ui/view/outlnvsh.cxx        |   24 ++++++++++++------------
 sd/source/ui/view/viewshel.cxx        |    4 ++--
 5 files changed, 29 insertions(+), 29 deletions(-)

New commits:
commit 7574d1865fb8512b9416bcb247fb29b8ce80fb72
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Fri Mar 23 11:15:16 2018 +0200

    loplugin:useuniqueptr in OutlineViewShell and ViewShell
    
    Change-Id: Ia40444b4ba3c8b02d195d979ff6d84cfe4d8b44e
    Reviewed-on: https://gerrit.libreoffice.org/51845
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sd/source/ui/inc/OutlineViewShell.hxx b/sd/source/ui/inc/OutlineViewShell.hxx
index 396fc360f332..ffe701349ab0 100644
--- a/sd/source/ui/inc/OutlineViewShell.hxx
+++ b/sd/source/ui/inc/OutlineViewShell.hxx
@@ -149,7 +149,7 @@ public:
     void UpdateOutlineObject( SdPage* pPage, Paragraph* pPara );
 
 private:
-    OutlineView* pOlView;
+    std::unique_ptr<OutlineView> pOlView;
     SdPage*         pLastPage; // For efficient processing of the preview
     rtl::Reference<TransferableClipboardListener> mxClipEvtLstnr;
     bool            bPastePossible;
diff --git a/sd/source/ui/inc/ViewShell.hxx b/sd/source/ui/inc/ViewShell.hxx
index a3d82ba4f0c6..1e002a59958e 100644
--- a/sd/source/ui/inc/ViewShell.hxx
+++ b/sd/source/ui/inc/ViewShell.hxx
@@ -223,7 +223,7 @@ public:
 
     void    ExecReq( SfxRequest &rReq );
 
-    ZoomList* GetZoomList() { return mpZoomList;}
+    ZoomList* GetZoomList() { return mpZoomList.get();}
 
     FrameView* GetFrameView() { return mpFrameView; }
     /** Setting a frame view triggers ReadFrameViewData() for the new
@@ -463,7 +463,7 @@ protected:
 
     rtl::Reference<FuPoor>   mxCurrentFunction;
     rtl::Reference<FuPoor>   mxOldFunction;
-    ZoomList*   mpZoomList;
+    std::unique_ptr<ZoomList> mpZoomList;
 
     Point       maViewPos;
     Size        maViewSize;
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
index 7445372219bb..ec6496c446a6 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -104,7 +104,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
             else
             {
                 // open the zoom dialog here
-                SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+                SetCurrentFunction( FuScale::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             }
             Cancel();
         }
@@ -268,7 +268,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
         {
             if( rReq.GetArgs() )
             {
-                SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+                SetCurrentFunction( FuTemplate::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
                 Cancel();
             }
 
@@ -278,7 +278,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
 
         case SID_PRESENTATION_DLG:
         {
-            SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+            SetCurrentFunction( FuSlideShowDlg::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             Cancel();
         }
         break;
@@ -299,7 +299,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
 
         case SID_CUSTOMSHOW_DLG:
         {
-            SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+            SetCurrentFunction( FuCustomShowDlg::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             Cancel();
         }
         break;
@@ -393,7 +393,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
         case SID_INSERT_ZWSP:
         case SID_CHARMAP:
         {
-            SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+            SetCurrentFunction( FuBullet::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             Cancel();
         }
         break;
@@ -402,14 +402,14 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
         case FN_SVX_SET_BULLET:
         case FN_SVX_SET_NUMBER:
         {
-            SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+            SetCurrentFunction( FuOutlineBullet::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             Cancel();
         }
         break;
 
         case SID_THESAURUS:
         {
-            SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+            SetCurrentFunction( FuThesaurus::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             Cancel();
             rReq.Ignore ();
         }
@@ -418,21 +418,21 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
         case SID_CHAR_DLG_EFFECT:
         case SID_CHAR_DLG:
         {
-            SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+            SetCurrentFunction( FuChar::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             Cancel();
         }
         break;
 
         case SID_INSERTFILE:
         {
-            SetCurrentFunction( FuInsertFile::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
+            SetCurrentFunction( FuInsertFile::Create(this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq) );
             Cancel();
         }
         break;
 
         case SID_PRESENTATIONOBJECT:
         {
-            SetCurrentFunction( FuPresentationObjects::Create(this, GetActiveWindow(), pOlView, GetDoc(), rReq) );
+            SetCurrentFunction( FuPresentationObjects::Create(this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq) );
             Cancel();
         }
         break;
@@ -448,7 +448,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
         case SID_SUMMARY_PAGE:
         {
             pOlView->SetSelectedPages();
-            SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+            SetCurrentFunction( FuSummaryPage::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             pOlView->GetOutliner().Clear();
             pOlView->FillOutliner();
             pOlView->GetActualPage();
@@ -459,7 +459,7 @@ void OutlineViewShell::FuTemporaryModify(SfxRequest &rReq)
         case SID_EXPAND_PAGE:
         {
             pOlView->SetSelectedPages();
-            SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), pOlView, GetDoc(), rReq ) );
+            SetCurrentFunction( FuExpandPage::Create( this, GetActiveWindow(), pOlView.get(), GetDoc(), rReq ) );
             pOlView->GetOutliner().Clear();
             pOlView->FillOutliner();
             pOlView->GetActualPage();
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 30a4dd6693c1..7cc482d7cd0a 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -138,8 +138,8 @@ void OutlineViewShell::Construct()
     GetActiveWindow()->SetMinZoom( MIN_ZOOM );
     GetActiveWindow()->SetMaxZoom( MAX_ZOOM );
     InitWindows(aViewOrigin, aSize, aWinPos);
-    pOlView = new OutlineView(*GetDocSh(), GetActiveWindow(), *this);
-    mpView = pOlView;            // Pointer of base class ViewShell
+    pOlView.reset( new OutlineView(*GetDocSh(), GetActiveWindow(), *this) );
+    mpView = pOlView.get();            // Pointer of base class ViewShell
 
     SetPool( &GetDoc()->GetPool() );
 
@@ -211,7 +211,7 @@ OutlineViewShell::~OutlineViewShell()
 {
     DisposeFunctions();
 
-    delete pOlView;
+    pOlView.reset();
 
     mpFrameView->Disconnect();
 
@@ -469,7 +469,7 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq)
 
         case SID_PASTE:
         {
-            OutlineViewPageChangesGuard aGuard2(pOlView);
+            OutlineViewPageChangesGuard aGuard2(pOlView.get());
 
             if(HasCurrentFunction())
             {
@@ -486,7 +486,7 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq)
 
         case SID_PASTE_UNFORMATTED:
         {
-            OutlineViewPageChangesGuard aGuard2(pOlView);
+            OutlineViewPageChangesGuard aGuard2(pOlView.get());
 
             if(HasCurrentFunction())
             {
@@ -514,7 +514,7 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq)
                 OutlinerView* pOutlView = pOlView->GetViewByWindow(GetActiveWindow());
                 if (pOutlView)
                 {
-                    OutlineViewPageChangesGuard aGuard2(pOlView);
+                    OutlineViewPageChangesGuard aGuard2(pOlView.get());
 
                     vcl::KeyCode aKCode(KEY_DELETE);
                     KeyEvent aKEvt( 0, aKCode );
@@ -634,13 +634,13 @@ void OutlineViewShell::FuSupport(SfxRequest &rReq)
         // added Undo/Redo handling
         case SID_UNDO :
         {
-            OutlineViewPageChangesGuard aGuard2(pOlView);
+            OutlineViewPageChangesGuard aGuard2(pOlView.get());
             ImpSidUndo(rReq);
         }
         break;
         case SID_REDO :
         {
-            OutlineViewPageChangesGuard aGuard2(pOlView);
+            OutlineViewPageChangesGuard aGuard2(pOlView.get());
             ImpSidRedo(rReq);
         }
         break;
@@ -675,7 +675,7 @@ void OutlineViewShell::FuPermanent(SfxRequest &rReq)
             rOutl.GetUndoManager().Clear();
             rOutl.UpdateFields();
 
-            SetCurrentFunction( FuOutlineText::Create(this,GetActiveWindow(),pOlView,GetDoc(),rReq) );
+            SetCurrentFunction( FuOutlineText::Create(this,GetActiveWindow(),pOlView.get(),GetDoc(),rReq) );
 
             rReq.Done();
         }
@@ -1387,7 +1387,7 @@ void OutlineViewShell::Command( const CommandEvent& rCEvt, ::sd::Window* pWin )
 bool OutlineViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
 {
     bool bReturn = false;
-    OutlineViewPageChangesGuard aGuard(pOlView);
+    OutlineViewPageChangesGuard aGuard(pOlView.get());
 
     if (pWin == nullptr && HasCurrentFunction())
     {
@@ -1562,7 +1562,7 @@ void OutlineViewShell::UpdatePreview( SdPage* pPage, bool )
     pLastPage = pPage;
     if (bNewPage)
     {
-        OutlineViewPageChangesGuard aGuard(pOlView);
+        OutlineViewPageChangesGuard aGuard(pOlView.get());
         SetCurrentPage(pPage);
     }
 }
@@ -1757,7 +1757,7 @@ ErrCode OutlineViewShell::ReadRtf(SvStream& rInput)
 
     ::Outliner& rOutl = pOlView->GetOutliner();
 
-    OutlineViewPageChangesGuard aGuard( pOlView );
+    OutlineViewPageChangesGuard aGuard( pOlView.get() );
     OutlineViewModelChangeGuard aGuard2( *pOlView );
 
     bRet = rOutl.Read( rInput, OUString(), EETextFormat::Rtf, GetDocSh()->GetHeaderAttributes() );
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index f9fdeb1c76a8..e72f15c44395 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -153,7 +153,7 @@ ViewShell::~ViewShell()
     if (mpContentWindow)
         mpContentWindow->SetViewShell(nullptr);
 
-    delete mpZoomList;
+    mpZoomList.reset();
 
     mpLayerTabBar.disposeAndClear();
 
@@ -199,7 +199,7 @@ void ViewShell::construct()
     if (IsMainViewShell())
         GetDocSh()->Connect (this);
 
-    mpZoomList = new ZoomList( this );
+    mpZoomList.reset( new ZoomList( this ) );
 
     mpContentWindow.reset(VclPtr< ::sd::Window >::Create(GetParentWindow()));
     SetActiveWindow (mpContentWindow.get());


More information about the Libreoffice-commits mailing list