winaccessibility/source/service/msaaservice_impl.cxx |   90 +++++++++----------
 1 file changed, 44 insertions(+), 46 deletions(-)

New commits:
commit 069c4be9fc0f377415b9e4bf08d26f2390c03be5
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Dec 5 10:09:37 2024 +0000
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Dec 6 22:37:34 2024 +0100

    wina11y: Drop always true bShow param
    
    Change-Id: I794e486b3e5e7d341a05cec20cc218dd2cd7e242
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177881
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit 9084c484c0596dc1dc17eef0247bd2475e060d4a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177946

diff --git a/winaccessibility/source/service/msaaservice_impl.cxx 
b/winaccessibility/source/service/msaaservice_impl.cxx
index 8f60decddf1c..43b0b49d8c6b 100644
--- a/winaccessibility/source/service/msaaservice_impl.cxx
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -139,8 +139,8 @@ Sequence< OUString > 
MSAAServiceImpl::getSupportedServiceNames()
    return { "com.sun.star.accessibility.MSAAService" };
 }
 
-static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService > 
&xAccMgr,
-                                             vcl::Window *pWindow, bool bShow)
+static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService>& 
xAccMgr,
+                                             vcl::Window* pWindow)
 {
     assert(pWindow);
 
@@ -184,10 +184,8 @@ static void AccessBridgeHandleExistingWindow(const 
Reference< XMSAAService > &xA
         }
         catch (css::uno::RuntimeException const&)
         {
-            // Ignore show events that throw DisposedExceptions in 
getAccessibleContext(),
-            // but keep revoking these windows in hide(s).
-            if (bShow)
-                return;
+            // Ignore show events that throw DisposedExceptions in 
getAccessibleContext()
+            return;
         }
     }
 
@@ -221,7 +219,7 @@ static void AccessBridgeUpdateOldTopWindows( const 
Reference< XMSAAService > &xA
             if ( xAC.is())
             {
                 if ( !xAC->getAccessibleName().isEmpty() )
-                    AccessBridgeHandleExistingWindow( xAccMgr, pTopWindow, 
true );
+                    AccessBridgeHandleExistingWindow(xAccMgr, pTopWindow);
             }
         }
     }
commit 71c7362988dd823d9dcefc3a2bdaacdc3b054399
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Dec 5 10:04:52 2024 +0000
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Dec 6 22:37:27 2024 +0100

    wina11y: Replace condition by by assert in AccessBridgeHandleExistingWindow
    
    The method only gets called from AccessBridgeUpdateOldTopWindows
    which always passes a non-null window.
    
    Change-Id: I7d6d4effb75c722af6176257b8f296b5a77734cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177880
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>
    (cherry picked from commit db366ebcde00ead8d2a37589c147bd867ed6e455)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177945

diff --git a/winaccessibility/source/service/msaaservice_impl.cxx 
b/winaccessibility/source/service/msaaservice_impl.cxx
index e858d2b367be..8f60decddf1c 100644
--- a/winaccessibility/source/service/msaaservice_impl.cxx
+++ b/winaccessibility/source/service/msaaservice_impl.cxx
@@ -142,67 +142,67 @@ Sequence< OUString > 
MSAAServiceImpl::getSupportedServiceNames()
 static void AccessBridgeHandleExistingWindow(const Reference< XMSAAService > 
&xAccMgr,
                                              vcl::Window *pWindow, bool bShow)
 {
-    if ( pWindow )
-    {
-        css::uno::Reference< css::accessibility::XAccessible > xAccessible;
+    assert(pWindow);
+
+    css::uno::Reference<css::accessibility::XAccessible> xAccessible;
 
-        SAL_INFO( "iacc2", "Decide whether to register existing window with 
IAccessible2" );
+    SAL_INFO("iacc2", "Decide whether to register existing window with 
IAccessible2");
 
-        // Test for combo box - drop down floating windows first
-        vcl::Window * pParentWindow = pWindow->GetParent();
+    // Test for combo box - drop down floating windows first
+    vcl::Window* pParentWindow = pWindow->GetParent();
 
-        if ( pParentWindow )
+    if (pParentWindow)
+    {
+        try
         {
-            try
+            // The parent window of a combo box floating window should have 
the role COMBO_BOX
+            css::uno::Reference<css::accessibility::XAccessible> 
xParentAccessible(pParentWindow->GetAccessible());
+            if (xParentAccessible.is())
             {
-                // The parent window of a combo box floating window should 
have the role COMBO_BOX
-                css::uno::Reference< css::accessibility::XAccessible > 
xParentAccessible(pParentWindow->GetAccessible());
-                if ( xParentAccessible.is() )
+                css::uno::Reference<css::accessibility::XAccessibleContext> 
xParentAC(xParentAccessible->getAccessibleContext());
+                if (xParentAC.is()
+                    && (css::accessibility::AccessibleRole::COMBO_BOX
+                        == xParentAC->getAccessibleRole()))
                 {
-                    css::uno::Reference< 
css::accessibility::XAccessibleContext > xParentAC( 
xParentAccessible->getAccessibleContext() );
-                    if ( xParentAC.is() && 
(css::accessibility::AccessibleRole::COMBO_BOX == 
xParentAC->getAccessibleRole()) )
+                    // O.k. - this is a combo box floating window 
corresponding to the child of role LIST of the parent.
+                    // Let's not rely on a specific child order, just search 
for the child with the role LIST
+                    sal_Int64 nCount = xParentAC->getAccessibleChildCount();
+                    for (sal_Int64 n = 0; (n < nCount) && !xAccessible.is(); 
n++)
                     {
-                        // O.k. - this is a combo box floating window 
corresponding to the child of role LIST of the parent.
-                        // Let's not rely on a specific child order, just 
search for the child with the role LIST
-                        sal_Int64 nCount = 
xParentAC->getAccessibleChildCount();
-                        for (sal_Int64 n = 0; (n < nCount) && 
!xAccessible.is(); n++)
+                        css::uno::Reference<css::accessibility::XAccessible> 
xChild = xParentAC->getAccessibleChild(n);
+                        if (xChild.is())
                         {
-                            css::uno::Reference< 
css::accessibility::XAccessible > xChild = xParentAC->getAccessibleChild(n);
-                            if ( xChild.is() )
+                            
css::uno::Reference<css::accessibility::XAccessibleContext> xChildAC = 
xChild->getAccessibleContext();
+                            if (xChildAC.is() && 
(css::accessibility::AccessibleRole::LIST == xChildAC->getAccessibleRole()))
                             {
-                                css::uno::Reference< 
css::accessibility::XAccessibleContext > xChildAC = 
xChild->getAccessibleContext();
-                                if ( xChildAC.is() && 
(css::accessibility::AccessibleRole::LIST == xChildAC->getAccessibleRole()) )
-                                {
-                                    xAccessible = xChild;
-                                }
+                                xAccessible = xChild;
                             }
                         }
                     }
                 }
             }
-            catch (css::uno::RuntimeException const&)
-            {
-                // Ignore show events that throw DisposedExceptions in 
getAccessibleContext(),
-                // but keep revoking these windows in hide(s).
-                if (bShow)
-                    return;
-            }
         }
-
-        // We have to rely on the fact that 
Window::GetAccessible()->getAccessibleContext() returns a valid 
XAccessibleContext
-        // also for other menus than menubar or toplevel popup window. 
Otherwise we had to traverse the hierarchy to find the
-        // context object to this menu floater. This makes the call to 
Window->IsMenuFloatingWindow() obsolete.
-        if ( ! xAccessible.is() )
-            xAccessible = pWindow->GetAccessible();
-
-        assert( xAccMgr.is() );
-        if ( xAccessible.is() )
+        catch (css::uno::RuntimeException const&)
         {
-            xAccMgr->handleWindowOpened(
-                    reinterpret_cast<sal_Int64>(xAccessible.get()));
-            SAL_INFO( "iacc2", "Decide whether to register existing window 
with IAccessible2" );
+            // Ignore show events that throw DisposedExceptions in 
getAccessibleContext(),
+            // but keep revoking these windows in hide(s).
+            if (bShow)
+                return;
         }
     }
+
+    // We have to rely on the fact that 
Window::GetAccessible()->getAccessibleContext() returns a valid 
XAccessibleContext
+    // also for other menus than menubar or toplevel popup window. Otherwise 
we had to traverse the hierarchy to find the
+    // context object to this menu floater. This makes the call to 
Window->IsMenuFloatingWindow() obsolete.
+    if (!xAccessible.is())
+        xAccessible = pWindow->GetAccessible();
+
+    assert(xAccMgr.is());
+    if (xAccessible.is())
+    {
+        
xAccMgr->handleWindowOpened(reinterpret_cast<sal_Int64>(xAccessible.get()));
+        SAL_INFO("iacc2", "Decide whether to register existing window with 
IAccessible2");
+    }
 }
 
 /*

Reply via email to