accessibility/inc/standard/svtaccessiblenumericfield.hxx    |    4 ++++
 accessibility/source/standard/svtaccessiblenumericfield.cxx |   12 ++++++++++++
 2 files changed, 16 insertions(+)

New commits:
commit 07f4fa7119d28ce943405ee6e7cbdf260c730357
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Apr 14 18:25:34 2023 +0300
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Sat Apr 15 05:39:03 2023 +0200

    a11y: Send VALUE_CHANGED event for FormattedField
    
    `VCLXAccessibleEdit::ProcessWindowEvent` takes care
    of sending a `TEXT_CHANGED` event. In the case of
    `SVTXAccessibleNumericField`, numeric values are
    handled, so send a `VALUE_CHANGED` event in addition.
    
    This makes Orca with the qt6 VCL plugin announce
    the new value when e.g. changing the page width
    using the arrow up key in the "Format" -> "Page Style"
    dialog.
    
    For Accerciser, an additional fix is needed so the
    value gets updated there in the interface view when
    the a11y object is selected. Pending MR: [1]
    
    [1] https://gitlab.gnome.org/GNOME/accerciser/-/merge_requests/25
    
    Change-Id: Id911f50664df7220bc58204bc3477c5306a1da33
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150422
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/accessibility/inc/standard/svtaccessiblenumericfield.hxx 
b/accessibility/inc/standard/svtaccessiblenumericfield.hxx
index 3537b9d6ef1d..29225a5c6072 100644
--- a/accessibility/inc/standard/svtaccessiblenumericfield.hxx
+++ b/accessibility/inc/standard/svtaccessiblenumericfield.hxx
@@ -20,6 +20,8 @@
 #pragma once
 
 #include <cppuhelper/implbase.hxx>
+#include <vcl/vclevent.hxx>
+
 #include <standard/vclxaccessibleedit.hxx>
 
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
@@ -30,6 +32,8 @@ class SVTXAccessibleNumericField final
 public:
     SVTXAccessibleNumericField(VCLXWindow* pVCLXindow);
 
+    virtual void ProcessWindowEvent(const VclWindowEvent& rVclWindowEvent) 
override;
+
     // XAccessibleContext
     virtual sal_Int16 SAL_CALL getAccessibleRole() override;
 
diff --git a/accessibility/source/standard/svtaccessiblenumericfield.cxx 
b/accessibility/source/standard/svtaccessiblenumericfield.cxx
index 2862a3a2b670..f3192d4212f0 100644
--- a/accessibility/source/standard/svtaccessiblenumericfield.cxx
+++ b/accessibility/source/standard/svtaccessiblenumericfield.cxx
@@ -21,6 +21,7 @@
 #include <comphelper/accessiblecontexthelper.hxx>
 #include <toolkit/awt/vclxwindows.hxx>
 
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 
 using namespace ::com::sun::star::accessibility;
@@ -31,6 +32,17 @@ 
SVTXAccessibleNumericField::SVTXAccessibleNumericField(VCLXWindow* pVCLWindow)
 {
 }
 
+void SVTXAccessibleNumericField::ProcessWindowEvent(const VclWindowEvent& 
rVclWindowEvent)
+{
+    VCLXAccessibleEdit::ProcessWindowEvent(rVclWindowEvent);
+
+    if (rVclWindowEvent.GetId() == VclEventId::EditModify)
+    {
+        css::uno::Any aNewValue = getCurrentValue();
+        NotifyAccessibleEvent(AccessibleEventId::VALUE_CHANGED, 
css::uno::Any(), aNewValue);
+    }
+}
+
 sal_Int16 SVTXAccessibleNumericField::getAccessibleRole() { return 
AccessibleRole::SPIN_BOX; }
 
 css::uno::Any SAL_CALL SVTXAccessibleNumericField::getCurrentValue()

Reply via email to