1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef TABLE_ACCESSIBLE_H
8 #define TABLE_ACCESSIBLE_H
19 * Accessible table interface.
21 class TableAccessible
{
24 * Return the caption accessible if any for this table.
26 virtual Accessible
* Caption() const { return nullptr; }
29 * Get the summary for this table.
31 virtual void Summary(nsString
& aSummary
) { aSummary
.Truncate(); }
34 * Return the number of columns in the table.
36 virtual uint32_t ColCount() const { return 0; }
39 * Return the number of rows in the table.
41 virtual uint32_t RowCount() { return 0; }
44 * Return the accessible for the cell at the given row and column indices.
46 virtual Accessible
* CellAt(uint32_t aRowIdx
, uint32_t aColIdx
) {
51 * Return the index of the cell at the given row and column.
53 virtual int32_t CellIndexAt(uint32_t aRowIdx
, uint32_t aColIdx
) { return -1; }
56 * Return the column index of the cell with the given index.
57 * This returns -1 if the column count is 0 or an invalid index is being
60 virtual int32_t ColIndexAt(uint32_t aCellIdx
) { return -1; }
63 * Return the row index of the cell with the given index.
64 * This returns -1 if the column count is 0 or an invalid index is being
67 virtual int32_t RowIndexAt(uint32_t aCellIdx
) { return -1; }
70 * Get the row and column indices for the cell at the given index.
71 * This returns -1 for both output parameters if the column count is 0 or an
72 * invalid index is being passed in.
74 virtual void RowAndColIndicesAt(uint32_t aCellIdx
, int32_t* aRowIdx
,
81 * Return the number of columns occupied by the cell at the given row and
84 virtual uint32_t ColExtentAt(uint32_t aRowIdx
, uint32_t aColIdx
) { return 1; }
87 * Return the number of rows occupied by the cell at the given row and column
90 virtual uint32_t RowExtentAt(uint32_t aRowIdx
, uint32_t aColIdx
) { return 1; }
93 * Get the description of the given column.
95 virtual void ColDescription(uint32_t aColIdx
, nsString
& aDescription
) {
96 aDescription
.Truncate();
100 * Get the description for the given row.
102 virtual void RowDescription(uint32_t aRowIdx
, nsString
& aDescription
) {
103 aDescription
.Truncate();
107 * Return true if the given column is selected.
109 virtual bool IsColSelected(uint32_t aColIdx
) { return false; }
112 * Return true if the given row is selected.
114 virtual bool IsRowSelected(uint32_t aRowIdx
) { return false; }
117 * Return true if the given cell is selected.
119 virtual bool IsCellSelected(uint32_t aRowIdx
, uint32_t aColIdx
) {
124 * Return the number of selected cells.
126 virtual uint32_t SelectedCellCount() { return 0; }
129 * Return the number of selected columns.
131 virtual uint32_t SelectedColCount() { return 0; }
134 * Return the number of selected rows.
136 virtual uint32_t SelectedRowCount() { return 0; }
139 * Get the set of selected cells.
141 virtual void SelectedCells(nsTArray
<Accessible
*>* aCells
) {}
144 * Get the set of selected cell indices.
146 virtual void SelectedCellIndices(nsTArray
<uint32_t>* aCells
) {}
149 * Get the set of selected column indices.
151 virtual void SelectedColIndices(nsTArray
<uint32_t>* aCols
) {}
154 * Get the set of selected row indices.
156 virtual void SelectedRowIndices(nsTArray
<uint32_t>* aRows
) {}
159 * Return true if the table is probably for layout.
161 virtual bool IsProbablyLayoutTable() { return false; }
164 * Convert the table to an Accessible*.
166 virtual Accessible
* AsAccessible() = 0;
170 } // namespace mozilla