2 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/accessibility/bridge/bridge-table.h>
22 #include <dali/devel-api/atspi-interfaces/table-cell.h>
24 using namespace Dali::Accessibility;
26 void BridgeTable::RegisterInterfaces()
28 DBus::DBusInterfaceDescription desc{Accessible::GetInterfaceName(AtspiInterface::TABLE)};
30 AddGetPropertyToInterface(desc, "NRows", &BridgeTable::GetRowCount);
31 AddGetPropertyToInterface(desc, "NColumns", &BridgeTable::GetColumnCount);
32 AddGetPropertyToInterface(desc, "NSelectedRows", &BridgeTable::GetSelectedRowCount);
33 AddGetPropertyToInterface(desc, "NSelectedColumns", &BridgeTable::GetSelectedColumnCount);
34 AddGetPropertyToInterface(desc, "Caption", &BridgeTable::GetCaption);
35 AddGetPropertyToInterface(desc, "Summary", &BridgeTable::GetSummary);
36 AddFunctionToInterface(desc, "GetAccessibleAt", &BridgeTable::GetCell);
37 AddFunctionToInterface(desc, "GetIndexAt", &BridgeTable::GetChildIndex);
38 AddFunctionToInterface(desc, "GetRowAtIndex", &BridgeTable::GetRowByChildIndex);
39 AddFunctionToInterface(desc, "GetColumnAtIndex", &BridgeTable::GetColumnByChildIndex);
40 AddFunctionToInterface(desc, "GetRowDescription", &BridgeTable::GetRowDescription);
41 AddFunctionToInterface(desc, "GetColumnDescription", &BridgeTable::GetColumnDescription);
42 AddFunctionToInterface(desc, "GetRowExtentAt", &BridgeTable::GetRowSpan);
43 AddFunctionToInterface(desc, "GetColumnExtentAt", &BridgeTable::GetColumnSpan);
44 AddFunctionToInterface(desc, "GetRowHeader", &BridgeTable::GetRowHeader);
45 AddFunctionToInterface(desc, "GetColumnHeader", &BridgeTable::GetColumnHeader);
46 AddFunctionToInterface(desc, "GetSelectedRows", &BridgeTable::GetSelectedRows);
47 AddFunctionToInterface(desc, "GetSelectedColumns", &BridgeTable::GetSelectedColumns);
48 AddFunctionToInterface(desc, "IsRowSelected", &BridgeTable::IsRowSelected);
49 AddFunctionToInterface(desc, "IsColumnSelected", &BridgeTable::IsColumnSelected);
50 AddFunctionToInterface(desc, "IsSelected", &BridgeTable::IsCellSelected);
51 AddFunctionToInterface(desc, "AddRowSelection", &BridgeTable::AddRowSelection);
52 AddFunctionToInterface(desc, "AddColumnSelection", &BridgeTable::AddColumnSelection);
53 AddFunctionToInterface(desc, "RemoveRowSelection", &BridgeTable::RemoveRowSelection);
54 AddFunctionToInterface(desc, "RemoveColumnSelection", &BridgeTable::RemoveColumnSelection);
55 AddFunctionToInterface(desc, "GetRowColumnExtentsAtIndex", &BridgeTable::GetRowColumnSpan);
57 mDbusServer.addInterface("/", desc, true);
60 Table* BridgeTable::FindSelf() const
62 return FindCurrentObjectWithInterface<AtspiInterface::TABLE>();
65 DBus::ValueOrError<std::int32_t> BridgeTable::GetRowCount()
67 return FindSelf()->GetRowCount();
70 DBus::ValueOrError<std::int32_t> BridgeTable::GetColumnCount()
72 return FindSelf()->GetColumnCount();
75 DBus::ValueOrError<std::int32_t> BridgeTable::GetSelectedRowCount()
77 return FindSelf()->GetSelectedRowCount();
80 DBus::ValueOrError<std::int32_t> BridgeTable::GetSelectedColumnCount()
82 return FindSelf()->GetSelectedColumnCount();
85 DBus::ValueOrError<Accessible*> BridgeTable::GetCaption()
87 return FindSelf()->GetCaption();
90 DBus::ValueOrError<Accessible*> BridgeTable::GetSummary()
92 return FindSelf()->GetSummary();
95 DBus::ValueOrError<Accessible*> BridgeTable::GetCell(std::int32_t row, std::int32_t column)
97 return FindSelf()->GetCell(row, column);
100 DBus::ValueOrError<std::int32_t> BridgeTable::GetChildIndex(std::int32_t row, std::int32_t column)
102 return static_cast<std::int32_t>(FindSelf()->GetChildIndex(row, column));
105 DBus::ValueOrError<std::int32_t> BridgeTable::GetRowByChildIndex(std::int32_t childIndex)
107 return FindSelf()->GetRowByChildIndex(static_cast<std::size_t>(childIndex));
110 DBus::ValueOrError<std::int32_t> BridgeTable::GetColumnByChildIndex(std::int32_t childIndex)
112 return FindSelf()->GetColumnByChildIndex(static_cast<std::size_t>(childIndex));
115 DBus::ValueOrError<std::string> BridgeTable::GetRowDescription(std::int32_t row)
117 return FindSelf()->GetRowDescription(row);
120 DBus::ValueOrError<std::string> BridgeTable::GetColumnDescription(std::int32_t column)
122 return FindSelf()->GetColumnDescription(column);
125 DBus::ValueOrError<std::int32_t> BridgeTable::GetRowSpan(std::int32_t row, std::int32_t column)
127 return FindSelf()->GetRowSpan(row, column);
130 DBus::ValueOrError<std::int32_t> BridgeTable::GetColumnSpan(std::int32_t row, std::int32_t column)
132 return FindSelf()->GetColumnSpan(row, column);
135 DBus::ValueOrError<Accessible*> BridgeTable::GetRowHeader(std::int32_t row)
137 return FindSelf()->GetRowHeader(row);
140 DBus::ValueOrError<Accessible*> BridgeTable::GetColumnHeader(std::int32_t column)
142 return FindSelf()->GetColumnHeader(column);
145 DBus::ValueOrError<std::vector<std::int32_t>> BridgeTable::GetSelectedRows()
147 return FindSelf()->GetSelectedRows();
150 DBus::ValueOrError<std::vector<std::int32_t>> BridgeTable::GetSelectedColumns()
152 return FindSelf()->GetSelectedColumns();
155 DBus::ValueOrError<bool> BridgeTable::IsRowSelected(std::int32_t row)
157 return FindSelf()->IsRowSelected(row);
160 DBus::ValueOrError<bool> BridgeTable::IsColumnSelected(std::int32_t column)
162 return FindSelf()->IsColumnSelected(column);
165 DBus::ValueOrError<bool> BridgeTable::IsCellSelected(std::int32_t row, std::int32_t column)
167 return FindSelf()->IsCellSelected(row, column);
170 DBus::ValueOrError<bool> BridgeTable::AddRowSelection(std::int32_t row)
172 return FindSelf()->AddRowSelection(row);
175 DBus::ValueOrError<bool> BridgeTable::AddColumnSelection(std::int32_t column)
177 return FindSelf()->AddColumnSelection(column);
180 DBus::ValueOrError<bool> BridgeTable::RemoveRowSelection(std::int32_t row)
182 return FindSelf()->RemoveRowSelection(row);
185 DBus::ValueOrError<bool> BridgeTable::RemoveColumnSelection(std::int32_t column)
187 return FindSelf()->RemoveColumnSelection(column);
190 BridgeTable::RowColumnSpanType BridgeTable::GetRowColumnSpan(std::int32_t childIndex)
192 Table::RowColumnSpanType span = FindSelf()->GetRowColumnSpan(static_cast<std::size_t>(childIndex));
194 return {span.success, span.row, span.column, span.rowSpan, span.columnSpan, span.isSelected};