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
37 //= TableControlAction
39 enum TableControlAction
41 /// moves the cursor in the table control one row up, if possible, by keeping the current column
43 /// moves the cursor in the table control one row down, if possible, by keeping the current column
45 /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
47 /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
49 /// moves the cursor to the beginning of the current line
51 /// moves the cursor to the end of the current line
53 /// moves the cursor to the first row, keeping the current column
55 /// moves the cursor to the last row, keeping the current column
57 /// moves the cursor one page up, keeping the current column
59 /// moves the cursor one page down, keeping the current column
61 /// moves the cursor to the top-most, left-most cell
63 /// moves the cursor to the bottom-most, right-most cell
65 /// selects the row, where the actual cursor is
67 /// selects the rows, above the actual cursor is
69 /// selects the row, beneath the actual cursor is
71 /// selects the row, from the actual cursor till top
72 cursorSelectRowAreaTop
,
73 /// selects the row, from the actual cursor till bottom
74 cursorSelectRowAreaBottom
,
76 /// invalid and final enumeration value, not to be actually used
77 invalidTableControlAction
98 TableCell( ColPos
const i_column
, RowPos
const i_row
)
101 ,eArea( CellContent
)
111 /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible
112 area. Note: see below.
116 /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of a all columns
117 up to the current one.
119 Huh? Earlier you said that the nStartPixel of columns
120 scrolled out (to the left) of the visible area is
121 negative. Also, where is the promise that there is no gap
122 between columns? The above claim would be true only if the
123 first column always started at zero, and there is never a
124 gap. So these doc comments are inconsistent. How
135 ColumnMetrics( long const i_start
, long const i_end
)
136 :nStartPixel( i_start
)
155 /** defines a callback interface to be implemented by a concrete table control
157 class SAL_NO_VTABLE ITableControl
160 /** hides the cell cursor
162 The method cares for successive calls, that is, for every call to
163 ->hideCursor(), you need one call to ->showCursor. Only if the number
164 of both calls matches, the cursor is really shown.
168 virtual void hideCursor() = 0;
170 /** shows the cell cursor
174 virtual void showCursor() = 0;
176 /** dispatches an action to the table control
179 <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
180 failure conditions include some other instance vetoing the action, or impossibility
181 to execute the action at all (for instance moving up one row when already positioned
182 on the very first row).
184 @see TableControlAction
186 virtual bool dispatchAction( TableControlAction _eAction
) = 0;
188 /** returns selection engine*/
189 virtual SelectionEngine
* getSelEngine() = 0;
191 /** returns the table model
193 The returned model is guaranteed to not be <NULL/>.
195 virtual PTableModel
getModel() const = 0;
197 /// returns the index of the currently active column
198 virtual ColPos
getCurrentColumn() const = 0;
200 /// returns the index of the currently active row
201 virtual RowPos
getCurrentRow() const = 0;
203 /// activates the given cell
204 virtual void activateCell( ColPos
const i_col
, RowPos
const i_row
) = 0;
206 /// retrieves the size of the table window, in pixels
207 virtual ::Size
getTableSizePixel() const = 0;
209 /// sets a new mouse pointer for the table window
210 virtual void setPointer( Pointer
const & i_pointer
) = 0;
212 /// captures the mouse to the table window
213 virtual void captureMouse() = 0;
215 /// releases the mouse, after it had previously been captured
216 virtual void releaseMouse() = 0;
218 /// invalidates the table window
219 virtual void invalidate( TableArea
const i_what
) = 0;
221 /// calculates a width, given in pixels, into a AppFont-based width
222 virtual long pixelWidthToAppFont( long const i_pixels
) const = 0;
224 /// shows a tracking rectangle
225 virtual void showTracking( tools::Rectangle
const & i_location
, ShowTrackFlags
const i_flags
) = 0;
227 /// hides a prviously shown tracking rectangle
228 virtual void hideTracking() = 0;
230 /// does a hit test for the given pixel coordinates
231 virtual TableCell
hitTest( const Point
& rPoint
) const = 0;
233 /// retrieves the metrics for a given column
234 virtual ColumnMetrics
getColumnMetrics( ColPos
const i_column
) const = 0;
236 /// determines whether a given row is selected
237 virtual bool isRowSelected( RowPos _nRow
) const = 0;
239 virtual ~ITableControl() {};
243 } } // namespace svt::table
246 #endif // INCLUDED_SVTOOLS_INC_TABLE_TABLECONTROLINTERFACE_HXX
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */