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 <sal/types.h>
23 #include <vcl/seleng.hxx>
24 #include <vcl/window.hxx>
26 #include <controls/table/tabletypes.hxx>
27 #include <controls/table/tablemodel.hxx>
31 //= TableControlAction
32 enum TableControlAction
34 /// moves the cursor in the table control one row up, if possible, by keeping the current column
36 /// moves the cursor in the table control one row down, if possible, by keeping the current column
38 /// moves the cursor in the table control one column to the left, if possible, by keeping the current row
40 /// moves the cursor in the table control one column to the right, if possible, by keeping the current row
42 /// moves the cursor to the beginning of the current line
44 /// moves the cursor to the end of the current line
46 /// moves the cursor to the first row, keeping the current column
48 /// moves the cursor to the last row, keeping the current column
50 /// moves the cursor one page up, keeping the current column
52 /// moves the cursor one page down, keeping the current column
54 /// moves the cursor to the top-most, left-most cell
56 /// moves the cursor to the bottom-most, right-most cell
58 /// selects the row, where the actual cursor is
60 /// selects the rows, above the actual cursor is
62 /// selects the row, beneath the actual cursor is
64 /// selects the row, from the actual cursor till top
65 cursorSelectRowAreaTop
,
66 /// selects the row, from the actual cursor till bottom
67 cursorSelectRowAreaBottom
,
69 /// invalid and final enumeration value, not to be actually used
70 invalidTableControlAction
91 TableCell( ColPos
const i_column
, RowPos
const i_row
)
104 /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible
105 area. Note: see below.
107 tools::Long nStartPixel
;
109 /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of all columns
110 up to the current one.
112 Huh? Earlier you said that the nStartPixel of columns
113 scrolled out (to the left) of the visible area is
114 negative. Also, where is the promise that there is no gap
115 between columns? The above claim would be true only if the
116 first column always started at zero, and there is never a
117 gap. So these doc comments are inconsistent. How
120 tools::Long nEndPixel
;
128 ColumnMetrics( tools::Long
const i_start
, tools::Long
const i_end
)
129 :nStartPixel( i_start
)
148 /** defines a callback interface to be implemented by a concrete table control
150 class SAL_NO_VTABLE ITableControl
153 /** hides the cell cursor
155 The method cares for successive calls, that is, for every call to
156 ->hideCursor(), you need one call to ->showCursor. Only if the number
157 of both calls matches, the cursor is really shown.
161 virtual void hideCursor() = 0;
163 /** shows the cell cursor
167 virtual void showCursor() = 0;
169 /** dispatches an action to the table control
172 <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
173 failure conditions include some other instance vetoing the action, or impossibility
174 to execute the action at all (for instance moving up one row when already positioned
175 on the very first row).
177 @see TableControlAction
179 virtual bool dispatchAction( TableControlAction _eAction
) = 0;
181 /** returns selection engine*/
182 virtual SelectionEngine
* getSelEngine() = 0;
184 /** returns the table model
186 The returned model is guaranteed to not be <NULL/>.
188 virtual PTableModel
getModel() const = 0;
190 /// returns the index of the currently active column
191 virtual ColPos
getCurrentColumn() const = 0;
193 /// returns the index of the currently active row
194 virtual RowPos
getCurrentRow() const = 0;
196 /// activates the given cell
197 virtual void activateCell( ColPos
const i_col
, RowPos
const i_row
) = 0;
199 /// retrieves the size of the table window, in pixels
200 virtual ::Size
getTableSizePixel() const = 0;
202 /// sets a new mouse pointer for the table window
203 virtual void setPointer( PointerStyle i_pointer
) = 0;
205 /// captures the mouse to the table window
206 virtual void captureMouse() = 0;
208 /// releases the mouse, after it had previously been captured
209 virtual void releaseMouse() = 0;
211 /// invalidates the table window
212 virtual void invalidate( TableArea
const i_what
) = 0;
214 /// calculates a width, given in pixels, into an AppFont-based width
215 virtual tools::Long
pixelWidthToAppFont( tools::Long
const i_pixels
) const = 0;
217 /// shows a tracking rectangle
218 virtual void showTracking( tools::Rectangle
const & i_location
, ShowTrackFlags
const i_flags
) = 0;
220 /// hides a previously shown tracking rectangle
221 virtual void hideTracking() = 0;
223 /// does a hit test for the given pixel coordinates
224 virtual TableCell
hitTest( const Point
& rPoint
) const = 0;
226 /// retrieves the metrics for a given column
227 virtual ColumnMetrics
getColumnMetrics( ColPos
const i_column
) const = 0;
229 /// determines whether a given row is selected
230 virtual bool isRowSelected( RowPos _nRow
) const = 0;
232 virtual ~ITableControl() {};
235 } // namespace svt::table
237 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */