diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2022-02-22 16:36:33 +0100 |
---|---|---|
committer | Michael Weghorn <m.weghorn@posteo.de> | 2022-02-23 06:27:22 +0100 |
commit | fe9206b474464dd092da1d5c1ee788fe1c9b0765 (patch) | |
tree | 305389f14d7239b2cf05a2390f9ceb7e37c5eacb /vcl | |
parent | 4162feb37109d4e9da44933831e10b5732721c72 (diff) |
qt a11y: Better handle TEXT_CHANGED event
Trigger the corresponding Qt accessibility
events for deleted and inserted text rather
than sending a QAccessible::TextColumnChanged
event (which looks like a rather arbitrary choice...).
Qt also has a 'QAccessibleTextUpdateEvent'
class that could be used to send a combined
event, but since we get the relevant data
separately in the LO event, using the latter
wouldn't make things easier. And at least
for the AT-SPI case on Linux, Qt sends
separate AT-SPI events via D-Bus anyway. [1]
Unfortunately, qt5/qt6 VCL a11y is not yet functional
enough to e.g. test that the correct AT-SPI events
are actually received when using the the script mentioned in
Change-Id: Ibcae27ecfccf41a909e06d01ce681e4b7b97eb25
(gtk3 a11y: Migrate from deprecated "text-changed" ATK signal).
[1] https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/linux/atspiadaptor.cpp#n964
Change-Id: Ia9282382b6d5fd6bffd536dcda2989a6da901e90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130356
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/QtAccessibleEventListener.cxx | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/vcl/qt5/QtAccessibleEventListener.cxx b/vcl/qt5/QtAccessibleEventListener.cxx index 5a8e84144210..08b97b69c347 100644 --- a/vcl/qt5/QtAccessibleEventListener.cxx +++ b/vcl/qt5/QtAccessibleEventListener.cxx @@ -18,10 +18,12 @@ */ #include <QtAccessibleEventListener.hxx> +#include <QtTools.hxx> #include <sal/log.hxx> #include <com/sun/star/accessibility/AccessibleEventId.hpp> +#include <com/sun/star/accessibility/TextSegment.hpp> #include <QtGui/QAccessible> @@ -96,6 +98,24 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::AttributeChanged)); return; + case AccessibleEventId::TEXT_CHANGED: + { + TextSegment aDeletedText; + TextSegment aInsertedText; + if (aEvent.OldValue >>= aDeletedText) + { + QAccessible::updateAccessibility( + new QAccessibleTextRemoveEvent(pQAccessibleInterface, aDeletedText.SegmentStart, + toQString(aDeletedText.SegmentText))); + } + if (aEvent.NewValue >>= aInsertedText) + { + QAccessible::updateAccessibility(new QAccessibleTextInsertEvent( + pQAccessibleInterface, aInsertedText.SegmentStart, + toQString(aInsertedText.SegmentText))); + } + return; + } case AccessibleEventId::TABLE_CAPTION_CHANGED: QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::TableCaptionChanged)); @@ -140,7 +160,6 @@ void QtAccessibleEventListener::notifyEvent(const css::accessibility::Accessible QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::SectionChanged)); return; - case AccessibleEventId::TEXT_CHANGED: case AccessibleEventId::COLUMN_CHANGED: QAccessible::updateAccessibility( new QAccessibleEvent(pQAccessibleInterface, QAccessible::TextColumnChanged)); |