https://bugs.documentfoundation.org/show_bug.cgi?id=168409

--- Comment #11 from Michael Weghorn <[email protected]> ---
(In reply to Michael Weghorn from comment #6)
> For the current development version (git master), what could possibly work
> as a temporary workaround is using the same approach that the Java
> accessibility tests currently use to get access to the
> XAccessible/XAccessibleContext by using the deprecated XVclWindowPeer
> interface and its XVclWindowPeer::getProperty method to request the
> "XAccessible" property, see
> 
>     commit d1a25112bbbe3eb8e1c86840cb853e1694ec96ba
>     Author: Michael Weghorn
>     Date:   Wed Jun 18 17:49:48 2025 +0200
> 
>         java a11y tests: Don't rely on XWindow being XAccessible
> 
> and its commit message for more details.
> 
> But please be aware that this can only be seen as a temporary workaround, as
> that would still rely on accessibility implementation details that are
> subject to further changes in the future.

I just tried this on current master (as of
7b5b9a5f08a69029594c45ba06edb249d0a11ba1), and that indeed works in a quick
test. Updated sample code:

    Sub Main
        With GlobalScope.BasicLibraries
            .loadLibrary("ScriptForge")
            If .hasByName("XrayTool") Then .loadLibrary("XrayTool")
        End With
        doc = CreateScriptService("Calc", ThisComponent)        '      
ScriptForge (Basic) object

        toolbar = doc.Toolbars("standardbar")                           '      
ScriptForge (Basic) object
        toolbar.Visible = True
        layoutmanager = toolbar._LayoutManager                          '      
com.sun.star.comp.framework.LayoutManager
        resourceURL = toolbar.ResourceURL                                      
'       private:resource/toolbar/standardbar

        element = layoutmanager.getElement(resourceURL)         '      
com.sun.star.ui.XUIElement
        accessiblecontext = element.RealInterface.getProperty("XAccessible")   
        '       com.sun.star.accessibility.XAccessibleContext
        settings = element.getSettings(True)                            '      
com.sun.star.container.XIndexAccess

        For i = 0 To accessiblecontext.AccessibleChildCount - 1
            print accessiblecontext.getAccessibleChild(i).AccessibleName,
        Next i
    End Sub



The only change to the code in the initial description is changing

    accessiblecontext = element.RealInterface.AccessibleContext

to

    accessiblecontext = element.RealInterface.getProperty("XAccessible")

But as I said earlier, that can still break again later as a11y API is subject
to change, so if there's a better solution, I wouldn't recommend going with
this temporary workaround.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to