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 .
22 #include <controls/table/tabletypes.hxx>
23 #include <tools/gen.hxx>
29 class TableControl_Impl
;
37 const TableControl_Impl
& m_rControl
;
38 const tools::Rectangle
& m_rBoundaries
;
39 tools::Rectangle m_aRect
;
43 const TableControl_Impl
& _rControl
,
44 const tools::Rectangle
& _rBoundaries
46 :m_rControl( _rControl
)
47 ,m_rBoundaries( _rBoundaries
)
48 ,m_aRect( _rBoundaries
)
54 const TableControl_Impl
& getControl() const { return m_rControl
; }
57 const tools::Rectangle
& getRect() const { return m_aRect
; }
58 bool isValid() const { return !m_aRect
.GetIntersection( m_rBoundaries
).IsEmpty(); }
64 class TableRowGeometry final
: public TableGeometry
68 TableControl_Impl
const & _rControl
,
69 tools::Rectangle
const & _rBoundaries
,
71 bool const i_allowVirtualRows
= false
72 // allow rows >= getRowCount()?
76 RowPos
getRow() const { return m_nRowPos
; }
82 bool impl_isValidRow( RowPos
const i_row
) const;
85 bool m_bAllowVirtualRows
;
89 //= TableColumnGeometry
91 class TableColumnGeometry final
: public TableGeometry
95 TableControl_Impl
const & _rControl
,
96 tools::Rectangle
const & _rBoundaries
,
101 ColPos
getCol() const { return m_nColPos
; }
106 void impl_initRect();
107 bool impl_isValidColumn( ColPos
const i_column
) const;
113 //= TableCellGeometry
115 /** a helper representing geometry information of a cell
117 class TableCellGeometry
120 TableRowGeometry m_aRow
;
121 TableColumnGeometry m_aCol
;
125 TableControl_Impl
const & _rControl
,
126 tools::Rectangle
const & _rBoundaries
,
130 :m_aRow( _rControl
, _rBoundaries
, _nRow
, false/*allowVirtualCells*/ )
131 ,m_aCol( _rControl
, _rBoundaries
, _nCol
)
136 const TableRowGeometry
& _rRow
,
140 ,m_aCol( _rRow
.getControl(), _rRow
.getRect(), _nCol
)
144 tools::Rectangle
getRect() const { return m_aRow
.getRect().GetIntersection( m_aCol
.getRect() ); }
145 ColPos
getColumn() const { return m_aCol
.getCol(); }
146 bool isValid() const { return !getRect().IsEmpty(); }
148 bool moveRight() {return m_aCol
.moveRight(); }
152 } // namespace svt::table
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */