[Libreoffice-commits] core.git: sw/inc sw/source
Noel Grandin
noel at peralex.com
Mon May 25 23:46:14 PDT 2015
sw/inc/crsrsh.hxx | 8 +--
sw/source/core/crsr/BlockCursor.cxx | 29 -----------
sw/source/core/crsr/BlockCursor.hxx | 63 ++++++++++++++++++++++++-
sw/source/core/crsr/IBlockCursor.hxx | 86 -----------------------------------
sw/source/core/crsr/crsrsh.cxx | 3 -
5 files changed, 66 insertions(+), 123 deletions(-)
New commits:
commit 57e801ba568de9d1b43456e0fc3c11fd0be05fe6
Author: Noel Grandin <noel at peralex.com>
Date: Mon May 25 15:04:08 2015 +0200
loplugin:unnecessarysuperclass, merge IBlockCursor into SwBlockCursor
Change-Id: I3c6c0d620cf7ffb11a9ca5e1025d91e59ef66c80
Reviewed-on: https://gerrit.libreoffice.org/15898
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
Tested-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx
index 073a8df..b513fc1 100644
--- a/sw/inc/crsrsh.hxx
+++ b/sw/inc/crsrsh.hxx
@@ -61,7 +61,7 @@ class SwTextAttr;
class SwTableBox;
class SwTOXMark;
class SwRangeRedline;
-class IBlockCursor;
+class SwBlockCursor;
class SwContentNode;
class SwPostItField;
class SwTextField;
@@ -177,7 +177,7 @@ private:
SwShellCrsr* m_pCrsrStk; ///< stack for the cursor
SwVisCrsr *m_pVisCrsr; ///< the visible cursor
- IBlockCursor *m_pBlockCrsr; ///< interface of cursor for block (=rectangular) selection
+ SwBlockCursor *m_pBlockCrsr; ///< interface of cursor for block (=rectangular) selection
SwShellTableCrsr* m_pTableCrsr; /**< table Crsr; only in tables when the
selection lays over 2 columns */
@@ -640,8 +640,8 @@ public:
{ return (const_cast<SwCrsrShell*>(this))->getShellCrsr( bBlock ); }
bool IsBlockMode() const { return 0 != m_pBlockCrsr; }
- const IBlockCursor* GetBlockCrsr() const { return m_pBlockCrsr; }
- IBlockCursor* GetBlockCrsr() { return m_pBlockCrsr; }
+ const SwBlockCursor* GetBlockCrsr() const { return m_pBlockCrsr; }
+ SwBlockCursor* GetBlockCrsr() { return m_pBlockCrsr; }
// is the Crsr in a table and is the selection over 2 columns
bool IsTableMode() const { return 0 != m_pTableCrsr; }
diff --git a/sw/source/core/crsr/BlockCursor.cxx b/sw/source/core/crsr/BlockCursor.cxx
index 992d29b..dea4bf8 100644
--- a/sw/source/core/crsr/BlockCursor.cxx
+++ b/sw/source/core/crsr/BlockCursor.cxx
@@ -17,33 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <IBlockCursor.hxx>
#include <viscrs.hxx>
#include "BlockCursor.hxx"
-/** The implementation of the block cursor interface
-
- It's simply an aggregation of a SwShellCrsr and a rectangle defined by
- a start and an end point.
-*/
-class SwBlockCursor : public IBlockCursor
-{
- SwShellCrsr aCursor;
- Point *pStartPt;
- Point *pEndPt;
-
-public:
- SwBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos ) :
- aCursor( rCrsrSh, rPos ), pStartPt(0), pEndPt(0) {}
- virtual SwShellCrsr& getShellCrsr() SAL_OVERRIDE;
- virtual void setStartPoint( const Point &rPt ) SAL_OVERRIDE;
- virtual void setEndPoint( const Point &rPt ) SAL_OVERRIDE;
- virtual const Point* getStartPoint() const SAL_OVERRIDE;
- virtual const Point* getEndPoint() const SAL_OVERRIDE;
- virtual void clearPoints() SAL_OVERRIDE;
- virtual ~SwBlockCursor();
-};
-
SwBlockCursor::~SwBlockCursor()
{
delete pStartPt;
@@ -89,9 +65,4 @@ void SwBlockCursor::clearPoints()
pEndPt = 0;
}
-IBlockCursor *createBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos )
-{
- return new SwBlockCursor( rCrsrSh, rPos );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/crsr/BlockCursor.hxx b/sw/source/core/crsr/BlockCursor.hxx
index b7d6ec9..17c781b 100644
--- a/sw/source/core/crsr/BlockCursor.hxx
+++ b/sw/source/core/crsr/BlockCursor.hxx
@@ -19,11 +19,70 @@
#ifndef INCLUDED_SW_SOURCE_CORE_CRSR_BLOCKCURSOR_HXX
#define INCLUDED_SW_SOURCE_CORE_CRSR_BLOCKCURSOR_HXX
-class IBlockCursor;
+#include <crsrsh.hxx>
+
class SwCrsrShell;
struct SwPosition;
+class Point;
+
+ /** Access to the block cursor
+
+ A block cursor contains a SwShellCrsr and additional information about
+ the rectangle which has been created by pressing the mouse button and
+ moving the mouse.
+
+ It's simply an aggregation of a SwShellCrsr and a rectangle defined by
+ a start and an end point.
+*/
+class SwBlockCursor
+{
+ SwShellCrsr aCursor;
+ Point *pStartPt;
+ Point *pEndPt;
+
+public:
+ SwBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos ) :
+ aCursor( rCrsrSh, rPos ), pStartPt(0), pEndPt(0) {}
+ /** Access to the shell cursor
+
+ @return SwShellCrsr& which represents the start and end position of the
+ current block selection
+ */
+ SwShellCrsr& getShellCrsr();
+ /** Defines the starting vertex of the block selection
+
+ @param rPt
+ rPt should contain the document coordinates of the mouse cursor when
+ the block selection starts (MouseButtonDown)
+ */
+ void setStartPoint( const Point &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 );
+ /** The document coordinates where the block selection has been started
+
+ @return 0, if no start point has been set
+ */
+ const Point* getStartPoint() const;
+ /** The document coordinates where the block selection ends (at the moment)
+
+ @return 0, if no end point has been set
+ */
+ const Point* getEndPoint() const;
+ /** 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();
+ ~SwBlockCursor();
+};
-IBlockCursor *createBlockCursor(const SwCrsrShell& rCrsrSh, const SwPosition &rPos);
#endif
diff --git a/sw/source/core/crsr/IBlockCursor.hxx b/sw/source/core/crsr/IBlockCursor.hxx
deleted file mode 100644
index 38039ea..0000000
--- a/sw/source/core/crsr/IBlockCursor.hxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_SW_SOURCE_CORE_CRSR_IBLOCKCURSOR_HXX
-#define INCLUDED_SW_SOURCE_CORE_CRSR_IBLOCKCURSOR_HXX
-
-class SwShellCrsr;
-class Point;
-
- /** Access to the block cursor
-
- A block cursor contains a SwShellCrsr and additional information about
- the rectangle which has been created by pressing the mouse button and
- moving the mouse.
- This interface provides access to the SwShellCrsr and to start and end
- point of the mouse movement.
- */
- class IBlockCursor
- {
- public:
- /** Access to the shell cursor
-
- @return SwShellCrsr& which represents the start and end position of the
- current block selection
- */
- virtual SwShellCrsr& getShellCrsr() = 0;
-
- /** Defines the starting vertex of the block selection
-
- @param rPt
- rPt should contain the document coordinates of the mouse cursor when
- the block selection starts (MouseButtonDown)
- */
- virtual void setStartPoint( const Point &rPt ) = 0;
-
- /** 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)
- */
- virtual void setEndPoint( const Point &rPt ) = 0;
-
- /** The document coordinates where the block selection has been started
-
- @return 0, if no start point has been set
- */
- virtual const Point* getStartPoint() const = 0;
-
- /** The document coordinates where the block selection ends (at the moment)
-
- @return 0, if no end point has been set
- */
- virtual const Point* getEndPoint() const = 0;
-
- /** 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.
- */
- virtual void clearPoints() = 0;
-
- /** Destructor of the block cursor interface */
- virtual ~IBlockCursor() {};
- };
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 428aa40..702ec9d 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -31,7 +31,6 @@
#include <viewimp.hxx>
#include <pam.hxx>
#include <swselectionlist.hxx>
-#include <IBlockCursor.hxx>
#include "BlockCursor.hxx"
#include <ndtxt.hxx>
#include <flyfrm.hxx>
@@ -890,7 +889,7 @@ void SwCrsrShell::CrsrToBlockCrsr()
if( !m_pBlockCrsr )
{
SwPosition aPos( *m_pCurCrsr->GetPoint() );
- m_pBlockCrsr = createBlockCursor( *this, aPos );
+ m_pBlockCrsr = new SwBlockCursor( *this, aPos );
SwShellCrsr &rBlock = m_pBlockCrsr->getShellCrsr();
rBlock.GetPtPos() = m_pCurCrsr->GetPtPos();
if( m_pCurCrsr->HasMark() )
More information about the Libreoffice-commits
mailing list