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_INC_TABLE_TABLECONTROLINTERFACE_HXX
21 #define INCLUDED_SVTOOLS_INC_TABLE_TABLECONTROLINTERFACE_HXX
23 #include <sal/types.h>
24 #include <vcl/event.hxx>
25 #include <vcl/seleng.hxx>
27 #include <svtools/table/tabletypes.hxx>
28 #include <svtools/table/tablemodel.hxx>
33 namespace svt
{ namespace table
38 //= TableControlAction
40 enum TableControlAction
42 /// moves the cursor in the table control one row up, if possible, by keeping the current column
44 /// moves the cursor in the table control one row down, if possible, by keeping the current column
46 /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
48 /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
50 /// moves the cursor to the beginning of the current line
52 /// moves the cursor to the end of the current line
54 /// moves the cursor to the first row, keeping the current column
56 /// moves the cursor to the last row, keeping the current column
58 /// moves the cursor one page up, keeping the current column
60 /// moves the cursor one page down, keeping the current column
62 /// moves the cursor to the top-most, left-most cell
64 /// moves the cursor to the bottom-most, right-most cell
66 /// selects the row, where the actual cursor is
68 /// selects the rows, above the actual cursor is
70 /// selects the row, beneath the actual cursor is
72 /// selects the row, from the actual cursor till top
73 cursorSelectRowAreaTop
,
74 /// selects the row, from the actual cursor till bottom
75 cursorSelectRowAreaBottom
,
77 /// invalid and final enumeration value, not to be actually used
78 invalidTableControlAction
100 :nColumn( COL_INVALID
)
102 ,eArea( CellContent
)
106 TableCell( ColPos
const i_column
, RowPos
const i_row
)
109 ,eArea( CellContent
)
119 /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible
120 area. Note: see below.
124 /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of a all columns
125 up to the current one.
127 Huh? Earlier you said that the nStartPixel of columns
128 scrolled out (to the left) of the visible area is
129 negative. Also, where is the promise that there is no gap
130 between columns? The above claim would be true only if the
131 first column always started at zero, and there is never a
132 gap. So these doc comments are inconsistent. How
143 ColumnMetrics( long const i_start
, long const i_end
)
144 :nStartPixel( i_start
)
155 TableAreaColumnHeaders
,
164 /** defines a callback interface to be implemented by a concrete table control
166 class SAL_NO_VTABLE ITableControl
169 /** hides the cell cursor
171 The method cares for successive calls, that is, for every call to
172 ->hideCursor(), you need one call to ->showCursor. Only if the number
173 of both calls matches, the cursor is really shown.
177 virtual void hideCursor() = 0;
179 /** shows the cell cursor
183 virtual void showCursor() = 0;
185 /** dispatches an action to the table control
188 <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
189 failure conditions include some other instance vetoing the action, or impossibility
190 to execute the action at all (for instance moving up one row when already positioned
191 on the very first row).
193 @see TableControlAction
195 virtual bool dispatchAction( TableControlAction _eAction
) = 0;
197 /** returns selection engine*/
198 virtual SelectionEngine
* getSelEngine() = 0;
200 /** returns the table model
202 The returned model is guaranteed to not be <NULL/>.
204 virtual PTableModel
getModel() const = 0;
206 /// returns the index of the currently active column
207 virtual ColPos
getCurrentColumn() const = 0;
209 /// returns the index of the currently active row
210 virtual RowPos
getCurrentRow() const = 0;
212 /// activates the given cell
213 virtual bool activateCell( ColPos
const i_col
, RowPos
const i_row
) = 0;
215 /// retrieves the size of the table window, in pixels
216 virtual ::Size
getTableSizePixel() const = 0;
218 /// sets a new mouse pointer for the table window
219 virtual void setPointer( Pointer
const & i_pointer
) = 0;
221 /// captures the mouse to the table window
222 virtual void captureMouse() = 0;
224 /// releases the mouse, after it had previously been captured
225 virtual void releaseMouse() = 0;
227 /// invalidates the table window
228 virtual void invalidate( TableArea
const i_what
) = 0;
230 /// calculates a width, given in pixels, into a AppFont-based width
231 virtual long pixelWidthToAppFont( long const i_pixels
) const = 0;
233 /// shows a trackign rectangle
234 virtual void showTracking( Rectangle
const & i_location
, sal_uInt16
const i_flags
) = 0;
236 /// hides a prviously shown tracking rectangle
237 virtual void hideTracking() = 0;
239 /// does a hit test for the given pixel coordinates
240 virtual TableCell
hitTest( const Point
& rPoint
) const = 0;
242 /// retrieves the metrics for a given column
243 virtual ColumnMetrics
getColumnMetrics( ColPos
const i_column
) const = 0;
245 /// determines whether a given row is selected
246 virtual bool isRowSelected( RowPos _nRow
) const = 0;
248 virtual ~ITableControl() {};
252 } } // namespace svt::table
255 #endif // INCLUDED_SVTOOLS_INC_TABLE_TABLECONTROLINTERFACE_HXX
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */