LCOV - code coverage report
Current view: top level - svtools/source/table - tablegeometry.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 18 0.0 %
Date: 2014-04-14 Functions: 0 12 0.0 %
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             : #ifndef INCLUDED_SVTOOLS_SOURCE_TABLE_TABLEGEOMETRY_HXX
      21             : #define INCLUDED_SVTOOLS_SOURCE_TABLE_TABLEGEOMETRY_HXX
      22             : 
      23             : #include "svtools/table/tabletypes.hxx"
      24             : 
      25             : #include <tools/gen.hxx>
      26             : 
      27             : 
      28             : namespace svt { namespace table
      29             : {
      30             : 
      31             : 
      32             :     class TableControl_Impl;
      33             : 
      34             : 
      35             :     //= TableGeometry
      36             : 
      37             :     class TableGeometry
      38             :     {
      39             :     protected:
      40             :         const TableControl_Impl&    m_rControl;
      41             :         const Rectangle&            m_rBoundaries;
      42             :         Rectangle                   m_aRect;
      43             : 
      44             :     protected:
      45           0 :         TableGeometry(
      46             :                 const TableControl_Impl& _rControl,
      47             :                 const Rectangle& _rBoundaries
      48             :             )
      49             :             :m_rControl( _rControl )
      50             :             ,m_rBoundaries( _rBoundaries )
      51           0 :             ,m_aRect( _rBoundaries )
      52             :         {
      53           0 :         }
      54             : 
      55             :     public:
      56             :         // attribute access
      57           0 :         const TableControl_Impl&    getControl() const      { return m_rControl; }
      58             : 
      59             :         // status
      60           0 :         const Rectangle&    getRect() const { return m_aRect; }
      61           0 :         bool                isValid() const { return !m_aRect.GetIntersection( m_rBoundaries ).IsEmpty(); }
      62             :     };
      63             : 
      64             : 
      65             :     //= TableRowGeometry
      66             : 
      67             :     class TableRowGeometry : public TableGeometry
      68             :     {
      69             :     protected:
      70             :         RowPos  m_nRowPos;
      71             :         bool    m_bAllowVirtualRows;
      72             : 
      73             :     public:
      74             :         TableRowGeometry(
      75             :             TableControl_Impl const & _rControl,
      76             :             Rectangle const & _rBoundaries,
      77             :             RowPos const _nRow,
      78             :             bool const i_allowVirtualRows = false
      79             :                 // allow rows >= getRowCount()?
      80             :         );
      81             : 
      82             :         // status
      83           0 :         RowPos              getRow() const  { return m_nRowPos; }
      84             :         // operations
      85             :         bool                moveDown();
      86             : 
      87             :     private:
      88             :         void    impl_initRect();
      89             :         bool    impl_isValidRow( RowPos const i_row ) const;
      90             :     };
      91             : 
      92             : 
      93             :     //= TableColumnGeometry
      94             : 
      95             :     class TableColumnGeometry : public TableGeometry
      96             :     {
      97             :     protected:
      98             :         ColPos  m_nColPos;
      99             :         bool    m_bAllowVirtualColumns;
     100             : 
     101             :     public:
     102             :         TableColumnGeometry(
     103             :             TableControl_Impl const & _rControl,
     104             :             Rectangle const & _rBoundaries,
     105             :             ColPos const _nCol,
     106             :             bool const i_allowVirtualColumns = false
     107             :         );
     108             : 
     109             :         // status
     110           0 :         ColPos              getCol() const  { return m_nColPos; }
     111             :         // operations
     112             :         bool                moveRight();
     113             : 
     114             :     private:
     115             :         void    impl_initRect();
     116             :         bool    impl_isValidColumn( ColPos const i_column ) const;
     117             :     };
     118             : 
     119             : 
     120             :     //= TableCellGeometry
     121             : 
     122             :     /** a helper representing geometry information of a cell
     123             :     */
     124             :     class TableCellGeometry
     125             :     {
     126             :     private:
     127             :         TableRowGeometry    m_aRow;
     128             :         TableColumnGeometry m_aCol;
     129             : 
     130             :     public:
     131           0 :         TableCellGeometry(
     132             :                 TableControl_Impl const & _rControl,
     133             :                 Rectangle const & _rBoundaries,
     134             :                 ColPos const _nCol,
     135             :                 RowPos const _nRow,
     136             :                 bool const i_alllowVirtualCells = false
     137             :             )
     138             :             :m_aRow( _rControl, _rBoundaries, _nRow, i_alllowVirtualCells )
     139           0 :             ,m_aCol( _rControl, _rBoundaries, _nCol, i_alllowVirtualCells )
     140             :         {
     141           0 :         }
     142             : 
     143           0 :         TableCellGeometry(
     144             :                 const TableRowGeometry& _rRow,
     145             :                 ColPos _nCol
     146             :             )
     147             :             :m_aRow( _rRow )
     148           0 :             ,m_aCol( _rRow.getControl(), _rRow.getRect(), _nCol )
     149             :         {
     150           0 :         }
     151             : 
     152           0 :         inline  Rectangle   getRect() const     { return m_aRow.getRect().GetIntersection( m_aCol.getRect() ); }
     153             :         inline  RowPos      getRow() const      { return m_aRow.getRow(); }
     154           0 :         inline  ColPos      getColumn() const   { return m_aCol.getCol(); }
     155           0 :         inline  bool        isValid() const     { return !getRect().IsEmpty(); }
     156             : 
     157             :         inline  bool        moveDown()      {return m_aRow.moveDown(); }
     158           0 :         inline  bool        moveRight()     {return m_aCol.moveRight(); }
     159             :     };
     160             : 
     161             : 
     162             : } } // namespace svt::table
     163             : 
     164             : 
     165             : #endif // INCLUDED_SVTOOLS_SOURCE_TABLE_TABLEGEOMETRY_HXX
     166             : 
     167             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10