Difference between revisions of "Documentation/DevGuide/Accessibility/Using the Accessibility API"

From Apache OpenOffice Wiki
Jump to: navigation, search
(Initial author Sun Microsystems, Inc.)
 
m
 
(4 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
|NextPage=Documentation/DevGuide/Accessibility/A Simple Screen Reader
 
|NextPage=Documentation/DevGuide/Accessibility/A Simple Screen Reader
 
}}
 
}}
{{DISPLAYTITLE:Using the Accessibility API}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/Accessibility/{{SUBPAGENAME}}}}
When you are writing your own ATs and want to use the UNO accessibility API directly, you must first connect to {{PRODUCTNAME}}. Connecting to {{PRODUCTNAME}} is explained elsewhere in this document. Once a connection is established, the toolkit with its <idl>com.sun.star.awt.XExtendedToolkit</idl> interface can be used to retrieve a list of all currently open top-level windows. From these, you can then get the accessible root nodes of the accessibility object trees associated with the windows. When you register an <idl>com.sun.star.awt.XTopWindowListener</idl> you will then be informed about new top-level windows, as well as top-level windows that have disappeared.
+
{{DISPLAYTITLE:Using the Accessibility API}}
 +
When you are writing your own ATs and want to use the UNO accessibility API directly, you must first connect to {{AOo}}. Connecting to {{AOo}} is explained elsewhere in this document. Once a connection is established, the toolkit with its <idl>com.sun.star.awt.XExtendedToolkit</idl> interface can be used to retrieve a list of all currently open top-level windows. From these, you can then get the accessible root nodes of the accessibility object trees associated with the windows. When you register a <idl>com.sun.star.awt.XTopWindowListener</idl> you will then be informed about new top-level windows, as well as top-level windows that have disappeared.
  
 
With the top-level accessible objects at hand, you can use the Java version of the accessibility API as it is described in detail in the following sections. To be informed about focus changes - so that, for example, a screen reader can track the currently focused object and read it to the user - an AT has to register all non-transient objects of an accessibility tree.  
 
With the top-level accessible objects at hand, you can use the Java version of the accessibility API as it is described in detail in the following sections. To be informed about focus changes - so that, for example, a screen reader can track the currently focused object and read it to the user - an AT has to register all non-transient objects of an accessibility tree.  
Line 12: Line 13:
 
The general operation of a simple AT consists of the following steps:
 
The general operation of a simple AT consists of the following steps:
  
# Connect to {{PRODUCTNAME}}.
+
# Connect to {{AOo}}.
 
# Retrieve the currently visible top-level windows and register as top window listener to keep the list up-to-date.
 
# Retrieve the currently visible top-level windows and register as top window listener to keep the list up-to-date.
 
# Traverse the trees by getting their root elements from each window. See the description of the <idl>com.sun.star.accessibility.XAccessibleContext</idl> for a code example for this.
 
# Traverse the trees by getting their root elements from each window. See the description of the <idl>com.sun.star.accessibility.XAccessibleContext</idl> for a code example for this.
Line 18: Line 19:
 
# If called back with an <idl>com.sun.star.accessibility.AccessibleEventObject</idl> object, then process two kinds of events:
 
# If called back with an <idl>com.sun.star.accessibility.AccessibleEventObject</idl> object, then process two kinds of events:
 
#* Events that denote a state change with either <idlm>com.sun.star.accessibility.AccessibleEventObject:OldValue</idlm> or <idlm>com.sun.star.accessibility.AccessibleEventObject:NewValue</idlm> containing the <idlm>com.sun.star.accessibility.AccessibleStateType:FOCUSED</idlm> constant indicate that the source object of this event got either focused or unfocused.
 
#* Events that denote a state change with either <idlm>com.sun.star.accessibility.AccessibleEventObject:OldValue</idlm> or <idlm>com.sun.star.accessibility.AccessibleEventObject:NewValue</idlm> containing the <idlm>com.sun.star.accessibility.AccessibleStateType:FOCUSED</idlm> constant indicate that the source object of this event got either focused or unfocused.
#* When receiving events of type <idlm>com.sun.star.accessibility.AccessibleEventId:CHILD</idlm>, register as listener at the object that is specified by the event, as well as all of the object's children.
+
#* When receiving events of type <idlm>com.sun.star.accessibility.AccessibleEventId:CHILD</idlm>, register as listener at the object that is specified by the event, as well as all the object's children.
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Accessibility]]
+
 
 +
[[Category:Documentation/Developer's Guide/Accessibility]]

Latest revision as of 17:50, 21 December 2020



When you are writing your own ATs and want to use the UNO accessibility API directly, you must first connect to Apache OpenOffice. Connecting to Apache OpenOffice is explained elsewhere in this document. Once a connection is established, the toolkit with its com.sun.star.awt.XExtendedToolkit interface can be used to retrieve a list of all currently open top-level windows. From these, you can then get the accessible root nodes of the accessibility object trees associated with the windows. When you register a com.sun.star.awt.XTopWindowListener you will then be informed about new top-level windows, as well as top-level windows that have disappeared.

With the top-level accessible objects at hand, you can use the Java version of the accessibility API as it is described in detail in the following sections. To be informed about focus changes - so that, for example, a screen reader can track the currently focused object and read it to the user - an AT has to register all non-transient objects of an accessibility tree.

The general operation of a simple AT consists of the following steps:

  1. Connect to Apache OpenOffice.
  2. Retrieve the currently visible top-level windows and register as top window listener to keep the list up-to-date.
  3. Traverse the trees by getting their root elements from each window. See the description of the com.sun.star.accessibility.XAccessibleContext for a code example for this.
  4. Register each accessible object as com.sun.star.accessibility.XAccessibleEventListener.
  5. If called back with an com.sun.star.accessibility.AccessibleEventObject object, then process two kinds of events:
    • Events that denote a state change with either OldValue or NewValue containing the FOCUSED constant indicate that the source object of this event got either focused or unfocused.
    • When receiving events of type CHILD, register as listener at the object that is specified by the event, as well as all the object's children.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages