The screen content is presented to AT as a tree - or a forest, to be more specific - of accessibility objects. Each displayed object that wants to be accessible has to support the com.sun.star.accessibility.XAccessible interface. From this interface, you obtain the actual accessibility object by calling the getAccessibleContext() function. The returned object has to at least support the com.sun.star.accessibility.XAccessibleContext interface.
Accessibility objects are organized in one or more hierarchies, one for each top-level window. So there is a tree for a single top-level window, and a forest when there is more than one top-level window. Internal nodes of a tree are containers of other accessibility objects. A container can represent window frames, toolbars, menus, group shapes, or shapes that contain text. Leaves represent objects like menu entries without sub-menus, buttons, icons, shapes without text, or text paragraphs.
You can move up and down within the tree of a given accessibility object. All functions for obtaining an object's parent and children are part of the com.sun.star.accessibility.XAccessibleContext interface. The ability to move up towards the tree root is provided by the getAccessibleParent() function. Like all other accessibility functions that return a reference to another accessibility object, it returns a reference to a com.sun.star.accessibility.XAccessible object. Moving down the tree towards the leaves requires two functions. The getAccessibleChildCount() function returns the number of children. The getAccessibleChild() function allows you to access any child by specifying the appropriate index.
|Between the call to getAccessibleChildCount() and the final getAccessibleChild() call (when accessing all children one after the other) the number of children may have changed. You can keep track of the number of children by registering as listener and waiting for com.sun.star.accessibility.AccessibleEventId:CHILD events. Additionally, you have to cope with com.sun.star.lang.IndexOutOfBoundsException exceptions that denote bad indices.|
When children are added or removed from an accessibility object, the indices of the new and remaining children may change. You can use the getAccessibleIndexInParent() function to get the current indices.
|Content on this page is licensed under the Public Documentation License (PDL).|