LibreOffice Module toolkit (master) 1
tablegeometry.cxx
Go to the documentation of this file.
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
21#include "tablegeometry.hxx"
22#include "tablecontrol_impl.hxx"
23
24
25namespace svt::table
26{
27
28
29 //= TableRowGeometry
30
31
33 RowPos const _nRow, bool const i_allowVirtualRows )
34 :TableGeometry( _rControl, _rBoundaries )
35 ,m_nRowPos( _nRow )
36 ,m_bAllowVirtualRows( i_allowVirtualRows )
37 {
39 {
40 m_aRect.SetTop( 0 );
42 }
43 else
44 {
46 }
47 }
48
49
51 {
53 {
56 }
57 else
59 }
60
61
62 bool TableRowGeometry::impl_isValidRow( RowPos const i_row ) const
63 {
64 return m_bAllowVirtualRows || ( i_row < m_rControl.m_pModel->getRowCount() );
65 }
66
67
69 {
71 {
74 }
75 else
76 {
77 if ( impl_isValidRow( ++m_nRowPos ) )
79 else
81 }
82 return isValid();
83 }
84
85
86 //= TableColumnGeometry
87
88
90 ColPos const _nCol )
91 :TableGeometry( _rControl, _rBoundaries )
92 ,m_nColPos( _nCol )
93 {
95 {
96 m_aRect.SetLeft( 0 );
98 }
99 else
100 {
102 }
103 }
104
105
107 {
108 ColPos nLeftColumn = m_rControl.m_nLeftColumn;
109 if ( ( m_nColPos >= nLeftColumn ) && impl_isValidColumn( m_nColPos ) )
110 {
112 // TODO: take into account any possibly frozen columns
113
114 for ( ColPos col = nLeftColumn; col < m_nColPos; ++col )
117 }
118 else
120 }
121
122
124 {
125 return i_column < ColPos( m_rControl.m_aColumnWidths.size() );
126 }
127
128
130 {
131 if ( m_nColPos == COL_ROW_HEADERS )
132 {
135 }
136 else
137 {
138 if ( impl_isValidColumn( ++m_nColPos ) )
139 {
140 m_aRect.SetLeft( m_aRect.Right() + 1 );
142 }
143 else
145 }
146
147 return isValid();
148 }
149
150
151} // namespace svt::table
152
153
154/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool impl_isValidColumn(ColPos const i_column) const
TableColumnGeometry(TableControl_Impl const &_rControl, tools::Rectangle const &_rBoundaries, ColPos const _nCol)
tools::Long m_nRowHeightPixel
the height of a single row in the table, measured in pixels
tools::Long m_nRowHeaderWidthPixel
the width of the row header column in the table, measured in pixels
ColumnPositions m_aColumnWidths
info about the widths of our columns
tools::Long m_nColHeaderHeightPixel
the height of the column header row in the table, measured in pixels
PTableModel m_pModel
the model of the table control
const TableControl_Impl & m_rControl
tools::Rectangle m_aRect
bool impl_isValidRow(RowPos const i_row) const
TableRowGeometry(TableControl_Impl const &_rControl, tools::Rectangle const &_rBoundaries, RowPos const _nRow, bool const i_allowVirtualRows=false)
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
constexpr void SetRight(tools::Long v)
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
constexpr tools::Long Right() const
tools::Long AdjustRight(tools::Long nHorzMoveDelta)
constexpr void SetBottom(tools::Long v)
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
constexpr tools::Long Left() const
RttiCompleteObjectLocator col
sal_Int32 RowPos
a value denoting a row position within a table
Definition: tabletypes.hxx:34
sal_Int32 ColPos
a value denoting a column position within a table
Definition: tabletypes.hxx:32
#define COL_ROW_HEADERS
denotes the column containing the row headers
Definition: tabletypes.hxx:39
#define ROW_COL_HEADERS
denotes the row containing the column headers
Definition: tabletypes.hxx:41