Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /************************************************************************* |
michael@0 | 2 | * |
michael@0 | 3 | * File Name (Accessible2.idl) |
michael@0 | 4 | * |
michael@0 | 5 | * IAccessible2 IDL Specification |
michael@0 | 6 | * |
michael@0 | 7 | * Copyright (c) 2007, 2013 Linux Foundation |
michael@0 | 8 | * Copyright (c) 2006 IBM Corporation |
michael@0 | 9 | * Copyright (c) 2000, 2006 Sun Microsystems, Inc. |
michael@0 | 10 | * All rights reserved. |
michael@0 | 11 | * |
michael@0 | 12 | * |
michael@0 | 13 | * Redistribution and use in source and binary forms, with or without |
michael@0 | 14 | * modification, are permitted provided that the following conditions |
michael@0 | 15 | * are met: |
michael@0 | 16 | * |
michael@0 | 17 | * 1. Redistributions of source code must retain the above copyright |
michael@0 | 18 | * notice, this list of conditions and the following disclaimer. |
michael@0 | 19 | * |
michael@0 | 20 | * 2. Redistributions in binary form must reproduce the above |
michael@0 | 21 | * copyright notice, this list of conditions and the following |
michael@0 | 22 | * disclaimer in the documentation and/or other materials |
michael@0 | 23 | * provided with the distribution. |
michael@0 | 24 | * |
michael@0 | 25 | * 3. Neither the name of the Linux Foundation nor the names of its |
michael@0 | 26 | * contributors may be used to endorse or promote products |
michael@0 | 27 | * derived from this software without specific prior written |
michael@0 | 28 | * permission. |
michael@0 | 29 | * |
michael@0 | 30 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
michael@0 | 31 | * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
michael@0 | 32 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@0 | 33 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
michael@0 | 34 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
michael@0 | 35 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@0 | 36 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
michael@0 | 37 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
michael@0 | 38 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
michael@0 | 39 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
michael@0 | 40 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
michael@0 | 41 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
michael@0 | 42 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 43 | * |
michael@0 | 44 | * This BSD License conforms to the Open Source Initiative "Simplified |
michael@0 | 45 | * BSD License" as published at: |
michael@0 | 46 | * http://www.opensource.org/licenses/bsd-license.php |
michael@0 | 47 | * |
michael@0 | 48 | * IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 |
michael@0 | 49 | * mark may be used in accordance with the Linux Foundation Trademark |
michael@0 | 50 | * Policy to indicate compliance with the IAccessible2 specification. |
michael@0 | 51 | * |
michael@0 | 52 | ************************************************************************/ |
michael@0 | 53 | |
michael@0 | 54 | /** @mainpage |
michael@0 | 55 | |
michael@0 | 56 | @section _interfaces Interfaces |
michael@0 | 57 | IAccessible2\n |
michael@0 | 58 | IAccessible2_2\n |
michael@0 | 59 | IAccessibleAction\n |
michael@0 | 60 | IAccessibleApplication\n |
michael@0 | 61 | IAccessibleComponent\n |
michael@0 | 62 | IAccessibleDocument\n |
michael@0 | 63 | IAccessibleEditableText\n |
michael@0 | 64 | IAccessibleHypertext\n |
michael@0 | 65 | IAccessibleHypertext2\n |
michael@0 | 66 | IAccessibleHyperlink\n |
michael@0 | 67 | IAccessibleImage\n |
michael@0 | 68 | IAccessibleRelation\n |
michael@0 | 69 | IAccessibleTable [Deprecated]\n |
michael@0 | 70 | IAccessibleTable2\n |
michael@0 | 71 | IAccessibleTableCell\n |
michael@0 | 72 | IAccessibleText\n |
michael@0 | 73 | IAccessibleText2\n |
michael@0 | 74 | IAccessibleValue |
michael@0 | 75 | |
michael@0 | 76 | @section _structs Structs |
michael@0 | 77 | IA2Locale\n |
michael@0 | 78 | IA2TableModelChange\n |
michael@0 | 79 | IA2TextSegment |
michael@0 | 80 | |
michael@0 | 81 | @section _enums Enums |
michael@0 | 82 | ::IA2Actions values are predefined actions for use when implementing support for HTML5 media.\n |
michael@0 | 83 | ::IA2CoordinateType values define the requested coordinate type (screen or parent window).\n |
michael@0 | 84 | ::IA2EventID values identify events.\n |
michael@0 | 85 | ::IA2Role values defines roles which are in addition to the existing MSAA roles.\n |
michael@0 | 86 | ::IA2ScrollType values define where to place an object or substring on the screen.\n |
michael@0 | 87 | ::IA2States values define states which are in addition to the existing MSAA states.\n |
michael@0 | 88 | ::IA2TableModelChangeType values describe the kinds of changes made to a table (insert, delete, update).\n |
michael@0 | 89 | ::IA2TextBoundaryType values define the requested text unit (character, word, sentence, line, paragraph).\n |
michael@0 | 90 | ::IA2TextSpecialOffsets values define special offsets for use in the text interfaces. |
michael@0 | 91 | |
michael@0 | 92 | @section _constants Constants |
michael@0 | 93 | @ref grpRelations |
michael@0 | 94 | |
michael@0 | 95 | @section _misc Miscellaneous |
michael@0 | 96 | @ref _licensePage "BSD License"\n |
michael@0 | 97 | @ref _generalInfo "General Information"\n |
michael@0 | 98 | |
michael@0 | 99 | @page _licensePage BSD License |
michael@0 | 100 | %IAccessible2 IDL Specification |
michael@0 | 101 | |
michael@0 | 102 | Copyright (c) 2007, 2013 Linux Foundation\n |
michael@0 | 103 | Copyright (c) 2006 IBM Corporation\n |
michael@0 | 104 | Copyright (c) 2000, 2006 Sun Microsystems, Inc.\n |
michael@0 | 105 | All rights reserved. |
michael@0 | 106 | |
michael@0 | 107 | Redistribution and use in source and binary forms, with or without |
michael@0 | 108 | modification, are permitted provided that the following conditions |
michael@0 | 109 | are met: |
michael@0 | 110 | |
michael@0 | 111 | 1. Redistributions of source code must retain the above copyright |
michael@0 | 112 | notice, this list of conditions and the following disclaimer. |
michael@0 | 113 | |
michael@0 | 114 | 2. Redistributions in binary form must reproduce the above |
michael@0 | 115 | copyright notice, this list of conditions and the following |
michael@0 | 116 | disclaimer in the documentation and/or other materials |
michael@0 | 117 | provided with the distribution. |
michael@0 | 118 | |
michael@0 | 119 | 3. Neither the name of the Linux Foundation nor the names of its |
michael@0 | 120 | contributors may be used to endorse or promote products |
michael@0 | 121 | derived from this software without specific prior written |
michael@0 | 122 | permission. |
michael@0 | 123 | |
michael@0 | 124 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
michael@0 | 125 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, |
michael@0 | 126 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
michael@0 | 127 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
michael@0 | 128 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
michael@0 | 129 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
michael@0 | 130 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
michael@0 | 131 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
michael@0 | 132 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
michael@0 | 133 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
michael@0 | 134 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
michael@0 | 135 | OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
michael@0 | 136 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 137 | |
michael@0 | 138 | This BSD License conforms to the Open Source Initiative "Simplified |
michael@0 | 139 | BSD License" as published at: |
michael@0 | 140 | http://www.opensource.org/licenses/bsd-license.php |
michael@0 | 141 | |
michael@0 | 142 | %IAccessible2 is a trademark of the Linux Foundation. The %IAccessible2 |
michael@0 | 143 | mark may be used in accordance with the |
michael@0 | 144 | <a href="http://www.linuxfoundation.org/collaborate/workgroups/accessibility/trademark-policy"> |
michael@0 | 145 | Linux Foundation Trademark Policy</a> to indicate compliance with the %IAccessible2 specification. |
michael@0 | 146 | |
michael@0 | 147 | @page _generalInfo General Information |
michael@0 | 148 | The following information is applicable to two or more interfaces. |
michael@0 | 149 | |
michael@0 | 150 | @ref _errors\n |
michael@0 | 151 | @ref _memory\n |
michael@0 | 152 | @ref _arrayConsideration\n |
michael@0 | 153 | @ref _indexes\n |
michael@0 | 154 | @ref _enums\n |
michael@0 | 155 | @ref _specialOffsets\n |
michael@0 | 156 | @ref _dicoveringInterfaces\n |
michael@0 | 157 | @ref _changingInterfaces\n |
michael@0 | 158 | @ref _applicationInfo\n |
michael@0 | 159 | @ref _childIDs\n |
michael@0 | 160 | @ref _variants\n |
michael@0 | 161 | @ref _iaaction-iahyperlink\n |
michael@0 | 162 | @ref _trademark |
michael@0 | 163 | |
michael@0 | 164 | @section _errors Error Handling |
michael@0 | 165 | HRESULT values are defined by the Microsoft® Win32® API. For more information, refer to |
michael@0 | 166 | <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa378137%28v=vs.85%29.aspx"> |
michael@0 | 167 | Interpreting HRESULT Values</a> in MSDN®. |
michael@0 | 168 | |
michael@0 | 169 | Note that the S_FALSE return value is considered a non-error value and the |
michael@0 | 170 | SUCCEEDED macro will return TRUE. S_FALSE is used when there is no failure |
michael@0 | 171 | but there was nothing valid to return, e.g. in IAccessible2::attributes when |
michael@0 | 172 | there are no attributes. When S_FALSE is returned [out] pointer types should |
michael@0 | 173 | be NULL and [out] longs should generally be 0, but sometimes -1 is used such |
michael@0 | 174 | as IAccessible2::indexInParent, IAccessibleText::caretOffset, and |
michael@0 | 175 | IAccessibleHypertext::hyperlinkIndex. |
michael@0 | 176 | |
michael@0 | 177 | Note that for BSTR [out] variables common COM practice is that the server does |
michael@0 | 178 | the SysAllocString and the client does the SysFreeString. Also note that when |
michael@0 | 179 | NULL is returned there is no need for the client to call SysFreeString. Please |
michael@0 | 180 | refer to the documentation for each method for more details regarding error handling. |
michael@0 | 181 | |
michael@0 | 182 | @section _memory Memory Management |
michael@0 | 183 | The following memory management issues should be considered: |
michael@0 | 184 | @li Although [out] BSTR variables are declared by the client, their space is |
michael@0 | 185 | allocated by the server. They need to be freed with SysFreeString by the |
michael@0 | 186 | client at end of life; the same is true when BSTRs are used in structs or |
michael@0 | 187 | arrays which are passed to the server. |
michael@0 | 188 | @li If there is no valid [out] BSTR to return, the server should return S_FALSE and |
michael@0 | 189 | assign NULL to the output, e.g. *theOutBSTR = NULL;. |
michael@0 | 190 | @li COM interfaces need to be referenced with AddRef when used and dereferenced |
michael@0 | 191 | with Release at end of life. |
michael@0 | 192 | @li Single [out] longs, HWNDs, booleans, and structs are declared by the caller |
michael@0 | 193 | and passed by reference. The marshaller does all the memory management. |
michael@0 | 194 | |
michael@0 | 195 | The following articles may be helpful for understanding memory management issues: |
michael@0 | 196 | @li An article by Don Box in a |
michael@0 | 197 | <a href="http://www.microsoft.com/msj/1196/activex1196.aspx">Q & A section</a> |
michael@0 | 198 | of the November 1996 edition of the Microsoft Systems Journal. |
michael@0 | 199 | @li A posting to a CodeGuru forum, |
michael@0 | 200 | <a href="http://www.codeguru.com/forum/showthread.php?t=364511">Windows SDK |
michael@0 | 201 | String: What are the rules for BSTR allocation and deallocation?</a> |
michael@0 | 202 | |
michael@0 | 203 | @subsection _arrayConsideration Special Consideration when using Arrays |
michael@0 | 204 | There are several methods which return arrays. In the case of IAccessible2::relations |
michael@0 | 205 | and IAccessibleRelation::targets the client must allocate and free the arrays. |
michael@0 | 206 | |
michael@0 | 207 | For the remaining methods which return arrays, the server must allocate the array |
michael@0 | 208 | and the client must free the array when no longer needed. These methods are |
michael@0 | 209 | IAccessible2::extendedStates, IAccessible2::localizedExtendedStates, |
michael@0 | 210 | IAccessible2_2::relationTargetsOfType, IAccessibleAction::keyBinding, |
michael@0 | 211 | IAccessibleHypertext2::hyperlinks, IAccessibleTable::selectedChildren, |
michael@0 | 212 | IAccessibleTable::selectedColumns, IAccessibleTable::selectedRows, |
michael@0 | 213 | IAccessibleTable2::selectedCells, IAccessibleTable2::selectedColumns, |
michael@0 | 214 | IAccessibleTable2::selectedRows, IAccessibleTableCell::columnHeaderCells, |
michael@0 | 215 | and IAccessibleTableCell::rowHeaderCells. |
michael@0 | 216 | For those methods, the server must allocate both the top level array and any storage |
michael@0 | 217 | associated with it, e.g. for BSTRs. The server must allocate the arrays with |
michael@0 | 218 | CoTaskMemAlloc and any BSTRs with SysAllocString. The client must use CoTaskMemFree |
michael@0 | 219 | to free the array and any BSTRs must be freed with SysFreeString. |
michael@0 | 220 | |
michael@0 | 221 | Also, the IDL for IAccessible2::extendedStates, IAccessible2::localizedExtendedStates, |
michael@0 | 222 | IAccessibleAction::keyBinding, IAccessibleTable::selectedChildren, |
michael@0 | 223 | IAccessibleTable::selectedColumns, and IAccessibleTable::selectedRows includes an |
michael@0 | 224 | extraneous [in] parameter for the caller to specify the max size of the array. |
michael@0 | 225 | This parameter will be ignored by the COM server. |
michael@0 | 226 | |
michael@0 | 227 | @section _indexes Zero and One Based Indexes |
michael@0 | 228 | Unless otherwise specified all offsets and indexes are 0 based. |
michael@0 | 229 | |
michael@0 | 230 | @section _enums Enums |
michael@0 | 231 | Note that enums start at 0. |
michael@0 | 232 | |
michael@0 | 233 | @section _specialOffsets Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods |
michael@0 | 234 | IAccessibleText and IAccessibleEditableText can use one or more of the following |
michael@0 | 235 | special offset values. They are defined in the ::IA2TextSpecialOffsets enum. |
michael@0 | 236 | @li Using ::IA2_TEXT_OFFSET_LENGTH (-1) as an offset in any of the IAccessibleText or |
michael@0 | 237 | IAccessibleEditableText methods is the same as specifying the length of the string. |
michael@0 | 238 | @li Using ::IA2_TEXT_OFFSET_CARET (-2) as an offset for IAccessibleText::textBeforeOffset, |
michael@0 | 239 | IAccessibleText::textAtOffset, and IAccessibleText::textAfterOffset indicates that the |
michael@0 | 240 | text related to the physical location of the caret should be used. This is needed for |
michael@0 | 241 | applications that consider the character offset of the end of one line (as reached by |
michael@0 | 242 | pressing the End key) the same as the offset of the first character on the next line. |
michael@0 | 243 | Since the same offset is associated with two different lines a special means is needed |
michael@0 | 244 | to fetch text from the line where the caret is physically located. |
michael@0 | 245 | |
michael@0 | 246 | @section _dicoveringInterfaces Discovery of Interfaces |
michael@0 | 247 | In general AT (Assistive Technology) should try IAccessible2 interfaces, followed by using |
michael@0 | 248 | the MSAA (Microsoft® Active Accessibility®) interfaces. (In cases where the an application |
michael@0 | 249 | is known to have custom interfaces which provide information not supplied by IAccessible2 |
michael@0 | 250 | or MSAA, then those custom interfaces can be used.) The AT can then, by default, support |
michael@0 | 251 | unknown IAccessible2/MSAA applications, without the application developers having to request |
michael@0 | 252 | AT vendors for support on an individual application by application basis. |
michael@0 | 253 | |
michael@0 | 254 | When you have a reference to an IAccessible and require a reference to an IAccessible2 use |
michael@0 | 255 | QueryService as follows: |
michael@0 | 256 | @code |
michael@0 | 257 | // pAcc is a reference to the accessible object's IAccessible interface. |
michael@0 | 258 | IServiceProvider *pService = NULL; |
michael@0 | 259 | hr = pAcc->QueryInterface(IID_IServiceProvider, (void **)&pService); |
michael@0 | 260 | if(SUCCEEDED(hr)) { |
michael@0 | 261 | IAccessible2 *pIA2 = NULL; |
michael@0 | 262 | hr = pService->QueryService(IID_IAccessible, IID_IAccessible2, (void**)&pIA2); |
michael@0 | 263 | if (SUCCEEDED(hr) && pIA2) { |
michael@0 | 264 | // The control supports IAccessible2. |
michael@0 | 265 | // pIA2 is the reference to the accessible object's IAccessible2 interface. |
michael@0 | 266 | } |
michael@0 | 267 | } |
michael@0 | 268 | @endcode |
michael@0 | 269 | |
michael@0 | 270 | @section _changingInterfaces Changing between Accessible Interfaces |
michael@0 | 271 | Note that developers must always implement MSAA's IAccessible and, if needed, some |
michael@0 | 272 | of the interfaces in the set of IAccessible2 interfaces. Although the IAccessible2 |
michael@0 | 273 | IDL is coded such that IAccessible2 is a subclass of MSAA's IAccessible, none of |
michael@0 | 274 | MSAA's IAccessible methods are redefined by IAccessible2. |
michael@0 | 275 | |
michael@0 | 276 | QueryService must be used to switch from a reference to an MSAA IAccessible interface |
michael@0 | 277 | to another interface. This has been |
michael@0 | 278 | <a href="http://www.atia.org/files/public/Introducing_IAccessibleEx.doc"> |
michael@0 | 279 | documented</a> and the pertinent facts have been extracted below: |
michael@0 | 280 | |
michael@0 | 281 | @par |
michael@0 | 282 | Why use QueryService instead of just using QueryInterface to get IAccessibleEx |
michael@0 | 283 | directly? The reason is that since MSAA 2.0, clients don't talk to a server's |
michael@0 | 284 | IAccessible interface directly; instead they talk to an intermediate MSAA-provided |
michael@0 | 285 | wrapper that calls through to the original IAccessible. This wrapper provides services |
michael@0 | 286 | such as implementing IDispatch, supplying information from MSAA 2.0's Dynamic Annotation |
michael@0 | 287 | service, and scaling locations when running on Windows Vista with DPI scaling enabled. |
michael@0 | 288 | QueryService is the supported way to expose additional interfaces from an existing |
michael@0 | 289 | IAccessible and was originally used by MSHTML to expose IHTMLElement objects corresponding |
michael@0 | 290 | to IAccessibles. QueryService is often more convenient for servers to implement than |
michael@0 | 291 | QueryInterface because it does not have the same requirements for preserving object |
michael@0 | 292 | identity or symmetry/transitivity as QueryInterface, so QueryService allows servers to |
michael@0 | 293 | easily implement the interface on the same object or a separate object. The latter is |
michael@0 | 294 | often hard to do with QueryInterface unless the original object supports aggregation. |
michael@0 | 295 | |
michael@0 | 296 | Two related references in MSDN® are: |
michael@0 | 297 | @li <a href="http://msdn.microsoft.com/en-us/library/ms696078(VS.85).aspx"> |
michael@0 | 298 | "Using QueryService to expose a native object model interface for an IAccessible object"</a> |
michael@0 | 299 | @li <a href="http://msdn.microsoft.com/en-us/library/ms528415.aspx#acc_obj"> |
michael@0 | 300 | "Accessing the Internet Explorer Object Associated with an Accessible Object"</a> |
michael@0 | 301 | |
michael@0 | 302 | Based on this information from Microsoft, QueryService must be used to switch back and forth |
michael@0 | 303 | between a reference to an MSAA IAccessible interface and any of the IAccessible2 interfaces. |
michael@0 | 304 | |
michael@0 | 305 | Regarding switching between any of the IAccessible2 interfaces, applications implementing |
michael@0 | 306 | IAccessible2 should implement the IAccessible2 interfaces on a single object since ATs |
michael@0 | 307 | will be using QueryInterface to switch between the IAccessilbe2 interfaces. Implementing |
michael@0 | 308 | the IAccessible2 interfaces on separate objects would require the use of QueryService. |
michael@0 | 309 | There is one exception, IAccessibleApplication can be implemented on a separate object so |
michael@0 | 310 | its common code doesn't have to be included in each accessible object. ATs should use |
michael@0 | 311 | QueryService to access IAccessibleApplication. |
michael@0 | 312 | |
michael@0 | 313 | @section _applicationInfo Access to Information about the Application |
michael@0 | 314 | Servers implementing IAccessible2 should provide access to the IAccessibleApplication |
michael@0 | 315 | interface via QueryService from any object so that ATs can easily determine specific |
michael@0 | 316 | information about the application such as its name or version. |
michael@0 | 317 | |
michael@0 | 318 | @section _childIDs Child IDs |
michael@0 | 319 | The IAccessible2 interfaces do not support child IDs, i.e. simple child elements. |
michael@0 | 320 | Full accessible objects must be created for each object that supports IAccessible2. |
michael@0 | 321 | Therefore MSAA's get_accChild should never return a child ID (other than CHILDID_SELF) |
michael@0 | 322 | for an object that implements any of the IAccessible2 interfaces. |
michael@0 | 323 | |
michael@0 | 324 | Microsoft's UI Automation specification has the same limitation and this was resolved |
michael@0 | 325 | in the UI Automation Express specification by adding IAccessibleEx::GetObjectForChild |
michael@0 | 326 | and IAccessibleEx::GetIAccessiblePair. These methods allow mapping back and forth |
michael@0 | 327 | between an IAccessibleEx and an {IAccessible, Child ID} pair. A future version of |
michael@0 | 328 | IAccessible2 may include similar methods to map back and forth between an IAccessible2 |
michael@0 | 329 | and an {IAccessible, Child ID} pair. |
michael@0 | 330 | |
michael@0 | 331 | @section _variants VARIANTs |
michael@0 | 332 | Some methods return a VARIANT. Implementers need to make sure that the return type is |
michael@0 | 333 | specified, i.e. VT_I4, VT_IDISPATCH, etc. The methods that return VARIANTs are |
michael@0 | 334 | IAccessibleHyperlink::anchor, IAccessibleHyperlink::anchorTarget, IAccessibleValue::currentValue, |
michael@0 | 335 | IAccessibleValue::maximumValue, IAccessibleValue::minimumValue. |
michael@0 | 336 | |
michael@0 | 337 | @section _iaaction-iahyperlink IAccessibleHyperlink as subclass of IAccessibleAction |
michael@0 | 338 | In this version of the IDL, IAccessibleHyperlink is a subclass of IAccessibleAction. |
michael@0 | 339 | However, there is no practical need for that inheritance and in some cases, such as |
michael@0 | 340 | an image map of smart tags, it doesn't make sense because such an image map doesn't |
michael@0 | 341 | have actionable objects; it's the secondary smart tags that are actionable. As a |
michael@0 | 342 | result, implementations should not rely on the inheritance as it may be removed in |
michael@0 | 343 | a later version of the IDL. |
michael@0 | 344 | |
michael@0 | 345 | @section _trademark Trademark Attribution |
michael@0 | 346 | The names of actual companies and products mentioned herein may be the trademarks of |
michael@0 | 347 | their respective owners. In particular, Active Accessibility, Microsoft, MSDN, and Win32 |
michael@0 | 348 | are trademarks of the Microsoft group of companies in the U.S.A. and/or other countries. |
michael@0 | 349 | |
michael@0 | 350 | **/ |
michael@0 | 351 | |
michael@0 | 352 | import "objidl.idl"; |
michael@0 | 353 | import "oaidl.idl"; |
michael@0 | 354 | import "oleacc.idl"; |
michael@0 | 355 | import "AccessibleRelation.idl"; |
michael@0 | 356 | import "AccessibleStates.idl"; |
michael@0 | 357 | import "IA2CommonTypes.idl"; |
michael@0 | 358 | |
michael@0 | 359 | /** A structure defining the locale of an accessible object. |
michael@0 | 360 | |
michael@0 | 361 | IAccessible2::locale returns this struct. |
michael@0 | 362 | */ |
michael@0 | 363 | typedef struct IA2Locale { |
michael@0 | 364 | BSTR language; ///< ISO 639-1 Alpha-2 two character language code |
michael@0 | 365 | BSTR country; ///< ISO 3166-1 Alpha-2 two character country code |
michael@0 | 366 | BSTR variant; ///< Application specific variant of the locale |
michael@0 | 367 | } IA2Locale; |
michael@0 | 368 | |
michael@0 | 369 | /** @brief This interface exposes the primary set of information about an |
michael@0 | 370 | IAccessible2 enabled accessible object. |
michael@0 | 371 | |
michael@0 | 372 | This interface must always be provided for objects that support some |
michael@0 | 373 | portion of the collection of the %IAccessible2 interfaces. |
michael@0 | 374 | |
michael@0 | 375 | Please refer to @ref _changingInterfaces "Changing between Accessible Interfaces" |
michael@0 | 376 | for special considerations related to use of the MSAA IAccessible interface and |
michael@0 | 377 | the set of %IAccessible2 interfaces. |
michael@0 | 378 | */ |
michael@0 | 379 | [object, uuid(E89F726E-C4F4-4c19-BB19-B647D7FA8478)] |
michael@0 | 380 | interface IAccessible2 : IAccessible |
michael@0 | 381 | { |
michael@0 | 382 | |
michael@0 | 383 | /** @brief Returns the number of accessible relations for this object. |
michael@0 | 384 | @param [out] nRelations |
michael@0 | 385 | @retval S_OK |
michael@0 | 386 | */ |
michael@0 | 387 | [propget] HRESULT nRelations |
michael@0 | 388 | ( |
michael@0 | 389 | [out, retval] long *nRelations |
michael@0 | 390 | ); |
michael@0 | 391 | |
michael@0 | 392 | /** @brief Returns one accessible relation for this object. |
michael@0 | 393 | @param [in] relationIndex |
michael@0 | 394 | 0 based |
michael@0 | 395 | @param [out] relation |
michael@0 | 396 | @retval S_OK |
michael@0 | 397 | @retval E_INVALIDARG if bad [in] passed |
michael@0 | 398 | */ |
michael@0 | 399 | [propget] HRESULT relation |
michael@0 | 400 | ( |
michael@0 | 401 | [in] long relationIndex, |
michael@0 | 402 | [out, retval] IAccessibleRelation **relation |
michael@0 | 403 | ); |
michael@0 | 404 | |
michael@0 | 405 | /** @brief Returns multiple accessible relations for this object. |
michael@0 | 406 | @param [in] maxRelations |
michael@0 | 407 | maximum size of the array allocated by the client |
michael@0 | 408 | @param [out] relations |
michael@0 | 409 | The array of accessible relation objects. Note that this array is to be |
michael@0 | 410 | allocated by the client and freed when no longer needed. Refer to @ref |
michael@0 | 411 | _arrayConsideration "Special Consideration when using Arrays" for more details. |
michael@0 | 412 | @param [out] nRelations |
michael@0 | 413 | actual number of relations in the returned array (not more than maxRelations) |
michael@0 | 414 | @retval S_OK |
michael@0 | 415 | @retval S_FALSE if there are no relations, nRelations is set to 0 |
michael@0 | 416 | @note As a performant alternative, client code should consider using IAccessible2_2::relationTargetsOfType. |
michael@0 | 417 | */ |
michael@0 | 418 | [propget] HRESULT relations |
michael@0 | 419 | ( |
michael@0 | 420 | [in] long maxRelations, |
michael@0 | 421 | [out, size_is(maxRelations), length_is(*nRelations)] |
michael@0 | 422 | IAccessibleRelation **relations, |
michael@0 | 423 | [out, retval] long *nRelations |
michael@0 | 424 | ); |
michael@0 | 425 | |
michael@0 | 426 | /** @brief Returns the role of an %IAccessible2 object. |
michael@0 | 427 | @param [out] role |
michael@0 | 428 | The role of an %IAccessible2 object. |
michael@0 | 429 | @retval S_OK |
michael@0 | 430 | @note |
michael@0 | 431 | @li For convenience MSAA roles are also passed through this method so the |
michael@0 | 432 | AT doesn't have to also fetch roles through MSAA's get_accRole. |
michael@0 | 433 | @li %IAccessible2 roles should not be passed through MSAA's get_accRole. |
michael@0 | 434 | @li For compatibility with non IAccessible2 enabled ATs, IAccessible2 |
michael@0 | 435 | applications should also add support to get_accRole to return the closest |
michael@0 | 436 | MSAA role or ROLE_SYSTEM_CLIENT (the MSAA defined default role) if there |
michael@0 | 437 | is not a good match. |
michael@0 | 438 | @li This method is missing a [propget] prefix in the IDL. The result is the |
michael@0 | 439 | method is named role in generated C++ code instead of get_role. |
michael@0 | 440 | */ |
michael@0 | 441 | HRESULT role |
michael@0 | 442 | ( |
michael@0 | 443 | [out, retval] long *role |
michael@0 | 444 | ); |
michael@0 | 445 | |
michael@0 | 446 | /** @brief Makes an object visible on the screen. |
michael@0 | 447 | @param [in] scrollType |
michael@0 | 448 | Defines where the object should be placed on the screen. |
michael@0 | 449 | @retval S_OK |
michael@0 | 450 | @retval E_INVALIDARG if bad [in] passed |
michael@0 | 451 | */ |
michael@0 | 452 | HRESULT scrollTo |
michael@0 | 453 | ( |
michael@0 | 454 | [in] enum IA2ScrollType scrollType |
michael@0 | 455 | ); |
michael@0 | 456 | |
michael@0 | 457 | /** @brief Moves the top left of an object to a specified location. |
michael@0 | 458 | |
michael@0 | 459 | @param [in] coordinateType |
michael@0 | 460 | Specifies whether the coordinates are relative to the screen or the parent object. |
michael@0 | 461 | @param [in] x |
michael@0 | 462 | Defines the x coordinate. |
michael@0 | 463 | @param [in] y |
michael@0 | 464 | Defines the y coordinate. |
michael@0 | 465 | @retval S_OK |
michael@0 | 466 | @retval E_INVALIDARG if bad [in] passed |
michael@0 | 467 | */ |
michael@0 | 468 | HRESULT scrollToPoint |
michael@0 | 469 | ( |
michael@0 | 470 | [in] enum IA2CoordinateType coordinateType, |
michael@0 | 471 | [in] long x, |
michael@0 | 472 | [in] long y |
michael@0 | 473 | ); |
michael@0 | 474 | |
michael@0 | 475 | /** @brief Returns grouping information. |
michael@0 | 476 | |
michael@0 | 477 | Used for tree items, list items, tab panel labels, radio buttons, etc. |
michael@0 | 478 | Also used for collections of non-text objects. |
michael@0 | 479 | |
michael@0 | 480 | @param [out] groupLevel |
michael@0 | 481 | 1 based, 0 indicates that this value is not applicable |
michael@0 | 482 | @param [out] similarItemsInGroup |
michael@0 | 483 | 1 based, 0 indicates that this value is not applicable |
michael@0 | 484 | @param [out] positionInGroup |
michael@0 | 485 | 1 based, 0 indicates that this value is not applicable. This is an index |
michael@0 | 486 | into the objects in the current group, not an index into all the objects |
michael@0 | 487 | at the same group level. |
michael@0 | 488 | @retval S_OK if at least one value is valid |
michael@0 | 489 | @retval S_FALSE if no values are valid, [out] values are 0s |
michael@0 | 490 | @note This method is meant to describe the nature of an object's containment |
michael@0 | 491 | structure. It's exposed by trees, tree grids, nested lists, nested menus, |
michael@0 | 492 | but not headings, which uses the level object attribute. It is also exposed |
michael@0 | 493 | by radio buttons (with groupLevel == 0). |
michael@0 | 494 | @note This is normally not implemented on a combo box to describe the nature |
michael@0 | 495 | of its contents. Normally an AT will get that information from its child list |
michael@0 | 496 | object. However, in some cases when non-edit combo boxes are not able to be structured |
michael@0 | 497 | such that the list is a child of the combo box, this method is implemented on |
michael@0 | 498 | the combo box itself. ATs can use this interface if a child list is not found. |
michael@0 | 499 | */ |
michael@0 | 500 | [propget] HRESULT groupPosition |
michael@0 | 501 | ( |
michael@0 | 502 | [out] long *groupLevel, |
michael@0 | 503 | [out] long *similarItemsInGroup, |
michael@0 | 504 | [out, retval] long *positionInGroup |
michael@0 | 505 | ); |
michael@0 | 506 | |
michael@0 | 507 | /** @brief Returns the bit strip containing any IAccessible2 states. |
michael@0 | 508 | |
michael@0 | 509 | The IAccessible2 states are in addition to the MSAA states and are defined in |
michael@0 | 510 | the IA2States enum. |
michael@0 | 511 | |
michael@0 | 512 | @param [out] states |
michael@0 | 513 | @retval S_OK |
michael@0 | 514 | */ |
michael@0 | 515 | [propget] HRESULT states |
michael@0 | 516 | ( |
michael@0 | 517 | [out, retval] AccessibleStates *states |
michael@0 | 518 | ); |
michael@0 | 519 | |
michael@0 | 520 | /** @brief Returns the extended role. |
michael@0 | 521 | |
michael@0 | 522 | An extended role is a role which is dynamically generated by the application. |
michael@0 | 523 | It is not predefined by the %IAccessible2 specification. |
michael@0 | 524 | |
michael@0 | 525 | @param [out] extendedRole |
michael@0 | 526 | @retval S_OK |
michael@0 | 527 | @retval S_FALSE if there is nothing to return, [out] value is NULL |
michael@0 | 528 | */ |
michael@0 | 529 | [propget] HRESULT extendedRole |
michael@0 | 530 | ( |
michael@0 | 531 | [out, retval] BSTR *extendedRole |
michael@0 | 532 | ); |
michael@0 | 533 | |
michael@0 | 534 | /** @brief Returns the localized extended role. |
michael@0 | 535 | @param [out] localizedExtendedRole |
michael@0 | 536 | @retval S_OK |
michael@0 | 537 | @retval S_FALSE if there is nothing to return, [out] value is NULL |
michael@0 | 538 | */ |
michael@0 | 539 | [propget] HRESULT localizedExtendedRole |
michael@0 | 540 | ( |
michael@0 | 541 | [out, retval] BSTR *localizedExtendedRole |
michael@0 | 542 | ); |
michael@0 | 543 | |
michael@0 | 544 | /** @brief Returns the number of extended states. |
michael@0 | 545 | @param [out] nExtendedStates |
michael@0 | 546 | @retval S_OK |
michael@0 | 547 | */ |
michael@0 | 548 | [propget] HRESULT nExtendedStates |
michael@0 | 549 | ( |
michael@0 | 550 | [out, retval] long *nExtendedStates |
michael@0 | 551 | ); |
michael@0 | 552 | |
michael@0 | 553 | /** @brief Returns the extended states (array of strings). |
michael@0 | 554 | |
michael@0 | 555 | An extended state is a state which is dynamically generated by the application. |
michael@0 | 556 | It is not predefined by the %IAccessible2 specification. |
michael@0 | 557 | |
michael@0 | 558 | @param [in] maxExtendedStates |
michael@0 | 559 | This parameter is ignored. Refer to @ref _arrayConsideration |
michael@0 | 560 | "Special Consideration when using Arrays" for more details. |
michael@0 | 561 | @param [out] extendedStates |
michael@0 | 562 | This array is allocated by the server. The client must free it with CoTaskMemFree. |
michael@0 | 563 | @param [out] nExtendedStates |
michael@0 | 564 | The number of extended states returned; the size of the returned array. |
michael@0 | 565 | @retval S_OK |
michael@0 | 566 | @retval S_FALSE if there are no states, [out] values are NULL and 0 respectively |
michael@0 | 567 | */ |
michael@0 | 568 | [propget] HRESULT extendedStates |
michael@0 | 569 | ( |
michael@0 | 570 | [in] long maxExtendedStates, |
michael@0 | 571 | [out, size_is(,maxExtendedStates), length_is(,*nExtendedStates)] BSTR **extendedStates, |
michael@0 | 572 | [out, retval] long *nExtendedStates |
michael@0 | 573 | ); |
michael@0 | 574 | |
michael@0 | 575 | /** @brief Returns the localized extended states (array of strings). |
michael@0 | 576 | |
michael@0 | 577 | @param [in] maxLocalizedExtendedStates |
michael@0 | 578 | This parameter is ignored. Refer to @ref _arrayConsideration |
michael@0 | 579 | "Special Consideration when using Arrays" for more details. |
michael@0 | 580 | @param [out] localizedExtendedStates |
michael@0 | 581 | This array is allocated by the server. The client must free it with CoTaskMemFree. |
michael@0 | 582 | @param [out] nLocalizedExtendedStates |
michael@0 | 583 | The number of localized extended states returned; the size of the returned array. |
michael@0 | 584 | @retval S_OK |
michael@0 | 585 | @retval S_FALSE if there are no states, [out] values are NULL and 0 respectively |
michael@0 | 586 | */ |
michael@0 | 587 | [propget] HRESULT localizedExtendedStates |
michael@0 | 588 | ( |
michael@0 | 589 | [in] long maxLocalizedExtendedStates, |
michael@0 | 590 | [out, size_is(,maxLocalizedExtendedStates), length_is(,*nLocalizedExtendedStates)] BSTR **localizedExtendedStates, |
michael@0 | 591 | [out, retval] long *nLocalizedExtendedStates |
michael@0 | 592 | ); |
michael@0 | 593 | |
michael@0 | 594 | /** @brief Returns the unique ID. |
michael@0 | 595 | |
michael@0 | 596 | The uniqueID is an identifier for this object, is unique within the |
michael@0 | 597 | current window, and remains the same for the lifetime of the accessible |
michael@0 | 598 | object. |
michael@0 | 599 | |
michael@0 | 600 | The uniqueID is not related to: |
michael@0 | 601 | - the MSAA objectID which is used by the server to disambiguate between |
michael@0 | 602 | IAccessibles per HWND or |
michael@0 | 603 | - the MSAA childID which is used to disambiguate between children being |
michael@0 | 604 | managed by an IAccessible. |
michael@0 | 605 | |
michael@0 | 606 | This value is provided so the AT can have access to a unique runtime persistent |
michael@0 | 607 | identifier even when not handling an event for the object. |
michael@0 | 608 | |
michael@0 | 609 | An example of when this value is useful is if the AT wants to build a cache. |
michael@0 | 610 | The AT could cache the uniqueIDs in addition to other data being cached. |
michael@0 | 611 | When an event is fired the AT could map the uniqueID to its internal model. |
michael@0 | 612 | Thus, if there's a REORDER/SHOW/HIDE event the AT knows which part of the |
michael@0 | 613 | internal structure has been invalidated and can refetch just that part. |
michael@0 | 614 | |
michael@0 | 615 | This value can also be used by an AT to determine when the current control |
michael@0 | 616 | has changed. If the role is the same for two controls that are adjacent in |
michael@0 | 617 | the tab order, this can be used to detect the new control. |
michael@0 | 618 | |
michael@0 | 619 | Another use of this value by an AT is to identify when a grouping object has |
michael@0 | 620 | changed, e.g. when moving from a radio button in one group to a radio button in a |
michael@0 | 621 | different group. |
michael@0 | 622 | |
michael@0 | 623 | One means of implementing this would be to create a factory with a 32 bit number |
michael@0 | 624 | generator and a reuse pool. The number generator would emit numbers starting |
michael@0 | 625 | at 1. Each time an object's life cycle ended, its number would be saved into a |
michael@0 | 626 | reuse pool. The number generator would be used whenever the reuse pool was empty. |
michael@0 | 627 | |
michael@0 | 628 | Another way to create a unique ID is to generate it from a pointer value, e.g. an |
michael@0 | 629 | object's address. That would be unique because no two active objects can use the |
michael@0 | 630 | same allocated memory space. |
michael@0 | 631 | |
michael@0 | 632 | @param [out] uniqueID |
michael@0 | 633 | @retval S_OK |
michael@0 | 634 | */ |
michael@0 | 635 | [propget] HRESULT uniqueID |
michael@0 | 636 | ( |
michael@0 | 637 | [out, retval] long *uniqueID |
michael@0 | 638 | ); |
michael@0 | 639 | |
michael@0 | 640 | /** @brief Returns the window handle for the parent window which contains this object. |
michael@0 | 641 | |
michael@0 | 642 | This is the same window handle which will be passed for any events that occur on the |
michael@0 | 643 | object, but is cached in the accessible object for use when it would be helpful to |
michael@0 | 644 | access the window handle in cases where an event isn't fired on this object. |
michael@0 | 645 | |
michael@0 | 646 | A use case is when a screen reader is grabbing an entire web page on a page load. |
michael@0 | 647 | Without the availability of windowHandle, the AT would have to get the window handle |
michael@0 | 648 | by using WindowFromAccessibleObject on each IAccessible, which is slow because it's |
michael@0 | 649 | implemented by oleacc.dll as a loop which crawls up the ancestor chain and looks for |
michael@0 | 650 | a ROLE_WINDOW object, mapping that back to a window handle. |
michael@0 | 651 | |
michael@0 | 652 | @param [out] windowHandle |
michael@0 | 653 | @retval S_OK |
michael@0 | 654 | */ |
michael@0 | 655 | [propget] HRESULT windowHandle |
michael@0 | 656 | ( |
michael@0 | 657 | [out, retval] HWND *windowHandle |
michael@0 | 658 | ); |
michael@0 | 659 | |
michael@0 | 660 | /** @brief Returns the index of this object in its parent object. |
michael@0 | 661 | @param [out] indexInParent |
michael@0 | 662 | 0 based; -1 indicates there is no parent; the upper bound is the value |
michael@0 | 663 | returned by the parent's IAccessible::get_accChildCount. |
michael@0 | 664 | @retval S_OK |
michael@0 | 665 | @retval S_FALSE if no parent, [out] value is -1 |
michael@0 | 666 | */ |
michael@0 | 667 | [propget] HRESULT indexInParent |
michael@0 | 668 | ( |
michael@0 | 669 | [out, retval] long *indexInParent |
michael@0 | 670 | ); |
michael@0 | 671 | |
michael@0 | 672 | /** @brief Returns the IA2Locale of the accessible object. |
michael@0 | 673 | @param [out] locale |
michael@0 | 674 | @retval S_OK |
michael@0 | 675 | */ |
michael@0 | 676 | [propget] HRESULT locale |
michael@0 | 677 | ( |
michael@0 | 678 | [out, retval] IA2Locale *locale |
michael@0 | 679 | ); |
michael@0 | 680 | |
michael@0 | 681 | /** @brief Returns the attributes specific to this object, such as a cell's formula. |
michael@0 | 682 | @param [out] attributes |
michael@0 | 683 | @retval S_OK |
michael@0 | 684 | @retval S_FALSE returned if there is nothing to return, [out] value is NULL |
michael@0 | 685 | */ |
michael@0 | 686 | [propget] HRESULT attributes |
michael@0 | 687 | ( |
michael@0 | 688 | [out, retval] BSTR *attributes |
michael@0 | 689 | ); |
michael@0 | 690 | |
michael@0 | 691 | } |
michael@0 | 692 |