1 /* 2 * Copyright (c) 2005, 2015, 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 * A class to manage JNI calls into AccessBridge.java 28 */ 29 30 #include "AccessBridgeJavaEntryPoints.h" 31 #include "AccessBridgeDebug.h" 32 33 34 35 /** 36 * Initialize the AccessBridgeJavaEntryPoints class 37 * 38 */ 39 AccessBridgeJavaEntryPoints::AccessBridgeJavaEntryPoints(JNIEnv *jniEnvironment, 40 jobject bridgeObject) { 41 jniEnv = jniEnvironment; 42 accessBridgeObject = (jobject)bridgeObject; 43 PrintDebugString("AccessBridgeJavaEntryPoints(%X, %X) called", jniEnv, accessBridgeObject); 44 } 45 46 47 /** 48 * Destructor 49 * 50 */ 51 AccessBridgeJavaEntryPoints::~AccessBridgeJavaEntryPoints() { 52 } 53 54 // ----------------------------------- 55 56 #define FIND_CLASS(classRef, className) \ 57 localClassRef = jniEnv->FindClass(className); \ 58 if (localClassRef == (jclass) 0) { \ 59 PrintDebugString(" Error! FindClass(%s) failed!", className); \ 60 PrintDebugString(" -> jniEnv = %p", jniEnv); \ 61 return FALSE; \ 62 } \ 63 classRef = (jclass) jniEnv->NewGlobalRef(localClassRef); \ 64 jniEnv->DeleteLocalRef(localClassRef); \ 65 if (classRef == (jclass) 0) { \ 66 PrintDebugString(" Error! FindClass(%s) failed!", className); \ 67 PrintDebugString(" -> (ran out of RAM)"); \ 68 return FALSE; \ 69 } 70 71 72 #define FIND_METHOD(methodID, classRef, methodString, methodSignature); \ 73 methodID = jniEnv->GetMethodID(classRef, methodString, methodSignature); \ 74 if (methodID == (jmethodID) 0) { \ 75 PrintDebugString(" Error! GetMethodID(%s) failed!", methodString); \ 76 PrintDebugString(" -> jniEnv = %p; classRef = %p", jniEnv, classRef); \ 77 return FALSE; \ 78 } 79 80 #define EXCEPTION_CHECK(situationDescription, returnVal) \ 81 if (exception = jniEnv->ExceptionOccurred()) { \ 82 PrintDebugString("\r\n *** Exception occured while doing: %s; returning %d", situationDescription, returnVal); \ 83 jniEnv->ExceptionDescribe(); \ 84 jniEnv->ExceptionClear(); \ 85 return (returnVal); \ 86 } 87 88 #define EXCEPTION_CHECK_VOID(situationDescription) \ 89 if (exception = jniEnv->ExceptionOccurred()) { \ 90 PrintDebugString("\r\n *** Exception occured while doing: %s", situationDescription); \ 91 jniEnv->ExceptionDescribe(); \ 92 jniEnv->ExceptionClear(); \ 93 return; \ 94 } 95 96 /** 97 * Make all of the getClass() & getMethod() calls 98 * 99 */ 100 BOOL 101 AccessBridgeJavaEntryPoints::BuildJavaEntryPoints() { 102 jclass localClassRef; 103 104 PrintDebugString("Calling BuildJavaEntryPoints():"); 105 106 FIND_CLASS(bridgeClass, "com/sun/java/accessibility/AccessBridge"); 107 108 // ------- general methods 109 110 // GetMethodID(decrementReference) 111 FIND_METHOD(decrementReferenceMethod, bridgeClass, 112 "decrementReference", 113 "(Ljava/lang/Object;)V"); 114 115 // GetMethodID(getJavaVersionPropertyMethod) 116 FIND_METHOD(getJavaVersionPropertyMethod, bridgeClass, 117 "getJavaVersionProperty", 118 "()Ljava/lang/String;"); 119 120 // GetMethodID(getAccessBridgeVersionMethod) 121 FIND_METHOD(getAccessBridgeVersionMethod, bridgeClass, 122 "getAccessBridgeVersion", 123 "()Ljava/lang/String;"); 124 125 126 // ------- Window methods 127 128 // GetMethodID(isJavaWindow) 129 FIND_METHOD(isJavaWindowMethod, bridgeClass, 130 "isJavaWindow", 131 "(I)Z"); 132 133 // GetMethodID(getAccessibleContextFromHWND) 134 FIND_METHOD(getAccessibleContextFromHWNDMethod, bridgeClass, 135 "getContextFromNativeWindowHandle", 136 "(I)Ljavax/accessibility/AccessibleContext;"); 137 138 // GetMethodID(getHWNDFromAccessibleContext) 139 FIND_METHOD(getHWNDFromAccessibleContextMethod, bridgeClass, 140 "getNativeWindowHandleFromContext", 141 "(Ljavax/accessibility/AccessibleContext;)I"); 142 143 // GetMethodID(getAccessibleParentFromContext) 144 FIND_METHOD(getAccessibleParentFromContextMethod, bridgeClass, 145 "getAccessibleParentFromContext", 146 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;"); 147 148 // ===== utility methods ===== */ 149 150 // GetMethodID(setTextContents) 151 FIND_METHOD(setTextContentsMethod, bridgeClass, 152 "setTextContents", 153 "(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Z"); 154 155 // GetMethodID(getParentWithRole) 156 FIND_METHOD(getParentWithRoleMethod, bridgeClass, 157 "getParentWithRole", 158 "(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Ljavax/accessibility/AccessibleContext;"); 159 160 // GetMethodID(getTopLevelObject) 161 FIND_METHOD(getTopLevelObjectMethod, bridgeClass, 162 "getTopLevelObject", 163 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;"); 164 165 // GetMethodID(getParentWithRoleElseRoot) 166 FIND_METHOD(getParentWithRoleElseRootMethod, bridgeClass, 167 "getParentWithRoleElseRoot", 168 "(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Ljavax/accessibility/AccessibleContext;"); 169 170 // GetMethodID(getObjectDepth) 171 FIND_METHOD(getObjectDepthMethod, bridgeClass, 172 "getObjectDepth", 173 "(Ljavax/accessibility/AccessibleContext;)I"); 174 175 // GetMethodID(getActiveDescendent) 176 FIND_METHOD(getActiveDescendentMethod, bridgeClass, 177 "getActiveDescendent", 178 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;"); 179 180 // ------- AccessibleContext methods 181 182 // GetMethodID(getAccessibleContextAt) 183 FIND_METHOD(getAccessibleContextAtMethod, bridgeClass, 184 "getAccessibleContextAt", 185 "(IILjavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;"); 186 187 // GetMethodID(getAccessibleContextWithFocus) 188 FIND_METHOD(getAccessibleContextWithFocusMethod, bridgeClass, 189 "getAccessibleContextWithFocus", 190 "()Ljavax/accessibility/AccessibleContext;"); 191 192 // GetMethodID(getAccessibleNameFromContext) 193 FIND_METHOD(getAccessibleNameFromContextMethod, bridgeClass, 194 "getAccessibleNameFromContext", 195 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 196 197 // GetMethodID(getAccessibleDescriptionFromContext) 198 FIND_METHOD(getAccessibleDescriptionFromContextMethod, bridgeClass, 199 "getAccessibleDescriptionFromContext", 200 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 201 202 // GetMethodID(getAccessibleRoleStringFromContext) 203 FIND_METHOD(getAccessibleRoleStringFromContextMethod, bridgeClass, 204 "getAccessibleRoleStringFromContext", 205 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 206 207 // GetMethodID(getAccessibleRoleStringFromContext_en_US) 208 FIND_METHOD(getAccessibleRoleStringFromContext_en_USMethod, bridgeClass, 209 "getAccessibleRoleStringFromContext_en_US", 210 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 211 212 // GetMethodID(getAccessibleStatesStringFromContext) 213 FIND_METHOD(getAccessibleStatesStringFromContextMethod, bridgeClass, 214 "getAccessibleStatesStringFromContext", 215 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 216 217 // GetMethodID(getAccessibleStatesStringFromContext_en_US) 218 FIND_METHOD(getAccessibleStatesStringFromContext_en_USMethod, bridgeClass, 219 "getAccessibleStatesStringFromContext_en_US", 220 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 221 222 // GetMethodID(getAccessibleParentFromContext) 223 FIND_METHOD(getAccessibleParentFromContextMethod, bridgeClass, 224 "getAccessibleParentFromContext", 225 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;"); 226 227 // GetMethodID(getAccessibleIndexInParentFromContext) 228 FIND_METHOD(getAccessibleIndexInParentFromContextMethod, bridgeClass, 229 "getAccessibleIndexInParentFromContext", 230 "(Ljavax/accessibility/AccessibleContext;)I"); 231 232 // GetMethodID(getAccessibleChildrenCountFromContext) 233 FIND_METHOD(getAccessibleChildrenCountFromContextMethod, bridgeClass, 234 "getAccessibleChildrenCountFromContext", 235 "(Ljavax/accessibility/AccessibleContext;)I"); 236 237 // GetMethodID(getAccessibleChildFromContext) 238 FIND_METHOD(getAccessibleChildFromContextMethod, bridgeClass, 239 "getAccessibleChildFromContext", 240 "(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;"); 241 242 // GetMethodID(getAccessibleBoundsOnScreenFromContext) 243 FIND_METHOD(getAccessibleBoundsOnScreenFromContextMethod, bridgeClass, 244 "getAccessibleBoundsOnScreenFromContext", 245 "(Ljavax/accessibility/AccessibleContext;)Ljava/awt/Rectangle;"); 246 247 // GetMethodID(getAccessibleXcoordFromContext) 248 FIND_METHOD(getAccessibleXcoordFromContextMethod, bridgeClass, 249 "getAccessibleXcoordFromContext", 250 "(Ljavax/accessibility/AccessibleContext;)I"); 251 252 // GetMethodID(getAccessibleYcoordFromContext) 253 FIND_METHOD(getAccessibleYcoordFromContextMethod, bridgeClass, 254 "getAccessibleYcoordFromContext", 255 "(Ljavax/accessibility/AccessibleContext;)I"); 256 257 // GetMethodID(getAccessibleHeightFromContext) 258 FIND_METHOD(getAccessibleHeightFromContextMethod, bridgeClass, 259 "getAccessibleHeightFromContext", 260 "(Ljavax/accessibility/AccessibleContext;)I"); 261 262 // GetMethodID(getAccessibleWidthFromContext) 263 FIND_METHOD(getAccessibleWidthFromContextMethod, bridgeClass, 264 "getAccessibleWidthFromContext", 265 "(Ljavax/accessibility/AccessibleContext;)I"); 266 267 // GetMethodID(getAccessibleComponentFromContext) 268 FIND_METHOD(getAccessibleComponentFromContextMethod, bridgeClass, 269 "getAccessibleComponentFromContext", 270 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleComponent;"); 271 272 // GetMethodID(getAccessibleActionFromContext) 273 FIND_METHOD(getAccessibleActionFromContextMethod, bridgeClass, 274 "getAccessibleActionFromContext", 275 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleAction;"); 276 277 // GetMethodID(getAccessibleSelectionFromContext) 278 FIND_METHOD(getAccessibleSelectionFromContextMethod, bridgeClass, 279 "getAccessibleSelectionFromContext", 280 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleSelection;"); 281 282 // GetMethodID(getAccessibleTextFromContext) 283 FIND_METHOD(getAccessibleTextFromContextMethod, bridgeClass, 284 "getAccessibleTextFromContext", 285 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleText;"); 286 287 // GetMethodID(getAccessibleValueFromContext) 288 FIND_METHOD(getAccessibleValueFromContextMethod, bridgeClass, 289 "getAccessibleValueFromContext", 290 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleValue;"); 291 292 293 // ------- begin AccessibleTable methods 294 295 // GetMethodID(getAccessibleTableFromContext) 296 FIND_METHOD(getAccessibleTableFromContextMethod, bridgeClass, 297 "getAccessibleTableFromContext", 298 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;"); 299 300 // GetMethodID(getContextFromAccessibleTable) 301 FIND_METHOD(getContextFromAccessibleTableMethod, bridgeClass, 302 "getContextFromAccessibleTable", 303 "(Ljavax/accessibility/AccessibleTable;)Ljavax/accessibility/AccessibleContext;"); 304 305 // GetMethodID(getAccessibleTableRowHeader) 306 FIND_METHOD(getAccessibleTableRowHeaderMethod, bridgeClass, 307 "getAccessibleTableRowHeader", 308 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;"); 309 310 311 // GetMethodID(getAccessibleTableColumnHeader) 312 FIND_METHOD(getAccessibleTableColumnHeaderMethod, bridgeClass, 313 "getAccessibleTableColumnHeader", 314 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;"); 315 316 317 // GetMethodID(getAccessibleTableRowCount) 318 FIND_METHOD(getAccessibleTableRowCountMethod, bridgeClass, 319 "getAccessibleTableRowCount", 320 "(Ljavax/accessibility/AccessibleContext;)I"); 321 322 // GetMethodID(getAccessibleTableColumnCount) 323 FIND_METHOD(getAccessibleTableColumnCountMethod, bridgeClass, 324 "getAccessibleTableColumnCount", 325 "(Ljavax/accessibility/AccessibleContext;)I"); 326 327 // GetMethodID(getAccessibleTableCellAccessibleContext) 328 FIND_METHOD(getAccessibleTableCellAccessibleContextMethod, bridgeClass, 329 "getAccessibleTableCellAccessibleContext", 330 "(Ljavax/accessibility/AccessibleTable;II)Ljavax/accessibility/AccessibleContext;"); 331 332 // GetMethodID(getAccessibleTableCellIndex) 333 FIND_METHOD(getAccessibleTableCellIndexMethod, bridgeClass, 334 "getAccessibleTableCellIndex", 335 "(Ljavax/accessibility/AccessibleTable;II)I"); 336 337 // GetMethodID(getAccessibleTableCellRowExtent) 338 FIND_METHOD(getAccessibleTableCellRowExtentMethod, bridgeClass, 339 "getAccessibleTableCellRowExtent", 340 "(Ljavax/accessibility/AccessibleTable;II)I"); 341 342 // GetMethodID(getAccessibleTableCellColumnExtent) 343 FIND_METHOD(getAccessibleTableCellColumnExtentMethod, bridgeClass, 344 "getAccessibleTableCellColumnExtent", 345 "(Ljavax/accessibility/AccessibleTable;II)I"); 346 347 // GetMethodID(isAccessibleTableCellSelected) 348 FIND_METHOD(isAccessibleTableCellSelectedMethod, bridgeClass, 349 "isAccessibleTableCellSelected", 350 "(Ljavax/accessibility/AccessibleTable;II)Z"); 351 352 // GetMethodID(getAccessibleTableRowHeaderRowCount) 353 FIND_METHOD(getAccessibleTableRowHeaderRowCountMethod, bridgeClass, 354 "getAccessibleTableRowHeaderRowCount", 355 "(Ljavax/accessibility/AccessibleContext;)I"); 356 357 // GetMethodID(getAccessibleTableColumnHeaderRowCount) 358 FIND_METHOD(getAccessibleTableColumnHeaderRowCountMethod, bridgeClass, 359 "getAccessibleTableColumnHeaderRowCount", 360 "(Ljavax/accessibility/AccessibleContext;)I"); 361 362 // GetMethodID(getAccessibleTableRowHeaderColumnCount) 363 FIND_METHOD(getAccessibleTableRowHeaderColumnCountMethod, bridgeClass, 364 "getAccessibleTableRowHeaderColumnCount", 365 "(Ljavax/accessibility/AccessibleContext;)I"); 366 367 // GetMethodID(getAccessibleTableColumnHeaderColumnCount) 368 FIND_METHOD(getAccessibleTableColumnHeaderColumnCountMethod, bridgeClass, 369 "getAccessibleTableColumnHeaderColumnCount", 370 "(Ljavax/accessibility/AccessibleContext;)I"); 371 372 // GetMethodID(getAccessibleTableRowDescription) 373 FIND_METHOD(getAccessibleTableRowDescriptionMethod, bridgeClass, 374 "getAccessibleTableRowDescription", 375 "(Ljavax/accessibility/AccessibleTable;I)Ljavax/accessibility/AccessibleContext;"); 376 377 // GetMethodID(getAccessibleTableColumnDescription) 378 FIND_METHOD(getAccessibleTableColumnDescriptionMethod, bridgeClass, 379 "getAccessibleTableColumnDescription", 380 "(Ljavax/accessibility/AccessibleTable;I)Ljavax/accessibility/AccessibleContext;"); 381 382 // GetMethodID(getAccessibleTableRowSelectionCount) 383 FIND_METHOD(getAccessibleTableRowSelectionCountMethod, bridgeClass, 384 "getAccessibleTableRowSelectionCount", 385 "(Ljavax/accessibility/AccessibleTable;)I"); 386 387 // GetMethodID(isAccessibleTableRowSelected) 388 FIND_METHOD(isAccessibleTableRowSelectedMethod, bridgeClass, 389 "isAccessibleTableRowSelected", 390 "(Ljavax/accessibility/AccessibleTable;I)Z"); 391 392 // GetMethodID(getAccessibleTableRowSelections) 393 FIND_METHOD(getAccessibleTableRowSelectionsMethod, bridgeClass, 394 "getAccessibleTableRowSelections", 395 "(Ljavax/accessibility/AccessibleTable;I)I"); 396 397 // GetMethodID(getAccessibleTableColumnSelectionCount) 398 FIND_METHOD(getAccessibleTableColumnSelectionCountMethod, bridgeClass, 399 "getAccessibleTableColumnSelectionCount", 400 "(Ljavax/accessibility/AccessibleTable;)I"); 401 402 // GetMethodID(isAccessibleTableColumnSelected) 403 FIND_METHOD(isAccessibleTableColumnSelectedMethod, bridgeClass, 404 "isAccessibleTableColumnSelected", 405 "(Ljavax/accessibility/AccessibleTable;I)Z"); 406 407 // GetMethodID(getAccessibleTableColumnSelections) 408 FIND_METHOD(getAccessibleTableColumnSelectionsMethod, bridgeClass, 409 "getAccessibleTableColumnSelections", 410 "(Ljavax/accessibility/AccessibleTable;I)I"); 411 412 // GetMethodID(getAccessibleTableRow) 413 FIND_METHOD(getAccessibleTableRowMethod, bridgeClass, 414 "getAccessibleTableRow", 415 "(Ljavax/accessibility/AccessibleTable;I)I"); 416 417 // GetMethodID(getAccessibleTableColumn) 418 FIND_METHOD(getAccessibleTableColumnMethod, bridgeClass, 419 "getAccessibleTableColumn", 420 "(Ljavax/accessibility/AccessibleTable;I)I"); 421 422 // GetMethodID(getAccessibleTableIndex) 423 FIND_METHOD(getAccessibleTableIndexMethod, bridgeClass, 424 "getAccessibleTableIndex", 425 "(Ljavax/accessibility/AccessibleTable;II)I"); 426 427 /* ------- end AccessibleTable methods */ 428 429 /* start AccessibleRelationSet methods ----- */ 430 431 // GetMethodID(getAccessibleRelationCount) 432 FIND_METHOD(getAccessibleRelationCountMethod, bridgeClass, 433 "getAccessibleRelationCount", 434 "(Ljavax/accessibility/AccessibleContext;)I"); 435 436 // GetMethodID(getAccessibleRelationKey) 437 FIND_METHOD(getAccessibleRelationKeyMethod, bridgeClass, 438 "getAccessibleRelationKey", 439 "(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;"); 440 441 // GetMethodID(getAccessibleRelationTargetCount) 442 FIND_METHOD(getAccessibleRelationTargetCountMethod, bridgeClass, 443 "getAccessibleRelationTargetCount", 444 "(Ljavax/accessibility/AccessibleContext;I)I"); 445 446 // GetMethodID(getAccessibleRelationTarget) 447 FIND_METHOD(getAccessibleRelationTargetMethod, bridgeClass, 448 "getAccessibleRelationTarget", 449 "(Ljavax/accessibility/AccessibleContext;II)Ljavax/accessibility/AccessibleContext;"); 450 451 452 // ------- AccessibleHypertext methods 453 454 // GetMethodID(getAccessibleHypertext) 455 FIND_METHOD(getAccessibleHypertextMethod, bridgeClass, 456 "getAccessibleHypertext", 457 "(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleHypertext;"); 458 459 // GetMethodID(activateAccessibleHyperlink) 460 FIND_METHOD(activateAccessibleHyperlinkMethod, bridgeClass, 461 "activateAccessibleHyperlink", 462 "(Ljavax/accessibility/AccessibleContext;Ljavax/accessibility/AccessibleHyperlink;)Z"); 463 464 // GetMethodID(getAccessibleHyperlinkCount) 465 FIND_METHOD(getAccessibleHyperlinkCountMethod, bridgeClass, 466 "getAccessibleHyperlinkCount", 467 "(Ljavax/accessibility/AccessibleContext;)I"); 468 469 // GetMethodID(getAccessibleHyperlink) 470 FIND_METHOD(getAccessibleHyperlinkMethod, bridgeClass, 471 "getAccessibleHyperlink", 472 "(Ljavax/accessibility/AccessibleHypertext;I)Ljavax/accessibility/AccessibleHyperlink;"); 473 474 // GetMethodID(getAccessibleHyperlinkText) 475 FIND_METHOD(getAccessibleHyperlinkTextMethod, bridgeClass, 476 "getAccessibleHyperlinkText", 477 "(Ljavax/accessibility/AccessibleHyperlink;)Ljava/lang/String;"); 478 479 // GetMethodID(getAccessibleHyperlinkURL) 480 FIND_METHOD(getAccessibleHyperlinkURLMethod, bridgeClass, 481 "getAccessibleHyperlinkURL", 482 "(Ljavax/accessibility/AccessibleHyperlink;)Ljava/lang/String;"); 483 484 // GetMethodID(getAccessibleHyperlinkStartIndex) 485 FIND_METHOD(getAccessibleHyperlinkStartIndexMethod, bridgeClass, 486 "getAccessibleHyperlinkStartIndex", 487 "(Ljavax/accessibility/AccessibleHyperlink;)I"); 488 489 // GetMethodID(getAccessibleHyperlinkEndIndex) 490 FIND_METHOD(getAccessibleHyperlinkEndIndexMethod, bridgeClass, 491 "getAccessibleHyperlinkEndIndex", 492 "(Ljavax/accessibility/AccessibleHyperlink;)I"); 493 494 // GetMethodID(getAccessibleHypertextLinkIndex) 495 FIND_METHOD(getAccessibleHypertextLinkIndexMethod, bridgeClass, 496 "getAccessibleHypertextLinkIndex", 497 "(Ljavax/accessibility/AccessibleHypertext;I)I"); 498 499 // Accessible KeyBinding, Icon and Action ==================== 500 501 // GetMethodID(getAccessibleKeyBindingsCount) 502 FIND_METHOD(getAccessibleKeyBindingsCountMethod, bridgeClass, 503 "getAccessibleKeyBindingsCount", 504 "(Ljavax/accessibility/AccessibleContext;)I"); 505 506 // GetMethodID(getAccessibleKeyBindingChar) 507 FIND_METHOD(getAccessibleKeyBindingCharMethod, bridgeClass, 508 "getAccessibleKeyBindingChar", 509 "(Ljavax/accessibility/AccessibleContext;I)C"); 510 511 // GetMethodID(getAccessibleKeyBindingModifiers) 512 FIND_METHOD(getAccessibleKeyBindingModifiersMethod, bridgeClass, 513 "getAccessibleKeyBindingModifiers", 514 "(Ljavax/accessibility/AccessibleContext;I)I"); 515 516 // GetMethodID(getAccessibleIconsCount) 517 FIND_METHOD(getAccessibleIconsCountMethod, bridgeClass, 518 "getAccessibleIconsCount", 519 "(Ljavax/accessibility/AccessibleContext;)I"); 520 521 // GetMethodID(getAccessibleIconDescription) 522 FIND_METHOD(getAccessibleIconDescriptionMethod, bridgeClass, 523 "getAccessibleIconDescription", 524 "(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;"); 525 526 // GetMethodID(getAccessibleIconHeight) 527 FIND_METHOD(getAccessibleIconHeightMethod, bridgeClass, 528 "getAccessibleIconHeight", 529 "(Ljavax/accessibility/AccessibleContext;I)I"); 530 531 // GetMethodID(getAccessibleIconWidth) 532 FIND_METHOD(getAccessibleIconWidthMethod, bridgeClass, 533 "getAccessibleIconWidth", 534 "(Ljavax/accessibility/AccessibleContext;I)I"); 535 536 // GetMethodID(getAccessibleActionsCount) 537 FIND_METHOD(getAccessibleActionsCountMethod, bridgeClass, 538 "getAccessibleActionsCount", 539 "(Ljavax/accessibility/AccessibleContext;)I"); 540 541 // GetMethodID(getAccessibleActionName) 542 FIND_METHOD(getAccessibleActionNameMethod, bridgeClass, 543 "getAccessibleActionName", 544 "(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;"); 545 546 // GetMethodID(doAccessibleActions) 547 FIND_METHOD(doAccessibleActionsMethod, bridgeClass, 548 "doAccessibleActions", 549 "(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Z"); 550 551 // ------- AccessibleText methods 552 553 // GetMethodID(getAccessibleCharCountFromContext) 554 FIND_METHOD(getAccessibleCharCountFromContextMethod, bridgeClass, 555 "getAccessibleCharCountFromContext", 556 "(Ljavax/accessibility/AccessibleContext;)I"); 557 558 // GetMethodID(getAccessibleCaretPositionFromContext) 559 FIND_METHOD(getAccessibleCaretPositionFromContextMethod, bridgeClass, 560 "getAccessibleCaretPositionFromContext", 561 "(Ljavax/accessibility/AccessibleContext;)I"); 562 563 // GetMethodID(getAccessibleIndexAtPointFromContext) 564 FIND_METHOD(getAccessibleIndexAtPointFromContextMethod, bridgeClass, 565 "getAccessibleIndexAtPointFromContext", 566 "(Ljavax/accessibility/AccessibleContext;II)I"); 567 568 // GetMethodID(getAccessibleLetterAtIndexFromContext) 569 FIND_METHOD(getAccessibleLetterAtIndexFromContextMethod, bridgeClass, 570 "getAccessibleLetterAtIndexFromContext", 571 "(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;"); 572 573 // GetMethodID(getAccessibleWordAtIndexFromContext) 574 FIND_METHOD(getAccessibleWordAtIndexFromContextMethod, bridgeClass, 575 "getAccessibleWordAtIndexFromContext", 576 "(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;"); 577 578 // GetMethodID(getAccessibleSentenceAtIndexFromContext) 579 FIND_METHOD(getAccessibleSentenceAtIndexFromContextMethod, bridgeClass, 580 "getAccessibleSentenceAtIndexFromContext", 581 "(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;"); 582 583 // GetMethodID(getAccessibleTextSelectionStartFromContext) 584 FIND_METHOD(getAccessibleTextSelectionStartFromContextMethod, bridgeClass, 585 "getAccessibleTextSelectionStartFromContext", 586 "(Ljavax/accessibility/AccessibleContext;)I"); 587 588 // GetMethodID(getAccessibleTextSelectionEndFromContext) 589 FIND_METHOD(getAccessibleTextSelectionEndFromContextMethod, bridgeClass, 590 "getAccessibleTextSelectionEndFromContext", 591 "(Ljavax/accessibility/AccessibleContext;)I"); 592 593 // GetMethodID(getAccessibleTextSelectedTextFromContext) 594 FIND_METHOD(getAccessibleTextSelectedTextFromContextMethod, bridgeClass, 595 "getAccessibleTextSelectedTextFromContext", 596 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 597 598 // GetMethodID(getAccessibleAttributesAtIndexFromContext) 599 FIND_METHOD(getAccessibleAttributesAtIndexFromContextMethod, bridgeClass, 600 "getAccessibleAttributesAtIndexFromContext", 601 "(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;"); 602 603 // GetMethodID(getAccessibleAttributeSetAtIndexFromContext) 604 FIND_METHOD(getAccessibleAttributeSetAtIndexFromContextMethod, bridgeClass, 605 "getAccessibleAttributeSetAtIndexFromContext", 606 "(Ljavax/accessibility/AccessibleContext;I)Ljavax/swing/text/AttributeSet;"); 607 608 // GetMethodID(getAccessibleTextRectAtIndexFromContext) 609 FIND_METHOD(getAccessibleTextRectAtIndexFromContextMethod, bridgeClass, 610 "getAccessibleTextRectAtIndexFromContext", 611 "(Ljavax/accessibility/AccessibleContext;I)Ljava/awt/Rectangle;"); 612 613 // GetMethodID(getAccessibleXcoordTextRectAtIndexFromContext) 614 FIND_METHOD(getAccessibleXcoordTextRectAtIndexFromContextMethod, bridgeClass, 615 "getAccessibleXcoordTextRectAtIndexFromContext", 616 "(Ljavax/accessibility/AccessibleContext;I)I"); 617 618 // GetMethodID(getAccessibleYcoordTextRectAtIndexFromContext) 619 FIND_METHOD(getAccessibleYcoordTextRectAtIndexFromContextMethod, bridgeClass, 620 "getAccessibleYcoordTextRectAtIndexFromContext", 621 "(Ljavax/accessibility/AccessibleContext;I)I"); 622 623 // GetMethodID(getAccessibleHeightTextRectAtIndexFromContext) 624 FIND_METHOD(getAccessibleHeightTextRectAtIndexFromContextMethod, bridgeClass, 625 "getAccessibleHeightTextRectAtIndexFromContext", 626 "(Ljavax/accessibility/AccessibleContext;I)I"); 627 628 // GetMethodID(getAccessibleWidthTextRectAtIndexFromContext) 629 FIND_METHOD(getAccessibleWidthTextRectAtIndexFromContextMethod, bridgeClass, 630 "getAccessibleWidthTextRectAtIndexFromContext", 631 "(Ljavax/accessibility/AccessibleContext;I)I"); 632 633 // GetMethodID(getCaretLocationX) 634 FIND_METHOD(getCaretLocationXMethod, bridgeClass, 635 "getCaretLocationX", 636 "(Ljavax/accessibility/AccessibleContext;)I"); 637 638 // GetMethodID(getCaretLocationY) 639 FIND_METHOD(getCaretLocationYMethod, bridgeClass, 640 "getCaretLocationY", 641 "(Ljavax/accessibility/AccessibleContext;)I"); 642 643 // GetMethodID(getCaretLocationHeight) 644 FIND_METHOD(getCaretLocationHeightMethod, bridgeClass, 645 "getCaretLocationHeight", 646 "(Ljavax/accessibility/AccessibleContext;)I"); 647 648 // GetMethodID(getCaretLocationWidth) 649 FIND_METHOD(getCaretLocationWidthMethod, bridgeClass, 650 "getCaretLocationWidth", 651 "(Ljavax/accessibility/AccessibleContext;)I"); 652 653 654 // GetMethodID(getAccessibleTextLineLeftBoundsFromContextMethod) 655 FIND_METHOD(getAccessibleTextLineLeftBoundsFromContextMethod, bridgeClass, 656 "getAccessibleTextLineLeftBoundsFromContext", 657 "(Ljavax/accessibility/AccessibleContext;I)I"); 658 659 // GetMethodID(getAccessibleTextLineRightBoundsFromContextMethod) 660 FIND_METHOD(getAccessibleTextLineRightBoundsFromContextMethod, bridgeClass, 661 "getAccessibleTextLineRightBoundsFromContext", 662 "(Ljavax/accessibility/AccessibleContext;I)I"); 663 664 // GetMethodID(getAccessibleTextRangeFromContextMethod) 665 FIND_METHOD(getAccessibleTextRangeFromContextMethod, bridgeClass, 666 "getAccessibleTextRangeFromContext", 667 "(Ljavax/accessibility/AccessibleContext;II)Ljava/lang/String;"); 668 669 670 // ------- AccessibleValue methods 671 672 // GetMethodID(getCurrentAccessibleValueFromContext) 673 FIND_METHOD(getCurrentAccessibleValueFromContextMethod, bridgeClass, 674 "getCurrentAccessibleValueFromContext", 675 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 676 677 // GetMethodID(getMaximumAccessibleValueFromContext) 678 FIND_METHOD(getMaximumAccessibleValueFromContextMethod, bridgeClass, 679 "getMaximumAccessibleValueFromContext", 680 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 681 682 // GetMethodID(getMinimumAccessibleValueFromContext) 683 FIND_METHOD(getMinimumAccessibleValueFromContextMethod, bridgeClass, 684 "getMinimumAccessibleValueFromContext", 685 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 686 687 688 // ------- AccessibleSelection methods 689 690 // GetMethodID(addAccessibleSelectionFromContext) 691 FIND_METHOD(addAccessibleSelectionFromContextMethod, bridgeClass, 692 "addAccessibleSelectionFromContext", 693 "(Ljavax/accessibility/AccessibleContext;I)V"); 694 695 // GetMethodID(clearAccessibleSelectionFromContext) 696 FIND_METHOD(clearAccessibleSelectionFromContextMethod, bridgeClass, 697 "clearAccessibleSelectionFromContext", 698 "(Ljavax/accessibility/AccessibleContext;)V"); 699 700 // GetMethodID(getAccessibleSelectionFromContext) 701 FIND_METHOD(getAccessibleSelectionContextFromContextMethod, bridgeClass, 702 "getAccessibleSelectionFromContext", 703 "(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;"); 704 705 // GetMethodID(getAccessibleSelectionCountFromContext) 706 FIND_METHOD(getAccessibleSelectionCountFromContextMethod, bridgeClass, 707 "getAccessibleSelectionCountFromContext", 708 "(Ljavax/accessibility/AccessibleContext;)I"); 709 710 // GetMethodID(isAccessibleChildSelectedFromContext) 711 FIND_METHOD(isAccessibleChildSelectedFromContextMethod, bridgeClass, 712 "isAccessibleChildSelectedFromContext", 713 "(Ljavax/accessibility/AccessibleContext;I)Z"); 714 715 // GetMethodID(removeAccessibleSelectionFromContext) 716 FIND_METHOD(removeAccessibleSelectionFromContextMethod, bridgeClass, 717 "removeAccessibleSelectionFromContext", 718 "(Ljavax/accessibility/AccessibleContext;I)V"); 719 720 // GetMethodID(selectAllAccessibleSelectionFromContext) 721 FIND_METHOD(selectAllAccessibleSelectionFromContextMethod, bridgeClass, 722 "selectAllAccessibleSelectionFromContext", 723 "(Ljavax/accessibility/AccessibleContext;)V"); 724 725 726 // ------- Event Notification methods 727 728 // GetMethodID(addJavaEventNotification) 729 FIND_METHOD(addJavaEventNotificationMethod, bridgeClass, 730 "addJavaEventNotification", "(J)V"); 731 732 // GetMethodID(removeJavaEventNotification) 733 FIND_METHOD(removeJavaEventNotificationMethod, bridgeClass, 734 "removeJavaEventNotification", "(J)V"); 735 736 // GetMethodID(addAccessibilityEventNotification) 737 FIND_METHOD(addAccessibilityEventNotificationMethod, bridgeClass, 738 "addAccessibilityEventNotification", "(J)V"); 739 740 // GetMethodID(removeAccessibilityEventNotification) 741 FIND_METHOD(removeAccessibilityEventNotificationMethod, bridgeClass, 742 "removeAccessibilityEventNotification", "(J)V"); 743 744 745 // ------- AttributeSet methods 746 747 // GetMethodID(getBoldFromAttributeSet) 748 FIND_METHOD(getBoldFromAttributeSetMethod, bridgeClass, 749 "getBoldFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z"); 750 751 // GetMethodID(getItalicFromAttributeSet) 752 FIND_METHOD(getItalicFromAttributeSetMethod, bridgeClass, 753 "getItalicFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z"); 754 755 // GetMethodID(getUnderlineFromAttributeSet) 756 FIND_METHOD(getUnderlineFromAttributeSetMethod, bridgeClass, 757 "getUnderlineFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z"); 758 759 // GetMethodID(getStrikethroughFromAttributeSet) 760 FIND_METHOD(getStrikethroughFromAttributeSetMethod, bridgeClass, 761 "getStrikethroughFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z"); 762 763 // GetMethodID(getSuperscriptFromAttributeSet) 764 FIND_METHOD(getSuperscriptFromAttributeSetMethod, bridgeClass, 765 "getSuperscriptFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z"); 766 767 // GetMethodID(getSubscriptFromAttributeSet) 768 FIND_METHOD(getSubscriptFromAttributeSetMethod, bridgeClass, 769 "getSubscriptFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z"); 770 771 // GetMethodID(getBackgroundColorFromAttributeSet) 772 FIND_METHOD(getBackgroundColorFromAttributeSetMethod, bridgeClass, 773 "getBackgroundColorFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;"); 774 775 // GetMethodID(getForegroundColorFromAttributeSet) 776 FIND_METHOD(getForegroundColorFromAttributeSetMethod, bridgeClass, 777 "getForegroundColorFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;"); 778 779 // GetMethodID(getFontFamilyFromAttributeSet) 780 FIND_METHOD(getFontFamilyFromAttributeSetMethod, bridgeClass, 781 "getFontFamilyFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;"); 782 783 // GetMethodID(getFontSizeFromAttributeSet) 784 FIND_METHOD(getFontSizeFromAttributeSetMethod, bridgeClass, 785 "getFontSizeFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I"); 786 787 // GetMethodID(getAlignmentFromAttributeSet) 788 FIND_METHOD(getAlignmentFromAttributeSetMethod, bridgeClass, 789 "getAlignmentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I"); 790 791 // GetMethodID(getBidiLevelFromAttributeSet) 792 FIND_METHOD(getBidiLevelFromAttributeSetMethod, bridgeClass, 793 "getBidiLevelFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I"); 794 795 // GetMethodID(getFirstLineIndentFromAttributeSet) 796 FIND_METHOD(getFirstLineIndentFromAttributeSetMethod, bridgeClass, 797 "getFirstLineIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F"); 798 799 // GetMethodID(getLeftIndentFromAttributeSet) 800 FIND_METHOD(getLeftIndentFromAttributeSetMethod, bridgeClass, 801 "getLeftIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F"); 802 803 // GetMethodID(getRightIndentFromAttributeSet) 804 FIND_METHOD(getRightIndentFromAttributeSetMethod, bridgeClass, 805 "getRightIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F"); 806 807 // GetMethodID(getLineSpacingFromAttributeSet) 808 FIND_METHOD(getLineSpacingFromAttributeSetMethod, bridgeClass, 809 "getLineSpacingFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F"); 810 811 // GetMethodID(getSpaceAboveFromAttributeSet) 812 FIND_METHOD(getSpaceAboveFromAttributeSetMethod, bridgeClass, 813 "getSpaceAboveFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F"); 814 815 // GetMethodID(getSpaceBelowFromAttributeSet) 816 FIND_METHOD(getSpaceBelowFromAttributeSetMethod, bridgeClass, 817 "getSpaceBelowFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F"); 818 819 820 /** 821 * Additional methods for Teton 822 */ 823 824 // GetMethodID(requestFocus) 825 FIND_METHOD(requestFocusMethod, bridgeClass, 826 "requestFocus", 827 "(Ljavax/accessibility/AccessibleContext;)Z"); 828 829 // GetMethodID(selectTextRange) 830 FIND_METHOD(selectTextRangeMethod, bridgeClass, 831 "selectTextRange", 832 "(Ljavax/accessibility/AccessibleContext;II)Z"); 833 834 // GetMethodID(getVisibleChildrenCount) 835 FIND_METHOD(getVisibleChildrenCountMethod, bridgeClass, 836 "getVisibleChildrenCount", 837 "(Ljavax/accessibility/AccessibleContext;)I"); 838 839 // GetMethodID(getVisibleChild) 840 FIND_METHOD(getVisibleChildMethod, bridgeClass, 841 "getVisibleChild", 842 "(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;"); 843 844 // GetMethodID(setCaretPosition) 845 FIND_METHOD(setCaretPositionMethod, bridgeClass, 846 "setCaretPosition", 847 "(Ljavax/accessibility/AccessibleContext;I)Z"); 848 849 // GetMethodID(getVirtualAccessibleNameFromContextMethod) Ben Key 850 FIND_METHOD(getVirtualAccessibleNameFromContextMethod, bridgeClass, 851 "getVirtualAccessibleNameFromContext", 852 "(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;"); 853 854 return TRUE; 855 } 856 857 // Note for the following code which makes JNI upcalls... 858 // 859 // Problem, bug DB 16818166, JBS DB JDK-8015400 860 // AccessibleContext is a JOBJECT64 which is a jobject (32 bit pointer) 861 // for a Legacy (XP) build and a jlong (64 bits) for a -32 or -64 build. 862 // For the -32 build the lower 32 bits needs to be extracted into a jobject. 863 // Otherwise, if AccessibleContext is used directly what happens is that 864 // the JNI code consumes the lower 32 of its 64 bits and that is not a 865 // problem, but then when the JNI code consumes the next 32 bits for the 866 // reference to the role String it gets the higher 0x00000000 bits from 867 // the 64 bit JOBJECT64 AccessibleContext variable and thus a null reference 868 // is passed as the String reference. 869 // 870 // Solution: 871 // Cast the JOBJECT64 to a jobject. For a 64 bit compile this is basically 872 // a noop, i.e. JOBJECT64 is a 64 bit jlong and a jobject is a 64 bit reference. 873 // For a 32 bit compile the cast drops the high order 32 bits, i.e. JOBJECT64 874 // is a 64 bit jlong and jobject is a 32 bit reference. For a Legacy build 875 // JOBJECT64 is a jobject so this is also basically a noop. The casts are 876 // done in the methods in JavaAccessBridge::processPackage. 877 878 // ----------------------------------- 879 880 /** 881 * isJavaWindow - returns whether the HWND is a Java window or not 882 * 883 */ 884 BOOL 885 AccessBridgeJavaEntryPoints::isJavaWindow(jint window) { 886 jthrowable exception; 887 BOOL returnVal; 888 889 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::isJavaWindow(%X):", window); 890 891 if (isJavaWindowMethod != (jmethodID) 0) { 892 returnVal = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, isJavaWindowMethod, window); 893 EXCEPTION_CHECK("Getting isJavaWindow - call to CallBooleanMethod()", FALSE); 894 return returnVal; 895 } else { 896 PrintDebugString("\r\n Error! either jniEnv == 0 or isJavaWindowMethod == 0"); 897 return FALSE; 898 } 899 } 900 901 // ----------------------------------- 902 903 /** 904 * isSameObject - returns whether two object reference refer to the same object 905 * 906 */ 907 BOOL 908 AccessBridgeJavaEntryPoints::isSameObject(jobject obj1, jobject obj2) { 909 jthrowable exception; 910 BOOL returnVal; 911 912 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::isSameObject(%p %p):", obj1, obj2); 913 914 returnVal = (BOOL) jniEnv->IsSameObject((jobject)obj1, (jobject)obj2); 915 EXCEPTION_CHECK("Calling IsSameObject", FALSE); 916 917 PrintDebugString("\r\n isSameObject returning %d", returnVal); 918 return returnVal; 919 } 920 921 // ----------------------------------- 922 923 /** 924 * getAccessibleContextFromHWND - returns the AccessibleContext, if any, for an HWND 925 * 926 */ 927 jobject 928 AccessBridgeJavaEntryPoints::getAccessibleContextFromHWND(jint window) { 929 jobject returnedAccessibleContext; 930 jobject globalRef; 931 jthrowable exception; 932 933 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::getAccessibleContextFromHWND(%X):", window); 934 935 if (getAccessibleContextFromHWNDMethod != (jmethodID) 0) { 936 returnedAccessibleContext = 937 (jobject)jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleContextFromHWNDMethod, 938 window); 939 EXCEPTION_CHECK("Getting AccessibleContextFromHWND - call to CallObjectMethod()", (jobject) 0); 940 globalRef = (jobject)jniEnv->NewGlobalRef((jobject)returnedAccessibleContext); 941 EXCEPTION_CHECK("Getting AccessibleContextFromHWND - call to CallObjectMethod()", (jobject) 0); 942 return globalRef; 943 } else { 944 PrintDebugString("\r\n Error! either jniEnv == 0 or getAccessibleContextFromHWNDMethod == 0"); 945 return (jobject) 0; 946 } 947 } 948 949 // ----------------------------------- 950 951 /** 952 * getHWNDFromAccessibleContext - returns the HWND for an AccessibleContext, if any 953 * returns (HWND)0 on error. 954 */ 955 HWND 956 AccessBridgeJavaEntryPoints::getHWNDFromAccessibleContext(jobject accessibleContext) { 957 jthrowable exception; 958 HWND rHWND; 959 960 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::getHWNDFromAccessibleContext(%X):", 961 accessibleContext); 962 963 if (getHWNDFromAccessibleContextMethod != (jmethodID) 0) { 964 rHWND = (HWND)jniEnv->CallIntMethod(accessBridgeObject, getHWNDFromAccessibleContextMethod, 965 accessibleContext); 966 EXCEPTION_CHECK("Getting HWNDFromAccessibleContext - call to CallIntMethod()", (HWND)0); 967 PrintDebugString("\r\n rHWND = %X", rHWND); 968 return rHWND; 969 } else { 970 PrintDebugString("\r\n Error! either jniEnv == 0 or getHWNDFromAccessibleContextMethod == 0"); 971 return (HWND)0; 972 } 973 } 974 975 976 /* ====== Utility methods ===== */ 977 978 /** 979 * Sets a text field to the specified string. Returns whether successful; 980 */ 981 BOOL 982 AccessBridgeJavaEntryPoints::setTextContents(const jobject accessibleContext, const wchar_t *text) { 983 jthrowable exception; 984 BOOL result = FALSE; 985 986 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::setTextContents(%p, %ls):", 987 accessibleContext, text); 988 989 if (setTextContentsMethod != (jmethodID) 0) { 990 991 // create a Java String for the text 992 jstring textString = jniEnv->NewString(text, (jsize)wcslen(text)); 993 if (textString == 0) { 994 PrintDebugString("\r NewString failed"); 995 return FALSE; 996 } 997 998 result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject, 999 setTextContentsMethod, 1000 accessibleContext, textString); 1001 EXCEPTION_CHECK("setTextContents - call to CallBooleanMethod()", FALSE); 1002 PrintDebugString("\r\n result = %d", result); 1003 return result; 1004 } else { 1005 PrintDebugString("\r\n Error! either jniEnv == 0 or setTextContentsMethod == 0"); 1006 return result; 1007 } 1008 } 1009 1010 /** 1011 * Returns the Accessible Context of a Page Tab object that is the 1012 * ancestor of a given object. If the object is a Page Tab object 1013 * or a Page Tab ancestor object was found, returns the object 1014 * AccessibleContext. 1015 * If there is no ancestor object that has an Accessible Role of Page Tab, 1016 * returns (AccessibleContext)0. 1017 */ 1018 jobject 1019 AccessBridgeJavaEntryPoints::getParentWithRole(const jobject accessibleContext, const wchar_t *role) { 1020 jthrowable exception; 1021 jobject rAccessibleContext; 1022 1023 PrintDebugString("In AccessBridgeJavaEntryPoints::getParentWithRole(%p):", 1024 accessibleContext); 1025 1026 if (getParentWithRoleMethod != (jmethodID) 0) { 1027 // create a Java String for the role 1028 jstring roleName = jniEnv->NewString(role, (jsize)wcslen(role)); 1029 if (roleName == 0) { 1030 PrintDebugString(" NewString failed"); 1031 return FALSE; 1032 } 1033 1034 rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 1035 getParentWithRoleMethod, 1036 accessibleContext, roleName); 1037 EXCEPTION_CHECK("Getting ParentWithRole - call to CallObjectMethod()", (AccessibleContext)0); 1038 PrintDebugString(" rAccessibleContext = %p", rAccessibleContext); 1039 jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext); 1040 EXCEPTION_CHECK("Getting ParentWithRole - call to NewGlobalRef()", FALSE); 1041 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 1042 rAccessibleContext, globalRef); 1043 return globalRef; 1044 } else { 1045 PrintDebugString("\r\n Error! either jniEnv == 0 or getParentWithRoleMethod == 0"); 1046 return 0; 1047 } 1048 } 1049 1050 /** 1051 * Returns the Accessible Context for the top level object in 1052 * a Java Window. This is same Accessible Context that is obtained 1053 * from GetAccessibleContextFromHWND for that window. Returns 1054 * (AccessibleContext)0 on error. 1055 */ 1056 jobject 1057 AccessBridgeJavaEntryPoints::getTopLevelObject(const jobject accessibleContext) { 1058 jthrowable exception; 1059 jobject rAccessibleContext; 1060 1061 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::getTopLevelObject(%p):", 1062 accessibleContext); 1063 1064 if (getTopLevelObjectMethod != (jmethodID) 0) { 1065 rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 1066 getTopLevelObjectMethod, 1067 accessibleContext); 1068 EXCEPTION_CHECK("Getting TopLevelObject - call to CallObjectMethod()", FALSE); 1069 PrintDebugString("\r\n rAccessibleContext = %p", rAccessibleContext); 1070 jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext); 1071 EXCEPTION_CHECK("Getting TopLevelObject - call to NewGlobalRef()", FALSE); 1072 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 1073 rAccessibleContext, globalRef); 1074 return globalRef; 1075 } else { 1076 PrintDebugString("\r\n Error! either jniEnv == 0 or getTopLevelObjectMethod == 0"); 1077 return 0; 1078 } 1079 } 1080 1081 /** 1082 * If there is an Ancestor object that has an Accessible Role of 1083 * Internal Frame, returns the Accessible Context of the Internal 1084 * Frame object. Otherwise, returns the top level object for that 1085 * Java Window. Returns (AccessibleContext)0 on error. 1086 */ 1087 jobject 1088 AccessBridgeJavaEntryPoints::getParentWithRoleElseRoot(const jobject accessibleContext, const wchar_t *role) { 1089 jthrowable exception; 1090 jobject rAccessibleContext; 1091 1092 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::getParentWithRoleElseRoot(%p):", 1093 accessibleContext); 1094 1095 if (getParentWithRoleElseRootMethod != (jmethodID) 0) { 1096 1097 // create a Java String for the role 1098 jstring roleName = jniEnv->NewString(role, (jsize)wcslen(role)); 1099 if (roleName == 0) { 1100 PrintDebugString("\r NewString failed"); 1101 return FALSE; 1102 } 1103 1104 rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 1105 getParentWithRoleElseRootMethod, 1106 accessibleContext, roleName); 1107 EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to CallObjectMethod()", (AccessibleContext)0); 1108 PrintDebugString(" rAccessibleContext = %p", rAccessibleContext); 1109 jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext); 1110 EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to NewGlobalRef()", FALSE); 1111 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 1112 rAccessibleContext, globalRef); 1113 return globalRef; 1114 } else { 1115 PrintDebugString("\r\n Error! either jniEnv == 0 or getParentWithRoleElseRootMethod == 0"); 1116 return 0; 1117 } 1118 } 1119 1120 /** 1121 * Returns how deep in the object hierarchy a given object is. 1122 * The top most object in the object hierarchy has an object depth of 0. 1123 * Returns -1 on error. 1124 */ 1125 jint 1126 AccessBridgeJavaEntryPoints::getObjectDepth(const jobject accessibleContext) { 1127 jthrowable exception; 1128 jint rResult; 1129 1130 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::getObjectDepth(%p):", 1131 accessibleContext); 1132 1133 if (getObjectDepthMethod != (jmethodID) 0) { 1134 rResult = jniEnv->CallIntMethod(accessBridgeObject, 1135 getObjectDepthMethod, 1136 accessibleContext); 1137 EXCEPTION_CHECK("Getting ObjectDepth - call to CallIntMethod()", -1); 1138 PrintDebugString("\r\n rResult = %d", rResult); 1139 return rResult; 1140 } else { 1141 PrintDebugString("\r\n Error! either jniEnv == 0 or getObjectDepthMethod == 0"); 1142 return -1; 1143 } 1144 } 1145 1146 1147 1148 /** 1149 * Returns the Accessible Context of the current ActiveDescendent of an object. 1150 * Returns 0 on error. 1151 */ 1152 jobject 1153 AccessBridgeJavaEntryPoints::getActiveDescendent(const jobject accessibleContext) { 1154 jthrowable exception; 1155 jobject rAccessibleContext; 1156 1157 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::getActiveDescendent(%p):", 1158 accessibleContext); 1159 1160 if (getActiveDescendentMethod != (jmethodID) 0) { 1161 rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 1162 getActiveDescendentMethod, 1163 accessibleContext); 1164 EXCEPTION_CHECK("Getting ActiveDescendent - call to CallObjectMethod()", (AccessibleContext)0); 1165 PrintDebugString("\r\n rAccessibleContext = %p", rAccessibleContext); 1166 jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext); 1167 EXCEPTION_CHECK("Getting ActiveDescendant - call to NewGlobalRef()", FALSE); 1168 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 1169 rAccessibleContext, globalRef); 1170 return globalRef; 1171 } else { 1172 PrintDebugString("\r\n Error! either jniEnv == 0 or getActiveDescendentMethod == 0"); 1173 return (AccessibleContext)0; 1174 } 1175 } 1176 1177 /** 1178 * Additional methods for Teton 1179 */ 1180 1181 /** 1182 * Returns an AccessibleName for a component using an algorithm optimized 1183 * for the JAWS screen reader by Ben Key (Freedom Scientific). This method 1184 * is only intended for JAWS. All other uses are entirely optional. 1185 * 1186 * Bug ID 4916682 - Implement JAWS AccessibleName policy 1187 */ 1188 BOOL 1189 AccessBridgeJavaEntryPoints::getVirtualAccessibleName ( 1190 IN const jobject object, 1191 OUT wchar_t * name, 1192 IN const int nameSize) 1193 { 1194 /* 1195 + 1196 Parameter validation 1197 + 1198 */ 1199 if ((name == 0) || (nameSize == 0)) 1200 { 1201 return FALSE; 1202 } 1203 ::memset (name, 0, nameSize * sizeof (wchar_t)); 1204 if (0 == object) 1205 { 1206 return FALSE; 1207 } 1208 1209 jstring js = NULL; 1210 const wchar_t * stringBytes = NULL; 1211 jthrowable exception = NULL; 1212 jsize length = 0; 1213 PrintDebugString("\r\n getVirtualAccessibleName called."); 1214 if (getVirtualAccessibleNameFromContextMethod != (jmethodID) 0) 1215 { 1216 js = (jstring) jniEnv->CallObjectMethod ( 1217 accessBridgeObject, 1218 getVirtualAccessibleNameFromContextMethod, 1219 object); 1220 EXCEPTION_CHECK("Getting AccessibleName - call to CallObjectMethod()", FALSE); 1221 if (js != (jstring) 0) 1222 { 1223 stringBytes = (const wchar_t *) jniEnv->GetStringChars (js, 0); 1224 EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE); 1225 wcsncpy(name, stringBytes, nameSize - 1); 1226 length = jniEnv->GetStringLength(js); 1227 EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE); 1228 jniEnv->ReleaseStringChars(js, stringBytes); 1229 EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE); 1230 jniEnv->CallVoidMethod ( 1231 accessBridgeObject, 1232 decrementReferenceMethod, js); 1233 EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE); 1234 wPrintDebugString(L" Accessible Name = %ls", name); 1235 jniEnv->DeleteLocalRef(js); 1236 EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE); 1237 } 1238 else 1239 { 1240 PrintDebugString(" Accessible Name is null."); 1241 } 1242 } 1243 else 1244 { 1245 PrintDebugString("\r\n Error! either jniEnv == 0 or getVirtualAccessibleNameFromContextMethod == 0"); 1246 return FALSE; 1247 } 1248 if ( 0 != name [0] ) 1249 { 1250 return TRUE; 1251 } 1252 return FALSE; 1253 } 1254 1255 1256 /** 1257 * Request focus for a component. Returns whether successful; 1258 * 1259 * Bug ID 4944757 - requestFocus method needed 1260 */ 1261 BOOL 1262 AccessBridgeJavaEntryPoints::requestFocus(const jobject accessibleContext) { 1263 1264 jthrowable exception; 1265 BOOL result = FALSE; 1266 1267 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::requestFocus(%p):", 1268 accessibleContext); 1269 1270 if (requestFocusMethod != (jmethodID) 0) { 1271 result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject, 1272 requestFocusMethod, 1273 accessibleContext); 1274 EXCEPTION_CHECK("requestFocus - call to CallBooleanMethod()", FALSE); 1275 PrintDebugString("\r\n result = %d", result); 1276 return result; 1277 } else { 1278 PrintDebugString("\r\n Error! either jniEnv == 0 or requestFocusMethod == 0"); 1279 return result; 1280 } 1281 } 1282 1283 /** 1284 * Selects text between two indices. Selection includes the text at the start index 1285 * and the text at the end index. Returns whether successful; 1286 * 1287 * Bug ID 4944758 - selectTextRange method needed 1288 */ 1289 BOOL 1290 AccessBridgeJavaEntryPoints::selectTextRange(const jobject accessibleContext, int startIndex, int endIndex) { 1291 1292 jthrowable exception; 1293 BOOL result = FALSE; 1294 1295 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::selectTextRange(%p start = %d end = %d):", 1296 accessibleContext, startIndex, endIndex); 1297 1298 if (selectTextRangeMethod != (jmethodID) 0) { 1299 result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject, 1300 selectTextRangeMethod, 1301 accessibleContext, 1302 startIndex, endIndex); 1303 EXCEPTION_CHECK("selectTextRange - call to CallBooleanMethod()", FALSE); 1304 PrintDebugString("\r\n result = %d", result); 1305 return result; 1306 } else { 1307 PrintDebugString("\r\n Error! either jniEnv == 0 or selectTextRangeMethod == 0"); 1308 return result; 1309 } 1310 } 1311 1312 /* 1313 * Returns whether two text attributes are the same. 1314 */ 1315 static BOOL CompareAccessibleTextAttributesInfo(AccessibleTextAttributesInfo *one, 1316 AccessibleTextAttributesInfo *two) { 1317 return(one->bold == two->bold 1318 && one->italic == two->italic 1319 && one->underline == two->underline 1320 && one->strikethrough == two->strikethrough 1321 && one->superscript == two->superscript 1322 && one->subscript == two->subscript 1323 && one->fontSize == two->fontSize 1324 && one->alignment == two->alignment 1325 && one->bidiLevel == two->bidiLevel 1326 && one->firstLineIndent == two->firstLineIndent 1327 && one->leftIndent == two->leftIndent 1328 && one->rightIndent == two->rightIndent 1329 && one->lineSpacing == two->lineSpacing 1330 && one->spaceAbove == two->spaceAbove 1331 && one->spaceBelow == two->spaceBelow 1332 && !wcscmp(one->backgroundColor,two->backgroundColor) 1333 && !wcscmp(one->foregroundColor,two->foregroundColor) 1334 && !wcscmp(one->fullAttributesString,two->fullAttributesString)); 1335 } 1336 1337 /** 1338 * Get text attributes between two indices. 1339 * 1340 * Only one AccessibleTextAttributesInfo structure is passed - which 1341 * contains the attributes for the first character, the function then goes 1342 * through the following characters in the range specified and stops when the 1343 * attributes are different from the first, it then returns in the passed 1344 * parameter len the number of characters with the attributes returned. In most 1345 * situations this will be all the characters, and if not the calling program 1346 * can easily get the attributes for the next characters with different 1347 * attributes 1348 * 1349 * Bug ID 4944761 - getTextAttributes between two indices method needed 1350 */ 1351 1352 /* NEW FASTER CODE!!*/ 1353 BOOL 1354 AccessBridgeJavaEntryPoints::getTextAttributesInRange(const jobject accessibleContext, 1355 int startIndex, int endIndex, 1356 AccessibleTextAttributesInfo *attributes, short *len) { 1357 1358 jstring js; 1359 const wchar_t *stringBytes; 1360 jthrowable exception; 1361 jsize length; 1362 BOOL result = FALSE; 1363 1364 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::getTextAttributesInRange(%p start = %d end = %d):", 1365 accessibleContext, startIndex, endIndex); 1366 1367 *len = 0; 1368 result = getAccessibleTextAttributes((jobject)accessibleContext, startIndex, attributes); 1369 if (result != TRUE) { 1370 return FALSE; 1371 } 1372 (*len)++; 1373 1374 for (jint i = startIndex+1; i <= endIndex; i++) { 1375 1376 AccessibleTextAttributesInfo test_attributes = *attributes; 1377 // Get the full test_attributes string at i 1378 if (getAccessibleAttributesAtIndexFromContextMethod != (jmethodID) 0) { 1379 PrintDebugString(" Getting full test_attributes string from Context..."); 1380 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 1381 getAccessibleAttributesAtIndexFromContextMethod, 1382 accessibleContext, i); 1383 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallObjectMethod()", FALSE); 1384 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 1385 if (js != (jstring) 0) { 1386 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 1387 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringChars()", FALSE); 1388 wcsncpy(test_attributes.fullAttributesString, stringBytes, (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t))); 1389 length = jniEnv->GetStringLength(js); 1390 test_attributes.fullAttributesString[length < (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t)) ? 1391 length : (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t))-2] = (wchar_t) 0; 1392 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringLength()", FALSE); 1393 jniEnv->ReleaseStringChars(js, stringBytes); 1394 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to ReleaseStringChars()", FALSE); 1395 jniEnv->CallVoidMethod(accessBridgeObject, 1396 decrementReferenceMethod, js); 1397 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallVoidMethod()", FALSE); 1398 wPrintDebugString(L" Accessible Text attributes = %ls", test_attributes.fullAttributesString); 1399 jniEnv->DeleteLocalRef(js); 1400 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE); 1401 } else { 1402 PrintDebugString(" Accessible Text attributes is null."); 1403 test_attributes.fullAttributesString[0] = (wchar_t) 0; 1404 return FALSE; 1405 } 1406 } else { 1407 PrintDebugString(" Error! either env == 0 or getAccessibleAttributesAtIndexFromContextMethod == 0"); 1408 return FALSE; 1409 } 1410 1411 if(wcscmp(attributes->fullAttributesString,test_attributes.fullAttributesString)) 1412 break; 1413 if (result != TRUE) { 1414 return FALSE; 1415 } 1416 (*len)++; 1417 } 1418 return TRUE; 1419 } 1420 1421 /* 1422 * Returns the number of visible children of a component 1423 * 1424 * Bug ID 4944762- getVisibleChildren for list-like components needed 1425 */ 1426 int 1427 AccessBridgeJavaEntryPoints::getVisibleChildrenCount(const jobject accessibleContext) { 1428 1429 jthrowable exception; 1430 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getVisibleChildrenCount(%p)", 1431 accessibleContext); 1432 1433 // get the visible children count 1434 int numChildren = jniEnv->CallIntMethod(accessBridgeObject, getVisibleChildrenCountMethod, 1435 accessibleContext); 1436 EXCEPTION_CHECK("##### Getting visible children count - call to CallIntMethod()", FALSE); 1437 PrintDebugString(" ##### visible children count = %d", numChildren); 1438 1439 return numChildren; 1440 } 1441 1442 1443 /* 1444 * This method is used to iterate through the visible children of a component. It 1445 * returns visible children information for a component starting at nStartIndex. 1446 * No more than MAX_VISIBLE_CHILDREN VisibleChildrenInfo objects will 1447 * be returned for each call to this method. Returns FALSE on error. 1448 * 1449 * Bug ID 4944762- getVisibleChildren for list-like components needed 1450 */ 1451 BOOL AccessBridgeJavaEntryPoints::getVisibleChildren(const jobject accessibleContext, 1452 const int nStartIndex, 1453 /* OUT */ VisibleChildrenInfo *visibleChildrenInfo) { 1454 1455 jthrowable exception; 1456 1457 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getVisibleChildren(%p, startIndex = %d)", 1458 accessibleContext, nStartIndex); 1459 1460 // get the visible children count 1461 int numChildren = jniEnv->CallIntMethod(accessBridgeObject, getVisibleChildrenCountMethod, 1462 accessibleContext); 1463 EXCEPTION_CHECK("##### Getting visible children count - call to CallIntMethod()", FALSE); 1464 PrintDebugString(" ##### visible children count = %d", numChildren); 1465 1466 if (nStartIndex >= numChildren) { 1467 return FALSE; 1468 } 1469 1470 // get the visible children 1471 int bufIndex = 0; 1472 for (int i = nStartIndex; (i < numChildren) && (i < nStartIndex + MAX_VISIBLE_CHILDREN); i++) { 1473 PrintDebugString(" getting visible child %d ...", i); 1474 1475 // get the visible child at index i 1476 jobject ac = jniEnv->CallObjectMethod(accessBridgeObject, getVisibleChildMethod, 1477 accessibleContext, i); 1478 EXCEPTION_CHECK("##### getVisibleChildMethod - call to CallObjectMethod()", FALSE); 1479 jobject globalRef = jniEnv->NewGlobalRef(ac); 1480 EXCEPTION_CHECK("##### getVisibleChildMethod - call to NewGlobalRef()", FALSE); 1481 visibleChildrenInfo->children[bufIndex] = (JOBJECT64)globalRef; 1482 PrintDebugString(" ##### visible child = %p", globalRef); 1483 1484 bufIndex++; 1485 } 1486 visibleChildrenInfo->returnedChildrenCount = bufIndex; 1487 1488 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getVisibleChildren succeeded"); 1489 return TRUE; 1490 } 1491 1492 /** 1493 * Set the caret to a text position. Returns whether successful; 1494 * 1495 * Bug ID 4944770 - setCaretPosition method needed 1496 */ 1497 BOOL 1498 AccessBridgeJavaEntryPoints::setCaretPosition(const jobject accessibleContext, int position) { 1499 1500 jthrowable exception; 1501 BOOL result = FALSE; 1502 1503 PrintDebugString("\r\nIn AccessBridgeJavaEntryPoints::setCaretPostion(%p position = %d):", 1504 accessibleContext, position); 1505 1506 if (setCaretPositionMethod != (jmethodID) 0) { 1507 result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject, 1508 setCaretPositionMethod, 1509 accessibleContext, position); 1510 EXCEPTION_CHECK("setCaretPostion - call to CallBooleanMethod()", FALSE); 1511 PrintDebugString("\r\n result = %d", result); 1512 return result; 1513 } else { 1514 PrintDebugString("\r\n Error! either jniEnv == 0 or setCaretPositionMethod == 0"); 1515 return result; 1516 } 1517 } 1518 1519 1520 // ----------------------------------- 1521 1522 /** 1523 * getVersionInfo - returns the version string of the java.version property 1524 * and the AccessBridge.java version 1525 * 1526 */ 1527 BOOL 1528 AccessBridgeJavaEntryPoints::getVersionInfo(AccessBridgeVersionInfo *info) { 1529 jstring js; 1530 const wchar_t *stringBytes; 1531 jthrowable exception; 1532 jsize length; 1533 1534 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getVersionInfo():"); 1535 1536 if (getJavaVersionPropertyMethod != (jmethodID) 0) { 1537 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 1538 getJavaVersionPropertyMethod); 1539 EXCEPTION_CHECK("Getting JavaVersionProperty - call to CallObjectMethod()", FALSE); 1540 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 1541 if (js != (jstring) 0) { 1542 length = jniEnv->GetStringLength(js); 1543 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 1544 if (stringBytes == NULL) { 1545 if (!jniEnv->ExceptionCheck()) { 1546 PrintDebugString("\r\n *** Exception when getting JavaVersionProperty - call to GetStringChars"); 1547 jniEnv->ExceptionDescribe(); 1548 jniEnv->ExceptionClear(); 1549 } 1550 return FALSE; 1551 } 1552 wcsncpy(info->bridgeJavaDLLVersion, 1553 stringBytes, 1554 sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t)); 1555 info->bridgeJavaDLLVersion[length < (sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t)) ? 1556 length : (sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t))-2] = (wchar_t) 0; 1557 wcsncpy(info->VMversion, 1558 stringBytes, 1559 sizeof(info->VMversion) / sizeof(wchar_t)); 1560 info->VMversion[length < (sizeof(info->VMversion) / sizeof(wchar_t)) ? 1561 length : (sizeof(info->VMversion) / sizeof(wchar_t))-2] = (wchar_t) 0; 1562 wcsncpy(info->bridgeJavaClassVersion, 1563 stringBytes, 1564 sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t)); 1565 info->bridgeJavaClassVersion[length < (sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t)) ? 1566 length : (sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t))-2] = (wchar_t) 0; 1567 wcsncpy(info->bridgeWinDLLVersion, 1568 stringBytes, 1569 sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t)); 1570 info->bridgeWinDLLVersion[length < (sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t)) ? 1571 length : (sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t))-2] = (wchar_t) 0; 1572 jniEnv->ReleaseStringChars(js, stringBytes); 1573 EXCEPTION_CHECK("Getting JavaVersionProperty - call to ReleaseStringChars()", FALSE); 1574 jniEnv->CallVoidMethod(accessBridgeObject, 1575 decrementReferenceMethod, js); 1576 EXCEPTION_CHECK("Getting JavaVersionProperty - call to CallVoidMethod()", FALSE); 1577 wPrintDebugString(L" Java version = %ls", info->VMversion); 1578 jniEnv->DeleteLocalRef(js); 1579 EXCEPTION_CHECK("Getting JavaVersionProperty - call to DeleteLocalRef()", FALSE); 1580 } else { 1581 PrintDebugString(" Java version is null."); 1582 info->VMversion[0] = (wchar_t) 0; 1583 return FALSE; 1584 } 1585 } else { 1586 PrintDebugString(" Error! either env == 0 or getJavaVersionPropertyMethod == 0"); 1587 return FALSE; 1588 } 1589 1590 return TRUE; 1591 } 1592 1593 1594 /* 1595 * Verifies the Java VM still exists and obj is an 1596 * instance of AccessibleText 1597 */ 1598 BOOL AccessBridgeJavaEntryPoints::verifyAccessibleText(jobject obj) { 1599 JavaVM *vm; 1600 BOOL retval; 1601 jthrowable exception; 1602 1603 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::verifyAccessibleText"); 1604 1605 if (jniEnv->GetJavaVM(&vm) != 0) { 1606 PrintDebugString(" Error! No Java VM"); 1607 return FALSE; 1608 } 1609 1610 if (obj == (jobject)0) { 1611 PrintDebugString(" Error! Null jobject"); 1612 return FALSE; 1613 } 1614 1615 // Copied from getAccessibleContextInfo 1616 if (getAccessibleTextFromContextMethod != (jmethodID) 0) { 1617 jobject returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 1618 getAccessibleTextFromContextMethod, 1619 (jobject)obj); 1620 EXCEPTION_CHECK("Getting AccessibleText - call to CallObjectMethod()", FALSE); 1621 PrintDebugString(" AccessibleText = %p", returnedJobject); 1622 retval = returnedJobject != (jobject) 0; 1623 jniEnv->DeleteLocalRef(returnedJobject); 1624 EXCEPTION_CHECK("Getting AccessibleText - call to DeleteLocalRef()", FALSE); 1625 } else { 1626 PrintDebugString(" Error! either env == 0 or getAccessibleTextFromContextMethod == 0"); 1627 return FALSE; 1628 } 1629 if (retval == FALSE) { 1630 PrintDebugString(" Error! jobject is not an AccessibleText"); 1631 } 1632 return retval; 1633 } 1634 1635 1636 /********** AccessibleContext routines ***********************************/ 1637 1638 /** 1639 * getAccessibleContextAt - performs the Java method call: 1640 * Accessible AccessBridge.getAccessibleContextAt(x, y) 1641 * 1642 * Note: this call explicitly goes through the AccessBridge, 1643 * so that it can keep a reference the returned jobject for the JavaVM. 1644 * You must explicity call INTreleaseJavaObject() when you are through using 1645 * the Accessible returned, to let the AccessBridge know it can release the 1646 * object, so that the can then garbage collect it. 1647 * 1648 */ 1649 jobject 1650 AccessBridgeJavaEntryPoints::getAccessibleContextAt(jint x, jint y, jobject accessibleContext) { 1651 jobject returnedAccessibleContext; 1652 jobject globalRef; 1653 jthrowable exception; 1654 1655 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleContextAt(%d, %d, %p):", 1656 x, y, accessibleContext); 1657 1658 if (getAccessibleContextAtMethod != (jmethodID) 0) { 1659 returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 1660 getAccessibleContextAtMethod, 1661 x, y, accessibleContext); 1662 EXCEPTION_CHECK("Getting AccessibleContextAt - call to CallObjectMethod()", FALSE); 1663 globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext); 1664 EXCEPTION_CHECK("Getting AccessibleContextAt - call to NewGlobalRef()", FALSE); 1665 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 1666 returnedAccessibleContext, globalRef); 1667 return globalRef; 1668 } else { 1669 PrintDebugString(" Error! either env == 0 or getAccessibleContextAtMethod == 0"); 1670 return (jobject) 0; 1671 } 1672 } 1673 1674 /** 1675 * getAccessibleWithFocus - performs the Java method calls: 1676 * Accessible Translator.getAccessible(SwingEventMonitor.getComponentWithFocus(); 1677 * 1678 * Note: this call explicitly goes through the AccessBridge, 1679 * so that the AccessBridge can hide expected changes in how this functions 1680 * between JDK 1.1.x w/AccessibilityUtility classes, and JDK 1.2, when some 1681 * of this functionality may be built into the platform 1682 * 1683 */ 1684 jobject 1685 AccessBridgeJavaEntryPoints::getAccessibleContextWithFocus() { 1686 jobject returnedAccessibleContext; 1687 jobject globalRef; 1688 jthrowable exception; 1689 1690 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleContextWithFocus()"); 1691 1692 if (getAccessibleContextWithFocusMethod != (jmethodID) 0) { 1693 returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 1694 getAccessibleContextWithFocusMethod); 1695 EXCEPTION_CHECK("Getting AccessibleContextWithFocus - call to CallObjectMethod()", FALSE); 1696 globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext); 1697 EXCEPTION_CHECK("Getting AccessibleContextWithFocus - call to NewGlobalRef()", FALSE); 1698 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 1699 returnedAccessibleContext, globalRef); 1700 return globalRef; 1701 } else { 1702 PrintDebugString(" Error! either jniEnv == 0 or getAccessibleContextWithFocusMethod == 0"); 1703 return (jobject) 0; 1704 } 1705 } 1706 1707 /** 1708 * getAccessibleContextInfo - fills a struct with a bunch of information 1709 * contained in the Java Accessibility API 1710 * 1711 * Note: if the AccessibleContext parameter is bogus, this call will blow up 1712 * 1713 * Note: this call explicitly goes through the AccessBridge, 1714 * so that it can keep a reference the returned jobject for the JavaVM. 1715 * You must explicity call releaseJavaObject() when you are through using 1716 * the AccessibleContext returned, to let the AccessBridge know it can release the 1717 * object, so that the JavaVM can then garbage collect it. 1718 */ 1719 BOOL 1720 AccessBridgeJavaEntryPoints::getAccessibleContextInfo(jobject accessibleContext, AccessibleContextInfo *info) { 1721 jstring js; 1722 const wchar_t *stringBytes; 1723 jobject returnedJobject; 1724 jthrowable exception; 1725 jsize length; 1726 1727 PrintDebugString("\r\n##### Calling AccessBridgeJavaEntryPoints::getAccessibleContextInfo(%p):", accessibleContext); 1728 1729 ZeroMemory(info, sizeof(AccessibleContextInfo)); 1730 1731 if (accessibleContext == (jobject) 0) { 1732 PrintDebugString(" passed in AccessibleContext == null! (oops)"); 1733 return (FALSE); 1734 } 1735 1736 // Get the Accessible Name 1737 if (getAccessibleNameFromContextMethod != (jmethodID) 0) { 1738 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 1739 getAccessibleNameFromContextMethod, 1740 accessibleContext); 1741 EXCEPTION_CHECK("Getting AccessibleName - call to CallObjectMethod()", FALSE); 1742 if (js != (jstring) 0) { 1743 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 1744 EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE); 1745 wcsncpy(info->name, stringBytes, (sizeof(info->name) / sizeof(wchar_t))); 1746 length = jniEnv->GetStringLength(js); 1747 info->name[length < (sizeof(info->name) / sizeof(wchar_t)) ? 1748 length : (sizeof(info->name) / sizeof(wchar_t))-2] = (wchar_t) 0; 1749 EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE); 1750 jniEnv->ReleaseStringChars(js, stringBytes); 1751 EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE); 1752 jniEnv->CallVoidMethod(accessBridgeObject, 1753 decrementReferenceMethod, js); 1754 EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE); 1755 wPrintDebugString(L" Accessible Name = %ls", info->name); 1756 jniEnv->DeleteLocalRef(js); 1757 EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE); 1758 } else { 1759 PrintDebugString(" Accessible Name is null."); 1760 info->name[0] = (wchar_t) 0; 1761 } 1762 } else { 1763 PrintDebugString(" Error! either env == 0 or getAccessibleNameFromContextMethod == 0"); 1764 return FALSE; 1765 } 1766 1767 1768 // Get the Accessible Description 1769 if (getAccessibleDescriptionFromContextMethod != (jmethodID) 0) { 1770 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 1771 getAccessibleDescriptionFromContextMethod, 1772 accessibleContext); 1773 EXCEPTION_CHECK("Getting AccessibleDescription - call to CallObjectMethod()", FALSE); 1774 if (js != (jstring) 0) { 1775 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 1776 EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE); 1777 wcsncpy(info->description, stringBytes, (sizeof(info->description) / sizeof(wchar_t))); 1778 length = jniEnv->GetStringLength(js); 1779 info->description[length < (sizeof(info->description) / sizeof(wchar_t)) ? 1780 length : (sizeof(info->description) / sizeof(wchar_t))-2] = (wchar_t) 0; 1781 EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE); 1782 jniEnv->ReleaseStringChars(js, stringBytes); 1783 EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE); 1784 jniEnv->CallVoidMethod(accessBridgeObject, 1785 decrementReferenceMethod, js); 1786 EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE); 1787 wPrintDebugString(L" Accessible Description = %ls", info->description); 1788 jniEnv->DeleteLocalRef(js); 1789 EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE); 1790 } else { 1791 PrintDebugString(" Accessible Description is null."); 1792 info->description[0] = (wchar_t) 0; 1793 } 1794 } else { 1795 PrintDebugString(" Error! either env == 0 or getAccessibleDescriptionFromContextMethod == 0"); 1796 return FALSE; 1797 } 1798 1799 1800 // Get the Accessible Role String 1801 if (getAccessibleRoleStringFromContextMethod != (jmethodID) 0) { 1802 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 1803 getAccessibleRoleStringFromContextMethod, 1804 accessibleContext); 1805 EXCEPTION_CHECK("Getting AccessibleRole - call to CallObjectMethod()", FALSE); 1806 if (js != (jstring) 0) { 1807 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 1808 EXCEPTION_CHECK("Getting AccessibleRole - call to GetStringChars()", FALSE); 1809 wcsncpy(info->role, stringBytes, (sizeof(info->role) / sizeof(wchar_t))); 1810 length = jniEnv->GetStringLength(js); 1811 info->role[length < (sizeof(info->role) / sizeof(wchar_t)) ? 1812 length : (sizeof(info->role) / sizeof(wchar_t))-2] = (wchar_t) 0; 1813 EXCEPTION_CHECK("Getting AccessibleRole - call to GetStringLength()", FALSE); 1814 jniEnv->ReleaseStringChars(js, stringBytes); 1815 EXCEPTION_CHECK("Getting AccessibleRole - call to ReleaseStringChars()", FALSE); 1816 jniEnv->CallVoidMethod(accessBridgeObject, 1817 decrementReferenceMethod, js); 1818 EXCEPTION_CHECK("Getting AccessibleRole - call to CallVoidMethod()", FALSE); 1819 wPrintDebugString(L" Accessible Role = %ls", info->role); 1820 jniEnv->DeleteLocalRef(js); 1821 EXCEPTION_CHECK("Getting AccessibleRole - call to DeleteLocalRef()", FALSE); 1822 } else { 1823 PrintDebugString(" Accessible Role is null."); 1824 info->role[0] = (wchar_t) 0; 1825 } 1826 } else { 1827 PrintDebugString(" Error! either env == 0 or getAccessibleRoleStringFromContextMethod == 0"); 1828 return FALSE; 1829 } 1830 1831 1832 // Get the Accessible Role String in the en_US locale 1833 if (getAccessibleRoleStringFromContext_en_USMethod != (jmethodID) 0) { 1834 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 1835 getAccessibleRoleStringFromContext_en_USMethod, 1836 accessibleContext); 1837 EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to CallObjectMethod()", FALSE); 1838 if (js != (jstring) 0) { 1839 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 1840 EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to GetStringChars()", FALSE); 1841 wcsncpy(info->role_en_US, stringBytes, (sizeof(info->role_en_US) / sizeof(wchar_t))); 1842 length = jniEnv->GetStringLength(js); 1843 info->role_en_US[length < (sizeof(info->role_en_US) / sizeof(wchar_t)) ? 1844 length : (sizeof(info->role_en_US) / sizeof(wchar_t))-2] = (wchar_t) 0; 1845 EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to GetStringLength()", FALSE); 1846 jniEnv->ReleaseStringChars(js, stringBytes); 1847 EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to ReleaseStringChars()", FALSE); 1848 jniEnv->CallVoidMethod(accessBridgeObject, 1849 decrementReferenceMethod, js); 1850 EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to CallVoidMethod()", FALSE); 1851 wPrintDebugString(L" Accessible Role en_US = %ls", info->role_en_US); 1852 jniEnv->DeleteLocalRef(js); 1853 EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to DeleteLocalRef()", FALSE); 1854 } else { 1855 PrintDebugString(" Accessible Role en_US is null."); 1856 info->role[0] = (wchar_t) 0; 1857 } 1858 } else { 1859 PrintDebugString(" Error! either env == 0 or getAccessibleRoleStringFromContext_en_USMethod == 0"); 1860 return FALSE; 1861 } 1862 1863 // Get the Accessible States String 1864 if (getAccessibleStatesStringFromContextMethod != (jmethodID) 0) { 1865 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 1866 getAccessibleStatesStringFromContextMethod, 1867 accessibleContext); 1868 EXCEPTION_CHECK("Getting AccessibleState - call to CallObjectMethod()", FALSE); 1869 if (js != (jstring) 0) { 1870 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 1871 EXCEPTION_CHECK("Getting AccessibleState - call to GetStringChars()", FALSE); 1872 wcsncpy(info->states, stringBytes, (sizeof(info->states) / sizeof(wchar_t))); 1873 length = jniEnv->GetStringLength(js); 1874 info->states[length < (sizeof(info->states) / sizeof(wchar_t)) ? 1875 length : (sizeof(info->states) / sizeof(wchar_t))-2] = (wchar_t) 0; 1876 EXCEPTION_CHECK("Getting AccessibleState - call to GetStringLength()", FALSE); 1877 jniEnv->ReleaseStringChars(js, stringBytes); 1878 EXCEPTION_CHECK("Getting AccessibleState - call to ReleaseStringChars()", FALSE); 1879 jniEnv->CallVoidMethod(accessBridgeObject, 1880 decrementReferenceMethod, js); 1881 EXCEPTION_CHECK("Getting AccessibleState - call to CallVoidMethod()", FALSE); 1882 wPrintDebugString(L" Accessible States = %ls", info->states); 1883 jniEnv->DeleteLocalRef(js); 1884 EXCEPTION_CHECK("Getting AccessibleState - call to DeleteLocalRef()", FALSE); 1885 } else { 1886 PrintDebugString(" Accessible States is null."); 1887 info->states[0] = (wchar_t) 0; 1888 } 1889 } else { 1890 PrintDebugString(" Error! either env == 0 or getAccessibleStatesStringFromContextMethod == 0"); 1891 return FALSE; 1892 } 1893 1894 // Get the Accessible States String in the en_US locale 1895 if (getAccessibleStatesStringFromContext_en_USMethod != (jmethodID) 0) { 1896 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 1897 getAccessibleStatesStringFromContext_en_USMethod, 1898 accessibleContext); 1899 EXCEPTION_CHECK("Getting AccessibleState_en_US - call to CallObjectMethod()", FALSE); 1900 if (js != (jstring) 0) { 1901 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 1902 EXCEPTION_CHECK("Getting AccessibleState_en_US - call to GetStringChars()", FALSE); 1903 wcsncpy(info->states_en_US, stringBytes, (sizeof(info->states_en_US) / sizeof(wchar_t))); 1904 length = jniEnv->GetStringLength(js); 1905 info->states_en_US[length < (sizeof(info->states_en_US) / sizeof(wchar_t)) ? 1906 length : (sizeof(info->states_en_US) / sizeof(wchar_t))-2] = (wchar_t) 0; 1907 EXCEPTION_CHECK("Getting AccessibleState_en_US - call to GetStringLength()", FALSE); 1908 jniEnv->ReleaseStringChars(js, stringBytes); 1909 EXCEPTION_CHECK("Getting AccessibleState_en_US - call to ReleaseStringChars()", FALSE); 1910 jniEnv->CallVoidMethod(accessBridgeObject, 1911 decrementReferenceMethod, js); 1912 EXCEPTION_CHECK("Getting AccessibleState_en_US - call to CallVoidMethod()", FALSE); 1913 wPrintDebugString(L" Accessible States en_US = %ls", info->states_en_US); 1914 jniEnv->DeleteLocalRef(js); 1915 EXCEPTION_CHECK("Getting AccessibleState_en_US - call to DeleteLocalRef()", FALSE); 1916 } else { 1917 PrintDebugString(" Accessible States en_US is null."); 1918 info->states[0] = (wchar_t) 0; 1919 } 1920 } else { 1921 PrintDebugString(" Error! either env == 0 or getAccessibleStatesStringFromContext_en_USMethod == 0"); 1922 return FALSE; 1923 } 1924 1925 1926 // Get the index in Parent 1927 if (getAccessibleIndexInParentFromContextMethod != (jmethodID) 0) { 1928 info->indexInParent = jniEnv->CallIntMethod(accessBridgeObject, 1929 getAccessibleIndexInParentFromContextMethod, 1930 accessibleContext); 1931 EXCEPTION_CHECK("Getting AccessibleIndexInParent - call to CallIntMethod()", FALSE); 1932 PrintDebugString(" Index in Parent = %d", info->indexInParent); 1933 } else { 1934 PrintDebugString(" Error! either env == 0 or getAccessibleIndexInParentFromContextMethod == 0"); 1935 return FALSE; 1936 } 1937 1938 1939 PrintDebugString("*** jniEnv: %p; accessBridgeObject: %p; AccessibleContext: %p ***", 1940 jniEnv, accessBridgeObject, accessibleContext); 1941 1942 // Get the children count 1943 if (getAccessibleChildrenCountFromContextMethod != (jmethodID) 0) { 1944 info->childrenCount = jniEnv->CallIntMethod(accessBridgeObject, 1945 getAccessibleChildrenCountFromContextMethod, 1946 accessibleContext); 1947 EXCEPTION_CHECK("Getting AccessibleChildrenCount - call to CallIntMethod()", FALSE); 1948 PrintDebugString(" Children count = %d", info->childrenCount); 1949 } else { 1950 PrintDebugString(" Error! either env == 0 or getAccessibleChildrenCountFromContextMethod == 0"); 1951 return FALSE; 1952 } 1953 1954 PrintDebugString("*** jniEnv: %p; accessBridgeObject: %p; AccessibleContext: %X ***", 1955 jniEnv, accessBridgeObject, accessibleContext); 1956 1957 1958 // Get the x coord 1959 if (getAccessibleXcoordFromContextMethod != (jmethodID) 0) { 1960 info->x = jniEnv->CallIntMethod(accessBridgeObject, 1961 getAccessibleXcoordFromContextMethod, 1962 accessibleContext); 1963 EXCEPTION_CHECK("Getting AccessibleXcoord - call to CallIntMethod()", FALSE); 1964 PrintDebugString(" X coord = %d", info->x); 1965 } else { 1966 PrintDebugString(" Error! either env == 0 or getAccessibleXcoordFromContextMethod == 0"); 1967 return FALSE; 1968 } 1969 1970 PrintDebugString("*** jniEnv: %X; accessBridgeObject: %X; AccessibleContext: %p ***", 1971 jniEnv, accessBridgeObject, accessibleContext); 1972 1973 1974 // Get the y coord 1975 if (getAccessibleYcoordFromContextMethod != (jmethodID) 0) { 1976 info->y = jniEnv->CallIntMethod(accessBridgeObject, 1977 getAccessibleYcoordFromContextMethod, 1978 accessibleContext); 1979 EXCEPTION_CHECK("Getting AccessibleYcoord - call to CallIntMethod()", FALSE); 1980 PrintDebugString(" Y coord = %d", info->y); 1981 } else { 1982 PrintDebugString(" Error! either env == 0 or getAccessibleYcoordFromContextMethod == 0"); 1983 return FALSE; 1984 } 1985 1986 // Get the width 1987 if (getAccessibleWidthFromContextMethod != (jmethodID) 0) { 1988 info->width = jniEnv->CallIntMethod(accessBridgeObject, 1989 getAccessibleWidthFromContextMethod, 1990 accessibleContext); 1991 EXCEPTION_CHECK("Getting AccessibleWidth - call to CallIntMethod()", FALSE); 1992 PrintDebugString(" Width = %d", info->width); 1993 } else { 1994 PrintDebugString(" Error! either env == 0 or getAccessibleWidthFromContextMethod == 0"); 1995 return FALSE; 1996 } 1997 1998 // Get the height 1999 if (getAccessibleHeightFromContextMethod != (jmethodID) 0) { 2000 info->height = jniEnv->CallIntMethod(accessBridgeObject, 2001 getAccessibleHeightFromContextMethod, 2002 accessibleContext); 2003 EXCEPTION_CHECK("Getting AccessibleHeight - call to CallIntMethod()", FALSE); 2004 PrintDebugString(" Height = %d", info->height); 2005 } else { 2006 PrintDebugString(" Error! either env == 0 or getAccessibleHeightFromContextMethod == 0"); 2007 return FALSE; 2008 } 2009 2010 // Get the AccessibleComponent 2011 if (getAccessibleComponentFromContextMethod != (jmethodID) 0) { 2012 returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 2013 getAccessibleComponentFromContextMethod, 2014 accessibleContext); 2015 EXCEPTION_CHECK("Getting AccessibleComponent - call to CallObjectMethod()", FALSE); 2016 PrintDebugString(" AccessibleComponent = %p", returnedJobject); 2017 info->accessibleComponent = (returnedJobject != (jobject) 0 ? TRUE : FALSE); 2018 jniEnv->DeleteLocalRef(returnedJobject); 2019 EXCEPTION_CHECK("Getting AccessibleComponent - call to DeleteLocalRef()", FALSE); 2020 } else { 2021 PrintDebugString(" Error! either env == 0 or getAccessibleComponentFromContextMethod == 0"); 2022 return FALSE; 2023 } 2024 2025 // Get the AccessibleAction 2026 if (getAccessibleActionFromContextMethod != (jmethodID) 0) { 2027 returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 2028 getAccessibleActionFromContextMethod, 2029 accessibleContext); 2030 EXCEPTION_CHECK("Getting AccessibleAction - call to CallObjectMethod()", FALSE); 2031 PrintDebugString(" AccessibleAction = %p", returnedJobject); 2032 info->accessibleAction = (returnedJobject != (jobject) 0 ? TRUE : FALSE); 2033 jniEnv->DeleteLocalRef(returnedJobject); 2034 EXCEPTION_CHECK("Getting AccessibleAction - call to DeleteLocalRef()", FALSE); 2035 } else { 2036 PrintDebugString(" Error! either env == 0 or getAccessibleActionFromContextMethod == 0"); 2037 return FALSE; 2038 } 2039 2040 // Get the AccessibleSelection 2041 if (getAccessibleSelectionFromContextMethod != (jmethodID) 0) { 2042 returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 2043 getAccessibleSelectionFromContextMethod, 2044 accessibleContext); 2045 EXCEPTION_CHECK("Getting AccessibleSelection - call to CallObjectMethod()", FALSE); 2046 PrintDebugString(" AccessibleSelection = %p", returnedJobject); 2047 info->accessibleSelection = (returnedJobject != (jobject) 0 ? TRUE : FALSE); 2048 jniEnv->DeleteLocalRef(returnedJobject); 2049 EXCEPTION_CHECK("Getting AccessibleSelection - call to DeleteLocalRef()", FALSE); 2050 } else { 2051 PrintDebugString(" Error! either env == 0 or getAccessibleSelectionFromContextMethod == 0"); 2052 return FALSE; 2053 } 2054 2055 // Get the AccessibleTable 2056 if (getAccessibleTableFromContextMethod != (jmethodID) 0) { 2057 PrintDebugString("##### Calling getAccessibleTableFromContextMethod ..."); 2058 returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 2059 getAccessibleTableFromContextMethod, 2060 accessibleContext); 2061 PrintDebugString("##### ... Returned from getAccessibleTableFromContextMethod"); 2062 EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE); 2063 PrintDebugString(" ##### AccessibleTable = %p", returnedJobject); 2064 if (returnedJobject != (jobject) 0) { 2065 info->accessibleInterfaces |= cAccessibleTableInterface; 2066 } 2067 jniEnv->DeleteLocalRef(returnedJobject); 2068 EXCEPTION_CHECK("##### Getting AccessibleTable - call to DeleteLocalRef()", FALSE); 2069 2070 /* 2071 returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 2072 getAccessibleTableFromContextMethod, 2073 AccessibleContext); 2074 PrintDebugString("##### ... Returned from getAccessibleTableFromContextMethod"); 2075 EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE); 2076 PrintDebugString(" ##### AccessibleTable = %X", returnedJobject); 2077 info->accessibleTable = returnedJobject; 2078 */ 2079 2080 } else { 2081 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableFromContextMethod == 0"); 2082 return FALSE; 2083 } 2084 2085 // Get the AccessibleText 2086 if (getAccessibleTextFromContextMethod != (jmethodID) 0) { 2087 returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 2088 getAccessibleTextFromContextMethod, 2089 accessibleContext); 2090 EXCEPTION_CHECK("Getting AccessibleText - call to CallObjectMethod()", FALSE); 2091 PrintDebugString(" AccessibleText = %p", returnedJobject); 2092 info->accessibleText = (returnedJobject != (jobject) 0 ? TRUE : FALSE); 2093 jniEnv->DeleteLocalRef(returnedJobject); 2094 EXCEPTION_CHECK("Getting AccessibleText - call to DeleteLocalRef()", FALSE); 2095 } else { 2096 PrintDebugString(" Error! either env == 0 or getAccessibleTextFromContextMethod == 0"); 2097 return FALSE; 2098 } 2099 2100 // Get the AccessibleValue 2101 if (getAccessibleValueFromContextMethod != (jmethodID) 0) { 2102 returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 2103 getAccessibleValueFromContextMethod, 2104 accessibleContext); 2105 EXCEPTION_CHECK("Getting AccessibleValue - call to CallObjectMethod()", FALSE); 2106 PrintDebugString(" AccessibleValue = %p", returnedJobject); 2107 if (returnedJobject != (jobject) 0) { 2108 info->accessibleInterfaces |= cAccessibleValueInterface; 2109 } 2110 jniEnv->DeleteLocalRef(returnedJobject); 2111 EXCEPTION_CHECK("Getting AccessibleValue - call to DeleteLocalRef()", FALSE); 2112 } else { 2113 PrintDebugString(" Error! either env == 0 or getAccessibleValueFromContextMethod == 0"); 2114 return FALSE; 2115 } 2116 2117 // FIX 2118 // get the AccessibleHypertext 2119 if (getAccessibleHypertextMethod != (jmethodID) 0 && 2120 getAccessibleHyperlinkCountMethod != (jmethodID) 0 && 2121 getAccessibleHyperlinkMethod != (jmethodID) 0 && 2122 getAccessibleHyperlinkTextMethod != (jmethodID) 0 && 2123 getAccessibleHyperlinkStartIndexMethod != (jmethodID) 0 && 2124 getAccessibleHyperlinkEndIndexMethod != (jmethodID) 0) { 2125 returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject, 2126 getAccessibleHypertextMethod, 2127 accessibleContext); 2128 EXCEPTION_CHECK("Getting AccessibleHypertext - call to CallObjectMethod()", FALSE); 2129 PrintDebugString(" AccessibleHypertext = %p", 2130 returnedJobject); 2131 if (returnedJobject != (jobject) 0) { 2132 info->accessibleInterfaces |= cAccessibleHypertextInterface; 2133 } 2134 jniEnv->DeleteLocalRef(returnedJobject); 2135 EXCEPTION_CHECK("Getting AccessibleHypertext - call to DeleteLocalRef()", FALSE); 2136 } 2137 2138 // set new accessibleInterfaces flags from old BOOL values 2139 if(info->accessibleComponent) 2140 info->accessibleInterfaces |= cAccessibleComponentInterface; 2141 if(info->accessibleAction) 2142 info->accessibleInterfaces |= cAccessibleActionInterface; 2143 if(info->accessibleSelection) 2144 info->accessibleInterfaces |= cAccessibleSelectionInterface; 2145 if(info->accessibleText) 2146 info->accessibleInterfaces |= cAccessibleTextInterface; 2147 // FIX END 2148 2149 return TRUE; 2150 } 2151 2152 /** 2153 * getAccessibleChildFromContext - performs the Java method call: 2154 * AccessibleContext AccessBridge.getAccessibleChildContext(AccessibleContext) 2155 * 2156 * Note: if the AccessibleContext parameter is bogus, this call will blow up 2157 * 2158 * Note: this call explicitly goes through the AccessBridge, 2159 * so that it can keep a reference the returned jobject for the JavaVM. 2160 * You must explicity call releaseJavaObject() when you are through using 2161 * the AccessibleContext returned, to let the AccessBridge know it can release the 2162 * object, so that the JavaVM can then garbage collect it. 2163 */ 2164 jobject 2165 AccessBridgeJavaEntryPoints::getAccessibleChildFromContext(jobject accessibleContext, jint childIndex) { 2166 jobject returnedAccessibleContext; 2167 jobject globalRef; 2168 jthrowable exception; 2169 2170 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleChildContext(%p, %d):", 2171 accessibleContext, childIndex); 2172 2173 if (getAccessibleChildFromContextMethod != (jmethodID) 0) { 2174 returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 2175 getAccessibleChildFromContextMethod, 2176 accessibleContext, childIndex); 2177 EXCEPTION_CHECK("Getting AccessibleChild - call to CallObjectMethod()", FALSE); 2178 globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext); 2179 EXCEPTION_CHECK("Getting AccessibleChild - call to NewGlobalRef()", FALSE); 2180 jniEnv->DeleteLocalRef(returnedAccessibleContext); 2181 EXCEPTION_CHECK("Getting AccessibleChild - call to DeleteLocalRef()", FALSE); 2182 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 2183 returnedAccessibleContext, globalRef); 2184 return globalRef; 2185 } else { 2186 PrintDebugString(" Error! either env == 0 or getAccessibleChildContextMethod == 0"); 2187 return (jobject) 0; 2188 } 2189 } 2190 2191 /** 2192 * getAccessibleParentFromContext - returns the AccessibleContext parent 2193 * 2194 */ 2195 jobject 2196 AccessBridgeJavaEntryPoints::getAccessibleParentFromContext(jobject accessibleContext) 2197 { 2198 jobject returnedAccessibleContext; 2199 jobject globalRef; 2200 jthrowable exception; 2201 2202 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleParentFromContext(%p):", accessibleContext); 2203 2204 if (getAccessibleParentFromContextMethod != (jmethodID) 0) { 2205 returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 2206 getAccessibleParentFromContextMethod, 2207 accessibleContext); 2208 EXCEPTION_CHECK("Getting AccessibleParent - call to CallObjectMethod()", FALSE); 2209 globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext); 2210 EXCEPTION_CHECK("Getting AccessibleParent - call to NewGlobalRef()", FALSE); 2211 jniEnv->DeleteLocalRef(returnedAccessibleContext); 2212 EXCEPTION_CHECK("Getting AccessibleParent - call to DeleteLocalRef()", FALSE); 2213 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 2214 returnedAccessibleContext, globalRef); 2215 return globalRef; 2216 } else { 2217 PrintDebugString(" Error! either env == 0 or getAccessibleParentFromContextMethod == 0"); 2218 return (jobject) 0; 2219 } 2220 } 2221 2222 2223 /********** AccessibleTable routines **********************************/ 2224 2225 BOOL 2226 AccessBridgeJavaEntryPoints::getAccessibleTableInfo(jobject accessibleContext, 2227 AccessibleTableInfo *tableInfo) { 2228 2229 jthrowable exception; 2230 2231 PrintDebugString("\r\n##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableInfo(%p):", 2232 accessibleContext); 2233 2234 // get the table row count 2235 if (getAccessibleTableRowCountMethod != (jmethodID) 0) { 2236 tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject, 2237 getAccessibleTableRowCountMethod, 2238 accessibleContext); 2239 EXCEPTION_CHECK("##### Getting AccessibleTableRowCount - call to CallIntMethod()", FALSE); 2240 PrintDebugString(" ##### table row count = %d", tableInfo->rowCount); 2241 } else { 2242 PrintDebugString(" ##### Error! either env == 0 or getAccessibleRowCountMethod == 0"); 2243 return FALSE; 2244 } 2245 2246 // get the table column count 2247 if (getAccessibleTableColumnCountMethod != (jmethodID) 0) { 2248 tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject, 2249 getAccessibleTableColumnCountMethod, 2250 accessibleContext); 2251 EXCEPTION_CHECK("Getting AccessibleTableColumnCount - call to CallIntMethod()", FALSE); 2252 PrintDebugString(" ##### table column count = %d", tableInfo->columnCount); 2253 } else { 2254 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableColumnCountMethod == 0"); 2255 return FALSE; 2256 } 2257 2258 // get the AccessibleTable 2259 if (getAccessibleTableFromContextMethod != (jmethodID) 0) { 2260 PrintDebugString("##### Calling getAccessibleTableFromContextMethod ..."); 2261 jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject, 2262 getAccessibleTableFromContextMethod, 2263 accessibleContext); 2264 PrintDebugString("##### ... Returned from getAccessibleTableFromContextMethod"); 2265 EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE); 2266 jobject globalRef = jniEnv->NewGlobalRef(accTable); 2267 EXCEPTION_CHECK("##### Getting AccessibleTable - call to NewGlobalRef()", FALSE); 2268 tableInfo->accessibleTable = (JOBJECT64)globalRef; 2269 PrintDebugString(" ##### accessibleTable = %p", globalRef); 2270 } else { 2271 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableFromContextMethod == 0"); 2272 return FALSE; 2273 } 2274 2275 // cache the AccessibleContext 2276 if (getContextFromAccessibleTableMethod != (jmethodID) 0) { 2277 PrintDebugString("##### Calling getContextFromAccessibleTable Method ..."); 2278 jobject ac = jniEnv->CallObjectMethod(accessBridgeObject, 2279 getContextFromAccessibleTableMethod, 2280 accessibleContext); 2281 PrintDebugString("##### ... Returned from getContextFromAccessibleTable Method"); 2282 EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE); 2283 jobject globalRef = jniEnv->NewGlobalRef(ac); 2284 EXCEPTION_CHECK("##### Getting AccessibleTable - call to NewGlobalRef()", FALSE); 2285 tableInfo->accessibleContext = (JOBJECT64)globalRef; 2286 PrintDebugString(" ##### accessibleContext = %p", globalRef); 2287 } else { 2288 PrintDebugString(" ##### Error! either env == 0 or getContextFromAccessibleTable Method == 0"); 2289 return FALSE; 2290 } 2291 2292 // FIX - set unused elements 2293 tableInfo->caption = NULL; 2294 tableInfo->summary = NULL; 2295 2296 PrintDebugString("##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableInfo succeeded"); 2297 return TRUE; 2298 } 2299 2300 BOOL 2301 AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo(jobject accessibleTable, jint row, jint column, 2302 AccessibleTableCellInfo *tableCellInfo) { 2303 2304 jthrowable exception; 2305 2306 PrintDebugString("\r\n##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo(%p): row=%d, column=%d", 2307 accessibleTable, row, column); 2308 2309 // FIX 2310 ZeroMemory(tableCellInfo, sizeof(AccessibleTableCellInfo)); 2311 tableCellInfo->row = row; 2312 tableCellInfo->column = column; 2313 // FIX END 2314 2315 // get the table cell index 2316 if (getAccessibleTableCellIndexMethod != (jmethodID) 0) { 2317 tableCellInfo->index = jniEnv->CallIntMethod(accessBridgeObject, 2318 getAccessibleTableCellIndexMethod, 2319 accessibleTable, row, column); 2320 EXCEPTION_CHECK("##### Getting AccessibleTableCellIndex - call to CallIntMethod()", FALSE); 2321 PrintDebugString(" ##### table cell index = %d", tableCellInfo->index); 2322 } else { 2323 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableCellIndexMethod == 0"); 2324 return FALSE; 2325 } 2326 2327 // get the table cell row extent 2328 if (getAccessibleTableCellRowExtentMethod != (jmethodID) 0) { 2329 tableCellInfo->rowExtent = jniEnv->CallIntMethod(accessBridgeObject, 2330 getAccessibleTableCellRowExtentMethod, 2331 accessibleTable, row, column); 2332 EXCEPTION_CHECK("##### Getting AccessibleTableCellRowExtentCount - call to CallIntMethod()", FALSE); 2333 PrintDebugString(" ##### table cell row extent = %d", tableCellInfo->rowExtent); 2334 } else { 2335 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableCellRowExtentMethod == 0"); 2336 return FALSE; 2337 } 2338 2339 // get the table cell column extent 2340 if (getAccessibleTableCellColumnExtentMethod != (jmethodID) 0) { 2341 tableCellInfo->columnExtent = jniEnv->CallIntMethod(accessBridgeObject, 2342 getAccessibleTableCellColumnExtentMethod, 2343 accessibleTable, row, column); 2344 EXCEPTION_CHECK("##### Getting AccessibleTableCellColumnExtentCount - call to CallIntMethod()", FALSE); 2345 PrintDebugString(" ##### table cell column extent = %d", tableCellInfo->columnExtent); 2346 } else { 2347 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableCellColumnExtentMethod == 0"); 2348 return FALSE; 2349 } 2350 2351 // get whether the table cell is selected 2352 if (isAccessibleTableCellSelectedMethod != (jmethodID) 0) { 2353 tableCellInfo->isSelected = jniEnv->CallBooleanMethod(accessBridgeObject, 2354 isAccessibleTableCellSelectedMethod, 2355 accessibleTable, row, column); 2356 EXCEPTION_CHECK("##### Getting isAccessibleTableCellSelected - call to CallBooleanMethod()", FALSE); 2357 PrintDebugString(" ##### table cell isSelected = %d", tableCellInfo->isSelected); 2358 } else { 2359 PrintDebugString(" ##### Error! either env == 0 or isAccessibleTableCellSelectedMethod == 0"); 2360 return FALSE; 2361 } 2362 2363 // get the table cell AccessibleContext 2364 if (getAccessibleTableCellAccessibleContextMethod != (jmethodID) 0) { 2365 jobject tableCellAC = jniEnv->CallObjectMethod(accessBridgeObject, 2366 getAccessibleTableCellAccessibleContextMethod, 2367 accessibleTable, row, column); 2368 EXCEPTION_CHECK("##### Getting AccessibleTableCellAccessibleContext - call to CallObjectMethod()", FALSE); 2369 jobject globalRef = jniEnv->NewGlobalRef(tableCellAC); 2370 EXCEPTION_CHECK("##### Getting AccessibleTableCellAccessibleContext - call to NewGlobalRef()", FALSE); 2371 tableCellInfo->accessibleContext = (JOBJECT64)globalRef; 2372 PrintDebugString(" ##### table cell AccessibleContext = %p", globalRef); 2373 } else { 2374 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableCellAccessibleContextMethod == 0"); 2375 return FALSE; 2376 } 2377 2378 PrintDebugString(" ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo succeeded"); 2379 return TRUE; 2380 } 2381 2382 BOOL 2383 AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader(jobject acParent, AccessibleTableInfo *tableInfo) { 2384 2385 jthrowable exception; 2386 2387 PrintDebugString("\r\n##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader(%p):", 2388 acParent); 2389 2390 // get the header row count 2391 if (getAccessibleTableRowHeaderRowCountMethod != (jmethodID) 0) { 2392 tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject, 2393 getAccessibleTableRowHeaderRowCountMethod, 2394 acParent); 2395 EXCEPTION_CHECK("##### Getting AccessibleTableRowHeaderRowCount - call to CallIntMethod()", FALSE); 2396 PrintDebugString(" ##### table row count = %d", tableInfo->rowCount); 2397 } else { 2398 PrintDebugString(" ##### Error! either env == 0 or getAccessibleRowHeaderRowCountMethod == 0"); 2399 return FALSE; 2400 } 2401 2402 // get the header column count 2403 if (getAccessibleTableRowHeaderColumnCountMethod != (jmethodID) 0) { 2404 tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject, 2405 getAccessibleTableRowHeaderColumnCountMethod, 2406 acParent); 2407 EXCEPTION_CHECK("Getting AccessibleTableRowHeaderColumnCount - call to CallIntMethod()", FALSE); 2408 PrintDebugString(" ##### table column count = %d", tableInfo->columnCount); 2409 } else { 2410 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableRowHeaderColumnCountMethod == 0"); 2411 return FALSE; 2412 } 2413 2414 // get the header AccessibleTable 2415 if (getAccessibleTableRowHeaderMethod != (jmethodID) 0) { 2416 jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject, 2417 getAccessibleTableRowHeaderMethod, 2418 acParent); 2419 EXCEPTION_CHECK("##### Getting AccessibleTableRowHeader - call to CallObjectMethod()", FALSE); 2420 jobject globalRef = jniEnv->NewGlobalRef(accTable); 2421 EXCEPTION_CHECK("##### Getting AccessibleTableRowHeader - call to NewGlobalRef()", FALSE); 2422 tableInfo->accessibleTable = (JOBJECT64)globalRef; 2423 PrintDebugString(" ##### row header AccessibleTable = %p", globalRef); 2424 } else { 2425 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableRowHeaderMethod == 0"); 2426 return FALSE; 2427 } 2428 2429 // FIX - set unused elements 2430 tableInfo->caption = NULL; 2431 tableInfo->summary = NULL; 2432 tableInfo->accessibleContext = NULL; 2433 2434 PrintDebugString(" ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader succeeded"); 2435 return TRUE; 2436 } 2437 2438 BOOL 2439 AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader(jobject acParent, AccessibleTableInfo *tableInfo) { 2440 jthrowable exception; 2441 2442 PrintDebugString("\r\n##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader(%p):", 2443 acParent); 2444 2445 // get the header row count 2446 if (getAccessibleTableColumnHeaderRowCountMethod != (jmethodID) 0) { 2447 tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject, 2448 getAccessibleTableColumnHeaderRowCountMethod, 2449 acParent); 2450 EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeaderRowCount - call to CallIntMethod()", FALSE); 2451 PrintDebugString(" ##### table row count = %d", tableInfo->rowCount); 2452 } else { 2453 PrintDebugString(" ##### Error! either env == 0 or getAccessibleColumnHeaderRowCountMethod == 0"); 2454 return FALSE; 2455 } 2456 2457 // get the header column count 2458 if (getAccessibleTableColumnHeaderColumnCountMethod != (jmethodID) 0) { 2459 tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject, 2460 getAccessibleTableColumnHeaderColumnCountMethod, 2461 acParent); 2462 EXCEPTION_CHECK("Getting AccessibleTableColumnHeaderColumnCount - call to CallIntMethod()", FALSE); 2463 PrintDebugString(" ##### table column count = %d", tableInfo->columnCount); 2464 } else { 2465 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableColumnHeaderColumnCountMethod == 0"); 2466 return FALSE; 2467 } 2468 // get the header AccessibleTable 2469 if (getAccessibleTableColumnHeaderMethod != (jmethodID) 0) { 2470 jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject, 2471 getAccessibleTableColumnHeaderMethod, 2472 acParent); 2473 EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeader - call to CallObjectMethod()", FALSE); 2474 jobject globalRef = jniEnv->NewGlobalRef(accTable); 2475 EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeader - call to NewGlobalRef()", FALSE); 2476 tableInfo->accessibleTable = (JOBJECT64)globalRef; 2477 PrintDebugString(" ##### column header AccessibleTable = %p", globalRef); 2478 } else { 2479 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableColumnHeaderMethod == 0"); 2480 return FALSE; 2481 } 2482 2483 // FIX - set unused elements 2484 tableInfo->caption = NULL; 2485 tableInfo->summary = NULL; 2486 tableInfo->accessibleContext = NULL; 2487 2488 PrintDebugString(" ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader succeeded"); 2489 return TRUE; 2490 } 2491 2492 jobject 2493 AccessBridgeJavaEntryPoints::getAccessibleTableRowDescription(jobject acParent, jint row) { 2494 2495 jobject returnedAccessibleContext; 2496 jobject globalRef; 2497 jthrowable exception; 2498 2499 PrintDebugString("\r\n##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowDescription(%p):", 2500 acParent); 2501 2502 if (getAccessibleTableRowDescriptionMethod != (jmethodID) 0) { 2503 returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject, 2504 getAccessibleTableRowDescriptionMethod, 2505 acParent, row); 2506 EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to CallObjectMethod()", FALSE); 2507 globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext); 2508 EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to NewGlobalRef()", FALSE); 2509 jniEnv->DeleteLocalRef(returnedAccessibleContext); 2510 EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to DeleteLocalRef()", FALSE); 2511 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 2512 returnedAccessibleContext, globalRef); 2513 return globalRef; 2514 } else { 2515 PrintDebugString(" Error! either env == 0 or getAccessibleTableRowDescriptionMethod == 0"); 2516 return (jobject) 0; 2517 } 2518 } 2519 2520 jobject 2521 AccessBridgeJavaEntryPoints::getAccessibleTableColumnDescription(jobject acParent, jint column) { 2522 2523 jobject returnedAccessibleContext; 2524 jobject globalRef; 2525 jthrowable exception; 2526 2527 PrintDebugString("\r\n##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnDescription(%p):", 2528 acParent); 2529 2530 if (getAccessibleTableColumnDescriptionMethod != (jmethodID) 0) { 2531 returnedAccessibleContext = jniEnv->CallObjectMethod( 2532 accessBridgeObject, 2533 getAccessibleTableColumnDescriptionMethod, 2534 acParent, column); 2535 EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to CallObjectMethod()", FALSE); 2536 globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext); 2537 EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to NewGlobalRef()", FALSE); 2538 jniEnv->DeleteLocalRef(returnedAccessibleContext); 2539 EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to DeleteLocalRef()", FALSE); 2540 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 2541 returnedAccessibleContext, globalRef); 2542 return globalRef; 2543 } else { 2544 PrintDebugString(" Error! either env == 0 or getAccessibleTableColumnDescriptionMethod == 0"); 2545 return (jobject) 0; 2546 } 2547 } 2548 2549 jint 2550 AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount(jobject accessibleTable) { 2551 2552 jthrowable exception; 2553 jint count; 2554 2555 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount(%p)", 2556 accessibleTable); 2557 2558 // Get the table row selection count 2559 if (getAccessibleTableRowSelectionCountMethod != (jmethodID) 0) { 2560 count = jniEnv->CallIntMethod(accessBridgeObject, 2561 getAccessibleTableRowSelectionCountMethod, 2562 accessibleTable); 2563 EXCEPTION_CHECK("##### Getting AccessibleTableRowSelectionCount - call to CallIntMethod()", FALSE); 2564 PrintDebugString(" ##### table row selection count = %d", count); 2565 return count; 2566 } else { 2567 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableRowSelectionCountMethod == 0"); 2568 return 0; 2569 } 2570 2571 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount failed"); 2572 return 0; 2573 } 2574 2575 BOOL 2576 AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected(jobject accessibleTable, jint row) { 2577 jthrowable exception; 2578 BOOL result; 2579 2580 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected(%p, %d)", 2581 accessibleTable, row); 2582 2583 if (isAccessibleTableRowSelectedMethod != (jmethodID) 0) { 2584 result = jniEnv->CallBooleanMethod(accessBridgeObject, 2585 isAccessibleTableRowSelectedMethod, 2586 accessibleTable, row); 2587 EXCEPTION_CHECK("##### Getting isAccessibleTableRowSelected - call to CallBooleanMethod()", FALSE); 2588 PrintDebugString(" ##### table row isSelected = %d", result); 2589 return result; 2590 } else { 2591 PrintDebugString(" ##### Error! either env == 0 or isAccessibleTableRowSelectedMethod == 0"); 2592 return FALSE; 2593 } 2594 2595 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected failed"); 2596 return FALSE; 2597 } 2598 2599 BOOL 2600 AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections(jobject accessibleTable, jint count, 2601 jint *selections) { 2602 2603 jthrowable exception; 2604 2605 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections(%p, %d %p)", 2606 accessibleTable, count, selections); 2607 2608 if (getAccessibleTableRowSelectionsMethod == (jmethodID) 0) { 2609 return FALSE; 2610 } 2611 // Get the table row selections 2612 for (int i = 0; i < count; i++) { 2613 2614 selections[i] = jniEnv->CallIntMethod(accessBridgeObject, 2615 getAccessibleTableRowSelectionsMethod, 2616 accessibleTable, 2617 i); 2618 EXCEPTION_CHECK("##### Getting AccessibleTableRowSelections - call to CallIntMethod()", FALSE); 2619 PrintDebugString(" ##### table row selection[%d] = %d", i, selections[i]); 2620 } 2621 2622 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections succeeded"); 2623 return TRUE; 2624 } 2625 2626 2627 jint 2628 AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount(jobject accessibleTable) { 2629 2630 jthrowable exception; 2631 jint count; 2632 2633 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount(%p)", 2634 accessibleTable); 2635 2636 // Get the table column selection count 2637 if (getAccessibleTableColumnSelectionCountMethod != (jmethodID) 0) { 2638 count = jniEnv->CallIntMethod(accessBridgeObject, 2639 getAccessibleTableColumnSelectionCountMethod, 2640 accessibleTable); 2641 EXCEPTION_CHECK("##### Getting AccessibleTableColumnSelectionCount - call to CallIntMethod()", FALSE); 2642 PrintDebugString(" ##### table column selection count = %d", count); 2643 return count; 2644 } else { 2645 PrintDebugString(" ##### Error! either env == 0 or getAccessibleRowCountMethod == 0"); 2646 return 0; 2647 } 2648 2649 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount failed"); 2650 return 0; 2651 } 2652 2653 BOOL 2654 AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected(jobject accessibleTable, jint column) { 2655 jthrowable exception; 2656 BOOL result; 2657 2658 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected(%p, %d)", 2659 accessibleTable, column); 2660 2661 if (isAccessibleTableColumnSelectedMethod != (jmethodID) 0) { 2662 result = jniEnv->CallBooleanMethod(accessBridgeObject, 2663 isAccessibleTableColumnSelectedMethod, 2664 accessibleTable, column); 2665 EXCEPTION_CHECK("##### Getting isAccessibleTableColumnSelected - call to CallBooleanMethod()", FALSE); 2666 PrintDebugString(" ##### table column isSelected = %d", result); 2667 return result; 2668 } else { 2669 PrintDebugString(" ##### Error! either env == 0 or isAccessibleTableColumnSelectedMethod == 0"); 2670 return FALSE; 2671 } 2672 2673 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected failed"); 2674 return FALSE; 2675 } 2676 2677 BOOL 2678 AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections(jobject accessibleTable, jint count, 2679 jint *selections) { 2680 jthrowable exception; 2681 2682 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections(%p, %d, %p)", 2683 accessibleTable, count, selections); 2684 2685 if (getAccessibleTableColumnSelectionsMethod == (jmethodID) 0) { 2686 return FALSE; 2687 } 2688 // Get the table column selections 2689 for (int i = 0; i < count; i++) { 2690 2691 selections[i] = jniEnv->CallIntMethod(accessBridgeObject, 2692 getAccessibleTableColumnSelectionsMethod, 2693 accessibleTable, 2694 i); 2695 EXCEPTION_CHECK("##### Getting AccessibleTableColumnSelections - call to CallIntMethod()", FALSE); 2696 PrintDebugString(" ##### table Column selection[%d] = %d", i, selections[i]); 2697 } 2698 2699 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections succeeded"); 2700 return TRUE; 2701 } 2702 2703 2704 jint 2705 AccessBridgeJavaEntryPoints::getAccessibleTableRow(jobject accessibleTable, jint index) { 2706 jthrowable exception; 2707 jint result; 2708 2709 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleTableRow(%p, index=%d)", 2710 accessibleTable, index); 2711 2712 if (getAccessibleTableRowMethod != (jmethodID) 0) { 2713 result = jniEnv->CallIntMethod(accessBridgeObject, 2714 getAccessibleTableRowMethod, 2715 accessibleTable, index); 2716 EXCEPTION_CHECK("##### Getting AccessibleTableRow - call to CallIntMethod()", FALSE); 2717 PrintDebugString(" ##### table row = %d", result); 2718 return result; 2719 } else { 2720 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableRowMethod == 0"); 2721 return -1; 2722 } 2723 2724 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleTableRow failed"); 2725 return -1; 2726 } 2727 2728 jint 2729 AccessBridgeJavaEntryPoints::getAccessibleTableColumn(jobject accessibleTable, jint index) { 2730 jthrowable exception; 2731 jint result; 2732 2733 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleTableColumn(%p, index=%d)", 2734 accessibleTable, index); 2735 2736 if (getAccessibleTableColumnMethod != (jmethodID) 0) { 2737 result = jniEnv->CallIntMethod(accessBridgeObject, 2738 getAccessibleTableColumnMethod, 2739 accessibleTable, index); 2740 EXCEPTION_CHECK("##### Getting AccessibleTableColumn - call to CallIntMethod()", FALSE); 2741 PrintDebugString(" ##### table column = %d", result); 2742 return result; 2743 } else { 2744 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableColumnMethod == 0"); 2745 return -1; 2746 } 2747 2748 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumn failed"); 2749 return -1; 2750 } 2751 2752 jint 2753 AccessBridgeJavaEntryPoints::getAccessibleTableIndex(jobject accessibleTable, jint row, jint column) { 2754 jthrowable exception; 2755 jint result; 2756 2757 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleTableIndex(%p, row=%d, col=%d)", 2758 accessibleTable, row, column); 2759 2760 if (getAccessibleTableIndexMethod != (jmethodID) 0) { 2761 result = jniEnv->CallIntMethod(accessBridgeObject, 2762 getAccessibleTableIndexMethod, 2763 accessibleTable, row, column); 2764 EXCEPTION_CHECK("##### Getting getAccessibleTableIndex - call to CallIntMethod()", FALSE); 2765 PrintDebugString(" ##### table index = %d", result); 2766 return result; 2767 } else { 2768 PrintDebugString(" ##### Error! either env == 0 or getAccessibleTableIndexMethod == 0"); 2769 return -1; 2770 } 2771 2772 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleTableIndex failed"); 2773 return -1; 2774 } 2775 2776 /********** end AccessibleTable routines ******************************/ 2777 2778 2779 /********** begin AccessibleRelationSet routines **********************/ 2780 2781 BOOL 2782 AccessBridgeJavaEntryPoints::getAccessibleRelationSet(jobject accessibleContext, 2783 AccessibleRelationSetInfo *relationSet) { 2784 2785 jthrowable exception; 2786 const wchar_t *stringBytes; 2787 jsize length; 2788 2789 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleRelationSet(%p, %p)", 2790 accessibleContext, relationSet); 2791 2792 if (getAccessibleRelationCountMethod == (jmethodID) 0 || 2793 getAccessibleRelationKeyMethod == (jmethodID) 0 || 2794 getAccessibleRelationTargetCountMethod == (jmethodID) 0 || 2795 getAccessibleRelationTargetMethod == (jmethodID) 0) { 2796 return FALSE; 2797 } 2798 2799 // Get the relations set count 2800 relationSet->relationCount = jniEnv->CallIntMethod(accessBridgeObject, 2801 getAccessibleRelationCountMethod, 2802 accessibleContext); 2803 EXCEPTION_CHECK("##### Getting AccessibleRelationCount - call to CallIntMethod()", FALSE); 2804 PrintDebugString(" ##### AccessibleRelation count = %d", relationSet->relationCount); 2805 2806 2807 // Get the relation set 2808 for (int i = 0; i < relationSet->relationCount && i < MAX_RELATIONS; i++) { 2809 2810 jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject, 2811 getAccessibleRelationKeyMethod, 2812 accessibleContext, 2813 i); 2814 2815 EXCEPTION_CHECK("Getting AccessibleRelationKey - call to CallObjectMethod()", FALSE); 2816 if (js != (jstring) 0) { 2817 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 2818 EXCEPTION_CHECK("Getting AccessibleRelation key - call to GetStringChars()", FALSE); 2819 wcsncpy(relationSet->relations[i].key, stringBytes, (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t))); 2820 length = jniEnv->GetStringLength(js); 2821 relationSet->relations[i].key [length < (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t)) ? 2822 length : (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t))-2] = (wchar_t) 0; 2823 EXCEPTION_CHECK("Getting AccessibleRelation key - call to GetStringLength()", FALSE); 2824 jniEnv->ReleaseStringChars(js, stringBytes); 2825 EXCEPTION_CHECK("Getting AccessibleRelation key - call to ReleaseStringChars()", FALSE); 2826 // jniEnv->CallVoidMethod(accessBridgeObject, 2827 // decrementReferenceMethod, js); 2828 //EXCEPTION_CHECK("Getting AccessibleRelation key - call to CallVoidMethod()", FALSE); 2829 PrintDebugString("##### AccessibleRelation key = %ls", relationSet->relations[i].key ); 2830 jniEnv->DeleteLocalRef(js); 2831 EXCEPTION_CHECK("Getting AccessibleRelation key - call to DeleteLocalRef()", FALSE); 2832 } else { 2833 PrintDebugString(" AccessibleRelation key is null."); 2834 relationSet->relations[i].key [0] = (wchar_t) 0; 2835 } 2836 2837 relationSet->relations[i].targetCount = jniEnv->CallIntMethod(accessBridgeObject, 2838 getAccessibleRelationTargetCountMethod, 2839 accessibleContext, 2840 i); 2841 2842 for (int j = 0; j < relationSet->relations[i].targetCount && j < MAX_RELATION_TARGETS; j++) { 2843 jobject target = jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleRelationTargetMethod, 2844 accessibleContext, i, j); 2845 EXCEPTION_CHECK("Getting AccessibleRelationSet - call to CallObjectMethod()", FALSE); 2846 jobject globalRef = jniEnv->NewGlobalRef(target); 2847 EXCEPTION_CHECK("Getting AccessibleRelationSet - call to NewGlobalRef()", FALSE); 2848 relationSet->relations[i].targets[j] = (JOBJECT64)globalRef; 2849 PrintDebugString(" relation set item: %p", globalRef); 2850 } 2851 } 2852 2853 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleRelationSet succeeded"); 2854 return TRUE; 2855 } 2856 2857 2858 /********** end AccessibleRelationSet routines ************************/ 2859 2860 2861 /********** begin AccessibleHypertext routines **********************/ 2862 2863 BOOL 2864 AccessBridgeJavaEntryPoints::getAccessibleHypertext(jobject accessibleContext, 2865 AccessibleHypertextInfo *hypertext) { 2866 2867 jthrowable exception; 2868 const wchar_t *stringBytes; 2869 jsize length; 2870 2871 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleHypertext(%p, %p)", 2872 accessibleContext, hypertext); 2873 2874 // get the AccessibleHypertext 2875 jobject ht = jniEnv->CallObjectMethod(accessBridgeObject, 2876 getAccessibleHypertextMethod, 2877 accessibleContext); 2878 EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to CallObjectMethod()", FALSE); 2879 jobject globalRef = jniEnv->NewGlobalRef(ht); 2880 EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to NewGlobalRef()", FALSE); 2881 hypertext->accessibleHypertext = (JOBJECT64)globalRef; 2882 PrintDebugString(" ##### AccessibleHypertext = %p", globalRef); 2883 2884 if (hypertext->accessibleHypertext == 0) { 2885 PrintDebugString(" ##### null AccessibleHypertext; returning FALSE"); 2886 return false; 2887 } 2888 2889 // get the hyperlink count 2890 hypertext->linkCount = jniEnv->CallIntMethod(accessBridgeObject, 2891 getAccessibleHyperlinkCountMethod,accessibleContext); 2892 2893 EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", FALSE); 2894 PrintDebugString(" ##### hyperlink count = %d", hypertext->linkCount); 2895 2896 2897 // get the hypertext links 2898 for (int i = 0; i < hypertext->linkCount && i < MAX_HYPERLINKS; i++) { 2899 2900 // get the hyperlink 2901 jobject hl = jniEnv->CallObjectMethod(accessBridgeObject, 2902 getAccessibleHyperlinkMethod, 2903 accessibleContext, 2904 i); 2905 EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE); 2906 jobject globalRef = jniEnv->NewGlobalRef(hl); 2907 EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE); 2908 hypertext->links[i].accessibleHyperlink = (JOBJECT64)globalRef; 2909 PrintDebugString(" ##### AccessibleHyperlink = %p", globalRef); 2910 2911 // get the hyperlink text 2912 jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject, 2913 getAccessibleHyperlinkTextMethod, 2914 hypertext->links[i].accessibleHyperlink, 2915 i); 2916 2917 EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE); 2918 if (js != (jstring) 0) { 2919 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 2920 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE); 2921 wcsncpy(hypertext->links[i].text, stringBytes, (sizeof(hypertext->links[i].text) / sizeof(wchar_t))); 2922 length = jniEnv->GetStringLength(js); 2923 if (length >= (sizeof(hypertext->links[i].text) / sizeof(wchar_t))) { 2924 length = (sizeof(hypertext->links[i].text) / sizeof(wchar_t)) - 2; 2925 } 2926 hypertext->links[i].text[length] = (wchar_t) 0; 2927 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE); 2928 jniEnv->ReleaseStringChars(js, stringBytes); 2929 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE); 2930 // jniEnv->CallVoidMethod(accessBridgeObject, 2931 // decrementReferenceMethod, js); 2932 //EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE); 2933 PrintDebugString("##### AccessibleHyperlink text = %ls", hypertext->links[i].text ); 2934 jniEnv->DeleteLocalRef(js); 2935 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE); 2936 } else { 2937 PrintDebugString(" AccessibleHyperlink text is null."); 2938 hypertext->links[i].text[0] = (wchar_t) 0; 2939 } 2940 2941 hypertext->links[i].startIndex = jniEnv->CallIntMethod(accessBridgeObject, 2942 getAccessibleHyperlinkStartIndexMethod, 2943 hypertext->links[i].accessibleHyperlink, 2944 i); 2945 EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE); 2946 PrintDebugString(" ##### hyperlink start index = %d", hypertext->links[i].startIndex); 2947 2948 2949 hypertext->links[i].endIndex = jniEnv->CallIntMethod(accessBridgeObject, 2950 getAccessibleHyperlinkEndIndexMethod, 2951 hypertext->links[i].accessibleHyperlink, 2952 i); 2953 EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE); 2954 PrintDebugString(" ##### hyperlink end index = %d", hypertext->links[i].endIndex); 2955 2956 } 2957 2958 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleHypertext succeeded"); 2959 return TRUE; 2960 } 2961 2962 /* 2963 * Activates an AccessibleHyperlink 2964 */ 2965 BOOL 2966 AccessBridgeJavaEntryPoints::activateAccessibleHyperlink(jobject accessibleContext, 2967 jobject accessibleHyperlink) { 2968 2969 jthrowable exception; 2970 BOOL returnVal; 2971 2972 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::activateAccessibleHyperlink(%p, %p):", 2973 accessibleContext, accessibleHyperlink); 2974 2975 if (activateAccessibleHyperlinkMethod != (jmethodID) 0) { 2976 returnVal = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, activateAccessibleHyperlinkMethod, 2977 accessibleContext, accessibleHyperlink); 2978 EXCEPTION_CHECK("activateAccessibleHyperlink - call to CallBooleanMethod()", FALSE); 2979 return returnVal; 2980 } else { 2981 PrintDebugString("\r\n Error! either jniEnv == 0 or activateAccessibleHyperlinkMethod == 0"); 2982 return FALSE; 2983 } 2984 } 2985 2986 2987 /* 2988 * This method is used to iterate through the hyperlinks in a component. It 2989 * returns hypertext information for a component starting at hyperlink index 2990 * nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will 2991 * be returned for each call to this method. 2992 * returns FALSE on error. 2993 */ 2994 BOOL 2995 AccessBridgeJavaEntryPoints::getAccessibleHypertextExt(const jobject accessibleContext, 2996 const jint nStartIndex, 2997 /* OUT */ AccessibleHypertextInfo *hypertext) { 2998 2999 jthrowable exception; 3000 const wchar_t *stringBytes; 3001 jsize length; 3002 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleHypertextExt(%p, %p, startIndex = %d)", 3003 accessibleContext, hypertext, nStartIndex); 3004 3005 // get the AccessibleHypertext 3006 jobject ht = jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleHypertextMethod, 3007 accessibleContext); 3008 EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to CallObjectMethod()", FALSE); 3009 jobject globalRef = jniEnv->NewGlobalRef(ht); 3010 EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to NewGlobalRef()", FALSE); 3011 hypertext->accessibleHypertext = (JOBJECT64)globalRef; 3012 PrintDebugString(" ##### AccessibleHypertext = %p", globalRef); 3013 if (hypertext->accessibleHypertext == 0) { 3014 PrintDebugString(" ##### null AccessibleHypertext; returning FALSE"); 3015 return FALSE; 3016 } 3017 3018 // get the hyperlink count 3019 hypertext->linkCount = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHyperlinkCountMethod, 3020 accessibleContext); 3021 EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", FALSE); 3022 PrintDebugString(" ##### hyperlink count = %d", hypertext->linkCount); 3023 3024 if (nStartIndex >= hypertext->linkCount) { 3025 return FALSE; 3026 } 3027 3028 // get the hypertext links 3029 // NOTE: To avoid a crash when there are more than MAX_HYPERLINKS (64) links 3030 // in the document, test for i < MAX_HYPERLINKS in addition to 3031 // i < hypertext->linkCount 3032 int bufIndex = 0; 3033 for (int i = nStartIndex; (i < hypertext->linkCount) && (i < nStartIndex + MAX_HYPERLINKS); i++) { 3034 PrintDebugString(" getting hyperlink %d ...", i); 3035 3036 // get the hyperlink 3037 jobject hl = jniEnv->CallObjectMethod(accessBridgeObject, 3038 getAccessibleHyperlinkMethod, 3039 hypertext->accessibleHypertext, 3040 i); 3041 EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE); 3042 jobject globalRef = jniEnv->NewGlobalRef(hl); 3043 EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE); 3044 hypertext->links[bufIndex].accessibleHyperlink = (JOBJECT64)globalRef; 3045 PrintDebugString(" ##### AccessibleHyperlink = %p", globalRef); 3046 3047 // get the hyperlink text 3048 jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject, 3049 getAccessibleHyperlinkTextMethod, 3050 hypertext->links[bufIndex].accessibleHyperlink, 3051 i); 3052 3053 EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE); 3054 if (js != (jstring) 0) { 3055 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3056 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE); 3057 wcsncpy(hypertext->links[bufIndex].text, stringBytes, 3058 (sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t))); 3059 length = jniEnv->GetStringLength(js); 3060 if (length >= (sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t))) { 3061 length = (sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t)) - 2; 3062 } 3063 hypertext->links[bufIndex].text[length] = (wchar_t) 0; 3064 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE); 3065 jniEnv->ReleaseStringChars(js, stringBytes); 3066 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE); 3067 // jniEnv->CallVoidMethod(accessBridgeObject, 3068 // decrementReferenceMethod, js); 3069 //EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE); 3070 PrintDebugString("##### AccessibleHyperlink text = %ls", hypertext->links[bufIndex].text ); 3071 jniEnv->DeleteLocalRef(js); 3072 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE); 3073 3074 } else { 3075 PrintDebugString(" AccessibleHyperlink text is null."); 3076 hypertext->links[bufIndex].text[0] = (wchar_t) 0; 3077 } 3078 3079 hypertext->links[bufIndex].startIndex = jniEnv->CallIntMethod(accessBridgeObject, 3080 getAccessibleHyperlinkStartIndexMethod, 3081 hypertext->links[bufIndex].accessibleHyperlink, 3082 i); 3083 EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE); 3084 PrintDebugString(" ##### hyperlink start index = %d", hypertext->links[bufIndex].startIndex); 3085 3086 hypertext->links[bufIndex].endIndex = jniEnv->CallIntMethod(accessBridgeObject, 3087 getAccessibleHyperlinkEndIndexMethod, 3088 hypertext->links[bufIndex].accessibleHyperlink, 3089 i); 3090 EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE); 3091 PrintDebugString(" ##### hyperlink end index = %d", hypertext->links[bufIndex].endIndex); 3092 3093 bufIndex++; 3094 } 3095 3096 PrintDebugString(" ##### AccessBridgeJavaEntryPoints::getAccessibleHypertextExt succeeded"); 3097 return TRUE; 3098 } 3099 3100 jint AccessBridgeJavaEntryPoints::getAccessibleHyperlinkCount(const jobject accessibleContext) { 3101 3102 jthrowable exception; 3103 3104 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleHyperlinkCount(%X)", 3105 accessibleContext); 3106 3107 if (getAccessibleHyperlinkCountMethod == (jmethodID)0) { 3108 return -1; 3109 } 3110 3111 // get the hyperlink count 3112 jint linkCount = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHyperlinkCountMethod, 3113 accessibleContext); 3114 EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", -1); 3115 PrintDebugString(" ##### hyperlink count = %d", linkCount); 3116 3117 return linkCount; 3118 } 3119 3120 3121 jint AccessBridgeJavaEntryPoints::getAccessibleHypertextLinkIndex(const jobject hypertext, 3122 const jint nIndex) { 3123 3124 jthrowable exception; 3125 3126 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleHypertextLinkIndex(%p, index = %d)", 3127 hypertext, nIndex); 3128 3129 if (getAccessibleHypertextLinkIndexMethod == (jmethodID)0) { 3130 return -1; 3131 } 3132 3133 // get the hyperlink index 3134 jint index = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHypertextLinkIndexMethod, 3135 hypertext, nIndex); 3136 3137 EXCEPTION_CHECK("##### Getting hyperlink index - call to CallIntMethod()", -1); 3138 PrintDebugString(" ##### hyperlink index = %d", index); 3139 3140 return index; 3141 } 3142 3143 BOOL AccessBridgeJavaEntryPoints::getAccessibleHyperlink(jobject hypertext, 3144 const jint index, 3145 /* OUT */ AccessibleHyperlinkInfo *info) { 3146 3147 jthrowable exception; 3148 const wchar_t *stringBytes; 3149 jsize length; 3150 3151 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleHyperlink(%p, index = %d)", 3152 hypertext, index); 3153 3154 3155 // get the hyperlink 3156 jobject hl = jniEnv->CallObjectMethod(accessBridgeObject, 3157 getAccessibleHyperlinkMethod, 3158 hypertext, 3159 index); 3160 EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE); 3161 jobject globalRef = jniEnv->NewGlobalRef(hl); 3162 EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE); 3163 info->accessibleHyperlink = (JOBJECT64)globalRef; 3164 PrintDebugString(" ##### AccessibleHyperlink = %p", globalRef); 3165 3166 // get the hyperlink text 3167 jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject, 3168 getAccessibleHyperlinkTextMethod, 3169 info->accessibleHyperlink, 3170 index); 3171 3172 EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE); 3173 if (js != (jstring) 0) { 3174 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3175 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE); 3176 wcsncpy(info->text, stringBytes, 3177 (sizeof(info->text) / sizeof(wchar_t))); 3178 length = jniEnv->GetStringLength(js); 3179 if (length >= (sizeof(info->text) / sizeof(wchar_t))) { 3180 length = (sizeof(info->text) / sizeof(wchar_t)) - 2; 3181 } 3182 info->text[length] = (wchar_t) 0; 3183 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE); 3184 jniEnv->ReleaseStringChars(js, stringBytes); 3185 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE); 3186 // jniEnv->CallVoidMethod(accessBridgeObject, 3187 // decrementReferenceMethod, js); 3188 //EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE); 3189 PrintDebugString("##### AccessibleHyperlink text = %ls", info->text ); 3190 jniEnv->DeleteLocalRef(js); 3191 EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE); 3192 3193 } else { 3194 PrintDebugString(" AccessibleHyperlink text is null."); 3195 info->text[0] = (wchar_t) 0; 3196 } 3197 3198 info->startIndex = jniEnv->CallIntMethod(accessBridgeObject, 3199 getAccessibleHyperlinkStartIndexMethod, 3200 info->accessibleHyperlink, 3201 index); 3202 EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE); 3203 PrintDebugString(" ##### hyperlink start index = %d", info->startIndex); 3204 3205 info->endIndex = jniEnv->CallIntMethod(accessBridgeObject, 3206 getAccessibleHyperlinkEndIndexMethod, 3207 info->accessibleHyperlink, 3208 index); 3209 EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE); 3210 PrintDebugString(" ##### hyperlink end index = %d", info->endIndex); 3211 3212 return TRUE; 3213 } 3214 3215 3216 /********** end AccessibleHypertext routines ************************/ 3217 3218 // Accessible Keybinding methods 3219 BOOL AccessBridgeJavaEntryPoints::getAccessibleKeyBindings(jobject accessibleContext, 3220 AccessibleKeyBindings *keyBindings) { 3221 3222 jthrowable exception; 3223 3224 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleKeyBindings(%p, %p)", 3225 accessibleContext, keyBindings); 3226 3227 if (getAccessibleKeyBindingsCountMethod == (jmethodID) 0 || 3228 getAccessibleKeyBindingCharMethod == (jmethodID) 0 || 3229 getAccessibleKeyBindingModifiersMethod == (jmethodID) 0) { 3230 return FALSE; 3231 } 3232 3233 // get the key binding count 3234 keyBindings->keyBindingsCount = jniEnv->CallIntMethod(accessBridgeObject, 3235 getAccessibleKeyBindingsCountMethod, accessibleContext); 3236 3237 EXCEPTION_CHECK("##### Getting key bindings count - call to CallIntMethod()", FALSE); 3238 3239 PrintDebugString(" ##### key bindings count = %d", keyBindings->keyBindingsCount); 3240 3241 // get the key bindings 3242 for (int i = 0; i < keyBindings->keyBindingsCount && i < MAX_KEY_BINDINGS; i++) { 3243 3244 // get the key binding character 3245 keyBindings->keyBindingInfo[i].character = jniEnv->CallCharMethod(accessBridgeObject, 3246 getAccessibleKeyBindingCharMethod, 3247 accessibleContext, 3248 i); 3249 EXCEPTION_CHECK("##### Getting key binding character - call to CallCharMethod()", FALSE); 3250 PrintDebugString(" ##### key binding character = %c", keyBindings->keyBindingInfo[i].character); 3251 PrintDebugString(" ##### key binding character in hex = %hx", keyBindings->keyBindingInfo[i].character); 3252 3253 // get the key binding modifiers 3254 keyBindings->keyBindingInfo[i].modifiers = jniEnv->CallIntMethod(accessBridgeObject, 3255 getAccessibleKeyBindingModifiersMethod, 3256 accessibleContext, 3257 i); 3258 EXCEPTION_CHECK("##### Getting key binding modifiers - call to CallIntMethod()", FALSE); 3259 PrintDebugString(" ##### key binding modifiers = %x", keyBindings->keyBindingInfo[i].modifiers); 3260 } 3261 return FALSE; 3262 } 3263 3264 // AccessibleIcon methods 3265 BOOL AccessBridgeJavaEntryPoints::getAccessibleIcons(jobject accessibleContext, 3266 AccessibleIcons *icons) { 3267 3268 jthrowable exception; 3269 const wchar_t *stringBytes; 3270 jsize length; 3271 3272 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleIcons(%p, %p)", 3273 accessibleContext, icons); 3274 3275 if (getAccessibleIconsCountMethod == (jmethodID) 0 || 3276 getAccessibleIconDescriptionMethod == (jmethodID) 0 || 3277 getAccessibleIconHeightMethod == (jmethodID) 0 || 3278 getAccessibleIconWidthMethod == (jmethodID) 0) { 3279 PrintDebugString(" ##### missing method(s) !!!"); 3280 return FALSE; 3281 } 3282 3283 3284 // get the icons count 3285 icons->iconsCount = jniEnv->CallIntMethod(accessBridgeObject, 3286 getAccessibleIconsCountMethod, accessibleContext); 3287 3288 EXCEPTION_CHECK("##### Getting icons count - call to CallIntMethod()", FALSE); 3289 PrintDebugString(" ##### icons count = %d", icons->iconsCount); 3290 3291 3292 // get the icons 3293 for (int i = 0; i < icons->iconsCount && i < MAX_ICON_INFO; i++) { 3294 3295 // get the icon description 3296 jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject, 3297 getAccessibleIconDescriptionMethod, 3298 accessibleContext, 3299 i); 3300 3301 EXCEPTION_CHECK("Getting icon description - call to CallObjectMethod()", FALSE); 3302 if (js != (jstring) 0) { 3303 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3304 EXCEPTION_CHECK("Getting AccessibleIcon description - call to GetStringChars()", FALSE); 3305 wcsncpy(icons->iconInfo[i].description, stringBytes, (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t))); 3306 length = jniEnv->GetStringLength(js); 3307 if (length >= (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t))) { 3308 length = (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t)) - 2; 3309 } 3310 icons->iconInfo[i].description[length] = (wchar_t) 0; 3311 EXCEPTION_CHECK("Getting AccessibleIcon description - call to GetStringLength()", FALSE); 3312 jniEnv->ReleaseStringChars(js, stringBytes); 3313 EXCEPTION_CHECK("Getting AccessibleIcon description - call to ReleaseStringChars()", FALSE); 3314 // jniEnv->CallVoidMethod(accessBridgeObject, 3315 // decrementReferenceMethod, js); 3316 //EXCEPTION_CHECK("Getting AccessibleIcon description - call to CallVoidMethod()", FALSE); 3317 PrintDebugString("##### AccessibleIcon description = %ls", icons->iconInfo[i].description ); 3318 jniEnv->DeleteLocalRef(js); 3319 EXCEPTION_CHECK("Getting AccessibleIcon description - call to DeleteLocalRef()", FALSE); 3320 } else { 3321 PrintDebugString(" AccessibleIcon description is null."); 3322 icons->iconInfo[i].description[0] = (wchar_t) 0; 3323 } 3324 3325 3326 // get the icon height 3327 icons->iconInfo[i].height = jniEnv->CallIntMethod(accessBridgeObject, 3328 getAccessibleIconHeightMethod, 3329 accessibleContext, 3330 i); 3331 EXCEPTION_CHECK("##### Getting icon height - call to CallIntMethod()", FALSE); 3332 PrintDebugString(" ##### icon height = %d", icons->iconInfo[i].height); 3333 3334 // get the icon width 3335 icons->iconInfo[i].width = jniEnv->CallIntMethod(accessBridgeObject, 3336 getAccessibleIconWidthMethod, 3337 accessibleContext, 3338 i); 3339 EXCEPTION_CHECK("##### Getting icon width - call to CallIntMethod()", FALSE); 3340 PrintDebugString(" ##### icon width = %d", icons->iconInfo[i].width); 3341 } 3342 return FALSE; 3343 } 3344 3345 // AccessibleActionMethods 3346 BOOL AccessBridgeJavaEntryPoints::getAccessibleActions(jobject accessibleContext, 3347 AccessibleActions *actions) { 3348 3349 jthrowable exception; 3350 const wchar_t *stringBytes; 3351 jsize length; 3352 3353 PrintDebugString("\r\n##### AccessBridgeJavaEntryPoints::getAccessibleIcons(%p, %p)", 3354 accessibleContext, actions); 3355 3356 if (getAccessibleActionsCountMethod == (jmethodID) 0 || 3357 getAccessibleActionNameMethod == (jmethodID) 0) { 3358 PrintDebugString(" ##### missing method(s) !!!"); 3359 return FALSE; 3360 } 3361 3362 3363 // get the icons count 3364 actions->actionsCount = jniEnv->CallIntMethod(accessBridgeObject, 3365 getAccessibleActionsCountMethod,accessibleContext); 3366 3367 EXCEPTION_CHECK("##### Getting actions count - call to CallIntMethod()", FALSE); 3368 PrintDebugString(" ##### key actions count = %d", actions->actionsCount); 3369 3370 3371 // get the actions 3372 for (int i = 0; i < actions->actionsCount && i < MAX_ACTION_INFO; i++) { 3373 3374 // get the action name 3375 jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject, 3376 getAccessibleActionNameMethod, 3377 accessibleContext, 3378 i); 3379 3380 EXCEPTION_CHECK("Getting Action Name - call to CallObjectMethod()", FALSE); 3381 if (js != (jstring) 0) { 3382 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3383 EXCEPTION_CHECK("Getting AccessibleAction Name - call to GetStringChars()", FALSE); 3384 wcsncpy(actions->actionInfo[i].name , stringBytes, (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t))); 3385 length = jniEnv->GetStringLength(js); 3386 if (length >= (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t))) { 3387 length = (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t)) - 2; 3388 } 3389 actions->actionInfo[i].name [length] = (wchar_t) 0; 3390 EXCEPTION_CHECK("Getting AccessibleAction name - call to GetStringLength()", FALSE); 3391 jniEnv->ReleaseStringChars(js, stringBytes); 3392 EXCEPTION_CHECK("Getting AccessibleAction name - call to ReleaseStringChars()", FALSE); 3393 // jniEnv->CallVoidMethod(accessBridgeObject, 3394 // decrementReferenceMethod, js); 3395 //EXCEPTION_CHECK("Getting AccessibleAction name - call to CallVoidMethod()", FALSE); 3396 PrintDebugString("##### AccessibleAction name = %ls", actions->actionInfo[i].name ); 3397 jniEnv->DeleteLocalRef(js); 3398 EXCEPTION_CHECK("Getting AccessibleAction name - call to DeleteLocalRef()", FALSE); 3399 } else { 3400 PrintDebugString(" AccessibleAction name is null."); 3401 actions->actionInfo[i].name [0] = (wchar_t) 0; 3402 } 3403 } 3404 return FALSE; 3405 } 3406 3407 BOOL AccessBridgeJavaEntryPoints::doAccessibleActions(jobject accessibleContext, 3408 AccessibleActionsToDo *actionsToDo, 3409 jint *failure) { 3410 3411 jthrowable exception; 3412 BOOL returnVal; 3413 3414 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::doAccessibleActions(%p, #actions %d %s):", 3415 accessibleContext, 3416 actionsToDo->actionsCount, 3417 actionsToDo->actions[0].name); 3418 3419 if (doAccessibleActionsMethod == (jmethodID) 0) { 3420 *failure = 0; 3421 return FALSE; 3422 } 3423 3424 PrintDebugString("\r\n doing %d actions ...", actionsToDo->actionsCount); 3425 for (int i = 0; i < actionsToDo->actionsCount && i < MAX_ACTIONS_TO_DO; i++) { 3426 PrintDebugString("\r doing action %d: %s ...", i, actionsToDo->actions[i].name); 3427 3428 // create a Java String for the action name 3429 wchar_t *actionName = (wchar_t *)actionsToDo->actions[i].name; 3430 jstring javaName = jniEnv->NewString(actionName, (jsize)wcslen(actionName)); 3431 if (javaName == 0) { 3432 PrintDebugString("\r NewString failed"); 3433 *failure = i; 3434 return FALSE; 3435 } 3436 3437 returnVal = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject, doAccessibleActionsMethod, 3438 accessibleContext, javaName); 3439 jniEnv->DeleteLocalRef(javaName); 3440 EXCEPTION_CHECK("doAccessibleActions - call to CallBooleanMethod()", FALSE); 3441 3442 if (returnVal != TRUE) { 3443 PrintDebugString("\r Action %d failed", i); 3444 *failure = i; 3445 return FALSE; 3446 } 3447 } 3448 *failure = -1; 3449 return TRUE; 3450 } 3451 3452 3453 /********** AccessibleText routines ***********************************/ 3454 3455 BOOL 3456 AccessBridgeJavaEntryPoints::getAccessibleTextInfo(jobject accessibleContext, 3457 AccessibleTextInfo *textInfo, 3458 jint x, jint y) { 3459 jthrowable exception; 3460 3461 // Verify the Java VM still exists and AccessibleContext is 3462 // an instance of AccessibleText 3463 if (verifyAccessibleText(accessibleContext) == FALSE) { 3464 return FALSE; 3465 } 3466 3467 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleTextInfo(%p, %d, %d):", 3468 accessibleContext, x, y); 3469 3470 // Get the character count 3471 if (getAccessibleCharCountFromContextMethod != (jmethodID) 0) { 3472 textInfo->charCount = jniEnv->CallIntMethod(accessBridgeObject, 3473 getAccessibleCharCountFromContextMethod, 3474 accessibleContext); 3475 EXCEPTION_CHECK("Getting AccessibleCharCount - call to CallIntMethod()", FALSE); 3476 PrintDebugString(" Char count = %d", textInfo->charCount); 3477 } else { 3478 PrintDebugString(" Error! either env == 0 or getAccessibleCharCountFromContextMethod == 0"); 3479 return FALSE; 3480 } 3481 3482 // Get the index of the caret 3483 if (getAccessibleCaretPositionFromContextMethod != (jmethodID) 0) { 3484 textInfo->caretIndex = jniEnv->CallIntMethod(accessBridgeObject, 3485 getAccessibleCaretPositionFromContextMethod, 3486 accessibleContext); 3487 EXCEPTION_CHECK("Getting AccessibleCaretPosition - call to CallIntMethod()", FALSE); 3488 PrintDebugString(" Index at caret = %d", textInfo->caretIndex); 3489 } else { 3490 PrintDebugString(" Error! either env == 0 or getAccessibleCaretPositionFromContextMethod == 0"); 3491 return FALSE; 3492 } 3493 3494 // Get the index at the given point 3495 if (getAccessibleIndexAtPointFromContextMethod != (jmethodID) 0) { 3496 textInfo->indexAtPoint = jniEnv->CallIntMethod(accessBridgeObject, 3497 getAccessibleIndexAtPointFromContextMethod, 3498 accessibleContext, x, y); 3499 EXCEPTION_CHECK("Getting AccessibleIndexAtPoint - call to CallIntMethod()", FALSE); 3500 PrintDebugString(" Index at point = %d", textInfo->indexAtPoint); 3501 } else { 3502 PrintDebugString(" Error! either env == 0 or getAccessibleIndexAtPointFromContextMethod == 0"); 3503 return FALSE; 3504 } 3505 return TRUE; 3506 } 3507 3508 BOOL 3509 AccessBridgeJavaEntryPoints::getAccessibleTextItems(jobject accessibleContext, 3510 AccessibleTextItemsInfo *textItems, jint index) { 3511 jstring js; 3512 const wchar_t *stringBytes; 3513 jthrowable exception; 3514 jsize length; 3515 3516 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleTextItems(%p):", accessibleContext); 3517 3518 // Verify the Java VM still exists and AccessibleContext is 3519 // an instance of AccessibleText 3520 if (verifyAccessibleText(accessibleContext) == FALSE) { 3521 return FALSE; 3522 } 3523 3524 // Get the letter at index 3525 if (getAccessibleLetterAtIndexFromContextMethod != (jmethodID) 0) { 3526 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 3527 getAccessibleLetterAtIndexFromContextMethod, 3528 accessibleContext, index); 3529 EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to CallIntMethod()", FALSE); 3530 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 3531 if (js != (jstring) 0) { 3532 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3533 EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to GetStringChars()", FALSE); 3534 textItems->letter = stringBytes[0]; 3535 jniEnv->ReleaseStringChars(js, stringBytes); 3536 EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to ReleaseStringChars()", FALSE); 3537 jniEnv->CallVoidMethod(accessBridgeObject, 3538 decrementReferenceMethod, js); 3539 EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to CallVoidMethod()", FALSE); 3540 PrintDebugString(" Accessible Text letter = %c", textItems->letter); 3541 jniEnv->DeleteLocalRef(js); 3542 EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to DeleteLocalRef()", FALSE); 3543 } else { 3544 PrintDebugString(" Accessible Text letter is null."); 3545 textItems->letter = (wchar_t) 0; 3546 } 3547 } else { 3548 PrintDebugString(" Error! either env == 0 or getAccessibleLetterAtIndexFromContextMethod == 0"); 3549 return FALSE; 3550 } 3551 3552 3553 // Get the word at index 3554 if (getAccessibleWordAtIndexFromContextMethod != (jmethodID) 0) { 3555 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 3556 getAccessibleWordAtIndexFromContextMethod, 3557 accessibleContext, index); 3558 EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to CallIntMethod()", FALSE); 3559 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 3560 if (js != (jstring) 0) { 3561 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3562 EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to GetStringChars()", FALSE); 3563 wcsncpy(textItems->word, stringBytes, (sizeof(textItems->word) / sizeof(wchar_t))); 3564 length = jniEnv->GetStringLength(js); 3565 textItems->word[length < (sizeof(textItems->word) / sizeof(wchar_t)) ? 3566 length : (sizeof(textItems->word) / sizeof(wchar_t))-2] = (wchar_t) 0; 3567 EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to GetStringLength()", FALSE); 3568 jniEnv->ReleaseStringChars(js, stringBytes); 3569 EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to ReleaseStringChars()", FALSE); 3570 jniEnv->CallVoidMethod(accessBridgeObject, 3571 decrementReferenceMethod, js); 3572 EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to CallVoidMethod()", FALSE); 3573 wPrintDebugString(L" Accessible Text word = %ls", textItems->word); 3574 jniEnv->DeleteLocalRef(js); 3575 EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to DeleteLocalRef()", FALSE); 3576 } else { 3577 PrintDebugString(" Accessible Text word is null."); 3578 textItems->word[0] = (wchar_t) 0; 3579 } 3580 } else { 3581 PrintDebugString(" Error! either env == 0 or getAccessibleWordAtIndexFromContextMethod == 0"); 3582 return FALSE; 3583 } 3584 3585 // Get the sentence at index 3586 if (getAccessibleSentenceAtIndexFromContextMethod != (jmethodID) 0) { 3587 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 3588 getAccessibleSentenceAtIndexFromContextMethod, 3589 accessibleContext, index); 3590 EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to CallObjectMethod()", FALSE); 3591 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 3592 if (js != (jstring) 0) { 3593 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3594 EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to GetStringChars()", FALSE); 3595 wcsncpy(textItems->sentence, stringBytes, (sizeof(textItems->sentence) / sizeof(wchar_t))-2); 3596 length = jniEnv->GetStringLength(js); 3597 3598 if (length < sizeof(textItems->sentence) / sizeof(wchar_t)) { 3599 textItems->sentence[length] = (wchar_t) 0; 3600 } else { 3601 textItems->sentence[(sizeof(textItems->sentence) / sizeof(wchar_t))-2] = (wchar_t) 0; 3602 } 3603 EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to GetStringLength()", FALSE); 3604 jniEnv->ReleaseStringChars(js, stringBytes); 3605 EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to ReleaseStringChars()", FALSE); 3606 jniEnv->CallVoidMethod(accessBridgeObject, 3607 decrementReferenceMethod, js); 3608 EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to CallVoidMethod()", FALSE); 3609 wPrintDebugString(L" Accessible Text sentence = %ls", textItems->sentence); 3610 jniEnv->DeleteLocalRef(js); 3611 EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to DeleteLocalRef()", FALSE); 3612 } else { 3613 PrintDebugString(" Accessible Text sentence is null."); 3614 textItems->sentence[0] = (wchar_t) 0; 3615 } 3616 } else { 3617 PrintDebugString(" Error! either env == 0 or getAccessibleSentenceAtIndexFromContextMethod == 0"); 3618 return FALSE; 3619 } 3620 3621 return TRUE; 3622 } 3623 3624 BOOL 3625 AccessBridgeJavaEntryPoints::getAccessibleTextSelectionInfo(jobject accessibleContext, 3626 AccessibleTextSelectionInfo *selectionInfo) { 3627 jstring js; 3628 const wchar_t *stringBytes; 3629 jthrowable exception; 3630 jsize length; 3631 3632 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleTextSelectionInfo(%p):", 3633 accessibleContext); 3634 3635 // Verify the Java VM still exists and AccessibleContext is 3636 // an instance of AccessibleText 3637 if (verifyAccessibleText(accessibleContext) == FALSE) { 3638 return FALSE; 3639 } 3640 3641 // Get the selection start index 3642 if (getAccessibleTextSelectionStartFromContextMethod != (jmethodID) 0) { 3643 selectionInfo->selectionStartIndex = jniEnv->CallIntMethod(accessBridgeObject, 3644 getAccessibleTextSelectionStartFromContextMethod, 3645 accessibleContext); 3646 EXCEPTION_CHECK("Getting AccessibleTextSelectionStart - call to CallIntMethod()", FALSE); 3647 PrintDebugString(" Selection start = %d", selectionInfo->selectionStartIndex); 3648 } else { 3649 PrintDebugString(" Error! either env == 0 or getAccessibleTextSelectionStartFromContextMethod == 0"); 3650 return FALSE; 3651 } 3652 3653 // Get the selection end index 3654 if (getAccessibleTextSelectionEndFromContextMethod != (jmethodID) 0) { 3655 selectionInfo->selectionEndIndex = jniEnv->CallIntMethod(accessBridgeObject, 3656 getAccessibleTextSelectionEndFromContextMethod, 3657 accessibleContext); 3658 EXCEPTION_CHECK("Getting AccessibleTextSelectionEnd - call to CallIntMethod()", FALSE); 3659 PrintDebugString(" Selection end = %d", selectionInfo->selectionEndIndex); 3660 } else { 3661 PrintDebugString(" Error! either env == 0 or getAccessibleTextSelectionEndFromContextMethod == 0"); 3662 return FALSE; 3663 } 3664 3665 // Get the selected text 3666 if (getAccessibleTextSelectedTextFromContextMethod != (jmethodID) 0) { 3667 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 3668 getAccessibleTextSelectedTextFromContextMethod, 3669 accessibleContext); 3670 EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to CallObjectMethod()", FALSE); 3671 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 3672 if (js != (jstring) 0) { 3673 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3674 EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to GetStringChars()", FALSE); 3675 wcsncpy(selectionInfo->selectedText, stringBytes, (sizeof(selectionInfo->selectedText) / sizeof(wchar_t))); 3676 length = jniEnv->GetStringLength(js); 3677 selectionInfo->selectedText[length < (sizeof(selectionInfo->selectedText) / sizeof(wchar_t)) ? 3678 length : (sizeof(selectionInfo->selectedText) / sizeof(wchar_t))-2] = (wchar_t) 0; 3679 EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to GetStringLength()", FALSE); 3680 jniEnv->ReleaseStringChars(js, stringBytes); 3681 EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to ReleaseStringChars()", FALSE); 3682 jniEnv->CallVoidMethod(accessBridgeObject, 3683 decrementReferenceMethod, js); 3684 EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to CallVoidMethod()", FALSE); 3685 PrintDebugString(" Accessible's selected text = %s", selectionInfo->selectedText); 3686 jniEnv->DeleteLocalRef(js); 3687 EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to DeleteLocalRef()", FALSE); 3688 } else { 3689 PrintDebugString(" Accessible's selected text is null."); 3690 selectionInfo->selectedText[0] = (wchar_t) 0; 3691 } 3692 } else { 3693 PrintDebugString(" Error! either env == 0 or getAccessibleTextSelectedTextFromContextMethod == 0"); 3694 return FALSE; 3695 } 3696 return TRUE; 3697 } 3698 3699 BOOL 3700 AccessBridgeJavaEntryPoints::getAccessibleTextAttributes(jobject accessibleContext, jint index, AccessibleTextAttributesInfo *attributes) { 3701 jstring js; 3702 const wchar_t *stringBytes; 3703 jobject AttributeSet; 3704 jthrowable exception; 3705 jsize length; 3706 3707 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleTextAttributes(%p):", accessibleContext); 3708 3709 // Verify the Java VM still exists and AccessibleContext is 3710 // an instance of AccessibleText 3711 if (verifyAccessibleText(accessibleContext) == FALSE) { 3712 return FALSE; 3713 } 3714 3715 if (accessibleContext == (jobject) 0) { 3716 PrintDebugString(" passed in AccessibleContext == null! (oops)"); 3717 3718 attributes->bold = FALSE; 3719 attributes->italic = FALSE; 3720 attributes->underline = FALSE; 3721 attributes->strikethrough = FALSE; 3722 attributes->superscript = FALSE; 3723 attributes->subscript = FALSE; 3724 attributes->backgroundColor[0] = (wchar_t) 0; 3725 attributes->foregroundColor[0] = (wchar_t) 0; 3726 attributes->fontFamily[0] = (wchar_t) 0; 3727 attributes->fontSize = -1; 3728 attributes->alignment = -1; 3729 attributes->bidiLevel = -1; 3730 attributes->firstLineIndent = -1; 3731 attributes->leftIndent = -1; 3732 attributes->rightIndent = -1; 3733 attributes->lineSpacing = -1; 3734 attributes->spaceAbove = -1; 3735 attributes->spaceBelow = -1; 3736 attributes->fullAttributesString[0] = (wchar_t) 0; 3737 3738 return (FALSE); 3739 } 3740 3741 // Get the AttributeSet 3742 if (getAccessibleAttributeSetAtIndexFromContextMethod != (jmethodID) 0) { 3743 PrintDebugString(" Getting AttributeSet at index..."); 3744 AttributeSet = jniEnv->CallObjectMethod(accessBridgeObject, 3745 getAccessibleAttributeSetAtIndexFromContextMethod, 3746 accessibleContext, index); 3747 EXCEPTION_CHECK("Getting AccessibleAttributeSetAtIndex - call to CallObjectMethod()", FALSE); 3748 } else { 3749 PrintDebugString(" Error! either env == 0 or getAccessibleAttributeSetAtIndexFromContextMethod == 0"); 3750 return FALSE; 3751 } 3752 3753 // It is legal for the AttributeSet object to be null, in which case we return false! 3754 if (AttributeSet == (jobject) 0) { 3755 PrintDebugString(" AttributeSet returned at index is null (this is legal! - see AWT in J2SE 1.3"); 3756 3757 attributes->bold = FALSE; 3758 attributes->italic = FALSE; 3759 attributes->underline = FALSE; 3760 attributes->strikethrough = FALSE; 3761 attributes->superscript = FALSE; 3762 attributes->subscript = FALSE; 3763 attributes->backgroundColor[0] = (wchar_t) 0; 3764 attributes->foregroundColor[0] = (wchar_t) 0; 3765 attributes->fontFamily[0] = (wchar_t) 0; 3766 attributes->fontSize = -1; 3767 attributes->alignment = -1; 3768 attributes->bidiLevel = -1; 3769 attributes->firstLineIndent = -1; 3770 attributes->leftIndent = -1; 3771 attributes->rightIndent = -1; 3772 attributes->lineSpacing = -1; 3773 attributes->spaceAbove = -1; 3774 attributes->spaceBelow = -1; 3775 attributes->fullAttributesString[0] = (wchar_t) 0; 3776 3777 return (FALSE); 3778 } 3779 3780 // Get the bold setting 3781 if (getBoldFromAttributeSetMethod != (jmethodID) 0) { 3782 PrintDebugString(" Getting bold from AttributeSet..."); 3783 attributes->bold = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, 3784 getBoldFromAttributeSetMethod, 3785 AttributeSet); 3786 EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to CallBooleanMethod()", FALSE); 3787 } else { 3788 PrintDebugString(" Error! either env == 0 or getBoldFromAttributeSetMethod == 0"); 3789 jniEnv->CallVoidMethod(accessBridgeObject, 3790 decrementReferenceMethod, AttributeSet); 3791 EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to CallVoidMethod()", FALSE); 3792 jniEnv->DeleteLocalRef(AttributeSet); 3793 EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to DeleteLocalRef()", FALSE); 3794 return FALSE; 3795 } 3796 3797 // Get the italic setting 3798 if (getItalicFromAttributeSetMethod != (jmethodID) 0) { 3799 PrintDebugString(" Getting italic from AttributeSet..."); 3800 attributes->italic = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, 3801 getItalicFromAttributeSetMethod, 3802 AttributeSet); 3803 EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to CallBooleanMethod()", FALSE); 3804 } else { 3805 PrintDebugString(" Error! either env == 0 or getItalicdFromAttributeSetMethod == 0"); 3806 jniEnv->CallVoidMethod(accessBridgeObject, 3807 decrementReferenceMethod, AttributeSet); 3808 EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to CallVoidMethod()", FALSE); 3809 jniEnv->DeleteLocalRef(AttributeSet); 3810 EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to DeleteLocalRef()", FALSE); 3811 return FALSE; 3812 } 3813 3814 // Get the underline setting 3815 if (getUnderlineFromAttributeSetMethod != (jmethodID) 0) { 3816 PrintDebugString(" Getting underline from AttributeSet..."); 3817 attributes->underline = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, 3818 getUnderlineFromAttributeSetMethod, 3819 AttributeSet); 3820 EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to CallBooleanMethod()", FALSE); 3821 } else { 3822 PrintDebugString(" Error! either env == 0 or getUnderlineFromAttributeSetMethod == 0"); 3823 jniEnv->CallVoidMethod(accessBridgeObject, 3824 decrementReferenceMethod, AttributeSet); 3825 EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to CallVoidMethod()", FALSE); 3826 jniEnv->DeleteLocalRef(AttributeSet); 3827 EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to DeleteLocalRef()", FALSE); 3828 return FALSE; 3829 } 3830 3831 // Get the strikethrough setting 3832 if (getStrikethroughFromAttributeSetMethod != (jmethodID) 0) { 3833 PrintDebugString(" Getting strikethrough from AttributeSet..."); 3834 attributes->strikethrough = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, 3835 getStrikethroughFromAttributeSetMethod, 3836 AttributeSet); 3837 EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to CallBooleanMethod()", FALSE); 3838 } else { 3839 PrintDebugString(" Error! either env == 0 or getStrikethroughFromAttributeSetMethod == 0"); 3840 jniEnv->CallVoidMethod(accessBridgeObject, 3841 decrementReferenceMethod, AttributeSet); 3842 EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to CallVoidMethod()", FALSE); 3843 jniEnv->DeleteLocalRef(AttributeSet); 3844 EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to DeleteLocalRef()", FALSE); 3845 return FALSE; 3846 } 3847 3848 // Get the superscript setting 3849 if (getSuperscriptFromAttributeSetMethod != (jmethodID) 0) { 3850 PrintDebugString(" Getting superscript from AttributeSet..."); 3851 attributes->superscript = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, 3852 getSuperscriptFromAttributeSetMethod, 3853 AttributeSet); 3854 EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to CallBooleanMethod()", FALSE); 3855 } else { 3856 PrintDebugString(" Error! either env == 0 or getSuperscripteFromAttributeSetMethod == 0"); 3857 jniEnv->CallVoidMethod(accessBridgeObject, 3858 decrementReferenceMethod, AttributeSet); 3859 EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to CallVoidMethod()", FALSE); 3860 jniEnv->DeleteLocalRef(AttributeSet); 3861 EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to DeleteLocalRef()", FALSE); 3862 return FALSE; 3863 } 3864 3865 // Get the subscript setting 3866 if (getSubscriptFromAttributeSetMethod != (jmethodID) 0) { 3867 PrintDebugString(" Getting subscript from AttributeSet..."); 3868 attributes->subscript = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, 3869 getSubscriptFromAttributeSetMethod, 3870 AttributeSet); 3871 EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to CallBooleanMethod()", FALSE); 3872 } else { 3873 PrintDebugString(" Error! either env == 0 or getSubscriptFromAttributeSetMethod == 0"); 3874 jniEnv->CallVoidMethod(accessBridgeObject, 3875 decrementReferenceMethod, AttributeSet); 3876 EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to CallVoidMethod()", FALSE); 3877 jniEnv->DeleteLocalRef(AttributeSet); 3878 EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to DeleteLocalRef()", FALSE); 3879 return FALSE; 3880 } 3881 3882 // Get the backgroundColor setting 3883 if (getBackgroundColorFromAttributeSetMethod != (jmethodID) 0) { 3884 PrintDebugString(" Getting backgroundColor from AttributeSet..."); 3885 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 3886 getBackgroundColorFromAttributeSetMethod, 3887 AttributeSet); 3888 EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallObjectMethod()", FALSE); 3889 if (js != (jstring) 0) { 3890 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3891 EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to GetStringChars()", FALSE); 3892 wcsncpy(attributes->backgroundColor, stringBytes, (sizeof(attributes->backgroundColor) / sizeof(wchar_t))); 3893 length = jniEnv->GetStringLength(js); 3894 attributes->backgroundColor[length < (sizeof(attributes->backgroundColor) / sizeof(wchar_t)) ? 3895 length : (sizeof(attributes->backgroundColor) / sizeof(wchar_t))-2] = (wchar_t) 0; 3896 EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to GetStringLength()", FALSE); 3897 jniEnv->ReleaseStringChars(js, stringBytes); 3898 EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to ReleaseStringChars()", FALSE); 3899 jniEnv->CallVoidMethod(accessBridgeObject, 3900 decrementReferenceMethod, js); 3901 EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallVoidMethod()", FALSE); 3902 wPrintDebugString(L" AttributeSet's background color = %ls", attributes->backgroundColor); 3903 jniEnv->DeleteLocalRef(js); 3904 EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE); 3905 } else { 3906 PrintDebugString(" AttributeSet's background color is null."); 3907 attributes->backgroundColor[0] = (wchar_t) 0; 3908 } 3909 } else { 3910 PrintDebugString(" Error! either env == 0 or getBackgroundColorFromAttributeSetMethod == 0"); 3911 jniEnv->CallVoidMethod(accessBridgeObject, 3912 decrementReferenceMethod, AttributeSet); 3913 EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallVoidMethod()", FALSE); 3914 jniEnv->DeleteLocalRef(AttributeSet); 3915 EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE); 3916 return FALSE; 3917 } 3918 3919 // Get the foregroundColor setting 3920 if (getForegroundColorFromAttributeSetMethod != (jmethodID) 0) { 3921 PrintDebugString(" Getting foregroundColor from AttributeSet..."); 3922 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 3923 getForegroundColorFromAttributeSetMethod, 3924 AttributeSet); 3925 EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallObjectMethod()", FALSE); 3926 if (js != (jstring) 0) { 3927 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3928 EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to GetStringChars()", FALSE); 3929 wcsncpy(attributes->foregroundColor, stringBytes, (sizeof(attributes->foregroundColor) / sizeof(wchar_t))); 3930 length = jniEnv->GetStringLength(js); 3931 attributes->foregroundColor[length < (sizeof(attributes->foregroundColor) / sizeof(wchar_t)) ? 3932 length : (sizeof(attributes->foregroundColor) / sizeof(wchar_t))-2] = (wchar_t) 0; 3933 EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to GetStringLength()", FALSE); 3934 jniEnv->ReleaseStringChars(js, stringBytes); 3935 EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to ReleaseStringChars()", FALSE); 3936 jniEnv->CallVoidMethod(accessBridgeObject, 3937 decrementReferenceMethod, js); 3938 EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallVoidMethod()", FALSE); 3939 wPrintDebugString(L" AttributeSet's foreground color = %ls", attributes->foregroundColor); 3940 jniEnv->DeleteLocalRef(js); 3941 EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE); 3942 } else { 3943 PrintDebugString(" AttributeSet's foreground color is null."); 3944 attributes->foregroundColor[0] = (wchar_t) 0; 3945 } 3946 } else { 3947 PrintDebugString(" Error! either env == 0 or getForegroundColorFromAttributeSetMethod == 0"); 3948 jniEnv->CallVoidMethod(accessBridgeObject, 3949 decrementReferenceMethod, AttributeSet); 3950 EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallVoidMethod()", FALSE); 3951 jniEnv->DeleteLocalRef(AttributeSet); 3952 EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE); 3953 return FALSE; 3954 } 3955 3956 // Get the fontFamily setting 3957 if (getFontFamilyFromAttributeSetMethod != (jmethodID) 0) { 3958 PrintDebugString(" Getting fontFamily from AttributeSet..."); 3959 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 3960 getFontFamilyFromAttributeSetMethod, 3961 AttributeSet); 3962 EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallObjectMethod()", FALSE); 3963 if (js != (jstring) 0) { 3964 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 3965 EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to GetStringChars()", FALSE); 3966 wcsncpy(attributes->fontFamily, stringBytes, (sizeof(attributes->fontFamily) / sizeof(wchar_t))); 3967 length = jniEnv->GetStringLength(js); 3968 attributes->fontFamily[length < (sizeof(attributes->fontFamily) / sizeof(wchar_t)) ? 3969 length : (sizeof(attributes->fontFamily) / sizeof(wchar_t))-2] = (wchar_t) 0; 3970 EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to GetStringLength()", FALSE); 3971 jniEnv->ReleaseStringChars(js, stringBytes); 3972 EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to ReleaseStringChars()", FALSE); 3973 jniEnv->CallVoidMethod(accessBridgeObject, 3974 decrementReferenceMethod, js); 3975 EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallVoidMethod()", FALSE); 3976 wPrintDebugString(L" AttributeSet's fontFamily = %ls", attributes->fontFamily); 3977 jniEnv->DeleteLocalRef(js); 3978 EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to DeleteLocalRef()", FALSE); 3979 } else { 3980 PrintDebugString(" AttributeSet's fontFamily is null."); 3981 attributes->backgroundColor[0] = (wchar_t) 0; 3982 } 3983 } else { 3984 PrintDebugString(" Error! either env == 0 or getFontFamilyFromAttributeSetMethod == 0"); 3985 jniEnv->CallVoidMethod(accessBridgeObject, 3986 decrementReferenceMethod, AttributeSet); 3987 EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallVoidMethod()", FALSE); 3988 jniEnv->DeleteLocalRef(AttributeSet); 3989 EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to DeleteLocalRef()", FALSE); 3990 return FALSE; 3991 } 3992 3993 // Get the font size 3994 if (getFontSizeFromAttributeSetMethod != (jmethodID) 0) { 3995 PrintDebugString(" Getting font size from AttributeSet..."); 3996 attributes->fontSize = jniEnv->CallIntMethod(accessBridgeObject, 3997 getFontSizeFromAttributeSetMethod, 3998 AttributeSet); 3999 EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to CallIntMethod()", FALSE); 4000 PrintDebugString(" AttributeSet's font size = %d", attributes->fontSize); 4001 } else { 4002 PrintDebugString(" Error! either env == 0 or getAlignmentFromAttributeSetMethod == 0"); 4003 jniEnv->CallVoidMethod(accessBridgeObject, 4004 decrementReferenceMethod, AttributeSet); 4005 EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to CallVoidMethod()", FALSE); 4006 jniEnv->DeleteLocalRef(AttributeSet); 4007 EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to DeleteLocalRef()", FALSE); 4008 return FALSE; 4009 } 4010 4011 4012 // Get the alignment setting 4013 if (getAlignmentFromAttributeSetMethod != (jmethodID) 0) { 4014 PrintDebugString(" Getting alignment from AttributeSet..."); 4015 attributes->alignment = jniEnv->CallIntMethod(accessBridgeObject, 4016 getAlignmentFromAttributeSetMethod, 4017 AttributeSet); 4018 EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to CallIntMethod()", FALSE); 4019 } else { 4020 PrintDebugString(" Error! either env == 0 or getAlignmentFromAttributeSetMethod == 0"); 4021 jniEnv->CallVoidMethod(accessBridgeObject, 4022 decrementReferenceMethod, AttributeSet); 4023 EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to CallVoidMethod()", FALSE); 4024 jniEnv->DeleteLocalRef(AttributeSet); 4025 EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to DeleteLocalRef()", FALSE); 4026 return FALSE; 4027 } 4028 4029 // Get the bidiLevel setting 4030 if (getBidiLevelFromAttributeSetMethod != (jmethodID) 0) { 4031 PrintDebugString(" Getting bidiLevel from AttributeSet..."); 4032 attributes->bidiLevel = jniEnv->CallIntMethod(accessBridgeObject, 4033 getBidiLevelFromAttributeSetMethod, 4034 AttributeSet); 4035 EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to CallIntMethod()", FALSE); 4036 } else { 4037 PrintDebugString(" Error! either env == 0 or getBidiLevelFromAttributeSetMethod == 0"); 4038 jniEnv->CallVoidMethod(accessBridgeObject, 4039 decrementReferenceMethod, AttributeSet); 4040 EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to CallVoidMethod()", FALSE); 4041 jniEnv->DeleteLocalRef(AttributeSet); 4042 EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to DeleteLocalRef()", FALSE); 4043 return FALSE; 4044 } 4045 4046 // Get the firstLineIndent setting 4047 if (getFirstLineIndentFromAttributeSetMethod != (jmethodID) 0) { 4048 PrintDebugString(" Getting firstLineIndent from AttributeSet..."); 4049 attributes->firstLineIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject, 4050 getFirstLineIndentFromAttributeSetMethod, 4051 AttributeSet); 4052 EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to CallIntMethod()", FALSE); 4053 } else { 4054 PrintDebugString(" Error! either env == 0 or getFirstLineIndentFromAttributeSetMethod == 0"); 4055 jniEnv->CallVoidMethod(accessBridgeObject, 4056 decrementReferenceMethod, AttributeSet); 4057 EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to CallVoidMethod()", FALSE); 4058 jniEnv->DeleteLocalRef(AttributeSet); 4059 EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to DeleteLocalRef()", FALSE); 4060 return FALSE; 4061 } 4062 4063 // Get the leftIndent setting 4064 if (getLeftIndentFromAttributeSetMethod != (jmethodID) 0) { 4065 PrintDebugString(" Getting leftIndent from AttributeSet..."); 4066 attributes->leftIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject, 4067 getLeftIndentFromAttributeSetMethod, 4068 AttributeSet); 4069 EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to CallIntMethod()", FALSE); 4070 } else { 4071 PrintDebugString(" Error! either env == 0 or getLeftIndentFromAttributeSetMethod == 0"); 4072 jniEnv->CallVoidMethod(accessBridgeObject, 4073 decrementReferenceMethod, AttributeSet); 4074 EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to CallVoidMethod()", FALSE); 4075 jniEnv->DeleteLocalRef(AttributeSet); 4076 EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to DeleteLocalRef()", FALSE); 4077 return FALSE; 4078 } 4079 4080 // Get the rightIndent setting 4081 if (getRightIndentFromAttributeSetMethod != (jmethodID) 0) { 4082 PrintDebugString(" Getting rightIndent from AttributeSet..."); 4083 attributes->rightIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject, 4084 getRightIndentFromAttributeSetMethod, 4085 AttributeSet); 4086 EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to CallIntMethod()", FALSE); 4087 } else { 4088 PrintDebugString(" Error! either env == 0 or getRightIndentFromAttributeSetMethod == 0"); 4089 jniEnv->CallVoidMethod(accessBridgeObject, 4090 decrementReferenceMethod, AttributeSet); 4091 EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to CallVoidMethod()", FALSE); 4092 jniEnv->DeleteLocalRef(AttributeSet); 4093 EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to DeleteLocalRef()", FALSE); 4094 return FALSE; 4095 } 4096 4097 // Get the lineSpacing setting 4098 if (getLineSpacingFromAttributeSetMethod != (jmethodID) 0) { 4099 PrintDebugString(" Getting lineSpacing from AttributeSet..."); 4100 attributes->lineSpacing = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject, 4101 getLineSpacingFromAttributeSetMethod, 4102 AttributeSet); 4103 EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to CallIntMethod()", FALSE); 4104 } else { 4105 PrintDebugString(" Error! either env == 0 or getLineSpacingFromAttributeSetMethod == 0"); 4106 jniEnv->CallVoidMethod(accessBridgeObject, 4107 decrementReferenceMethod, AttributeSet); 4108 EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to CallVoidMethod()", FALSE); 4109 jniEnv->DeleteLocalRef(AttributeSet); 4110 EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to DeleteLocalRef()", FALSE); 4111 return FALSE; 4112 } 4113 4114 // Get the spaceAbove setting 4115 if (getSpaceAboveFromAttributeSetMethod != (jmethodID) 0) { 4116 PrintDebugString(" Getting spaceAbove from AttributeSet..."); 4117 attributes->spaceAbove = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject, 4118 getSpaceAboveFromAttributeSetMethod, 4119 AttributeSet); 4120 EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to CallIntMethod()", FALSE); 4121 } else { 4122 PrintDebugString(" Error! either env == 0 or getSpaceAboveFromAttributeSetMethod == 0"); 4123 jniEnv->CallVoidMethod(accessBridgeObject, 4124 decrementReferenceMethod, AttributeSet); 4125 EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to CallVoidMethod()", FALSE); 4126 jniEnv->DeleteLocalRef(AttributeSet); 4127 EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to DeleteLocalRef()", FALSE); 4128 return FALSE; 4129 } 4130 4131 // Get the spaceBelow setting 4132 if (getSpaceBelowFromAttributeSetMethod != (jmethodID) 0) { 4133 PrintDebugString(" Getting spaceBelow from AttributeSet..."); 4134 attributes->spaceBelow = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject, 4135 getSpaceBelowFromAttributeSetMethod, 4136 AttributeSet); 4137 EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to CallIntMethod()", FALSE); 4138 } else { 4139 PrintDebugString(" Error! either env == 0 or getSpaceBelowFromAttributeSetMethod == 0"); 4140 jniEnv->CallVoidMethod(accessBridgeObject, 4141 decrementReferenceMethod, AttributeSet); 4142 EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to CallVoidMethod()", FALSE); 4143 jniEnv->DeleteLocalRef(AttributeSet); 4144 EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to DeleteLocalRef()", FALSE); 4145 return FALSE; 4146 } 4147 4148 // Release the AttributeSet object 4149 if (decrementReferenceMethod != (jmethodID) 0) { 4150 PrintDebugString(" Decrementing reference to AttributeSet..."); 4151 jniEnv->CallVoidMethod(accessBridgeObject, 4152 decrementReferenceMethod, AttributeSet); 4153 EXCEPTION_CHECK("Releasing AttributeSet object - call to CallVoidMethod()", FALSE); 4154 } else { 4155 PrintDebugString(" Error! either env == 0 or accessBridgeObject == 0"); 4156 jniEnv->DeleteLocalRef(AttributeSet); 4157 EXCEPTION_CHECK("Releasing AttributeSet object - call to DeleteLocalRef()", FALSE); 4158 return FALSE; 4159 } 4160 4161 // Get the full attributes string at index 4162 if (getAccessibleAttributesAtIndexFromContextMethod != (jmethodID) 0) { 4163 PrintDebugString(" Getting full attributes string from Context..."); 4164 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 4165 getAccessibleAttributesAtIndexFromContextMethod, 4166 accessibleContext, index); 4167 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallObjectMethod()", FALSE); 4168 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 4169 if (js != (jstring) 0) { 4170 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 4171 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringChars()", FALSE); 4172 wcsncpy(attributes->fullAttributesString, stringBytes, (sizeof(attributes->fullAttributesString) / sizeof(wchar_t))); 4173 length = jniEnv->GetStringLength(js); 4174 attributes->fullAttributesString[length < (sizeof(attributes->fullAttributesString) / sizeof(wchar_t)) ? 4175 length : (sizeof(attributes->fullAttributesString) / sizeof(wchar_t))-2] = (wchar_t) 0; 4176 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringLength()", FALSE); 4177 jniEnv->ReleaseStringChars(js, stringBytes); 4178 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to ReleaseStringChars()", FALSE); 4179 jniEnv->CallVoidMethod(accessBridgeObject, 4180 decrementReferenceMethod, js); 4181 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallVoidMethod()", FALSE); 4182 wPrintDebugString(L" Accessible Text attributes = %ls", attributes->fullAttributesString); 4183 jniEnv->DeleteLocalRef(js); 4184 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE); 4185 } else { 4186 PrintDebugString(" Accessible Text attributes is null."); 4187 attributes->fullAttributesString[0] = (wchar_t) 0; 4188 jniEnv->DeleteLocalRef(AttributeSet); 4189 EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE); 4190 return FALSE; 4191 } 4192 } else { 4193 PrintDebugString(" Error! either env == 0 or getAccessibleAttributesAtIndexFromContextMethod == 0"); 4194 jniEnv->DeleteLocalRef(AttributeSet); 4195 return FALSE; 4196 } 4197 4198 jniEnv->DeleteLocalRef(AttributeSet); 4199 EXCEPTION_CHECK("Getting AccessibleAttributeSetAtIndex - call to DeleteLocalRef()", FALSE); 4200 return TRUE; 4201 } 4202 4203 BOOL 4204 AccessBridgeJavaEntryPoints::getAccessibleTextRect(jobject accessibleContext, AccessibleTextRectInfo *rectInfo, jint index) { 4205 4206 jthrowable exception; 4207 4208 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleTextRect(%p), index = %d", 4209 accessibleContext, index); 4210 4211 // Verify the Java VM still exists and AccessibleContext is 4212 // an instance of AccessibleText 4213 if (verifyAccessibleText(accessibleContext) == FALSE) { 4214 return FALSE; 4215 } 4216 4217 // Get the x coord 4218 if (getAccessibleXcoordTextRectAtIndexFromContextMethod != (jmethodID) 0) { 4219 rectInfo->x = jniEnv->CallIntMethod(accessBridgeObject, 4220 getAccessibleXcoordTextRectAtIndexFromContextMethod, 4221 accessibleContext, index); 4222 EXCEPTION_CHECK("Getting AccessibleXcoordTextRect - call to CallIntMethod()", FALSE); 4223 PrintDebugString(" X coord = %d", rectInfo->x); 4224 } else { 4225 PrintDebugString(" Error! either env == 0 or getAccessibleXcoordTextRectAtIndexFromContextMethod == 0"); 4226 return FALSE; 4227 } 4228 4229 // Get the y coord 4230 if (getAccessibleYcoordTextRectAtIndexFromContextMethod != (jmethodID) 0) { 4231 rectInfo->y = jniEnv->CallIntMethod(accessBridgeObject, 4232 getAccessibleYcoordTextRectAtIndexFromContextMethod, 4233 accessibleContext, index); 4234 EXCEPTION_CHECK("Getting AccessibleYcoordTextRect - call to CallIntMethod()", FALSE); 4235 PrintDebugString(" Y coord = %d", rectInfo->y); 4236 } else { 4237 PrintDebugString(" Error! either env == 0 or getAccessibleYcoordTextRectAtIndexFromContextMethod == 0"); 4238 return FALSE; 4239 } 4240 4241 // Get the width 4242 if (getAccessibleWidthTextRectAtIndexFromContextMethod != (jmethodID) 0) { 4243 rectInfo->width = jniEnv->CallIntMethod(accessBridgeObject, 4244 getAccessibleWidthTextRectAtIndexFromContextMethod, 4245 accessibleContext, index); 4246 EXCEPTION_CHECK("Getting AccessibleWidthTextRect - call to CallIntMethod()", FALSE); 4247 PrintDebugString(" Width = %d", rectInfo->width); 4248 } else { 4249 PrintDebugString(" Error! either env == 0 or getAccessibleWidthTextRectAtIndexFromContextMethod == 0"); 4250 return FALSE; 4251 } 4252 4253 // Get the height 4254 if (getAccessibleHeightTextRectAtIndexFromContextMethod != (jmethodID) 0) { 4255 rectInfo->height = jniEnv->CallIntMethod(accessBridgeObject, 4256 getAccessibleHeightTextRectAtIndexFromContextMethod, 4257 accessibleContext, index); 4258 EXCEPTION_CHECK("Getting AccessibleHeightTextRect - call to CallIntMethod()", FALSE); 4259 PrintDebugString(" Height = %d", rectInfo->height); 4260 } else { 4261 PrintDebugString(" Error! either env == 0 or getAccessibleHeightTextRectAtIndexFromContextMethod == 0"); 4262 return FALSE; 4263 } 4264 4265 return TRUE; 4266 } 4267 4268 // ===== 4269 4270 /** 4271 * gets the bounding rectangle for the text caret 4272 */ 4273 BOOL 4274 AccessBridgeJavaEntryPoints::getCaretLocation(jobject accessibleContext, AccessibleTextRectInfo *rectInfo, jint index) { 4275 4276 jthrowable exception; 4277 4278 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getCaretLocation(%p), index = %d", 4279 accessibleContext, index); 4280 4281 // Verify the Java VM still exists and AccessibleContext is 4282 // an instance of AccessibleText 4283 if (verifyAccessibleText(accessibleContext) == FALSE) { 4284 return FALSE; 4285 } 4286 4287 // Get the x coord 4288 if (getCaretLocationXMethod != (jmethodID) 0) { 4289 rectInfo->x = jniEnv->CallIntMethod(accessBridgeObject, 4290 getCaretLocationXMethod, 4291 accessibleContext, index); 4292 EXCEPTION_CHECK("Getting caret X coordinate - call to CallIntMethod()", FALSE); 4293 PrintDebugString(" X coord = %d", rectInfo->x); 4294 } else { 4295 PrintDebugString(" Error! either env == 0 or getCaretLocationXMethod == 0"); 4296 return FALSE; 4297 } 4298 4299 // Get the y coord 4300 if (getCaretLocationYMethod != (jmethodID) 0) { 4301 rectInfo->y = jniEnv->CallIntMethod(accessBridgeObject, 4302 getCaretLocationYMethod, 4303 accessibleContext, index); 4304 EXCEPTION_CHECK("Getting caret Y coordinate - call to CallIntMethod()", FALSE); 4305 PrintDebugString(" Y coord = %d", rectInfo->y); 4306 } else { 4307 PrintDebugString(" Error! either env == 0 or getCaretLocationYMethod == 0"); 4308 return FALSE; 4309 } 4310 4311 // Get the width 4312 if (getCaretLocationWidthMethod != (jmethodID) 0) { 4313 rectInfo->width = jniEnv->CallIntMethod(accessBridgeObject, 4314 getCaretLocationWidthMethod, 4315 accessibleContext, index); 4316 EXCEPTION_CHECK("Getting caret width - call to CallIntMethod()", FALSE); 4317 PrintDebugString(" Width = %d", rectInfo->width); 4318 } else { 4319 PrintDebugString(" Error! either env == 0 or getCaretLocationWidthMethod == 0"); 4320 return FALSE; 4321 } 4322 4323 // Get the height 4324 if (getCaretLocationHeightMethod != (jmethodID) 0) { 4325 rectInfo->height = jniEnv->CallIntMethod(accessBridgeObject, 4326 getCaretLocationHeightMethod, 4327 accessibleContext, index); 4328 EXCEPTION_CHECK("Getting caret height - call to CallIntMethod()", FALSE); 4329 PrintDebugString(" Height = %d", rectInfo->height); 4330 } else { 4331 PrintDebugString(" Error! either env == 0 or getCaretLocationHeightMethod == 0"); 4332 return FALSE; 4333 } 4334 4335 return TRUE; 4336 } 4337 4338 // ===== 4339 4340 BOOL 4341 AccessBridgeJavaEntryPoints::getAccessibleTextLineBounds(jobject accessibleContext, jint index, jint *startIndex, jint *endIndex) { 4342 4343 jthrowable exception; 4344 4345 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleTextLineBounds(%p):", accessibleContext); 4346 4347 // Verify the Java VM still exists and AccessibleContext is 4348 // an instance of AccessibleText 4349 if (verifyAccessibleText(accessibleContext) == FALSE) { 4350 return FALSE; 4351 } 4352 4353 // Get the index of the left boundary of the line containing 'index' 4354 if (getAccessibleTextLineLeftBoundsFromContextMethod != (jmethodID) 0) { 4355 *startIndex = jniEnv->CallIntMethod(accessBridgeObject, 4356 getAccessibleTextLineLeftBoundsFromContextMethod, 4357 accessibleContext, index); 4358 EXCEPTION_CHECK("Getting AccessibleTextLineLeftBounds - call to CallIntMethod()", FALSE); 4359 PrintDebugString(" startIndex = %d", *startIndex); 4360 } else { 4361 PrintDebugString(" Error! either env == 0 or getAccessibleTextLineLeftBoundsFromContextMethod == 0"); 4362 return FALSE; 4363 } 4364 4365 // Get the index of the right boundary of the line containing 'index' 4366 if (getAccessibleTextLineRightBoundsFromContextMethod != (jmethodID) 0) { 4367 *endIndex = jniEnv->CallIntMethod(accessBridgeObject, 4368 getAccessibleTextLineRightBoundsFromContextMethod, 4369 accessibleContext, index); 4370 EXCEPTION_CHECK("Getting AccessibleTextLineRightBounds - call to CallIntMethod()", FALSE); 4371 PrintDebugString(" endIndex = %d", *endIndex); 4372 } else { 4373 PrintDebugString(" Error! either env == 0 or getAccessibleTextLineRightBoundsFromContextMethod == 0"); 4374 return FALSE; 4375 } 4376 4377 return TRUE; 4378 } 4379 4380 BOOL 4381 AccessBridgeJavaEntryPoints::getAccessibleTextRange(jobject accessibleContext, 4382 jint start, jint end, wchar_t *text, short len) { 4383 jstring js; 4384 const wchar_t *stringBytes; 4385 jthrowable exception; 4386 jsize length; 4387 4388 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleTextRange(%p, %d, %d, *text, %d):", accessibleContext, start, end, len); 4389 4390 // Verify the Java VM still exists and AccessibleContext is 4391 // an instance of AccessibleText 4392 if (verifyAccessibleText(accessibleContext) == FALSE) { 4393 return FALSE; 4394 } 4395 4396 // range is inclusive 4397 if (end < start) { 4398 PrintDebugString(" Error! end < start!"); 4399 text[0] = (wchar_t) 0; 4400 return FALSE; 4401 } 4402 4403 // Get the text range within [start, end] inclusive 4404 if (getAccessibleTextRangeFromContextMethod != (jmethodID) 0) { 4405 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 4406 getAccessibleTextRangeFromContextMethod, 4407 accessibleContext, start, end); 4408 EXCEPTION_CHECK("Getting AccessibleTextRange - call to CallObjectMethod()", FALSE); 4409 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 4410 if (js != (jstring) 0) { 4411 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 4412 EXCEPTION_CHECK("Getting AccessibleTextRange - call to GetStringChars()", FALSE); 4413 wPrintDebugString(L" Accessible Text stringBytes returned from Java = %ls", stringBytes); 4414 wcsncpy(text, stringBytes, len); 4415 length = jniEnv->GetStringLength(js); 4416 PrintDebugString(" Accessible Text stringBytes length = %d", length); 4417 text[length < len ? length : len - 2] = (wchar_t) 0; 4418 wPrintDebugString(L" Accessible Text 'text' after null termination = %ls", text); 4419 EXCEPTION_CHECK("Getting AccessibleTextRange - call to GetStringLength()", FALSE); 4420 jniEnv->ReleaseStringChars(js, stringBytes); 4421 EXCEPTION_CHECK("Getting AccessibleTextRange - call to ReleaseStringChars()", FALSE); 4422 jniEnv->CallVoidMethod(accessBridgeObject, 4423 decrementReferenceMethod, js); 4424 EXCEPTION_CHECK("Getting AccessibleTextRange - call to CallVoidMethod()", FALSE); 4425 wPrintDebugString(L" Accessible Text range = %ls", text); 4426 jniEnv->DeleteLocalRef(js); 4427 EXCEPTION_CHECK("Getting AccessibleTextRange - call to DeleteLocalRef()", FALSE); 4428 } else { 4429 PrintDebugString(" current Accessible Text range is null."); 4430 text[0] = (wchar_t) 0; 4431 return FALSE; 4432 } 4433 } else { 4434 PrintDebugString(" Error! either env == 0 or getAccessibleTextRangeFromContextMethod == 0"); 4435 return FALSE; 4436 } 4437 return TRUE; 4438 } 4439 4440 /********** AccessibleValue routines ***************/ 4441 4442 BOOL 4443 AccessBridgeJavaEntryPoints::getCurrentAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) { 4444 jstring js; 4445 const wchar_t *stringBytes; 4446 jthrowable exception; 4447 jsize length; 4448 4449 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getCurrentAccessibleValueFromContext(%p):", accessibleContext); 4450 4451 // Get the current Accessible Value 4452 if (getCurrentAccessibleValueFromContextMethod != (jmethodID) 0) { 4453 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 4454 getCurrentAccessibleValueFromContextMethod, 4455 accessibleContext); 4456 EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to CallObjectMethod()", FALSE); 4457 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 4458 if (js != (jstring) 0) { 4459 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 4460 EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to GetStringChars()", FALSE); 4461 wcsncpy(value, stringBytes, len); 4462 length = jniEnv->GetStringLength(js); 4463 value[length < len ? length : len - 2] = (wchar_t) 0; 4464 EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to GetStringLength()", FALSE); 4465 jniEnv->ReleaseStringChars(js, stringBytes); 4466 EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to ReleaseStringChars()", FALSE); 4467 jniEnv->CallVoidMethod(accessBridgeObject, 4468 decrementReferenceMethod, js); 4469 EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to CallVoidMethod()", FALSE); 4470 PrintDebugString(" current Accessible Value = %s", value); 4471 jniEnv->DeleteLocalRef(js); 4472 EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to DeleteLocalRef()", FALSE); 4473 } else { 4474 PrintDebugString(" current Accessible Value is null."); 4475 value[0] = (wchar_t) 0; 4476 return FALSE; 4477 } 4478 } else { 4479 PrintDebugString(" Error! either env == 0 or getCurrentAccessibleValueFromContextMethod == 0"); 4480 return FALSE; 4481 } 4482 return TRUE; 4483 } 4484 4485 BOOL 4486 AccessBridgeJavaEntryPoints::getMaximumAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) { 4487 jstring js; 4488 const wchar_t *stringBytes; 4489 jthrowable exception; 4490 jsize length; 4491 4492 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getMaximumAccessibleValueFromContext(%p):", accessibleContext); 4493 4494 // Get the maximum Accessible Value 4495 if (getMaximumAccessibleValueFromContextMethod != (jmethodID) 0) { 4496 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 4497 getMaximumAccessibleValueFromContextMethod, 4498 accessibleContext); 4499 EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to CallObjectMethod()", FALSE); 4500 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 4501 if (js != (jstring) 0) { 4502 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 4503 EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to GetStringChars()", FALSE); 4504 wcsncpy(value, stringBytes, len); 4505 length = jniEnv->GetStringLength(js); 4506 value[length < len ? length : len - 2] = (wchar_t) 0; 4507 EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to GetStringLength()", FALSE); 4508 jniEnv->ReleaseStringChars(js, stringBytes); 4509 EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to ReleaseStringChars()", FALSE); 4510 jniEnv->CallVoidMethod(accessBridgeObject, 4511 decrementReferenceMethod, js); 4512 EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to CallVoidMethod()", FALSE); 4513 PrintDebugString(" maximum Accessible Value = %s", value); 4514 jniEnv->DeleteLocalRef(js); 4515 EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to DeleteLocalRef()", FALSE); 4516 } else { 4517 PrintDebugString(" maximum Accessible Value is null."); 4518 value[0] = (wchar_t) 0; 4519 return FALSE; 4520 } 4521 } else { 4522 PrintDebugString(" Error! either env == 0 or getMaximumAccessibleValueFromContextMethod == 0"); 4523 return FALSE; 4524 } 4525 return TRUE; 4526 } 4527 4528 BOOL 4529 AccessBridgeJavaEntryPoints::getMinimumAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) { 4530 jstring js; 4531 const wchar_t *stringBytes; 4532 jthrowable exception; 4533 jsize length; 4534 4535 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getMinimumAccessibleValueFromContext(%p):", accessibleContext); 4536 4537 // Get the mimimum Accessible Value 4538 if (getMinimumAccessibleValueFromContextMethod != (jmethodID) 0) { 4539 js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject, 4540 getMinimumAccessibleValueFromContextMethod, 4541 accessibleContext); 4542 EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to CallObjectMethod()", FALSE); 4543 PrintDebugString(" returned from CallObjectMethod(), js = %p", js); 4544 if (js != (jstring) 0) { 4545 stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0); 4546 EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to GetStringChars()", FALSE); 4547 wcsncpy(value, stringBytes, len); 4548 length = jniEnv->GetStringLength(js); 4549 value[length < len ? length : len - 2] = (wchar_t) 0; 4550 EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to GetStringLength()", FALSE); 4551 jniEnv->ReleaseStringChars(js, stringBytes); 4552 EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to ReleaseStringChars()", FALSE); 4553 jniEnv->CallVoidMethod(accessBridgeObject, 4554 decrementReferenceMethod, js); 4555 EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to CallVoidMethod()", FALSE); 4556 PrintDebugString(" mimimum Accessible Value = %s", value); 4557 jniEnv->DeleteLocalRef(js); 4558 EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to DeleteLocalRef()", FALSE); 4559 } else { 4560 PrintDebugString(" mimimum Accessible Value is null."); 4561 value[0] = (wchar_t) 0; 4562 return FALSE; 4563 } 4564 } else { 4565 PrintDebugString(" Error! either env == 0 or getMinimumAccessibleValueFromContextMethod == 0"); 4566 return FALSE; 4567 } 4568 return TRUE; 4569 } 4570 4571 4572 /********** AccessibleSelection routines ***************/ 4573 4574 void 4575 AccessBridgeJavaEntryPoints::addAccessibleSelectionFromContext(jobject accessibleContext, int i) { 4576 jthrowable exception; 4577 4578 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::addAccessibleSelectionFromContext(%p):", accessibleContext); 4579 4580 // Add the child to the AccessibleSelection 4581 if (addAccessibleSelectionFromContextMethod != (jmethodID) 0) { 4582 jniEnv->CallVoidMethod(accessBridgeObject, 4583 addAccessibleSelectionFromContextMethod, 4584 accessibleContext, i); 4585 EXCEPTION_CHECK_VOID("Doing addAccessibleSelection - call to CallVoidMethod()"); 4586 PrintDebugString(" returned from CallObjectMethod()"); 4587 } else { 4588 PrintDebugString(" Error! either env == 0 or addAccessibleSelectionFromContextMethod == 0"); 4589 } 4590 } 4591 4592 void 4593 AccessBridgeJavaEntryPoints::clearAccessibleSelectionFromContext(jobject accessibleContext) { 4594 jthrowable exception; 4595 4596 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::clearAccessibleSelectionFromContext(%p):", accessibleContext); 4597 4598 // Clearing the Selection of the AccessibleSelection 4599 if (clearAccessibleSelectionFromContextMethod != (jmethodID) 0) { 4600 jniEnv->CallVoidMethod(accessBridgeObject, 4601 clearAccessibleSelectionFromContextMethod, 4602 accessibleContext); 4603 EXCEPTION_CHECK_VOID("Doing clearAccessibleSelection - call to CallVoidMethod()"); 4604 PrintDebugString(" returned from CallObjectMethod()"); 4605 } else { 4606 PrintDebugString(" Error! either env == 0 or clearAccessibleSelectionFromContextMethod == 0"); 4607 } 4608 } 4609 4610 jobject 4611 AccessBridgeJavaEntryPoints::getAccessibleSelectionFromContext(jobject accessibleContext, int i) { 4612 jobject returnedAccessibleContext; 4613 jobject globalRef; 4614 jthrowable exception; 4615 4616 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleSelectionFromContext(%p):", accessibleContext); 4617 4618 if (getAccessibleSelectionContextFromContextMethod != (jmethodID) 0) { 4619 returnedAccessibleContext = jniEnv->CallObjectMethod( 4620 accessBridgeObject, 4621 getAccessibleSelectionContextFromContextMethod, 4622 accessibleContext, i); 4623 EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to CallObjectMethod()", (jobject) 0); 4624 globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext); 4625 EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to NewGlobalRef()", (jobject) 0); 4626 jniEnv->DeleteLocalRef(returnedAccessibleContext); 4627 EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to DeleteLocalRef()", (jobject) 0); 4628 PrintDebugString(" Returning - returnedAccessibleContext = %p; globalRef = %p", 4629 returnedAccessibleContext, globalRef); 4630 return globalRef; 4631 } else { 4632 PrintDebugString(" Error! either env == 0 or getAccessibleSelectionContextFromContextMethod == 0"); 4633 return (jobject) 0; 4634 } 4635 } 4636 4637 int 4638 AccessBridgeJavaEntryPoints::getAccessibleSelectionCountFromContext(jobject accessibleContext) { 4639 int count; 4640 jthrowable exception; 4641 4642 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::getAccessibleSelectionCountFromContext(%p):", accessibleContext); 4643 4644 // Get (& return) the # of items selected in the AccessibleSelection 4645 if (getAccessibleSelectionCountFromContextMethod != (jmethodID) 0) { 4646 count = jniEnv->CallIntMethod(accessBridgeObject, 4647 getAccessibleSelectionCountFromContextMethod, 4648 accessibleContext); 4649 EXCEPTION_CHECK("Getting AccessibleSelectionCount - call to CallIntMethod()", -1); 4650 PrintDebugString(" returned from CallObjectMethod()"); 4651 return count; 4652 } else { 4653 PrintDebugString(" Error! either env == 0 or getAccessibleSelectionCountFromContextMethod == 0"); 4654 return -1; 4655 } 4656 } 4657 4658 BOOL 4659 AccessBridgeJavaEntryPoints::isAccessibleChildSelectedFromContext(jobject accessibleContext, int i) { 4660 jboolean result; 4661 jthrowable exception; 4662 4663 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::isAccessibleChildSelectedFromContext(%p):", accessibleContext); 4664 4665 // Get (& return) the # of items selected in the AccessibleSelection 4666 if (isAccessibleChildSelectedFromContextMethod != (jmethodID) 0) { 4667 result = jniEnv->CallBooleanMethod(accessBridgeObject, 4668 isAccessibleChildSelectedFromContextMethod, 4669 accessibleContext, i); 4670 EXCEPTION_CHECK("Doing isAccessibleChildSelected - call to CallBooleanMethod()", FALSE); 4671 PrintDebugString(" returned from CallObjectMethod()"); 4672 if (result != 0) { 4673 return TRUE; 4674 } 4675 } else { 4676 PrintDebugString(" Error! either env == 0 or isAccessibleChildSelectedFromContextMethod == 0"); 4677 } 4678 return FALSE; 4679 } 4680 4681 4682 void 4683 AccessBridgeJavaEntryPoints::removeAccessibleSelectionFromContext(jobject accessibleContext, int i) { 4684 jthrowable exception; 4685 4686 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::removeAccessibleSelectionFromContext(%p):", accessibleContext); 4687 4688 // Remove the i-th child from the AccessibleSelection 4689 if (removeAccessibleSelectionFromContextMethod != (jmethodID) 0) { 4690 jniEnv->CallVoidMethod(accessBridgeObject, 4691 removeAccessibleSelectionFromContextMethod, 4692 accessibleContext, i); 4693 EXCEPTION_CHECK_VOID("Doing removeAccessibleSelection - call to CallVoidMethod()"); 4694 PrintDebugString(" returned from CallObjectMethod()"); 4695 } else { 4696 PrintDebugString(" Error! either env == 0 or removeAccessibleSelectionFromContextMethod == 0"); 4697 } 4698 } 4699 4700 void 4701 AccessBridgeJavaEntryPoints::selectAllAccessibleSelectionFromContext(jobject accessibleContext) { 4702 jthrowable exception; 4703 4704 PrintDebugString("\r\nCalling AccessBridgeJavaEntryPoints::selectAllAccessibleSelectionFromContext(%p):", accessibleContext); 4705 4706 // Select all children (if possible) of the AccessibleSelection 4707 if (selectAllAccessibleSelectionFromContextMethod != (jmethodID) 0) { 4708 jniEnv->CallVoidMethod(accessBridgeObject, 4709 selectAllAccessibleSelectionFromContextMethod, 4710 accessibleContext); 4711 EXCEPTION_CHECK_VOID("Doing selectAllAccessibleSelection - call to CallVoidMethod()"); 4712 PrintDebugString(" returned from CallObjectMethod()"); 4713 } else { 4714 PrintDebugString(" Error! either env == 0 or selectAllAccessibleSelectionFromContextMethod == 0"); 4715 } 4716 } 4717 4718 4719 /********** Event Notification Registration routines ***************/ 4720 4721 BOOL 4722 AccessBridgeJavaEntryPoints::addJavaEventNotification(jlong type) { 4723 jthrowable exception; 4724 4725 PrintDebugString("\r\n in AccessBridgeJavaEntryPoints::addJavaEventNotification(%016I64X);", type); 4726 4727 // Let AccessBridge know we want to add an event type 4728 if (addJavaEventNotificationMethod != (jmethodID) 0) { 4729 jniEnv->CallVoidMethod(accessBridgeObject, 4730 addJavaEventNotificationMethod, type); 4731 EXCEPTION_CHECK("Doing addJavaEventNotification - call to CallVoidMethod()", FALSE); 4732 } else { 4733 PrintDebugString(" Error! either env == 0 or addJavaEventNotificationMethod == 0"); 4734 return FALSE; 4735 } 4736 return TRUE; 4737 } 4738 4739 BOOL 4740 AccessBridgeJavaEntryPoints::removeJavaEventNotification(jlong type) { 4741 jthrowable exception; 4742 4743 PrintDebugString("\r\n in AccessBridgeJavaEntryPoints::removeJavaEventNotification(%016I64X):", type); 4744 4745 // Let AccessBridge know we want to remove an event type 4746 if (removeJavaEventNotificationMethod != (jmethodID) 0) { 4747 jniEnv->CallVoidMethod(accessBridgeObject, 4748 removeJavaEventNotificationMethod, type); 4749 EXCEPTION_CHECK("Doing removeJavaEventNotification - call to CallVoidMethod()", FALSE); 4750 } else { 4751 PrintDebugString(" Error! either env == 0 or removeJavaEventNotificationMethod == 0"); 4752 return FALSE; 4753 } 4754 return TRUE; 4755 } 4756 4757 BOOL 4758 AccessBridgeJavaEntryPoints::addAccessibilityEventNotification(jlong type) { 4759 jthrowable exception; 4760 4761 PrintDebugString("\r\n in AccessBridgeJavaEntryPoints::addAccessibilityEventNotification(%016I64X);", type); 4762 4763 // Let AccessBridge know we want to add an event type 4764 if (addAccessibilityEventNotificationMethod != (jmethodID) 0) { 4765 PrintDebugString("\r\n addAccessibilityEventNotification: calling void method: accessBridgeObject = %p", accessBridgeObject); 4766 jniEnv->CallVoidMethod(accessBridgeObject, 4767 addAccessibilityEventNotificationMethod, type); 4768 EXCEPTION_CHECK("Doing addAccessibilityEvent - call to CallVoidMethod()", FALSE); 4769 } else { 4770 PrintDebugString(" Error! either env == 0 or addAccessibilityEventNotificationMethod == 0"); 4771 return FALSE; 4772 } 4773 PrintDebugString("\r\n addAccessibilityEventNotification: just returning true"); 4774 return TRUE; 4775 } 4776 4777 BOOL 4778 AccessBridgeJavaEntryPoints::removeAccessibilityEventNotification(jlong type) { 4779 jthrowable exception; 4780 4781 PrintDebugString("\r\n in AccessBridgeJavaEntryPoints::removeAccessibilityEventNotification(%016I64X):", type); 4782 4783 // Let AccessBridge know we want to remove an event type 4784 if (removeAccessibilityEventNotificationMethod != (jmethodID) 0) { 4785 jniEnv->CallVoidMethod(accessBridgeObject, 4786 removeAccessibilityEventNotificationMethod, type); 4787 EXCEPTION_CHECK("Doing removeAccessibilityEvent - call to CallVoidMethod()", FALSE); 4788 } else { 4789 PrintDebugString(" Error! either env == 0 or removeAccessibilityEventNotificationMethod == 0"); 4790 return FALSE; 4791 } 4792 return TRUE; 4793 }