[Tizen][AT-SPI] Add Table and TableCell interfaces 19/293419/3
authorArtur Świgoń <a.swigon@samsung.com>
Tue, 6 Sep 2022 09:40:58 +0000 (11:40 +0200)
committerArtur Świgoń <a.swigon@samsung.com>
Fri, 26 May 2023 11:47:50 +0000 (13:47 +0200)
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
dali/devel-api/atspi-interfaces/table-cell.h [new file with mode: 0644]
dali/devel-api/atspi-interfaces/table.h [new file with mode: 0644]
dali/devel-api/file.list
dali/internal/accessibility/bridge/bridge-impl.cpp
dali/internal/accessibility/bridge/bridge-table-cell.cpp [new file with mode: 0644]
dali/internal/accessibility/bridge/bridge-table-cell.h [new file with mode: 0644]
dali/internal/accessibility/bridge/bridge-table.cpp [new file with mode: 0644]
dali/internal/accessibility/bridge/bridge-table.h [new file with mode: 0644]
dali/internal/accessibility/file.list

index 3d143bf..915da51 100644 (file)
@@ -40,6 +40,8 @@
 #include <dali/devel-api/atspi-interfaces/hypertext.h>
 #include <dali/devel-api/atspi-interfaces/selection.h>
 #include <dali/devel-api/atspi-interfaces/socket.h>
+#include <dali/devel-api/atspi-interfaces/table.h>
+#include <dali/devel-api/atspi-interfaces/table-cell.h>
 #include <dali/devel-api/atspi-interfaces/text.h>
 #include <dali/devel-api/atspi-interfaces/value.h>
 #include <dali/internal/adaptor/common/adaptor-impl.h>
@@ -241,6 +243,8 @@ AtspiInterfaces Accessible::DoGetInterfaces() const
   interfaces[AtspiInterface::HYPERTEXT]     = dynamic_cast<const Hypertext*>(this);
   interfaces[AtspiInterface::SELECTION]     = dynamic_cast<const Selection*>(this);
   interfaces[AtspiInterface::SOCKET]        = dynamic_cast<const Socket*>(this);
+  interfaces[AtspiInterface::TABLE]         = dynamic_cast<const Table*>(this);
+  interfaces[AtspiInterface::TABLE_CELL]    = dynamic_cast<const TableCell*>(this);
   interfaces[AtspiInterface::TEXT]          = dynamic_cast<const Text*>(this);
   interfaces[AtspiInterface::VALUE]         = dynamic_cast<const Value*>(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 (file)
index 0000000..81ae310
--- /dev/null
@@ -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 <utility>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/accessible.h>
+
+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<int, int> 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<AtspiInterface::TABLE_CELL>
+{
+  using Type = TableCell;
+};
+} // namespace Internal
+
+inline TableCell* TableCell::DownCast(Accessible* obj)
+{
+  return Accessible::DownCast<AtspiInterface::TABLE_CELL>(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 (file)
index 0000000..f90f304
--- /dev/null
@@ -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 <string>
+#include <vector>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/accessible.h>
+
+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<int> GetSelectedRows() const = 0;
+
+  /**
+   * @brief Gets all selected columns' numbers.
+   *
+   * @return Selected columns' numbers
+   *
+   * @see Table::GetSelectedColumnCount()
+   */
+  virtual std::vector<int> 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<AtspiInterface::TABLE>
+{
+  using Type = Table;
+};
+} // namespace Internal
+
+inline Table* Table::DownCast(Accessible* obj)
+{
+  return Accessible::DownCast<AtspiInterface::TABLE>(obj);
+}
+
+} // namespace Dali::Accessibility
+
+#endif // DALI_ADAPTOR_ATSPI_TABLE_H
index 30fb9c1..b446749 100755 (executable)
@@ -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
 )
index a7b68d2..2036741 100644 (file)
@@ -38,6 +38,8 @@
 #include <dali/internal/accessibility/bridge/bridge-object.h>
 #include <dali/internal/accessibility/bridge/bridge-selection.h>
 #include <dali/internal/accessibility/bridge/bridge-socket.h>
+#include <dali/internal/accessibility/bridge/bridge-table.h>
+#include <dali/internal/accessibility/bridge/bridge-table-cell.h>
 #include <dali/internal/accessibility/bridge/bridge-text.h>
 #include <dali/internal/accessibility/bridge/bridge-value.h>
 #include <dali/internal/accessibility/bridge/bridge-application.h>
