LCOV - code coverage report
Current view: top level - sw/source/core/crsr - BlockCursor.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 31 3.2 %
Date: 2014-11-03 Functions: 2 12 16.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <IBlockCursor.hxx>
      21             : #include <viscrs.hxx>
      22             : #include "BlockCursor.hxx"
      23             : 
      24             : /** The implementation of the block cursor interface
      25             : 
      26             :     It's simply an aggregation of a SwShellCrsr and a rectangle defined by
      27             :     a start and an end point.
      28             : */
      29             : class SwBlockCursor : public IBlockCursor
      30             : {
      31             :     SwShellCrsr aCursor;
      32             :     Point *pStartPt;
      33             :     Point *pEndPt;
      34             : 
      35             : public:
      36           0 :     SwBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos ) :
      37           0 :         aCursor( rCrsrSh, rPos ), pStartPt(0), pEndPt(0) {}
      38             :     virtual SwShellCrsr& getShellCrsr() SAL_OVERRIDE;
      39             :     virtual void setStartPoint( const Point &rPt ) SAL_OVERRIDE;
      40             :     virtual void setEndPoint( const Point &rPt ) SAL_OVERRIDE;
      41             :     virtual const Point* getStartPoint() const SAL_OVERRIDE;
      42             :     virtual const Point* getEndPoint() const SAL_OVERRIDE;
      43             :     virtual void clearPoints() SAL_OVERRIDE;
      44             :     virtual ~SwBlockCursor();
      45             : };
      46             : 
      47           0 : SwBlockCursor::~SwBlockCursor()
      48             : {
      49           0 :     delete pStartPt;
      50           0 :     delete pEndPt;
      51           0 : }
      52             : 
      53           0 : SwShellCrsr& SwBlockCursor::getShellCrsr()
      54             : {
      55           0 :     return aCursor;
      56             : }
      57             : 
      58           0 : void SwBlockCursor::setStartPoint( const Point &rPt )
      59             : {
      60           0 :     if( pStartPt )
      61           0 :         *pStartPt = rPt;
      62             :     else
      63           0 :         pStartPt = new Point( rPt );
      64           0 : }
      65             : 
      66           0 : void SwBlockCursor::setEndPoint( const Point &rPt )
      67             : {
      68           0 :     if( pEndPt )
      69           0 :         *pEndPt = rPt;
      70             :     else
      71           0 :         pEndPt = new Point( rPt );
      72           0 : }
      73             : 
      74           0 : const Point* SwBlockCursor::getStartPoint() const
      75             : {
      76           0 :     return pStartPt;
      77             : }
      78             : 
      79           0 : const Point* SwBlockCursor::getEndPoint() const
      80             : {
      81           0 :     return pEndPt;
      82             : }
      83             : 
      84           0 : void SwBlockCursor::clearPoints()
      85             : {
      86           0 :     delete pStartPt;
      87           0 :     delete pEndPt;
      88           0 :     pStartPt = 0;
      89           0 :     pEndPt = 0;
      90           0 : }
      91             : 
      92           0 : IBlockCursor *createBlockCursor( const SwCrsrShell& rCrsrSh, const SwPosition &rPos )
      93             : {
      94           0 :     return new SwBlockCursor( rCrsrSh, rPos );
      95         270 : }
      96             : 
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10