1 /*************************************************************************
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * Copyright 2009 by Sun Microsystems, Inc.
6 * OpenOffice.org - a multi-platform office productivity suite
8 * This file is part of OpenOffice.org.
10 * OpenOffice.org is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License version 3
12 * only, as published by the Free Software Foundation.
14 * OpenOffice.org is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License version 3 for more details
18 * (a copy is included in the LICENSE file that accompanied this code).
20 * You should have received a copy of the GNU Lesser General Public License
21 * version 3 along with OpenOffice.org. If not, see
22 * <http://www.openoffice.org/license.html>
23 * for a copy of the LGPLv3 License.
24 ************************************************************************/
26 #ifndef SVTOOLS_TABLEGEOMETRY_HXX
27 #define SVTOOLS_TABLEGEOMETRY_HXX
29 #ifndef SVTOOLS_INC_TABLE_TABLETYPES_HXX
30 #include <svtools/table/tabletypes.hxx>
34 #include <tools/gen.hxx>
37 //........................................................................
38 namespace svt
{ namespace table
40 //........................................................................
42 class TableControl_Impl
;
44 //====================================================================
46 //====================================================================
50 const TableControl_Impl
& m_rControl
;
51 const Rectangle
& m_rBoundaries
;
56 const TableControl_Impl
& _rControl
,
57 const Rectangle
& _rBoundaries
59 :m_rControl( _rControl
)
60 ,m_rBoundaries( _rBoundaries
)
61 ,m_aRect( _rBoundaries
)
67 const TableControl_Impl
& getControl() const { return m_rControl
; }
70 const Rectangle
& getRect() const { return m_aRect
; }
71 bool isValid() const { return !m_aRect
.GetIntersection( m_rBoundaries
).IsEmpty(); }
74 //====================================================================
76 //====================================================================
77 class TableRowGeometry
: public TableGeometry
84 const TableControl_Impl
& _rControl
,
85 const Rectangle
& _rBoundaries
,
90 RowPos
getRow() const { return m_nRowPos
; }
95 //====================================================================
96 //= TableColumnGeometry
97 //====================================================================
98 class TableColumnGeometry
: public TableGeometry
105 const TableControl_Impl
& _rControl
,
106 const Rectangle
& _rBoundaries
,
111 ColPos
getCol() const { return m_nColPos
; }
116 //====================================================================
117 //= TableCellGeometry
118 //====================================================================
119 /** a helper representing geometry information of a cell
121 class TableCellGeometry
124 TableRowGeometry m_aRow
;
125 TableColumnGeometry m_aCol
;
129 const TableControl_Impl
& _rControl
,
130 const Rectangle
& _rBoundaries
,
134 :m_aRow( _rControl
, _rBoundaries
, _nRow
)
135 ,m_aCol( _rControl
, _rBoundaries
, _nCol
)
140 const TableRowGeometry
& _rRow
,
144 ,m_aCol( _rRow
.getControl(), _rRow
.getRect(), _nCol
)
148 inline Rectangle
getRect() const { return m_aRow
.getRect().GetIntersection( m_aCol
.getRect() ); }
149 inline RowPos
getRow() const { return m_aRow
.getRow(); }
150 inline ColPos
getColumn() const { return m_aCol
.getCol(); }
151 inline bool isValid() const { return !getRect().IsEmpty(); }
153 inline bool moveDown() {return m_aRow
.moveDown(); }
154 inline bool moveRight() {return m_aCol
.moveRight(); }
157 //........................................................................
158 } } // namespace svt::table
159 //........................................................................
161 #endif // SVTOOLS_TABLEGEOMETRY_HXX