winaccessibility/inc/AccContainerEventListener.hxx            |    3 -
 winaccessibility/inc/AccEventListener.hxx                     |    3 -
 winaccessibility/inc/AccObject.hxx                            |    1 
 winaccessibility/inc/AccObjectWinManager.hxx                  |    1 
 winaccessibility/source/service/AccContainerEventListener.cxx |    6 +-
 winaccessibility/source/service/AccEventListener.cxx          |    9 +--
 winaccessibility/source/service/AccObject.cxx                 |   26 ----------
 winaccessibility/source/service/AccObjectWinManager.cxx       |   13 -----
 8 files changed, 10 insertions(+), 52 deletions(-)

New commits:
commit efb4ad90713bcc728a258a87e8ff294f67248cc4
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Aug 20 14:47:18 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Aug 21 07:47:51 2024 +0200

    wina11y: Query new a11y name instead of passing it around
    
    Drop `AccObject::SetName` et al. taking a string param
    with the new a11y name to set in favor of using
    `AccObject::UpdateName` et al. that updates the a11y name
    by querying the current value from the underlying
    `XAccessible`.
    
    This makes it unnecessary to pass the new value
    around when a `AccessibleEventId::NAME_CHANGED`
    event is received, and the new name has to
    already be set on the a11y object at the point in
    time that the event is received.
    
    Change-Id: I1510bde22ef6d1271f6aeaffe245441cd9e11f19
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172145
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/winaccessibility/inc/AccContainerEventListener.hxx 
b/winaccessibility/inc/AccContainerEventListener.hxx
index f15379db3462..b653b48e2518 100644
--- a/winaccessibility/inc/AccContainerEventListener.hxx
+++ b/winaccessibility/inc/AccContainerEventListener.hxx
@@ -88,8 +88,7 @@ public:
     virtual void HandleColumnChangedEvent(
             const css::uno::Any &oldValue, const css::uno::Any &newValue);
 
-    //for name changed event
-    virtual void HandleNameChangedEvent(css::uno::Any name) override;
+    virtual void HandleNameChangedEvent() override;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/winaccessibility/inc/AccEventListener.hxx 
b/winaccessibility/inc/AccEventListener.hxx
index bf8841125d95..256780612964 100644
--- a/winaccessibility/inc/AccEventListener.hxx
+++ b/winaccessibility/inc/AccEventListener.hxx
@@ -50,8 +50,7 @@ public:
     virtual void SAL_CALL
     notifyEvent(const css::accessibility::AccessibleEventObject& aEvent) 
override;
 
-    //for name changed event
-    virtual void HandleNameChangedEvent(css::uno::Any name);
+    virtual void HandleNameChangedEvent();
 
     virtual void HandleChildChangedEvent(css::uno::Any oldValue, css::uno::Any 
newValue);
     virtual void HandleDescriptionChangedEvent();
diff --git a/winaccessibility/inc/AccObject.hxx 
b/winaccessibility/inc/AccObject.hxx
index 81d69082095a..405dfa8f9ac1 100644
--- a/winaccessibility/inc/AccObject.hxx
+++ b/winaccessibility/inc/AccObject.hxx
@@ -103,7 +103,6 @@ public:
     void  DecreaseState( sal_Int64 xState );//call COM interface DecreaseState 
method
     void  IncreaseState( sal_Int64 xState );//call COM interface IncreaseState 
method
 
-    void  SetName( css::uno::Any newName);
     void  SetValue( css::uno::Any pAny );
 
     short GetRole() const;
diff --git a/winaccessibility/inc/AccObjectWinManager.hxx 
b/winaccessibility/inc/AccObjectWinManager.hxx
index 8e50adaf75c4..bbf4e579186f 100644
--- a/winaccessibility/inc/AccObjectWinManager.hxx
+++ b/winaccessibility/inc/AccObjectWinManager.hxx
@@ -113,7 +113,6 @@ public:
     void  SetValue( css::accessibility::XAccessible* pXAcc, css::uno::Any pAny 
);
     void  UpdateValue( css::accessibility::XAccessible* pXAcc );
 
-    void  SetAccName( css::accessibility::XAccessible* pXAcc, css::uno::Any 
newName);
     void  UpdateAccName( css::accessibility::XAccessible* pXAcc );
 
     void  UpdateAccFocus( css::accessibility::XAccessible* newFocus );
diff --git a/winaccessibility/source/service/AccContainerEventListener.cxx 
b/winaccessibility/source/service/AccContainerEventListener.cxx
index f167cf6de766..227893b22d1f 100644
--- a/winaccessibility/source/service/AccContainerEventListener.cxx
+++ b/winaccessibility/source/service/AccContainerEventListener.cxx
@@ -473,7 +473,7 @@ void 
AccContainerEventListener::HandleColumnChangedEvent(const Any& /*oldValue*/
     m_rObjManager.NotifyAccEvent(m_xAccessible.get(), 
UnoMSAAEvent::COLUMN_CHANGED);
 }
 
-void  AccContainerEventListener::HandleNameChangedEvent( Any name )
+void AccContainerEventListener::HandleNameChangedEvent()
 {
     if (GetRole() == AccessibleRole::COMBO_BOX)
     {
@@ -487,12 +487,12 @@ void  AccContainerEventListener::HandleNameChangedEvent( 
Any name )
                 short childrole = mxChildContext->getAccessibleRole();
                 if (childrole == AccessibleRole::TEXT)
                 {
-                    m_rObjManager.SetAccName(mxChild.get(), name);
+                    m_rObjManager.UpdateAccName(mxChild.get());
                 }
             }
         }
     }
-    AccEventListener::HandleNameChangedEvent(name);
+    AccEventListener::HandleNameChangedEvent();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/winaccessibility/source/service/AccEventListener.cxx 
b/winaccessibility/source/service/AccEventListener.cxx
index 4ba5ebfca0c0..3d148c8d13a9 100644
--- a/winaccessibility/source/service/AccEventListener.cxx
+++ b/winaccessibility/source/service/AccEventListener.cxx
@@ -63,7 +63,7 @@ void AccEventListener::notifyEvent(const 
css::accessibility::AccessibleEventObje
             HandleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
             break;
         case AccessibleEventId::NAME_CHANGED:
-            HandleNameChangedEvent(aEvent.NewValue);
+            HandleNameChangedEvent();
             break;
         case AccessibleEventId::DESCRIPTION_CHANGED:
             HandleDescriptionChangedEvent();
@@ -78,9 +78,8 @@ void AccEventListener::notifyEvent(const 
css::accessibility::AccessibleEventObje
 
 /**
  *  handle the NAME_CHANGED event
- *  @param  name        the new name with changed.
  */
-void AccEventListener::HandleNameChangedEvent(Any name)
+void AccEventListener::HandleNameChangedEvent()
 {
     if (m_rObjManager.IsTopWinAcc(m_xAccessible.get()))
     {
@@ -92,7 +91,7 @@ void AccEventListener::HandleNameChangedEvent(Any name)
         }
     }
 
-    m_rObjManager.SetAccName(m_xAccessible.get(), name);
+    m_rObjManager.UpdateAccName(m_xAccessible.get());
     m_rObjManager.NotifyAccEvent(m_xAccessible.get(), 
UnoMSAAEvent::OBJECT_NAMECHANGE);
 }
 
diff --git a/winaccessibility/source/service/AccObject.cxx 
b/winaccessibility/source/service/AccObject.cxx
index 4371d34b0584..b39a6076a13d 100644
--- a/winaccessibility/source/service/AccObject.cxx
+++ b/winaccessibility/source/service/AccObject.cxx
@@ -546,19 +546,6 @@ OUString AccObject::GetMAccessibleValueFromAny(Any pAny)
 
     return strValue;
 }
-/**
-   * Set name property via pAny.
-   * @param pAny New accessible name.
-   * @return
-   */
-void  AccObject::SetName( Any pAny)
-{
-    if( nullptr == m_pIMAcc )
-        return ;
-
-    m_pIMAcc->Put_XAccName( 
o3tl::toW(GetMAccessibleValueFromAny(pAny).getStr()) );
-
-}
 
 /**
 * Get role property via pAny
diff --git a/winaccessibility/source/service/AccObjectWinManager.cxx 
b/winaccessibility/source/service/AccObjectWinManager.cxx
index 2afb59d776db..614df33f2ce0 100644
--- a/winaccessibility/source/service/AccObjectWinManager.cxx
+++ b/winaccessibility/source/service/AccObjectWinManager.cxx
@@ -892,19 +892,6 @@ void  AccObjectWinManager::UpdateValue( XAccessible* pXAcc 
)
         pAccObj->UpdateValue();
 }
 
-/**
-   * Set corresponding com object's name via XAccessible interface and new 
name.
-   * @param pXAcc XAccessible interface.
-   * @param newName new name
-   * @return
-   */
-void  AccObjectWinManager::SetAccName( XAccessible* pXAcc, Any newName)
-{
-    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
-    if( pAccObj )
-        pAccObj->SetName( newName );
-}
-
 /**
    * Judge if a XAccessible object is a container object.
    * @param pAccessible XAccessible interface.
commit a7568b0555b2c616e7cab857400ff6d7911f290d
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Aug 20 14:23:42 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Aug 21 07:47:44 2024 +0200

    wina11y: Use UNKNOWN as fallback for a11y role
    
    Let `AccEventListener::GetRole` return
    `AccessibleRole::UNKNOWN` in case there's no
    accessible object instead of -1.
    
    The latter doesn't map to any a11y role.
    
    This doesn't make any difference in practice right now,
    as none of the callers explicitly handles the UNKNOWN
    role either, but could e.g. simplify switching
    `AccessibleRole` from an integer type to an enum in the
    future.
    
    Change-Id: I8b0d78642621ce997d55d12905e31e7978962ec7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172124
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/winaccessibility/source/service/AccEventListener.cxx 
b/winaccessibility/source/service/AccEventListener.cxx
index cb59ad90a878..4ba5ebfca0c0 100644
--- a/winaccessibility/source/service/AccEventListener.cxx
+++ b/winaccessibility/source/service/AccEventListener.cxx
@@ -233,7 +233,7 @@ short AccEventListener::GetRole()
     {
         return xContext->getAccessibleRole();
     }
-    return -1;
+    return AccessibleRole::UNKNOWN;
 }
 
 /**
commit ead6cb42592880012ab12aada57cf1165ef084e4
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Tue Aug 20 14:02:43 2024 +0100
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Wed Aug 21 07:47:37 2024 +0200

    wina11y: Drop special a11y name handling for paragraph/block quote
    
    The ARIA spec prohibits setting an a11y name for paragraphs [1],
    which may have been the reason why an empty name was always
    explicitly set in `AccObject::UpdateName`, and that was just
    extended to apply for the block quote role when that new role
    was added in
    
        commit f44eae4912e8f2ba34d93a71a609473df976a2cb
        Author: Michael Weghorn <m.wegh...@posteo.de>
        Date:   Fri Oct 27 14:53:59 2023 +0200
    
            tdf#135586 a11y: Add a new BLOCK_QUOTE a11y role
    
    Wile it makes sense to always report an empty a11y
    name for paragraphs, ensuring that is not the task of the
    platform a11y bridge, but it should be done properly in
    the underlying `XAccessibleContext` implementation already,
    as this is not specific to Windows/IAccessible2.
    
    At least paragraphs in Writer already report an empty
    a11y name. If anything else doesn't, that should be
    fixed there.
    
    [1] https://w3c.github.io/aria/#paragraph
    
    Change-Id: I7ffd42acc02fc41cf73174e60c32e8938161c4d3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172123
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    Tested-by: Jenkins

diff --git a/winaccessibility/source/service/AccObject.cxx 
b/winaccessibility/source/service/AccObject.cxx
index dd9144504ea7..4371d34b0584 100644
--- a/winaccessibility/source/service/AccObject.cxx
+++ b/winaccessibility/source/service/AccObject.cxx
@@ -364,20 +364,9 @@ void AccObject::ImplInitializeCreateObj()
 void  AccObject::UpdateName( )
 {
     if (!m_pIMAcc)
-    {
         return;
-    }
-
-    //IAccessibility2 Implementation 2009-----
-    if (m_accRole == AccessibleRole::PARAGRAPH || m_accRole == 
AccessibleRole::BLOCK_QUOTE)
-    {
-        m_pIMAcc->Put_XAccName(L"");
-    }
-    //-----IAccessibility2 Implementation 2009
-    else
-        
m_pIMAcc->Put_XAccName(o3tl::toW(m_xAccContextRef->getAccessibleName().getStr()));
 
-    return ;
+    
m_pIMAcc->Put_XAccName(o3tl::toW(m_xAccContextRef->getAccessibleName().getStr()));
 }
 
 /**

Reply via email to