bump product version to 6.4.0.3
[LibreOffice.git] / svtools / inc / table / tablecontrolinterface.hxx
blob6baff43ba2b7a1b431c086412cfc8e3bcc123c2b
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_INC_TABLE_TABLECONTROLINTERFACE_HXX
21 #define INCLUDED_SVTOOLS_INC_TABLE_TABLECONTROLINTERFACE_HXX
23 #include <sal/types.h>
24 #include <vcl/seleng.hxx>
26 #include <svtools/table/tabletypes.hxx>
27 #include <svtools/table/tablemodel.hxx>
30 namespace svt { namespace table
34 //= TableControlAction
36 enum TableControlAction
38 /// moves the cursor in the table control one row up, if possible, by keeping the current column
39 cursorUp,
40 /// moves the cursor in the table control one row down, if possible, by keeping the current column
41 cursorDown,
42 /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
43 cursorLeft,
44 /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
45 cursorRight,
46 /// moves the cursor to the beginning of the current line
47 cursorToLineStart,
48 /// moves the cursor to the end of the current line
49 cursorToLineEnd,
50 /// moves the cursor to the first row, keeping the current column
51 cursorToFirstLine,
52 /// moves the cursor to the last row, keeping the current column
53 cursorToLastLine,
54 /// moves the cursor one page up, keeping the current column
55 cursorPageUp,
56 /// moves the cursor one page down, keeping the current column
57 cursorPageDown,
58 /// moves the cursor to the top-most, left-most cell
59 cursorTopLeft,
60 /// moves the cursor to the bottom-most, right-most cell
61 cursorBottomRight,
62 /// selects the row, where the actual cursor is
63 cursorSelectRow,
64 /// selects the rows, above the actual cursor is
65 cursorSelectRowUp,
66 /// selects the row, beneath the actual cursor is
67 cursorSelectRowDown,
68 /// selects the row, from the actual cursor till top
69 cursorSelectRowAreaTop,
70 /// selects the row, from the actual cursor till bottom
71 cursorSelectRowAreaBottom,
73 /// invalid and final enumeration value, not to be actually used
74 invalidTableControlAction
78 //= TableCellArea
80 enum TableCellArea
82 CellContent,
83 ColumnDivider
87 //= TableCell
89 struct TableCell
91 ColPos const nColumn;
92 RowPos const nRow;
93 TableCellArea eArea;
95 TableCell( ColPos const i_column, RowPos const i_row )
96 :nColumn( i_column )
97 ,nRow( i_row )
98 ,eArea( CellContent )
104 //= ColumnMetrics
106 struct ColumnMetrics
108 /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible
109 area. Note: see below.
111 long nStartPixel;
113 /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of all columns
114 up to the current one.
116 Huh? Earlier you said that the nStartPixel of columns
117 scrolled out (to the left) of the visible area is
118 negative. Also, where is the promise that there is no gap
119 between columns? The above claim would be true only if the
120 first column always started at zero, and there is never a
121 gap. So these doc comments are inconsistent. How
122 surprising.
124 long nEndPixel;
126 ColumnMetrics()
127 :nStartPixel(0)
128 ,nEndPixel(0)
132 ColumnMetrics( long const i_start, long const i_end )
133 :nStartPixel( i_start )
134 ,nEndPixel( i_end )
140 //= TableArea
142 enum class TableArea
144 ColumnHeaders,
145 RowHeaders,
150 //= ITableControl
152 /** defines a callback interface to be implemented by a concrete table control
154 class SAL_NO_VTABLE ITableControl
156 public:
157 /** hides the cell cursor
159 The method cares for successive calls, that is, for every call to
160 ->hideCursor(), you need one call to ->showCursor. Only if the number
161 of both calls matches, the cursor is really shown.
163 @see showCursor
165 virtual void hideCursor() = 0;
167 /** shows the cell cursor
169 @see hideCursor
171 virtual void showCursor() = 0;
173 /** dispatches an action to the table control
175 @return
176 <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
177 failure conditions include some other instance vetoing the action, or impossibility
178 to execute the action at all (for instance moving up one row when already positioned
179 on the very first row).
181 @see TableControlAction
183 virtual bool dispatchAction( TableControlAction _eAction ) = 0;
185 /** returns selection engine*/
186 virtual SelectionEngine* getSelEngine() = 0;
188 /** returns the table model
190 The returned model is guaranteed to not be <NULL/>.
192 virtual PTableModel getModel() const = 0;
194 /// returns the index of the currently active column
195 virtual ColPos getCurrentColumn() const = 0;
197 /// returns the index of the currently active row
198 virtual RowPos getCurrentRow() const = 0;
200 /// activates the given cell
201 virtual void activateCell( ColPos const i_col, RowPos const i_row ) = 0;
203 /// retrieves the size of the table window, in pixels
204 virtual ::Size getTableSizePixel() const = 0;
206 /// sets a new mouse pointer for the table window
207 virtual void setPointer( PointerStyle i_pointer ) = 0;
209 /// captures the mouse to the table window
210 virtual void captureMouse() = 0;
212 /// releases the mouse, after it had previously been captured
213 virtual void releaseMouse() = 0;
215 /// invalidates the table window
216 virtual void invalidate( TableArea const i_what ) = 0;
218 /// calculates a width, given in pixels, into an AppFont-based width
219 virtual long pixelWidthToAppFont( long const i_pixels ) const = 0;
221 /// shows a tracking rectangle
222 virtual void showTracking( tools::Rectangle const & i_location, ShowTrackFlags const i_flags ) = 0;
224 /// hides a prviously shown tracking rectangle
225 virtual void hideTracking() = 0;
227 /// does a hit test for the given pixel coordinates
228 virtual TableCell hitTest( const Point& rPoint ) const = 0;
230 /// retrieves the metrics for a given column
231 virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0;
233 /// determines whether a given row is selected
234 virtual bool isRowSelected( RowPos _nRow ) const = 0;
236 virtual ~ITableControl() {};
240 } } // namespace svt::table
243 #endif // INCLUDED_SVTOOLS_INC_TABLE_TABLECONTROLINTERFACE_HXX
245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */