sw/source/core/access/accmap.cxx |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

New commits:
commit c965b4f6fb1e59d05b26930d5fa24df2e7c0e0b5
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Wed Jan 24 14:24:42 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Thu Jan 25 09:42:20 2024 +0100

    sw a11y: Drop special event handling for single selected shape
    
    If shape selecion changed, just send the same
    `AccessibleEventId::SELECTION_CHANGED_ADD` event(s)
    regardless of whether only a single or multiple shapes
    are selected.
    
    This unifies the handling and also prepares for sending the
    event with the correct source and `NewValue` set.
    
    The `AccessibleEventId::SELECTION_CHANGED` doc doesn't
    expclicitly mention whether the source should be the
    selection container (i.e. the parent, which is the doc view
    in the case here) or the selected object, and this is
    currently handled inconsistently across the codebase.
    I tend to think that this event should have the
    container as the source (just as for the
    `AccessibleEventId::SELECTION_CHANGED_ADD` case,
    that will be fixed in an upcoming commit), and this
    is at least what the handling e.g. in the gtk3 a11y
    bridge assumes (s. `AtkListener::notifyEvent`), but
    there seems to be no added value in handling the
    case of a single selected shape specially here in the
    first place.
    
    This may have been inspired by the MSAA/IAccessible
    equivalent, `EVENT_OBJECT_SELECTION` [1]:
    
    > The selection within a container object has changed. (...) This event
    > signals a single selection: either a child is selected in a container
    > that previously did not contain any selected children, or the selection
    > has changed from one child to another.
    
    But then, the selection taking place here might also be from
    multiple objects being selected to just a single one, and
    `SELECTION_CHANGED_REMOVE` is sent for any previously selected
    but now unselected shape anyway, so using
    `AccessibleEventId::SELECTION_CHANGED_ADD` seems more
    consistent to me anyway.
    
    [1] https://learn.microsoft.com/en-us/windows/win32/winauto/event-constants
    
    Change-Id: I1525ed27434bbbb4cf181df2148669c7bc6850b9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162518
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 38c9233ec018..bb0f209bb049 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1495,7 +1495,6 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool 
bInvalidateFocusMode /*=fa
 
     std::vector<::rtl::Reference<::accessibility::AccessibleShape>> 
vecxShapeAdd;
     std::vector<::rtl::Reference<::accessibility::AccessibleShape>> 
vecxShapeRemove;
-    int nCountSelectedShape=0;
 
     vcl::Window *pWin = GetShell()->GetWin();
     bool bFocused = pWin && pWin->HasFocus();
@@ -1545,7 +1544,6 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool 
bInvalidateFocusMode /*=fa
                 {
                     vecxShapeAdd.push_back(pShape->second);
                 }
-                ++nCountSelectedShape;
             }
         }
 
@@ -1564,17 +1562,12 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool 
bInvalidateFocusMode /*=fa
     }
     else
     {
-        short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD;
-        if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 )
-        {
-            nEventID = AccessibleEventId::SELECTION_CHANGED;
-        }
         for (const auto& rpShape : vecxShapeAdd)
         {
             ::accessibility::AccessibleShape *pAccShape = rpShape.get();
             if (pAccShape)
             {
-                pAccShape->CommitChange(nEventID, uno::Any(), uno::Any(), -1);
+                
pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, uno::Any(), 
uno::Any(), -1);
             }
         }
     }

Reply via email to