1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVTOOLS_SOURCE_TABLE_TABLEGEOMETRY_HXX
21 #define INCLUDED_SVTOOLS_SOURCE_TABLE_TABLEGEOMETRY_HXX
23 #include <svtools/table/tabletypes.hxx>
25 #include <tools/gen.hxx>
28 namespace svt
{ namespace table
32 class TableControl_Impl
;
40 const TableControl_Impl
& m_rControl
;
41 const Rectangle
& m_rBoundaries
;
46 const TableControl_Impl
& _rControl
,
47 const Rectangle
& _rBoundaries
49 :m_rControl( _rControl
)
50 ,m_rBoundaries( _rBoundaries
)
51 ,m_aRect( _rBoundaries
)
57 const TableControl_Impl
& getControl() const { return m_rControl
; }
60 const Rectangle
& getRect() const { return m_aRect
; }
61 bool isValid() const { return !m_aRect
.GetIntersection( m_rBoundaries
).IsEmpty(); }
67 class TableRowGeometry
: public TableGeometry
71 bool m_bAllowVirtualRows
;
75 TableControl_Impl
const & _rControl
,
76 Rectangle
const & _rBoundaries
,
78 bool const i_allowVirtualRows
= false
79 // allow rows >= getRowCount()?
83 RowPos
getRow() const { return m_nRowPos
; }
89 bool impl_isValidRow( RowPos
const i_row
) const;
93 //= TableColumnGeometry
95 class TableColumnGeometry
: public TableGeometry
99 bool m_bAllowVirtualColumns
;
103 TableControl_Impl
const & _rControl
,
104 Rectangle
const & _rBoundaries
,
106 bool const i_allowVirtualColumns
= false
110 ColPos
getCol() const { return m_nColPos
; }
115 void impl_initRect();
116 bool impl_isValidColumn( ColPos
const i_column
) const;
120 //= TableCellGeometry
122 /** a helper representing geometry information of a cell
124 class TableCellGeometry
127 TableRowGeometry m_aRow
;
128 TableColumnGeometry m_aCol
;
132 TableControl_Impl
const & _rControl
,
133 Rectangle
const & _rBoundaries
,
136 bool const i_alllowVirtualCells
= false
138 :m_aRow( _rControl
, _rBoundaries
, _nRow
, i_alllowVirtualCells
)
139 ,m_aCol( _rControl
, _rBoundaries
, _nCol
, i_alllowVirtualCells
)
144 const TableRowGeometry
& _rRow
,
148 ,m_aCol( _rRow
.getControl(), _rRow
.getRect(), _nCol
)
152 inline Rectangle
getRect() const { return m_aRow
.getRect().GetIntersection( m_aCol
.getRect() ); }
153 inline RowPos
getRow() const { return m_aRow
.getRow(); }
154 inline ColPos
getColumn() const { return m_aCol
.getCol(); }
155 inline bool isValid() const { return !getRect().IsEmpty(); }
157 inline bool moveDown() {return m_aRow
.moveDown(); }
158 inline bool moveRight() {return m_aCol
.moveRight(); }
162 } } // namespace svt::table
165 #endif // INCLUDED_SVTOOLS_SOURCE_TABLE_TABLEGEOMETRY_HXX
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */