summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2022-08-30 19:03:37 +0200
committerMichael Weghorn <m.weghorn@posteo.de>2022-08-30 23:53:59 +0200
commitef2ab3326ab1390c5c08d56d65af6dedd67c894f (patch)
tree933906292a8a668932b1fe8c946bd732b130e253
parent0a8efec1cd6ad5c8a3c09d4266067944f5d9d7be (diff)
gtk3 a11y: Implement methods for (un)selecting table rows/cols
The `XAccessibleTableSelection` interface provides the required methods. This e.g. makes (un)selecting rows and columns in a Writer table using Accerciser as described in Change-Id I0c239c0d36a073cd63a35ca7d0802cf5591d9738 ("sw a11y: Don't confuse row and column") work with the gtk3 VCL plugin as well. Change-Id: Ic17cc74c209b08907adedfa59ac586732b5ec3bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139065 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/unx/gtk3/a11y/atktable.cxx74
-rw-r--r--vcl/unx/gtk3/a11y/atkwrapper.cxx2
-rw-r--r--vcl/unx/gtk3/a11y/atkwrapper.hxx2
3 files changed, 66 insertions, 12 deletions
diff --git a/vcl/unx/gtk3/a11y/atktable.cxx b/vcl/unx/gtk3/a11y/atktable.cxx
index 11df8a73ce1c..04e9d7645cc5 100644
--- a/vcl/unx/gtk3/a11y/atktable.cxx
+++ b/vcl/unx/gtk3/a11y/atktable.cxx
@@ -24,6 +24,7 @@
#include "atkwrapper.hxx"
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
#include <comphelper/sequence.hxx>
using namespace ::com::sun::star;
@@ -71,6 +72,23 @@ static css::uno::Reference<css::accessibility::XAccessibleTable>
return css::uno::Reference<css::accessibility::XAccessibleTable>();
}
+static css::uno::Reference<css::accessibility::XAccessibleTableSelection>
+ getTableSelection(AtkTable *pTable)
+{
+ AtkObjectWrapper *pWrap = ATK_OBJECT_WRAPPER(pTable);
+ if (pWrap)
+ {
+ if (!pWrap->mpTableSelection.is())
+ {
+ pWrap->mpTableSelection.set(pWrap->mpContext, css::uno::UNO_QUERY);
+ }
+
+ return pWrap->mpTableSelection;
+ }
+
+ return css::uno::Reference<css::accessibility::XAccessibleTableSelection>();
+}
+
/*****************************************************************************/
extern "C" {
@@ -466,37 +484,69 @@ table_wrapper_is_selected( AtkTable *table,
/*****************************************************************************/
static gboolean
-table_wrapper_add_row_selection( AtkTable *, gint )
+table_wrapper_add_row_selection(AtkTable *pTable, gint row)
{
- g_warning( "FIXME: no simple analogue for add_row_selection" );
- return 0;
+ try {
+ css::uno::Reference<css::accessibility::XAccessibleTableSelection> xTableSelection = getTableSelection(pTable);
+ if (xTableSelection.is())
+ return xTableSelection->selectRow(row);
+ }
+ catch(const uno::Exception&) {
+ g_warning( "Exception in selectRow()" );
+ }
+
+ return false;
}
/*****************************************************************************/
static gboolean
-table_wrapper_remove_row_selection( AtkTable *, gint )
+table_wrapper_remove_row_selection(AtkTable *pTable, gint row)
{
- g_warning( "FIXME: no simple analogue for remove_row_selection" );
- return 0;
+ try {
+ css::uno::Reference<css::accessibility::XAccessibleTableSelection> xTableSelection = getTableSelection(pTable);
+ if (xTableSelection.is())
+ return xTableSelection->unselectRow(row);
+ }
+ catch(const uno::Exception&) {
+ g_warning( "Exception in unselectRow()" );
+ }
+
+ return false;
}
/*****************************************************************************/
static gboolean
-table_wrapper_add_column_selection( AtkTable *, gint )
+table_wrapper_add_column_selection(AtkTable *pTable, gint column)
{
- g_warning( "FIXME: no simple analogue for add_column_selection" );
- return 0;
+ try {
+ css::uno::Reference<css::accessibility::XAccessibleTableSelection> xTableSelection = getTableSelection(pTable);
+ if (xTableSelection.is())
+ return xTableSelection->selectColumn(column);
+ }
+ catch(const uno::Exception&) {
+ g_warning( "Exception in selectColumn()" );
+ }
+
+ return false;
}
/*****************************************************************************/
static gboolean
-table_wrapper_remove_column_selection( AtkTable *, gint )
+table_wrapper_remove_column_selection(AtkTable *pTable, gint column)
{
- g_warning( "FIXME: no simple analogue for remove_column_selection" );
- return 0;
+ try {
+ css::uno::Reference<css::accessibility::XAccessibleTableSelection> xTableSelection = getTableSelection(pTable);
+ if (xTableSelection.is())
+ return xTableSelection->unselectColumn(column);
+ }
+ catch(const uno::Exception&) {
+ g_warning( "Exception in unselectColumn()" );
+ }
+
+ return false;
}
/*****************************************************************************/
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.cxx b/vcl/unx/gtk3/a11y/atkwrapper.cxx
index f798364e2003..c99290fd4a9a 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.cxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.cxx
@@ -683,6 +683,7 @@ atk_object_wrapper_init (AtkObjectWrapper *wrapper,
wrapper->mpImage = nullptr;
wrapper->mpSelection = nullptr;
wrapper->mpTable = nullptr;
+ wrapper->mpTableSelection = nullptr;
wrapper->mpText = nullptr;
wrapper->mpValue = nullptr;
}
@@ -996,6 +997,7 @@ void atk_object_wrapper_dispose(AtkObjectWrapper* wrapper)
wrapper->mpSelection.clear();
wrapper->mpMultiLineText.clear();
wrapper->mpTable.clear();
+ wrapper->mpTableSelection.clear();
wrapper->mpText.clear();
wrapper->mpTextMarkup.clear();
wrapper->mpTextAttributes.clear();
diff --git a/vcl/unx/gtk3/a11y/atkwrapper.hxx b/vcl/unx/gtk3/a11y/atkwrapper.hxx
index 906e6f0c9414..e43172f68ac1 100644
--- a/vcl/unx/gtk3/a11y/atkwrapper.hxx
+++ b/vcl/unx/gtk3/a11y/atkwrapper.hxx
@@ -39,6 +39,7 @@ namespace com::sun::star::accessibility {
class XAccessibleMultiLineText;
class XAccessibleSelection;
class XAccessibleTable;
+ class XAccessibleTableSelection;
class XAccessibleText;
class XAccessibleTextMarkup;
class XAccessibleTextAttributes;
@@ -64,6 +65,7 @@ struct AtkObjectWrapper
mpMultiLineText;
css::uno::Reference<css::accessibility::XAccessibleSelection> mpSelection;
css::uno::Reference<css::accessibility::XAccessibleTable> mpTable;
+ css::uno::Reference<css::accessibility::XAccessibleTableSelection> mpTableSelection;
css::uno::Reference<css::accessibility::XAccessibleText> mpText;
css::uno::Reference<css::accessibility::XAccessibleTextMarkup> mpTextMarkup;
css::uno::Reference<css::accessibility::XAccessibleTextAttributes>