1 /*
   2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  * Glue routines called by Windows AT into the WindowsAccessBridge dll
  28  */
  29 
  30 #include "AccessBridgeDebug.h"
  31 #include "AccessBridgeWindowsEntryPoints.h"
  32 #include "WinAccessBridge.h"
  33 #include "accessBridgeResource.h"
  34 
  35 #include <windows.h>
  36 #include <jni.h>
  37 
  38 
  39 extern WinAccessBridge *theWindowsAccessBridge;
  40 extern HWND theDialogWindow;
  41 
  42 #ifdef __cplusplus
  43 extern "C" {
  44 #endif
  45 
  46     /**
  47      * Windows_run - where Windows executables will load/unload us
  48      *
  49      */
  50     void Windows_run() {
  51         // open our window
  52         if (theWindowsAccessBridge != (WinAccessBridge *) 0) {
  53             theWindowsAccessBridge->initWindow();
  54             DEBUG_CODE(SetDlgItemText(theDialogWindow, cInvokedByText, "Windows"));
  55         }
  56     }
  57 
  58     /*
  59       /**
  60       * Windows_shutdown - where Windows executables will load/unload us
  61       *
  62       *
  63       void Windows_shutdown() {
  64       if (theWindowsAccessBridge != (WinAccessBridge *) 0) {
  65       theWindowsAccessBridge->initWindow();
  66       }
  67       }
  68     */
  69 
  70     /**
  71      * getTopLevelHWND - returns the top-level window parent of the descendent
  72      *
  73      */
  74     HWND getTopLevelHWND(HWND descendent) {
  75         HWND hwnd;
  76         if (descendent == NULL) {
  77             return NULL;
  78         }
  79 
  80         if (!IsWindow(descendent)) {
  81             return NULL;
  82         }
  83 
  84         hwnd = descendent;
  85         for(;;) {
  86             LONG style = GetWindowLong(hwnd, GWL_STYLE);
  87             if ( (style & WS_CHILD) == 0 ) {
  88                 // found a non-child window so terminate
  89                 break;
  90             }
  91             hwnd = GetParent(hwnd);
  92         }
  93 
  94         return hwnd;
  95     }
  96 
  97     void releaseJavaObject(long vmID, JOBJECT64 object) {
  98         if (theWindowsAccessBridge != 0) {
  99             theWindowsAccessBridge->releaseJavaObject(vmID, object);
 100         }
 101     }
 102 
 103     void getVersionInfo(long vmID, AccessBridgeVersionInfo *info) {
 104         if (theWindowsAccessBridge != 0) {
 105             theWindowsAccessBridge->getVersionInfo(vmID, info);
 106         }
 107     }
 108 
 109 
 110     BOOL isJavaWindow(HWND window) {
 111         if (theWindowsAccessBridge != 0) {
 112             return theWindowsAccessBridge->isJavaWindow(window);
 113         }
 114         return FALSE;
 115     }
 116 
 117     /*
 118      * Returns whether two object references refer to the same object
 119      */
 120     BOOL isSameObject(long vmID, JOBJECT64 obj1, JOBJECT64 obj2) {
 121 #ifdef ACCESSBRIDGE_ARCH_LEGACY // JOBJECT64 is jobject (32 bit pointer)
 122         PrintDebugString("\r\nAccessBridgeWindowsEntryPoints::isSameObject(%p %p)", obj1, obj2);
 123 #else // JOBJECT64 is jlong (64 bit)
 124         PrintDebugString("\r\nAccessBridgeWindowsEntryPoints::isSameObject(%016I64X %016I64X)", obj1, obj2);
 125 #endif
 126         if (theWindowsAccessBridge != 0) {
 127             return theWindowsAccessBridge->isSameObject(vmID, obj1, obj2);
 128         }
 129         return FALSE;
 130     }
 131 
 132     /**
 133      * Sets a text field to the specified string. Returns whether successful
 134      */
 135     BOOL setTextContents (const long vmID, const AccessibleContext accessibleContext,const wchar_t *text) {
 136 
 137         if (theWindowsAccessBridge != 0) {
 138             return theWindowsAccessBridge->setTextContents(vmID, accessibleContext, text);
 139         }
 140         return FALSE;
 141     }
 142 
 143     /**
 144      * Returns the Accessible Context of an object of the specified role that is the
 145      * ancestor of a given object.  If the object is of the specified role
 146      * or an ancestor object of the specified role was found, returns the object's
 147      * AccessibleContext.
 148      * If there is no ancestor object of the specified role,
 149      * returns (AccessibleContext)0.
 150      */
 151     AccessibleContext getParentWithRole (const long vmID, const AccessibleContext accessibleContext, const wchar_t *role) {
 152 
 153         if (theWindowsAccessBridge != 0) {
 154             return theWindowsAccessBridge->getParentWithRole(vmID, accessibleContext, role);
 155         }
 156         return (AccessibleContext)0;
 157     }
 158 
 159 
 160     /**
 161      * Returns the Accessible Context for the top level object in
 162      * a Java Window.  This is same Accessible Context that is obtained
 163      * from GetAccessibleContextFromHWND for that window.  Returns
 164      * (AccessibleContext)0 on error.
 165      */
 166     AccessibleContext getTopLevelObject (const long vmID, const AccessibleContext accessibleContext) {
 167 
 168         if (theWindowsAccessBridge != 0) {
 169             return theWindowsAccessBridge->getTopLevelObject(vmID, accessibleContext);
 170         }
 171         return (AccessibleContext)0;
 172     }
 173 
 174     /**
 175      * If there is an Ancestor object of the specified role,
 176      * returns the Accessible Context of the found object.
 177      * Otherwise, returns the top level object for that
 178      * Java Window.  Returns (AccessibleContext)0 on error.
 179      */
 180     AccessibleContext getParentWithRoleElseRoot (const long vmID, const AccessibleContext accessibleContext, const wchar_t *role) {
 181 
 182         if (theWindowsAccessBridge != 0) {
 183             return theWindowsAccessBridge->getParentWithRoleElseRoot(vmID, accessibleContext, role);
 184         }
 185         return (AccessibleContext)0;
 186     }
 187 
 188     /**
 189      * Returns how deep in the object hierarchy a given object is.
 190      * The top most object in the object hierarchy has an object depth of 0.
 191      * Returns -1 on error.
 192      */
 193     int getObjectDepth (const long vmID, const AccessibleContext accessibleContext) {
 194 
 195         if (theWindowsAccessBridge != 0) {
 196             return theWindowsAccessBridge->getObjectDepth(vmID, accessibleContext);
 197         }
 198         return -1;
 199     }
 200 
 201     /**
 202      * Returns the Accessible Context of the currently ActiveDescendent of an object.
 203      * Returns (AccessibleContext)0 on error.
 204      */
 205     AccessibleContext getActiveDescendent (const long vmID, const AccessibleContext accessibleContext) {
 206 
 207         if (theWindowsAccessBridge != 0) {
 208             return theWindowsAccessBridge->getActiveDescendent(vmID, accessibleContext);
 209         }
 210         return (AccessibleContext)0;
 211     }
 212 
 213     // -------- Accessible Context methods -------------
 214 
 215     BOOL getAccessibleContextFromHWND(HWND window, long *vmID, JOBJECT64 *AccessibleContext) {
 216         if (theWindowsAccessBridge != 0) {
 217             return theWindowsAccessBridge->getAccessibleContextFromHWND(window, vmID, AccessibleContext);
 218         }
 219         return FALSE;
 220     }
 221 
 222     HWND getHWNDFromAccessibleContext(long vmID, JOBJECT64 accessibleContext) {
 223         if (theWindowsAccessBridge != 0) {
 224             return theWindowsAccessBridge->getHWNDFromAccessibleContext(vmID, accessibleContext);
 225         }
 226         return (HWND)0;
 227     }
 228 
 229     BOOL getAccessibleContextAt(long vmID, JOBJECT64 AccessibleContextParent,
 230                                 jint x, jint y, JOBJECT64 *AccessibleContext) {
 231         if (theWindowsAccessBridge != 0) {
 232             return theWindowsAccessBridge->getAccessibleContextAt(vmID, AccessibleContextParent,
 233                                                                   x, y, AccessibleContext);
 234         }
 235         return FALSE;
 236     }
 237 
 238     BOOL getAccessibleContextWithFocus(HWND window, long *vmID, JOBJECT64 *AccessibleContext) {
 239         if (theWindowsAccessBridge != 0) {
 240             return theWindowsAccessBridge->getAccessibleContextWithFocus(window, vmID, AccessibleContext);
 241         }
 242         return FALSE;
 243     }
 244 
 245     BOOL getAccessibleContextInfo(long vmID,
 246                                   JOBJECT64 AccessibleContext,
 247                                   AccessibleContextInfo *info) {
 248         if (theWindowsAccessBridge != 0) {
 249             return theWindowsAccessBridge->getAccessibleContextInfo(
 250                                                                     vmID,
 251                                                                     AccessibleContext,
 252                                                                     info);
 253         }
 254         return FALSE;
 255     }
 256 
 257     JOBJECT64 getAccessibleChildFromContext(long vmID,
 258                                           JOBJECT64 AccessibleContext,
 259                                           jint childIndex) {
 260         if (theWindowsAccessBridge != 0) {
 261             return theWindowsAccessBridge->getAccessibleChildFromContext(
 262                                                                          vmID,
 263                                                                          AccessibleContext,
 264                                                                          childIndex);
 265         }
 266         return (JOBJECT64) 0;
 267     }
 268 
 269     JOBJECT64 getAccessibleParentFromContext(long vmID,
 270                                            JOBJECT64 AccessibleContext) {
 271         if (theWindowsAccessBridge != 0) {
 272             return theWindowsAccessBridge->getAccessibleParentFromContext(
 273                                                                           vmID,
 274                                                                           AccessibleContext);
 275         }
 276         return (JOBJECT64) 0;
 277     }
 278 
 279     // -------- begin AccessibleTable routines -------------
 280 
 281     BOOL getAccessibleTableInfo(long vmID, JOBJECT64 ac,
 282                                 AccessibleTableInfo *tableInfo) {
 283         if (theWindowsAccessBridge != 0) {
 284             return theWindowsAccessBridge->getAccessibleTableInfo(
 285                                                                   vmID,
 286                                                                   ac,
 287                                                                   tableInfo);
 288         }
 289         return FALSE;
 290     }
 291 
 292     BOOL getAccessibleTableCellInfo(long vmID, JOBJECT64 accessibleTable,
 293                                     jint row, jint column, AccessibleTableCellInfo *tableCellInfo) {
 294 
 295         if (theWindowsAccessBridge != 0) {
 296             return theWindowsAccessBridge->getAccessibleTableCellInfo(
 297                                                                       vmID,
 298                                                                       accessibleTable,
 299                                                                       row, column, tableCellInfo);
 300         }
 301         return FALSE;
 302     }
 303 
 304     BOOL getAccessibleTableRowHeader(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo) {
 305 
 306         if (theWindowsAccessBridge != 0) {
 307             return theWindowsAccessBridge->getAccessibleTableRowHeader(
 308                                                                        vmID,
 309                                                                        acParent,
 310                                                                        tableInfo);
 311         }
 312         return FALSE;
 313     }
 314 
 315     BOOL getAccessibleTableColumnHeader(long vmID, JOBJECT64 acParent, AccessibleTableInfo *tableInfo) {
 316 
 317         if (theWindowsAccessBridge != 0) {
 318             return theWindowsAccessBridge->getAccessibleTableColumnHeader(
 319                                                                           vmID,
 320                                                                           acParent,
 321                                                                           tableInfo);
 322         }
 323         return FALSE;
 324     }
 325 
 326     JOBJECT64 getAccessibleTableRowDescription(long vmID, JOBJECT64 acParent, jint row) {
 327 
 328         if (theWindowsAccessBridge != 0) {
 329             return (JOBJECT64)theWindowsAccessBridge->getAccessibleTableRowDescription(
 330                                                                             vmID,
 331                                                                             acParent,
 332                                                                             row);
 333         }
 334         return (JOBJECT64)0;
 335     }
 336 
 337     JOBJECT64 getAccessibleTableColumnDescription(long vmID, JOBJECT64 acParent, jint column) {
 338 
 339         if (theWindowsAccessBridge != 0) {
 340             return (JOBJECT64)theWindowsAccessBridge->getAccessibleTableColumnDescription(
 341                                                                                vmID,
 342                                                                                acParent,
 343                                                                                column);
 344         }
 345         return (JOBJECT64)0;
 346     }
 347 
 348     jint getAccessibleTableRowSelectionCount(long vmID, JOBJECT64 accessibleTable) {
 349         if (theWindowsAccessBridge != 0) {
 350             return theWindowsAccessBridge->getAccessibleTableRowSelectionCount(vmID, accessibleTable);
 351         }
 352         return -1;
 353     }
 354 
 355     BOOL isAccessibleTableRowSelected(long vmID, JOBJECT64 accessibleTable, jint row) {
 356         if (theWindowsAccessBridge != 0 ) {
 357             return theWindowsAccessBridge->isAccessibleTableRowSelected(vmID, accessibleTable, row);
 358         }
 359         return FALSE;
 360     }
 361 
 362     BOOL getAccessibleTableRowSelections(long vmID, JOBJECT64 accessibleTable, jint count, jint *selections) {
 363         if (theWindowsAccessBridge != 0 ) {
 364             return theWindowsAccessBridge->getAccessibleTableRowSelections(vmID, accessibleTable, count,
 365                                                                            selections);
 366         }
 367         return FALSE;
 368     }
 369 
 370 
 371     jint getAccessibleTableColumnSelectionCount(long vmID, JOBJECT64 accessibleTable) {
 372         if (theWindowsAccessBridge != 0 ) {
 373             return theWindowsAccessBridge->getAccessibleTableColumnSelectionCount(vmID, accessibleTable);
 374         }
 375         return -1;
 376     }
 377 
 378     BOOL isAccessibleTableColumnSelected(long vmID, JOBJECT64 accessibleTable, jint column) {
 379         if (theWindowsAccessBridge != 0 ) {
 380             return theWindowsAccessBridge->isAccessibleTableColumnSelected(vmID, accessibleTable, column);
 381         }
 382         return FALSE;
 383     }
 384 
 385     BOOL getAccessibleTableColumnSelections(long vmID, JOBJECT64 accessibleTable, jint count, jint *selections) {
 386         if (theWindowsAccessBridge != 0 ) {
 387             return theWindowsAccessBridge->getAccessibleTableColumnSelections(vmID, accessibleTable, count,
 388                                                                               selections);
 389         }
 390         return FALSE;
 391     }
 392 
 393     jint getAccessibleTableRow(long vmID, JOBJECT64 accessibleTable, jint index) {
 394         if (theWindowsAccessBridge != 0 ) {
 395             return theWindowsAccessBridge->getAccessibleTableRow(vmID, accessibleTable, index);
 396         }
 397         return -1;
 398     }
 399 
 400     jint getAccessibleTableColumn(long vmID, JOBJECT64 accessibleTable, jint index) {
 401         if (theWindowsAccessBridge != 0 ) {
 402             return theWindowsAccessBridge->getAccessibleTableColumn(vmID, accessibleTable, index);
 403         }
 404         return -1;
 405     }
 406 
 407     jint getAccessibleTableIndex(long vmID, JOBJECT64 accessibleTable, jint row, jint column) {
 408         if (theWindowsAccessBridge != 0 ) {
 409             return theWindowsAccessBridge->getAccessibleTableIndex(vmID, accessibleTable, row, column);
 410         }
 411         return -1;
 412     }
 413 
 414     /* --------- end AccessibleTable routines ------- */
 415 
 416     // --------- AccessibleRelationSet methods
 417 
 418     BOOL getAccessibleRelationSet(long vmID, JOBJECT64 accessibleContext,
 419                                   AccessibleRelationSetInfo *relationSetInfo) {
 420         if (theWindowsAccessBridge != 0) {
 421             return theWindowsAccessBridge->getAccessibleRelationSet(vmID, accessibleContext, relationSetInfo);
 422         }
 423         return FALSE;
 424     }
 425 
 426     // --------- AccessibleHypertext methods
 427 
 428     BOOL getAccessibleHypertext(long vmID, JOBJECT64 accessibleContext,
 429                                 AccessibleHypertextInfo *accessibleHypertextInfo) {
 430         if (theWindowsAccessBridge != 0) {
 431             return theWindowsAccessBridge->getAccessibleHypertext(vmID, accessibleContext,
 432                                                                   accessibleHypertextInfo);
 433         }
 434         return FALSE;
 435     }
 436 
 437     BOOL activateAccessibleHyperlink(long vmID, JOBJECT64 accessibleContext, JOBJECT64 accessibleHyperlink) {
 438         if (theWindowsAccessBridge != 0) {
 439             return theWindowsAccessBridge->activateAccessibleHyperlink(vmID, accessibleContext,
 440                                                                        accessibleHyperlink);
 441         }
 442         return FALSE;
 443     }
 444 
 445     jint getAccessibleHyperlinkCount(const long vmID,
 446                                      const AccessibleContext accessibleContext) {
 447 
 448         if (theWindowsAccessBridge != 0) {
 449             return theWindowsAccessBridge->getAccessibleHyperlinkCount(vmID, accessibleContext);
 450         }
 451         return -1;
 452     }
 453 
 454 
 455     BOOL getAccessibleHypertextExt(const long vmID,
 456                                    const AccessibleContext accessibleContext,
 457                                    const jint nStartIndex,
 458                                    /* OUT */ AccessibleHypertextInfo *hypertextInfo) {
 459 
 460         if (theWindowsAccessBridge != 0) {
 461             return theWindowsAccessBridge->getAccessibleHypertextExt(vmID,
 462                                                                      accessibleContext,
 463                                                                      nStartIndex,
 464                                                                      hypertextInfo);
 465         }
 466         return FALSE;
 467     }
 468 
 469 
 470     jint getAccessibleHypertextLinkIndex(const long vmID,
 471                                          const AccessibleHypertext hypertext,
 472                                          const jint nIndex) {
 473 
 474         if (theWindowsAccessBridge != 0) {
 475             return theWindowsAccessBridge->getAccessibleHypertextLinkIndex(vmID,
 476                                                                            hypertext,
 477                                                                            nIndex);
 478         }
 479         return -1;
 480     }
 481 
 482 
 483     BOOL getAccessibleHyperlink(const long vmID,
 484                                 const AccessibleHypertext hypertext,
 485                                 const jint nIndex,
 486                                 /* OUT */ AccessibleHyperlinkInfo *hyperlinkInfo) {
 487 
 488         if (theWindowsAccessBridge != 0) {
 489             return theWindowsAccessBridge->getAccessibleHyperlink(vmID,
 490                                                                   hypertext,
 491                                                                   nIndex,
 492                                                                   hyperlinkInfo);
 493         }
 494         return FALSE;
 495     }
 496 
 497 
 498     /* Accessible KeyBindings, Icons and Actions */
 499     BOOL getAccessibleKeyBindings(long vmID, JOBJECT64 accessibleContext, AccessibleKeyBindings *keyBindings) {
 500 
 501         if (theWindowsAccessBridge != 0) {
 502             return theWindowsAccessBridge->getAccessibleKeyBindings(vmID, accessibleContext, keyBindings);
 503         }
 504         return FALSE;
 505     }
 506 
 507     BOOL getAccessibleIcons(long vmID, JOBJECT64 accessibleContext, AccessibleIcons *icons) {
 508 
 509         if (theWindowsAccessBridge != 0) {
 510             return theWindowsAccessBridge->getAccessibleIcons(vmID, accessibleContext, icons);
 511         }
 512         return FALSE;
 513     }
 514 
 515     BOOL getAccessibleActions(long vmID, JOBJECT64 accessibleContext, AccessibleActions *actions) {
 516 
 517         if (theWindowsAccessBridge != 0) {
 518             return theWindowsAccessBridge->getAccessibleActions(vmID, accessibleContext, actions);
 519         }
 520         return FALSE;
 521     }
 522 
 523     BOOL doAccessibleActions(long vmID, JOBJECT64 accessibleContext, AccessibleActionsToDo *actionsToDo,
 524                              jint *failure) {
 525 
 526         if (theWindowsAccessBridge != 0) {
 527             return theWindowsAccessBridge->doAccessibleActions(vmID, accessibleContext, actionsToDo,
 528                                                                failure);
 529         }
 530         return FALSE;
 531     }
 532 
 533     /**
 534      * Additional methods for Teton
 535      */
 536 
 537     /**
 538      * Gets the AccessibleName for a component based upon the JAWS algorithm. Returns
 539      * whether successful.
 540      *
 541      * Bug ID 4916682 - Implement JAWS AccessibleName policy
 542      */
 543     BOOL getVirtualAccessibleName(long vmID, AccessibleContext accessibleContext, wchar_t *name, int len) {
 544         if (theWindowsAccessBridge != 0) {
 545             return theWindowsAccessBridge->getVirtualAccessibleName(vmID, accessibleContext, name, len);
 546         }
 547         return FALSE;
 548     }
 549 
 550     /**
 551      * Request focus for a component. Returns whether successful;
 552      *
 553      * Bug ID 4944757 - requestFocus method needed
 554      */
 555     BOOL requestFocus(long vmID, AccessibleContext accessibleContext) {
 556         if (theWindowsAccessBridge != 0) {
 557             return theWindowsAccessBridge->requestFocus(vmID, accessibleContext);
 558         }
 559         return FALSE;
 560     }
 561 
 562     /**
 563      * Selects text between two indices.  Selection includes the text at the start index
 564      * and the text at the end index. Returns whether successful;
 565      *
 566      * Bug ID 4944758 - selectTextRange method needed
 567      */
 568     BOOL selectTextRange(long vmID, AccessibleContext accessibleContext, int startIndex, int endIndex) {
 569         if (theWindowsAccessBridge != 0) {
 570             return theWindowsAccessBridge->selectTextRange(vmID, accessibleContext, startIndex, endIndex);
 571         }
 572         return FALSE;
 573     }
 574 
 575     /**
 576      * Get text attributes between two indices.  The attribute list includes the text at the
 577      * start index and the text at the end index. Returns whether successful;
 578      *
 579      * Bug ID 4944761 - getTextAttributes between two indices method needed
 580      */
 581     BOOL getTextAttributesInRange(long vmID, AccessibleContext accessibleContext, int startIndex, int endIndex,
 582                                   AccessibleTextAttributesInfo *attributes, short *len) {
 583         if (theWindowsAccessBridge != 0) {
 584             return theWindowsAccessBridge->getTextAttributesInRange(vmID, accessibleContext,
 585                                                                     startIndex, endIndex, attributes, len);
 586         }
 587         return FALSE;
 588     }
 589 
 590     /**
 591      * Gets the number of visible children of a component.  Returns -1 on error.
 592      *
 593      * Bug ID 4944762- getVisibleChildren for list-like components needed
 594      */
 595     int getVisibleChildrenCount(long vmID, AccessibleContext accessibleContext) {
 596         if (theWindowsAccessBridge != 0) {
 597             return theWindowsAccessBridge->getVisibleChildrenCount(vmID, accessibleContext);
 598         }
 599         return FALSE;
 600     }
 601 
 602     /**
 603      * Gets the visible children of an AccessibleContext. Returns whether successful;
 604      *
 605      * Bug ID 4944762- getVisibleChildren for list-like components needed
 606      */
 607     BOOL getVisibleChildren(long vmID, AccessibleContext accessibleContext, int startIndex,
 608                             VisibleChildrenInfo *visibleChildrenInfo) {
 609         if (theWindowsAccessBridge != 0) {
 610             return theWindowsAccessBridge->getVisibleChildren(vmID, accessibleContext, startIndex,
 611                                                               visibleChildrenInfo);
 612         }
 613         return FALSE;
 614     }
 615 
 616     /**
 617      * Set the caret to a text position. Returns whether successful;
 618      *
 619      * Bug ID 4944770 - setCaretPosition method needed
 620      */
 621     BOOL setCaretPosition(const long vmID, const AccessibleContext accessibleContext,
 622                           const int position) {
 623         if (theWindowsAccessBridge != 0) {
 624             return theWindowsAccessBridge->setCaretPosition(vmID, accessibleContext, position);
 625         }
 626         return FALSE;
 627     }
 628 
 629     // -------- Accessible Text methods -------------
 630 
 631     BOOL getAccessibleTextInfo(long vmID, JOBJECT64 AccessibleContext,
 632                                AccessibleTextInfo *textInfo, jint x, jint y) {
 633         if (theWindowsAccessBridge != 0) {
 634             return theWindowsAccessBridge->getAccessibleTextInfo(
 635                                                                  vmID,
 636                                                                  AccessibleContext,
 637                                                                  textInfo, x, y);
 638         }
 639         return FALSE;
 640     }
 641 
 642     BOOL getAccessibleTextItems(long vmID, JOBJECT64 AccessibleContext,
 643                                 AccessibleTextItemsInfo *textItems, jint index) {
 644         if (theWindowsAccessBridge != 0) {
 645             return theWindowsAccessBridge->getAccessibleTextItems(
 646                                                                   vmID,
 647                                                                   AccessibleContext,
 648                                                                   textItems, index);
 649         }
 650         return FALSE;
 651     }
 652 
 653     BOOL getAccessibleTextSelectionInfo(long vmID, JOBJECT64 AccessibleContext,
 654                                         AccessibleTextSelectionInfo *selectionInfo) {
 655         if (theWindowsAccessBridge != 0) {
 656             return theWindowsAccessBridge->getAccessibleTextSelectionInfo(
 657                                                                           vmID,
 658                                                                           AccessibleContext,
 659                                                                           selectionInfo);
 660         }
 661         return FALSE;
 662     }
 663 
 664     BOOL getAccessibleTextAttributes(long vmID, JOBJECT64 AccessibleContext,
 665                                      jint index, AccessibleTextAttributesInfo *attributes) {
 666         if (theWindowsAccessBridge != 0) {
 667             return theWindowsAccessBridge->getAccessibleTextAttributes(
 668                                                                        vmID,
 669                                                                        AccessibleContext,
 670                                                                        index, attributes);
 671         }
 672         return FALSE;
 673     }
 674 
 675     BOOL getAccessibleTextRect(long vmID, JOBJECT64 AccessibleContext,
 676                                AccessibleTextRectInfo *rectInfo, jint index) {
 677         if (theWindowsAccessBridge != 0) {
 678             return theWindowsAccessBridge->getAccessibleTextRect(
 679                                                                  vmID,
 680                                                                  AccessibleContext,
 681                                                                  rectInfo, index);
 682         }
 683         return FALSE;
 684     }
 685 
 686     BOOL getCaretLocation(long vmID, JOBJECT64 AccessibleContext,
 687                           AccessibleTextRectInfo *rectInfo, jint index) {
 688         if (theWindowsAccessBridge != 0) {
 689             return theWindowsAccessBridge->getCaretLocation(vmID,
 690                                                             AccessibleContext,
 691                                                             rectInfo, index);
 692         }
 693         return FALSE;
 694     }
 695 
 696     int getEventsWaiting() {
 697         if (theWindowsAccessBridge != 0) {
 698             return theWindowsAccessBridge->getEventsWaiting();
 699         }
 700         return FALSE;
 701     }
 702 
 703     BOOL getAccessibleTextLineBounds(long vmID, JOBJECT64 AccessibleContext,
 704                                      jint index, jint *startIndex, jint *endIndex) {
 705         if (theWindowsAccessBridge != 0) {
 706             return theWindowsAccessBridge->getAccessibleTextLineBounds(
 707                                                                        vmID,
 708                                                                        AccessibleContext,
 709                                                                        index, startIndex, endIndex);
 710         }
 711         return FALSE;
 712     }
 713 
 714     BOOL getAccessibleTextRange(long vmID, JOBJECT64 AccessibleContext,
 715                                 jint start, jint end, wchar_t *text, short len) {
 716         if (theWindowsAccessBridge != 0) {
 717             return theWindowsAccessBridge->getAccessibleTextRange(
 718                                                                   vmID,
 719                                                                   AccessibleContext,
 720                                                                   start, end, text, len);
 721         }
 722         return FALSE;
 723     }
 724 
 725 
 726     // -------- Accessible Value methods -------------
 727 
 728     BOOL getCurrentAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext,
 729                                               wchar_t *value, short len) {
 730         if (theWindowsAccessBridge != 0) {
 731             return theWindowsAccessBridge->getCurrentAccessibleValueFromContext(
 732                                                                                 vmID, AccessibleContext, value, len);
 733         }
 734         return FALSE;
 735     }
 736 
 737     BOOL getMaximumAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext,
 738                                               wchar_t *value, short len) {
 739         if (theWindowsAccessBridge != 0) {
 740             return theWindowsAccessBridge->getMaximumAccessibleValueFromContext(
 741                                                                                 vmID, AccessibleContext, value, len);
 742         }
 743         return FALSE;
 744     }
 745 
 746     BOOL getMinimumAccessibleValueFromContext(long vmID, JOBJECT64 AccessibleContext,
 747                                               wchar_t *value, short len) {
 748         if (theWindowsAccessBridge != 0) {
 749             return theWindowsAccessBridge->getMinimumAccessibleValueFromContext(
 750                                                                                 vmID, AccessibleContext, value, len);
 751         }
 752         return FALSE;
 753     }
 754 
 755     // -------- Accessible Selection methods -------------
 756 
 757     void addAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i) {
 758         if (theWindowsAccessBridge != 0) {
 759             theWindowsAccessBridge->addAccessibleSelectionFromContext(
 760                                                                       vmID, AccessibleContext, i);
 761         }
 762     }
 763 
 764     void clearAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext) {
 765         if (theWindowsAccessBridge != 0) {
 766             theWindowsAccessBridge->clearAccessibleSelectionFromContext(
 767                                                                         vmID, AccessibleContext);
 768         }
 769     }
 770 
 771     JOBJECT64 getAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i) {
 772         if (theWindowsAccessBridge != 0) {
 773             return theWindowsAccessBridge->getAccessibleSelectionFromContext(
 774                                                                              vmID, AccessibleContext, i);
 775         }
 776         return (JOBJECT64) 0;
 777     }
 778 
 779     int getAccessibleSelectionCountFromContext(long vmID, JOBJECT64 AccessibleContext) {
 780         if (theWindowsAccessBridge != 0) {
 781             return theWindowsAccessBridge->getAccessibleSelectionCountFromContext(
 782                                                                                   vmID, AccessibleContext);
 783         }
 784         return -1;
 785     }
 786 
 787     BOOL isAccessibleChildSelectedFromContext(long vmID, JOBJECT64 AccessibleContext, int i) {
 788         if (theWindowsAccessBridge != 0) {
 789             return theWindowsAccessBridge->isAccessibleChildSelectedFromContext(
 790                                                                                 vmID, AccessibleContext, i);
 791         }
 792         return FALSE;
 793     }
 794 
 795     void removeAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext, int i) {
 796         if (theWindowsAccessBridge != 0) {
 797             theWindowsAccessBridge->removeAccessibleSelectionFromContext(
 798                                                                          vmID, AccessibleContext, i);
 799         }
 800     }
 801 
 802     void selectAllAccessibleSelectionFromContext(long vmID, JOBJECT64 AccessibleContext) {
 803         if (theWindowsAccessBridge != 0) {
 804             theWindowsAccessBridge->selectAllAccessibleSelectionFromContext(
 805                                                                             vmID, AccessibleContext);
 806         }
 807     }
 808 
 809 
 810     // -------- Event Handler methods -------------
 811 
 812 #define SET_EVENT_FP(function, callbackFP)          \
 813     void function(callbackFP fp) {                  \
 814         if (theWindowsAccessBridge != 0) {          \
 815             theWindowsAccessBridge->function(fp);   \
 816         }                                           \
 817 }
 818 
 819     void setJavaShutdownFP(AccessBridge_JavaShutdownFP fp) {
 820         if (theWindowsAccessBridge != 0) {
 821             theWindowsAccessBridge->setJavaShutdownFP(fp);
 822         }
 823     }
 824 
 825         SET_EVENT_FP(setPropertyChangeFP, AccessBridge_PropertyChangeFP)
 826         SET_EVENT_FP(setFocusGainedFP, AccessBridge_FocusGainedFP)
 827         SET_EVENT_FP(setFocusLostFP, AccessBridge_FocusLostFP)
 828         SET_EVENT_FP(setCaretUpdateFP, AccessBridge_CaretUpdateFP)
 829         SET_EVENT_FP(setMouseClickedFP, AccessBridge_MouseClickedFP)
 830         SET_EVENT_FP(setMouseEnteredFP, AccessBridge_MouseEnteredFP)
 831         SET_EVENT_FP(setMouseExitedFP, AccessBridge_MouseExitedFP)
 832         SET_EVENT_FP(setMousePressedFP, AccessBridge_MousePressedFP)
 833         SET_EVENT_FP(setMouseReleasedFP, AccessBridge_MouseReleasedFP)
 834         SET_EVENT_FP(setMenuCanceledFP, AccessBridge_MenuCanceledFP)
 835         SET_EVENT_FP(setMenuDeselectedFP, AccessBridge_MenuDeselectedFP)
 836         SET_EVENT_FP(setMenuSelectedFP, AccessBridge_MenuSelectedFP)
 837         SET_EVENT_FP(setPopupMenuCanceledFP, AccessBridge_PopupMenuCanceledFP)
 838         SET_EVENT_FP(setPopupMenuWillBecomeInvisibleFP, AccessBridge_PopupMenuWillBecomeInvisibleFP)
 839         SET_EVENT_FP(setPopupMenuWillBecomeVisibleFP, AccessBridge_PopupMenuWillBecomeVisibleFP)
 840 
 841         SET_EVENT_FP(setPropertyNameChangeFP, AccessBridge_PropertyNameChangeFP)
 842         SET_EVENT_FP(setPropertyDescriptionChangeFP, AccessBridge_PropertyDescriptionChangeFP)
 843         SET_EVENT_FP(setPropertyStateChangeFP, AccessBridge_PropertyStateChangeFP)
 844         SET_EVENT_FP(setPropertyValueChangeFP, AccessBridge_PropertyValueChangeFP)
 845         SET_EVENT_FP(setPropertySelectionChangeFP, AccessBridge_PropertySelectionChangeFP)
 846         SET_EVENT_FP(setPropertyTextChangeFP, AccessBridge_PropertyTextChangeFP)
 847         SET_EVENT_FP(setPropertyCaretChangeFP, AccessBridge_PropertyCaretChangeFP)
 848         SET_EVENT_FP(setPropertyVisibleDataChangeFP, AccessBridge_PropertyVisibleDataChangeFP)
 849         SET_EVENT_FP(setPropertyChildChangeFP, AccessBridge_PropertyChildChangeFP)
 850         SET_EVENT_FP(setPropertyActiveDescendentChangeFP, AccessBridge_PropertyActiveDescendentChangeFP)
 851 
 852         SET_EVENT_FP(setPropertyTableModelChangeFP, AccessBridge_PropertyTableModelChangeFP)
 853 
 854 #ifdef __cplusplus
 855         }
 856 #endif