LibreOffice Module toolkit (master) 1
tablecontrolinterface.hxx
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#pragma once
21
22#include <sal/types.h>
23#include <vcl/seleng.hxx>
24#include <vcl/window.hxx>
25
28
29namespace svt::table
30{
31 //= TableControlAction
33 {
68
71 };
72
73
74 //= TableCellArea
75
77 {
80 };
81
82
83 //= TableCell
84
85 struct TableCell
86 {
90
91 TableCell( ColPos const i_column, RowPos const i_row )
92 :nColumn( i_column )
93 ,nRow( i_row )
95 {
96 }
97 };
98
99
100 //= ColumnMetrics
101
103 {
108
121
123 :nStartPixel(0)
124 ,nEndPixel(0)
125 {
126 }
127
128 ColumnMetrics( tools::Long const i_start, tools::Long const i_end )
129 :nStartPixel( i_start )
130 ,nEndPixel( i_end )
131 {
132 }
133 };
134
135
136 //= TableArea
137
138 enum class TableArea
139 {
142 All
143 };
144
145
146 //= ITableControl
147
151 {
152 public:
161 virtual void hideCursor() = 0;
162
167 virtual void showCursor() = 0;
168
179 virtual bool dispatchAction( TableControlAction _eAction ) = 0;
180
183
188 virtual PTableModel getModel() const = 0;
189
191 virtual ColPos getCurrentColumn() const = 0;
192
194 virtual RowPos getCurrentRow() const = 0;
195
197 virtual void activateCell( ColPos const i_col, RowPos const i_row ) = 0;
198
200 virtual ::Size getTableSizePixel() const = 0;
201
203 virtual void setPointer( PointerStyle i_pointer ) = 0;
204
206 virtual void captureMouse() = 0;
207
209 virtual void releaseMouse() = 0;
210
212 virtual void invalidate( TableArea const i_what ) = 0;
213
215 virtual tools::Long pixelWidthToAppFont( tools::Long const i_pixels ) const = 0;
216
218 virtual void showTracking( tools::Rectangle const & i_location, ShowTrackFlags const i_flags ) = 0;
219
221 virtual void hideTracking() = 0;
222
224 virtual TableCell hitTest( const Point& rPoint ) const = 0;
225
227 virtual ColumnMetrics getColumnMetrics( ColPos const i_column ) const = 0;
228
230 virtual bool isRowSelected( RowPos _nRow ) const = 0;
231
232 virtual ~ITableControl() {};
233 };
234
235} // namespace svt::table
236
237/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
defines a callback interface to be implemented by a concrete table control
virtual void showCursor()=0
shows the cell cursor
virtual void activateCell(ColPos const i_col, RowPos const i_row)=0
activates the given cell
virtual ::Size getTableSizePixel() const =0
retrieves the size of the table window, in pixels
virtual void captureMouse()=0
captures the mouse to the table window
virtual PTableModel getModel() const =0
returns the table model
virtual ColPos getCurrentColumn() const =0
returns the index of the currently active column
virtual bool isRowSelected(RowPos _nRow) const =0
determines whether a given row is selected
virtual void hideCursor()=0
hides the cell cursor
virtual void setPointer(PointerStyle i_pointer)=0
sets a new mouse pointer for the table window
virtual void hideTracking()=0
hides a previously shown tracking rectangle
virtual SelectionEngine * getSelEngine()=0
returns selection engine
virtual tools::Long pixelWidthToAppFont(tools::Long const i_pixels) const =0
calculates a width, given in pixels, into an AppFont-based width
virtual RowPos getCurrentRow() const =0
returns the index of the currently active row
virtual void releaseMouse()=0
releases the mouse, after it had previously been captured
virtual void showTracking(tools::Rectangle const &i_location, ShowTrackFlags const i_flags)=0
shows a tracking rectangle
virtual bool dispatchAction(TableControlAction _eAction)=0
dispatches an action to the table control
virtual void invalidate(TableArea const i_what)=0
invalidates the table window
virtual ColumnMetrics getColumnMetrics(ColPos const i_column) const =0
retrieves the metrics for a given column
virtual TableCell hitTest(const Point &rPoint) const =0
does a hit test for the given pixel coordinates
sal_Int32 RowPos
a value denoting a row position within a table
Definition: tabletypes.hxx:34
std::shared_ptr< ITableModel > PTableModel
Definition: tablemodel.hxx:448
sal_Int32 ColPos
a value denoting a column position within a table
Definition: tabletypes.hxx:32
@ cursorToFirstLine
moves the cursor to the first row, keeping the current column
@ cursorToLineStart
moves the cursor to the beginning of the current line
@ cursorLeft
moves the cursor in the table control one column to the left, if possible, by keeping the current row
@ cursorPageDown
moves the cursor one page down, keeping the current column
@ cursorSelectRowUp
selects the rows, above the actual cursor is
@ cursorBottomRight
moves the cursor to the bottom-most, right-most cell
@ cursorDown
moves the cursor in the table control one row down, if possible, by keeping the current column
@ invalidTableControlAction
invalid and final enumeration value, not to be actually used
@ cursorPageUp
moves the cursor one page up, keeping the current column
@ cursorSelectRowDown
selects the row, beneath the actual cursor is
@ cursorUp
moves the cursor in the table control one row up, if possible, by keeping the current column
@ cursorToLineEnd
moves the cursor to the end of the current line
@ cursorSelectRow
selects the row, where the actual cursor is
@ cursorTopLeft
moves the cursor to the top-most, left-most cell
@ cursorSelectRowAreaBottom
selects the row, from the actual cursor till bottom
@ cursorRight
moves the cursor in the table control one column to the right, if possible, by keeping the current ro...
@ cursorSelectRowAreaTop
selects the row, from the actual cursor till top
@ cursorToLastLine
moves the cursor to the last row, keeping the current column
long Long
PointerStyle
tools::Long nEndPixel
the end of the column, in pixels, plus 1.
ColumnMetrics(tools::Long const i_start, tools::Long const i_end)
tools::Long nStartPixel
the start of the column, in pixels.
TableCell(ColPos const i_column, RowPos const i_row)
#define SAL_NO_VTABLE
ShowTrackFlags