[Libreoffice-commits] core.git: 2 commits - chart2/source include/sfx2 sfx2/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Jul 24 06:35:07 UTC 2018


 chart2/source/controller/inc/ChartController.hxx           |    2 -
 chart2/source/controller/main/ChartController.cxx          |    6 ++--
 chart2/source/controller/main/ChartController_Position.cxx |    2 -
 chart2/source/controller/main/ChartController_TextEdit.cxx |    2 -
 chart2/source/controller/main/ChartController_Tools.cxx    |    6 ++--
 chart2/source/controller/main/ChartController_Window.cxx   |   18 ++++++-------
 include/sfx2/viewfrm.hxx                                   |    4 +-
 sfx2/source/view/viewfrm.cxx                               |    6 ++--
 8 files changed, 23 insertions(+), 23 deletions(-)

New commits:
commit e2282a94558d6d92ed5f170e3dde6f26bfe383db
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 23 14:22:14 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 24 08:34:55 2018 +0200

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

diff --git a/include/sfx2/viewfrm.hxx b/include/sfx2/viewfrm.hxx
index 3fafd9e1762d..e0a7db3c2c6e 100644
--- a/include/sfx2/viewfrm.hxx
+++ b/include/sfx2/viewfrm.hxx
@@ -66,7 +66,7 @@ class SFX2_DLLPUBLIC SfxViewFrame: public SfxShell, public SfxListener
     std::unique_ptr<struct SfxViewFrame_Impl>   m_pImpl;
 
     SfxObjectShellRef           m_xObjSh;
-    SfxDispatcher*              m_pDispatcher;
+    std::unique_ptr<SfxDispatcher> m_pDispatcher;
     SfxBindings*                m_pBindings;
     sal_uInt16                  m_nAdjustPosPixelLock;
 
@@ -112,7 +112,7 @@ public:
             void            DoDeactivate(bool bMDI, SfxViewFrame const *pOld);
 
     using SfxShell::GetDispatcher;
-    SfxDispatcher*          GetDispatcher() { return m_pDispatcher; }
+    SfxDispatcher*          GetDispatcher() { return m_pDispatcher.get(); }
     SfxBindings&            GetBindings() { return *m_pBindings; }
     const SfxBindings&      GetBindings() const  { return *m_pBindings; }
     vcl::Window&            GetWindow() const;
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 9d4cebb64562..d369cf65c4b6 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -1408,9 +1408,9 @@ void SfxViewFrame::Construct_Impl( SfxObjectShell *pObjSh )
     m_pImpl->pWindow = nullptr;
 
     SetPool( &SfxGetpApp()->GetPool() );
-    m_pDispatcher = new SfxDispatcher(this);
+    m_pDispatcher.reset( new SfxDispatcher(this) );
     if ( !GetBindings().GetDispatcher() )
-        GetBindings().SetDispatcher( m_pDispatcher );
+        GetBindings().SetDispatcher( m_pDispatcher.get() );
 
     m_xObjSh = pObjSh;
     if ( m_xObjSh.is() && m_xObjSh->IsPreview() )
@@ -1513,7 +1513,7 @@ void SfxViewFrame::KillDispatcher_Impl()
             m_pDispatcher->Pop( *pModule, SfxDispatcherPopFlags::POP_UNTIL );
         else
             m_pDispatcher->Pop( *this );
-        DELETEZ(m_pDispatcher);
+        m_pDispatcher.reset();
     }
 }
 
commit e83e5144119cba5514d07e03b6af557dae542b5b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Jul 23 13:42:00 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Jul 24 08:34:43 2018 +0200

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

diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx
index d6f5658b62cf..2cf1978811db 100644
--- a/chart2/source/controller/inc/ChartController.hxx
+++ b/chart2/source/controller/inc/ChartController.hxx
@@ -389,7 +389,7 @@ private:
     css::uno::Reference<css::awt::XWindow> m_xViewWindow;
     css::uno::Reference<css::uno::XInterface> m_xChartView;
     std::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper;
-    DrawViewWrapper* m_pDrawViewWrapper;
+    std::unique_ptr<DrawViewWrapper> m_pDrawViewWrapper;
 
     Selection m_aSelection;
     SdrDragMode m_eDragMode;
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index b0c27a4e6a43..2467f267d27f 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -729,7 +729,7 @@ void ChartController::impl_createDrawViewController()
     {
         if( m_pDrawModelWrapper )
         {
-            m_pDrawViewWrapper = new DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow());
+            m_pDrawViewWrapper.reset( new DrawViewWrapper(m_pDrawModelWrapper->getSdrModel(),GetChartWindow()) );
             m_pDrawViewWrapper->attachParentReferenceDevice( getModel() );
         }
     }
@@ -742,7 +742,7 @@ void ChartController::impl_deleteDrawViewController()
         SolarMutexGuard aGuard;
         if( m_pDrawViewWrapper->IsTextEdit() )
             this->EndTextEdit();
-        DELETEZ( m_pDrawViewWrapper );
+        m_pDrawViewWrapper.reset();
     }
 }
 
@@ -1470,7 +1470,7 @@ DrawViewWrapper* ChartController::GetDrawViewWrapper()
     {
         impl_createDrawViewController();
     }
-    return m_pDrawViewWrapper;
+    return m_pDrawViewWrapper.get();
 }
 
 
diff --git a/chart2/source/controller/main/ChartController_Position.cxx b/chart2/source/controller/main/ChartController_Position.cxx
index 5746569a5836..cac61217b4a0 100644
--- a/chart2/source/controller/main/ChartController_Position.cxx
+++ b/chart2/source/controller/main/ChartController_Position.cxx
@@ -131,7 +131,7 @@ void ChartController::executeDispatch_PositionAndSize()
         SfxItemSet aItemSet = m_pDrawViewWrapper->getPositionAndSizeItemSetFromMarkedObject();
 
         //prepare and open dialog
-        SdrView* pSdrView = m_pDrawViewWrapper;
+        SdrView* pSdrView = m_pDrawViewWrapper.get();
         bool bResizePossible = m_aSelection.isResizeableObjectSelected();
 
         SolarMutexGuard aGuard;
diff --git a/chart2/source/controller/main/ChartController_TextEdit.cxx b/chart2/source/controller/main/ChartController_TextEdit.cxx
index dfb94cc64725..acaac25d4668 100644
--- a/chart2/source/controller/main/ChartController_TextEdit.cxx
+++ b/chart2/source/controller/main/ChartController_TextEdit.cxx
@@ -209,7 +209,7 @@ uno::Reference< css::accessibility::XAccessibleContext >
     ChartController::impl_createAccessibleTextContext()
 {
     uno::Reference< css::accessibility::XAccessibleContext > xResult(
-        new AccessibleTextHelper( m_pDrawViewWrapper ));
+        new AccessibleTextHelper( m_pDrawViewWrapper.get() ));
 
     return xResult;
 }
diff --git a/chart2/source/controller/main/ChartController_Tools.cxx b/chart2/source/controller/main/ChartController_Tools.cxx
index 312d701c2add..a8269b760edf 100644
--- a/chart2/source/controller/main/ChartController_Tools.cxx
+++ b/chart2/source/controller/main/ChartController_Tools.cxx
@@ -361,7 +361,7 @@ void ChartController::impl_PasteGraphic(
             }
             //select new shape
             m_aSelection.setSelection( xGraphicShape );
-            m_aSelection.applySelection( m_pDrawViewWrapper );
+            m_aSelection.applySelection( m_pDrawViewWrapper.get() );
         }
         xGraphicShapeProp->setPropertyValue( "Graphic", uno::Any( xGraphic ));
         uno::Reference< beans::XPropertySet > xGraphicProp( xGraphic, uno::UNO_QUERY );
@@ -427,7 +427,7 @@ void ChartController::impl_PasteShapes( SdrModel* pModel )
 
             // select last inserted shape
             m_aSelection.setSelection( xSelShape );
-            m_aSelection.applySelection( m_pDrawViewWrapper );
+            m_aSelection.applySelection( m_pDrawViewWrapper.get() );
 
             m_pDrawViewWrapper->EndUndo();
 
@@ -470,7 +470,7 @@ void ChartController::impl_PasteStringAsTextShape( const OUString& rString, cons
                 xTextShape->setPosition( rPosition );
 
                 m_aSelection.setSelection( xTextShape );
-                m_aSelection.applySelection( m_pDrawViewWrapper );
+                m_aSelection.applySelection( m_pDrawViewWrapper.get() );
 
                 SdrObject* pObj = DrawViewWrapper::getSdrObject( xTextShape );
                 if ( pObj )
diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx
index a7d12d1c5388..0bbe37e0cf5e 100644
--- a/chart2/source/controller/main/ChartController_Window.cxx
+++ b/chart2/source/controller/main/ChartController_Window.cxx
@@ -437,7 +437,7 @@ void SAL_CALL ChartController::removePaintListener(
 void ChartController::PrePaint()
 {
     // forward VCLs PrePaint window event to DrawingLayer
-    DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+    DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
 
     if (pDrawViewWrapper)
     {
@@ -477,7 +477,7 @@ void ChartController::execute_Paint(vcl::RenderContext& rRenderContext, const to
 
         {
             SolarMutexGuard aGuard;
-            DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+            DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
             if (pDrawViewWrapper)
                 pDrawViewWrapper->CompleteRedraw(&rRenderContext, vcl::Region(rRect));
         }
@@ -557,7 +557,7 @@ void ChartController::execute_MouseButtonDown( const MouseEvent& rMEvt )
 
     m_aSelection.remindSelectionBeforeMouseDown();
 
-    DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+    DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
     auto pChartWindow(GetChartWindow());
     if(!pChartWindow || !pDrawViewWrapper )
         return;
@@ -707,7 +707,7 @@ void ChartController::execute_MouseMove( const MouseEvent& rMEvt )
 {
     SolarMutexGuard aGuard;
 
-    DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+    DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
     auto pChartWindow(GetChartWindow());
     if(!pChartWindow || !pDrawViewWrapper)
         return;
@@ -735,7 +735,7 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
     {
         SolarMutexGuard aGuard;
 
-        DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+        DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
         auto pChartWindow(GetChartWindow());
         if(!pChartWindow || !pDrawViewWrapper)
             return;
@@ -967,7 +967,7 @@ void ChartController::execute_Command( const CommandEvent& rCEvt )
     auto pChartWindow(GetChartWindow());
     bool bIsAction = false;
     {
-        DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+        DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
         if(!pChartWindow || !pDrawViewWrapper)
             return;
         bIsAction = m_pDrawViewWrapper->IsAction();
@@ -1306,7 +1306,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt )
     SolarMutexGuard aGuard;
     bool bReturn=false;
 
-    DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+    DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
     auto pChartWindow(GetChartWindow());
     if(!pChartWindow || !pDrawViewWrapper)
         return bReturn;
@@ -1724,11 +1724,11 @@ void ChartController::impl_selectObjectAndNotiy()
 {
     {
         SolarMutexGuard aGuard;
-        DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper;
+        DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get();
         if( pDrawViewWrapper )
         {
             pDrawViewWrapper->SetDragMode( m_eDragMode );
-            m_aSelection.applySelection( m_pDrawViewWrapper );
+            m_aSelection.applySelection( m_pDrawViewWrapper.get() );
         }
     }
     impl_notifySelectionChangeListeners();


More information about the Libreoffice-commits mailing list