diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2023-10-24 10:03:44 +0200 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2023-10-24 12:58:14 +0200 |
commit | eafef8fd195654f0e7dbd007bcc7fa0f6d29b599 (patch) | |
tree | 1d04f38b509cc4bf57131542ae409f9370604b3a /accessibility | |
parent | 6974c10901cc052bce23295ddff25530137e94c8 (diff) |
tdf#135921 a11y Send event when toggling listbox checkbox
When toggling the state of the checkbox in a listbox/
treelist entry using the mouse or the keyboard, emit
a `VclEventId::CheckboxToggle` event and process
that in the a11y class that's used for the case
where there's just a single checkbox (like in the
spelling options dialog), `AccessibleListBoxEntry`
by sending a corresponding STATE_CHANGED event
on the a11y layer.
This makes Orca with the qt6 VCL plugin and NVDA on Windows
announce the new value when toggling a checkbox in the
Spelling options dialog using either the mouse or the
keyboard.
As mentioned in the previous commit,
Change-Id Ic78f9052d166be0da17a76261a09da02b8a11cd7
tdf#135921 a11y: Toggle listbox item checkbox on space
, the case where a listbox entry has multiple checkboxes
(like the autocorrect options dialog in Writer)
uses different a11y classes and toggling a checkbox there
still doesn't result in the new value being announced.
Change-Id: I36a2b0a3fa3154279fb06af023fdb96f699fac2f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158375
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'accessibility')
-rw-r--r-- | accessibility/source/extended/accessiblelistboxentry.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index 69feac418805..10433d882730 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -23,6 +23,7 @@ #include <svtools/stringtransfer.hxx> #include <vcl/toolkit/svlbitm.hxx> #include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleRelationType.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp> @@ -84,6 +85,22 @@ namespace accessibility switch ( rEvent.GetId() ) { + case VclEventId::CheckboxToggle: + { + // assert this object is represented as a checkbox on a11y layer (LABEL role is used for + // SvButtonState::Tristate, s. AccessibleListBoxEntry::getAccessibleRole) + assert(getAccessibleRole() == AccessibleRole::CHECK_BOX + || getAccessibleRole() == AccessibleRole::LABEL); + Any aOldValue; + Any aNewValue; + if (getAccessibleStateSet() & AccessibleStateType::CHECKED) + aNewValue <<= AccessibleStateType::CHECKED; + else + aOldValue <<= AccessibleStateType::CHECKED; + + NotifyAccessibleEvent(AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue); + break; + } case VclEventId::ObjectDying : { if ( m_pTreeListBox ) |