From 2c9f8bedeebfe3d823709f7210ec79f19f3b4253 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Artur=20=C5=9Awigo=C5=84?= Date: Tue, 6 Sep 2022 11:40:58 +0200 Subject: [PATCH] [Tizen][AT-SPI] Add Table and TableCell interfaces The purpose of these interfaces is to support Screen Reader operation with tables and grids, often in combination with the Selection interface, for example reading the row and column number when navigating a grid of items, or selecting cells / rows / columns, as specified in the UX guide. Change-Id: If61844b73421b76661d3966c8e7caba6c9202c8f --- dali/devel-api/adaptor-framework/accessibility.cpp | 4 + dali/devel-api/atspi-interfaces/table-cell.h | 118 +++++++ dali/devel-api/atspi-interfaces/table.h | 340 +++++++++++++++++++++ dali/devel-api/file.list | 2 + dali/internal/accessibility/bridge/bridge-impl.cpp | 8 +- .../accessibility/bridge/bridge-table-cell.cpp | 71 +++++ .../accessibility/bridge/bridge-table-cell.h | 72 +++++ .../internal/accessibility/bridge/bridge-table.cpp | 195 ++++++++++++ dali/internal/accessibility/bridge/bridge-table.h | 186 +++++++++++ dali/internal/accessibility/file.list | 2 + 10 files changed, 997 insertions(+), 1 deletion(-) create mode 100644 dali/devel-api/atspi-interfaces/table-cell.h create mode 100644 dali/devel-api/atspi-interfaces/table.h create mode 100644 dali/internal/accessibility/bridge/bridge-table-cell.cpp create mode 100644 dali/internal/accessibility/bridge/bridge-table-cell.h create mode 100644 dali/internal/accessibility/bridge/bridge-table.cpp create mode 100644 dali/internal/accessibility/bridge/bridge-table.h diff --git a/dali/devel-api/adaptor-framework/accessibility.cpp b/dali/devel-api/adaptor-framework/accessibility.cpp index 3d143bf..915da51 100644 --- a/dali/devel-api/adaptor-framework/accessibility.cpp +++ b/dali/devel-api/adaptor-framework/accessibility.cpp @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include #include @@ -241,6 +243,8 @@ AtspiInterfaces Accessible::DoGetInterfaces() const interfaces[AtspiInterface::HYPERTEXT] = dynamic_cast(this); interfaces[AtspiInterface::SELECTION] = dynamic_cast(this); interfaces[AtspiInterface::SOCKET] = dynamic_cast(this); + interfaces[AtspiInterface::TABLE] = dynamic_cast(this); + interfaces[AtspiInterface::TABLE_CELL] = dynamic_cast(this); interfaces[AtspiInterface::TEXT] = dynamic_cast(this); interfaces[AtspiInterface::VALUE] = dynamic_cast(this); diff --git a/dali/devel-api/atspi-interfaces/table-cell.h b/dali/devel-api/atspi-interfaces/table-cell.h new file mode 100644 index 0000000..81ae310 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/table-cell.h @@ -0,0 +1,118 @@ +#ifndef DALI_ADAPTOR_ATSPI_TABLE_CELL_H +#define DALI_ADAPTOR_ATSPI_TABLE_CELL_H + +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +class Table; + +/** + * @brief Interface representing a table cell. + * + * @see Dali::Accessibility::Table + */ +class DALI_ADAPTOR_API TableCell : public virtual Accessible +{ +public: + /** + * @brief Cell information type. + * + * @see TableCell:GetCellRowColumnSpan() + */ + struct RowColumnSpanType + { + int row; ///< Row index + int column; ///< Column index + int rowSpan; ///< Row span + int columnSpan; ///< Column span + }; + + /** + * @brief Returns the table this cell belongs to. + * + * @return The table + */ + virtual Table* GetTable() const = 0; + + /** + * @brief Returns the position of this cell in the table. + * + * @return A pair of integers (row index, column index) + */ + virtual std::pair GetCellPosition() const = 0; + + /** + * @brief Returns the number of rows occupied by this cell. + * + * @return Number of rows + */ + virtual int GetCellRowSpan() const = 0; + + /** + * @brief Returns the number of columns occupied by this cell. + * + * @return Number of columns + */ + virtual int GetCellColumnSpan() const = 0; + + /** + * @brief Returns the position, row span, and column span of this cell. + * + * @return Cell information + * + * @see TableCell::RowColumnSpanType + * @see TableCell::GetCellPosition() + * @see TableCell::GetCellRowSpan() + * @see TableCell::GetCellColumnSpan() + */ + virtual RowColumnSpanType GetCellRowColumnSpan() const = 0; + + /** + * @brief Downcasts an Accessible to a TableCell. + * + * @param obj The Accessible + * @return A Table or null + * + * @see Dali::Accessibility::Accessible::DownCast() + */ + static inline TableCell* DownCast(Accessible* obj); +}; + +namespace Internal +{ +template<> +struct AtspiInterfaceTypeHelper +{ + using Type = TableCell; +}; +} // namespace Internal + +inline TableCell* TableCell::DownCast(Accessible* obj) +{ + return Accessible::DownCast(obj); +} + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_TABLE_CELL_H diff --git a/dali/devel-api/atspi-interfaces/table.h b/dali/devel-api/atspi-interfaces/table.h new file mode 100644 index 0000000..f90f304 --- /dev/null +++ b/dali/devel-api/atspi-interfaces/table.h @@ -0,0 +1,340 @@ +#ifndef DALI_ADAPTOR_ATSPI_TABLE_H +#define DALI_ADAPTOR_ATSPI_TABLE_H + +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// EXTERNAL INCLUDES +#include +#include + +// INTERNAL INCLUDES +#include + +namespace Dali::Accessibility +{ +class TableCell; + +/** + * @brief Interface representing a table. + * + * The selection methods extend the Selection interface, + * so both should be implemented by table and grid controls. + * + * @see Dali::Accessibility::Selection + * @see Dali::Accessibility::TableCell + */ +class DALI_ADAPTOR_API Table : public virtual Accessible +{ +public: + /** + * @brief Cell information type. + * + * @see Table:GetRowColumnSpan() + */ + struct RowColumnSpanType + { + int row; ///< Row index + int column; ///< Column index + int rowSpan; ///< Row span + int columnSpan; ///< Column span + bool isSelected; ///< Whether the cell is selected + bool success; ///< Whether other fields are meaningful + }; + + /** + * @brief Gets the number of rows. + * + * @return Number of rows + */ + virtual int GetRowCount() const = 0; + + /** + * @brief Gets the number of columns. + * + * @return Number of columns + */ + virtual int GetColumnCount() const = 0; + + /** + * @brief Gets the number of selected rows. + * + * @return Number of selected rows + * + * @see Table::GetSelectedRows() + */ + virtual int GetSelectedRowCount() const = 0; + + /** + * @brief Gets the number of selected columns. + * + * @return Number of selected columns + * + * @see Table::GetSelectedColumns() + */ + virtual int GetSelectedColumnCount() const = 0; + + /** + * @brief Gets the table's caption. + * + * @return The caption or null + */ + virtual Accessible* GetCaption() const = 0; + + /** + * @brief Gets the table's summary. + * + * @return The summary or null + */ + virtual Accessible* GetSummary() const = 0; + + /** + * @brief Gets the cell at the specified position + * + * @param[in] row Row number + * @param[in] column Column number + * + * @return The cell or null + */ + virtual TableCell* GetCell(int row, int column) const = 0; + + /** + * @brief Gets the one-dimensional index of a cell + * + * The returned index should be such that: + * @code GetChildAtIndex(GetChildIndex(row, column)) == GetCell(row, column) @endcode + * + * @param[in] row Row number + * @param[in] column Column number + * + * @return The one-dimensional index + * + * @see Dali::Accessibility::Accessible::GetChildAtIndex() + * @see Table::GetCell() + */ + virtual std::size_t GetChildIndex(int row, int column) const = 0; + + /** + * @brief Gets the row number of a cell + * + * @param[in] childIndex One-dimensional index of the cell + * + * @return The row number of the cell + * + * @see Table::GetChildIndex() + */ + virtual int GetRowByChildIndex(std::size_t childIndex) const = 0; + + /** + * @brief Gets the column number of a cell + * + * @param[in] childIndex One-dimensional index of the cell + * + * @return The column number of the cell + * + * @see Table::GetChildIndex() + */ + virtual int GetColumnByChildIndex(std::size_t childIndex) const = 0; + + /** + * @brief Gets the description of a row. + * + * @param[in] row Row number + * + * @return The description of the row + */ + virtual std::string GetRowDescription(int row) const = 0; + + /** + * @brief Gets the description of a column. + * + * @param[in] column Column number + * + * @return The description of the column + */ + virtual std::string GetColumnDescription(int column) const = 0; + + /** + * @brief Gets the row span of a cell + * + * The return value should be such that: + * @code GetRowSpan(row, column) == GetCell(row, column)->GetCellRowSpan() @endcode + * + * @param[in] row Row number + * @param[in] column Column number + * + * @return The row span of the cell + * + * @see Table::GetCell() + * @see Dali::Accessibility::TableCell::GetCellRowSpan() + */ + virtual int GetRowSpan(int row, int column) const = 0; + + /** + * @brief Gets the column span of a cell + * + * The return value should be such that: + * @code GetColumnSpan(row, column) == GetCell(row, column)->GetCellColumnSpan() @endcode + * + * @param[in] row Row number + * @param[in] column Column number + * + * @return The column span of the cell + * + * @see Table::GetCell() + * @see Dali::Accessibility::TableCell::GetCellColumnSpan() + */ + virtual int GetColumnSpan(int row, int column) const = 0; + + /** + * @brief Gets the header of a row. + * + * @param[in] row Row number + * + * @return The row header or null + */ + virtual Accessible* GetRowHeader(int row) const = 0; + + /** + * @brief Gets the header of a column. + * + * @param[in] column Column number + * + * @return The column header or null + */ + virtual Accessible* GetColumnHeader(int column) const = 0; + + /** + * @brief Gets all selected rows' numbers. + * + * @return Selected rows' numbers + * + * @see Table::GetSelectedRowCount() + */ + virtual std::vector GetSelectedRows() const = 0; + + /** + * @brief Gets all selected columns' numbers. + * + * @return Selected columns' numbers + * + * @see Table::GetSelectedColumnCount() + */ + virtual std::vector GetSelectedColumns() const = 0; + + /** + * @brief Checks if a row is selected. + * + * @param[in] row Row number + * + * @return True if the row is selected, false otherwise + */ + virtual bool IsRowSelected(int row) const = 0; + + /** + * @brief Checks if a column is selected. + * + * @param[in] column Column number + * + * @return True if the column is selected, false otherwise + */ + virtual bool IsColumnSelected(int column) const = 0; + + /** + * @brief Checks if a cell is selected. + * + * @param[in] row Row number of the cell + * @param[in] column Column number of the cell + * + * @return True if the cell is selected, false otherwise + */ + virtual bool IsCellSelected(int row, int column) const = 0; + + /** + * @brief Selects a row. + * + * @param[in] row Row number + * + * @return True on success, false otherwise + */ + virtual bool AddRowSelection(int row) = 0; + + /** + * @brief Selects a column. + * + * @param[in] column Column number + * + * @return True on success, false otherwise + */ + virtual bool AddColumnSelection(int column) = 0; + + /** + * @brief Unselects a row. + * + * @param[in] row Row number + * + * @return True on success, false otherwise + */ + virtual bool RemoveRowSelection(int row) = 0; + + /** + * @brief Unselects a column. + * + * @param[in] column Column number + * + * @return True on success, false otherwise + */ + virtual bool RemoveColumnSelection(int column) = 0; + + /** + * @brief Returns position and span information about a cell. + * + * @param[in] childIndex One-dimensional index of the cell + * + * @return The 'status' field of the returned structure is true on success, false otherwise + * + * @see Table::RowColumnSpanType + */ + virtual RowColumnSpanType GetRowColumnSpan(std::size_t childIndex) const = 0; + + /** + * @brief Downcasts an Accessible to a Table. + * + * @param obj The Accessible + * @return A Table or null + * + * @see Dali::Accessibility::Accessible::DownCast() + */ + static inline Table* DownCast(Accessible* obj); +}; + +namespace Internal +{ +template<> +struct AtspiInterfaceTypeHelper +{ + using Type = Table; +}; +} // namespace Internal + +inline Table* Table::DownCast(Accessible* obj) +{ + return Accessible::DownCast(obj); +} + +} // namespace Dali::Accessibility + +#endif // DALI_ADAPTOR_ATSPI_TABLE_H diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index 30fb9c1..b446749 100755 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -162,6 +162,8 @@ SET( devel_api_atspi_interfaces_header_files ${adaptor_devel_api_dir}/atspi-interfaces/hypertext.h ${adaptor_devel_api_dir}/atspi-interfaces/selection.h ${adaptor_devel_api_dir}/atspi-interfaces/socket.h + ${adaptor_devel_api_dir}/atspi-interfaces/table.h + ${adaptor_devel_api_dir}/atspi-interfaces/table-cell.h ${adaptor_devel_api_dir}/atspi-interfaces/text.h ${adaptor_devel_api_dir}/atspi-interfaces/value.h ) diff --git a/dali/internal/accessibility/bridge/bridge-impl.cpp b/dali/internal/accessibility/bridge/bridge-impl.cpp index a7b68d2..2036741 100644 --- a/dali/internal/accessibility/bridge/bridge-impl.cpp +++ b/dali/internal/accessibility/bridge/bridge-impl.cpp @@ -38,6 +38,8 @@ #include #include #include +#include +#include #include #include #include @@ -71,7 +73,9 @@ class BridgeImpl : public virtual BridgeBase, public BridgeApplication, public BridgeHypertext, public BridgeHyperlink, - public BridgeSocket + public BridgeSocket, + public BridgeTable, + public BridgeTableCell { DBus::DBusClient mAccessibilityStatusClient; DBus::DBusClient mRegistryClient; @@ -331,6 +335,8 @@ public: BridgeHypertext::RegisterInterfaces(); BridgeHyperlink::RegisterInterfaces(); BridgeSocket::RegisterInterfaces(); + BridgeTable::RegisterInterfaces(); + BridgeTableCell::RegisterInterfaces(); RegisterOnBridge(&mApplication); diff --git a/dali/internal/accessibility/bridge/bridge-table-cell.cpp b/dali/internal/accessibility/bridge/bridge-table-cell.cpp new file mode 100644 index 0000000..b4680f8 --- /dev/null +++ b/dali/internal/accessibility/bridge/bridge-table-cell.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// INTERNAL INCLUDES +#include + +using namespace Dali::Accessibility; + +void BridgeTableCell::RegisterInterfaces() +{ + DBus::DBusInterfaceDescription desc{Accessible::GetInterfaceName(AtspiInterface::TABLE_CELL)}; + + AddGetPropertyToInterface(desc, "Table", &BridgeTableCell::GetTable); + AddGetPropertyToInterface(desc, "Position", &BridgeTableCell::GetCellPosition); + AddGetPropertyToInterface(desc, "RowSpan", &BridgeTableCell::GetCellRowSpan); + AddGetPropertyToInterface(desc, "ColumnSpan", &BridgeTableCell::GetCellColumnSpan); + AddFunctionToInterface(desc, "GetRowColumnSpan", &BridgeTableCell::GetCellRowColumnSpan); + + mDbusServer.addInterface("/", desc, true); +} + +TableCell* BridgeTableCell::FindSelf() const +{ + return FindCurrentObjectWithInterface(); +} + +DBus::ValueOrError BridgeTableCell::GetTable() +{ + return FindSelf()->GetTable(); +} + +DBus::ValueOrError BridgeTableCell::GetCellPosition() +{ + std::pair position = FindSelf()->GetCellPosition(); + + return {position.first, position.second}; +} + +DBus::ValueOrError BridgeTableCell::GetCellRowSpan() +{ + return FindSelf()->GetCellRowSpan(); +} + +DBus::ValueOrError BridgeTableCell::GetCellColumnSpan() +{ + return FindSelf()->GetCellColumnSpan(); +} + +DBus::ValueOrError BridgeTableCell::GetCellRowColumnSpan() +{ + TableCell::RowColumnSpanType span = FindSelf()->GetCellRowColumnSpan(); + + return {span.row, span.column, span.rowSpan, span.columnSpan}; +} diff --git a/dali/internal/accessibility/bridge/bridge-table-cell.h b/dali/internal/accessibility/bridge/bridge-table-cell.h new file mode 100644 index 0000000..e8a7b61 --- /dev/null +++ b/dali/internal/accessibility/bridge/bridge-table-cell.h @@ -0,0 +1,72 @@ +#ifndef DALI_INTERNAL_ACCESSIBILITY_BRIDGE_TABLE_CELL_H +#define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_TABLE_CELL_H + +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include +#include + +/** + * @brief The BridgeTableCell class contains glue code for Accessibility::TableCell. + */ +class BridgeTableCell : public virtual BridgeBase +{ +protected: + BridgeTableCell() = default; + + /** + * @brief Registers TableCell methods as a DBus interface. + */ + void RegisterInterfaces(); + + /** + * @brief Returns the TableCell object of the currently executed DBus method call. + * + * @return The TableCell object + */ + Dali::Accessibility::TableCell* FindSelf() const; + +public: + /** + * @copydoc Dali::Accessibility::TableCell::GetTable() + */ + DBus::ValueOrError GetTable(); + + /** + * @copydoc Dali::Accessibility::TableCell::GetCellPosition() + */ + DBus::ValueOrError GetCellPosition(); + + /** + * @copydoc Dali::Accessibility::TableCell::GetCellRowSpan() + */ + DBus::ValueOrError GetCellRowSpan(); + + /** + * @copydoc Dali::Accessibility::TableCell::GetCellColumnSpan() + */ + DBus::ValueOrError GetCellColumnSpan(); + + /** + * @copydoc Dali::Accessibility::TableCell::GetCellRowColumnSpan() + */ + DBus::ValueOrError GetCellRowColumnSpan(); +}; + +#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_TABLE_CELL_H diff --git a/dali/internal/accessibility/bridge/bridge-table.cpp b/dali/internal/accessibility/bridge/bridge-table.cpp new file mode 100644 index 0000000..81ec834 --- /dev/null +++ b/dali/internal/accessibility/bridge/bridge-table.cpp @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// CLASS HEADER +#include + +// INTERNAL INCLUDES +#include + +using namespace Dali::Accessibility; + +void BridgeTable::RegisterInterfaces() +{ + DBus::DBusInterfaceDescription desc{Accessible::GetInterfaceName(AtspiInterface::TABLE)}; + + AddGetPropertyToInterface(desc, "NRows", &BridgeTable::GetRowCount); + AddGetPropertyToInterface(desc, "NColumns", &BridgeTable::GetColumnCount); + AddGetPropertyToInterface(desc, "NSelectedRows", &BridgeTable::GetSelectedRowCount); + AddGetPropertyToInterface(desc, "NSelectedColumns", &BridgeTable::GetSelectedColumnCount); + AddGetPropertyToInterface(desc, "Caption", &BridgeTable::GetCaption); + AddGetPropertyToInterface(desc, "Summary", &BridgeTable::GetSummary); + AddFunctionToInterface(desc, "GetAccessibleAt", &BridgeTable::GetCell); + AddFunctionToInterface(desc, "GetIndexAt", &BridgeTable::GetChildIndex); + AddFunctionToInterface(desc, "GetRowAtIndex", &BridgeTable::GetRowByChildIndex); + AddFunctionToInterface(desc, "GetColumnAtIndex", &BridgeTable::GetColumnByChildIndex); + AddFunctionToInterface(desc, "GetRowDescription", &BridgeTable::GetRowDescription); + AddFunctionToInterface(desc, "GetColumnDescription", &BridgeTable::GetColumnDescription); + AddFunctionToInterface(desc, "GetRowExtentAt", &BridgeTable::GetRowSpan); + AddFunctionToInterface(desc, "GetColumnExtentAt", &BridgeTable::GetColumnSpan); + AddFunctionToInterface(desc, "GetRowHeader", &BridgeTable::GetRowHeader); + AddFunctionToInterface(desc, "GetColumnHeader", &BridgeTable::GetColumnHeader); + AddFunctionToInterface(desc, "GetSelectedRows", &BridgeTable::GetSelectedRows); + AddFunctionToInterface(desc, "GetSelectedColumns", &BridgeTable::GetSelectedColumns); + AddFunctionToInterface(desc, "IsRowSelected", &BridgeTable::IsRowSelected); + AddFunctionToInterface(desc, "IsColumnSelected", &BridgeTable::IsColumnSelected); + AddFunctionToInterface(desc, "IsSelected", &BridgeTable::IsCellSelected); + AddFunctionToInterface(desc, "AddRowSelection", &BridgeTable::AddRowSelection); + AddFunctionToInterface(desc, "AddColumnSelection", &BridgeTable::AddColumnSelection); + AddFunctionToInterface(desc, "RemoveRowSelection", &BridgeTable::RemoveRowSelection); + AddFunctionToInterface(desc, "RemoveColumnSelection", &BridgeTable::RemoveColumnSelection); + AddFunctionToInterface(desc, "GetRowColumnExtentsAtIndex", &BridgeTable::GetRowColumnSpan); + + mDbusServer.addInterface("/", desc, true); +} + +Table* BridgeTable::FindSelf() const +{ + return FindCurrentObjectWithInterface(); +} + +DBus::ValueOrError BridgeTable::GetRowCount() +{ + return FindSelf()->GetRowCount(); +} + +DBus::ValueOrError BridgeTable::GetColumnCount() +{ + return FindSelf()->GetColumnCount(); +} + +DBus::ValueOrError BridgeTable::GetSelectedRowCount() +{ + return FindSelf()->GetSelectedRowCount(); +} + +DBus::ValueOrError BridgeTable::GetSelectedColumnCount() +{ + return FindSelf()->GetSelectedColumnCount(); +} + +DBus::ValueOrError BridgeTable::GetCaption() +{ + return FindSelf()->GetCaption(); +} + +DBus::ValueOrError BridgeTable::GetSummary() +{ + return FindSelf()->GetSummary(); +} + +DBus::ValueOrError BridgeTable::GetCell(std::int32_t row, std::int32_t column) +{ + return FindSelf()->GetCell(row, column); +} + +DBus::ValueOrError BridgeTable::GetChildIndex(std::int32_t row, std::int32_t column) +{ + return static_cast(FindSelf()->GetChildIndex(row, column)); +} + +DBus::ValueOrError BridgeTable::GetRowByChildIndex(std::int32_t childIndex) +{ + return FindSelf()->GetRowByChildIndex(static_cast(childIndex)); +} + +DBus::ValueOrError BridgeTable::GetColumnByChildIndex(std::int32_t childIndex) +{ + return FindSelf()->GetColumnByChildIndex(static_cast(childIndex)); +} + +DBus::ValueOrError BridgeTable::GetRowDescription(std::int32_t row) +{ + return FindSelf()->GetRowDescription(row); +} + +DBus::ValueOrError BridgeTable::GetColumnDescription(std::int32_t column) +{ + return FindSelf()->GetColumnDescription(column); +} + +DBus::ValueOrError BridgeTable::GetRowSpan(std::int32_t row, std::int32_t column) +{ + return FindSelf()->GetRowSpan(row, column); +} + +DBus::ValueOrError BridgeTable::GetColumnSpan(std::int32_t row, std::int32_t column) +{ + return FindSelf()->GetColumnSpan(row, column); +} + +DBus::ValueOrError BridgeTable::GetRowHeader(std::int32_t row) +{ + return FindSelf()->GetRowHeader(row); +} + +DBus::ValueOrError BridgeTable::GetColumnHeader(std::int32_t column) +{ + return FindSelf()->GetColumnHeader(column); +} + +DBus::ValueOrError> BridgeTable::GetSelectedRows() +{ + return FindSelf()->GetSelectedRows(); +} + +DBus::ValueOrError> BridgeTable::GetSelectedColumns() +{ + return FindSelf()->GetSelectedColumns(); +} + +DBus::ValueOrError BridgeTable::IsRowSelected(std::int32_t row) +{ + return FindSelf()->IsRowSelected(row); +} + +DBus::ValueOrError BridgeTable::IsColumnSelected(std::int32_t column) +{ + return FindSelf()->IsColumnSelected(column); +} + +DBus::ValueOrError BridgeTable::IsCellSelected(std::int32_t row, std::int32_t column) +{ + return FindSelf()->IsCellSelected(row, column); +} + +DBus::ValueOrError BridgeTable::AddRowSelection(std::int32_t row) +{ + return FindSelf()->AddRowSelection(row); +} + +DBus::ValueOrError BridgeTable::AddColumnSelection(std::int32_t column) +{ + return FindSelf()->AddColumnSelection(column); +} + +DBus::ValueOrError BridgeTable::RemoveRowSelection(std::int32_t row) +{ + return FindSelf()->RemoveRowSelection(row); +} + +DBus::ValueOrError BridgeTable::RemoveColumnSelection(std::int32_t column) +{ + return FindSelf()->RemoveColumnSelection(column); +} + +BridgeTable::RowColumnSpanType BridgeTable::GetRowColumnSpan(std::int32_t childIndex) +{ + Table::RowColumnSpanType span = FindSelf()->GetRowColumnSpan(static_cast(childIndex)); + + return {span.success, span.row, span.column, span.rowSpan, span.columnSpan, span.isSelected}; +} diff --git a/dali/internal/accessibility/bridge/bridge-table.h b/dali/internal/accessibility/bridge/bridge-table.h new file mode 100644 index 0000000..d9ffbe5 --- /dev/null +++ b/dali/internal/accessibility/bridge/bridge-table.h @@ -0,0 +1,186 @@ +#ifndef DALI_INTERNAL_ACCESSIBILITY_BRIDGE_TABLE_H +#define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_TABLE_H + +/* + * Copyright (c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +// INTERNAL INCLUDES +#include +#include + +/** + * @brief The BridgeTable class contains glue code for Accessibility::Table. + */ +class BridgeTable : public virtual BridgeBase +{ +protected: + BridgeTable() = default; + + /** + * @brief Registers Table methods as a DBus interface. + */ + void RegisterInterfaces(); + + /** + * @brief Returns the Table object of the currently executed DBus method call. + * + * @return The Table object + */ + Dali::Accessibility::Table* FindSelf() const; + +public: + using RowColumnSpanType = DBus::ValueOrError< + bool, // success + std::int32_t, // row + std::int32_t, // column + std::int32_t, // rowSpan + std::int32_t, // columnSpan + bool // isSelected + >; + + /** + * @copydoc Dali::Accessibility::Table::GetRowCount() + */ + DBus::ValueOrError GetRowCount(); + + /** + * @copydoc Dali::Accessibility::Table::GetColumnCount() + */ + DBus::ValueOrError GetColumnCount(); + + /** + * @copydoc Dali::Accessibility::Table::GetSelectedRowCount() + */ + DBus::ValueOrError GetSelectedRowCount(); + + /** + * @copydoc Dali::Accessibility::Table::GetSelectedColumnCount() + */ + DBus::ValueOrError GetSelectedColumnCount(); + + /** + * @copydoc Dali::Accessibility::Table::GetCaption() + */ + DBus::ValueOrError GetCaption(); + + /** + * @copydoc Dali::Accessibility::Table::GetSummary() + */ + DBus::ValueOrError GetSummary(); + + /** + * @copydoc Dali::Accessibility::Table::GetCell() + */ + DBus::ValueOrError GetCell(std::int32_t row, std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::GetChildIndex() + */ + DBus::ValueOrError GetChildIndex(std::int32_t row, std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::GetRowByChildIndex() + */ + DBus::ValueOrError GetRowByChildIndex(std::int32_t childIndex); + + /** + * @copydoc Dali::Accessibility::Table::GetColumnByChildIndex() + */ + DBus::ValueOrError GetColumnByChildIndex(std::int32_t childIndex); + + /** + * @copydoc Dali::Accessibility::Table::GetRowDescription() + */ + DBus::ValueOrError GetRowDescription(std::int32_t row); + + /** + * @copydoc Dali::Accessibility::Table::GetColumnDescription() + */ + DBus::ValueOrError GetColumnDescription(std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::GetRowSpan() + */ + DBus::ValueOrError GetRowSpan(std::int32_t row, std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::GetColumnSpan() + */ + DBus::ValueOrError GetColumnSpan(std::int32_t row, std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::GetRowHeader() + */ + DBus::ValueOrError GetRowHeader(std::int32_t row); + + /** + * @copydoc Dali::Accessibility::Table::GetColumnHeader() + */ + DBus::ValueOrError GetColumnHeader(std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::GetSelectedRows() + */ + DBus::ValueOrError> GetSelectedRows(); + + /** + * @copydoc Dali::Accessibility::Table::GetSelectedColumns() + */ + DBus::ValueOrError> GetSelectedColumns(); + + /** + * @copydoc Dali::Accessibility::Table::IsRowSelected() + */ + DBus::ValueOrError IsRowSelected(std::int32_t row); + + /** + * @copydoc Dali::Accessibility::Table::IsColumnSelected() + */ + DBus::ValueOrError IsColumnSelected(std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::IsCellSelected() + */ + DBus::ValueOrError IsCellSelected(std::int32_t row, std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::AddRowSelection() + */ + DBus::ValueOrError AddRowSelection(std::int32_t row); + + /** + * @copydoc Dali::Accessibility::Table::AddColumnSelection() + */ + DBus::ValueOrError AddColumnSelection(std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::RemoveRowSelection() + */ + DBus::ValueOrError RemoveRowSelection(std::int32_t row); + + /** + * @copydoc Dali::Accessibility::Table::RemoveColumnSelection() + */ + DBus::ValueOrError RemoveColumnSelection(std::int32_t column); + + /** + * @copydoc Dali::Accessibility::Table::GetRowColumnSpan() + */ + RowColumnSpanType GetRowColumnSpan(std::int32_t childIndex); +}; + +#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_TABLE_H diff --git a/dali/internal/accessibility/file.list b/dali/internal/accessibility/file.list index 3f3e35c..eccf293 100644 --- a/dali/internal/accessibility/file.list +++ b/dali/internal/accessibility/file.list @@ -74,6 +74,8 @@ SET( adaptor_accessibility_atspi_bridge_src_files ${adaptor_accessibility_dir}/bridge/bridge-object.cpp ${adaptor_accessibility_dir}/bridge/bridge-selection.cpp ${adaptor_accessibility_dir}/bridge/bridge-socket.cpp + ${adaptor_accessibility_dir}/bridge/bridge-table.cpp + ${adaptor_accessibility_dir}/bridge/bridge-table-cell.cpp ${adaptor_accessibility_dir}/bridge/bridge-text.cpp ${adaptor_accessibility_dir}/bridge/bridge-value.cpp ${adaptor_accessibility_dir}/bridge/component.cpp -- 2.7.4