LibreOffice Module toolkit (master) 1
tablecontrol.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
24
25#include <vcl/ctrl.hxx>
26#include <vcl/seleng.hxx>
27
28#include <memory>
29
30namespace svt::table
31{
32 class TableControl_Impl;
33
34
35 //= TableControl
36
54 {
55 private:
56 std::shared_ptr<TableControl_Impl> m_pImpl;
57
58
59 public:
60 TableControl( vcl::Window* _pParent, WinBits _nStyle );
61 virtual ~TableControl() override;
62 virtual void dispose() override;
63
65 void SetModel( const PTableModel& _pModel );
67 PTableModel GetModel() const;
68
78 sal_Int32 GetCurrentRow() const override;
79
82
92 sal_Int32 GetCurrentColumn() const override;
93
96 void GoTo( ColPos _nColumnPos, RowPos _nRow);
97
98 virtual void Resize() override;
99 void Select();
100
106
107 // Window overridables
108 virtual void GetFocus() override;
109 virtual void LoseFocus() override;
110 virtual void KeyInput( const KeyEvent& rKEvt ) override;
111 virtual void StateChanged( StateChangedType i_nStateChange ) override;
112
114 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override;
115 virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl( sal_Int32 _nIndex ) override;
116 virtual OUString GetAccessibleObjectName(vcl::table::AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const override;
117 virtual void GoToCell( sal_Int32 _nColumnPos, sal_Int32 _nRow ) override;
118 virtual OUString GetAccessibleObjectDescription(vcl::table::AccessibleTableControlObjType eObjType) const override;
119 virtual void FillAccessibleStateSet( sal_Int64& rStateSet, vcl::table::AccessibleTableControlObjType eObjType ) const override;
120
121 // temporary methods
122 // Those do not really belong into the public API - they're intended for firing A11Y-related events. However,
123 // firing those events should be an implementation internal to the TableControl resp. TableControl_Impl,
124 // instead of something triggered externally.
125 void commitCellEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
126 void commitTableEventIfAccessibleAlive( sal_Int16 const i_eventID, const css::uno::Any& i_newValue, const css::uno::Any& i_oldValue );
127
128
129 // IAccessibleTable
130 virtual tools::Rectangle GetWindowExtentsAbsolute() const override;
131 virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window& rRelativeWindow) const override;
132 virtual void GrabFocus() override;
133 virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override;
134 virtual vcl::Window* GetAccessibleParentWindow() const override;
135 virtual vcl::Window* GetWindowInstance() override;
136 virtual sal_Int32 GetAccessibleControlCount() const override;
137 virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override;
138 virtual sal_Int32 GetRowCount() const override;
139 virtual sal_Int32 GetColumnCount() const override;
140 virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ) override;
141 virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar ) override;
142 virtual tools::Rectangle calcHeaderCellRect( bool _bIsColumnBar, sal_Int32 nPos) override;
143 virtual tools::Rectangle calcTableRect() override;
144 virtual tools::Rectangle calcCellRect( sal_Int32 _nRowPos, sal_Int32 _nColPos ) override;
145 virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex) override;
146 virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint) override;
147 virtual void FillAccessibleStateSetForCell( sal_Int64& _rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const override;
148 virtual OUString GetRowName(sal_Int32 _nIndex) const override;
149 virtual OUString GetColumnName( sal_Int32 _nIndex ) const override;
150 virtual bool HasRowHeader() override;
151 virtual bool HasColHeader() override;
152 virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const override;
153
154 virtual sal_Int32 GetSelectedRowCount() const override;
155 virtual sal_Int32 GetSelectedRowIndex( sal_Int32 const i_selectionIndex ) const override;
156 virtual bool IsRowSelected( sal_Int32 const i_rowIndex ) const override;
157 virtual void SelectRow( sal_Int32 const i_rowIndex, bool const i_select ) override;
158 virtual void SelectAllRows( bool const i_select ) override;
159
160
161 private:
162 DECL_LINK( ImplSelectHdl, LinkParamNone*, void );
163
164 private:
165 TableControl( const TableControl& ) = delete;
167 };
168
169
170} // namespace svt::table
171
172
173
174/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
defines a callback interface to be implemented by a concrete table control
a basic control which manages table-like data, i.e.
void SetModel(const PTableModel &_pModel)
sets a new table model
virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow, sal_Int32 _nColumnPos, const Point &_rPoint) override
virtual sal_Int32 GetSelectedRowCount() const override
virtual OUString GetAccessibleObjectName(vcl::table::AccessibleTableControlObjType eObjType, sal_Int32 _nRow, sal_Int32 _nCol) const override
virtual bool HasColHeader() override
virtual sal_Int32 GetAccessibleControlCount() const override
virtual vcl::Window * GetAccessibleParentWindow() const override
sal_Int32 GetCurrentRow() const override
retrieves the current row
virtual void SelectAllRows(bool const i_select) override
sal_Int32 GetCurrentColumn() const override
retrieves the current column
virtual bool HasRowHeader() override
virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar) override
virtual css::uno::Reference< css::accessibility::XAccessible > GetAccessible() override
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessibleControl(sal_Int32 _nIndex) override
virtual bool IsRowSelected(sal_Int32 const i_rowIndex) const override
virtual tools::Rectangle calcHeaderCellRect(bool _bIsColumnBar, sal_Int32 nPos) override
virtual tools::Rectangle calcCellRect(sal_Int32 _nRowPos, sal_Int32 _nColPos) override
TableControl & operator=(const TableControl &)=delete
virtual void FillAccessibleStateSet(sal_Int64 &rStateSet, vcl::table::AccessibleTableControlObjType eObjType) const override
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Creates and returns the accessible object of the whole GridControl.
virtual sal_Int32 GetColumnCount() const override
virtual OUString GetAccessibleObjectDescription(vcl::table::AccessibleTableControlObjType eObjType) const override
virtual sal_Int32 GetSelectedRowIndex(sal_Int32 const i_selectionIndex) const override
virtual sal_Int32 GetRowCount() const override
virtual OUString GetRowName(sal_Int32 _nIndex) const override
virtual void GoToCell(sal_Int32 _nColumnPos, sal_Int32 _nRow) override
virtual void FillAccessibleStateSetForCell(sal_Int64 &_rStateSet, sal_Int32 _nRow, sal_uInt16 _nColumnPos) const override
virtual vcl::Window * GetWindowInstance() override
virtual tools::Rectangle GetWindowExtentsAbsolute() const override
virtual void SelectRow(sal_Int32 const i_rowIndex, bool const i_select) override
virtual tools::Rectangle GetFieldCharacterBounds(sal_Int32 _nRow, sal_Int32 _nColumnPos, sal_Int32 nIndex) override
virtual void LoseFocus() override
PTableModel GetModel() const
retrieves the current table model
virtual void KeyInput(const KeyEvent &rKEvt) override
virtual tools::Rectangle calcTableRect() override
virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const override
virtual bool ConvertPointToControlIndex(sal_Int32 &_rnIndex, const Point &_rPoint) override
ITableControl & getTableControlInterface()
TableControl(const TableControl &)=delete
virtual OUString GetAccessibleCellText(sal_Int32 _nRowPos, sal_Int32 _nColPos) const override
SelectionEngine * getSelEngine()
after removing a row, updates the vector which contains the selected rows if the row,...
vcl::Window & getDataWindow()
virtual ~TableControl() override
void GoTo(ColPos _nColumnPos, RowPos _nRow)
activates the cell at the given position
void commitTableEventIfAccessibleAlive(sal_Int16 const i_eventID, const css::uno::Any &i_newValue, const css::uno::Any &i_oldValue)
DECL_LINK(ImplSelectHdl, LinkParamNone *, void)
virtual void Resize() override
virtual void GetFocus() override
virtual void dispose() override
virtual void GrabFocus() override
std::shared_ptr< TableControl_Impl > m_pImpl
void commitCellEventIfAccessibleAlive(sal_Int16 const i_eventID, const css::uno::Any &i_newValue, const css::uno::Any &i_oldValue)
virtual void StateChanged(StateChangedType i_nStateChange) override
virtual OUString GetColumnName(sal_Int32 _nIndex) const override
TableControl(vcl::Window *_pParent, WinBits _nStyle)
virtual bool ConvertPointToCellAddress(sal_Int32 &_rnRow, sal_Int32 &_rnColPos, const Point &_rPoint) override
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
AccessibleTableControlObjType
StateChangedType
sal_Int64 WinBits