@@ -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 (file)
index 0000000..b4680f8
--- /dev/null
@@ -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 <dali/internal/accessibility/bridge/bridge-table-cell.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/table.h>
+
+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<AtspiInterface::TABLE_CELL>();
+}
+
+DBus::ValueOrError<Accessible*> BridgeTableCell::GetTable()
+{
+  return FindSelf()->GetTable();
+}
+
+DBus::ValueOrError<std::int32_t, std::int32_t> BridgeTableCell::GetCellPosition()
+{
+  std::pair<int, int> position = FindSelf()->GetCellPosition();
+
+  return {position.first, position.second};
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTableCell::GetCellRowSpan()
+{
+  return FindSelf()->GetCellRowSpan();
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTableCell::GetCellColumnSpan()
+{
+  return FindSelf()->GetCellColumnSpan();
+}
+
+DBus::ValueOrError<std::int32_t, std::int32_t, std::int32_t, std::int32_t> 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 (file)
index 0000000..e8a7b61
--- /dev/null
@@ -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 <dali/devel-api/atspi-interfaces/table-cell.h>
+#include <dali/internal/accessibility/bridge/bridge-base.h>
+
+/**
+ * @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<Dali::Accessibility::Accessible*> GetTable();
+
+  /**
+   * @copydoc Dali::Accessibility::TableCell::GetCellPosition()
+   */
+  DBus::ValueOrError<std::int32_t, std::int32_t> GetCellPosition();
+
+  /**
+   * @copydoc Dali::Accessibility::TableCell::GetCellRowSpan()
+   */
+  DBus::ValueOrError<std::int32_t> GetCellRowSpan();
+
+  /**
+   * @copydoc Dali::Accessibility::TableCell::GetCellColumnSpan()
+   */
+  DBus::ValueOrError<std::int32_t> GetCellColumnSpan();
+
+  /**
+   * @copydoc Dali::Accessibility::TableCell::GetCellRowColumnSpan()
+   */
+  DBus::ValueOrError<std::int32_t, std::int32_t, std::int32_t, std::int32_t> 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 (file)
index 0000000..81ec834
--- /dev/null
@@ -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 <dali/internal/accessibility/bridge/bridge-table.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/atspi-interfaces/table-cell.h>
+
+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<AtspiInterface::TABLE>();
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetRowCount()
+{
+  return FindSelf()->GetRowCount();
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetColumnCount()
+{
+  return FindSelf()->GetColumnCount();
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetSelectedRowCount()
+{
+  return FindSelf()->GetSelectedRowCount();
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetSelectedColumnCount()
+{
+  return FindSelf()->GetSelectedColumnCount();
+}
+
+DBus::ValueOrError<Accessible*> BridgeTable::GetCaption()
+{
+  return FindSelf()->GetCaption();
+}
+
+DBus::ValueOrError<Accessible*> BridgeTable::GetSummary()
+{
+  return FindSelf()->GetSummary();
+}
+
+DBus::ValueOrError<Accessible*> BridgeTable::GetCell(std::int32_t row, std::int32_t column)
+{
+  return FindSelf()->GetCell(row, column);
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetChildIndex(std::int32_t row, std::int32_t column)
+{
+  return static_cast<std::int32_t>(FindSelf()->GetChildIndex(row, column));
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetRowByChildIndex(std::int32_t childIndex)
+{
+  return FindSelf()->GetRowByChildIndex(static_cast<std::size_t>(childIndex));
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetColumnByChildIndex(std::int32_t childIndex)
+{
+  return FindSelf()->GetColumnByChildIndex(static_cast<std::size_t>(childIndex));
+}
+
+DBus::ValueOrError<std::string> BridgeTable::GetRowDescription(std::int32_t row)
+{
+  return FindSelf()->GetRowDescription(row);
+}
+
+DBus::ValueOrError<std::string> BridgeTable::GetColumnDescription(std::int32_t column)
+{
+  return FindSelf()->GetColumnDescription(column);
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetRowSpan(std::int32_t row, std::int32_t column)
+{
+  return FindSelf()->GetRowSpan(row, column);
+}
+
+DBus::ValueOrError<std::int32_t> BridgeTable::GetColumnSpan(std::int32_t row, std::int32_t column)
+{
+  return FindSelf()->GetColumnSpan(row, column);
+}
+
+DBus::ValueOrError<Accessible*> BridgeTable::GetRowHeader(std::int32_t row)
+{
+  return FindSelf()->GetRowHeader(row);
+}
+
+DBus::ValueOrError<Accessible*> BridgeTable::GetColumnHeader(std::int32_t column)
+{
+  return FindSelf()->GetColumnHeader(column);
+}
+
+DBus::ValueOrError<std::vector<std::int32_t>> BridgeTable::GetSelectedRows()
+{
+  return FindSelf()->GetSelectedRows();
+}
+
+DBus::ValueOrError<std::vector<std::int32_t>> BridgeTable::GetSelectedColumns()
+{
+  return FindSelf()->GetSelectedColumns();
+}
+
+DBus::ValueOrError<bool> BridgeTable::IsRowSelected(std::int32_t row)
+{
+  return FindSelf()->IsRowSelected(row);
+}
+
+DBus::ValueOrError<bool> BridgeTable::IsColumnSelected(std::int32_t column)
+{
+  return FindSelf()->IsColumnSelected(column);
+}
+
+DBus::ValueOrError<bool> BridgeTable::IsCellSelected(std::int32_t row, std::int32_t column)
+{
+  return FindSelf()->IsCellSelected(row, column);
+}
+
+DBus::ValueOrError<bool> BridgeTable::AddRowSelection(std::int32_t row)
+{
+  return FindSelf()->AddRowSelection(row);
+}
+
+DBus::ValueOrError<bool> BridgeTable::AddColumnSelection(std::int32_t column)
+{
+  return FindSelf()->AddColumnSelection(column);
+}
+
+DBus::ValueOrError<bool> BridgeTable::RemoveRowSelection(std::int32_t row)
+{
+  return FindSelf()->RemoveRowSelection(row);
+}
+
+DBus::ValueOrError<bool> 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<std::size_t>(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 (file)
index 0000000..d9ffbe5
--- /dev/null
@@ -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 <dali/devel-api/atspi-interfaces/table.h>
+#include <dali/internal/accessibility/bridge/bridge-base.h>
+
+/**
+ * @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<std::int32_t> GetRowCount();
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetColumnCount()
+   */
+  DBus::ValueOrError<std::int32_t> GetColumnCount();
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetSelectedRowCount()
+   */
+  DBus::ValueOrError<std::int32_t> GetSelectedRowCount();
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetSelectedColumnCount()
+   */
+  DBus::ValueOrError<std::int32_t> GetSelectedColumnCount();
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetCaption()
+   */
+  DBus::ValueOrError<Dali::Accessibility::Accessible*> GetCaption();
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetSummary()
+   */
+  DBus::ValueOrError<Dali::Accessibility::Accessible*> GetSummary();
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetCell()
+   */
+  DBus::ValueOrError<Dali::Accessibility::Accessible*> GetCell(std::int32_t row, std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetChildIndex()
+   */
+  DBus::ValueOrError<std::int32_t> GetChildIndex(std::int32_t row, std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetRowByChildIndex()
+   */
+  DBus::ValueOrError<std::int32_t> GetRowByChildIndex(std::int32_t childIndex);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetColumnByChildIndex()
+   */
+  DBus::ValueOrError<std::int32_t> GetColumnByChildIndex(std::int32_t childIndex);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetRowDescription()
+   */
+  DBus::ValueOrError<std::string> GetRowDescription(std::int32_t row);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetColumnDescription()
+   */
+  DBus::ValueOrError<std::string> GetColumnDescription(std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetRowSpan()
+   */
+  DBus::ValueOrError<std::int32_t> GetRowSpan(std::int32_t row, std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetColumnSpan()
+   */
+  DBus::ValueOrError<std::int32_t> GetColumnSpan(std::int32_t row, std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetRowHeader()
+   */
+  DBus::ValueOrError<Dali::Accessibility::Accessible*> GetRowHeader(std::int32_t row);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetColumnHeader()
+   */
+  DBus::ValueOrError<Dali::Accessibility::Accessible*> GetColumnHeader(std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetSelectedRows()
+   */
+  DBus::ValueOrError<std::vector<std::int32_t>> GetSelectedRows();
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetSelectedColumns()
+   */
+  DBus::ValueOrError<std::vector<std::int32_t>> GetSelectedColumns();
+
+  /**
+   * @copydoc Dali::Accessibility::Table::IsRowSelected()
+   */
+  DBus::ValueOrError<bool> IsRowSelected(std::int32_t row);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::IsColumnSelected()
+   */
+  DBus::ValueOrError<bool> IsColumnSelected(std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::IsCellSelected()
+   */
+  DBus::ValueOrError<bool> IsCellSelected(std::int32_t row, std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::AddRowSelection()
+   */
+  DBus::ValueOrError<bool> AddRowSelection(std::int32_t row);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::AddColumnSelection()
+   */
+  DBus::ValueOrError<bool> AddColumnSelection(std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::RemoveRowSelection()
+   */
+  DBus::ValueOrError<bool> RemoveRowSelection(std::int32_t row);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::RemoveColumnSelection()
+   */
+  DBus::ValueOrError<bool> RemoveColumnSelection(std::int32_t column);
+
+  /**
+   * @copydoc Dali::Accessibility::Table::GetRowColumnSpan()
+   */
+  RowColumnSpanType GetRowColumnSpan(std::int32_t childIndex);
+};
+
+#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_TABLE_H
index 3f3e35c..eccf293 100644 (file)
@@ -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