Path: blob/master/src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp
40957 views
/*1* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425/*26* A class to manage JNI calls into AccessBridge.java27*/2829#include "AccessBridgeJavaEntryPoints.h"30#include "AccessBridgeDebug.h"31323334/**35* Initialize the AccessBridgeJavaEntryPoints class36*37*/38AccessBridgeJavaEntryPoints::AccessBridgeJavaEntryPoints(JNIEnv *jniEnvironment,39jobject bridgeObject) {40jniEnv = jniEnvironment;41accessBridgeObject = (jobject)bridgeObject;42PrintDebugString("[INFO]: AccessBridgeJavaEntryPoints(%p, %p) called", jniEnv, accessBridgeObject);43}444546/**47* Destructor48*49*/50AccessBridgeJavaEntryPoints::~AccessBridgeJavaEntryPoints() {51}5253// -----------------------------------5455#define FIND_CLASS(classRef, className) \56localClassRef = jniEnv->FindClass(className); \57if (localClassRef == (jclass) 0) { \58PrintDebugString("[ERROR]: FindClass(%s) failed! -> jniEnv = %p", className, jniEnv); \59return FALSE; \60} \61classRef = (jclass) jniEnv->NewGlobalRef(localClassRef); \62jniEnv->DeleteLocalRef(localClassRef); \63if (classRef == (jclass) 0) { \64PrintDebugString("[ERROR]: FindClass(%s) failed! -> (ran out of RAM)", className); \65return FALSE; \66}676869#define FIND_METHOD(methodID, classRef, methodString, methodSignature); \70methodID = jniEnv->GetMethodID(classRef, methodString, methodSignature); \71if (methodID == (jmethodID) 0) { \72PrintDebugString("[ERROR]: GetMethodID(%s) failed! -> jniEnv = %p; classRef = %p", methodString, jniEnv, classRef); \73return FALSE; \74}7576#define EXCEPTION_CHECK(situationDescription, returnVal) \77if (exception = jniEnv->ExceptionOccurred()) { \78PrintDebugString("[ERROR]: *** Exception occured while doing: %s; returning %d", situationDescription, returnVal); \79jniEnv->ExceptionDescribe(); \80jniEnv->ExceptionClear(); \81return (returnVal); \82}8384#define EXCEPTION_CHECK_VOID(situationDescription) \85if (exception = jniEnv->ExceptionOccurred()) { \86PrintDebugString("[ERROR]: *** Exception occured while doing: %s", situationDescription); \87jniEnv->ExceptionDescribe(); \88jniEnv->ExceptionClear(); \89return; \90}9192/**93* Make all of the getClass() & getMethod() calls94*95*/96BOOL97AccessBridgeJavaEntryPoints::BuildJavaEntryPoints() {98jclass localClassRef;99100PrintDebugString("[INFO]: Calling BuildJavaEntryPoints():");101102FIND_CLASS(bridgeClass, "com/sun/java/accessibility/internal/AccessBridge");103104// ------- general methods105106// GetMethodID(decrementReference)107FIND_METHOD(decrementReferenceMethod, bridgeClass,108"decrementReference",109"(Ljava/lang/Object;)V");110111// GetMethodID(getJavaVersionPropertyMethod)112FIND_METHOD(getJavaVersionPropertyMethod, bridgeClass,113"getJavaVersionProperty",114"()Ljava/lang/String;");115116// ------- Window methods117118// GetMethodID(isJavaWindow)119FIND_METHOD(isJavaWindowMethod, bridgeClass,120"isJavaWindow",121"(I)Z");122123// GetMethodID(getAccessibleContextFromHWND)124FIND_METHOD(getAccessibleContextFromHWNDMethod, bridgeClass,125"getContextFromNativeWindowHandle",126"(I)Ljavax/accessibility/AccessibleContext;");127128// GetMethodID(getHWNDFromAccessibleContext)129FIND_METHOD(getHWNDFromAccessibleContextMethod, bridgeClass,130"getNativeWindowHandleFromContext",131"(Ljavax/accessibility/AccessibleContext;)I");132133// GetMethodID(getAccessibleParentFromContext)134FIND_METHOD(getAccessibleParentFromContextMethod, bridgeClass,135"getAccessibleParentFromContext",136"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");137138// ===== utility methods ===== */139140// GetMethodID(setTextContents)141FIND_METHOD(setTextContentsMethod, bridgeClass,142"setTextContents",143"(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Z");144145// GetMethodID(getParentWithRole)146FIND_METHOD(getParentWithRoleMethod, bridgeClass,147"getParentWithRole",148"(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Ljavax/accessibility/AccessibleContext;");149150// GetMethodID(getTopLevelObject)151FIND_METHOD(getTopLevelObjectMethod, bridgeClass,152"getTopLevelObject",153"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");154155// GetMethodID(getParentWithRoleElseRoot)156FIND_METHOD(getParentWithRoleElseRootMethod, bridgeClass,157"getParentWithRoleElseRoot",158"(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Ljavax/accessibility/AccessibleContext;");159160// GetMethodID(getObjectDepth)161FIND_METHOD(getObjectDepthMethod, bridgeClass,162"getObjectDepth",163"(Ljavax/accessibility/AccessibleContext;)I");164165// GetMethodID(getActiveDescendent)166FIND_METHOD(getActiveDescendentMethod, bridgeClass,167"getActiveDescendent",168"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");169170// ------- AccessibleContext methods171172// GetMethodID(getAccessibleContextAt)173FIND_METHOD(getAccessibleContextAtMethod, bridgeClass,174"getAccessibleContextAt",175"(IILjavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");176177// GetMethodID(getAccessibleContextWithFocus)178FIND_METHOD(getAccessibleContextWithFocusMethod, bridgeClass,179"getAccessibleContextWithFocus",180"()Ljavax/accessibility/AccessibleContext;");181182// GetMethodID(getAccessibleNameFromContext)183FIND_METHOD(getAccessibleNameFromContextMethod, bridgeClass,184"getAccessibleNameFromContext",185"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");186187// GetMethodID(getAccessibleDescriptionFromContext)188FIND_METHOD(getAccessibleDescriptionFromContextMethod, bridgeClass,189"getAccessibleDescriptionFromContext",190"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");191192// GetMethodID(getAccessibleRoleStringFromContext)193FIND_METHOD(getAccessibleRoleStringFromContextMethod, bridgeClass,194"getAccessibleRoleStringFromContext",195"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");196197// GetMethodID(getAccessibleRoleStringFromContext_en_US)198FIND_METHOD(getAccessibleRoleStringFromContext_en_USMethod, bridgeClass,199"getAccessibleRoleStringFromContext_en_US",200"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");201202// GetMethodID(getAccessibleStatesStringFromContext)203FIND_METHOD(getAccessibleStatesStringFromContextMethod, bridgeClass,204"getAccessibleStatesStringFromContext",205"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");206207// GetMethodID(getAccessibleStatesStringFromContext_en_US)208FIND_METHOD(getAccessibleStatesStringFromContext_en_USMethod, bridgeClass,209"getAccessibleStatesStringFromContext_en_US",210"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");211212// GetMethodID(getAccessibleParentFromContext)213FIND_METHOD(getAccessibleParentFromContextMethod, bridgeClass,214"getAccessibleParentFromContext",215"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");216217// GetMethodID(getAccessibleIndexInParentFromContext)218FIND_METHOD(getAccessibleIndexInParentFromContextMethod, bridgeClass,219"getAccessibleIndexInParentFromContext",220"(Ljavax/accessibility/AccessibleContext;)I");221222// GetMethodID(getAccessibleChildrenCountFromContext)223FIND_METHOD(getAccessibleChildrenCountFromContextMethod, bridgeClass,224"getAccessibleChildrenCountFromContext",225"(Ljavax/accessibility/AccessibleContext;)I");226227// GetMethodID(getAccessibleChildFromContext)228FIND_METHOD(getAccessibleChildFromContextMethod, bridgeClass,229"getAccessibleChildFromContext",230"(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;");231232// GetMethodID(getAccessibleBoundsOnScreenFromContext)233FIND_METHOD(getAccessibleBoundsOnScreenFromContextMethod, bridgeClass,234"getAccessibleBoundsOnScreenFromContext",235"(Ljavax/accessibility/AccessibleContext;)Ljava/awt/Rectangle;");236237// GetMethodID(getAccessibleXcoordFromContext)238FIND_METHOD(getAccessibleXcoordFromContextMethod, bridgeClass,239"getAccessibleXcoordFromContext",240"(Ljavax/accessibility/AccessibleContext;)I");241242// GetMethodID(getAccessibleYcoordFromContext)243FIND_METHOD(getAccessibleYcoordFromContextMethod, bridgeClass,244"getAccessibleYcoordFromContext",245"(Ljavax/accessibility/AccessibleContext;)I");246247// GetMethodID(getAccessibleHeightFromContext)248FIND_METHOD(getAccessibleHeightFromContextMethod, bridgeClass,249"getAccessibleHeightFromContext",250"(Ljavax/accessibility/AccessibleContext;)I");251252// GetMethodID(getAccessibleWidthFromContext)253FIND_METHOD(getAccessibleWidthFromContextMethod, bridgeClass,254"getAccessibleWidthFromContext",255"(Ljavax/accessibility/AccessibleContext;)I");256257// GetMethodID(getAccessibleComponentFromContext)258FIND_METHOD(getAccessibleComponentFromContextMethod, bridgeClass,259"getAccessibleComponentFromContext",260"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleComponent;");261262// GetMethodID(getAccessibleActionFromContext)263FIND_METHOD(getAccessibleActionFromContextMethod, bridgeClass,264"getAccessibleActionFromContext",265"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleAction;");266267// GetMethodID(getAccessibleSelectionFromContext)268FIND_METHOD(getAccessibleSelectionFromContextMethod, bridgeClass,269"getAccessibleSelectionFromContext",270"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleSelection;");271272// GetMethodID(getAccessibleTextFromContext)273FIND_METHOD(getAccessibleTextFromContextMethod, bridgeClass,274"getAccessibleTextFromContext",275"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleText;");276277// GetMethodID(getAccessibleValueFromContext)278FIND_METHOD(getAccessibleValueFromContextMethod, bridgeClass,279"getAccessibleValueFromContext",280"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleValue;");281282283// ------- begin AccessibleTable methods284285// GetMethodID(getAccessibleTableFromContext)286FIND_METHOD(getAccessibleTableFromContextMethod, bridgeClass,287"getAccessibleTableFromContext",288"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;");289290// GetMethodID(getContextFromAccessibleTable)291FIND_METHOD(getContextFromAccessibleTableMethod, bridgeClass,292"getContextFromAccessibleTable",293"(Ljavax/accessibility/AccessibleTable;)Ljavax/accessibility/AccessibleContext;");294295// GetMethodID(getAccessibleTableRowHeader)296FIND_METHOD(getAccessibleTableRowHeaderMethod, bridgeClass,297"getAccessibleTableRowHeader",298"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;");299300301// GetMethodID(getAccessibleTableColumnHeader)302FIND_METHOD(getAccessibleTableColumnHeaderMethod, bridgeClass,303"getAccessibleTableColumnHeader",304"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;");305306307// GetMethodID(getAccessibleTableRowCount)308FIND_METHOD(getAccessibleTableRowCountMethod, bridgeClass,309"getAccessibleTableRowCount",310"(Ljavax/accessibility/AccessibleContext;)I");311312// GetMethodID(getAccessibleTableColumnCount)313FIND_METHOD(getAccessibleTableColumnCountMethod, bridgeClass,314"getAccessibleTableColumnCount",315"(Ljavax/accessibility/AccessibleContext;)I");316317// GetMethodID(getAccessibleTableCellAccessibleContext)318FIND_METHOD(getAccessibleTableCellAccessibleContextMethod, bridgeClass,319"getAccessibleTableCellAccessibleContext",320"(Ljavax/accessibility/AccessibleTable;II)Ljavax/accessibility/AccessibleContext;");321322// GetMethodID(getAccessibleTableCellIndex)323FIND_METHOD(getAccessibleTableCellIndexMethod, bridgeClass,324"getAccessibleTableCellIndex",325"(Ljavax/accessibility/AccessibleTable;II)I");326327// GetMethodID(getAccessibleTableCellRowExtent)328FIND_METHOD(getAccessibleTableCellRowExtentMethod, bridgeClass,329"getAccessibleTableCellRowExtent",330"(Ljavax/accessibility/AccessibleTable;II)I");331332// GetMethodID(getAccessibleTableCellColumnExtent)333FIND_METHOD(getAccessibleTableCellColumnExtentMethod, bridgeClass,334"getAccessibleTableCellColumnExtent",335"(Ljavax/accessibility/AccessibleTable;II)I");336337// GetMethodID(isAccessibleTableCellSelected)338FIND_METHOD(isAccessibleTableCellSelectedMethod, bridgeClass,339"isAccessibleTableCellSelected",340"(Ljavax/accessibility/AccessibleTable;II)Z");341342// GetMethodID(getAccessibleTableRowHeaderRowCount)343FIND_METHOD(getAccessibleTableRowHeaderRowCountMethod, bridgeClass,344"getAccessibleTableRowHeaderRowCount",345"(Ljavax/accessibility/AccessibleContext;)I");346347// GetMethodID(getAccessibleTableColumnHeaderRowCount)348FIND_METHOD(getAccessibleTableColumnHeaderRowCountMethod, bridgeClass,349"getAccessibleTableColumnHeaderRowCount",350"(Ljavax/accessibility/AccessibleContext;)I");351352// GetMethodID(getAccessibleTableRowHeaderColumnCount)353FIND_METHOD(getAccessibleTableRowHeaderColumnCountMethod, bridgeClass,354"getAccessibleTableRowHeaderColumnCount",355"(Ljavax/accessibility/AccessibleContext;)I");356357// GetMethodID(getAccessibleTableColumnHeaderColumnCount)358FIND_METHOD(getAccessibleTableColumnHeaderColumnCountMethod, bridgeClass,359"getAccessibleTableColumnHeaderColumnCount",360"(Ljavax/accessibility/AccessibleContext;)I");361362// GetMethodID(getAccessibleTableRowDescription)363FIND_METHOD(getAccessibleTableRowDescriptionMethod, bridgeClass,364"getAccessibleTableRowDescription",365"(Ljavax/accessibility/AccessibleTable;I)Ljavax/accessibility/AccessibleContext;");366367// GetMethodID(getAccessibleTableColumnDescription)368FIND_METHOD(getAccessibleTableColumnDescriptionMethod, bridgeClass,369"getAccessibleTableColumnDescription",370"(Ljavax/accessibility/AccessibleTable;I)Ljavax/accessibility/AccessibleContext;");371372// GetMethodID(getAccessibleTableRowSelectionCount)373FIND_METHOD(getAccessibleTableRowSelectionCountMethod, bridgeClass,374"getAccessibleTableRowSelectionCount",375"(Ljavax/accessibility/AccessibleTable;)I");376377// GetMethodID(isAccessibleTableRowSelected)378FIND_METHOD(isAccessibleTableRowSelectedMethod, bridgeClass,379"isAccessibleTableRowSelected",380"(Ljavax/accessibility/AccessibleTable;I)Z");381382// GetMethodID(getAccessibleTableRowSelections)383FIND_METHOD(getAccessibleTableRowSelectionsMethod, bridgeClass,384"getAccessibleTableRowSelections",385"(Ljavax/accessibility/AccessibleTable;I)I");386387// GetMethodID(getAccessibleTableColumnSelectionCount)388FIND_METHOD(getAccessibleTableColumnSelectionCountMethod, bridgeClass,389"getAccessibleTableColumnSelectionCount",390"(Ljavax/accessibility/AccessibleTable;)I");391392// GetMethodID(isAccessibleTableColumnSelected)393FIND_METHOD(isAccessibleTableColumnSelectedMethod, bridgeClass,394"isAccessibleTableColumnSelected",395"(Ljavax/accessibility/AccessibleTable;I)Z");396397// GetMethodID(getAccessibleTableColumnSelections)398FIND_METHOD(getAccessibleTableColumnSelectionsMethod, bridgeClass,399"getAccessibleTableColumnSelections",400"(Ljavax/accessibility/AccessibleTable;I)I");401402// GetMethodID(getAccessibleTableRow)403FIND_METHOD(getAccessibleTableRowMethod, bridgeClass,404"getAccessibleTableRow",405"(Ljavax/accessibility/AccessibleTable;I)I");406407// GetMethodID(getAccessibleTableColumn)408FIND_METHOD(getAccessibleTableColumnMethod, bridgeClass,409"getAccessibleTableColumn",410"(Ljavax/accessibility/AccessibleTable;I)I");411412// GetMethodID(getAccessibleTableIndex)413FIND_METHOD(getAccessibleTableIndexMethod, bridgeClass,414"getAccessibleTableIndex",415"(Ljavax/accessibility/AccessibleTable;II)I");416417/* ------- end AccessibleTable methods */418419/* start AccessibleRelationSet methods ----- */420421// GetMethodID(getAccessibleRelationCount)422FIND_METHOD(getAccessibleRelationCountMethod, bridgeClass,423"getAccessibleRelationCount",424"(Ljavax/accessibility/AccessibleContext;)I");425426// GetMethodID(getAccessibleRelationKey)427FIND_METHOD(getAccessibleRelationKeyMethod, bridgeClass,428"getAccessibleRelationKey",429"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");430431// GetMethodID(getAccessibleRelationTargetCount)432FIND_METHOD(getAccessibleRelationTargetCountMethod, bridgeClass,433"getAccessibleRelationTargetCount",434"(Ljavax/accessibility/AccessibleContext;I)I");435436// GetMethodID(getAccessibleRelationTarget)437FIND_METHOD(getAccessibleRelationTargetMethod, bridgeClass,438"getAccessibleRelationTarget",439"(Ljavax/accessibility/AccessibleContext;II)Ljavax/accessibility/AccessibleContext;");440441442// ------- AccessibleHypertext methods443444// GetMethodID(getAccessibleHypertext)445FIND_METHOD(getAccessibleHypertextMethod, bridgeClass,446"getAccessibleHypertext",447"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleHypertext;");448449// GetMethodID(activateAccessibleHyperlink)450FIND_METHOD(activateAccessibleHyperlinkMethod, bridgeClass,451"activateAccessibleHyperlink",452"(Ljavax/accessibility/AccessibleContext;Ljavax/accessibility/AccessibleHyperlink;)Z");453454// GetMethodID(getAccessibleHyperlinkCount)455FIND_METHOD(getAccessibleHyperlinkCountMethod, bridgeClass,456"getAccessibleHyperlinkCount",457"(Ljavax/accessibility/AccessibleContext;)I");458459// GetMethodID(getAccessibleHyperlink)460FIND_METHOD(getAccessibleHyperlinkMethod, bridgeClass,461"getAccessibleHyperlink",462"(Ljavax/accessibility/AccessibleHypertext;I)Ljavax/accessibility/AccessibleHyperlink;");463464// GetMethodID(getAccessibleHyperlinkText)465FIND_METHOD(getAccessibleHyperlinkTextMethod, bridgeClass,466"getAccessibleHyperlinkText",467"(Ljavax/accessibility/AccessibleHyperlink;)Ljava/lang/String;");468469// GetMethodID(getAccessibleHyperlinkURL)470FIND_METHOD(getAccessibleHyperlinkURLMethod, bridgeClass,471"getAccessibleHyperlinkURL",472"(Ljavax/accessibility/AccessibleHyperlink;)Ljava/lang/String;");473474// GetMethodID(getAccessibleHyperlinkStartIndex)475FIND_METHOD(getAccessibleHyperlinkStartIndexMethod, bridgeClass,476"getAccessibleHyperlinkStartIndex",477"(Ljavax/accessibility/AccessibleHyperlink;)I");478479// GetMethodID(getAccessibleHyperlinkEndIndex)480FIND_METHOD(getAccessibleHyperlinkEndIndexMethod, bridgeClass,481"getAccessibleHyperlinkEndIndex",482"(Ljavax/accessibility/AccessibleHyperlink;)I");483484// GetMethodID(getAccessibleHypertextLinkIndex)485FIND_METHOD(getAccessibleHypertextLinkIndexMethod, bridgeClass,486"getAccessibleHypertextLinkIndex",487"(Ljavax/accessibility/AccessibleHypertext;I)I");488489// Accessible KeyBinding, Icon and Action ====================490491// GetMethodID(getAccessibleKeyBindingsCount)492FIND_METHOD(getAccessibleKeyBindingsCountMethod, bridgeClass,493"getAccessibleKeyBindingsCount",494"(Ljavax/accessibility/AccessibleContext;)I");495496// GetMethodID(getAccessibleKeyBindingChar)497FIND_METHOD(getAccessibleKeyBindingCharMethod, bridgeClass,498"getAccessibleKeyBindingChar",499"(Ljavax/accessibility/AccessibleContext;I)C");500501// GetMethodID(getAccessibleKeyBindingModifiers)502FIND_METHOD(getAccessibleKeyBindingModifiersMethod, bridgeClass,503"getAccessibleKeyBindingModifiers",504"(Ljavax/accessibility/AccessibleContext;I)I");505506// GetMethodID(getAccessibleIconsCount)507FIND_METHOD(getAccessibleIconsCountMethod, bridgeClass,508"getAccessibleIconsCount",509"(Ljavax/accessibility/AccessibleContext;)I");510511// GetMethodID(getAccessibleIconDescription)512FIND_METHOD(getAccessibleIconDescriptionMethod, bridgeClass,513"getAccessibleIconDescription",514"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");515516// GetMethodID(getAccessibleIconHeight)517FIND_METHOD(getAccessibleIconHeightMethod, bridgeClass,518"getAccessibleIconHeight",519"(Ljavax/accessibility/AccessibleContext;I)I");520521// GetMethodID(getAccessibleIconWidth)522FIND_METHOD(getAccessibleIconWidthMethod, bridgeClass,523"getAccessibleIconWidth",524"(Ljavax/accessibility/AccessibleContext;I)I");525526// GetMethodID(getAccessibleActionsCount)527FIND_METHOD(getAccessibleActionsCountMethod, bridgeClass,528"getAccessibleActionsCount",529"(Ljavax/accessibility/AccessibleContext;)I");530531// GetMethodID(getAccessibleActionName)532FIND_METHOD(getAccessibleActionNameMethod, bridgeClass,533"getAccessibleActionName",534"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");535536// GetMethodID(doAccessibleActions)537FIND_METHOD(doAccessibleActionsMethod, bridgeClass,538"doAccessibleActions",539"(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Z");540541// ------- AccessibleText methods542543// GetMethodID(getAccessibleCharCountFromContext)544FIND_METHOD(getAccessibleCharCountFromContextMethod, bridgeClass,545"getAccessibleCharCountFromContext",546"(Ljavax/accessibility/AccessibleContext;)I");547548// GetMethodID(getAccessibleCaretPositionFromContext)549FIND_METHOD(getAccessibleCaretPositionFromContextMethod, bridgeClass,550"getAccessibleCaretPositionFromContext",551"(Ljavax/accessibility/AccessibleContext;)I");552553// GetMethodID(getAccessibleIndexAtPointFromContext)554FIND_METHOD(getAccessibleIndexAtPointFromContextMethod, bridgeClass,555"getAccessibleIndexAtPointFromContext",556"(Ljavax/accessibility/AccessibleContext;II)I");557558// GetMethodID(getAccessibleLetterAtIndexFromContext)559FIND_METHOD(getAccessibleLetterAtIndexFromContextMethod, bridgeClass,560"getAccessibleLetterAtIndexFromContext",561"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");562563// GetMethodID(getAccessibleWordAtIndexFromContext)564FIND_METHOD(getAccessibleWordAtIndexFromContextMethod, bridgeClass,565"getAccessibleWordAtIndexFromContext",566"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");567568// GetMethodID(getAccessibleSentenceAtIndexFromContext)569FIND_METHOD(getAccessibleSentenceAtIndexFromContextMethod, bridgeClass,570"getAccessibleSentenceAtIndexFromContext",571"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");572573// GetMethodID(getAccessibleTextSelectionStartFromContext)574FIND_METHOD(getAccessibleTextSelectionStartFromContextMethod, bridgeClass,575"getAccessibleTextSelectionStartFromContext",576"(Ljavax/accessibility/AccessibleContext;)I");577578// GetMethodID(getAccessibleTextSelectionEndFromContext)579FIND_METHOD(getAccessibleTextSelectionEndFromContextMethod, bridgeClass,580"getAccessibleTextSelectionEndFromContext",581"(Ljavax/accessibility/AccessibleContext;)I");582583// GetMethodID(getAccessibleTextSelectedTextFromContext)584FIND_METHOD(getAccessibleTextSelectedTextFromContextMethod, bridgeClass,585"getAccessibleTextSelectedTextFromContext",586"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");587588// GetMethodID(getAccessibleAttributesAtIndexFromContext)589FIND_METHOD(getAccessibleAttributesAtIndexFromContextMethod, bridgeClass,590"getAccessibleAttributesAtIndexFromContext",591"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");592593// GetMethodID(getAccessibleAttributeSetAtIndexFromContext)594FIND_METHOD(getAccessibleAttributeSetAtIndexFromContextMethod, bridgeClass,595"getAccessibleAttributeSetAtIndexFromContext",596"(Ljavax/accessibility/AccessibleContext;I)Ljavax/swing/text/AttributeSet;");597598// GetMethodID(getAccessibleTextRectAtIndexFromContext)599FIND_METHOD(getAccessibleTextRectAtIndexFromContextMethod, bridgeClass,600"getAccessibleTextRectAtIndexFromContext",601"(Ljavax/accessibility/AccessibleContext;I)Ljava/awt/Rectangle;");602603// GetMethodID(getAccessibleXcoordTextRectAtIndexFromContext)604FIND_METHOD(getAccessibleXcoordTextRectAtIndexFromContextMethod, bridgeClass,605"getAccessibleXcoordTextRectAtIndexFromContext",606"(Ljavax/accessibility/AccessibleContext;I)I");607608// GetMethodID(getAccessibleYcoordTextRectAtIndexFromContext)609FIND_METHOD(getAccessibleYcoordTextRectAtIndexFromContextMethod, bridgeClass,610"getAccessibleYcoordTextRectAtIndexFromContext",611"(Ljavax/accessibility/AccessibleContext;I)I");612613// GetMethodID(getAccessibleHeightTextRectAtIndexFromContext)614FIND_METHOD(getAccessibleHeightTextRectAtIndexFromContextMethod, bridgeClass,615"getAccessibleHeightTextRectAtIndexFromContext",616"(Ljavax/accessibility/AccessibleContext;I)I");617618// GetMethodID(getAccessibleWidthTextRectAtIndexFromContext)619FIND_METHOD(getAccessibleWidthTextRectAtIndexFromContextMethod, bridgeClass,620"getAccessibleWidthTextRectAtIndexFromContext",621"(Ljavax/accessibility/AccessibleContext;I)I");622623// GetMethodID(getCaretLocationX)624FIND_METHOD(getCaretLocationXMethod, bridgeClass,625"getCaretLocationX",626"(Ljavax/accessibility/AccessibleContext;)I");627628// GetMethodID(getCaretLocationY)629FIND_METHOD(getCaretLocationYMethod, bridgeClass,630"getCaretLocationY",631"(Ljavax/accessibility/AccessibleContext;)I");632633// GetMethodID(getCaretLocationHeight)634FIND_METHOD(getCaretLocationHeightMethod, bridgeClass,635"getCaretLocationHeight",636"(Ljavax/accessibility/AccessibleContext;)I");637638// GetMethodID(getCaretLocationWidth)639FIND_METHOD(getCaretLocationWidthMethod, bridgeClass,640"getCaretLocationWidth",641"(Ljavax/accessibility/AccessibleContext;)I");642643644// GetMethodID(getAccessibleTextLineLeftBoundsFromContextMethod)645FIND_METHOD(getAccessibleTextLineLeftBoundsFromContextMethod, bridgeClass,646"getAccessibleTextLineLeftBoundsFromContext",647"(Ljavax/accessibility/AccessibleContext;I)I");648649// GetMethodID(getAccessibleTextLineRightBoundsFromContextMethod)650FIND_METHOD(getAccessibleTextLineRightBoundsFromContextMethod, bridgeClass,651"getAccessibleTextLineRightBoundsFromContext",652"(Ljavax/accessibility/AccessibleContext;I)I");653654// GetMethodID(getAccessibleTextRangeFromContextMethod)655FIND_METHOD(getAccessibleTextRangeFromContextMethod, bridgeClass,656"getAccessibleTextRangeFromContext",657"(Ljavax/accessibility/AccessibleContext;II)Ljava/lang/String;");658659660// ------- AccessibleValue methods661662// GetMethodID(getCurrentAccessibleValueFromContext)663FIND_METHOD(getCurrentAccessibleValueFromContextMethod, bridgeClass,664"getCurrentAccessibleValueFromContext",665"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");666667// GetMethodID(getMaximumAccessibleValueFromContext)668FIND_METHOD(getMaximumAccessibleValueFromContextMethod, bridgeClass,669"getMaximumAccessibleValueFromContext",670"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");671672// GetMethodID(getMinimumAccessibleValueFromContext)673FIND_METHOD(getMinimumAccessibleValueFromContextMethod, bridgeClass,674"getMinimumAccessibleValueFromContext",675"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");676677678// ------- AccessibleSelection methods679680// GetMethodID(addAccessibleSelectionFromContext)681FIND_METHOD(addAccessibleSelectionFromContextMethod, bridgeClass,682"addAccessibleSelectionFromContext",683"(Ljavax/accessibility/AccessibleContext;I)V");684685// GetMethodID(clearAccessibleSelectionFromContext)686FIND_METHOD(clearAccessibleSelectionFromContextMethod, bridgeClass,687"clearAccessibleSelectionFromContext",688"(Ljavax/accessibility/AccessibleContext;)V");689690// GetMethodID(getAccessibleSelectionFromContext)691FIND_METHOD(getAccessibleSelectionContextFromContextMethod, bridgeClass,692"getAccessibleSelectionFromContext",693"(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;");694695// GetMethodID(getAccessibleSelectionCountFromContext)696FIND_METHOD(getAccessibleSelectionCountFromContextMethod, bridgeClass,697"getAccessibleSelectionCountFromContext",698"(Ljavax/accessibility/AccessibleContext;)I");699700// GetMethodID(isAccessibleChildSelectedFromContext)701FIND_METHOD(isAccessibleChildSelectedFromContextMethod, bridgeClass,702"isAccessibleChildSelectedFromContext",703"(Ljavax/accessibility/AccessibleContext;I)Z");704705// GetMethodID(removeAccessibleSelectionFromContext)706FIND_METHOD(removeAccessibleSelectionFromContextMethod, bridgeClass,707"removeAccessibleSelectionFromContext",708"(Ljavax/accessibility/AccessibleContext;I)V");709710// GetMethodID(selectAllAccessibleSelectionFromContext)711FIND_METHOD(selectAllAccessibleSelectionFromContextMethod, bridgeClass,712"selectAllAccessibleSelectionFromContext",713"(Ljavax/accessibility/AccessibleContext;)V");714715716// ------- Event Notification methods717718// GetMethodID(addJavaEventNotification)719FIND_METHOD(addJavaEventNotificationMethod, bridgeClass,720"addJavaEventNotification", "(J)V");721722// GetMethodID(removeJavaEventNotification)723FIND_METHOD(removeJavaEventNotificationMethod, bridgeClass,724"removeJavaEventNotification", "(J)V");725726// GetMethodID(addAccessibilityEventNotification)727FIND_METHOD(addAccessibilityEventNotificationMethod, bridgeClass,728"addAccessibilityEventNotification", "(J)V");729730// GetMethodID(removeAccessibilityEventNotification)731FIND_METHOD(removeAccessibilityEventNotificationMethod, bridgeClass,732"removeAccessibilityEventNotification", "(J)V");733734735// ------- AttributeSet methods736737// GetMethodID(getBoldFromAttributeSet)738FIND_METHOD(getBoldFromAttributeSetMethod, bridgeClass,739"getBoldFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");740741// GetMethodID(getItalicFromAttributeSet)742FIND_METHOD(getItalicFromAttributeSetMethod, bridgeClass,743"getItalicFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");744745// GetMethodID(getUnderlineFromAttributeSet)746FIND_METHOD(getUnderlineFromAttributeSetMethod, bridgeClass,747"getUnderlineFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");748749// GetMethodID(getStrikethroughFromAttributeSet)750FIND_METHOD(getStrikethroughFromAttributeSetMethod, bridgeClass,751"getStrikethroughFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");752753// GetMethodID(getSuperscriptFromAttributeSet)754FIND_METHOD(getSuperscriptFromAttributeSetMethod, bridgeClass,755"getSuperscriptFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");756757// GetMethodID(getSubscriptFromAttributeSet)758FIND_METHOD(getSubscriptFromAttributeSetMethod, bridgeClass,759"getSubscriptFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");760761// GetMethodID(getBackgroundColorFromAttributeSet)762FIND_METHOD(getBackgroundColorFromAttributeSetMethod, bridgeClass,763"getBackgroundColorFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;");764765// GetMethodID(getForegroundColorFromAttributeSet)766FIND_METHOD(getForegroundColorFromAttributeSetMethod, bridgeClass,767"getForegroundColorFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;");768769// GetMethodID(getFontFamilyFromAttributeSet)770FIND_METHOD(getFontFamilyFromAttributeSetMethod, bridgeClass,771"getFontFamilyFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;");772773// GetMethodID(getFontSizeFromAttributeSet)774FIND_METHOD(getFontSizeFromAttributeSetMethod, bridgeClass,775"getFontSizeFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I");776777// GetMethodID(getAlignmentFromAttributeSet)778FIND_METHOD(getAlignmentFromAttributeSetMethod, bridgeClass,779"getAlignmentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I");780781// GetMethodID(getBidiLevelFromAttributeSet)782FIND_METHOD(getBidiLevelFromAttributeSetMethod, bridgeClass,783"getBidiLevelFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I");784785// GetMethodID(getFirstLineIndentFromAttributeSet)786FIND_METHOD(getFirstLineIndentFromAttributeSetMethod, bridgeClass,787"getFirstLineIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");788789// GetMethodID(getLeftIndentFromAttributeSet)790FIND_METHOD(getLeftIndentFromAttributeSetMethod, bridgeClass,791"getLeftIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");792793// GetMethodID(getRightIndentFromAttributeSet)794FIND_METHOD(getRightIndentFromAttributeSetMethod, bridgeClass,795"getRightIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");796797// GetMethodID(getLineSpacingFromAttributeSet)798FIND_METHOD(getLineSpacingFromAttributeSetMethod, bridgeClass,799"getLineSpacingFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");800801// GetMethodID(getSpaceAboveFromAttributeSet)802FIND_METHOD(getSpaceAboveFromAttributeSetMethod, bridgeClass,803"getSpaceAboveFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");804805// GetMethodID(getSpaceBelowFromAttributeSet)806FIND_METHOD(getSpaceBelowFromAttributeSetMethod, bridgeClass,807"getSpaceBelowFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");808809810/**811* Additional methods for Teton812*/813814// GetMethodID(requestFocus)815FIND_METHOD(requestFocusMethod, bridgeClass,816"requestFocus",817"(Ljavax/accessibility/AccessibleContext;)Z");818819// GetMethodID(selectTextRange)820FIND_METHOD(selectTextRangeMethod, bridgeClass,821"selectTextRange",822"(Ljavax/accessibility/AccessibleContext;II)Z");823824// GetMethodID(getVisibleChildrenCount)825FIND_METHOD(getVisibleChildrenCountMethod, bridgeClass,826"getVisibleChildrenCount",827"(Ljavax/accessibility/AccessibleContext;)I");828829// GetMethodID(getVisibleChild)830FIND_METHOD(getVisibleChildMethod, bridgeClass,831"getVisibleChild",832"(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;");833834// GetMethodID(setCaretPosition)835FIND_METHOD(setCaretPositionMethod, bridgeClass,836"setCaretPosition",837"(Ljavax/accessibility/AccessibleContext;I)Z");838839// GetMethodID(getVirtualAccessibleNameFromContextMethod) Ben Key840FIND_METHOD(getVirtualAccessibleNameFromContextMethod, bridgeClass,841"getVirtualAccessibleNameFromContext",842"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");843844return TRUE;845}846847// Note for the following code which makes JNI upcalls...848//849// Problem, bug DB 16818166, JBS DB JDK-8015400850// AccessibleContext is a JOBJECT64 which is a jobject (32 bit pointer)851// for a Legacy (XP) build and a jlong (64 bits) for a -32 or -64 build.852// For the -32 build the lower 32 bits needs to be extracted into a jobject.853// Otherwise, if AccessibleContext is used directly what happens is that854// the JNI code consumes the lower 32 of its 64 bits and that is not a855// problem, but then when the JNI code consumes the next 32 bits for the856// reference to the role String it gets the higher 0x00000000 bits from857// the 64 bit JOBJECT64 AccessibleContext variable and thus a null reference858// is passed as the String reference.859//860// Solution:861// Cast the JOBJECT64 to a jobject. For a 64 bit compile this is basically862// a noop, i.e. JOBJECT64 is a 64 bit jlong and a jobject is a 64 bit reference.863// For a 32 bit compile the cast drops the high order 32 bits, i.e. JOBJECT64864// is a 64 bit jlong and jobject is a 32 bit reference. For a Legacy build865// JOBJECT64 is a jobject so this is also basically a noop. The casts are866// done in the methods in JavaAccessBridge::processPackage.867868// -----------------------------------869870/**871* isJavaWindow - returns whether the HWND is a Java window or not872*873*/874BOOL875AccessBridgeJavaEntryPoints::isJavaWindow(jint window) {876jthrowable exception;877BOOL returnVal;878879PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::isJavaWindow(%X):", window);880881if (isJavaWindowMethod != (jmethodID) 0) {882returnVal = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, isJavaWindowMethod, window);883EXCEPTION_CHECK("Getting isJavaWindow - call to CallBooleanMethod()", FALSE);884return returnVal;885} else {886PrintDebugString("[ERROR]: either jniEnv == 0 or isJavaWindowMethod == 0");887return FALSE;888}889}890891// -----------------------------------892893/**894* isSameObject - returns whether two object reference refer to the same object895*896*/897BOOL898AccessBridgeJavaEntryPoints::isSameObject(jobject obj1, jobject obj2) {899jthrowable exception;900BOOL returnVal;901902PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::isSameObject(%p %p):", obj1, obj2);903904returnVal = (BOOL) jniEnv->IsSameObject((jobject)obj1, (jobject)obj2);905EXCEPTION_CHECK("Calling IsSameObject", FALSE);906907PrintDebugString("[INFO]: isSameObject returning %d", returnVal);908return returnVal;909}910911// -----------------------------------912913/**914* getAccessibleContextFromHWND - returns the AccessibleContext, if any, for an HWND915*916*/917jobject918AccessBridgeJavaEntryPoints::getAccessibleContextFromHWND(jint window) {919jobject returnedAccessibleContext;920jobject globalRef;921jthrowable exception;922923PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getAccessibleContextFromHWND(%X):", window);924925if (getAccessibleContextFromHWNDMethod != (jmethodID) 0) {926returnedAccessibleContext =927(jobject)jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleContextFromHWNDMethod,928window);929EXCEPTION_CHECK("Getting AccessibleContextFromHWND - call to CallObjectMethod()", (jobject) 0);930globalRef = (jobject)jniEnv->NewGlobalRef((jobject)returnedAccessibleContext);931EXCEPTION_CHECK("Getting AccessibleContextFromHWND - call to CallObjectMethod()", (jobject) 0);932return globalRef;933} else {934PrintDebugString("[ERROR]: either jniEnv == 0 or getAccessibleContextFromHWNDMethod == 0");935return (jobject) 0;936}937}938939// -----------------------------------940941/**942* getHWNDFromAccessibleContext - returns the HWND for an AccessibleContext, if any943* returns (HWND)0 on error.944*/945HWND946AccessBridgeJavaEntryPoints::getHWNDFromAccessibleContext(jobject accessibleContext) {947jthrowable exception;948HWND rHWND;949950PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getHWNDFromAccessibleContext(%X):",951accessibleContext);952953if (getHWNDFromAccessibleContextMethod != (jmethodID) 0) {954rHWND = (HWND)jniEnv->CallIntMethod(accessBridgeObject, getHWNDFromAccessibleContextMethod,955accessibleContext);956EXCEPTION_CHECK("Getting HWNDFromAccessibleContext - call to CallIntMethod()", (HWND)0);957PrintDebugString("[INFO]: rHWND = %X", rHWND);958return rHWND;959} else {960PrintDebugString("[ERROR]: either jniEnv == 0 or getHWNDFromAccessibleContextMethod == 0");961return (HWND)0;962}963}964965966/* ====== Utility methods ===== */967968/**969* Sets a text field to the specified string. Returns whether successful;970*/971BOOL972AccessBridgeJavaEntryPoints::setTextContents(const jobject accessibleContext, const wchar_t *text) {973jthrowable exception;974BOOL result = FALSE;975976PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::setTextContents(%p, %ls):",977accessibleContext, text);978979if (setTextContentsMethod != (jmethodID) 0) {980981// create a Java String for the text982jstring textString = jniEnv->NewString(text, (jsize)wcslen(text));983if (textString == 0) {984PrintDebugString("[ERROR]: NewString failed");985return FALSE;986}987988result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject,989setTextContentsMethod,990accessibleContext, textString);991EXCEPTION_CHECK("setTextContents - call to CallBooleanMethod()", FALSE);992PrintDebugString("[INFO]: result = %d", result);993return result;994} else {995PrintDebugString("[ERROR]: either jniEnv == 0 or setTextContentsMethod == 0");996return result;997}998}9991000/**1001* Returns the Accessible Context of a Page Tab object that is the1002* ancestor of a given object. If the object is a Page Tab object1003* or a Page Tab ancestor object was found, returns the object1004* AccessibleContext.1005* If there is no ancestor object that has an Accessible Role of Page Tab,1006* returns (AccessibleContext)0.1007*/1008jobject1009AccessBridgeJavaEntryPoints::getParentWithRole(const jobject accessibleContext, const wchar_t *role) {1010jthrowable exception;1011jobject rAccessibleContext;10121013PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getParentWithRole(%p):",1014accessibleContext);10151016if (getParentWithRoleMethod != (jmethodID) 0) {1017// create a Java String for the role1018jstring roleName = jniEnv->NewString(role, (jsize)wcslen(role));1019if (roleName == 0) {1020PrintDebugString("[ERROR]: NewString failed");1021return FALSE;1022}10231024rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1025getParentWithRoleMethod,1026accessibleContext, roleName);1027EXCEPTION_CHECK("Getting ParentWithRole - call to CallObjectMethod()", (AccessibleContext)0);1028PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);1029jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);1030EXCEPTION_CHECK("Getting ParentWithRole - call to NewGlobalRef()", FALSE);1031PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1032rAccessibleContext, globalRef);1033return globalRef;1034} else {1035PrintDebugString("[ERROR]: either jniEnv == 0 or getParentWithRoleMethod == 0");1036return 0;1037}1038}10391040/**1041* Returns the Accessible Context for the top level object in1042* a Java Window. This is same Accessible Context that is obtained1043* from GetAccessibleContextFromHWND for that window. Returns1044* (AccessibleContext)0 on error.1045*/1046jobject1047AccessBridgeJavaEntryPoints::getTopLevelObject(const jobject accessibleContext) {1048jthrowable exception;1049jobject rAccessibleContext;10501051PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getTopLevelObject(%p):",1052accessibleContext);10531054if (getTopLevelObjectMethod != (jmethodID) 0) {1055rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1056getTopLevelObjectMethod,1057accessibleContext);1058EXCEPTION_CHECK("Getting TopLevelObject - call to CallObjectMethod()", FALSE);1059PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);1060jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);1061EXCEPTION_CHECK("Getting TopLevelObject - call to NewGlobalRef()", FALSE);1062PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1063rAccessibleContext, globalRef);1064return globalRef;1065} else {1066PrintDebugString("[ERROR]: either jniEnv == 0 or getTopLevelObjectMethod == 0");1067return 0;1068}1069}10701071/**1072* If there is an Ancestor object that has an Accessible Role of1073* Internal Frame, returns the Accessible Context of the Internal1074* Frame object. Otherwise, returns the top level object for that1075* Java Window. Returns (AccessibleContext)0 on error.1076*/1077jobject1078AccessBridgeJavaEntryPoints::getParentWithRoleElseRoot(const jobject accessibleContext, const wchar_t *role) {1079jthrowable exception;1080jobject rAccessibleContext;10811082PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getParentWithRoleElseRoot(%p):",1083accessibleContext);10841085if (getParentWithRoleElseRootMethod != (jmethodID) 0) {10861087// create a Java String for the role1088jstring roleName = jniEnv->NewString(role, (jsize)wcslen(role));1089if (roleName == 0) {1090PrintDebugString("[ERROR]: NewString failed");1091return FALSE;1092}10931094rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1095getParentWithRoleElseRootMethod,1096accessibleContext, roleName);1097EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to CallObjectMethod()", (AccessibleContext)0);1098PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);1099jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);1100EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to NewGlobalRef()", FALSE);1101PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1102rAccessibleContext, globalRef);1103return globalRef;1104} else {1105PrintDebugString("[ERROR]: either jniEnv == 0 or getParentWithRoleElseRootMethod == 0");1106return 0;1107}1108}11091110/**1111* Returns how deep in the object hierarchy a given object is.1112* The top most object in the object hierarchy has an object depth of 0.1113* Returns -1 on error.1114*/1115jint1116AccessBridgeJavaEntryPoints::getObjectDepth(const jobject accessibleContext) {1117jthrowable exception;1118jint rResult;11191120PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getObjectDepth(%p):",1121accessibleContext);11221123if (getObjectDepthMethod != (jmethodID) 0) {1124rResult = jniEnv->CallIntMethod(accessBridgeObject,1125getObjectDepthMethod,1126accessibleContext);1127EXCEPTION_CHECK("Getting ObjectDepth - call to CallIntMethod()", -1);1128PrintDebugString("[INFO]: rResult = %d", rResult);1129return rResult;1130} else {1131PrintDebugString("[ERROR]: either jniEnv == 0 or getObjectDepthMethod == 0");1132return -1;1133}1134}1135113611371138/**1139* Returns the Accessible Context of the current ActiveDescendent of an object.1140* Returns 0 on error.1141*/1142jobject1143AccessBridgeJavaEntryPoints::getActiveDescendent(const jobject accessibleContext) {1144jthrowable exception;1145jobject rAccessibleContext;11461147PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getActiveDescendent(%p):",1148accessibleContext);11491150if (getActiveDescendentMethod != (jmethodID) 0) {1151rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1152getActiveDescendentMethod,1153accessibleContext);1154EXCEPTION_CHECK("Getting ActiveDescendent - call to CallObjectMethod()", (AccessibleContext)0);1155PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);1156jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);1157EXCEPTION_CHECK("Getting ActiveDescendant - call to NewGlobalRef()", FALSE);1158PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1159rAccessibleContext, globalRef);1160return globalRef;1161} else {1162PrintDebugString("[ERROR]: either jniEnv == 0 or getActiveDescendentMethod == 0");1163return (AccessibleContext)0;1164}1165}11661167/**1168* Additional methods for Teton1169*/11701171/**1172* Returns an AccessibleName for a component using an algorithm optimized1173* for the JAWS screen reader by Ben Key (Freedom Scientific). This method1174* is only intended for JAWS. All other uses are entirely optional.1175*1176* Bug ID 4916682 - Implement JAWS AccessibleName policy1177*/1178BOOL1179AccessBridgeJavaEntryPoints::getVirtualAccessibleName (1180IN const jobject object,1181OUT wchar_t * name,1182IN const int nameSize)1183{1184/*1185+1186Parameter validation1187+1188*/1189if ((name == 0) || (nameSize == 0))1190{1191return FALSE;1192}1193::memset (name, 0, nameSize * sizeof (wchar_t));1194if (0 == object)1195{1196return FALSE;1197}11981199jstring js = NULL;1200const wchar_t * stringBytes = NULL;1201jthrowable exception = NULL;1202jsize length = 0;1203PrintDebugString("[INFO]: getVirtualAccessibleName called.");1204if (getVirtualAccessibleNameFromContextMethod != (jmethodID) 0)1205{1206js = (jstring) jniEnv->CallObjectMethod (1207accessBridgeObject,1208getVirtualAccessibleNameFromContextMethod,1209object);1210EXCEPTION_CHECK("Getting AccessibleName - call to CallObjectMethod()", FALSE);1211if (js != (jstring) 0)1212{1213stringBytes = (const wchar_t *) jniEnv->GetStringChars (js, 0);1214EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE);1215wcsncpy(name, stringBytes, nameSize - 1);1216length = jniEnv->GetStringLength(js);1217EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE);1218jniEnv->ReleaseStringChars(js, stringBytes);1219EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE);1220jniEnv->CallVoidMethod (1221accessBridgeObject,1222decrementReferenceMethod, js);1223EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE);1224wPrintDebugString(L" Accessible Name = %ls", name);1225jniEnv->DeleteLocalRef(js);1226EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE);1227}1228else1229{1230PrintDebugString("[INFO]: Accessible Name is null.");1231}1232}1233else1234{1235PrintDebugString("[INFO]: either jniEnv == 0 or getVirtualAccessibleNameFromContextMethod == 0");1236return FALSE;1237}1238if ( 0 != name [0] )1239{1240return TRUE;1241}1242return FALSE;1243}124412451246/**1247* Request focus for a component. Returns whether successful;1248*1249* Bug ID 4944757 - requestFocus method needed1250*/1251BOOL1252AccessBridgeJavaEntryPoints::requestFocus(const jobject accessibleContext) {12531254jthrowable exception;1255BOOL result = FALSE;12561257PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::requestFocus(%p):",1258accessibleContext);12591260if (requestFocusMethod != (jmethodID) 0) {1261result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject,1262requestFocusMethod,1263accessibleContext);1264EXCEPTION_CHECK("requestFocus - call to CallBooleanMethod()", FALSE);1265PrintDebugString("[INFO]: result = %d", result);1266return result;1267} else {1268PrintDebugString("[ERROR]: either jniEnv == 0 or requestFocusMethod == 0");1269return result;1270}1271}12721273/**1274* Selects text between two indices. Selection includes the text at the start index1275* and the text at the end index. Returns whether successful;1276*1277* Bug ID 4944758 - selectTextRange method needed1278*/1279BOOL1280AccessBridgeJavaEntryPoints::selectTextRange(const jobject accessibleContext, int startIndex, int endIndex) {12811282jthrowable exception;1283BOOL result = FALSE;12841285PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::selectTextRange(%p start = %d end = %d):",1286accessibleContext, startIndex, endIndex);12871288if (selectTextRangeMethod != (jmethodID) 0) {1289result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject,1290selectTextRangeMethod,1291accessibleContext,1292startIndex, endIndex);1293EXCEPTION_CHECK("selectTextRange - call to CallBooleanMethod()", FALSE);1294PrintDebugString("[INFO]: result = %d", result);1295return result;1296} else {1297PrintDebugString("[ERROR]: either jniEnv == 0 or selectTextRangeMethod == 0");1298return result;1299}1300}13011302/*1303* Returns whether two text attributes are the same.1304*/1305static BOOL CompareAccessibleTextAttributesInfo(AccessibleTextAttributesInfo *one,1306AccessibleTextAttributesInfo *two) {1307return(one->bold == two->bold1308&& one->italic == two->italic1309&& one->underline == two->underline1310&& one->strikethrough == two->strikethrough1311&& one->superscript == two->superscript1312&& one->subscript == two->subscript1313&& one->fontSize == two->fontSize1314&& one->alignment == two->alignment1315&& one->bidiLevel == two->bidiLevel1316&& one->firstLineIndent == two->firstLineIndent1317&& one->leftIndent == two->leftIndent1318&& one->rightIndent == two->rightIndent1319&& one->lineSpacing == two->lineSpacing1320&& one->spaceAbove == two->spaceAbove1321&& one->spaceBelow == two->spaceBelow1322&& !wcscmp(one->backgroundColor,two->backgroundColor)1323&& !wcscmp(one->foregroundColor,two->foregroundColor)1324&& !wcscmp(one->fullAttributesString,two->fullAttributesString));1325}13261327/**1328* Get text attributes between two indices.1329*1330* Only one AccessibleTextAttributesInfo structure is passed - which1331* contains the attributes for the first character, the function then goes1332* through the following characters in the range specified and stops when the1333* attributes are different from the first, it then returns in the passed1334* parameter len the number of characters with the attributes returned. In most1335* situations this will be all the characters, and if not the calling program1336* can easily get the attributes for the next characters with different1337* attributes1338*1339* Bug ID 4944761 - getTextAttributes between two indices method needed1340*/13411342/* NEW FASTER CODE!!*/1343BOOL1344AccessBridgeJavaEntryPoints::getTextAttributesInRange(const jobject accessibleContext,1345int startIndex, int endIndex,1346AccessibleTextAttributesInfo *attributes, short *len) {13471348jstring js;1349const wchar_t *stringBytes;1350jthrowable exception;1351jsize length;1352BOOL result = FALSE;13531354PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getTextAttributesInRange(%p start = %d end = %d):",1355accessibleContext, startIndex, endIndex);13561357*len = 0;1358result = getAccessibleTextAttributes((jobject)accessibleContext, startIndex, attributes);1359if (result != TRUE) {1360return FALSE;1361}1362(*len)++;13631364for (jint i = startIndex+1; i <= endIndex; i++) {13651366AccessibleTextAttributesInfo test_attributes = *attributes;1367// Get the full test_attributes string at i1368if (getAccessibleAttributesAtIndexFromContextMethod != (jmethodID) 0) {1369PrintDebugString("[INFO]: Getting full test_attributes string from Context...");1370js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1371getAccessibleAttributesAtIndexFromContextMethod,1372accessibleContext, i);1373EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallObjectMethod()", FALSE);1374PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);1375if (js != (jstring) 0) {1376stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1377EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringChars()", FALSE);1378wcsncpy(test_attributes.fullAttributesString, stringBytes, (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t)));1379length = jniEnv->GetStringLength(js);1380test_attributes.fullAttributesString[length < (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t)) ?1381length : (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t))-2] = (wchar_t) 0;1382EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringLength()", FALSE);1383jniEnv->ReleaseStringChars(js, stringBytes);1384EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to ReleaseStringChars()", FALSE);1385jniEnv->CallVoidMethod(accessBridgeObject,1386decrementReferenceMethod, js);1387EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallVoidMethod()", FALSE);1388wPrintDebugString(L"[INFO]: Accessible Text attributes = %ls", test_attributes.fullAttributesString);1389jniEnv->DeleteLocalRef(js);1390EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE);1391} else {1392PrintDebugString("[WARN]: Accessible Text attributes is null.");1393test_attributes.fullAttributesString[0] = (wchar_t) 0;1394return FALSE;1395}1396} else {1397PrintDebugString("[ERROR]: either env == 0 or getAccessibleAttributesAtIndexFromContextMethod == 0");1398return FALSE;1399}14001401if(wcscmp(attributes->fullAttributesString,test_attributes.fullAttributesString))1402break;1403if (result != TRUE) {1404return FALSE;1405}1406(*len)++;1407}1408return TRUE;1409}14101411/*1412* Returns the number of visible children of a component1413*1414* Bug ID 4944762- getVisibleChildren for list-like components needed1415*/1416int1417AccessBridgeJavaEntryPoints::getVisibleChildrenCount(const jobject accessibleContext) {14181419jthrowable exception;1420PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getVisibleChildrenCount(%p)",1421accessibleContext);14221423// get the visible children count1424int numChildren = jniEnv->CallIntMethod(accessBridgeObject, getVisibleChildrenCountMethod,1425accessibleContext);1426EXCEPTION_CHECK("##### Getting visible children count - call to CallIntMethod()", FALSE);1427PrintDebugString("[INFO]: ##### visible children count = %d", numChildren);14281429return numChildren;1430}143114321433/*1434* This method is used to iterate through the visible children of a component. It1435* returns visible children information for a component starting at nStartIndex.1436* No more than MAX_VISIBLE_CHILDREN VisibleChildrenInfo objects will1437* be returned for each call to this method. Returns FALSE on error.1438*1439* Bug ID 4944762- getVisibleChildren for list-like components needed1440*/1441BOOL AccessBridgeJavaEntryPoints::getVisibleChildren(const jobject accessibleContext,1442const int nStartIndex,1443/* OUT */ VisibleChildrenInfo *visibleChildrenInfo) {14441445jthrowable exception;14461447PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getVisibleChildren(%p, startIndex = %d)",1448accessibleContext, nStartIndex);14491450// get the visible children count1451int numChildren = jniEnv->CallIntMethod(accessBridgeObject, getVisibleChildrenCountMethod,1452accessibleContext);1453EXCEPTION_CHECK("##### Getting visible children count - call to CallIntMethod()", FALSE);1454PrintDebugString("[INFO]: ##### visible children count = %d", numChildren);14551456if (nStartIndex >= numChildren) {1457return FALSE;1458}14591460// get the visible children1461int bufIndex = 0;1462for (int i = nStartIndex; (i < numChildren) && (i < nStartIndex + MAX_VISIBLE_CHILDREN); i++) {1463PrintDebugString("[INFO]: getting visible child %d ...", i);14641465// get the visible child at index i1466jobject ac = jniEnv->CallObjectMethod(accessBridgeObject, getVisibleChildMethod,1467accessibleContext, i);1468EXCEPTION_CHECK("##### getVisibleChildMethod - call to CallObjectMethod()", FALSE);1469jobject globalRef = jniEnv->NewGlobalRef(ac);1470EXCEPTION_CHECK("##### getVisibleChildMethod - call to NewGlobalRef()", FALSE);1471visibleChildrenInfo->children[bufIndex] = (JOBJECT64)globalRef;1472PrintDebugString("[INFO]: ##### visible child = %p", globalRef);14731474bufIndex++;1475}1476visibleChildrenInfo->returnedChildrenCount = bufIndex;14771478PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getVisibleChildren succeeded");1479return TRUE;1480}14811482/**1483* Set the caret to a text position. Returns whether successful;1484*1485* Bug ID 4944770 - setCaretPosition method needed1486*/1487BOOL1488AccessBridgeJavaEntryPoints::setCaretPosition(const jobject accessibleContext, int position) {14891490jthrowable exception;1491BOOL result = FALSE;14921493PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::setCaretPostion(%p position = %d):",1494accessibleContext, position);14951496if (setCaretPositionMethod != (jmethodID) 0) {1497result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject,1498setCaretPositionMethod,1499accessibleContext, position);1500EXCEPTION_CHECK("setCaretPostion - call to CallBooleanMethod()", FALSE);1501PrintDebugString("[ERROR]: result = %d", result);1502return result;1503} else {1504PrintDebugString("[ERROR]: either jniEnv == 0 or setCaretPositionMethod == 0");1505return result;1506}1507}150815091510// -----------------------------------15111512/**1513* getVersionInfo - returns the version string of the java.version property1514* and the AccessBridge.java version1515*1516*/1517BOOL1518AccessBridgeJavaEntryPoints::getVersionInfo(AccessBridgeVersionInfo *info) {1519jstring js;1520const wchar_t *stringBytes;1521jthrowable exception;1522jsize length;15231524PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getVersionInfo():");15251526if (getJavaVersionPropertyMethod != (jmethodID) 0) {1527js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1528getJavaVersionPropertyMethod);1529EXCEPTION_CHECK("Getting JavaVersionProperty - call to CallObjectMethod()", FALSE);1530PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);1531if (js != (jstring) 0) {1532length = jniEnv->GetStringLength(js);1533stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1534if (stringBytes == NULL) {1535if (!jniEnv->ExceptionCheck()) {1536PrintDebugString("[ERROR]: *** Exception when getting JavaVersionProperty - call to GetStringChars");1537jniEnv->ExceptionDescribe();1538jniEnv->ExceptionClear();1539}1540return FALSE;1541}1542wcsncpy(info->bridgeJavaDLLVersion,1543stringBytes,1544sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t));1545info->bridgeJavaDLLVersion[length < (sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t)) ?1546length : (sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t))-2] = (wchar_t) 0;1547wcsncpy(info->VMversion,1548stringBytes,1549sizeof(info->VMversion) / sizeof(wchar_t));1550info->VMversion[length < (sizeof(info->VMversion) / sizeof(wchar_t)) ?1551length : (sizeof(info->VMversion) / sizeof(wchar_t))-2] = (wchar_t) 0;1552wcsncpy(info->bridgeJavaClassVersion,1553stringBytes,1554sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t));1555info->bridgeJavaClassVersion[length < (sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t)) ?1556length : (sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t))-2] = (wchar_t) 0;1557wcsncpy(info->bridgeWinDLLVersion,1558stringBytes,1559sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t));1560info->bridgeWinDLLVersion[length < (sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t)) ?1561length : (sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t))-2] = (wchar_t) 0;1562jniEnv->ReleaseStringChars(js, stringBytes);1563EXCEPTION_CHECK("Getting JavaVersionProperty - call to ReleaseStringChars()", FALSE);1564jniEnv->CallVoidMethod(accessBridgeObject,1565decrementReferenceMethod, js);1566EXCEPTION_CHECK("Getting JavaVersionProperty - call to CallVoidMethod()", FALSE);1567wPrintDebugString(L" Java version = %ls", info->VMversion);1568jniEnv->DeleteLocalRef(js);1569EXCEPTION_CHECK("Getting JavaVersionProperty - call to DeleteLocalRef()", FALSE);1570} else {1571PrintDebugString("[WARN]: Java version is null.");1572info->VMversion[0] = (wchar_t) 0;1573return FALSE;1574}1575} else {1576PrintDebugString("[ERROR]: either env == 0 or getJavaVersionPropertyMethod == 0");1577return FALSE;1578}15791580return TRUE;1581}158215831584/*1585* Verifies the Java VM still exists and obj is an1586* instance of AccessibleText1587*/1588BOOL AccessBridgeJavaEntryPoints::verifyAccessibleText(jobject obj) {1589JavaVM *vm;1590BOOL retval;1591jthrowable exception;15921593PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::verifyAccessibleText");15941595if (jniEnv->GetJavaVM(&vm) != 0) {1596PrintDebugString("[ERROR]: No Java VM");1597return FALSE;1598}15991600if (obj == (jobject)0) {1601PrintDebugString("[ERROR]: Null jobject");1602return FALSE;1603}16041605// Copied from getAccessibleContextInfo1606if (getAccessibleTextFromContextMethod != (jmethodID) 0) {1607jobject returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,1608getAccessibleTextFromContextMethod,1609(jobject)obj);1610EXCEPTION_CHECK("Getting AccessibleText - call to CallObjectMethod()", FALSE);1611PrintDebugString("[ERROR]: AccessibleText = %p", returnedJobject);1612retval = returnedJobject != (jobject) 0;1613jniEnv->DeleteLocalRef(returnedJobject);1614EXCEPTION_CHECK("Getting AccessibleText - call to DeleteLocalRef()", FALSE);1615} else {1616PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextFromContextMethod == 0");1617return FALSE;1618}1619if (retval == FALSE) {1620PrintDebugString("[ERROR]: jobject is not an AccessibleText");1621}1622return retval;1623}162416251626/********** AccessibleContext routines ***********************************/16271628/**1629* getAccessibleContextAt - performs the Java method call:1630* Accessible AccessBridge.getAccessibleContextAt(x, y)1631*1632* Note: this call explicitly goes through the AccessBridge,1633* so that it can keep a reference the returned jobject for the JavaVM.1634* You must explicity call INTreleaseJavaObject() when you are through using1635* the Accessible returned, to let the AccessBridge know it can release the1636* object, so that the can then garbage collect it.1637*1638*/1639jobject1640AccessBridgeJavaEntryPoints::getAccessibleContextAt(jint x, jint y, jobject accessibleContext) {1641jobject returnedAccessibleContext;1642jobject globalRef;1643jthrowable exception;16441645PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleContextAt(%d, %d, %p):",1646x, y, accessibleContext);16471648if (getAccessibleContextAtMethod != (jmethodID) 0) {1649returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1650getAccessibleContextAtMethod,1651x, y, accessibleContext);1652EXCEPTION_CHECK("Getting AccessibleContextAt - call to CallObjectMethod()", FALSE);1653globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);1654EXCEPTION_CHECK("Getting AccessibleContextAt - call to NewGlobalRef()", FALSE);1655PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1656returnedAccessibleContext, globalRef);1657return globalRef;1658} else {1659PrintDebugString("[ERROR]: either env == 0 or getAccessibleContextAtMethod == 0");1660return (jobject) 0;1661}1662}16631664/**1665* getAccessibleWithFocus - performs the Java method calls:1666* Accessible Translator.getAccessible(SwingEventMonitor.getComponentWithFocus();1667*1668* Note: this call explicitly goes through the AccessBridge,1669* so that the AccessBridge can hide expected changes in how this functions1670* between JDK 1.1.x w/AccessibilityUtility classes, and JDK 1.2, when some1671* of this functionality may be built into the platform1672*1673*/1674jobject1675AccessBridgeJavaEntryPoints::getAccessibleContextWithFocus() {1676jobject returnedAccessibleContext;1677jobject globalRef;1678jthrowable exception;16791680PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleContextWithFocus()");16811682if (getAccessibleContextWithFocusMethod != (jmethodID) 0) {1683returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1684getAccessibleContextWithFocusMethod);1685EXCEPTION_CHECK("Getting AccessibleContextWithFocus - call to CallObjectMethod()", FALSE);1686globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);1687EXCEPTION_CHECK("Getting AccessibleContextWithFocus - call to NewGlobalRef()", FALSE);1688PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1689returnedAccessibleContext, globalRef);1690return globalRef;1691} else {1692PrintDebugString("[ERROR]: either jniEnv == 0 or getAccessibleContextWithFocusMethod == 0");1693return (jobject) 0;1694}1695}16961697/**1698* getAccessibleContextInfo - fills a struct with a bunch of information1699* contained in the Java Accessibility API1700*1701* Note: if the AccessibleContext parameter is bogus, this call will blow up1702*1703* Note: this call explicitly goes through the AccessBridge,1704* so that it can keep a reference the returned jobject for the JavaVM.1705* You must explicity call releaseJavaObject() when you are through using1706* the AccessibleContext returned, to let the AccessBridge know it can release the1707* object, so that the JavaVM can then garbage collect it.1708*/1709BOOL1710AccessBridgeJavaEntryPoints::getAccessibleContextInfo(jobject accessibleContext, AccessibleContextInfo *info) {1711jstring js;1712const wchar_t *stringBytes;1713jobject returnedJobject;1714jthrowable exception;1715jsize length;17161717PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleContextInfo(%p):", accessibleContext);17181719ZeroMemory(info, sizeof(AccessibleContextInfo));17201721if (accessibleContext == (jobject) 0) {1722PrintDebugString("[WARN]: passed in AccessibleContext == null! (oops)");1723return (FALSE);1724}17251726// Get the Accessible Name1727if (getAccessibleNameFromContextMethod != (jmethodID) 0) {1728js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1729getAccessibleNameFromContextMethod,1730accessibleContext);1731EXCEPTION_CHECK("Getting AccessibleName - call to CallObjectMethod()", FALSE);1732if (js != (jstring) 0) {1733stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1734EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE);1735wcsncpy(info->name, stringBytes, (sizeof(info->name) / sizeof(wchar_t)));1736length = jniEnv->GetStringLength(js);1737info->name[length < (sizeof(info->name) / sizeof(wchar_t)) ?1738length : (sizeof(info->name) / sizeof(wchar_t))-2] = (wchar_t) 0;1739EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE);1740jniEnv->ReleaseStringChars(js, stringBytes);1741EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE);1742jniEnv->CallVoidMethod(accessBridgeObject,1743decrementReferenceMethod, js);1744EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE);1745wPrintDebugString(L"[INFO]: Accessible Name = %ls", info->name);1746jniEnv->DeleteLocalRef(js);1747EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE);1748} else {1749PrintDebugString("[WARN]: Accessible Name is null.");1750info->name[0] = (wchar_t) 0;1751}1752} else {1753PrintDebugString("[ERROR]: either env == 0 or getAccessibleNameFromContextMethod == 0");1754return FALSE;1755}175617571758// Get the Accessible Description1759if (getAccessibleDescriptionFromContextMethod != (jmethodID) 0) {1760js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1761getAccessibleDescriptionFromContextMethod,1762accessibleContext);1763EXCEPTION_CHECK("Getting AccessibleDescription - call to CallObjectMethod()", FALSE);1764if (js != (jstring) 0) {1765stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1766EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE);1767wcsncpy(info->description, stringBytes, (sizeof(info->description) / sizeof(wchar_t)));1768length = jniEnv->GetStringLength(js);1769info->description[length < (sizeof(info->description) / sizeof(wchar_t)) ?1770length : (sizeof(info->description) / sizeof(wchar_t))-2] = (wchar_t) 0;1771EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE);1772jniEnv->ReleaseStringChars(js, stringBytes);1773EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE);1774jniEnv->CallVoidMethod(accessBridgeObject,1775decrementReferenceMethod, js);1776EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE);1777wPrintDebugString(L"[INFO]: Accessible Description = %ls", info->description);1778jniEnv->DeleteLocalRef(js);1779EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE);1780} else {1781PrintDebugString("[WARN]: Accessible Description is null.");1782info->description[0] = (wchar_t) 0;1783}1784} else {1785PrintDebugString("[ERROR]: either env == 0 or getAccessibleDescriptionFromContextMethod == 0");1786return FALSE;1787}178817891790// Get the Accessible Role String1791if (getAccessibleRoleStringFromContextMethod != (jmethodID) 0) {1792js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1793getAccessibleRoleStringFromContextMethod,1794accessibleContext);1795EXCEPTION_CHECK("Getting AccessibleRole - call to CallObjectMethod()", FALSE);1796if (js != (jstring) 0) {1797stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1798EXCEPTION_CHECK("Getting AccessibleRole - call to GetStringChars()", FALSE);1799wcsncpy(info->role, stringBytes, (sizeof(info->role) / sizeof(wchar_t)));1800length = jniEnv->GetStringLength(js);1801info->role[length < (sizeof(info->role) / sizeof(wchar_t)) ?1802length : (sizeof(info->role) / sizeof(wchar_t))-2] = (wchar_t) 0;1803EXCEPTION_CHECK("Getting AccessibleRole - call to GetStringLength()", FALSE);1804jniEnv->ReleaseStringChars(js, stringBytes);1805EXCEPTION_CHECK("Getting AccessibleRole - call to ReleaseStringChars()", FALSE);1806jniEnv->CallVoidMethod(accessBridgeObject,1807decrementReferenceMethod, js);1808EXCEPTION_CHECK("Getting AccessibleRole - call to CallVoidMethod()", FALSE);1809wPrintDebugString(L"[INFO]: Accessible Role = %ls", info->role);1810jniEnv->DeleteLocalRef(js);1811EXCEPTION_CHECK("Getting AccessibleRole - call to DeleteLocalRef()", FALSE);1812} else {1813PrintDebugString("[WARN]: Accessible Role is null.");1814info->role[0] = (wchar_t) 0;1815}1816} else {1817PrintDebugString("[ERROR]: either env == 0 or getAccessibleRoleStringFromContextMethod == 0");1818return FALSE;1819}182018211822// Get the Accessible Role String in the en_US locale1823if (getAccessibleRoleStringFromContext_en_USMethod != (jmethodID) 0) {1824js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1825getAccessibleRoleStringFromContext_en_USMethod,1826accessibleContext);1827EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to CallObjectMethod()", FALSE);1828if (js != (jstring) 0) {1829stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1830EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to GetStringChars()", FALSE);1831wcsncpy(info->role_en_US, stringBytes, (sizeof(info->role_en_US) / sizeof(wchar_t)));1832length = jniEnv->GetStringLength(js);1833info->role_en_US[length < (sizeof(info->role_en_US) / sizeof(wchar_t)) ?1834length : (sizeof(info->role_en_US) / sizeof(wchar_t))-2] = (wchar_t) 0;1835EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to GetStringLength()", FALSE);1836jniEnv->ReleaseStringChars(js, stringBytes);1837EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to ReleaseStringChars()", FALSE);1838jniEnv->CallVoidMethod(accessBridgeObject,1839decrementReferenceMethod, js);1840EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to CallVoidMethod()", FALSE);1841wPrintDebugString(L"[INFO]: Accessible Role en_US = %ls", info->role_en_US);1842jniEnv->DeleteLocalRef(js);1843EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to DeleteLocalRef()", FALSE);1844} else {1845PrintDebugString("[WARN]: Accessible Role en_US is null.");1846info->role[0] = (wchar_t) 0;1847}1848} else {1849PrintDebugString("[ERROR]: either env == 0 or getAccessibleRoleStringFromContext_en_USMethod == 0");1850return FALSE;1851}18521853// Get the Accessible States String1854if (getAccessibleStatesStringFromContextMethod != (jmethodID) 0) {1855js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1856getAccessibleStatesStringFromContextMethod,1857accessibleContext);1858EXCEPTION_CHECK("Getting AccessibleState - call to CallObjectMethod()", FALSE);1859if (js != (jstring) 0) {1860stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1861EXCEPTION_CHECK("Getting AccessibleState - call to GetStringChars()", FALSE);1862wcsncpy(info->states, stringBytes, (sizeof(info->states) / sizeof(wchar_t)));1863length = jniEnv->GetStringLength(js);1864info->states[length < (sizeof(info->states) / sizeof(wchar_t)) ?1865length : (sizeof(info->states) / sizeof(wchar_t))-2] = (wchar_t) 0;1866EXCEPTION_CHECK("Getting AccessibleState - call to GetStringLength()", FALSE);1867jniEnv->ReleaseStringChars(js, stringBytes);1868EXCEPTION_CHECK("Getting AccessibleState - call to ReleaseStringChars()", FALSE);1869jniEnv->CallVoidMethod(accessBridgeObject,1870decrementReferenceMethod, js);1871EXCEPTION_CHECK("Getting AccessibleState - call to CallVoidMethod()", FALSE);1872wPrintDebugString(L"[INFO]: Accessible States = %ls", info->states);1873jniEnv->DeleteLocalRef(js);1874EXCEPTION_CHECK("Getting AccessibleState - call to DeleteLocalRef()", FALSE);1875} else {1876PrintDebugString("[WARN]: Accessible States is null.");1877info->states[0] = (wchar_t) 0;1878}1879} else {1880PrintDebugString("[ERROR]: either env == 0 or getAccessibleStatesStringFromContextMethod == 0");1881return FALSE;1882}18831884// Get the Accessible States String in the en_US locale1885if (getAccessibleStatesStringFromContext_en_USMethod != (jmethodID) 0) {1886js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1887getAccessibleStatesStringFromContext_en_USMethod,1888accessibleContext);1889EXCEPTION_CHECK("Getting AccessibleState_en_US - call to CallObjectMethod()", FALSE);1890if (js != (jstring) 0) {1891stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1892EXCEPTION_CHECK("Getting AccessibleState_en_US - call to GetStringChars()", FALSE);1893wcsncpy(info->states_en_US, stringBytes, (sizeof(info->states_en_US) / sizeof(wchar_t)));1894length = jniEnv->GetStringLength(js);1895info->states_en_US[length < (sizeof(info->states_en_US) / sizeof(wchar_t)) ?1896length : (sizeof(info->states_en_US) / sizeof(wchar_t))-2] = (wchar_t) 0;1897EXCEPTION_CHECK("Getting AccessibleState_en_US - call to GetStringLength()", FALSE);1898jniEnv->ReleaseStringChars(js, stringBytes);1899EXCEPTION_CHECK("Getting AccessibleState_en_US - call to ReleaseStringChars()", FALSE);1900jniEnv->CallVoidMethod(accessBridgeObject,1901decrementReferenceMethod, js);1902EXCEPTION_CHECK("Getting AccessibleState_en_US - call to CallVoidMethod()", FALSE);1903wPrintDebugString(L"[INFO]: Accessible States en_US = %ls", info->states_en_US);1904jniEnv->DeleteLocalRef(js);1905EXCEPTION_CHECK("Getting AccessibleState_en_US - call to DeleteLocalRef()", FALSE);1906} else {1907PrintDebugString("[WARN]: Accessible States en_US is null.");1908info->states[0] = (wchar_t) 0;1909}1910} else {1911PrintDebugString("[ERROR]: either env == 0 or getAccessibleStatesStringFromContext_en_USMethod == 0");1912return FALSE;1913}191419151916// Get the index in Parent1917if (getAccessibleIndexInParentFromContextMethod != (jmethodID) 0) {1918info->indexInParent = jniEnv->CallIntMethod(accessBridgeObject,1919getAccessibleIndexInParentFromContextMethod,1920accessibleContext);1921EXCEPTION_CHECK("Getting AccessibleIndexInParent - call to CallIntMethod()", FALSE);1922PrintDebugString("[INFO]: Index in Parent = %d", info->indexInParent);1923} else {1924PrintDebugString("[ERROR]: either env == 0 or getAccessibleIndexInParentFromContextMethod == 0");1925return FALSE;1926}192719281929PrintDebugString("[INFO]: *** jniEnv: %p; accessBridgeObject: %p; AccessibleContext: %p ***",1930jniEnv, accessBridgeObject, accessibleContext);19311932// Get the children count1933if (getAccessibleChildrenCountFromContextMethod != (jmethodID) 0) {1934info->childrenCount = jniEnv->CallIntMethod(accessBridgeObject,1935getAccessibleChildrenCountFromContextMethod,1936accessibleContext);1937EXCEPTION_CHECK("Getting AccessibleChildrenCount - call to CallIntMethod()", FALSE);1938PrintDebugString("[INFO]: Children count = %d", info->childrenCount);1939} else {1940PrintDebugString("[ERROR]: either env == 0 or getAccessibleChildrenCountFromContextMethod == 0");1941return FALSE;1942}19431944PrintDebugString("[INFO]: *** jniEnv: %p; accessBridgeObject: %p; AccessibleContext: %X ***",1945jniEnv, accessBridgeObject, accessibleContext);194619471948// Get the x coord1949if (getAccessibleXcoordFromContextMethod != (jmethodID) 0) {1950info->x = jniEnv->CallIntMethod(accessBridgeObject,1951getAccessibleXcoordFromContextMethod,1952accessibleContext);1953EXCEPTION_CHECK("Getting AccessibleXcoord - call to CallIntMethod()", FALSE);1954PrintDebugString("[INFO]: X coord = %d", info->x);1955} else {1956PrintDebugString("[ERROR]: either env == 0 or getAccessibleXcoordFromContextMethod == 0");1957return FALSE;1958}19591960PrintDebugString("[INFO]: *** jniEnv: %X; accessBridgeObject: %X; AccessibleContext: %p ***",1961jniEnv, accessBridgeObject, accessibleContext);196219631964// Get the y coord1965if (getAccessibleYcoordFromContextMethod != (jmethodID) 0) {1966info->y = jniEnv->CallIntMethod(accessBridgeObject,1967getAccessibleYcoordFromContextMethod,1968accessibleContext);1969EXCEPTION_CHECK("Getting AccessibleYcoord - call to CallIntMethod()", FALSE);1970PrintDebugString("[INFO]: Y coord = %d", info->y);1971} else {1972PrintDebugString("[ERROR]: either env == 0 or getAccessibleYcoordFromContextMethod == 0");1973return FALSE;1974}19751976// Get the width1977if (getAccessibleWidthFromContextMethod != (jmethodID) 0) {1978info->width = jniEnv->CallIntMethod(accessBridgeObject,1979getAccessibleWidthFromContextMethod,1980accessibleContext);1981EXCEPTION_CHECK("Getting AccessibleWidth - call to CallIntMethod()", FALSE);1982PrintDebugString("[INFO]: Width = %d", info->width);1983} else {1984PrintDebugString("[ERROR]: either env == 0 or getAccessibleWidthFromContextMethod == 0");1985return FALSE;1986}19871988// Get the height1989if (getAccessibleHeightFromContextMethod != (jmethodID) 0) {1990info->height = jniEnv->CallIntMethod(accessBridgeObject,1991getAccessibleHeightFromContextMethod,1992accessibleContext);1993EXCEPTION_CHECK("Getting AccessibleHeight - call to CallIntMethod()", FALSE);1994PrintDebugString("[INFO]: Height = %d", info->height);1995} else {1996PrintDebugString("[ERROR]: either env == 0 or getAccessibleHeightFromContextMethod == 0");1997return FALSE;1998}19992000// Get the AccessibleComponent2001if (getAccessibleComponentFromContextMethod != (jmethodID) 0) {2002returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2003getAccessibleComponentFromContextMethod,2004accessibleContext);2005EXCEPTION_CHECK("Getting AccessibleComponent - call to CallObjectMethod()", FALSE);2006PrintDebugString("[INFO]: AccessibleComponent = %p", returnedJobject);2007info->accessibleComponent = (returnedJobject != (jobject) 0 ? TRUE : FALSE);2008jniEnv->DeleteLocalRef(returnedJobject);2009EXCEPTION_CHECK("Getting AccessibleComponent - call to DeleteLocalRef()", FALSE);2010} else {2011PrintDebugString("[ERROR]: either env == 0 or getAccessibleComponentFromContextMethod == 0");2012return FALSE;2013}20142015// Get the AccessibleAction2016if (getAccessibleActionFromContextMethod != (jmethodID) 0) {2017returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2018getAccessibleActionFromContextMethod,2019accessibleContext);2020EXCEPTION_CHECK("Getting AccessibleAction - call to CallObjectMethod()", FALSE);2021PrintDebugString("[INFO]: AccessibleAction = %p", returnedJobject);2022info->accessibleAction = (returnedJobject != (jobject) 0 ? TRUE : FALSE);2023jniEnv->DeleteLocalRef(returnedJobject);2024EXCEPTION_CHECK("Getting AccessibleAction - call to DeleteLocalRef()", FALSE);2025} else {2026PrintDebugString("[ERROR]: either env == 0 or getAccessibleActionFromContextMethod == 0");2027return FALSE;2028}20292030// Get the AccessibleSelection2031if (getAccessibleSelectionFromContextMethod != (jmethodID) 0) {2032returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2033getAccessibleSelectionFromContextMethod,2034accessibleContext);2035EXCEPTION_CHECK("Getting AccessibleSelection - call to CallObjectMethod()", FALSE);2036PrintDebugString("[INFO]: AccessibleSelection = %p", returnedJobject);2037info->accessibleSelection = (returnedJobject != (jobject) 0 ? TRUE : FALSE);2038jniEnv->DeleteLocalRef(returnedJobject);2039EXCEPTION_CHECK("Getting AccessibleSelection - call to DeleteLocalRef()", FALSE);2040} else {2041PrintDebugString("[ERROR]: either env == 0 or getAccessibleSelectionFromContextMethod == 0");2042return FALSE;2043}20442045// Get the AccessibleTable2046if (getAccessibleTableFromContextMethod != (jmethodID) 0) {2047PrintDebugString("[INFO]: ##### Calling getAccessibleTableFromContextMethod ...");2048returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2049getAccessibleTableFromContextMethod,2050accessibleContext);2051PrintDebugString("[INFO]: ##### ... Returned from getAccessibleTableFromContextMethod");2052EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE);2053PrintDebugString("[INFO]: ##### AccessibleTable = %p", returnedJobject);2054if (returnedJobject != (jobject) 0) {2055info->accessibleInterfaces |= cAccessibleTableInterface;2056}2057jniEnv->DeleteLocalRef(returnedJobject);2058EXCEPTION_CHECK("##### Getting AccessibleTable - call to DeleteLocalRef()", FALSE);20592060/*2061returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2062getAccessibleTableFromContextMethod,2063AccessibleContext);2064PrintDebugString("##### ... Returned from getAccessibleTableFromContextMethod");2065EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE);2066PrintDebugString(" ##### AccessibleTable = %X", returnedJobject);2067info->accessibleTable = returnedJobject;2068*/20692070} else {2071PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableFromContextMethod == 0");2072return FALSE;2073}20742075// Get the AccessibleText2076if (getAccessibleTextFromContextMethod != (jmethodID) 0) {2077returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2078getAccessibleTextFromContextMethod,2079accessibleContext);2080EXCEPTION_CHECK("Getting AccessibleText - call to CallObjectMethod()", FALSE);2081PrintDebugString("[INFO]: AccessibleText = %p", returnedJobject);2082info->accessibleText = (returnedJobject != (jobject) 0 ? TRUE : FALSE);2083jniEnv->DeleteLocalRef(returnedJobject);2084EXCEPTION_CHECK("Getting AccessibleText - call to DeleteLocalRef()", FALSE);2085} else {2086PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextFromContextMethod == 0");2087return FALSE;2088}20892090// Get the AccessibleValue2091if (getAccessibleValueFromContextMethod != (jmethodID) 0) {2092returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2093getAccessibleValueFromContextMethod,2094accessibleContext);2095EXCEPTION_CHECK("Getting AccessibleValue - call to CallObjectMethod()", FALSE);2096PrintDebugString("[INFO]: AccessibleValue = %p", returnedJobject);2097if (returnedJobject != (jobject) 0) {2098info->accessibleInterfaces |= cAccessibleValueInterface;2099}2100jniEnv->DeleteLocalRef(returnedJobject);2101EXCEPTION_CHECK("Getting AccessibleValue - call to DeleteLocalRef()", FALSE);2102} else {2103PrintDebugString("[ERROR]: either env == 0 or getAccessibleValueFromContextMethod == 0");2104return FALSE;2105}21062107// FIX2108// get the AccessibleHypertext2109if (getAccessibleHypertextMethod != (jmethodID) 0 &&2110getAccessibleHyperlinkCountMethod != (jmethodID) 0 &&2111getAccessibleHyperlinkMethod != (jmethodID) 0 &&2112getAccessibleHyperlinkTextMethod != (jmethodID) 0 &&2113getAccessibleHyperlinkStartIndexMethod != (jmethodID) 0 &&2114getAccessibleHyperlinkEndIndexMethod != (jmethodID) 0) {2115returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2116getAccessibleHypertextMethod,2117accessibleContext);2118EXCEPTION_CHECK("Getting AccessibleHypertext - call to CallObjectMethod()", FALSE);2119PrintDebugString("[INFO]: AccessibleHypertext = %p",2120returnedJobject);2121if (returnedJobject != (jobject) 0) {2122info->accessibleInterfaces |= cAccessibleHypertextInterface;2123}2124jniEnv->DeleteLocalRef(returnedJobject);2125EXCEPTION_CHECK("Getting AccessibleHypertext - call to DeleteLocalRef()", FALSE);2126}21272128// set new accessibleInterfaces flags from old BOOL values2129if(info->accessibleComponent)2130info->accessibleInterfaces |= cAccessibleComponentInterface;2131if(info->accessibleAction)2132info->accessibleInterfaces |= cAccessibleActionInterface;2133if(info->accessibleSelection)2134info->accessibleInterfaces |= cAccessibleSelectionInterface;2135if(info->accessibleText)2136info->accessibleInterfaces |= cAccessibleTextInterface;2137// FIX END21382139return TRUE;2140}21412142/**2143* getAccessibleChildFromContext - performs the Java method call:2144* AccessibleContext AccessBridge.getAccessibleChildContext(AccessibleContext)2145*2146* Note: if the AccessibleContext parameter is bogus, this call will blow up2147*2148* Note: this call explicitly goes through the AccessBridge,2149* so that it can keep a reference the returned jobject for the JavaVM.2150* You must explicity call releaseJavaObject() when you are through using2151* the AccessibleContext returned, to let the AccessBridge know it can release the2152* object, so that the JavaVM can then garbage collect it.2153*/2154jobject2155AccessBridgeJavaEntryPoints::getAccessibleChildFromContext(jobject accessibleContext, jint childIndex) {2156jobject returnedAccessibleContext;2157jobject globalRef;2158jthrowable exception;21592160PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleChildContext(%p, %d):",2161accessibleContext, childIndex);21622163if (getAccessibleChildFromContextMethod != (jmethodID) 0) {2164returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,2165getAccessibleChildFromContextMethod,2166accessibleContext, childIndex);2167EXCEPTION_CHECK("Getting AccessibleChild - call to CallObjectMethod()", FALSE);2168globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);2169EXCEPTION_CHECK("Getting AccessibleChild - call to NewGlobalRef()", FALSE);2170jniEnv->DeleteLocalRef(returnedAccessibleContext);2171EXCEPTION_CHECK("Getting AccessibleChild - call to DeleteLocalRef()", FALSE);2172PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",2173returnedAccessibleContext, globalRef);2174return globalRef;2175} else {2176PrintDebugString("[ERROR]: either env == 0 or getAccessibleChildContextMethod == 0");2177return (jobject) 0;2178}2179}21802181/**2182* getAccessibleParentFromContext - returns the AccessibleContext parent2183*2184*/2185jobject2186AccessBridgeJavaEntryPoints::getAccessibleParentFromContext(jobject accessibleContext)2187{2188jobject returnedAccessibleContext;2189jobject globalRef;2190jthrowable exception;21912192PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleParentFromContext(%p):", accessibleContext);21932194if (getAccessibleParentFromContextMethod != (jmethodID) 0) {2195returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,2196getAccessibleParentFromContextMethod,2197accessibleContext);2198EXCEPTION_CHECK("Getting AccessibleParent - call to CallObjectMethod()", FALSE);2199globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);2200EXCEPTION_CHECK("Getting AccessibleParent - call to NewGlobalRef()", FALSE);2201jniEnv->DeleteLocalRef(returnedAccessibleContext);2202EXCEPTION_CHECK("Getting AccessibleParent - call to DeleteLocalRef()", FALSE);2203PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",2204returnedAccessibleContext, globalRef);2205return globalRef;2206} else {2207PrintDebugString("[ERROR]: either env == 0 or getAccessibleParentFromContextMethod == 0");2208return (jobject) 0;2209}2210}221122122213/********** AccessibleTable routines **********************************/22142215BOOL2216AccessBridgeJavaEntryPoints::getAccessibleTableInfo(jobject accessibleContext,2217AccessibleTableInfo *tableInfo) {22182219jthrowable exception;22202221PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableInfo(%p):",2222accessibleContext);22232224// get the table row count2225if (getAccessibleTableRowCountMethod != (jmethodID) 0) {2226tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject,2227getAccessibleTableRowCountMethod,2228accessibleContext);2229EXCEPTION_CHECK("##### Getting AccessibleTableRowCount - call to CallIntMethod()", FALSE);2230PrintDebugString("[INFO]: ##### table row count = %d", tableInfo->rowCount);2231} else {2232PrintDebugString("[ERROR]: either env == 0 or getAccessibleRowCountMethod == 0");2233return FALSE;2234}22352236// get the table column count2237if (getAccessibleTableColumnCountMethod != (jmethodID) 0) {2238tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject,2239getAccessibleTableColumnCountMethod,2240accessibleContext);2241EXCEPTION_CHECK("Getting AccessibleTableColumnCount - call to CallIntMethod()", FALSE);2242PrintDebugString("[INFO]: ##### table column count = %d", tableInfo->columnCount);2243} else {2244PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnCountMethod == 0");2245return FALSE;2246}22472248// get the AccessibleTable2249if (getAccessibleTableFromContextMethod != (jmethodID) 0) {2250PrintDebugString("[INFO]: ##### Calling getAccessibleTableFromContextMethod ...");2251jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject,2252getAccessibleTableFromContextMethod,2253accessibleContext);2254PrintDebugString("[INFO]: ##### ... Returned from getAccessibleTableFromContextMethod");2255EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE);2256jobject globalRef = jniEnv->NewGlobalRef(accTable);2257EXCEPTION_CHECK("##### Getting AccessibleTable - call to NewGlobalRef()", FALSE);2258tableInfo->accessibleTable = (JOBJECT64)globalRef;2259PrintDebugString("[INFO]: ##### accessibleTable = %p", globalRef);2260} else {2261PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableFromContextMethod == 0");2262return FALSE;2263}22642265// cache the AccessibleContext2266if (getContextFromAccessibleTableMethod != (jmethodID) 0) {2267PrintDebugString("[INFO]: ##### Calling getContextFromAccessibleTable Method ...");2268jobject ac = jniEnv->CallObjectMethod(accessBridgeObject,2269getContextFromAccessibleTableMethod,2270accessibleContext);2271PrintDebugString("[INFO]: ##### ... Returned from getContextFromAccessibleTable Method");2272EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE);2273jobject globalRef = jniEnv->NewGlobalRef(ac);2274EXCEPTION_CHECK("##### Getting AccessibleTable - call to NewGlobalRef()", FALSE);2275tableInfo->accessibleContext = (JOBJECT64)globalRef;2276PrintDebugString("[INFO]: ##### accessibleContext = %p", globalRef);2277} else {2278PrintDebugString("[ERROR]: either env == 0 or getContextFromAccessibleTable Method == 0");2279return FALSE;2280}22812282// FIX - set unused elements2283tableInfo->caption = NULL;2284tableInfo->summary = NULL;22852286PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableInfo succeeded");2287return TRUE;2288}22892290BOOL2291AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo(jobject accessibleTable, jint row, jint column,2292AccessibleTableCellInfo *tableCellInfo) {22932294jthrowable exception;22952296PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo(%p): row=%d, column=%d",2297accessibleTable, row, column);22982299// FIX2300ZeroMemory(tableCellInfo, sizeof(AccessibleTableCellInfo));2301tableCellInfo->row = row;2302tableCellInfo->column = column;2303// FIX END23042305// get the table cell index2306if (getAccessibleTableCellIndexMethod != (jmethodID) 0) {2307tableCellInfo->index = jniEnv->CallIntMethod(accessBridgeObject,2308getAccessibleTableCellIndexMethod,2309accessibleTable, row, column);2310EXCEPTION_CHECK("##### Getting AccessibleTableCellIndex - call to CallIntMethod()", FALSE);2311PrintDebugString("[INFO]: ##### table cell index = %d", tableCellInfo->index);2312} else {2313PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableCellIndexMethod == 0");2314return FALSE;2315}23162317// get the table cell row extent2318if (getAccessibleTableCellRowExtentMethod != (jmethodID) 0) {2319tableCellInfo->rowExtent = jniEnv->CallIntMethod(accessBridgeObject,2320getAccessibleTableCellRowExtentMethod,2321accessibleTable, row, column);2322EXCEPTION_CHECK("##### Getting AccessibleTableCellRowExtentCount - call to CallIntMethod()", FALSE);2323PrintDebugString("[INFO]: ##### table cell row extent = %d", tableCellInfo->rowExtent);2324} else {2325PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableCellRowExtentMethod == 0");2326return FALSE;2327}23282329// get the table cell column extent2330if (getAccessibleTableCellColumnExtentMethod != (jmethodID) 0) {2331tableCellInfo->columnExtent = jniEnv->CallIntMethod(accessBridgeObject,2332getAccessibleTableCellColumnExtentMethod,2333accessibleTable, row, column);2334EXCEPTION_CHECK("##### Getting AccessibleTableCellColumnExtentCount - call to CallIntMethod()", FALSE);2335PrintDebugString("[INFO]: ##### table cell column extent = %d", tableCellInfo->columnExtent);2336} else {2337PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableCellColumnExtentMethod == 0");2338return FALSE;2339}23402341// get whether the table cell is selected2342if (isAccessibleTableCellSelectedMethod != (jmethodID) 0) {2343tableCellInfo->isSelected = jniEnv->CallBooleanMethod(accessBridgeObject,2344isAccessibleTableCellSelectedMethod,2345accessibleTable, row, column);2346EXCEPTION_CHECK("##### Getting isAccessibleTableCellSelected - call to CallBooleanMethod()", FALSE);2347PrintDebugString("[INFO]: ##### table cell isSelected = %d", tableCellInfo->isSelected);2348} else {2349PrintDebugString("[ERROR]: either env == 0 or isAccessibleTableCellSelectedMethod == 0");2350return FALSE;2351}23522353// get the table cell AccessibleContext2354if (getAccessibleTableCellAccessibleContextMethod != (jmethodID) 0) {2355jobject tableCellAC = jniEnv->CallObjectMethod(accessBridgeObject,2356getAccessibleTableCellAccessibleContextMethod,2357accessibleTable, row, column);2358EXCEPTION_CHECK("##### Getting AccessibleTableCellAccessibleContext - call to CallObjectMethod()", FALSE);2359jobject globalRef = jniEnv->NewGlobalRef(tableCellAC);2360EXCEPTION_CHECK("##### Getting AccessibleTableCellAccessibleContext - call to NewGlobalRef()", FALSE);2361tableCellInfo->accessibleContext = (JOBJECT64)globalRef;2362PrintDebugString("[INFO]: ##### table cell AccessibleContext = %p", globalRef);2363} else {2364PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableCellAccessibleContextMethod == 0");2365return FALSE;2366}23672368PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo succeeded");2369return TRUE;2370}23712372BOOL2373AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader(jobject acParent, AccessibleTableInfo *tableInfo) {23742375jthrowable exception;23762377PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader(%p):",2378acParent);23792380// get the header row count2381if (getAccessibleTableRowHeaderRowCountMethod != (jmethodID) 0) {2382tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject,2383getAccessibleTableRowHeaderRowCountMethod,2384acParent);2385EXCEPTION_CHECK("##### Getting AccessibleTableRowHeaderRowCount - call to CallIntMethod()", FALSE);2386PrintDebugString("[INFO]: ##### table row count = %d", tableInfo->rowCount);2387} else {2388PrintDebugString("[ERROR]: either env == 0 or getAccessibleRowHeaderRowCountMethod == 0");2389return FALSE;2390}23912392// get the header column count2393if (getAccessibleTableRowHeaderColumnCountMethod != (jmethodID) 0) {2394tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject,2395getAccessibleTableRowHeaderColumnCountMethod,2396acParent);2397EXCEPTION_CHECK("Getting AccessibleTableRowHeaderColumnCount - call to CallIntMethod()", FALSE);2398PrintDebugString("[INFO]: ##### table column count = %d", tableInfo->columnCount);2399} else {2400PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowHeaderColumnCountMethod == 0");2401return FALSE;2402}24032404// get the header AccessibleTable2405if (getAccessibleTableRowHeaderMethod != (jmethodID) 0) {2406jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject,2407getAccessibleTableRowHeaderMethod,2408acParent);2409EXCEPTION_CHECK("##### Getting AccessibleTableRowHeader - call to CallObjectMethod()", FALSE);2410jobject globalRef = jniEnv->NewGlobalRef(accTable);2411EXCEPTION_CHECK("##### Getting AccessibleTableRowHeader - call to NewGlobalRef()", FALSE);2412tableInfo->accessibleTable = (JOBJECT64)globalRef;2413PrintDebugString("[INFO]: ##### row header AccessibleTable = %p", globalRef);2414} else {2415PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowHeaderMethod == 0");2416return FALSE;2417}24182419// FIX - set unused elements2420tableInfo->caption = NULL;2421tableInfo->summary = NULL;2422tableInfo->accessibleContext = NULL;24232424PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader succeeded");2425return TRUE;2426}24272428BOOL2429AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader(jobject acParent, AccessibleTableInfo *tableInfo) {2430jthrowable exception;24312432PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader(%p):",2433acParent);24342435// get the header row count2436if (getAccessibleTableColumnHeaderRowCountMethod != (jmethodID) 0) {2437tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject,2438getAccessibleTableColumnHeaderRowCountMethod,2439acParent);2440EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeaderRowCount - call to CallIntMethod()", FALSE);2441PrintDebugString("[INFO]: ##### table row count = %d", tableInfo->rowCount);2442} else {2443PrintDebugString("[ERROR]: either env == 0 or getAccessibleColumnHeaderRowCountMethod == 0");2444return FALSE;2445}24462447// get the header column count2448if (getAccessibleTableColumnHeaderColumnCountMethod != (jmethodID) 0) {2449tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject,2450getAccessibleTableColumnHeaderColumnCountMethod,2451acParent);2452EXCEPTION_CHECK("Getting AccessibleTableColumnHeaderColumnCount - call to CallIntMethod()", FALSE);2453PrintDebugString("[INFO]: ##### table column count = %d", tableInfo->columnCount);2454} else {2455PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnHeaderColumnCountMethod == 0");2456return FALSE;2457}2458// get the header AccessibleTable2459if (getAccessibleTableColumnHeaderMethod != (jmethodID) 0) {2460jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject,2461getAccessibleTableColumnHeaderMethod,2462acParent);2463EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeader - call to CallObjectMethod()", FALSE);2464jobject globalRef = jniEnv->NewGlobalRef(accTable);2465EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeader - call to NewGlobalRef()", FALSE);2466tableInfo->accessibleTable = (JOBJECT64)globalRef;2467PrintDebugString("[INFO]: ##### column header AccessibleTable = %p", globalRef);2468} else {2469PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnHeaderMethod == 0");2470return FALSE;2471}24722473// FIX - set unused elements2474tableInfo->caption = NULL;2475tableInfo->summary = NULL;2476tableInfo->accessibleContext = NULL;24772478PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader succeeded");2479return TRUE;2480}24812482jobject2483AccessBridgeJavaEntryPoints::getAccessibleTableRowDescription(jobject acParent, jint row) {24842485jobject returnedAccessibleContext;2486jobject globalRef;2487jthrowable exception;24882489PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowDescription(%p):",2490acParent);24912492if (getAccessibleTableRowDescriptionMethod != (jmethodID) 0) {2493returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,2494getAccessibleTableRowDescriptionMethod,2495acParent, row);2496EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to CallObjectMethod()", FALSE);2497globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);2498EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to NewGlobalRef()", FALSE);2499jniEnv->DeleteLocalRef(returnedAccessibleContext);2500EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to DeleteLocalRef()", FALSE);2501PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",2502returnedAccessibleContext, globalRef);2503return globalRef;2504} else {2505PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowDescriptionMethod == 0");2506return (jobject) 0;2507}2508}25092510jobject2511AccessBridgeJavaEntryPoints::getAccessibleTableColumnDescription(jobject acParent, jint column) {25122513jobject returnedAccessibleContext;2514jobject globalRef;2515jthrowable exception;25162517PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnDescription(%p):",2518acParent);25192520if (getAccessibleTableColumnDescriptionMethod != (jmethodID) 0) {2521returnedAccessibleContext = jniEnv->CallObjectMethod(2522accessBridgeObject,2523getAccessibleTableColumnDescriptionMethod,2524acParent, column);2525EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to CallObjectMethod()", FALSE);2526globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);2527EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to NewGlobalRef()", FALSE);2528jniEnv->DeleteLocalRef(returnedAccessibleContext);2529EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to DeleteLocalRef()", FALSE);2530PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",2531returnedAccessibleContext, globalRef);2532return globalRef;2533} else {2534PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnDescriptionMethod == 0");2535return (jobject) 0;2536}2537}25382539jint2540AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount(jobject accessibleTable) {25412542jthrowable exception;2543jint count;25442545PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount(%p)",2546accessibleTable);25472548// Get the table row selection count2549if (getAccessibleTableRowSelectionCountMethod != (jmethodID) 0) {2550count = jniEnv->CallIntMethod(accessBridgeObject,2551getAccessibleTableRowSelectionCountMethod,2552accessibleTable);2553EXCEPTION_CHECK("##### Getting AccessibleTableRowSelectionCount - call to CallIntMethod()", FALSE);2554PrintDebugString("[INFO]: ##### table row selection count = %d", count);2555return count;2556} else {2557PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowSelectionCountMethod == 0");2558return 0;2559}25602561PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount failed");2562return 0;2563}25642565BOOL2566AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected(jobject accessibleTable, jint row) {2567jthrowable exception;2568BOOL result;25692570PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected(%p, %d)",2571accessibleTable, row);25722573if (isAccessibleTableRowSelectedMethod != (jmethodID) 0) {2574result = jniEnv->CallBooleanMethod(accessBridgeObject,2575isAccessibleTableRowSelectedMethod,2576accessibleTable, row);2577EXCEPTION_CHECK("##### Getting isAccessibleTableRowSelected - call to CallBooleanMethod()", FALSE);2578PrintDebugString("[INFO]: ##### table row isSelected = %d", result);2579return result;2580} else {2581PrintDebugString("[ERROR]: either env == 0 or isAccessibleTableRowSelectedMethod == 0");2582return FALSE;2583}25842585PrintDebugString("[ERROR]: AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected failed");2586return FALSE;2587}25882589BOOL2590AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections(jobject accessibleTable, jint count,2591jint *selections) {25922593jthrowable exception;25942595PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections(%p, %d %p)",2596accessibleTable, count, selections);25972598if (getAccessibleTableRowSelectionsMethod == (jmethodID) 0) {2599return FALSE;2600}2601// Get the table row selections2602for (int i = 0; i < count; i++) {26032604selections[i] = jniEnv->CallIntMethod(accessBridgeObject,2605getAccessibleTableRowSelectionsMethod,2606accessibleTable,2607i);2608EXCEPTION_CHECK("##### Getting AccessibleTableRowSelections - call to CallIntMethod()", FALSE);2609PrintDebugString("[INFO]: ##### table row selection[%d] = %d", i, selections[i]);2610}26112612PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections succeeded");2613return TRUE;2614}261526162617jint2618AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount(jobject accessibleTable) {26192620jthrowable exception;2621jint count;26222623PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount(%p)",2624accessibleTable);26252626// Get the table column selection count2627if (getAccessibleTableColumnSelectionCountMethod != (jmethodID) 0) {2628count = jniEnv->CallIntMethod(accessBridgeObject,2629getAccessibleTableColumnSelectionCountMethod,2630accessibleTable);2631EXCEPTION_CHECK("##### Getting AccessibleTableColumnSelectionCount - call to CallIntMethod()", FALSE);2632PrintDebugString("[INFO]: ##### table column selection count = %d", count);2633return count;2634} else {2635PrintDebugString("[ERROR]: either env == 0 or getAccessibleRowCountMethod == 0");2636return 0;2637}26382639PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount failed");2640return 0;2641}26422643BOOL2644AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected(jobject accessibleTable, jint column) {2645jthrowable exception;2646BOOL result;26472648PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected(%p, %d)",2649accessibleTable, column);26502651if (isAccessibleTableColumnSelectedMethod != (jmethodID) 0) {2652result = jniEnv->CallBooleanMethod(accessBridgeObject,2653isAccessibleTableColumnSelectedMethod,2654accessibleTable, column);2655EXCEPTION_CHECK("##### Getting isAccessibleTableColumnSelected - call to CallBooleanMethod()", FALSE);2656PrintDebugString("[INFO]: ##### table column isSelected = %d", result);2657return result;2658} else {2659PrintDebugString("[ERROR]: either env == 0 or isAccessibleTableColumnSelectedMethod == 0");2660return FALSE;2661}26622663PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected failed");2664return FALSE;2665}26662667BOOL2668AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections(jobject accessibleTable, jint count,2669jint *selections) {2670jthrowable exception;26712672PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections(%p, %d, %p)",2673accessibleTable, count, selections);26742675if (getAccessibleTableColumnSelectionsMethod == (jmethodID) 0) {2676return FALSE;2677}2678// Get the table column selections2679for (int i = 0; i < count; i++) {26802681selections[i] = jniEnv->CallIntMethod(accessBridgeObject,2682getAccessibleTableColumnSelectionsMethod,2683accessibleTable,2684i);2685EXCEPTION_CHECK("##### Getting AccessibleTableColumnSelections - call to CallIntMethod()", FALSE);2686PrintDebugString("[INFO]: ##### table Column selection[%d] = %d", i, selections[i]);2687}26882689PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections succeeded");2690return TRUE;2691}269226932694jint2695AccessBridgeJavaEntryPoints::getAccessibleTableRow(jobject accessibleTable, jint index) {2696jthrowable exception;2697jint result;26982699PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRow(%p, index=%d)",2700accessibleTable, index);27012702if (getAccessibleTableRowMethod != (jmethodID) 0) {2703result = jniEnv->CallIntMethod(accessBridgeObject,2704getAccessibleTableRowMethod,2705accessibleTable, index);2706EXCEPTION_CHECK("##### Getting AccessibleTableRow - call to CallIntMethod()", FALSE);2707PrintDebugString("[INFO]: ##### table row = %d", result);2708return result;2709} else {2710PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowMethod == 0");2711return -1;2712}27132714PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRow failed");2715return -1;2716}27172718jint2719AccessBridgeJavaEntryPoints::getAccessibleTableColumn(jobject accessibleTable, jint index) {2720jthrowable exception;2721jint result;27222723PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumn(%p, index=%d)",2724accessibleTable, index);27252726if (getAccessibleTableColumnMethod != (jmethodID) 0) {2727result = jniEnv->CallIntMethod(accessBridgeObject,2728getAccessibleTableColumnMethod,2729accessibleTable, index);2730EXCEPTION_CHECK("##### Getting AccessibleTableColumn - call to CallIntMethod()", FALSE);2731PrintDebugString("[INFO]: ##### table column = %d", result);2732return result;2733} else {2734PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnMethod == 0");2735return -1;2736}27372738PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumn failed");2739return -1;2740}27412742jint2743AccessBridgeJavaEntryPoints::getAccessibleTableIndex(jobject accessibleTable, jint row, jint column) {2744jthrowable exception;2745jint result;27462747PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableIndex(%p, row=%d, col=%d)",2748accessibleTable, row, column);27492750if (getAccessibleTableIndexMethod != (jmethodID) 0) {2751result = jniEnv->CallIntMethod(accessBridgeObject,2752getAccessibleTableIndexMethod,2753accessibleTable, row, column);2754EXCEPTION_CHECK("##### Getting getAccessibleTableIndex - call to CallIntMethod()", FALSE);2755PrintDebugString("[INFO]: ##### table index = %d", result);2756return result;2757} else {2758PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableIndexMethod == 0");2759return -1;2760}27612762PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableIndex failed");2763return -1;2764}27652766/********** end AccessibleTable routines ******************************/276727682769/********** begin AccessibleRelationSet routines **********************/27702771BOOL2772AccessBridgeJavaEntryPoints::getAccessibleRelationSet(jobject accessibleContext,2773AccessibleRelationSetInfo *relationSet) {27742775jthrowable exception;2776const wchar_t *stringBytes;2777jsize length;27782779PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleRelationSet(%p, %p)",2780accessibleContext, relationSet);27812782if (getAccessibleRelationCountMethod == (jmethodID) 0 ||2783getAccessibleRelationKeyMethod == (jmethodID) 0 ||2784getAccessibleRelationTargetCountMethod == (jmethodID) 0 ||2785getAccessibleRelationTargetMethod == (jmethodID) 0) {2786return FALSE;2787}27882789// Get the relations set count2790relationSet->relationCount = jniEnv->CallIntMethod(accessBridgeObject,2791getAccessibleRelationCountMethod,2792accessibleContext);2793EXCEPTION_CHECK("##### Getting AccessibleRelationCount - call to CallIntMethod()", FALSE);2794PrintDebugString("[INFO]: ##### AccessibleRelation count = %d", relationSet->relationCount);279527962797// Get the relation set2798for (int i = 0; i < relationSet->relationCount && i < MAX_RELATIONS; i++) {27992800jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,2801getAccessibleRelationKeyMethod,2802accessibleContext,2803i);28042805EXCEPTION_CHECK("Getting AccessibleRelationKey - call to CallObjectMethod()", FALSE);2806if (js != (jstring) 0) {2807stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);2808EXCEPTION_CHECK("Getting AccessibleRelation key - call to GetStringChars()", FALSE);2809wcsncpy(relationSet->relations[i].key, stringBytes, (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t)));2810length = jniEnv->GetStringLength(js);2811relationSet->relations[i].key [length < (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t)) ?2812length : (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t))-2] = (wchar_t) 0;2813EXCEPTION_CHECK("Getting AccessibleRelation key - call to GetStringLength()", FALSE);2814jniEnv->ReleaseStringChars(js, stringBytes);2815EXCEPTION_CHECK("Getting AccessibleRelation key - call to ReleaseStringChars()", FALSE);2816// jniEnv->CallVoidMethod(accessBridgeObject,2817// decrementReferenceMethod, js);2818//EXCEPTION_CHECK("Getting AccessibleRelation key - call to CallVoidMethod()", FALSE);2819PrintDebugString("[INFO]: ##### AccessibleRelation key = %ls", relationSet->relations[i].key );2820jniEnv->DeleteLocalRef(js);2821EXCEPTION_CHECK("Getting AccessibleRelation key - call to DeleteLocalRef()", FALSE);2822} else {2823PrintDebugString("[WARN]: AccessibleRelation key is null.");2824relationSet->relations[i].key [0] = (wchar_t) 0;2825}28262827relationSet->relations[i].targetCount = jniEnv->CallIntMethod(accessBridgeObject,2828getAccessibleRelationTargetCountMethod,2829accessibleContext,2830i);28312832for (int j = 0; j < relationSet->relations[i].targetCount && j < MAX_RELATION_TARGETS; j++) {2833jobject target = jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleRelationTargetMethod,2834accessibleContext, i, j);2835EXCEPTION_CHECK("Getting AccessibleRelationSet - call to CallObjectMethod()", FALSE);2836jobject globalRef = jniEnv->NewGlobalRef(target);2837EXCEPTION_CHECK("Getting AccessibleRelationSet - call to NewGlobalRef()", FALSE);2838relationSet->relations[i].targets[j] = (JOBJECT64)globalRef;2839PrintDebugString("[INFO]: relation set item: %p", globalRef);2840}2841}28422843PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleRelationSet succeeded");2844return TRUE;2845}284628472848/********** end AccessibleRelationSet routines ************************/284928502851/********** begin AccessibleHypertext routines **********************/28522853BOOL2854AccessBridgeJavaEntryPoints::getAccessibleHypertext(jobject accessibleContext,2855AccessibleHypertextInfo *hypertext) {28562857jthrowable exception;2858const wchar_t *stringBytes;2859jsize length;28602861PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertext(%p, %p)",2862accessibleContext, hypertext);28632864// get the AccessibleHypertext2865jobject ht = jniEnv->CallObjectMethod(accessBridgeObject,2866getAccessibleHypertextMethod,2867accessibleContext);2868EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to CallObjectMethod()", FALSE);2869jobject globalRef = jniEnv->NewGlobalRef(ht);2870EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to NewGlobalRef()", FALSE);2871hypertext->accessibleHypertext = (JOBJECT64)globalRef;2872PrintDebugString("[INFO]: ##### AccessibleHypertext = %p", globalRef);28732874if (hypertext->accessibleHypertext == 0) {2875PrintDebugString("[WARN]: ##### null AccessibleHypertext; returning FALSE");2876return false;2877}28782879// get the hyperlink count2880hypertext->linkCount = jniEnv->CallIntMethod(accessBridgeObject,2881getAccessibleHyperlinkCountMethod,accessibleContext);28822883EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", FALSE);2884PrintDebugString("[INFO]: ##### hyperlink count = %d", hypertext->linkCount);288528862887// get the hypertext links2888for (int i = 0; i < hypertext->linkCount && i < MAX_HYPERLINKS; i++) {28892890// get the hyperlink2891jobject hl = jniEnv->CallObjectMethod(accessBridgeObject,2892getAccessibleHyperlinkMethod,2893accessibleContext,2894i);2895EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE);2896jobject globalRef = jniEnv->NewGlobalRef(hl);2897EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE);2898hypertext->links[i].accessibleHyperlink = (JOBJECT64)globalRef;2899PrintDebugString("[INFO]: ##### AccessibleHyperlink = %p", globalRef);29002901// get the hyperlink text2902jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,2903getAccessibleHyperlinkTextMethod,2904hypertext->links[i].accessibleHyperlink,2905i);29062907EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE);2908if (js != (jstring) 0) {2909stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);2910EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE);2911wcsncpy(hypertext->links[i].text, stringBytes, (sizeof(hypertext->links[i].text) / sizeof(wchar_t)));2912length = jniEnv->GetStringLength(js);2913if (length >= (sizeof(hypertext->links[i].text) / sizeof(wchar_t))) {2914length = (sizeof(hypertext->links[i].text) / sizeof(wchar_t)) - 2;2915}2916hypertext->links[i].text[length] = (wchar_t) 0;2917EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE);2918jniEnv->ReleaseStringChars(js, stringBytes);2919EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE);2920// jniEnv->CallVoidMethod(accessBridgeObject,2921// decrementReferenceMethod, js);2922//EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE);2923PrintDebugString("[INFO]: ##### AccessibleHyperlink text = %ls", hypertext->links[i].text );2924jniEnv->DeleteLocalRef(js);2925EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE);2926} else {2927PrintDebugString("[WARN]: AccessibleHyperlink text is null.");2928hypertext->links[i].text[0] = (wchar_t) 0;2929}29302931hypertext->links[i].startIndex = jniEnv->CallIntMethod(accessBridgeObject,2932getAccessibleHyperlinkStartIndexMethod,2933hypertext->links[i].accessibleHyperlink,2934i);2935EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE);2936PrintDebugString("[INFO]: ##### hyperlink start index = %d", hypertext->links[i].startIndex);293729382939hypertext->links[i].endIndex = jniEnv->CallIntMethod(accessBridgeObject,2940getAccessibleHyperlinkEndIndexMethod,2941hypertext->links[i].accessibleHyperlink,2942i);2943EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE);2944PrintDebugString("[INFO]: ##### hyperlink end index = %d", hypertext->links[i].endIndex);29452946}29472948PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertext succeeded");2949return TRUE;2950}29512952/*2953* Activates an AccessibleHyperlink2954*/2955BOOL2956AccessBridgeJavaEntryPoints::activateAccessibleHyperlink(jobject accessibleContext,2957jobject accessibleHyperlink) {29582959jthrowable exception;2960BOOL returnVal;29612962PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::activateAccessibleHyperlink(%p, %p):",2963accessibleContext, accessibleHyperlink);29642965if (activateAccessibleHyperlinkMethod != (jmethodID) 0) {2966returnVal = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, activateAccessibleHyperlinkMethod,2967accessibleContext, accessibleHyperlink);2968EXCEPTION_CHECK("activateAccessibleHyperlink - call to CallBooleanMethod()", FALSE);2969return returnVal;2970} else {2971PrintDebugString("[ERROR]: either jniEnv == 0 or activateAccessibleHyperlinkMethod == 0");2972return FALSE;2973}2974}297529762977/*2978* This method is used to iterate through the hyperlinks in a component. It2979* returns hypertext information for a component starting at hyperlink index2980* nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will2981* be returned for each call to this method.2982* returns FALSE on error.2983*/2984BOOL2985AccessBridgeJavaEntryPoints::getAccessibleHypertextExt(const jobject accessibleContext,2986const jint nStartIndex,2987/* OUT */ AccessibleHypertextInfo *hypertext) {29882989jthrowable exception;2990const wchar_t *stringBytes;2991jsize length;2992PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertextExt(%p, %p, startIndex = %d)",2993accessibleContext, hypertext, nStartIndex);29942995// get the AccessibleHypertext2996jobject ht = jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleHypertextMethod,2997accessibleContext);2998EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to CallObjectMethod()", FALSE);2999jobject globalRef = jniEnv->NewGlobalRef(ht);3000EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to NewGlobalRef()", FALSE);3001hypertext->accessibleHypertext = (JOBJECT64)globalRef;3002PrintDebugString("[INFO]: ##### AccessibleHypertext = %p", globalRef);3003if (hypertext->accessibleHypertext == 0) {3004PrintDebugString("[WARN]: ##### null AccessibleHypertext; returning FALSE");3005return FALSE;3006}30073008// get the hyperlink count3009hypertext->linkCount = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHyperlinkCountMethod,3010accessibleContext);3011EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", FALSE);3012PrintDebugString("[INFO]: ##### hyperlink count = %d", hypertext->linkCount);30133014if (nStartIndex >= hypertext->linkCount) {3015return FALSE;3016}30173018// get the hypertext links3019// NOTE: To avoid a crash when there are more than MAX_HYPERLINKS (64) links3020// in the document, test for i < MAX_HYPERLINKS in addition to3021// i < hypertext->linkCount3022int bufIndex = 0;3023for (int i = nStartIndex; (i < hypertext->linkCount) && (i < nStartIndex + MAX_HYPERLINKS); i++) {3024PrintDebugString("[INFO]: getting hyperlink %d ...", i);30253026// get the hyperlink3027jobject hl = jniEnv->CallObjectMethod(accessBridgeObject,3028getAccessibleHyperlinkMethod,3029hypertext->accessibleHypertext,3030i);3031EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE);3032jobject globalRef = jniEnv->NewGlobalRef(hl);3033EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE);3034hypertext->links[bufIndex].accessibleHyperlink = (JOBJECT64)globalRef;3035PrintDebugString("[INFO]: ##### AccessibleHyperlink = %p", globalRef);30363037// get the hyperlink text3038jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,3039getAccessibleHyperlinkTextMethod,3040hypertext->links[bufIndex].accessibleHyperlink,3041i);30423043EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE);3044if (js != (jstring) 0) {3045stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3046EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE);3047wcsncpy(hypertext->links[bufIndex].text, stringBytes,3048(sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t)));3049length = jniEnv->GetStringLength(js);3050if (length >= (sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t))) {3051length = (sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t)) - 2;3052}3053hypertext->links[bufIndex].text[length] = (wchar_t) 0;3054EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE);3055jniEnv->ReleaseStringChars(js, stringBytes);3056EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE);3057// jniEnv->CallVoidMethod(accessBridgeObject,3058// decrementReferenceMethod, js);3059//EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE);3060PrintDebugString("[INFO]: ##### AccessibleHyperlink text = %ls", hypertext->links[bufIndex].text );3061jniEnv->DeleteLocalRef(js);3062EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE);30633064} else {3065PrintDebugString("[WARN]: AccessibleHyperlink text is null.");3066hypertext->links[bufIndex].text[0] = (wchar_t) 0;3067}30683069hypertext->links[bufIndex].startIndex = jniEnv->CallIntMethod(accessBridgeObject,3070getAccessibleHyperlinkStartIndexMethod,3071hypertext->links[bufIndex].accessibleHyperlink,3072i);3073EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE);3074PrintDebugString("[INFO]: ##### hyperlink start index = %d", hypertext->links[bufIndex].startIndex);30753076hypertext->links[bufIndex].endIndex = jniEnv->CallIntMethod(accessBridgeObject,3077getAccessibleHyperlinkEndIndexMethod,3078hypertext->links[bufIndex].accessibleHyperlink,3079i);3080EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE);3081PrintDebugString("[INFO]: ##### hyperlink end index = %d", hypertext->links[bufIndex].endIndex);30823083bufIndex++;3084}30853086PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertextExt succeeded");3087return TRUE;3088}30893090jint AccessBridgeJavaEntryPoints::getAccessibleHyperlinkCount(const jobject accessibleContext) {30913092jthrowable exception;30933094PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHyperlinkCount(%X)",3095accessibleContext);30963097if (getAccessibleHyperlinkCountMethod == (jmethodID)0) {3098return -1;3099}31003101// get the hyperlink count3102jint linkCount = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHyperlinkCountMethod,3103accessibleContext);3104EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", -1);3105PrintDebugString("[INFO]: ##### hyperlink count = %d", linkCount);31063107return linkCount;3108}310931103111jint AccessBridgeJavaEntryPoints::getAccessibleHypertextLinkIndex(const jobject hypertext,3112const jint nIndex) {31133114jthrowable exception;31153116PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertextLinkIndex(%p, index = %d)",3117hypertext, nIndex);31183119if (getAccessibleHypertextLinkIndexMethod == (jmethodID)0) {3120return -1;3121}31223123// get the hyperlink index3124jint index = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHypertextLinkIndexMethod,3125hypertext, nIndex);31263127EXCEPTION_CHECK("##### Getting hyperlink index - call to CallIntMethod()", -1);3128PrintDebugString("[INFO]: ##### hyperlink index = %d", index);31293130return index;3131}31323133BOOL AccessBridgeJavaEntryPoints::getAccessibleHyperlink(jobject hypertext,3134const jint index,3135/* OUT */ AccessibleHyperlinkInfo *info) {31363137jthrowable exception;3138const wchar_t *stringBytes;3139jsize length;31403141PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHyperlink(%p, index = %d)",3142hypertext, index);314331443145// get the hyperlink3146jobject hl = jniEnv->CallObjectMethod(accessBridgeObject,3147getAccessibleHyperlinkMethod,3148hypertext,3149index);3150EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE);3151jobject globalRef = jniEnv->NewGlobalRef(hl);3152EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE);3153info->accessibleHyperlink = (JOBJECT64)globalRef;3154PrintDebugString("[INFO]: ##### AccessibleHyperlink = %p", globalRef);31553156// get the hyperlink text3157jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,3158getAccessibleHyperlinkTextMethod,3159info->accessibleHyperlink,3160index);31613162EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE);3163if (js != (jstring) 0) {3164stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3165EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE);3166wcsncpy(info->text, stringBytes,3167(sizeof(info->text) / sizeof(wchar_t)));3168length = jniEnv->GetStringLength(js);3169if (length >= (sizeof(info->text) / sizeof(wchar_t))) {3170length = (sizeof(info->text) / sizeof(wchar_t)) - 2;3171}3172info->text[length] = (wchar_t) 0;3173EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE);3174jniEnv->ReleaseStringChars(js, stringBytes);3175EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE);3176// jniEnv->CallVoidMethod(accessBridgeObject,3177// decrementReferenceMethod, js);3178//EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE);3179PrintDebugString("[INFO]: ##### AccessibleHyperlink text = %ls", info->text );3180jniEnv->DeleteLocalRef(js);3181EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE);31823183} else {3184PrintDebugString("[WARN]: AccessibleHyperlink text is null.");3185info->text[0] = (wchar_t) 0;3186}31873188info->startIndex = jniEnv->CallIntMethod(accessBridgeObject,3189getAccessibleHyperlinkStartIndexMethod,3190info->accessibleHyperlink,3191index);3192EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE);3193PrintDebugString("[INFO]: ##### hyperlink start index = %d", info->startIndex);31943195info->endIndex = jniEnv->CallIntMethod(accessBridgeObject,3196getAccessibleHyperlinkEndIndexMethod,3197info->accessibleHyperlink,3198index);3199EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE);3200PrintDebugString("[INFO]: ##### hyperlink end index = %d", info->endIndex);32013202return TRUE;3203}320432053206/********** end AccessibleHypertext routines ************************/32073208// Accessible Keybinding methods3209BOOL AccessBridgeJavaEntryPoints::getAccessibleKeyBindings(jobject accessibleContext,3210AccessibleKeyBindings *keyBindings) {32113212jthrowable exception;32133214PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleKeyBindings(%p, %p)",3215accessibleContext, keyBindings);32163217if (getAccessibleKeyBindingsCountMethod == (jmethodID) 0 ||3218getAccessibleKeyBindingCharMethod == (jmethodID) 0 ||3219getAccessibleKeyBindingModifiersMethod == (jmethodID) 0) {3220return FALSE;3221}32223223// get the key binding count3224keyBindings->keyBindingsCount = jniEnv->CallIntMethod(accessBridgeObject,3225getAccessibleKeyBindingsCountMethod, accessibleContext);32263227EXCEPTION_CHECK("##### Getting key bindings count - call to CallIntMethod()", FALSE);32283229PrintDebugString("[INFO]: ##### key bindings count = %d", keyBindings->keyBindingsCount);32303231// get the key bindings3232for (int i = 0; i < keyBindings->keyBindingsCount && i < MAX_KEY_BINDINGS; i++) {32333234// get the key binding character3235keyBindings->keyBindingInfo[i].character = jniEnv->CallCharMethod(accessBridgeObject,3236getAccessibleKeyBindingCharMethod,3237accessibleContext,3238i);3239EXCEPTION_CHECK("##### Getting key binding character - call to CallCharMethod()", FALSE);3240PrintDebugString("[INFO]: ##### key binding character = %c"\3241" ##### key binding character in hex = %hx"\3242, keyBindings->keyBindingInfo[i].character, keyBindings->keyBindingInfo[i].character);32433244// get the key binding modifiers3245keyBindings->keyBindingInfo[i].modifiers = jniEnv->CallIntMethod(accessBridgeObject,3246getAccessibleKeyBindingModifiersMethod,3247accessibleContext,3248i);3249EXCEPTION_CHECK("##### Getting key binding modifiers - call to CallIntMethod()", FALSE);3250PrintDebugString("[INFO]: ##### key binding modifiers = %x", keyBindings->keyBindingInfo[i].modifiers);3251}3252return FALSE;3253}32543255// AccessibleIcon methods3256BOOL AccessBridgeJavaEntryPoints::getAccessibleIcons(jobject accessibleContext,3257AccessibleIcons *icons) {32583259jthrowable exception;3260const wchar_t *stringBytes;3261jsize length;32623263PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleIcons(%p, %p)",3264accessibleContext, icons);32653266if (getAccessibleIconsCountMethod == (jmethodID) 0 ||3267getAccessibleIconDescriptionMethod == (jmethodID) 0 ||3268getAccessibleIconHeightMethod == (jmethodID) 0 ||3269getAccessibleIconWidthMethod == (jmethodID) 0) {3270PrintDebugString("[WARN]: ##### missing method(s) !!!");3271return FALSE;3272}327332743275// get the icons count3276icons->iconsCount = jniEnv->CallIntMethod(accessBridgeObject,3277getAccessibleIconsCountMethod, accessibleContext);32783279EXCEPTION_CHECK("##### Getting icons count - call to CallIntMethod()", FALSE);3280PrintDebugString("[INFO]: ##### icons count = %d", icons->iconsCount);328132823283// get the icons3284for (int i = 0; i < icons->iconsCount && i < MAX_ICON_INFO; i++) {32853286// get the icon description3287jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,3288getAccessibleIconDescriptionMethod,3289accessibleContext,3290i);32913292EXCEPTION_CHECK("Getting icon description - call to CallObjectMethod()", FALSE);3293if (js != (jstring) 0) {3294stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3295EXCEPTION_CHECK("Getting AccessibleIcon description - call to GetStringChars()", FALSE);3296wcsncpy(icons->iconInfo[i].description, stringBytes, (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t)));3297length = jniEnv->GetStringLength(js);3298if (length >= (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t))) {3299length = (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t)) - 2;3300}3301icons->iconInfo[i].description[length] = (wchar_t) 0;3302EXCEPTION_CHECK("Getting AccessibleIcon description - call to GetStringLength()", FALSE);3303jniEnv->ReleaseStringChars(js, stringBytes);3304EXCEPTION_CHECK("Getting AccessibleIcon description - call to ReleaseStringChars()", FALSE);3305// jniEnv->CallVoidMethod(accessBridgeObject,3306// decrementReferenceMethod, js);3307//EXCEPTION_CHECK("Getting AccessibleIcon description - call to CallVoidMethod()", FALSE);3308PrintDebugString("[INFO]: ##### AccessibleIcon description = %ls", icons->iconInfo[i].description );3309jniEnv->DeleteLocalRef(js);3310EXCEPTION_CHECK("Getting AccessibleIcon description - call to DeleteLocalRef()", FALSE);3311} else {3312PrintDebugString("[WARN]: AccessibleIcon description is null.");3313icons->iconInfo[i].description[0] = (wchar_t) 0;3314}331533163317// get the icon height3318icons->iconInfo[i].height = jniEnv->CallIntMethod(accessBridgeObject,3319getAccessibleIconHeightMethod,3320accessibleContext,3321i);3322EXCEPTION_CHECK("##### Getting icon height - call to CallIntMethod()", FALSE);3323PrintDebugString("[INFO]: ##### icon height = %d", icons->iconInfo[i].height);33243325// get the icon width3326icons->iconInfo[i].width = jniEnv->CallIntMethod(accessBridgeObject,3327getAccessibleIconWidthMethod,3328accessibleContext,3329i);3330EXCEPTION_CHECK("##### Getting icon width - call to CallIntMethod()", FALSE);3331PrintDebugString("[INFO]: ##### icon width = %d", icons->iconInfo[i].width);3332}3333return FALSE;3334}33353336// AccessibleActionMethods3337BOOL AccessBridgeJavaEntryPoints::getAccessibleActions(jobject accessibleContext,3338AccessibleActions *actions) {33393340jthrowable exception;3341const wchar_t *stringBytes;3342jsize length;33433344PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleIcons(%p, %p)",3345accessibleContext, actions);33463347if (getAccessibleActionsCountMethod == (jmethodID) 0 ||3348getAccessibleActionNameMethod == (jmethodID) 0) {3349PrintDebugString("[WARN]: ##### missing method(s) !!!");3350return FALSE;3351}335233533354// get the icons count3355actions->actionsCount = jniEnv->CallIntMethod(accessBridgeObject,3356getAccessibleActionsCountMethod,accessibleContext);33573358EXCEPTION_CHECK("##### Getting actions count - call to CallIntMethod()", FALSE);3359PrintDebugString("[INFO]: ##### key actions count = %d", actions->actionsCount);336033613362// get the actions3363for (int i = 0; i < actions->actionsCount && i < MAX_ACTION_INFO; i++) {33643365// get the action name3366jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,3367getAccessibleActionNameMethod,3368accessibleContext,3369i);33703371EXCEPTION_CHECK("Getting Action Name - call to CallObjectMethod()", FALSE);3372if (js != (jstring) 0) {3373stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3374EXCEPTION_CHECK("Getting AccessibleAction Name - call to GetStringChars()", FALSE);3375wcsncpy(actions->actionInfo[i].name , stringBytes, (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t)));3376length = jniEnv->GetStringLength(js);3377if (length >= (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t))) {3378length = (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t)) - 2;3379}3380actions->actionInfo[i].name [length] = (wchar_t) 0;3381EXCEPTION_CHECK("Getting AccessibleAction name - call to GetStringLength()", FALSE);3382jniEnv->ReleaseStringChars(js, stringBytes);3383EXCEPTION_CHECK("Getting AccessibleAction name - call to ReleaseStringChars()", FALSE);3384// jniEnv->CallVoidMethod(accessBridgeObject,3385// decrementReferenceMethod, js);3386//EXCEPTION_CHECK("Getting AccessibleAction name - call to CallVoidMethod()", FALSE);3387PrintDebugString("[INFO]: ##### AccessibleAction name = %ls", actions->actionInfo[i].name );3388jniEnv->DeleteLocalRef(js);3389EXCEPTION_CHECK("Getting AccessibleAction name - call to DeleteLocalRef()", FALSE);3390} else {3391PrintDebugString("[WARN]: AccessibleAction name is null.");3392actions->actionInfo[i].name [0] = (wchar_t) 0;3393}3394}3395return FALSE;3396}33973398BOOL AccessBridgeJavaEntryPoints::doAccessibleActions(jobject accessibleContext,3399AccessibleActionsToDo *actionsToDo,3400jint *failure) {34013402jthrowable exception;3403BOOL returnVal;34043405PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::doAccessibleActions(%p, #actions %d %s):",3406accessibleContext,3407actionsToDo->actionsCount,3408actionsToDo->actions[0].name);34093410if (doAccessibleActionsMethod == (jmethodID) 0) {3411*failure = 0;3412return FALSE;3413}34143415PrintDebugString("[INFO]: doing %d actions ...", actionsToDo->actionsCount);3416for (int i = 0; i < actionsToDo->actionsCount && i < MAX_ACTIONS_TO_DO; i++) {3417PrintDebugString("[INFO]: doing action %d: %s ...", i, actionsToDo->actions[i].name);34183419// create a Java String for the action name3420wchar_t *actionName = (wchar_t *)actionsToDo->actions[i].name;3421jstring javaName = jniEnv->NewString(actionName, (jsize)wcslen(actionName));3422if (javaName == 0) {3423PrintDebugString("[ERROR]: NewString failed");3424*failure = i;3425return FALSE;3426}34273428returnVal = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject, doAccessibleActionsMethod,3429accessibleContext, javaName);3430jniEnv->DeleteLocalRef(javaName);3431EXCEPTION_CHECK("doAccessibleActions - call to CallBooleanMethod()", FALSE);34323433if (returnVal != TRUE) {3434PrintDebugString("[ERROR]: Action %d failed", i);3435*failure = i;3436return FALSE;3437}3438}3439*failure = -1;3440return TRUE;3441}344234433444/********** AccessibleText routines ***********************************/34453446BOOL3447AccessBridgeJavaEntryPoints::getAccessibleTextInfo(jobject accessibleContext,3448AccessibleTextInfo *textInfo,3449jint x, jint y) {3450jthrowable exception;34513452// Verify the Java VM still exists and AccessibleContext is3453// an instance of AccessibleText3454if (verifyAccessibleText(accessibleContext) == FALSE) {3455return FALSE;3456}34573458PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextInfo(%p, %d, %d):",3459accessibleContext, x, y);34603461// Get the character count3462if (getAccessibleCharCountFromContextMethod != (jmethodID) 0) {3463textInfo->charCount = jniEnv->CallIntMethod(accessBridgeObject,3464getAccessibleCharCountFromContextMethod,3465accessibleContext);3466EXCEPTION_CHECK("Getting AccessibleCharCount - call to CallIntMethod()", FALSE);3467PrintDebugString("[INFO]: Char count = %d", textInfo->charCount);3468} else {3469PrintDebugString("[ERROR]: either env == 0 or getAccessibleCharCountFromContextMethod == 0");3470return FALSE;3471}34723473// Get the index of the caret3474if (getAccessibleCaretPositionFromContextMethod != (jmethodID) 0) {3475textInfo->caretIndex = jniEnv->CallIntMethod(accessBridgeObject,3476getAccessibleCaretPositionFromContextMethod,3477accessibleContext);3478EXCEPTION_CHECK("Getting AccessibleCaretPosition - call to CallIntMethod()", FALSE);3479PrintDebugString("[INFO]: Index at caret = %d", textInfo->caretIndex);3480} else {3481PrintDebugString("[ERROR]: either env == 0 or getAccessibleCaretPositionFromContextMethod == 0");3482return FALSE;3483}34843485// Get the index at the given point3486if (getAccessibleIndexAtPointFromContextMethod != (jmethodID) 0) {3487// If x or y is -1 return -13488if (x == -1 || y == -1) {3489textInfo->indexAtPoint = -1;3490} else {3491textInfo->indexAtPoint = jniEnv->CallIntMethod(accessBridgeObject,3492getAccessibleIndexAtPointFromContextMethod,3493accessibleContext, x, y);3494EXCEPTION_CHECK("Getting AccessibleIndexAtPoint - call to CallIntMethod()", FALSE);3495}3496PrintDebugString("[INFO]: Index at point = %d", textInfo->indexAtPoint);3497} else {3498PrintDebugString("[ERROR]: either env == 0 or getAccessibleIndexAtPointFromContextMethod == 0");3499return FALSE;3500}3501return TRUE;3502}35033504BOOL3505AccessBridgeJavaEntryPoints::getAccessibleTextItems(jobject accessibleContext,3506AccessibleTextItemsInfo *textItems, jint index) {3507jstring js;3508const wchar_t *stringBytes;3509jthrowable exception;3510jsize length;35113512PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextItems(%p):", accessibleContext);35133514// Verify the Java VM still exists and AccessibleContext is3515// an instance of AccessibleText3516if (verifyAccessibleText(accessibleContext) == FALSE) {3517return FALSE;3518}35193520// Get the letter at index3521if (getAccessibleLetterAtIndexFromContextMethod != (jmethodID) 0) {3522js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3523getAccessibleLetterAtIndexFromContextMethod,3524accessibleContext, index);3525EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to CallIntMethod()", FALSE);3526PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);3527if (js != (jstring) 0) {3528stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3529EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to GetStringChars()", FALSE);3530textItems->letter = stringBytes[0];3531jniEnv->ReleaseStringChars(js, stringBytes);3532EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to ReleaseStringChars()", FALSE);3533jniEnv->CallVoidMethod(accessBridgeObject,3534decrementReferenceMethod, js);3535EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to CallVoidMethod()", FALSE);3536PrintDebugString("[INFO]: Accessible Text letter = %c", textItems->letter);3537jniEnv->DeleteLocalRef(js);3538EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to DeleteLocalRef()", FALSE);3539} else {3540PrintDebugString("[WARN]: Accessible Text letter is null.");3541textItems->letter = (wchar_t) 0;3542}3543} else {3544PrintDebugString("[ERROR]: either env == 0 or getAccessibleLetterAtIndexFromContextMethod == 0");3545return FALSE;3546}354735483549// Get the word at index3550if (getAccessibleWordAtIndexFromContextMethod != (jmethodID) 0) {3551js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3552getAccessibleWordAtIndexFromContextMethod,3553accessibleContext, index);3554EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to CallIntMethod()", FALSE);3555PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);3556if (js != (jstring) 0) {3557stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3558EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to GetStringChars()", FALSE);3559wcsncpy(textItems->word, stringBytes, (sizeof(textItems->word) / sizeof(wchar_t)));3560length = jniEnv->GetStringLength(js);3561textItems->word[length < (sizeof(textItems->word) / sizeof(wchar_t)) ?3562length : (sizeof(textItems->word) / sizeof(wchar_t))-2] = (wchar_t) 0;3563EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to GetStringLength()", FALSE);3564jniEnv->ReleaseStringChars(js, stringBytes);3565EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to ReleaseStringChars()", FALSE);3566jniEnv->CallVoidMethod(accessBridgeObject,3567decrementReferenceMethod, js);3568EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to CallVoidMethod()", FALSE);3569wPrintDebugString(L"[INFO]: Accessible Text word = %ls", textItems->word);3570jniEnv->DeleteLocalRef(js);3571EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to DeleteLocalRef()", FALSE);3572} else {3573PrintDebugString("[WARN]: Accessible Text word is null.");3574textItems->word[0] = (wchar_t) 0;3575}3576} else {3577PrintDebugString("[ERROR]: either env == 0 or getAccessibleWordAtIndexFromContextMethod == 0");3578return FALSE;3579}35803581// Get the sentence at index3582if (getAccessibleSentenceAtIndexFromContextMethod != (jmethodID) 0) {3583js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3584getAccessibleSentenceAtIndexFromContextMethod,3585accessibleContext, index);3586EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to CallObjectMethod()", FALSE);3587PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);3588if (js != (jstring) 0) {3589stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3590EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to GetStringChars()", FALSE);3591wcsncpy(textItems->sentence, stringBytes, (sizeof(textItems->sentence) / sizeof(wchar_t))-2);3592length = jniEnv->GetStringLength(js);35933594if (length < sizeof(textItems->sentence) / sizeof(wchar_t)) {3595textItems->sentence[length] = (wchar_t) 0;3596} else {3597textItems->sentence[(sizeof(textItems->sentence) / sizeof(wchar_t))-2] = (wchar_t) 0;3598}3599EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to GetStringLength()", FALSE);3600jniEnv->ReleaseStringChars(js, stringBytes);3601EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to ReleaseStringChars()", FALSE);3602jniEnv->CallVoidMethod(accessBridgeObject,3603decrementReferenceMethod, js);3604EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to CallVoidMethod()", FALSE);3605wPrintDebugString(L"[INFO]: Accessible Text sentence = %ls", textItems->sentence);3606jniEnv->DeleteLocalRef(js);3607EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to DeleteLocalRef()", FALSE);3608} else {3609PrintDebugString("[WARN]: Accessible Text sentence is null.");3610textItems->sentence[0] = (wchar_t) 0;3611}3612} else {3613PrintDebugString("[ERROR]: either env == 0 or getAccessibleSentenceAtIndexFromContextMethod == 0");3614return FALSE;3615}36163617return TRUE;3618}36193620BOOL3621AccessBridgeJavaEntryPoints::getAccessibleTextSelectionInfo(jobject accessibleContext,3622AccessibleTextSelectionInfo *selectionInfo) {3623jstring js;3624const wchar_t *stringBytes;3625jthrowable exception;3626jsize length;36273628PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextSelectionInfo(%p):",3629accessibleContext);36303631// Verify the Java VM still exists and AccessibleContext is3632// an instance of AccessibleText3633if (verifyAccessibleText(accessibleContext) == FALSE) {3634return FALSE;3635}36363637// Get the selection start index3638if (getAccessibleTextSelectionStartFromContextMethod != (jmethodID) 0) {3639selectionInfo->selectionStartIndex = jniEnv->CallIntMethod(accessBridgeObject,3640getAccessibleTextSelectionStartFromContextMethod,3641accessibleContext);3642EXCEPTION_CHECK("Getting AccessibleTextSelectionStart - call to CallIntMethod()", FALSE);3643PrintDebugString("[INFO]: Selection start = %d", selectionInfo->selectionStartIndex);3644} else {3645PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextSelectionStartFromContextMethod == 0");3646return FALSE;3647}36483649// Get the selection end index3650if (getAccessibleTextSelectionEndFromContextMethod != (jmethodID) 0) {3651selectionInfo->selectionEndIndex = jniEnv->CallIntMethod(accessBridgeObject,3652getAccessibleTextSelectionEndFromContextMethod,3653accessibleContext);3654EXCEPTION_CHECK("Getting AccessibleTextSelectionEnd - call to CallIntMethod()", FALSE);3655PrintDebugString("[INFO]: Selection end = %d", selectionInfo->selectionEndIndex);3656} else {3657PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextSelectionEndFromContextMethod == 0");3658return FALSE;3659}36603661// Get the selected text3662if (getAccessibleTextSelectedTextFromContextMethod != (jmethodID) 0) {3663js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3664getAccessibleTextSelectedTextFromContextMethod,3665accessibleContext);3666EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to CallObjectMethod()", FALSE);3667PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);3668if (js != (jstring) 0) {3669stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3670EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to GetStringChars()", FALSE);3671wcsncpy(selectionInfo->selectedText, stringBytes, (sizeof(selectionInfo->selectedText) / sizeof(wchar_t)));3672length = jniEnv->GetStringLength(js);3673selectionInfo->selectedText[length < (sizeof(selectionInfo->selectedText) / sizeof(wchar_t)) ?3674length : (sizeof(selectionInfo->selectedText) / sizeof(wchar_t))-2] = (wchar_t) 0;3675EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to GetStringLength()", FALSE);3676jniEnv->ReleaseStringChars(js, stringBytes);3677EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to ReleaseStringChars()", FALSE);3678jniEnv->CallVoidMethod(accessBridgeObject,3679decrementReferenceMethod, js);3680EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to CallVoidMethod()", FALSE);3681PrintDebugString("[INFO]: Accessible's selected text = %s", selectionInfo->selectedText);3682jniEnv->DeleteLocalRef(js);3683EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to DeleteLocalRef()", FALSE);3684} else {3685PrintDebugString("[WARN]: Accessible's selected text is null.");3686selectionInfo->selectedText[0] = (wchar_t) 0;3687}3688} else {3689PrintDebugString("[WARN]: either env == 0 or getAccessibleTextSelectedTextFromContextMethod == 0");3690return FALSE;3691}3692return TRUE;3693}36943695BOOL3696AccessBridgeJavaEntryPoints::getAccessibleTextAttributes(jobject accessibleContext, jint index, AccessibleTextAttributesInfo *attributes) {3697jstring js;3698const wchar_t *stringBytes;3699jobject AttributeSet;3700jthrowable exception;3701jsize length;37023703PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextAttributes(%p):", accessibleContext);37043705// Verify the Java VM still exists and AccessibleContext is3706// an instance of AccessibleText3707if (verifyAccessibleText(accessibleContext) == FALSE) {3708return FALSE;3709}37103711if (accessibleContext == (jobject) 0) {3712PrintDebugString("[WARN]: passed in AccessibleContext == null! (oops)");37133714attributes->bold = FALSE;3715attributes->italic = FALSE;3716attributes->underline = FALSE;3717attributes->strikethrough = FALSE;3718attributes->superscript = FALSE;3719attributes->subscript = FALSE;3720attributes->backgroundColor[0] = (wchar_t) 0;3721attributes->foregroundColor[0] = (wchar_t) 0;3722attributes->fontFamily[0] = (wchar_t) 0;3723attributes->fontSize = -1;3724attributes->alignment = -1;3725attributes->bidiLevel = -1;3726attributes->firstLineIndent = -1;3727attributes->leftIndent = -1;3728attributes->rightIndent = -1;3729attributes->lineSpacing = -1;3730attributes->spaceAbove = -1;3731attributes->spaceBelow = -1;3732attributes->fullAttributesString[0] = (wchar_t) 0;37333734return (FALSE);3735}37363737// Get the AttributeSet3738if (getAccessibleAttributeSetAtIndexFromContextMethod != (jmethodID) 0) {3739PrintDebugString("[INFO]: Getting AttributeSet at index...");3740AttributeSet = jniEnv->CallObjectMethod(accessBridgeObject,3741getAccessibleAttributeSetAtIndexFromContextMethod,3742accessibleContext, index);3743EXCEPTION_CHECK("Getting AccessibleAttributeSetAtIndex - call to CallObjectMethod()", FALSE);3744} else {3745PrintDebugString("[ERROR]: either env == 0 or getAccessibleAttributeSetAtIndexFromContextMethod == 0");3746return FALSE;3747}37483749// It is legal for the AttributeSet object to be null, in which case we return false!3750if (AttributeSet == (jobject) 0) {3751PrintDebugString("[WARN]: AttributeSet returned at index is null (this is legal! - see AWT in J2SE 1.3");37523753attributes->bold = FALSE;3754attributes->italic = FALSE;3755attributes->underline = FALSE;3756attributes->strikethrough = FALSE;3757attributes->superscript = FALSE;3758attributes->subscript = FALSE;3759attributes->backgroundColor[0] = (wchar_t) 0;3760attributes->foregroundColor[0] = (wchar_t) 0;3761attributes->fontFamily[0] = (wchar_t) 0;3762attributes->fontSize = -1;3763attributes->alignment = -1;3764attributes->bidiLevel = -1;3765attributes->firstLineIndent = -1;3766attributes->leftIndent = -1;3767attributes->rightIndent = -1;3768attributes->lineSpacing = -1;3769attributes->spaceAbove = -1;3770attributes->spaceBelow = -1;3771attributes->fullAttributesString[0] = (wchar_t) 0;37723773return (FALSE);3774}37753776// Get the bold setting3777if (getBoldFromAttributeSetMethod != (jmethodID) 0) {3778PrintDebugString("[INFO]: Getting bold from AttributeSet...");3779attributes->bold = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3780getBoldFromAttributeSetMethod,3781AttributeSet);3782EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to CallBooleanMethod()", FALSE);3783} else {3784PrintDebugString("[ERROR]: either env == 0 or getBoldFromAttributeSetMethod == 0");3785jniEnv->CallVoidMethod(accessBridgeObject,3786decrementReferenceMethod, AttributeSet);3787EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to CallVoidMethod()", FALSE);3788jniEnv->DeleteLocalRef(AttributeSet);3789EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to DeleteLocalRef()", FALSE);3790return FALSE;3791}37923793// Get the italic setting3794if (getItalicFromAttributeSetMethod != (jmethodID) 0) {3795PrintDebugString("[INFO]: Getting italic from AttributeSet...");3796attributes->italic = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3797getItalicFromAttributeSetMethod,3798AttributeSet);3799EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to CallBooleanMethod()", FALSE);3800} else {3801PrintDebugString("[ERROR]: either env == 0 or getItalicdFromAttributeSetMethod == 0");3802jniEnv->CallVoidMethod(accessBridgeObject,3803decrementReferenceMethod, AttributeSet);3804EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to CallVoidMethod()", FALSE);3805jniEnv->DeleteLocalRef(AttributeSet);3806EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to DeleteLocalRef()", FALSE);3807return FALSE;3808}38093810// Get the underline setting3811if (getUnderlineFromAttributeSetMethod != (jmethodID) 0) {3812PrintDebugString("[INFO]: Getting underline from AttributeSet...");3813attributes->underline = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3814getUnderlineFromAttributeSetMethod,3815AttributeSet);3816EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to CallBooleanMethod()", FALSE);3817} else {3818PrintDebugString("[ERROR]: either env == 0 or getUnderlineFromAttributeSetMethod == 0");3819jniEnv->CallVoidMethod(accessBridgeObject,3820decrementReferenceMethod, AttributeSet);3821EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to CallVoidMethod()", FALSE);3822jniEnv->DeleteLocalRef(AttributeSet);3823EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to DeleteLocalRef()", FALSE);3824return FALSE;3825}38263827// Get the strikethrough setting3828if (getStrikethroughFromAttributeSetMethod != (jmethodID) 0) {3829PrintDebugString("[INFO]: Getting strikethrough from AttributeSet...");3830attributes->strikethrough = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3831getStrikethroughFromAttributeSetMethod,3832AttributeSet);3833EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to CallBooleanMethod()", FALSE);3834} else {3835PrintDebugString("[ERROR]: either env == 0 or getStrikethroughFromAttributeSetMethod == 0");3836jniEnv->CallVoidMethod(accessBridgeObject,3837decrementReferenceMethod, AttributeSet);3838EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to CallVoidMethod()", FALSE);3839jniEnv->DeleteLocalRef(AttributeSet);3840EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to DeleteLocalRef()", FALSE);3841return FALSE;3842}38433844// Get the superscript setting3845if (getSuperscriptFromAttributeSetMethod != (jmethodID) 0) {3846PrintDebugString("[INFO]: Getting superscript from AttributeSet...");3847attributes->superscript = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3848getSuperscriptFromAttributeSetMethod,3849AttributeSet);3850EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to CallBooleanMethod()", FALSE);3851} else {3852PrintDebugString("[ERROR]: either env == 0 or getSuperscripteFromAttributeSetMethod == 0");3853jniEnv->CallVoidMethod(accessBridgeObject,3854decrementReferenceMethod, AttributeSet);3855EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to CallVoidMethod()", FALSE);3856jniEnv->DeleteLocalRef(AttributeSet);3857EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to DeleteLocalRef()", FALSE);3858return FALSE;3859}38603861// Get the subscript setting3862if (getSubscriptFromAttributeSetMethod != (jmethodID) 0) {3863PrintDebugString("[INFO]: Getting subscript from AttributeSet...");3864attributes->subscript = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3865getSubscriptFromAttributeSetMethod,3866AttributeSet);3867EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to CallBooleanMethod()", FALSE);3868} else {3869PrintDebugString("[ERROR]: either env == 0 or getSubscriptFromAttributeSetMethod == 0");3870jniEnv->CallVoidMethod(accessBridgeObject,3871decrementReferenceMethod, AttributeSet);3872EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to CallVoidMethod()", FALSE);3873jniEnv->DeleteLocalRef(AttributeSet);3874EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to DeleteLocalRef()", FALSE);3875return FALSE;3876}38773878// Get the backgroundColor setting3879if (getBackgroundColorFromAttributeSetMethod != (jmethodID) 0) {3880PrintDebugString("[INFO]: Getting backgroundColor from AttributeSet...");3881js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3882getBackgroundColorFromAttributeSetMethod,3883AttributeSet);3884EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallObjectMethod()", FALSE);3885if (js != (jstring) 0) {3886stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3887EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to GetStringChars()", FALSE);3888wcsncpy(attributes->backgroundColor, stringBytes, (sizeof(attributes->backgroundColor) / sizeof(wchar_t)));3889length = jniEnv->GetStringLength(js);3890attributes->backgroundColor[length < (sizeof(attributes->backgroundColor) / sizeof(wchar_t)) ?3891length : (sizeof(attributes->backgroundColor) / sizeof(wchar_t))-2] = (wchar_t) 0;3892EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to GetStringLength()", FALSE);3893jniEnv->ReleaseStringChars(js, stringBytes);3894EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to ReleaseStringChars()", FALSE);3895jniEnv->CallVoidMethod(accessBridgeObject,3896decrementReferenceMethod, js);3897EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallVoidMethod()", FALSE);3898wPrintDebugString(L"[INFO]: AttributeSet's background color = %ls", attributes->backgroundColor);3899jniEnv->DeleteLocalRef(js);3900EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE);3901} else {3902PrintDebugString("[WARN]: AttributeSet's background color is null.");3903attributes->backgroundColor[0] = (wchar_t) 0;3904}3905} else {3906PrintDebugString("[ERROR]: either env == 0 or getBackgroundColorFromAttributeSetMethod == 0");3907jniEnv->CallVoidMethod(accessBridgeObject,3908decrementReferenceMethod, AttributeSet);3909EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallVoidMethod()", FALSE);3910jniEnv->DeleteLocalRef(AttributeSet);3911EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE);3912return FALSE;3913}39143915// Get the foregroundColor setting3916if (getForegroundColorFromAttributeSetMethod != (jmethodID) 0) {3917PrintDebugString("[INFO]: Getting foregroundColor from AttributeSet...");3918js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3919getForegroundColorFromAttributeSetMethod,3920AttributeSet);3921EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallObjectMethod()", FALSE);3922if (js != (jstring) 0) {3923stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3924EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to GetStringChars()", FALSE);3925wcsncpy(attributes->foregroundColor, stringBytes, (sizeof(attributes->foregroundColor) / sizeof(wchar_t)));3926length = jniEnv->GetStringLength(js);3927attributes->foregroundColor[length < (sizeof(attributes->foregroundColor) / sizeof(wchar_t)) ?3928length : (sizeof(attributes->foregroundColor) / sizeof(wchar_t))-2] = (wchar_t) 0;3929EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to GetStringLength()", FALSE);3930jniEnv->ReleaseStringChars(js, stringBytes);3931EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to ReleaseStringChars()", FALSE);3932jniEnv->CallVoidMethod(accessBridgeObject,3933decrementReferenceMethod, js);3934EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallVoidMethod()", FALSE);3935wPrintDebugString(L"[INFO]: AttributeSet's foreground color = %ls", attributes->foregroundColor);3936jniEnv->DeleteLocalRef(js);3937EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE);3938} else {3939PrintDebugString("[WARN]: AttributeSet's foreground color is null.");3940attributes->foregroundColor[0] = (wchar_t) 0;3941}3942} else {3943PrintDebugString("[ERROR]: either env == 0 or getForegroundColorFromAttributeSetMethod == 0");3944jniEnv->CallVoidMethod(accessBridgeObject,3945decrementReferenceMethod, AttributeSet);3946EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallVoidMethod()", FALSE);3947jniEnv->DeleteLocalRef(AttributeSet);3948EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE);3949return FALSE;3950}39513952// Get the fontFamily setting3953if (getFontFamilyFromAttributeSetMethod != (jmethodID) 0) {3954PrintDebugString("[INFO]: Getting fontFamily from AttributeSet...");3955js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3956getFontFamilyFromAttributeSetMethod,3957AttributeSet);3958EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallObjectMethod()", FALSE);3959if (js != (jstring) 0) {3960stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3961EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to GetStringChars()", FALSE);3962wcsncpy(attributes->fontFamily, stringBytes, (sizeof(attributes->fontFamily) / sizeof(wchar_t)));3963length = jniEnv->GetStringLength(js);3964attributes->fontFamily[length < (sizeof(attributes->fontFamily) / sizeof(wchar_t)) ?3965length : (sizeof(attributes->fontFamily) / sizeof(wchar_t))-2] = (wchar_t) 0;3966EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to GetStringLength()", FALSE);3967jniEnv->ReleaseStringChars(js, stringBytes);3968EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to ReleaseStringChars()", FALSE);3969jniEnv->CallVoidMethod(accessBridgeObject,3970decrementReferenceMethod, js);3971EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallVoidMethod()", FALSE);3972wPrintDebugString(L"[INFO]: AttributeSet's fontFamily = %ls", attributes->fontFamily);3973jniEnv->DeleteLocalRef(js);3974EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to DeleteLocalRef()", FALSE);3975} else {3976PrintDebugString("[WARN]: AttributeSet's fontFamily is null.");3977attributes->backgroundColor[0] = (wchar_t) 0;3978}3979} else {3980PrintDebugString("[ERROR]: either env == 0 or getFontFamilyFromAttributeSetMethod == 0");3981jniEnv->CallVoidMethod(accessBridgeObject,3982decrementReferenceMethod, AttributeSet);3983EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallVoidMethod()", FALSE);3984jniEnv->DeleteLocalRef(AttributeSet);3985EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to DeleteLocalRef()", FALSE);3986return FALSE;3987}39883989// Get the font size3990if (getFontSizeFromAttributeSetMethod != (jmethodID) 0) {3991PrintDebugString("[INFO]: Getting font size from AttributeSet...");3992attributes->fontSize = jniEnv->CallIntMethod(accessBridgeObject,3993getFontSizeFromAttributeSetMethod,3994AttributeSet);3995EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to CallIntMethod()", FALSE);3996PrintDebugString("[INFO]: AttributeSet's font size = %d", attributes->fontSize);3997} else {3998PrintDebugString("[ERROR]: either env == 0 or getAlignmentFromAttributeSetMethod == 0");3999jniEnv->CallVoidMethod(accessBridgeObject,4000decrementReferenceMethod, AttributeSet);4001EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to CallVoidMethod()", FALSE);4002jniEnv->DeleteLocalRef(AttributeSet);4003EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to DeleteLocalRef()", FALSE);4004return FALSE;4005}400640074008// Get the alignment setting4009if (getAlignmentFromAttributeSetMethod != (jmethodID) 0) {4010PrintDebugString(" Getting alignment from AttributeSet...");4011attributes->alignment = jniEnv->CallIntMethod(accessBridgeObject,4012getAlignmentFromAttributeSetMethod,4013AttributeSet);4014EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to CallIntMethod()", FALSE);4015} else {4016PrintDebugString("[ERROR]: either env == 0 or getAlignmentFromAttributeSetMethod == 0");4017jniEnv->CallVoidMethod(accessBridgeObject,4018decrementReferenceMethod, AttributeSet);4019EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to CallVoidMethod()", FALSE);4020jniEnv->DeleteLocalRef(AttributeSet);4021EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to DeleteLocalRef()", FALSE);4022return FALSE;4023}40244025// Get the bidiLevel setting4026if (getBidiLevelFromAttributeSetMethod != (jmethodID) 0) {4027PrintDebugString("[INFO]: Getting bidiLevel from AttributeSet...");4028attributes->bidiLevel = jniEnv->CallIntMethod(accessBridgeObject,4029getBidiLevelFromAttributeSetMethod,4030AttributeSet);4031EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to CallIntMethod()", FALSE);4032} else {4033PrintDebugString("[ERROR]: either env == 0 or getBidiLevelFromAttributeSetMethod == 0");4034jniEnv->CallVoidMethod(accessBridgeObject,4035decrementReferenceMethod, AttributeSet);4036EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to CallVoidMethod()", FALSE);4037jniEnv->DeleteLocalRef(AttributeSet);4038EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to DeleteLocalRef()", FALSE);4039return FALSE;4040}40414042// Get the firstLineIndent setting4043if (getFirstLineIndentFromAttributeSetMethod != (jmethodID) 0) {4044PrintDebugString("[ERROR]: Getting firstLineIndent from AttributeSet...");4045attributes->firstLineIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4046getFirstLineIndentFromAttributeSetMethod,4047AttributeSet);4048EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to CallIntMethod()", FALSE);4049} else {4050PrintDebugString("[ERROR]: either env == 0 or getFirstLineIndentFromAttributeSetMethod == 0");4051jniEnv->CallVoidMethod(accessBridgeObject,4052decrementReferenceMethod, AttributeSet);4053EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to CallVoidMethod()", FALSE);4054jniEnv->DeleteLocalRef(AttributeSet);4055EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to DeleteLocalRef()", FALSE);4056return FALSE;4057}40584059// Get the leftIndent setting4060if (getLeftIndentFromAttributeSetMethod != (jmethodID) 0) {4061PrintDebugString("[INFO]: Getting leftIndent from AttributeSet...");4062attributes->leftIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4063getLeftIndentFromAttributeSetMethod,4064AttributeSet);4065EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to CallIntMethod()", FALSE);4066} else {4067PrintDebugString("[ERROR]: either env == 0 or getLeftIndentFromAttributeSetMethod == 0");4068jniEnv->CallVoidMethod(accessBridgeObject,4069decrementReferenceMethod, AttributeSet);4070EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to CallVoidMethod()", FALSE);4071jniEnv->DeleteLocalRef(AttributeSet);4072EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to DeleteLocalRef()", FALSE);4073return FALSE;4074}40754076// Get the rightIndent setting4077if (getRightIndentFromAttributeSetMethod != (jmethodID) 0) {4078PrintDebugString("[INFO]: Getting rightIndent from AttributeSet...");4079attributes->rightIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4080getRightIndentFromAttributeSetMethod,4081AttributeSet);4082EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to CallIntMethod()", FALSE);4083} else {4084PrintDebugString("[ERROR]: either env == 0 or getRightIndentFromAttributeSetMethod == 0");4085jniEnv->CallVoidMethod(accessBridgeObject,4086decrementReferenceMethod, AttributeSet);4087EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to CallVoidMethod()", FALSE);4088jniEnv->DeleteLocalRef(AttributeSet);4089EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to DeleteLocalRef()", FALSE);4090return FALSE;4091}40924093// Get the lineSpacing setting4094if (getLineSpacingFromAttributeSetMethod != (jmethodID) 0) {4095PrintDebugString("[INFO]: Getting lineSpacing from AttributeSet...");4096attributes->lineSpacing = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4097getLineSpacingFromAttributeSetMethod,4098AttributeSet);4099EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to CallIntMethod()", FALSE);4100} else {4101PrintDebugString("[ERROR]: either env == 0 or getLineSpacingFromAttributeSetMethod == 0");4102jniEnv->CallVoidMethod(accessBridgeObject,4103decrementReferenceMethod, AttributeSet);4104EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to CallVoidMethod()", FALSE);4105jniEnv->DeleteLocalRef(AttributeSet);4106EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to DeleteLocalRef()", FALSE);4107return FALSE;4108}41094110// Get the spaceAbove setting4111if (getSpaceAboveFromAttributeSetMethod != (jmethodID) 0) {4112PrintDebugString("[INFO]: Getting spaceAbove from AttributeSet...");4113attributes->spaceAbove = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4114getSpaceAboveFromAttributeSetMethod,4115AttributeSet);4116EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to CallIntMethod()", FALSE);4117} else {4118PrintDebugString("[ERROR]: either env == 0 or getSpaceAboveFromAttributeSetMethod == 0");4119jniEnv->CallVoidMethod(accessBridgeObject,4120decrementReferenceMethod, AttributeSet);4121EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to CallVoidMethod()", FALSE);4122jniEnv->DeleteLocalRef(AttributeSet);4123EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to DeleteLocalRef()", FALSE);4124return FALSE;4125}41264127// Get the spaceBelow setting4128if (getSpaceBelowFromAttributeSetMethod != (jmethodID) 0) {4129PrintDebugString("[INFO]: Getting spaceBelow from AttributeSet...");4130attributes->spaceBelow = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4131getSpaceBelowFromAttributeSetMethod,4132AttributeSet);4133EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to CallIntMethod()", FALSE);4134} else {4135PrintDebugString("[ERROR]: either env == 0 or getSpaceBelowFromAttributeSetMethod == 0");4136jniEnv->CallVoidMethod(accessBridgeObject,4137decrementReferenceMethod, AttributeSet);4138EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to CallVoidMethod()", FALSE);4139jniEnv->DeleteLocalRef(AttributeSet);4140EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to DeleteLocalRef()", FALSE);4141return FALSE;4142}41434144// Release the AttributeSet object4145if (decrementReferenceMethod != (jmethodID) 0) {4146PrintDebugString("[INFO]: Decrementing reference to AttributeSet...");4147jniEnv->CallVoidMethod(accessBridgeObject,4148decrementReferenceMethod, AttributeSet);4149EXCEPTION_CHECK("Releasing AttributeSet object - call to CallVoidMethod()", FALSE);4150} else {4151PrintDebugString("[ERROR]: either env == 0 or accessBridgeObject == 0");4152jniEnv->DeleteLocalRef(AttributeSet);4153EXCEPTION_CHECK("Releasing AttributeSet object - call to DeleteLocalRef()", FALSE);4154return FALSE;4155}41564157// Get the full attributes string at index4158if (getAccessibleAttributesAtIndexFromContextMethod != (jmethodID) 0) {4159PrintDebugString("[INFO]: Getting full attributes string from Context...");4160js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4161getAccessibleAttributesAtIndexFromContextMethod,4162accessibleContext, index);4163EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallObjectMethod()", FALSE);4164PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4165if (js != (jstring) 0) {4166stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4167EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringChars()", FALSE);4168wcsncpy(attributes->fullAttributesString, stringBytes, (sizeof(attributes->fullAttributesString) / sizeof(wchar_t)));4169length = jniEnv->GetStringLength(js);4170attributes->fullAttributesString[length < (sizeof(attributes->fullAttributesString) / sizeof(wchar_t)) ?4171length : (sizeof(attributes->fullAttributesString) / sizeof(wchar_t))-2] = (wchar_t) 0;4172EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringLength()", FALSE);4173jniEnv->ReleaseStringChars(js, stringBytes);4174EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to ReleaseStringChars()", FALSE);4175jniEnv->CallVoidMethod(accessBridgeObject,4176decrementReferenceMethod, js);4177EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallVoidMethod()", FALSE);4178wPrintDebugString(L"[INFO]: Accessible Text attributes = %ls", attributes->fullAttributesString);4179jniEnv->DeleteLocalRef(js);4180EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE);4181} else {4182PrintDebugString("[WARN]: Accessible Text attributes is null.");4183attributes->fullAttributesString[0] = (wchar_t) 0;4184jniEnv->DeleteLocalRef(AttributeSet);4185EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE);4186return FALSE;4187}4188} else {4189PrintDebugString("[ERROR]: either env == 0 or getAccessibleAttributesAtIndexFromContextMethod == 0");4190jniEnv->DeleteLocalRef(AttributeSet);4191return FALSE;4192}41934194jniEnv->DeleteLocalRef(AttributeSet);4195EXCEPTION_CHECK("Getting AccessibleAttributeSetAtIndex - call to DeleteLocalRef()", FALSE);4196return TRUE;4197}41984199BOOL4200AccessBridgeJavaEntryPoints::getAccessibleTextRect(jobject accessibleContext, AccessibleTextRectInfo *rectInfo, jint index) {42014202jthrowable exception;42034204PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextRect(%p), index = %d",4205accessibleContext, index);42064207// Verify the Java VM still exists and AccessibleContext is4208// an instance of AccessibleText4209if (verifyAccessibleText(accessibleContext) == FALSE) {4210return FALSE;4211}42124213// Get the x coord4214if (getAccessibleXcoordTextRectAtIndexFromContextMethod != (jmethodID) 0) {4215rectInfo->x = jniEnv->CallIntMethod(accessBridgeObject,4216getAccessibleXcoordTextRectAtIndexFromContextMethod,4217accessibleContext, index);4218EXCEPTION_CHECK("Getting AccessibleXcoordTextRect - call to CallIntMethod()", FALSE);4219PrintDebugString("[INFO]: X coord = %d", rectInfo->x);4220} else {4221PrintDebugString("[ERROR]: either env == 0 or getAccessibleXcoordTextRectAtIndexFromContextMethod == 0");4222return FALSE;4223}42244225// Get the y coord4226if (getAccessibleYcoordTextRectAtIndexFromContextMethod != (jmethodID) 0) {4227rectInfo->y = jniEnv->CallIntMethod(accessBridgeObject,4228getAccessibleYcoordTextRectAtIndexFromContextMethod,4229accessibleContext, index);4230EXCEPTION_CHECK("Getting AccessibleYcoordTextRect - call to CallIntMethod()", FALSE);4231PrintDebugString("[INFO]: Y coord = %d", rectInfo->y);4232} else {4233PrintDebugString("[INFO]: either env == 0 or getAccessibleYcoordTextRectAtIndexFromContextMethod == 0");4234return FALSE;4235}42364237// Get the width4238if (getAccessibleWidthTextRectAtIndexFromContextMethod != (jmethodID) 0) {4239rectInfo->width = jniEnv->CallIntMethod(accessBridgeObject,4240getAccessibleWidthTextRectAtIndexFromContextMethod,4241accessibleContext, index);4242EXCEPTION_CHECK("Getting AccessibleWidthTextRect - call to CallIntMethod()", FALSE);4243PrintDebugString("[INFO]: Width = %d", rectInfo->width);4244} else {4245PrintDebugString("[INFO]: either env == 0 or getAccessibleWidthTextRectAtIndexFromContextMethod == 0");4246return FALSE;4247}42484249// Get the height4250if (getAccessibleHeightTextRectAtIndexFromContextMethod != (jmethodID) 0) {4251rectInfo->height = jniEnv->CallIntMethod(accessBridgeObject,4252getAccessibleHeightTextRectAtIndexFromContextMethod,4253accessibleContext, index);4254EXCEPTION_CHECK("Getting AccessibleHeightTextRect - call to CallIntMethod()", FALSE);4255PrintDebugString("[INFO]: Height = %d", rectInfo->height);4256} else {4257PrintDebugString("[ERROR]: either env == 0 or getAccessibleHeightTextRectAtIndexFromContextMethod == 0");4258return FALSE;4259}42604261return TRUE;4262}42634264// =====42654266/**4267* gets the bounding rectangle for the text caret4268*/4269BOOL4270AccessBridgeJavaEntryPoints::getCaretLocation(jobject accessibleContext, AccessibleTextRectInfo *rectInfo, jint index) {42714272jthrowable exception;42734274PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getCaretLocation(%p), index = %d",4275accessibleContext, index);42764277// Verify the Java VM still exists and AccessibleContext is4278// an instance of AccessibleText4279if (verifyAccessibleText(accessibleContext) == FALSE) {4280return FALSE;4281}42824283// Get the x coord4284if (getCaretLocationXMethod != (jmethodID) 0) {4285rectInfo->x = jniEnv->CallIntMethod(accessBridgeObject,4286getCaretLocationXMethod,4287accessibleContext, index);4288EXCEPTION_CHECK("Getting caret X coordinate - call to CallIntMethod()", FALSE);4289PrintDebugString("[INFO]: X coord = %d", rectInfo->x);4290} else {4291PrintDebugString("[ERROR]: either env == 0 or getCaretLocationXMethod == 0");4292return FALSE;4293}42944295// Get the y coord4296if (getCaretLocationYMethod != (jmethodID) 0) {4297rectInfo->y = jniEnv->CallIntMethod(accessBridgeObject,4298getCaretLocationYMethod,4299accessibleContext, index);4300EXCEPTION_CHECK("Getting caret Y coordinate - call to CallIntMethod()", FALSE);4301PrintDebugString("[INFO]: Y coord = %d", rectInfo->y);4302} else {4303PrintDebugString("[ERROR]: either env == 0 or getCaretLocationYMethod == 0");4304return FALSE;4305}43064307// Get the width4308if (getCaretLocationWidthMethod != (jmethodID) 0) {4309rectInfo->width = jniEnv->CallIntMethod(accessBridgeObject,4310getCaretLocationWidthMethod,4311accessibleContext, index);4312EXCEPTION_CHECK("Getting caret width - call to CallIntMethod()", FALSE);4313PrintDebugString("[INFO]: Width = %d", rectInfo->width);4314} else {4315PrintDebugString("[ERROR]: either env == 0 or getCaretLocationWidthMethod == 0");4316return FALSE;4317}43184319// Get the height4320if (getCaretLocationHeightMethod != (jmethodID) 0) {4321rectInfo->height = jniEnv->CallIntMethod(accessBridgeObject,4322getCaretLocationHeightMethod,4323accessibleContext, index);4324EXCEPTION_CHECK("Getting caret height - call to CallIntMethod()", FALSE);4325PrintDebugString("[INFO]: Height = %d", rectInfo->height);4326} else {4327PrintDebugString("[ERROR]: either env == 0 or getCaretLocationHeightMethod == 0");4328return FALSE;4329}43304331return TRUE;4332}43334334// =====43354336BOOL4337AccessBridgeJavaEntryPoints::getAccessibleTextLineBounds(jobject accessibleContext, jint index, jint *startIndex, jint *endIndex) {43384339jthrowable exception;43404341PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextLineBounds(%p):", accessibleContext);43424343// Verify the Java VM still exists and AccessibleContext is4344// an instance of AccessibleText4345if (verifyAccessibleText(accessibleContext) == FALSE) {4346return FALSE;4347}43484349// Get the index of the left boundary of the line containing 'index'4350if (getAccessibleTextLineLeftBoundsFromContextMethod != (jmethodID) 0) {4351*startIndex = jniEnv->CallIntMethod(accessBridgeObject,4352getAccessibleTextLineLeftBoundsFromContextMethod,4353accessibleContext, index);4354EXCEPTION_CHECK("Getting AccessibleTextLineLeftBounds - call to CallIntMethod()", FALSE);4355PrintDebugString("[INFO]: startIndex = %d", *startIndex);4356} else {4357PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextLineLeftBoundsFromContextMethod == 0");4358return FALSE;4359}43604361// Get the index of the right boundary of the line containing 'index'4362if (getAccessibleTextLineRightBoundsFromContextMethod != (jmethodID) 0) {4363*endIndex = jniEnv->CallIntMethod(accessBridgeObject,4364getAccessibleTextLineRightBoundsFromContextMethod,4365accessibleContext, index);4366EXCEPTION_CHECK("Getting AccessibleTextLineRightBounds - call to CallIntMethod()", FALSE);4367PrintDebugString("[INFO]: endIndex = %d", *endIndex);4368} else {4369PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextLineRightBoundsFromContextMethod == 0");4370return FALSE;4371}43724373return TRUE;4374}43754376BOOL4377AccessBridgeJavaEntryPoints::getAccessibleTextRange(jobject accessibleContext,4378jint start, jint end, wchar_t *text, short len) {4379jstring js;4380const wchar_t *stringBytes;4381jthrowable exception;4382jsize length;43834384PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextRange(%p, %d, %d, *text, %d):", accessibleContext, start, end, len);43854386// Verify the Java VM still exists and AccessibleContext is4387// an instance of AccessibleText4388if (verifyAccessibleText(accessibleContext) == FALSE) {4389return FALSE;4390}43914392// range is inclusive4393if (end < start) {4394PrintDebugString("[ERROR]: end < start!");4395text[0] = (wchar_t) 0;4396return FALSE;4397}43984399// Get the text range within [start, end] inclusive4400if (getAccessibleTextRangeFromContextMethod != (jmethodID) 0) {4401js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4402getAccessibleTextRangeFromContextMethod,4403accessibleContext, start, end);4404EXCEPTION_CHECK("Getting AccessibleTextRange - call to CallObjectMethod()", FALSE);4405PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4406if (js != (jstring) 0) {4407stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4408EXCEPTION_CHECK("Getting AccessibleTextRange - call to GetStringChars()", FALSE);4409wPrintDebugString(L"[INFO]: Accessible Text stringBytes returned from Java = %ls", stringBytes);4410wcsncpy(text, stringBytes, len);4411length = jniEnv->GetStringLength(js);4412PrintDebugString("[INFO]: Accessible Text stringBytes length = %d", length);4413text[length < len ? length : len - 2] = (wchar_t) 0;4414wPrintDebugString(L"[INFO]: Accessible Text 'text' after null termination = %ls", text);4415EXCEPTION_CHECK("Getting AccessibleTextRange - call to GetStringLength()", FALSE);4416jniEnv->ReleaseStringChars(js, stringBytes);4417EXCEPTION_CHECK("Getting AccessibleTextRange - call to ReleaseStringChars()", FALSE);4418jniEnv->CallVoidMethod(accessBridgeObject,4419decrementReferenceMethod, js);4420EXCEPTION_CHECK("Getting AccessibleTextRange - call to CallVoidMethod()", FALSE);4421wPrintDebugString(L"[INFO]: Accessible Text range = %ls", text);4422jniEnv->DeleteLocalRef(js);4423EXCEPTION_CHECK("Getting AccessibleTextRange - call to DeleteLocalRef()", FALSE);4424} else {4425PrintDebugString("[WARN]: current Accessible Text range is null.");4426text[0] = (wchar_t) 0;4427return FALSE;4428}4429} else {4430PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextRangeFromContextMethod == 0");4431return FALSE;4432}4433return TRUE;4434}44354436/********** AccessibleValue routines ***************/44374438BOOL4439AccessBridgeJavaEntryPoints::getCurrentAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) {4440jstring js;4441const wchar_t *stringBytes;4442jthrowable exception;4443jsize length;44444445PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getCurrentAccessibleValueFromContext(%p):", accessibleContext);44464447// Get the current Accessible Value4448if (getCurrentAccessibleValueFromContextMethod != (jmethodID) 0) {4449js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4450getCurrentAccessibleValueFromContextMethod,4451accessibleContext);4452EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to CallObjectMethod()", FALSE);4453PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4454if (js != (jstring) 0) {4455stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4456EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to GetStringChars()", FALSE);4457wcsncpy(value, stringBytes, len);4458length = jniEnv->GetStringLength(js);4459value[length < len ? length : len - 2] = (wchar_t) 0;4460EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to GetStringLength()", FALSE);4461jniEnv->ReleaseStringChars(js, stringBytes);4462EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to ReleaseStringChars()", FALSE);4463jniEnv->CallVoidMethod(accessBridgeObject,4464decrementReferenceMethod, js);4465EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to CallVoidMethod()", FALSE);4466PrintDebugString("[INFO]: current Accessible Value = %s", value);4467jniEnv->DeleteLocalRef(js);4468EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to DeleteLocalRef()", FALSE);4469} else {4470PrintDebugString("[WARN]: current Accessible Value is null.");4471value[0] = (wchar_t) 0;4472return FALSE;4473}4474} else {4475PrintDebugString("[ERROR]: either env == 0 or getCurrentAccessibleValueFromContextMethod == 0");4476return FALSE;4477}4478return TRUE;4479}44804481BOOL4482AccessBridgeJavaEntryPoints::getMaximumAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) {4483jstring js;4484const wchar_t *stringBytes;4485jthrowable exception;4486jsize length;44874488PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getMaximumAccessibleValueFromContext(%p):", accessibleContext);44894490// Get the maximum Accessible Value4491if (getMaximumAccessibleValueFromContextMethod != (jmethodID) 0) {4492js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4493getMaximumAccessibleValueFromContextMethod,4494accessibleContext);4495EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to CallObjectMethod()", FALSE);4496PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4497if (js != (jstring) 0) {4498stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4499EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to GetStringChars()", FALSE);4500wcsncpy(value, stringBytes, len);4501length = jniEnv->GetStringLength(js);4502value[length < len ? length : len - 2] = (wchar_t) 0;4503EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to GetStringLength()", FALSE);4504jniEnv->ReleaseStringChars(js, stringBytes);4505EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to ReleaseStringChars()", FALSE);4506jniEnv->CallVoidMethod(accessBridgeObject,4507decrementReferenceMethod, js);4508EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to CallVoidMethod()", FALSE);4509PrintDebugString("[INFO]: maximum Accessible Value = %s", value);4510jniEnv->DeleteLocalRef(js);4511EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to DeleteLocalRef()", FALSE);4512} else {4513PrintDebugString("[WARN]: maximum Accessible Value is null.");4514value[0] = (wchar_t) 0;4515return FALSE;4516}4517} else {4518PrintDebugString("[ERROR]: either env == 0 or getMaximumAccessibleValueFromContextMethod == 0");4519return FALSE;4520}4521return TRUE;4522}45234524BOOL4525AccessBridgeJavaEntryPoints::getMinimumAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) {4526jstring js;4527const wchar_t *stringBytes;4528jthrowable exception;4529jsize length;45304531PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getMinimumAccessibleValueFromContext(%p):", accessibleContext);45324533// Get the mimimum Accessible Value4534if (getMinimumAccessibleValueFromContextMethod != (jmethodID) 0) {4535js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4536getMinimumAccessibleValueFromContextMethod,4537accessibleContext);4538EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to CallObjectMethod()", FALSE);4539PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4540if (js != (jstring) 0) {4541stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4542EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to GetStringChars()", FALSE);4543wcsncpy(value, stringBytes, len);4544length = jniEnv->GetStringLength(js);4545value[length < len ? length : len - 2] = (wchar_t) 0;4546EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to GetStringLength()", FALSE);4547jniEnv->ReleaseStringChars(js, stringBytes);4548EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to ReleaseStringChars()", FALSE);4549jniEnv->CallVoidMethod(accessBridgeObject,4550decrementReferenceMethod, js);4551EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to CallVoidMethod()", FALSE);4552PrintDebugString("[INFO]: mimimum Accessible Value = %s", value);4553jniEnv->DeleteLocalRef(js);4554EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to DeleteLocalRef()", FALSE);4555} else {4556PrintDebugString("[WARN]: mimimum Accessible Value is null.");4557value[0] = (wchar_t) 0;4558return FALSE;4559}4560} else {4561PrintDebugString("[ERROR]: either env == 0 or getMinimumAccessibleValueFromContextMethod == 0");4562return FALSE;4563}4564return TRUE;4565}456645674568/********** AccessibleSelection routines ***************/45694570void4571AccessBridgeJavaEntryPoints::addAccessibleSelectionFromContext(jobject accessibleContext, int i) {4572jthrowable exception;45734574PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::addAccessibleSelectionFromContext(%p):", accessibleContext);45754576// Add the child to the AccessibleSelection4577if (addAccessibleSelectionFromContextMethod != (jmethodID) 0) {4578jniEnv->CallVoidMethod(accessBridgeObject,4579addAccessibleSelectionFromContextMethod,4580accessibleContext, i);4581EXCEPTION_CHECK_VOID("Doing addAccessibleSelection - call to CallVoidMethod()");4582PrintDebugString("[INFO]: returned from CallObjectMethod()");4583} else {4584PrintDebugString("[ERROR]: either env == 0 or addAccessibleSelectionFromContextMethod == 0");4585}4586}45874588void4589AccessBridgeJavaEntryPoints::clearAccessibleSelectionFromContext(jobject accessibleContext) {4590jthrowable exception;45914592PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::clearAccessibleSelectionFromContext(%p):", accessibleContext);45934594// Clearing the Selection of the AccessibleSelection4595if (clearAccessibleSelectionFromContextMethod != (jmethodID) 0) {4596jniEnv->CallVoidMethod(accessBridgeObject,4597clearAccessibleSelectionFromContextMethod,4598accessibleContext);4599EXCEPTION_CHECK_VOID("Doing clearAccessibleSelection - call to CallVoidMethod()");4600PrintDebugString("[INFO]: returned from CallObjectMethod()");4601} else {4602PrintDebugString("[ERROR]: either env == 0 or clearAccessibleSelectionFromContextMethod == 0");4603}4604}46054606jobject4607AccessBridgeJavaEntryPoints::getAccessibleSelectionFromContext(jobject accessibleContext, int i) {4608jobject returnedAccessibleContext;4609jobject globalRef;4610jthrowable exception;46114612PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleSelectionFromContext(%p):", accessibleContext);46134614if (getAccessibleSelectionContextFromContextMethod != (jmethodID) 0) {4615returnedAccessibleContext = jniEnv->CallObjectMethod(4616accessBridgeObject,4617getAccessibleSelectionContextFromContextMethod,4618accessibleContext, i);4619EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to CallObjectMethod()", (jobject) 0);4620globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);4621EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to NewGlobalRef()", (jobject) 0);4622jniEnv->DeleteLocalRef(returnedAccessibleContext);4623EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to DeleteLocalRef()", (jobject) 0);4624PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",4625returnedAccessibleContext, globalRef);4626return globalRef;4627} else {4628PrintDebugString("[ERROR]: either env == 0 or getAccessibleSelectionContextFromContextMethod == 0");4629return (jobject) 0;4630}4631}46324633int4634AccessBridgeJavaEntryPoints::getAccessibleSelectionCountFromContext(jobject accessibleContext) {4635int count;4636jthrowable exception;46374638PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleSelectionCountFromContext(%p):", accessibleContext);46394640// Get (& return) the # of items selected in the AccessibleSelection4641if (getAccessibleSelectionCountFromContextMethod != (jmethodID) 0) {4642count = jniEnv->CallIntMethod(accessBridgeObject,4643getAccessibleSelectionCountFromContextMethod,4644accessibleContext);4645EXCEPTION_CHECK("Getting AccessibleSelectionCount - call to CallIntMethod()", -1);4646PrintDebugString("[INFO]: returned from CallObjectMethod()");4647return count;4648} else {4649PrintDebugString("[ERROR]: either env == 0 or getAccessibleSelectionCountFromContextMethod == 0");4650return -1;4651}4652}46534654BOOL4655AccessBridgeJavaEntryPoints::isAccessibleChildSelectedFromContext(jobject accessibleContext, int i) {4656jboolean result;4657jthrowable exception;46584659PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::isAccessibleChildSelectedFromContext(%p):", accessibleContext);46604661// Get (& return) the # of items selected in the AccessibleSelection4662if (isAccessibleChildSelectedFromContextMethod != (jmethodID) 0) {4663result = jniEnv->CallBooleanMethod(accessBridgeObject,4664isAccessibleChildSelectedFromContextMethod,4665accessibleContext, i);4666EXCEPTION_CHECK("Doing isAccessibleChildSelected - call to CallBooleanMethod()", FALSE);4667PrintDebugString("[INFO]: returned from CallObjectMethod()");4668if (result != 0) {4669return TRUE;4670}4671} else {4672PrintDebugString("[ERROR]: either env == 0 or isAccessibleChildSelectedFromContextMethod == 0");4673}4674return FALSE;4675}467646774678void4679AccessBridgeJavaEntryPoints::removeAccessibleSelectionFromContext(jobject accessibleContext, int i) {4680jthrowable exception;46814682PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::removeAccessibleSelectionFromContext(%p):", accessibleContext);46834684// Remove the i-th child from the AccessibleSelection4685if (removeAccessibleSelectionFromContextMethod != (jmethodID) 0) {4686jniEnv->CallVoidMethod(accessBridgeObject,4687removeAccessibleSelectionFromContextMethod,4688accessibleContext, i);4689EXCEPTION_CHECK_VOID("Doing removeAccessibleSelection - call to CallVoidMethod()");4690PrintDebugString("[INFO]: returned from CallObjectMethod()");4691} else {4692PrintDebugString("[ERROR]: either env == 0 or removeAccessibleSelectionFromContextMethod == 0");4693}4694}46954696void4697AccessBridgeJavaEntryPoints::selectAllAccessibleSelectionFromContext(jobject accessibleContext) {4698jthrowable exception;46994700PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::selectAllAccessibleSelectionFromContext(%p):", accessibleContext);47014702// Select all children (if possible) of the AccessibleSelection4703if (selectAllAccessibleSelectionFromContextMethod != (jmethodID) 0) {4704jniEnv->CallVoidMethod(accessBridgeObject,4705selectAllAccessibleSelectionFromContextMethod,4706accessibleContext);4707EXCEPTION_CHECK_VOID("Doing selectAllAccessibleSelection - call to CallVoidMethod()");4708PrintDebugString("[INFO]: returned from CallObjectMethod()");4709} else {4710PrintDebugString("[ERROR]: either env == 0 or selectAllAccessibleSelectionFromContextMethod == 0");4711}4712}471347144715/********** Event Notification Registration routines ***************/47164717BOOL4718AccessBridgeJavaEntryPoints::addJavaEventNotification(jlong type) {4719jthrowable exception;47204721PrintDebugString("[INFO]: in AccessBridgeJavaEntryPoints::addJavaEventNotification(%016I64X);", type);47224723// Let AccessBridge know we want to add an event type4724if (addJavaEventNotificationMethod != (jmethodID) 0) {4725jniEnv->CallVoidMethod(accessBridgeObject,4726addJavaEventNotificationMethod, type);4727EXCEPTION_CHECK("Doing addJavaEventNotification - call to CallVoidMethod()", FALSE);4728} else {4729PrintDebugString("[ERROR]: either env == 0 or addJavaEventNotificationMethod == 0");4730return FALSE;4731}4732return TRUE;4733}47344735BOOL4736AccessBridgeJavaEntryPoints::removeJavaEventNotification(jlong type) {4737jthrowable exception;47384739PrintDebugString("[INFO]: in AccessBridgeJavaEntryPoints::removeJavaEventNotification(%016I64X):", type);47404741// Let AccessBridge know we want to remove an event type4742if (removeJavaEventNotificationMethod != (jmethodID) 0) {4743jniEnv->CallVoidMethod(accessBridgeObject,4744removeJavaEventNotificationMethod, type);4745EXCEPTION_CHECK("Doing removeJavaEventNotification - call to CallVoidMethod()", FALSE);4746} else {4747PrintDebugString("[ERROR]: either env == 0 or removeJavaEventNotificationMethod == 0");4748return FALSE;4749}4750return TRUE;4751}47524753BOOL4754AccessBridgeJavaEntryPoints::addAccessibilityEventNotification(jlong type) {4755jthrowable exception;47564757PrintDebugString("[INFO]: in AccessBridgeJavaEntryPoints::addAccessibilityEventNotification(%016I64X);", type);47584759// Let AccessBridge know we want to add an event type4760if (addAccessibilityEventNotificationMethod != (jmethodID) 0) {4761PrintDebugString("[INFO]: addAccessibilityEventNotification: calling void method: accessBridgeObject = %p", accessBridgeObject);4762jniEnv->CallVoidMethod(accessBridgeObject,4763addAccessibilityEventNotificationMethod, type);4764EXCEPTION_CHECK("Doing addAccessibilityEvent - call to CallVoidMethod()", FALSE);4765} else {4766PrintDebugString("[ERROR]: either env == 0 or addAccessibilityEventNotificationMethod == 0");4767return FALSE;4768}4769PrintDebugString("[INFO]: addAccessibilityEventNotification: just returning true");4770return TRUE;4771}47724773BOOL4774AccessBridgeJavaEntryPoints::removeAccessibilityEventNotification(jlong type) {4775jthrowable exception;47764777PrintDebugString("[INFO]: in AccessBridgeJavaEntryPoints::removeAccessibilityEventNotification(%016I64X):", type);47784779// Let AccessBridge know we want to remove an event type4780if (removeAccessibilityEventNotificationMethod != (jmethodID) 0) {4781jniEnv->CallVoidMethod(accessBridgeObject,4782removeAccessibilityEventNotificationMethod, type);4783EXCEPTION_CHECK("Doing removeAccessibilityEvent - call to CallVoidMethod()", FALSE);4784} else {4785PrintDebugString("[ERROR]: either env == 0 or removeAccessibilityEventNotificationMethod == 0");4786return FALSE;4787}4788return TRUE;4789}479047914792