diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-11-06 16:59:36 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-11-07 07:59:28 +0100 |
commit | a5c84405caf6f3dc51919fd937dfe21c3d6d53d1 (patch) | |
tree | 5b1fcb81cb6a6d7863246742c7d778cceb1b3174 /vcl/unx/gtk4 | |
parent | a182f283dabf5753e857a66386ef32226be47f49 (diff) |
gtk4 a11y: Map states to corresponding gtk a11y properties
For those states in
`com::sun::star::accessibility::AccessibleStateType::EDITABLE`
that have a corresponding `GTK_ACCESSIBLE_PROPERTY_*`, set
that property when creating a new `LoAccessible`.
This e.g. makes Accerciser show the "multiline" and "multi selectable"
AT-SPI states for a Writer paragraph when using the gtk4 VCL plugin.
State updates are not handled yet, since a11y event handling is
currently not implemented in the gtk4 VCL plugin yet.
Change-Id: Ic033e66dd89021defca449bbe2251102bbd61015
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159005
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl/unx/gtk4')
-rw-r--r-- | vcl/unx/gtk4/a11y.cxx | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx index 2aae5bdefae6..fc148d41c199 100644 --- a/vcl/unx/gtk4/a11y.cxx +++ b/vcl/unx/gtk4/a11y.cxx @@ -470,9 +470,33 @@ lo_accessible_new(GdkDisplay* pDisplay, GtkAccessible* pParent, ret->parent = pParent; ret->uno_accessible = rAccessible; - // set values from XAccessibleValue interface if that's implemented css::uno::Reference<css::accessibility::XAccessibleContext> xContext( ret->uno_accessible->getAccessibleContext()); + assert(xContext.is() && "No accessible context"); + + // set state properties + const sal_Int64 nStates = xContext->getAccessibleStateSet(); + gtk_accessible_update_property( + GTK_ACCESSIBLE(ret), GTK_ACCESSIBLE_PROPERTY_MODAL, + bool(nStates & com::sun::star::accessibility::AccessibleStateType::MODAL), + GTK_ACCESSIBLE_PROPERTY_MULTI_LINE, + bool(nStates & com::sun::star::accessibility::AccessibleStateType::MULTI_LINE), + GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE, + bool(nStates & com::sun::star::accessibility::AccessibleStateType::MULTI_SELECTABLE), + GTK_ACCESSIBLE_PROPERTY_READ_ONLY, + bool(!(nStates & com::sun::star::accessibility::AccessibleStateType::EDITABLE)), -1); + if (nStates & com::sun::star::accessibility::AccessibleStateType::HORIZONTAL) + { + gtk_accessible_update_property(GTK_ACCESSIBLE(ret), GTK_ACCESSIBLE_PROPERTY_ORIENTATION, + GTK_ORIENTATION_HORIZONTAL, -1); + } + else if ((nStates & com::sun::star::accessibility::AccessibleStateType::VERTICAL)) + { + gtk_accessible_update_property(GTK_ACCESSIBLE(ret), GTK_ACCESSIBLE_PROPERTY_ORIENTATION, + GTK_ORIENTATION_VERTICAL, -1); + } + + // set values from XAccessibleValue interface if that's implemented css::uno::Reference<css::accessibility::XAccessibleValue> xAccessibleValue(xContext, css::uno::UNO_QUERY); if (xAccessibleValue.is()) |