no bug - Correct some typos in the comments. a=typo-fix
[gecko.git] / accessible / basetypes / TableAccessible.h
blobfe5b499f754f51a8f2ae682ba53e4f05810bbcb6
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
10 #include "nsString.h"
11 #include "nsTArray.h"
13 namespace mozilla {
14 namespace a11y {
16 class Accessible;
18 /**
19 * Accessible table interface.
21 class TableAccessible {
22 public:
23 /**
24 * Return the caption accessible if any for this table.
26 virtual Accessible* Caption() const { return nullptr; }
28 /**
29 * Get the summary for this table.
31 virtual void Summary(nsString& aSummary) { aSummary.Truncate(); }
33 /**
34 * Return the number of columns in the table.
36 virtual uint32_t ColCount() const { return 0; }
38 /**
39 * Return the number of rows in the table.
41 virtual uint32_t RowCount() { return 0; }
43 /**
44 * Return the accessible for the cell at the given row and column indices.
46 virtual Accessible* CellAt(uint32_t aRowIdx, uint32_t aColIdx) {
47 return nullptr;
50 /**
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; }
55 /**
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
58 * passed in.
60 virtual int32_t ColIndexAt(uint32_t aCellIdx) { return -1; }
62 /**
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
65 * passed in.
67 virtual int32_t RowIndexAt(uint32_t aCellIdx) { return -1; }
69 /**
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,
75 int32_t* aColIdx) {
76 *aRowIdx = -1;
77 *aColIdx = -1;
80 /**
81 * Return the number of columns occupied by the cell at the given row and
82 * column indices.
84 virtual uint32_t ColExtentAt(uint32_t aRowIdx, uint32_t aColIdx) { return 1; }
86 /**
87 * Return the number of rows occupied by the cell at the given row and column
88 * indices.
90 virtual uint32_t RowExtentAt(uint32_t aRowIdx, uint32_t aColIdx) { return 1; }
92 /**
93 * Get the description of the given column.
95 virtual void ColDescription(uint32_t aColIdx, nsString& aDescription) {
96 aDescription.Truncate();
99 /**
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) {
120 return false;
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;
169 } // namespace a11y
170 } // namespace mozilla
172 #endif