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

Noel Grandin noel.grandin at collabora.co.uk
Fri Mar 16 07:26:13 UTC 2018


 chart2/source/controller/main/ChartController_EditData.cxx |    3 -
 sw/source/core/crsr/BlockCursor.cxx                        |   36 -------------
 sw/source/core/crsr/BlockCursor.hxx                        |   17 +++---
 3 files changed, 11 insertions(+), 45 deletions(-)

New commits:
commit 0a8af607ba0936d8802fca96ec3259c7eedcd571
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Thu Mar 15 17:05:46 2018 +0200

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

diff --git a/sw/source/core/crsr/BlockCursor.cxx b/sw/source/core/crsr/BlockCursor.cxx
index 89c8d8f745fe..9f2c399a7393 100644
--- a/sw/source/core/crsr/BlockCursor.cxx
+++ b/sw/source/core/crsr/BlockCursor.cxx
@@ -22,8 +22,6 @@
 
 SwBlockCursor::~SwBlockCursor()
 {
-    delete pStartPt;
-    delete pEndPt;
 }
 
 SwShellCursor& SwBlockCursor::getShellCursor()
@@ -31,38 +29,4 @@ SwShellCursor& SwBlockCursor::getShellCursor()
     return aCursor;
 }
 
-void SwBlockCursor::setStartPoint( const Point &rPt )
-{
-    if( pStartPt )
-        *pStartPt = rPt;
-    else
-        pStartPt = new Point( rPt );
-}
-
-void SwBlockCursor::setEndPoint( const Point &rPt )
-{
-    if( pEndPt )
-        *pEndPt = rPt;
-    else
-        pEndPt = new Point( rPt );
-}
-
-const Point* SwBlockCursor::getStartPoint() const
-{
-    return pStartPt;
-}
-
-const Point* SwBlockCursor::getEndPoint() const
-{
-    return pEndPt;
-}
-
-void SwBlockCursor::clearPoints()
-{
-    delete pStartPt;
-    delete pEndPt;
-    pStartPt = nullptr;
-    pEndPt = nullptr;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/crsr/BlockCursor.hxx b/sw/source/core/crsr/BlockCursor.hxx
index 3238993c87cd..c0b764662f15 100644
--- a/sw/source/core/crsr/BlockCursor.hxx
+++ b/sw/source/core/crsr/BlockCursor.hxx
@@ -20,6 +20,7 @@
 #define INCLUDED_SW_SOURCE_CORE_CRSR_BLOCKCURSOR_HXX
 
 #include <crsrsh.hxx>
+#include <boost/optional.hpp>
 
 class SwCursorShell;
 struct SwPosition;
@@ -37,12 +38,12 @@ class Point;
 class SwBlockCursor
 {
     SwShellCursor aCursor;
-    Point *pStartPt;
-    Point *pEndPt;
+    boost::optional<Point> maStartPt;
+    boost::optional<Point> maEndPt;
 
 public:
     SwBlockCursor( const SwCursorShell& rCursorSh, const SwPosition &rPos ) :
-        aCursor( rCursorSh, rPos ), pStartPt(nullptr), pEndPt(nullptr) {}
+        aCursor( rCursorSh, rPos ) {}
     /** Access to the shell cursor
 
         @return SwShellCursor& which represents the start and end position of the
@@ -55,31 +56,31 @@ public:
         rPt should contain the document coordinates of the mouse cursor when
         the block selection starts (MouseButtonDown)
     */
-    void setStartPoint( const Point &rPt );
+    void setStartPoint( const Point &rPt ) { maStartPt = rPt; }
     /** Defines the ending vertex of the block selection
 
         @param rPt
         rPt should contain the document coordinates of the mouse cursor when
         the block selection has started and the mouse has been moved (MouseMove)
     */
-    void setEndPoint( const Point &rPt );
+    void setEndPoint( const Point &rPt ) { maEndPt = rPt; }
     /** The document coordinates where the block selection has been started
 
         @return 0, if no start point has been set
     */
-    const Point* getStartPoint() const;
+    boost::optional<Point> const & getStartPoint() const { return maStartPt; }
     /** The document coordinates where the block selection ends (at the moment)
 
         @return 0, if no end point has been set
     */
-    const Point* getEndPoint() const;
+    boost::optional<Point> const & getEndPoint() const { return maEndPt; }
     /** Deletion of the mouse created rectangle
 
         When start and end points exist, the block cursor depends on this. If the
         cursor is moved by cursor keys (e.g. up/down, home/end) the mouse rectangle
         is obsolete and has to be deleted.
     */
-    void clearPoints();
+    void clearPoints() { maStartPt.reset(); maEndPt.reset(); }
     ~SwBlockCursor();
 };
 
commit a7e98725901412aa334a1abe87194e682c1ae836
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Thu Mar 15 16:48:54 2018 +0530

    chart2 lok: give parent to data table dialog to tunnel it
    
    Change-Id: Ie82a9a6d9b499e5da34e04f0c2f5fc7c164b098e
    Reviewed-on: https://gerrit.libreoffice.org/51346
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: pranavk <pranavk at collabora.co.uk>

diff --git a/chart2/source/controller/main/ChartController_EditData.cxx b/chart2/source/controller/main/ChartController_EditData.cxx
index a274a1e402df..c3296edf4d1c 100644
--- a/chart2/source/controller/main/ChartController_EditData.cxx
+++ b/chart2/source/controller/main/ChartController_EditData.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <ChartWindow.hxx>
 #include <ChartController.hxx>
 
 #include <dlg_DataEditor.hxx>
@@ -46,7 +47,7 @@ void ChartController::executeDispatch_EditData()
         UndoLiveUpdateGuardWithData aUndoGuard(
             SchResId( STR_ACTION_EDIT_CHART_DATA ),
             m_xUndoManager );
-        ScopedVclPtrInstance<DataEditor> aDataEditorDialog( nullptr, xChartDoc, m_xCC );
+        ScopedVclPtrInstance<DataEditor> aDataEditorDialog( GetChartWindow().get(), xChartDoc, m_xCC );
         if (aDataEditorDialog->Execute() == RET_OK)
             aDataEditorDialog->ApplyChangesToModel();
         aUndoGuard.commit();


More information about the Libreoffice-commits mailing list