sw/inc/fchrfmt.hxx    |    2 ++
 vcl/unx/gtk4/a11y.cxx |    9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

New commits:
commit eb4ac533ae358bb596ed60d5a65682799bf375a0
Author:     Miklos Vajna <[email protected]>
AuthorDate: Mon Nov 13 19:56:28 2023 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Nov 14 08:10:01 2023 +0100

    sw: document SwFormatCharFormat
    
    What it does, it refers to what, who is the owner.
    
    Change-Id: Ieb8a41ba6c47e5f24d43465f323b660cbf4afdeb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159394
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx
index 2b5aec14278e..aa9caa0f9b9f 100644
--- a/sw/inc/fchrfmt.hxx
+++ b/sw/inc/fchrfmt.hxx
@@ -27,6 +27,8 @@
 class SwTextCharFormat;
 class IntlWrapper;
 
+/// This pool item subclass can appear in the hint array of a text node. It 
refers to a character
+/// style. It's owned by SwTextCharFormat.
 class SW_DLLPUBLIC SwFormatCharFormat final : public SfxPoolItem, public 
SwClient
 {
     friend class SwTextCharFormat;
commit d5a21cca3851488d904ef7d4d86ae8fa8cd3ec12
Author:     Michael Weghorn <[email protected]>
AuthorDate: Mon Nov 13 17:45:21 2023 +0100
Commit:     Michael Weghorn <[email protected]>
CommitDate: Tue Nov 14 08:09:52 2023 +0100

    tdf#123864 gtk4 a11y: Handle CHECKABLE/CHECKED state independent of role
    
    The GtkAccessibleState doc [1] says for `GTK_ACCESSIBLE_STATE_CHECKED`:
    
    > A “checked” state; indicates the current state of a GtkCheckButton.
    > Value type: GtkAccessibleTristate
    
    The CHECKED state is actually used for more than just for checkboxes,
    (e.g. for toggle buttons in the toolbar), so don't restrict its
    use to the CHECK_BOX role in LibreOffice.
    
    Explicitly setting `GTK_ACCESSIBLE_STATE_CHECKED` makes
    Gtk report `ATSPI_STATE_CHECKABLE` on the AT-SPI layer [2],
    so this should only be set for objects that actually
    have `AccessibleStateType::CHECKABLE` set on LO side.
    
    This also implies that the gtk4 a11y bridge now depends
    on the recently introduced CHECKABLE state being set properly.
    (Reporting of that state in the different a11y classes will
    be added in follow-up commits.)
    
    For more background, see the commit adding the new role:
    
        Change-Id I6aa7fec3b3bd728a5cfedcdc8d6b66f06337f7ce
        Author: Michael Weghorn <[email protected]>
        Date:   Mon Nov 13 15:53:44 2023 +0100
    
            tdf#123864 a11y: Add new AccessibleStateType::CHECKABLE
    
    [1] https://docs.gtk.org/gtk4/enum.AccessibleState.html
    [2] 
https://gitlab.gnome.org/GNOME/gtk/-/blob/a9e4993184605bc70e930b5c1e69d8f49c689c76/gtk/a11y/gtkatspicontext.c#L204-220
    
    Change-Id: I898898f6117fb2ff62310c65e4baa140486deb16
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159390
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <[email protected]>

diff --git a/vcl/unx/gtk4/a11y.cxx b/vcl/unx/gtk4/a11y.cxx
index 43835956581a..96570b01f3c5 100644
--- a/vcl/unx/gtk4/a11y.cxx
+++ b/vcl/unx/gtk4/a11y.cxx
@@ -288,8 +288,9 @@ static void applyStates(GtkAccessible* pGtkAccessible,
         GTK_ACCESSIBLE_STATE_SELECTED,
         bool(nStates & 
com::sun::star::accessibility::AccessibleStateType::SELECTED), -1);
 
-    const sal_Int16 nRole = xContext->getAccessibleRole();
-    if (nRole == com::sun::star::accessibility::AccessibleRole::CHECK_BOX)
+    // when explicitly setting any value for GTK_ACCESSIBLE_STATE_CHECKED,
+    // Gtk will also report ATSPI_STATE_CHECKABLE on the AT-SPI layer
+    if (nStates & 
com::sun::star::accessibility::AccessibleStateType::CHECKABLE)
     {
         GtkAccessibleTristate eState = GTK_ACCESSIBLE_TRISTATE_FALSE;
         if (nStates & 
com::sun::star::accessibility::AccessibleStateType::INDETERMINATE)
@@ -298,7 +299,9 @@ static void applyStates(GtkAccessible* pGtkAccessible,
             eState = GTK_ACCESSIBLE_TRISTATE_TRUE;
         gtk_accessible_update_state(pGtkAccessible, 
GTK_ACCESSIBLE_STATE_CHECKED, eState, -1);
     }
-    else if (nRole == 
com::sun::star::accessibility::AccessibleRole::TOGGLE_BUTTON)
+
+    const sal_Int16 nRole = xContext->getAccessibleRole();
+    if (nRole == com::sun::star::accessibility::AccessibleRole::TOGGLE_BUTTON)
     {
         GtkAccessibleTristate eState = GTK_ACCESSIBLE_TRISTATE_FALSE;
         if (nStates & 
com::sun::star::accessibility::AccessibleStateType::INDETERMINATE)

Reply via email to