Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/native/sun/bridge/AccessBridgeJavaEntryPoints.cpp
32287 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/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// GetMethodID(getAccessBridgeVersionMethod)117FIND_METHOD(getAccessBridgeVersionMethod, bridgeClass,118"getAccessBridgeVersion",119"()Ljava/lang/String;");120121122// ------- Window methods123124// GetMethodID(isJavaWindow)125FIND_METHOD(isJavaWindowMethod, bridgeClass,126"isJavaWindow",127"(I)Z");128129// GetMethodID(getAccessibleContextFromHWND)130FIND_METHOD(getAccessibleContextFromHWNDMethod, bridgeClass,131"getContextFromNativeWindowHandle",132"(I)Ljavax/accessibility/AccessibleContext;");133134// GetMethodID(getHWNDFromAccessibleContext)135FIND_METHOD(getHWNDFromAccessibleContextMethod, bridgeClass,136"getNativeWindowHandleFromContext",137"(Ljavax/accessibility/AccessibleContext;)I");138139// GetMethodID(getAccessibleParentFromContext)140FIND_METHOD(getAccessibleParentFromContextMethod, bridgeClass,141"getAccessibleParentFromContext",142"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");143144// ===== utility methods ===== */145146// GetMethodID(setTextContents)147FIND_METHOD(setTextContentsMethod, bridgeClass,148"setTextContents",149"(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Z");150151// GetMethodID(getParentWithRole)152FIND_METHOD(getParentWithRoleMethod, bridgeClass,153"getParentWithRole",154"(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Ljavax/accessibility/AccessibleContext;");155156// GetMethodID(getTopLevelObject)157FIND_METHOD(getTopLevelObjectMethod, bridgeClass,158"getTopLevelObject",159"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");160161// GetMethodID(getParentWithRoleElseRoot)162FIND_METHOD(getParentWithRoleElseRootMethod, bridgeClass,163"getParentWithRoleElseRoot",164"(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Ljavax/accessibility/AccessibleContext;");165166// GetMethodID(getObjectDepth)167FIND_METHOD(getObjectDepthMethod, bridgeClass,168"getObjectDepth",169"(Ljavax/accessibility/AccessibleContext;)I");170171// GetMethodID(getActiveDescendent)172FIND_METHOD(getActiveDescendentMethod, bridgeClass,173"getActiveDescendent",174"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");175176// ------- AccessibleContext methods177178// GetMethodID(getAccessibleContextAt)179FIND_METHOD(getAccessibleContextAtMethod, bridgeClass,180"getAccessibleContextAt",181"(IILjavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");182183// GetMethodID(getAccessibleContextWithFocus)184FIND_METHOD(getAccessibleContextWithFocusMethod, bridgeClass,185"getAccessibleContextWithFocus",186"()Ljavax/accessibility/AccessibleContext;");187188// GetMethodID(getAccessibleNameFromContext)189FIND_METHOD(getAccessibleNameFromContextMethod, bridgeClass,190"getAccessibleNameFromContext",191"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");192193// GetMethodID(getAccessibleDescriptionFromContext)194FIND_METHOD(getAccessibleDescriptionFromContextMethod, bridgeClass,195"getAccessibleDescriptionFromContext",196"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");197198// GetMethodID(getAccessibleRoleStringFromContext)199FIND_METHOD(getAccessibleRoleStringFromContextMethod, bridgeClass,200"getAccessibleRoleStringFromContext",201"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");202203// GetMethodID(getAccessibleRoleStringFromContext_en_US)204FIND_METHOD(getAccessibleRoleStringFromContext_en_USMethod, bridgeClass,205"getAccessibleRoleStringFromContext_en_US",206"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");207208// GetMethodID(getAccessibleStatesStringFromContext)209FIND_METHOD(getAccessibleStatesStringFromContextMethod, bridgeClass,210"getAccessibleStatesStringFromContext",211"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");212213// GetMethodID(getAccessibleStatesStringFromContext_en_US)214FIND_METHOD(getAccessibleStatesStringFromContext_en_USMethod, bridgeClass,215"getAccessibleStatesStringFromContext_en_US",216"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");217218// GetMethodID(getAccessibleParentFromContext)219FIND_METHOD(getAccessibleParentFromContextMethod, bridgeClass,220"getAccessibleParentFromContext",221"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleContext;");222223// GetMethodID(getAccessibleIndexInParentFromContext)224FIND_METHOD(getAccessibleIndexInParentFromContextMethod, bridgeClass,225"getAccessibleIndexInParentFromContext",226"(Ljavax/accessibility/AccessibleContext;)I");227228// GetMethodID(getAccessibleChildrenCountFromContext)229FIND_METHOD(getAccessibleChildrenCountFromContextMethod, bridgeClass,230"getAccessibleChildrenCountFromContext",231"(Ljavax/accessibility/AccessibleContext;)I");232233// GetMethodID(getAccessibleChildFromContext)234FIND_METHOD(getAccessibleChildFromContextMethod, bridgeClass,235"getAccessibleChildFromContext",236"(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;");237238// GetMethodID(getAccessibleBoundsOnScreenFromContext)239FIND_METHOD(getAccessibleBoundsOnScreenFromContextMethod, bridgeClass,240"getAccessibleBoundsOnScreenFromContext",241"(Ljavax/accessibility/AccessibleContext;)Ljava/awt/Rectangle;");242243// GetMethodID(getAccessibleXcoordFromContext)244FIND_METHOD(getAccessibleXcoordFromContextMethod, bridgeClass,245"getAccessibleXcoordFromContext",246"(Ljavax/accessibility/AccessibleContext;)I");247248// GetMethodID(getAccessibleYcoordFromContext)249FIND_METHOD(getAccessibleYcoordFromContextMethod, bridgeClass,250"getAccessibleYcoordFromContext",251"(Ljavax/accessibility/AccessibleContext;)I");252253// GetMethodID(getAccessibleHeightFromContext)254FIND_METHOD(getAccessibleHeightFromContextMethod, bridgeClass,255"getAccessibleHeightFromContext",256"(Ljavax/accessibility/AccessibleContext;)I");257258// GetMethodID(getAccessibleWidthFromContext)259FIND_METHOD(getAccessibleWidthFromContextMethod, bridgeClass,260"getAccessibleWidthFromContext",261"(Ljavax/accessibility/AccessibleContext;)I");262263// GetMethodID(getAccessibleComponentFromContext)264FIND_METHOD(getAccessibleComponentFromContextMethod, bridgeClass,265"getAccessibleComponentFromContext",266"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleComponent;");267268// GetMethodID(getAccessibleActionFromContext)269FIND_METHOD(getAccessibleActionFromContextMethod, bridgeClass,270"getAccessibleActionFromContext",271"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleAction;");272273// GetMethodID(getAccessibleSelectionFromContext)274FIND_METHOD(getAccessibleSelectionFromContextMethod, bridgeClass,275"getAccessibleSelectionFromContext",276"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleSelection;");277278// GetMethodID(getAccessibleTextFromContext)279FIND_METHOD(getAccessibleTextFromContextMethod, bridgeClass,280"getAccessibleTextFromContext",281"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleText;");282283// GetMethodID(getAccessibleValueFromContext)284FIND_METHOD(getAccessibleValueFromContextMethod, bridgeClass,285"getAccessibleValueFromContext",286"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleValue;");287288289// ------- begin AccessibleTable methods290291// GetMethodID(getAccessibleTableFromContext)292FIND_METHOD(getAccessibleTableFromContextMethod, bridgeClass,293"getAccessibleTableFromContext",294"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;");295296// GetMethodID(getContextFromAccessibleTable)297FIND_METHOD(getContextFromAccessibleTableMethod, bridgeClass,298"getContextFromAccessibleTable",299"(Ljavax/accessibility/AccessibleTable;)Ljavax/accessibility/AccessibleContext;");300301// GetMethodID(getAccessibleTableRowHeader)302FIND_METHOD(getAccessibleTableRowHeaderMethod, bridgeClass,303"getAccessibleTableRowHeader",304"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;");305306307// GetMethodID(getAccessibleTableColumnHeader)308FIND_METHOD(getAccessibleTableColumnHeaderMethod, bridgeClass,309"getAccessibleTableColumnHeader",310"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleTable;");311312313// GetMethodID(getAccessibleTableRowCount)314FIND_METHOD(getAccessibleTableRowCountMethod, bridgeClass,315"getAccessibleTableRowCount",316"(Ljavax/accessibility/AccessibleContext;)I");317318// GetMethodID(getAccessibleTableColumnCount)319FIND_METHOD(getAccessibleTableColumnCountMethod, bridgeClass,320"getAccessibleTableColumnCount",321"(Ljavax/accessibility/AccessibleContext;)I");322323// GetMethodID(getAccessibleTableCellAccessibleContext)324FIND_METHOD(getAccessibleTableCellAccessibleContextMethod, bridgeClass,325"getAccessibleTableCellAccessibleContext",326"(Ljavax/accessibility/AccessibleTable;II)Ljavax/accessibility/AccessibleContext;");327328// GetMethodID(getAccessibleTableCellIndex)329FIND_METHOD(getAccessibleTableCellIndexMethod, bridgeClass,330"getAccessibleTableCellIndex",331"(Ljavax/accessibility/AccessibleTable;II)I");332333// GetMethodID(getAccessibleTableCellRowExtent)334FIND_METHOD(getAccessibleTableCellRowExtentMethod, bridgeClass,335"getAccessibleTableCellRowExtent",336"(Ljavax/accessibility/AccessibleTable;II)I");337338// GetMethodID(getAccessibleTableCellColumnExtent)339FIND_METHOD(getAccessibleTableCellColumnExtentMethod, bridgeClass,340"getAccessibleTableCellColumnExtent",341"(Ljavax/accessibility/AccessibleTable;II)I");342343// GetMethodID(isAccessibleTableCellSelected)344FIND_METHOD(isAccessibleTableCellSelectedMethod, bridgeClass,345"isAccessibleTableCellSelected",346"(Ljavax/accessibility/AccessibleTable;II)Z");347348// GetMethodID(getAccessibleTableRowHeaderRowCount)349FIND_METHOD(getAccessibleTableRowHeaderRowCountMethod, bridgeClass,350"getAccessibleTableRowHeaderRowCount",351"(Ljavax/accessibility/AccessibleContext;)I");352353// GetMethodID(getAccessibleTableColumnHeaderRowCount)354FIND_METHOD(getAccessibleTableColumnHeaderRowCountMethod, bridgeClass,355"getAccessibleTableColumnHeaderRowCount",356"(Ljavax/accessibility/AccessibleContext;)I");357358// GetMethodID(getAccessibleTableRowHeaderColumnCount)359FIND_METHOD(getAccessibleTableRowHeaderColumnCountMethod, bridgeClass,360"getAccessibleTableRowHeaderColumnCount",361"(Ljavax/accessibility/AccessibleContext;)I");362363// GetMethodID(getAccessibleTableColumnHeaderColumnCount)364FIND_METHOD(getAccessibleTableColumnHeaderColumnCountMethod, bridgeClass,365"getAccessibleTableColumnHeaderColumnCount",366"(Ljavax/accessibility/AccessibleContext;)I");367368// GetMethodID(getAccessibleTableRowDescription)369FIND_METHOD(getAccessibleTableRowDescriptionMethod, bridgeClass,370"getAccessibleTableRowDescription",371"(Ljavax/accessibility/AccessibleTable;I)Ljavax/accessibility/AccessibleContext;");372373// GetMethodID(getAccessibleTableColumnDescription)374FIND_METHOD(getAccessibleTableColumnDescriptionMethod, bridgeClass,375"getAccessibleTableColumnDescription",376"(Ljavax/accessibility/AccessibleTable;I)Ljavax/accessibility/AccessibleContext;");377378// GetMethodID(getAccessibleTableRowSelectionCount)379FIND_METHOD(getAccessibleTableRowSelectionCountMethod, bridgeClass,380"getAccessibleTableRowSelectionCount",381"(Ljavax/accessibility/AccessibleTable;)I");382383// GetMethodID(isAccessibleTableRowSelected)384FIND_METHOD(isAccessibleTableRowSelectedMethod, bridgeClass,385"isAccessibleTableRowSelected",386"(Ljavax/accessibility/AccessibleTable;I)Z");387388// GetMethodID(getAccessibleTableRowSelections)389FIND_METHOD(getAccessibleTableRowSelectionsMethod, bridgeClass,390"getAccessibleTableRowSelections",391"(Ljavax/accessibility/AccessibleTable;I)I");392393// GetMethodID(getAccessibleTableColumnSelectionCount)394FIND_METHOD(getAccessibleTableColumnSelectionCountMethod, bridgeClass,395"getAccessibleTableColumnSelectionCount",396"(Ljavax/accessibility/AccessibleTable;)I");397398// GetMethodID(isAccessibleTableColumnSelected)399FIND_METHOD(isAccessibleTableColumnSelectedMethod, bridgeClass,400"isAccessibleTableColumnSelected",401"(Ljavax/accessibility/AccessibleTable;I)Z");402403// GetMethodID(getAccessibleTableColumnSelections)404FIND_METHOD(getAccessibleTableColumnSelectionsMethod, bridgeClass,405"getAccessibleTableColumnSelections",406"(Ljavax/accessibility/AccessibleTable;I)I");407408// GetMethodID(getAccessibleTableRow)409FIND_METHOD(getAccessibleTableRowMethod, bridgeClass,410"getAccessibleTableRow",411"(Ljavax/accessibility/AccessibleTable;I)I");412413// GetMethodID(getAccessibleTableColumn)414FIND_METHOD(getAccessibleTableColumnMethod, bridgeClass,415"getAccessibleTableColumn",416"(Ljavax/accessibility/AccessibleTable;I)I");417418// GetMethodID(getAccessibleTableIndex)419FIND_METHOD(getAccessibleTableIndexMethod, bridgeClass,420"getAccessibleTableIndex",421"(Ljavax/accessibility/AccessibleTable;II)I");422423/* ------- end AccessibleTable methods */424425/* start AccessibleRelationSet methods ----- */426427// GetMethodID(getAccessibleRelationCount)428FIND_METHOD(getAccessibleRelationCountMethod, bridgeClass,429"getAccessibleRelationCount",430"(Ljavax/accessibility/AccessibleContext;)I");431432// GetMethodID(getAccessibleRelationKey)433FIND_METHOD(getAccessibleRelationKeyMethod, bridgeClass,434"getAccessibleRelationKey",435"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");436437// GetMethodID(getAccessibleRelationTargetCount)438FIND_METHOD(getAccessibleRelationTargetCountMethod, bridgeClass,439"getAccessibleRelationTargetCount",440"(Ljavax/accessibility/AccessibleContext;I)I");441442// GetMethodID(getAccessibleRelationTarget)443FIND_METHOD(getAccessibleRelationTargetMethod, bridgeClass,444"getAccessibleRelationTarget",445"(Ljavax/accessibility/AccessibleContext;II)Ljavax/accessibility/AccessibleContext;");446447448// ------- AccessibleHypertext methods449450// GetMethodID(getAccessibleHypertext)451FIND_METHOD(getAccessibleHypertextMethod, bridgeClass,452"getAccessibleHypertext",453"(Ljavax/accessibility/AccessibleContext;)Ljavax/accessibility/AccessibleHypertext;");454455// GetMethodID(activateAccessibleHyperlink)456FIND_METHOD(activateAccessibleHyperlinkMethod, bridgeClass,457"activateAccessibleHyperlink",458"(Ljavax/accessibility/AccessibleContext;Ljavax/accessibility/AccessibleHyperlink;)Z");459460// GetMethodID(getAccessibleHyperlinkCount)461FIND_METHOD(getAccessibleHyperlinkCountMethod, bridgeClass,462"getAccessibleHyperlinkCount",463"(Ljavax/accessibility/AccessibleContext;)I");464465// GetMethodID(getAccessibleHyperlink)466FIND_METHOD(getAccessibleHyperlinkMethod, bridgeClass,467"getAccessibleHyperlink",468"(Ljavax/accessibility/AccessibleHypertext;I)Ljavax/accessibility/AccessibleHyperlink;");469470// GetMethodID(getAccessibleHyperlinkText)471FIND_METHOD(getAccessibleHyperlinkTextMethod, bridgeClass,472"getAccessibleHyperlinkText",473"(Ljavax/accessibility/AccessibleHyperlink;)Ljava/lang/String;");474475// GetMethodID(getAccessibleHyperlinkURL)476FIND_METHOD(getAccessibleHyperlinkURLMethod, bridgeClass,477"getAccessibleHyperlinkURL",478"(Ljavax/accessibility/AccessibleHyperlink;)Ljava/lang/String;");479480// GetMethodID(getAccessibleHyperlinkStartIndex)481FIND_METHOD(getAccessibleHyperlinkStartIndexMethod, bridgeClass,482"getAccessibleHyperlinkStartIndex",483"(Ljavax/accessibility/AccessibleHyperlink;)I");484485// GetMethodID(getAccessibleHyperlinkEndIndex)486FIND_METHOD(getAccessibleHyperlinkEndIndexMethod, bridgeClass,487"getAccessibleHyperlinkEndIndex",488"(Ljavax/accessibility/AccessibleHyperlink;)I");489490// GetMethodID(getAccessibleHypertextLinkIndex)491FIND_METHOD(getAccessibleHypertextLinkIndexMethod, bridgeClass,492"getAccessibleHypertextLinkIndex",493"(Ljavax/accessibility/AccessibleHypertext;I)I");494495// Accessible KeyBinding, Icon and Action ====================496497// GetMethodID(getAccessibleKeyBindingsCount)498FIND_METHOD(getAccessibleKeyBindingsCountMethod, bridgeClass,499"getAccessibleKeyBindingsCount",500"(Ljavax/accessibility/AccessibleContext;)I");501502// GetMethodID(getAccessibleKeyBindingChar)503FIND_METHOD(getAccessibleKeyBindingCharMethod, bridgeClass,504"getAccessibleKeyBindingChar",505"(Ljavax/accessibility/AccessibleContext;I)C");506507// GetMethodID(getAccessibleKeyBindingModifiers)508FIND_METHOD(getAccessibleKeyBindingModifiersMethod, bridgeClass,509"getAccessibleKeyBindingModifiers",510"(Ljavax/accessibility/AccessibleContext;I)I");511512// GetMethodID(getAccessibleIconsCount)513FIND_METHOD(getAccessibleIconsCountMethod, bridgeClass,514"getAccessibleIconsCount",515"(Ljavax/accessibility/AccessibleContext;)I");516517// GetMethodID(getAccessibleIconDescription)518FIND_METHOD(getAccessibleIconDescriptionMethod, bridgeClass,519"getAccessibleIconDescription",520"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");521522// GetMethodID(getAccessibleIconHeight)523FIND_METHOD(getAccessibleIconHeightMethod, bridgeClass,524"getAccessibleIconHeight",525"(Ljavax/accessibility/AccessibleContext;I)I");526527// GetMethodID(getAccessibleIconWidth)528FIND_METHOD(getAccessibleIconWidthMethod, bridgeClass,529"getAccessibleIconWidth",530"(Ljavax/accessibility/AccessibleContext;I)I");531532// GetMethodID(getAccessibleActionsCount)533FIND_METHOD(getAccessibleActionsCountMethod, bridgeClass,534"getAccessibleActionsCount",535"(Ljavax/accessibility/AccessibleContext;)I");536537// GetMethodID(getAccessibleActionName)538FIND_METHOD(getAccessibleActionNameMethod, bridgeClass,539"getAccessibleActionName",540"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");541542// GetMethodID(doAccessibleActions)543FIND_METHOD(doAccessibleActionsMethod, bridgeClass,544"doAccessibleActions",545"(Ljavax/accessibility/AccessibleContext;Ljava/lang/String;)Z");546547// ------- AccessibleText methods548549// GetMethodID(getAccessibleCharCountFromContext)550FIND_METHOD(getAccessibleCharCountFromContextMethod, bridgeClass,551"getAccessibleCharCountFromContext",552"(Ljavax/accessibility/AccessibleContext;)I");553554// GetMethodID(getAccessibleCaretPositionFromContext)555FIND_METHOD(getAccessibleCaretPositionFromContextMethod, bridgeClass,556"getAccessibleCaretPositionFromContext",557"(Ljavax/accessibility/AccessibleContext;)I");558559// GetMethodID(getAccessibleIndexAtPointFromContext)560FIND_METHOD(getAccessibleIndexAtPointFromContextMethod, bridgeClass,561"getAccessibleIndexAtPointFromContext",562"(Ljavax/accessibility/AccessibleContext;II)I");563564// GetMethodID(getAccessibleLetterAtIndexFromContext)565FIND_METHOD(getAccessibleLetterAtIndexFromContextMethod, bridgeClass,566"getAccessibleLetterAtIndexFromContext",567"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");568569// GetMethodID(getAccessibleWordAtIndexFromContext)570FIND_METHOD(getAccessibleWordAtIndexFromContextMethod, bridgeClass,571"getAccessibleWordAtIndexFromContext",572"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");573574// GetMethodID(getAccessibleSentenceAtIndexFromContext)575FIND_METHOD(getAccessibleSentenceAtIndexFromContextMethod, bridgeClass,576"getAccessibleSentenceAtIndexFromContext",577"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");578579// GetMethodID(getAccessibleTextSelectionStartFromContext)580FIND_METHOD(getAccessibleTextSelectionStartFromContextMethod, bridgeClass,581"getAccessibleTextSelectionStartFromContext",582"(Ljavax/accessibility/AccessibleContext;)I");583584// GetMethodID(getAccessibleTextSelectionEndFromContext)585FIND_METHOD(getAccessibleTextSelectionEndFromContextMethod, bridgeClass,586"getAccessibleTextSelectionEndFromContext",587"(Ljavax/accessibility/AccessibleContext;)I");588589// GetMethodID(getAccessibleTextSelectedTextFromContext)590FIND_METHOD(getAccessibleTextSelectedTextFromContextMethod, bridgeClass,591"getAccessibleTextSelectedTextFromContext",592"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");593594// GetMethodID(getAccessibleAttributesAtIndexFromContext)595FIND_METHOD(getAccessibleAttributesAtIndexFromContextMethod, bridgeClass,596"getAccessibleAttributesAtIndexFromContext",597"(Ljavax/accessibility/AccessibleContext;I)Ljava/lang/String;");598599// GetMethodID(getAccessibleAttributeSetAtIndexFromContext)600FIND_METHOD(getAccessibleAttributeSetAtIndexFromContextMethod, bridgeClass,601"getAccessibleAttributeSetAtIndexFromContext",602"(Ljavax/accessibility/AccessibleContext;I)Ljavax/swing/text/AttributeSet;");603604// GetMethodID(getAccessibleTextRectAtIndexFromContext)605FIND_METHOD(getAccessibleTextRectAtIndexFromContextMethod, bridgeClass,606"getAccessibleTextRectAtIndexFromContext",607"(Ljavax/accessibility/AccessibleContext;I)Ljava/awt/Rectangle;");608609// GetMethodID(getAccessibleXcoordTextRectAtIndexFromContext)610FIND_METHOD(getAccessibleXcoordTextRectAtIndexFromContextMethod, bridgeClass,611"getAccessibleXcoordTextRectAtIndexFromContext",612"(Ljavax/accessibility/AccessibleContext;I)I");613614// GetMethodID(getAccessibleYcoordTextRectAtIndexFromContext)615FIND_METHOD(getAccessibleYcoordTextRectAtIndexFromContextMethod, bridgeClass,616"getAccessibleYcoordTextRectAtIndexFromContext",617"(Ljavax/accessibility/AccessibleContext;I)I");618619// GetMethodID(getAccessibleHeightTextRectAtIndexFromContext)620FIND_METHOD(getAccessibleHeightTextRectAtIndexFromContextMethod, bridgeClass,621"getAccessibleHeightTextRectAtIndexFromContext",622"(Ljavax/accessibility/AccessibleContext;I)I");623624// GetMethodID(getAccessibleWidthTextRectAtIndexFromContext)625FIND_METHOD(getAccessibleWidthTextRectAtIndexFromContextMethod, bridgeClass,626"getAccessibleWidthTextRectAtIndexFromContext",627"(Ljavax/accessibility/AccessibleContext;I)I");628629// GetMethodID(getCaretLocationX)630FIND_METHOD(getCaretLocationXMethod, bridgeClass,631"getCaretLocationX",632"(Ljavax/accessibility/AccessibleContext;)I");633634// GetMethodID(getCaretLocationY)635FIND_METHOD(getCaretLocationYMethod, bridgeClass,636"getCaretLocationY",637"(Ljavax/accessibility/AccessibleContext;)I");638639// GetMethodID(getCaretLocationHeight)640FIND_METHOD(getCaretLocationHeightMethod, bridgeClass,641"getCaretLocationHeight",642"(Ljavax/accessibility/AccessibleContext;)I");643644// GetMethodID(getCaretLocationWidth)645FIND_METHOD(getCaretLocationWidthMethod, bridgeClass,646"getCaretLocationWidth",647"(Ljavax/accessibility/AccessibleContext;)I");648649650// GetMethodID(getAccessibleTextLineLeftBoundsFromContextMethod)651FIND_METHOD(getAccessibleTextLineLeftBoundsFromContextMethod, bridgeClass,652"getAccessibleTextLineLeftBoundsFromContext",653"(Ljavax/accessibility/AccessibleContext;I)I");654655// GetMethodID(getAccessibleTextLineRightBoundsFromContextMethod)656FIND_METHOD(getAccessibleTextLineRightBoundsFromContextMethod, bridgeClass,657"getAccessibleTextLineRightBoundsFromContext",658"(Ljavax/accessibility/AccessibleContext;I)I");659660// GetMethodID(getAccessibleTextRangeFromContextMethod)661FIND_METHOD(getAccessibleTextRangeFromContextMethod, bridgeClass,662"getAccessibleTextRangeFromContext",663"(Ljavax/accessibility/AccessibleContext;II)Ljava/lang/String;");664665666// ------- AccessibleValue methods667668// GetMethodID(getCurrentAccessibleValueFromContext)669FIND_METHOD(getCurrentAccessibleValueFromContextMethod, bridgeClass,670"getCurrentAccessibleValueFromContext",671"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");672673// GetMethodID(getMaximumAccessibleValueFromContext)674FIND_METHOD(getMaximumAccessibleValueFromContextMethod, bridgeClass,675"getMaximumAccessibleValueFromContext",676"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");677678// GetMethodID(getMinimumAccessibleValueFromContext)679FIND_METHOD(getMinimumAccessibleValueFromContextMethod, bridgeClass,680"getMinimumAccessibleValueFromContext",681"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");682683684// ------- AccessibleSelection methods685686// GetMethodID(addAccessibleSelectionFromContext)687FIND_METHOD(addAccessibleSelectionFromContextMethod, bridgeClass,688"addAccessibleSelectionFromContext",689"(Ljavax/accessibility/AccessibleContext;I)V");690691// GetMethodID(clearAccessibleSelectionFromContext)692FIND_METHOD(clearAccessibleSelectionFromContextMethod, bridgeClass,693"clearAccessibleSelectionFromContext",694"(Ljavax/accessibility/AccessibleContext;)V");695696// GetMethodID(getAccessibleSelectionFromContext)697FIND_METHOD(getAccessibleSelectionContextFromContextMethod, bridgeClass,698"getAccessibleSelectionFromContext",699"(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;");700701// GetMethodID(getAccessibleSelectionCountFromContext)702FIND_METHOD(getAccessibleSelectionCountFromContextMethod, bridgeClass,703"getAccessibleSelectionCountFromContext",704"(Ljavax/accessibility/AccessibleContext;)I");705706// GetMethodID(isAccessibleChildSelectedFromContext)707FIND_METHOD(isAccessibleChildSelectedFromContextMethod, bridgeClass,708"isAccessibleChildSelectedFromContext",709"(Ljavax/accessibility/AccessibleContext;I)Z");710711// GetMethodID(removeAccessibleSelectionFromContext)712FIND_METHOD(removeAccessibleSelectionFromContextMethod, bridgeClass,713"removeAccessibleSelectionFromContext",714"(Ljavax/accessibility/AccessibleContext;I)V");715716// GetMethodID(selectAllAccessibleSelectionFromContext)717FIND_METHOD(selectAllAccessibleSelectionFromContextMethod, bridgeClass,718"selectAllAccessibleSelectionFromContext",719"(Ljavax/accessibility/AccessibleContext;)V");720721722// ------- Event Notification methods723724// GetMethodID(addJavaEventNotification)725FIND_METHOD(addJavaEventNotificationMethod, bridgeClass,726"addJavaEventNotification", "(J)V");727728// GetMethodID(removeJavaEventNotification)729FIND_METHOD(removeJavaEventNotificationMethod, bridgeClass,730"removeJavaEventNotification", "(J)V");731732// GetMethodID(addAccessibilityEventNotification)733FIND_METHOD(addAccessibilityEventNotificationMethod, bridgeClass,734"addAccessibilityEventNotification", "(J)V");735736// GetMethodID(removeAccessibilityEventNotification)737FIND_METHOD(removeAccessibilityEventNotificationMethod, bridgeClass,738"removeAccessibilityEventNotification", "(J)V");739740741// ------- AttributeSet methods742743// GetMethodID(getBoldFromAttributeSet)744FIND_METHOD(getBoldFromAttributeSetMethod, bridgeClass,745"getBoldFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");746747// GetMethodID(getItalicFromAttributeSet)748FIND_METHOD(getItalicFromAttributeSetMethod, bridgeClass,749"getItalicFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");750751// GetMethodID(getUnderlineFromAttributeSet)752FIND_METHOD(getUnderlineFromAttributeSetMethod, bridgeClass,753"getUnderlineFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");754755// GetMethodID(getStrikethroughFromAttributeSet)756FIND_METHOD(getStrikethroughFromAttributeSetMethod, bridgeClass,757"getStrikethroughFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");758759// GetMethodID(getSuperscriptFromAttributeSet)760FIND_METHOD(getSuperscriptFromAttributeSetMethod, bridgeClass,761"getSuperscriptFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");762763// GetMethodID(getSubscriptFromAttributeSet)764FIND_METHOD(getSubscriptFromAttributeSetMethod, bridgeClass,765"getSubscriptFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Z");766767// GetMethodID(getBackgroundColorFromAttributeSet)768FIND_METHOD(getBackgroundColorFromAttributeSetMethod, bridgeClass,769"getBackgroundColorFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;");770771// GetMethodID(getForegroundColorFromAttributeSet)772FIND_METHOD(getForegroundColorFromAttributeSetMethod, bridgeClass,773"getForegroundColorFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;");774775// GetMethodID(getFontFamilyFromAttributeSet)776FIND_METHOD(getFontFamilyFromAttributeSetMethod, bridgeClass,777"getFontFamilyFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)Ljava/lang/String;");778779// GetMethodID(getFontSizeFromAttributeSet)780FIND_METHOD(getFontSizeFromAttributeSetMethod, bridgeClass,781"getFontSizeFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I");782783// GetMethodID(getAlignmentFromAttributeSet)784FIND_METHOD(getAlignmentFromAttributeSetMethod, bridgeClass,785"getAlignmentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I");786787// GetMethodID(getBidiLevelFromAttributeSet)788FIND_METHOD(getBidiLevelFromAttributeSetMethod, bridgeClass,789"getBidiLevelFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)I");790791// GetMethodID(getFirstLineIndentFromAttributeSet)792FIND_METHOD(getFirstLineIndentFromAttributeSetMethod, bridgeClass,793"getFirstLineIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");794795// GetMethodID(getLeftIndentFromAttributeSet)796FIND_METHOD(getLeftIndentFromAttributeSetMethod, bridgeClass,797"getLeftIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");798799// GetMethodID(getRightIndentFromAttributeSet)800FIND_METHOD(getRightIndentFromAttributeSetMethod, bridgeClass,801"getRightIndentFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");802803// GetMethodID(getLineSpacingFromAttributeSet)804FIND_METHOD(getLineSpacingFromAttributeSetMethod, bridgeClass,805"getLineSpacingFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");806807// GetMethodID(getSpaceAboveFromAttributeSet)808FIND_METHOD(getSpaceAboveFromAttributeSetMethod, bridgeClass,809"getSpaceAboveFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");810811// GetMethodID(getSpaceBelowFromAttributeSet)812FIND_METHOD(getSpaceBelowFromAttributeSetMethod, bridgeClass,813"getSpaceBelowFromAttributeSet", "(Ljavax/swing/text/AttributeSet;)F");814815816/**817* Additional methods for Teton818*/819820// GetMethodID(requestFocus)821FIND_METHOD(requestFocusMethod, bridgeClass,822"requestFocus",823"(Ljavax/accessibility/AccessibleContext;)Z");824825// GetMethodID(selectTextRange)826FIND_METHOD(selectTextRangeMethod, bridgeClass,827"selectTextRange",828"(Ljavax/accessibility/AccessibleContext;II)Z");829830// GetMethodID(getVisibleChildrenCount)831FIND_METHOD(getVisibleChildrenCountMethod, bridgeClass,832"getVisibleChildrenCount",833"(Ljavax/accessibility/AccessibleContext;)I");834835// GetMethodID(getVisibleChild)836FIND_METHOD(getVisibleChildMethod, bridgeClass,837"getVisibleChild",838"(Ljavax/accessibility/AccessibleContext;I)Ljavax/accessibility/AccessibleContext;");839840// GetMethodID(setCaretPosition)841FIND_METHOD(setCaretPositionMethod, bridgeClass,842"setCaretPosition",843"(Ljavax/accessibility/AccessibleContext;I)Z");844845// GetMethodID(getVirtualAccessibleNameFromContextMethod) Ben Key846FIND_METHOD(getVirtualAccessibleNameFromContextMethod, bridgeClass,847"getVirtualAccessibleNameFromContext",848"(Ljavax/accessibility/AccessibleContext;)Ljava/lang/String;");849850return TRUE;851}852853// Note for the following code which makes JNI upcalls...854//855// Problem, bug DB 16818166, JBS DB JDK-8015400856// AccessibleContext is a JOBJECT64 which is a jobject (32 bit pointer)857// for a Legacy (XP) build and a jlong (64 bits) for a -32 or -64 build.858// For the -32 build the lower 32 bits needs to be extracted into a jobject.859// Otherwise, if AccessibleContext is used directly what happens is that860// the JNI code consumes the lower 32 of its 64 bits and that is not a861// problem, but then when the JNI code consumes the next 32 bits for the862// reference to the role String it gets the higher 0x00000000 bits from863// the 64 bit JOBJECT64 AccessibleContext variable and thus a null reference864// is passed as the String reference.865//866// Solution:867// Cast the JOBJECT64 to a jobject. For a 64 bit compile this is basically868// a noop, i.e. JOBJECT64 is a 64 bit jlong and a jobject is a 64 bit reference.869// For a 32 bit compile the cast drops the high order 32 bits, i.e. JOBJECT64870// is a 64 bit jlong and jobject is a 32 bit reference. For a Legacy build871// JOBJECT64 is a jobject so this is also basically a noop. The casts are872// done in the methods in JavaAccessBridge::processPackage.873874// -----------------------------------875876/**877* isJavaWindow - returns whether the HWND is a Java window or not878*879*/880BOOL881AccessBridgeJavaEntryPoints::isJavaWindow(jint window) {882jthrowable exception;883BOOL returnVal;884885PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::isJavaWindow(%X):", window);886887if (isJavaWindowMethod != (jmethodID) 0) {888returnVal = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, isJavaWindowMethod, window);889EXCEPTION_CHECK("Getting isJavaWindow - call to CallBooleanMethod()", FALSE);890return returnVal;891} else {892PrintDebugString("[ERROR]: either jniEnv == 0 or isJavaWindowMethod == 0");893return FALSE;894}895}896897// -----------------------------------898899/**900* isSameObject - returns whether two object reference refer to the same object901*902*/903BOOL904AccessBridgeJavaEntryPoints::isSameObject(jobject obj1, jobject obj2) {905jthrowable exception;906BOOL returnVal;907908PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::isSameObject(%p %p):", obj1, obj2);909910returnVal = (BOOL) jniEnv->IsSameObject((jobject)obj1, (jobject)obj2);911EXCEPTION_CHECK("Calling IsSameObject", FALSE);912913PrintDebugString("[INFO]: isSameObject returning %d", returnVal);914return returnVal;915}916917// -----------------------------------918919/**920* getAccessibleContextFromHWND - returns the AccessibleContext, if any, for an HWND921*922*/923jobject924AccessBridgeJavaEntryPoints::getAccessibleContextFromHWND(jint window) {925jobject returnedAccessibleContext;926jobject globalRef;927jthrowable exception;928929PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getAccessibleContextFromHWND(%X):", window);930931if (getAccessibleContextFromHWNDMethod != (jmethodID) 0) {932returnedAccessibleContext =933(jobject)jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleContextFromHWNDMethod,934window);935EXCEPTION_CHECK("Getting AccessibleContextFromHWND - call to CallObjectMethod()", (jobject) 0);936globalRef = (jobject)jniEnv->NewGlobalRef((jobject)returnedAccessibleContext);937EXCEPTION_CHECK("Getting AccessibleContextFromHWND - call to CallObjectMethod()", (jobject) 0);938return globalRef;939} else {940PrintDebugString("[ERROR]: either jniEnv == 0 or getAccessibleContextFromHWNDMethod == 0");941return (jobject) 0;942}943}944945// -----------------------------------946947/**948* getHWNDFromAccessibleContext - returns the HWND for an AccessibleContext, if any949* returns (HWND)0 on error.950*/951HWND952AccessBridgeJavaEntryPoints::getHWNDFromAccessibleContext(jobject accessibleContext) {953jthrowable exception;954HWND rHWND;955956PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getHWNDFromAccessibleContext(%X):",957accessibleContext);958959if (getHWNDFromAccessibleContextMethod != (jmethodID) 0) {960rHWND = (HWND)jniEnv->CallIntMethod(accessBridgeObject, getHWNDFromAccessibleContextMethod,961accessibleContext);962EXCEPTION_CHECK("Getting HWNDFromAccessibleContext - call to CallIntMethod()", (HWND)0);963PrintDebugString("[INFO]: rHWND = %X", rHWND);964return rHWND;965} else {966PrintDebugString("[ERROR]: either jniEnv == 0 or getHWNDFromAccessibleContextMethod == 0");967return (HWND)0;968}969}970971972/* ====== Utility methods ===== */973974/**975* Sets a text field to the specified string. Returns whether successful;976*/977BOOL978AccessBridgeJavaEntryPoints::setTextContents(const jobject accessibleContext, const wchar_t *text) {979jthrowable exception;980BOOL result = FALSE;981982PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::setTextContents(%p, %ls):",983accessibleContext, text);984985if (setTextContentsMethod != (jmethodID) 0) {986987// create a Java String for the text988jstring textString = jniEnv->NewString(text, (jsize)wcslen(text));989if (textString == 0) {990PrintDebugString("[ERROR]: NewString failed");991return FALSE;992}993994result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject,995setTextContentsMethod,996accessibleContext, textString);997EXCEPTION_CHECK("setTextContents - call to CallBooleanMethod()", FALSE);998PrintDebugString("[INFO]: result = %d", result);999return result;1000} else {1001PrintDebugString("[ERROR]: either jniEnv == 0 or setTextContentsMethod == 0");1002return result;1003}1004}10051006/**1007* Returns the Accessible Context of a Page Tab object that is the1008* ancestor of a given object. If the object is a Page Tab object1009* or a Page Tab ancestor object was found, returns the object1010* AccessibleContext.1011* If there is no ancestor object that has an Accessible Role of Page Tab,1012* returns (AccessibleContext)0.1013*/1014jobject1015AccessBridgeJavaEntryPoints::getParentWithRole(const jobject accessibleContext, const wchar_t *role) {1016jthrowable exception;1017jobject rAccessibleContext;10181019PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getParentWithRole(%p):",1020accessibleContext);10211022if (getParentWithRoleMethod != (jmethodID) 0) {1023// create a Java String for the role1024jstring roleName = jniEnv->NewString(role, (jsize)wcslen(role));1025if (roleName == 0) {1026PrintDebugString("[ERROR]: NewString failed");1027return FALSE;1028}10291030rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1031getParentWithRoleMethod,1032accessibleContext, roleName);1033EXCEPTION_CHECK("Getting ParentWithRole - call to CallObjectMethod()", (AccessibleContext)0);1034PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);1035jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);1036EXCEPTION_CHECK("Getting ParentWithRole - call to NewGlobalRef()", FALSE);1037PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1038rAccessibleContext, globalRef);1039return globalRef;1040} else {1041PrintDebugString("[ERROR]: either jniEnv == 0 or getParentWithRoleMethod == 0");1042return 0;1043}1044}10451046/**1047* Returns the Accessible Context for the top level object in1048* a Java Window. This is same Accessible Context that is obtained1049* from GetAccessibleContextFromHWND for that window. Returns1050* (AccessibleContext)0 on error.1051*/1052jobject1053AccessBridgeJavaEntryPoints::getTopLevelObject(const jobject accessibleContext) {1054jthrowable exception;1055jobject rAccessibleContext;10561057PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getTopLevelObject(%p):",1058accessibleContext);10591060if (getTopLevelObjectMethod != (jmethodID) 0) {1061rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1062getTopLevelObjectMethod,1063accessibleContext);1064EXCEPTION_CHECK("Getting TopLevelObject - call to CallObjectMethod()", FALSE);1065PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);1066jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);1067EXCEPTION_CHECK("Getting TopLevelObject - call to NewGlobalRef()", FALSE);1068PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1069rAccessibleContext, globalRef);1070return globalRef;1071} else {1072PrintDebugString("[ERROR]: either jniEnv == 0 or getTopLevelObjectMethod == 0");1073return 0;1074}1075}10761077/**1078* If there is an Ancestor object that has an Accessible Role of1079* Internal Frame, returns the Accessible Context of the Internal1080* Frame object. Otherwise, returns the top level object for that1081* Java Window. Returns (AccessibleContext)0 on error.1082*/1083jobject1084AccessBridgeJavaEntryPoints::getParentWithRoleElseRoot(const jobject accessibleContext, const wchar_t *role) {1085jthrowable exception;1086jobject rAccessibleContext;10871088PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getParentWithRoleElseRoot(%p):",1089accessibleContext);10901091if (getParentWithRoleElseRootMethod != (jmethodID) 0) {10921093// create a Java String for the role1094jstring roleName = jniEnv->NewString(role, (jsize)wcslen(role));1095if (roleName == 0) {1096PrintDebugString("[ERROR]: NewString failed");1097return FALSE;1098}10991100rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1101getParentWithRoleElseRootMethod,1102accessibleContext, roleName);1103EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to CallObjectMethod()", (AccessibleContext)0);1104PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);1105jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);1106EXCEPTION_CHECK("Getting ParentWithRoleElseRoot - call to NewGlobalRef()", FALSE);1107PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1108rAccessibleContext, globalRef);1109return globalRef;1110} else {1111PrintDebugString("[ERROR]: either jniEnv == 0 or getParentWithRoleElseRootMethod == 0");1112return 0;1113}1114}11151116/**1117* Returns how deep in the object hierarchy a given object is.1118* The top most object in the object hierarchy has an object depth of 0.1119* Returns -1 on error.1120*/1121jint1122AccessBridgeJavaEntryPoints::getObjectDepth(const jobject accessibleContext) {1123jthrowable exception;1124jint rResult;11251126PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getObjectDepth(%p):",1127accessibleContext);11281129if (getObjectDepthMethod != (jmethodID) 0) {1130rResult = jniEnv->CallIntMethod(accessBridgeObject,1131getObjectDepthMethod,1132accessibleContext);1133EXCEPTION_CHECK("Getting ObjectDepth - call to CallIntMethod()", -1);1134PrintDebugString("[INFO]: rResult = %d", rResult);1135return rResult;1136} else {1137PrintDebugString("[ERROR]: either jniEnv == 0 or getObjectDepthMethod == 0");1138return -1;1139}1140}1141114211431144/**1145* Returns the Accessible Context of the current ActiveDescendent of an object.1146* Returns 0 on error.1147*/1148jobject1149AccessBridgeJavaEntryPoints::getActiveDescendent(const jobject accessibleContext) {1150jthrowable exception;1151jobject rAccessibleContext;11521153PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getActiveDescendent(%p):",1154accessibleContext);11551156if (getActiveDescendentMethod != (jmethodID) 0) {1157rAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1158getActiveDescendentMethod,1159accessibleContext);1160EXCEPTION_CHECK("Getting ActiveDescendent - call to CallObjectMethod()", (AccessibleContext)0);1161PrintDebugString("[INFO]: rAccessibleContext = %p", rAccessibleContext);1162jobject globalRef = jniEnv->NewGlobalRef(rAccessibleContext);1163EXCEPTION_CHECK("Getting ActiveDescendant - call to NewGlobalRef()", FALSE);1164PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1165rAccessibleContext, globalRef);1166return globalRef;1167} else {1168PrintDebugString("[ERROR]: either jniEnv == 0 or getActiveDescendentMethod == 0");1169return (AccessibleContext)0;1170}1171}11721173/**1174* Additional methods for Teton1175*/11761177/**1178* Returns an AccessibleName for a component using an algorithm optimized1179* for the JAWS screen reader by Ben Key (Freedom Scientific). This method1180* is only intended for JAWS. All other uses are entirely optional.1181*1182* Bug ID 4916682 - Implement JAWS AccessibleName policy1183*/1184BOOL1185AccessBridgeJavaEntryPoints::getVirtualAccessibleName (1186IN const jobject object,1187OUT wchar_t * name,1188IN const int nameSize)1189{1190/*1191+1192Parameter validation1193+1194*/1195if ((name == 0) || (nameSize == 0))1196{1197return FALSE;1198}1199::memset (name, 0, nameSize * sizeof (wchar_t));1200if (0 == object)1201{1202return FALSE;1203}12041205jstring js = NULL;1206const wchar_t * stringBytes = NULL;1207jthrowable exception = NULL;1208jsize length = 0;1209PrintDebugString("[INFO]: getVirtualAccessibleName called.");1210if (getVirtualAccessibleNameFromContextMethod != (jmethodID) 0)1211{1212js = (jstring) jniEnv->CallObjectMethod (1213accessBridgeObject,1214getVirtualAccessibleNameFromContextMethod,1215object);1216EXCEPTION_CHECK("Getting AccessibleName - call to CallObjectMethod()", FALSE);1217if (js != (jstring) 0)1218{1219stringBytes = (const wchar_t *) jniEnv->GetStringChars (js, 0);1220EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE);1221wcsncpy(name, stringBytes, nameSize - 1);1222length = jniEnv->GetStringLength(js);1223EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE);1224jniEnv->ReleaseStringChars(js, stringBytes);1225EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE);1226jniEnv->CallVoidMethod (1227accessBridgeObject,1228decrementReferenceMethod, js);1229EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE);1230wPrintDebugString(L"[INFO]: Accessible Name = %ls", name);1231jniEnv->DeleteLocalRef(js);1232EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE);1233}1234else1235{1236PrintDebugString("[INFO]: Accessible Name is null.");1237}1238}1239else1240{1241PrintDebugString("[INFO]: either jniEnv == 0 or getVirtualAccessibleNameFromContextMethod == 0");1242return FALSE;1243}1244if ( 0 != name [0] )1245{1246return TRUE;1247}1248return FALSE;1249}125012511252/**1253* Request focus for a component. Returns whether successful;1254*1255* Bug ID 4944757 - requestFocus method needed1256*/1257BOOL1258AccessBridgeJavaEntryPoints::requestFocus(const jobject accessibleContext) {12591260jthrowable exception;1261BOOL result = FALSE;12621263PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::requestFocus(%p):",1264accessibleContext);12651266if (requestFocusMethod != (jmethodID) 0) {1267result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject,1268requestFocusMethod,1269accessibleContext);1270EXCEPTION_CHECK("requestFocus - call to CallBooleanMethod()", FALSE);1271PrintDebugString("[INFO]: result = %d", result);1272return result;1273} else {1274PrintDebugString("[ERROR]: either jniEnv == 0 or requestFocusMethod == 0");1275return result;1276}1277}12781279/**1280* Selects text between two indices. Selection includes the text at the start index1281* and the text at the end index. Returns whether successful;1282*1283* Bug ID 4944758 - selectTextRange method needed1284*/1285BOOL1286AccessBridgeJavaEntryPoints::selectTextRange(const jobject accessibleContext, int startIndex, int endIndex) {12871288jthrowable exception;1289BOOL result = FALSE;12901291PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::selectTextRange(%p start = %d end = %d):",1292accessibleContext, startIndex, endIndex);12931294if (selectTextRangeMethod != (jmethodID) 0) {1295result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject,1296selectTextRangeMethod,1297accessibleContext,1298startIndex, endIndex);1299EXCEPTION_CHECK("selectTextRange - call to CallBooleanMethod()", FALSE);1300PrintDebugString("[INFO]: result = %d", result);1301return result;1302} else {1303PrintDebugString("[ERROR]: either jniEnv == 0 or selectTextRangeMethod == 0");1304return result;1305}1306}13071308/*1309* Returns whether two text attributes are the same.1310*/1311static BOOL CompareAccessibleTextAttributesInfo(AccessibleTextAttributesInfo *one,1312AccessibleTextAttributesInfo *two) {1313return(one->bold == two->bold1314&& one->italic == two->italic1315&& one->underline == two->underline1316&& one->strikethrough == two->strikethrough1317&& one->superscript == two->superscript1318&& one->subscript == two->subscript1319&& one->fontSize == two->fontSize1320&& one->alignment == two->alignment1321&& one->bidiLevel == two->bidiLevel1322&& one->firstLineIndent == two->firstLineIndent1323&& one->leftIndent == two->leftIndent1324&& one->rightIndent == two->rightIndent1325&& one->lineSpacing == two->lineSpacing1326&& one->spaceAbove == two->spaceAbove1327&& one->spaceBelow == two->spaceBelow1328&& !wcscmp(one->backgroundColor,two->backgroundColor)1329&& !wcscmp(one->foregroundColor,two->foregroundColor)1330&& !wcscmp(one->fullAttributesString,two->fullAttributesString));1331}13321333/**1334* Get text attributes between two indices.1335*1336* Only one AccessibleTextAttributesInfo structure is passed - which1337* contains the attributes for the first character, the function then goes1338* through the following characters in the range specified and stops when the1339* attributes are different from the first, it then returns in the passed1340* parameter len the number of characters with the attributes returned. In most1341* situations this will be all the characters, and if not the calling program1342* can easily get the attributes for the next characters with different1343* attributes1344*1345* Bug ID 4944761 - getTextAttributes between two indices method needed1346*/13471348/* NEW FASTER CODE!!*/1349BOOL1350AccessBridgeJavaEntryPoints::getTextAttributesInRange(const jobject accessibleContext,1351int startIndex, int endIndex,1352AccessibleTextAttributesInfo *attributes, short *len) {13531354jstring js;1355const wchar_t *stringBytes;1356jthrowable exception;1357jsize length;1358BOOL result = FALSE;13591360PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::getTextAttributesInRange(%p start = %d end = %d):",1361accessibleContext, startIndex, endIndex);13621363*len = 0;1364result = getAccessibleTextAttributes((jobject)accessibleContext, startIndex, attributes);1365if (result != TRUE) {1366return FALSE;1367}1368(*len)++;13691370for (jint i = startIndex+1; i <= endIndex; i++) {13711372AccessibleTextAttributesInfo test_attributes = *attributes;1373// Get the full test_attributes string at i1374if (getAccessibleAttributesAtIndexFromContextMethod != (jmethodID) 0) {1375PrintDebugString("[INFO]: Getting full test_attributes string from Context...");1376js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1377getAccessibleAttributesAtIndexFromContextMethod,1378accessibleContext, i);1379EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallObjectMethod()", FALSE);1380PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);1381if (js != (jstring) 0) {1382stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1383EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringChars()", FALSE);1384wcsncpy(test_attributes.fullAttributesString, stringBytes, (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t)));1385length = jniEnv->GetStringLength(js);1386test_attributes.fullAttributesString[length < (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t)) ?1387length : (sizeof(test_attributes.fullAttributesString) / sizeof(wchar_t))-2] = (wchar_t) 0;1388EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringLength()", FALSE);1389jniEnv->ReleaseStringChars(js, stringBytes);1390EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to ReleaseStringChars()", FALSE);1391jniEnv->CallVoidMethod(accessBridgeObject,1392decrementReferenceMethod, js);1393EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallVoidMethod()", FALSE);1394wPrintDebugString(L"[INFO]: Accessible Text attributes = %ls", test_attributes.fullAttributesString);1395jniEnv->DeleteLocalRef(js);1396EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE);1397} else {1398PrintDebugString("[WARN]: Accessible Text attributes is null.");1399test_attributes.fullAttributesString[0] = (wchar_t) 0;1400return FALSE;1401}1402} else {1403PrintDebugString("[ERROR]: either env == 0 or getAccessibleAttributesAtIndexFromContextMethod == 0");1404return FALSE;1405}14061407if(wcscmp(attributes->fullAttributesString,test_attributes.fullAttributesString))1408break;1409if (result != TRUE) {1410return FALSE;1411}1412(*len)++;1413}1414return TRUE;1415}14161417/*1418* Returns the number of visible children of a component1419*1420* Bug ID 4944762- getVisibleChildren for list-like components needed1421*/1422int1423AccessBridgeJavaEntryPoints::getVisibleChildrenCount(const jobject accessibleContext) {14241425jthrowable exception;1426PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getVisibleChildrenCount(%p)",1427accessibleContext);14281429// get the visible children count1430int numChildren = jniEnv->CallIntMethod(accessBridgeObject, getVisibleChildrenCountMethod,1431accessibleContext);1432EXCEPTION_CHECK("##### Getting visible children count - call to CallIntMethod()", FALSE);1433PrintDebugString("[INFO]: ##### visible children count = %d", numChildren);14341435return numChildren;1436}143714381439/*1440* This method is used to iterate through the visible children of a component. It1441* returns visible children information for a component starting at nStartIndex.1442* No more than MAX_VISIBLE_CHILDREN VisibleChildrenInfo objects will1443* be returned for each call to this method. Returns FALSE on error.1444*1445* Bug ID 4944762- getVisibleChildren for list-like components needed1446*/1447BOOL AccessBridgeJavaEntryPoints::getVisibleChildren(const jobject accessibleContext,1448const int nStartIndex,1449/* OUT */ VisibleChildrenInfo *visibleChildrenInfo) {14501451jthrowable exception;14521453PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getVisibleChildren(%p, startIndex = %d)",1454accessibleContext, nStartIndex);14551456// get the visible children count1457int numChildren = jniEnv->CallIntMethod(accessBridgeObject, getVisibleChildrenCountMethod,1458accessibleContext);1459EXCEPTION_CHECK("##### Getting visible children count - call to CallIntMethod()", FALSE);1460PrintDebugString("[INFO]: ##### visible children count = %d", numChildren);14611462if (nStartIndex >= numChildren) {1463return FALSE;1464}14651466// get the visible children1467int bufIndex = 0;1468for (int i = nStartIndex; (i < numChildren) && (i < nStartIndex + MAX_VISIBLE_CHILDREN); i++) {1469PrintDebugString("[INFO]: getting visible child %d ...", i);14701471// get the visible child at index i1472jobject ac = jniEnv->CallObjectMethod(accessBridgeObject, getVisibleChildMethod,1473accessibleContext, i);1474EXCEPTION_CHECK("##### getVisibleChildMethod - call to CallObjectMethod()", FALSE);1475jobject globalRef = jniEnv->NewGlobalRef(ac);1476EXCEPTION_CHECK("##### getVisibleChildMethod - call to NewGlobalRef()", FALSE);1477visibleChildrenInfo->children[bufIndex] = (JOBJECT64)globalRef;1478PrintDebugString("[INFO]: ##### visible child = %p", globalRef);14791480bufIndex++;1481}1482visibleChildrenInfo->returnedChildrenCount = bufIndex;14831484PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getVisibleChildren succeeded");1485return TRUE;1486}14871488/**1489* Set the caret to a text position. Returns whether successful;1490*1491* Bug ID 4944770 - setCaretPosition method needed1492*/1493BOOL1494AccessBridgeJavaEntryPoints::setCaretPosition(const jobject accessibleContext, int position) {14951496jthrowable exception;1497BOOL result = FALSE;14981499PrintDebugString("[INFO]: In AccessBridgeJavaEntryPoints::setCaretPostion(%p position = %d):",1500accessibleContext, position);15011502if (setCaretPositionMethod != (jmethodID) 0) {1503result = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject,1504setCaretPositionMethod,1505accessibleContext, position);1506EXCEPTION_CHECK("setCaretPostion - call to CallBooleanMethod()", FALSE);1507PrintDebugString("[ERROR]: result = %d", result);1508return result;1509} else {1510PrintDebugString("[ERROR]: either jniEnv == 0 or setCaretPositionMethod == 0");1511return result;1512}1513}151415151516// -----------------------------------15171518/**1519* getVersionInfo - returns the version string of the java.version property1520* and the AccessBridge.java version1521*1522*/1523BOOL1524AccessBridgeJavaEntryPoints::getVersionInfo(AccessBridgeVersionInfo *info) {1525jstring js;1526const wchar_t *stringBytes;1527jthrowable exception;1528jsize length;15291530PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getVersionInfo():");15311532if (getJavaVersionPropertyMethod != (jmethodID) 0) {1533js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1534getJavaVersionPropertyMethod);1535EXCEPTION_CHECK("Getting JavaVersionProperty - call to CallObjectMethod()", FALSE);1536PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);1537if (js != (jstring) 0) {1538length = jniEnv->GetStringLength(js);1539stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1540if (stringBytes == NULL) {1541if (!jniEnv->ExceptionCheck()) {1542PrintDebugString("[ERROR]: *** Exception when getting JavaVersionProperty - call to GetStringChars");1543jniEnv->ExceptionDescribe();1544jniEnv->ExceptionClear();1545}1546return FALSE;1547}1548wcsncpy(info->bridgeJavaDLLVersion,1549stringBytes,1550sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t));1551info->bridgeJavaDLLVersion[length < (sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t)) ?1552length : (sizeof(info->bridgeJavaDLLVersion) / sizeof(wchar_t))-2] = (wchar_t) 0;1553wcsncpy(info->VMversion,1554stringBytes,1555sizeof(info->VMversion) / sizeof(wchar_t));1556info->VMversion[length < (sizeof(info->VMversion) / sizeof(wchar_t)) ?1557length : (sizeof(info->VMversion) / sizeof(wchar_t))-2] = (wchar_t) 0;1558wcsncpy(info->bridgeJavaClassVersion,1559stringBytes,1560sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t));1561info->bridgeJavaClassVersion[length < (sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t)) ?1562length : (sizeof(info->bridgeJavaClassVersion) / sizeof(wchar_t))-2] = (wchar_t) 0;1563wcsncpy(info->bridgeWinDLLVersion,1564stringBytes,1565sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t));1566info->bridgeWinDLLVersion[length < (sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t)) ?1567length : (sizeof(info->bridgeWinDLLVersion) / sizeof(wchar_t))-2] = (wchar_t) 0;1568jniEnv->ReleaseStringChars(js, stringBytes);1569EXCEPTION_CHECK("Getting JavaVersionProperty - call to ReleaseStringChars()", FALSE);1570jniEnv->CallVoidMethod(accessBridgeObject,1571decrementReferenceMethod, js);1572EXCEPTION_CHECK("Getting JavaVersionProperty - call to CallVoidMethod()", FALSE);1573wPrintDebugString(L"[INFO]: Java version = %ls", info->VMversion);1574jniEnv->DeleteLocalRef(js);1575EXCEPTION_CHECK("Getting JavaVersionProperty - call to DeleteLocalRef()", FALSE);1576} else {1577PrintDebugString("[WARN]: Java version is null.");1578info->VMversion[0] = (wchar_t) 0;1579return FALSE;1580}1581} else {1582PrintDebugString("[ERROR]: either env == 0 or getJavaVersionPropertyMethod == 0");1583return FALSE;1584}15851586return TRUE;1587}158815891590/*1591* Verifies the Java VM still exists and obj is an1592* instance of AccessibleText1593*/1594BOOL AccessBridgeJavaEntryPoints::verifyAccessibleText(jobject obj) {1595JavaVM *vm;1596BOOL retval;1597jthrowable exception;15981599PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::verifyAccessibleText");16001601if (jniEnv->GetJavaVM(&vm) != 0) {1602PrintDebugString("[ERROR]: No Java VM");1603return FALSE;1604}16051606if (obj == (jobject)0) {1607PrintDebugString("[ERROR]: Null jobject");1608return FALSE;1609}16101611// Copied from getAccessibleContextInfo1612if (getAccessibleTextFromContextMethod != (jmethodID) 0) {1613jobject returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,1614getAccessibleTextFromContextMethod,1615(jobject)obj);1616EXCEPTION_CHECK("Getting AccessibleText - call to CallObjectMethod()", FALSE);1617PrintDebugString("[ERROR]: AccessibleText = %p", returnedJobject);1618retval = returnedJobject != (jobject) 0;1619jniEnv->DeleteLocalRef(returnedJobject);1620EXCEPTION_CHECK("Getting AccessibleText - call to DeleteLocalRef()", FALSE);1621} else {1622PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextFromContextMethod == 0");1623return FALSE;1624}1625if (retval == FALSE) {1626PrintDebugString("[ERROR]: jobject is not an AccessibleText");1627}1628return retval;1629}163016311632/********** AccessibleContext routines ***********************************/16331634/**1635* getAccessibleContextAt - performs the Java method call:1636* Accessible AccessBridge.getAccessibleContextAt(x, y)1637*1638* Note: this call explicitly goes through the AccessBridge,1639* so that it can keep a reference the returned jobject for the JavaVM.1640* You must explicity call INTreleaseJavaObject() when you are through using1641* the Accessible returned, to let the AccessBridge know it can release the1642* object, so that the can then garbage collect it.1643*1644*/1645jobject1646AccessBridgeJavaEntryPoints::getAccessibleContextAt(jint x, jint y, jobject accessibleContext) {1647jobject returnedAccessibleContext;1648jobject globalRef;1649jthrowable exception;16501651PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleContextAt(%d, %d, %p):",1652x, y, accessibleContext);16531654if (getAccessibleContextAtMethod != (jmethodID) 0) {1655returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1656getAccessibleContextAtMethod,1657x, y, accessibleContext);1658EXCEPTION_CHECK("Getting AccessibleContextAt - call to CallObjectMethod()", FALSE);1659globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);1660EXCEPTION_CHECK("Getting AccessibleContextAt - call to NewGlobalRef()", FALSE);1661PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1662returnedAccessibleContext, globalRef);1663return globalRef;1664} else {1665PrintDebugString("[ERROR]: either env == 0 or getAccessibleContextAtMethod == 0");1666return (jobject) 0;1667}1668}16691670/**1671* getAccessibleWithFocus - performs the Java method calls:1672* Accessible Translator.getAccessible(SwingEventMonitor.getComponentWithFocus();1673*1674* Note: this call explicitly goes through the AccessBridge,1675* so that the AccessBridge can hide expected changes in how this functions1676* between JDK 1.1.x w/AccessibilityUtility classes, and JDK 1.2, when some1677* of this functionality may be built into the platform1678*1679*/1680jobject1681AccessBridgeJavaEntryPoints::getAccessibleContextWithFocus() {1682jobject returnedAccessibleContext;1683jobject globalRef;1684jthrowable exception;16851686PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleContextWithFocus()");16871688if (getAccessibleContextWithFocusMethod != (jmethodID) 0) {1689returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,1690getAccessibleContextWithFocusMethod);1691EXCEPTION_CHECK("Getting AccessibleContextWithFocus - call to CallObjectMethod()", FALSE);1692globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);1693EXCEPTION_CHECK("Getting AccessibleContextWithFocus - call to NewGlobalRef()", FALSE);1694PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",1695returnedAccessibleContext, globalRef);1696return globalRef;1697} else {1698PrintDebugString("[ERROR]: either jniEnv == 0 or getAccessibleContextWithFocusMethod == 0");1699return (jobject) 0;1700}1701}17021703/**1704* getAccessibleContextInfo - fills a struct with a bunch of information1705* contained in the Java Accessibility API1706*1707* Note: if the AccessibleContext parameter is bogus, this call will blow up1708*1709* Note: this call explicitly goes through the AccessBridge,1710* so that it can keep a reference the returned jobject for the JavaVM.1711* You must explicity call releaseJavaObject() when you are through using1712* the AccessibleContext returned, to let the AccessBridge know it can release the1713* object, so that the JavaVM can then garbage collect it.1714*/1715BOOL1716AccessBridgeJavaEntryPoints::getAccessibleContextInfo(jobject accessibleContext, AccessibleContextInfo *info) {1717jstring js;1718const wchar_t *stringBytes;1719jobject returnedJobject;1720jthrowable exception;1721jsize length;17221723PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleContextInfo(%p):", accessibleContext);17241725ZeroMemory(info, sizeof(AccessibleContextInfo));17261727if (accessibleContext == (jobject) 0) {1728PrintDebugString("[WARN]: passed in AccessibleContext == null! (oops)");1729return (FALSE);1730}17311732// Get the Accessible Name1733if (getAccessibleNameFromContextMethod != (jmethodID) 0) {1734js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1735getAccessibleNameFromContextMethod,1736accessibleContext);1737EXCEPTION_CHECK("Getting AccessibleName - call to CallObjectMethod()", FALSE);1738if (js != (jstring) 0) {1739stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1740EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE);1741wcsncpy(info->name, stringBytes, (sizeof(info->name) / sizeof(wchar_t)));1742length = jniEnv->GetStringLength(js);1743info->name[length < (sizeof(info->name) / sizeof(wchar_t)) ?1744length : (sizeof(info->name) / sizeof(wchar_t))-2] = (wchar_t) 0;1745EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE);1746jniEnv->ReleaseStringChars(js, stringBytes);1747EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE);1748jniEnv->CallVoidMethod(accessBridgeObject,1749decrementReferenceMethod, js);1750EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE);1751wPrintDebugString(L"[INFO]: Accessible Name = %ls", info->name);1752jniEnv->DeleteLocalRef(js);1753EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE);1754} else {1755PrintDebugString("[WARN]: Accessible Name is null.");1756info->name[0] = (wchar_t) 0;1757}1758} else {1759PrintDebugString("[ERROR]: either env == 0 or getAccessibleNameFromContextMethod == 0");1760return FALSE;1761}176217631764// Get the Accessible Description1765if (getAccessibleDescriptionFromContextMethod != (jmethodID) 0) {1766js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1767getAccessibleDescriptionFromContextMethod,1768accessibleContext);1769EXCEPTION_CHECK("Getting AccessibleDescription - call to CallObjectMethod()", FALSE);1770if (js != (jstring) 0) {1771stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1772EXCEPTION_CHECK("Getting AccessibleName - call to GetStringChars()", FALSE);1773wcsncpy(info->description, stringBytes, (sizeof(info->description) / sizeof(wchar_t)));1774length = jniEnv->GetStringLength(js);1775info->description[length < (sizeof(info->description) / sizeof(wchar_t)) ?1776length : (sizeof(info->description) / sizeof(wchar_t))-2] = (wchar_t) 0;1777EXCEPTION_CHECK("Getting AccessibleName - call to GetStringLength()", FALSE);1778jniEnv->ReleaseStringChars(js, stringBytes);1779EXCEPTION_CHECK("Getting AccessibleName - call to ReleaseStringChars()", FALSE);1780jniEnv->CallVoidMethod(accessBridgeObject,1781decrementReferenceMethod, js);1782EXCEPTION_CHECK("Getting AccessibleName - call to CallVoidMethod()", FALSE);1783wPrintDebugString(L"[INFO]: Accessible Description = %ls", info->description);1784jniEnv->DeleteLocalRef(js);1785EXCEPTION_CHECK("Getting AccessibleName - call to DeleteLocalRef()", FALSE);1786} else {1787PrintDebugString("[WARN]: Accessible Description is null.");1788info->description[0] = (wchar_t) 0;1789}1790} else {1791PrintDebugString("[ERROR]: either env == 0 or getAccessibleDescriptionFromContextMethod == 0");1792return FALSE;1793}179417951796// Get the Accessible Role String1797if (getAccessibleRoleStringFromContextMethod != (jmethodID) 0) {1798js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1799getAccessibleRoleStringFromContextMethod,1800accessibleContext);1801EXCEPTION_CHECK("Getting AccessibleRole - call to CallObjectMethod()", FALSE);1802if (js != (jstring) 0) {1803stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1804EXCEPTION_CHECK("Getting AccessibleRole - call to GetStringChars()", FALSE);1805wcsncpy(info->role, stringBytes, (sizeof(info->role) / sizeof(wchar_t)));1806length = jniEnv->GetStringLength(js);1807info->role[length < (sizeof(info->role) / sizeof(wchar_t)) ?1808length : (sizeof(info->role) / sizeof(wchar_t))-2] = (wchar_t) 0;1809EXCEPTION_CHECK("Getting AccessibleRole - call to GetStringLength()", FALSE);1810jniEnv->ReleaseStringChars(js, stringBytes);1811EXCEPTION_CHECK("Getting AccessibleRole - call to ReleaseStringChars()", FALSE);1812jniEnv->CallVoidMethod(accessBridgeObject,1813decrementReferenceMethod, js);1814EXCEPTION_CHECK("Getting AccessibleRole - call to CallVoidMethod()", FALSE);1815wPrintDebugString(L"[INFO]: Accessible Role = %ls", info->role);1816jniEnv->DeleteLocalRef(js);1817EXCEPTION_CHECK("Getting AccessibleRole - call to DeleteLocalRef()", FALSE);1818} else {1819PrintDebugString("[WARN]: Accessible Role is null.");1820info->role[0] = (wchar_t) 0;1821}1822} else {1823PrintDebugString("[ERROR]: either env == 0 or getAccessibleRoleStringFromContextMethod == 0");1824return FALSE;1825}182618271828// Get the Accessible Role String in the en_US locale1829if (getAccessibleRoleStringFromContext_en_USMethod != (jmethodID) 0) {1830js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1831getAccessibleRoleStringFromContext_en_USMethod,1832accessibleContext);1833EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to CallObjectMethod()", FALSE);1834if (js != (jstring) 0) {1835stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1836EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to GetStringChars()", FALSE);1837wcsncpy(info->role_en_US, stringBytes, (sizeof(info->role_en_US) / sizeof(wchar_t)));1838length = jniEnv->GetStringLength(js);1839info->role_en_US[length < (sizeof(info->role_en_US) / sizeof(wchar_t)) ?1840length : (sizeof(info->role_en_US) / sizeof(wchar_t))-2] = (wchar_t) 0;1841EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to GetStringLength()", FALSE);1842jniEnv->ReleaseStringChars(js, stringBytes);1843EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to ReleaseStringChars()", FALSE);1844jniEnv->CallVoidMethod(accessBridgeObject,1845decrementReferenceMethod, js);1846EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to CallVoidMethod()", FALSE);1847wPrintDebugString(L"[INFO]: Accessible Role en_US = %ls", info->role_en_US);1848jniEnv->DeleteLocalRef(js);1849EXCEPTION_CHECK("Getting AccessibleRole_en_US - call to DeleteLocalRef()", FALSE);1850} else {1851PrintDebugString("[WARN]: Accessible Role en_US is null.");1852info->role[0] = (wchar_t) 0;1853}1854} else {1855PrintDebugString("[ERROR]: either env == 0 or getAccessibleRoleStringFromContext_en_USMethod == 0");1856return FALSE;1857}18581859// Get the Accessible States String1860if (getAccessibleStatesStringFromContextMethod != (jmethodID) 0) {1861js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1862getAccessibleStatesStringFromContextMethod,1863accessibleContext);1864EXCEPTION_CHECK("Getting AccessibleState - call to CallObjectMethod()", FALSE);1865if (js != (jstring) 0) {1866stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1867EXCEPTION_CHECK("Getting AccessibleState - call to GetStringChars()", FALSE);1868wcsncpy(info->states, stringBytes, (sizeof(info->states) / sizeof(wchar_t)));1869length = jniEnv->GetStringLength(js);1870info->states[length < (sizeof(info->states) / sizeof(wchar_t)) ?1871length : (sizeof(info->states) / sizeof(wchar_t))-2] = (wchar_t) 0;1872EXCEPTION_CHECK("Getting AccessibleState - call to GetStringLength()", FALSE);1873jniEnv->ReleaseStringChars(js, stringBytes);1874EXCEPTION_CHECK("Getting AccessibleState - call to ReleaseStringChars()", FALSE);1875jniEnv->CallVoidMethod(accessBridgeObject,1876decrementReferenceMethod, js);1877EXCEPTION_CHECK("Getting AccessibleState - call to CallVoidMethod()", FALSE);1878wPrintDebugString(L"[INFO]: Accessible States = %ls", info->states);1879jniEnv->DeleteLocalRef(js);1880EXCEPTION_CHECK("Getting AccessibleState - call to DeleteLocalRef()", FALSE);1881} else {1882PrintDebugString("[WARN]: Accessible States is null.");1883info->states[0] = (wchar_t) 0;1884}1885} else {1886PrintDebugString("[ERROR]: either env == 0 or getAccessibleStatesStringFromContextMethod == 0");1887return FALSE;1888}18891890// Get the Accessible States String in the en_US locale1891if (getAccessibleStatesStringFromContext_en_USMethod != (jmethodID) 0) {1892js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,1893getAccessibleStatesStringFromContext_en_USMethod,1894accessibleContext);1895EXCEPTION_CHECK("Getting AccessibleState_en_US - call to CallObjectMethod()", FALSE);1896if (js != (jstring) 0) {1897stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);1898EXCEPTION_CHECK("Getting AccessibleState_en_US - call to GetStringChars()", FALSE);1899wcsncpy(info->states_en_US, stringBytes, (sizeof(info->states_en_US) / sizeof(wchar_t)));1900length = jniEnv->GetStringLength(js);1901info->states_en_US[length < (sizeof(info->states_en_US) / sizeof(wchar_t)) ?1902length : (sizeof(info->states_en_US) / sizeof(wchar_t))-2] = (wchar_t) 0;1903EXCEPTION_CHECK("Getting AccessibleState_en_US - call to GetStringLength()", FALSE);1904jniEnv->ReleaseStringChars(js, stringBytes);1905EXCEPTION_CHECK("Getting AccessibleState_en_US - call to ReleaseStringChars()", FALSE);1906jniEnv->CallVoidMethod(accessBridgeObject,1907decrementReferenceMethod, js);1908EXCEPTION_CHECK("Getting AccessibleState_en_US - call to CallVoidMethod()", FALSE);1909wPrintDebugString(L"[INFO]: Accessible States en_US = %ls", info->states_en_US);1910jniEnv->DeleteLocalRef(js);1911EXCEPTION_CHECK("Getting AccessibleState_en_US - call to DeleteLocalRef()", FALSE);1912} else {1913PrintDebugString("[WARN]: Accessible States en_US is null.");1914info->states[0] = (wchar_t) 0;1915}1916} else {1917PrintDebugString("[ERROR]: either env == 0 or getAccessibleStatesStringFromContext_en_USMethod == 0");1918return FALSE;1919}192019211922// Get the index in Parent1923if (getAccessibleIndexInParentFromContextMethod != (jmethodID) 0) {1924info->indexInParent = jniEnv->CallIntMethod(accessBridgeObject,1925getAccessibleIndexInParentFromContextMethod,1926accessibleContext);1927EXCEPTION_CHECK("Getting AccessibleIndexInParent - call to CallIntMethod()", FALSE);1928PrintDebugString("[INFO]: Index in Parent = %d", info->indexInParent);1929} else {1930PrintDebugString("[ERROR]: either env == 0 or getAccessibleIndexInParentFromContextMethod == 0");1931return FALSE;1932}193319341935PrintDebugString("[INFO]: *** jniEnv: %p; accessBridgeObject: %p; AccessibleContext: %p ***",1936jniEnv, accessBridgeObject, accessibleContext);19371938// Get the children count1939if (getAccessibleChildrenCountFromContextMethod != (jmethodID) 0) {1940info->childrenCount = jniEnv->CallIntMethod(accessBridgeObject,1941getAccessibleChildrenCountFromContextMethod,1942accessibleContext);1943EXCEPTION_CHECK("Getting AccessibleChildrenCount - call to CallIntMethod()", FALSE);1944PrintDebugString("[INFO]: Children count = %d", info->childrenCount);1945} else {1946PrintDebugString("[ERROR]: either env == 0 or getAccessibleChildrenCountFromContextMethod == 0");1947return FALSE;1948}19491950PrintDebugString("[INFO]: *** jniEnv: %p; accessBridgeObject: %p; AccessibleContext: %X ***",1951jniEnv, accessBridgeObject, accessibleContext);195219531954// Get the x coord1955if (getAccessibleXcoordFromContextMethod != (jmethodID) 0) {1956info->x = jniEnv->CallIntMethod(accessBridgeObject,1957getAccessibleXcoordFromContextMethod,1958accessibleContext);1959EXCEPTION_CHECK("Getting AccessibleXcoord - call to CallIntMethod()", FALSE);1960PrintDebugString("[INFO]: X coord = %d", info->x);1961} else {1962PrintDebugString("[ERROR]: either env == 0 or getAccessibleXcoordFromContextMethod == 0");1963return FALSE;1964}19651966PrintDebugString("[INFO]: *** jniEnv: %X; accessBridgeObject: %X; AccessibleContext: %p ***",1967jniEnv, accessBridgeObject, accessibleContext);196819691970// Get the y coord1971if (getAccessibleYcoordFromContextMethod != (jmethodID) 0) {1972info->y = jniEnv->CallIntMethod(accessBridgeObject,1973getAccessibleYcoordFromContextMethod,1974accessibleContext);1975EXCEPTION_CHECK("Getting AccessibleYcoord - call to CallIntMethod()", FALSE);1976PrintDebugString("[INFO]: Y coord = %d", info->y);1977} else {1978PrintDebugString("[ERROR]: either env == 0 or getAccessibleYcoordFromContextMethod == 0");1979return FALSE;1980}19811982// Get the width1983if (getAccessibleWidthFromContextMethod != (jmethodID) 0) {1984info->width = jniEnv->CallIntMethod(accessBridgeObject,1985getAccessibleWidthFromContextMethod,1986accessibleContext);1987EXCEPTION_CHECK("Getting AccessibleWidth - call to CallIntMethod()", FALSE);1988PrintDebugString("[INFO]: Width = %d", info->width);1989} else {1990PrintDebugString("[ERROR]: either env == 0 or getAccessibleWidthFromContextMethod == 0");1991return FALSE;1992}19931994// Get the height1995if (getAccessibleHeightFromContextMethod != (jmethodID) 0) {1996info->height = jniEnv->CallIntMethod(accessBridgeObject,1997getAccessibleHeightFromContextMethod,1998accessibleContext);1999EXCEPTION_CHECK("Getting AccessibleHeight - call to CallIntMethod()", FALSE);2000PrintDebugString("[INFO]: Height = %d", info->height);2001} else {2002PrintDebugString("[ERROR]: either env == 0 or getAccessibleHeightFromContextMethod == 0");2003return FALSE;2004}20052006// Get the AccessibleComponent2007if (getAccessibleComponentFromContextMethod != (jmethodID) 0) {2008returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2009getAccessibleComponentFromContextMethod,2010accessibleContext);2011EXCEPTION_CHECK("Getting AccessibleComponent - call to CallObjectMethod()", FALSE);2012PrintDebugString("[INFO]: AccessibleComponent = %p", returnedJobject);2013info->accessibleComponent = (returnedJobject != (jobject) 0 ? TRUE : FALSE);2014jniEnv->DeleteLocalRef(returnedJobject);2015EXCEPTION_CHECK("Getting AccessibleComponent - call to DeleteLocalRef()", FALSE);2016} else {2017PrintDebugString("[ERROR]: either env == 0 or getAccessibleComponentFromContextMethod == 0");2018return FALSE;2019}20202021// Get the AccessibleAction2022if (getAccessibleActionFromContextMethod != (jmethodID) 0) {2023returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2024getAccessibleActionFromContextMethod,2025accessibleContext);2026EXCEPTION_CHECK("Getting AccessibleAction - call to CallObjectMethod()", FALSE);2027PrintDebugString("[INFO]: AccessibleAction = %p", returnedJobject);2028info->accessibleAction = (returnedJobject != (jobject) 0 ? TRUE : FALSE);2029jniEnv->DeleteLocalRef(returnedJobject);2030EXCEPTION_CHECK("Getting AccessibleAction - call to DeleteLocalRef()", FALSE);2031} else {2032PrintDebugString("[ERROR]: either env == 0 or getAccessibleActionFromContextMethod == 0");2033return FALSE;2034}20352036// Get the AccessibleSelection2037if (getAccessibleSelectionFromContextMethod != (jmethodID) 0) {2038returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2039getAccessibleSelectionFromContextMethod,2040accessibleContext);2041EXCEPTION_CHECK("Getting AccessibleSelection - call to CallObjectMethod()", FALSE);2042PrintDebugString("[INFO]: AccessibleSelection = %p", returnedJobject);2043info->accessibleSelection = (returnedJobject != (jobject) 0 ? TRUE : FALSE);2044jniEnv->DeleteLocalRef(returnedJobject);2045EXCEPTION_CHECK("Getting AccessibleSelection - call to DeleteLocalRef()", FALSE);2046} else {2047PrintDebugString("[ERROR]: either env == 0 or getAccessibleSelectionFromContextMethod == 0");2048return FALSE;2049}20502051// Get the AccessibleTable2052if (getAccessibleTableFromContextMethod != (jmethodID) 0) {2053PrintDebugString("[INFO]: ##### Calling getAccessibleTableFromContextMethod ...");2054returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2055getAccessibleTableFromContextMethod,2056accessibleContext);2057PrintDebugString("[INFO]: ##### ... Returned from getAccessibleTableFromContextMethod");2058EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE);2059PrintDebugString("[INFO]: ##### AccessibleTable = %p", returnedJobject);2060if (returnedJobject != (jobject) 0) {2061info->accessibleInterfaces |= cAccessibleTableInterface;2062}2063jniEnv->DeleteLocalRef(returnedJobject);2064EXCEPTION_CHECK("##### Getting AccessibleTable - call to DeleteLocalRef()", FALSE);20652066/*2067returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2068getAccessibleTableFromContextMethod,2069AccessibleContext);2070PrintDebugString("##### ... Returned from getAccessibleTableFromContextMethod");2071EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE);2072PrintDebugString(" ##### AccessibleTable = %X", returnedJobject);2073info->accessibleTable = returnedJobject;2074*/20752076} else {2077PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableFromContextMethod == 0");2078return FALSE;2079}20802081// Get the AccessibleText2082if (getAccessibleTextFromContextMethod != (jmethodID) 0) {2083returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2084getAccessibleTextFromContextMethod,2085accessibleContext);2086EXCEPTION_CHECK("Getting AccessibleText - call to CallObjectMethod()", FALSE);2087PrintDebugString("[INFO]: AccessibleText = %p", returnedJobject);2088info->accessibleText = (returnedJobject != (jobject) 0 ? TRUE : FALSE);2089jniEnv->DeleteLocalRef(returnedJobject);2090EXCEPTION_CHECK("Getting AccessibleText - call to DeleteLocalRef()", FALSE);2091} else {2092PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextFromContextMethod == 0");2093return FALSE;2094}20952096// Get the AccessibleValue2097if (getAccessibleValueFromContextMethod != (jmethodID) 0) {2098returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2099getAccessibleValueFromContextMethod,2100accessibleContext);2101EXCEPTION_CHECK("Getting AccessibleValue - call to CallObjectMethod()", FALSE);2102PrintDebugString("[INFO]: AccessibleValue = %p", returnedJobject);2103if (returnedJobject != (jobject) 0) {2104info->accessibleInterfaces |= cAccessibleValueInterface;2105}2106jniEnv->DeleteLocalRef(returnedJobject);2107EXCEPTION_CHECK("Getting AccessibleValue - call to DeleteLocalRef()", FALSE);2108} else {2109PrintDebugString("[ERROR]: either env == 0 or getAccessibleValueFromContextMethod == 0");2110return FALSE;2111}21122113// FIX2114// get the AccessibleHypertext2115if (getAccessibleHypertextMethod != (jmethodID) 0 &&2116getAccessibleHyperlinkCountMethod != (jmethodID) 0 &&2117getAccessibleHyperlinkMethod != (jmethodID) 0 &&2118getAccessibleHyperlinkTextMethod != (jmethodID) 0 &&2119getAccessibleHyperlinkStartIndexMethod != (jmethodID) 0 &&2120getAccessibleHyperlinkEndIndexMethod != (jmethodID) 0) {2121returnedJobject = jniEnv->CallObjectMethod(accessBridgeObject,2122getAccessibleHypertextMethod,2123accessibleContext);2124EXCEPTION_CHECK("Getting AccessibleHypertext - call to CallObjectMethod()", FALSE);2125PrintDebugString("[INFO]: AccessibleHypertext = %p",2126returnedJobject);2127if (returnedJobject != (jobject) 0) {2128info->accessibleInterfaces |= cAccessibleHypertextInterface;2129}2130jniEnv->DeleteLocalRef(returnedJobject);2131EXCEPTION_CHECK("Getting AccessibleHypertext - call to DeleteLocalRef()", FALSE);2132}21332134// set new accessibleInterfaces flags from old BOOL values2135if(info->accessibleComponent)2136info->accessibleInterfaces |= cAccessibleComponentInterface;2137if(info->accessibleAction)2138info->accessibleInterfaces |= cAccessibleActionInterface;2139if(info->accessibleSelection)2140info->accessibleInterfaces |= cAccessibleSelectionInterface;2141if(info->accessibleText)2142info->accessibleInterfaces |= cAccessibleTextInterface;2143// FIX END21442145return TRUE;2146}21472148/**2149* getAccessibleChildFromContext - performs the Java method call:2150* AccessibleContext AccessBridge.getAccessibleChildContext(AccessibleContext)2151*2152* Note: if the AccessibleContext parameter is bogus, this call will blow up2153*2154* Note: this call explicitly goes through the AccessBridge,2155* so that it can keep a reference the returned jobject for the JavaVM.2156* You must explicity call releaseJavaObject() when you are through using2157* the AccessibleContext returned, to let the AccessBridge know it can release the2158* object, so that the JavaVM can then garbage collect it.2159*/2160jobject2161AccessBridgeJavaEntryPoints::getAccessibleChildFromContext(jobject accessibleContext, jint childIndex) {2162jobject returnedAccessibleContext;2163jobject globalRef;2164jthrowable exception;21652166PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleChildContext(%p, %d):",2167accessibleContext, childIndex);21682169if (getAccessibleChildFromContextMethod != (jmethodID) 0) {2170returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,2171getAccessibleChildFromContextMethod,2172accessibleContext, childIndex);2173EXCEPTION_CHECK("Getting AccessibleChild - call to CallObjectMethod()", FALSE);2174globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);2175EXCEPTION_CHECK("Getting AccessibleChild - call to NewGlobalRef()", FALSE);2176jniEnv->DeleteLocalRef(returnedAccessibleContext);2177EXCEPTION_CHECK("Getting AccessibleChild - call to DeleteLocalRef()", FALSE);2178PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",2179returnedAccessibleContext, globalRef);2180return globalRef;2181} else {2182PrintDebugString("[ERROR]: either env == 0 or getAccessibleChildContextMethod == 0");2183return (jobject) 0;2184}2185}21862187/**2188* getAccessibleParentFromContext - returns the AccessibleContext parent2189*2190*/2191jobject2192AccessBridgeJavaEntryPoints::getAccessibleParentFromContext(jobject accessibleContext)2193{2194jobject returnedAccessibleContext;2195jobject globalRef;2196jthrowable exception;21972198PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleParentFromContext(%p):", accessibleContext);21992200if (getAccessibleParentFromContextMethod != (jmethodID) 0) {2201returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,2202getAccessibleParentFromContextMethod,2203accessibleContext);2204EXCEPTION_CHECK("Getting AccessibleParent - call to CallObjectMethod()", FALSE);2205globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);2206EXCEPTION_CHECK("Getting AccessibleParent - call to NewGlobalRef()", FALSE);2207jniEnv->DeleteLocalRef(returnedAccessibleContext);2208EXCEPTION_CHECK("Getting AccessibleParent - call to DeleteLocalRef()", FALSE);2209PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",2210returnedAccessibleContext, globalRef);2211return globalRef;2212} else {2213PrintDebugString("[ERROR]: either env == 0 or getAccessibleParentFromContextMethod == 0");2214return (jobject) 0;2215}2216}221722182219/********** AccessibleTable routines **********************************/22202221BOOL2222AccessBridgeJavaEntryPoints::getAccessibleTableInfo(jobject accessibleContext,2223AccessibleTableInfo *tableInfo) {22242225jthrowable exception;22262227PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableInfo(%p):",2228accessibleContext);22292230// get the table row count2231if (getAccessibleTableRowCountMethod != (jmethodID) 0) {2232tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject,2233getAccessibleTableRowCountMethod,2234accessibleContext);2235EXCEPTION_CHECK("##### Getting AccessibleTableRowCount - call to CallIntMethod()", FALSE);2236PrintDebugString("[INFO]: ##### table row count = %d", tableInfo->rowCount);2237} else {2238PrintDebugString("[ERROR]: either env == 0 or getAccessibleRowCountMethod == 0");2239return FALSE;2240}22412242// get the table column count2243if (getAccessibleTableColumnCountMethod != (jmethodID) 0) {2244tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject,2245getAccessibleTableColumnCountMethod,2246accessibleContext);2247EXCEPTION_CHECK("Getting AccessibleTableColumnCount - call to CallIntMethod()", FALSE);2248PrintDebugString("[INFO]: ##### table column count = %d", tableInfo->columnCount);2249} else {2250PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnCountMethod == 0");2251return FALSE;2252}22532254// get the AccessibleTable2255if (getAccessibleTableFromContextMethod != (jmethodID) 0) {2256PrintDebugString("[INFO]: ##### Calling getAccessibleTableFromContextMethod ...");2257jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject,2258getAccessibleTableFromContextMethod,2259accessibleContext);2260PrintDebugString("[INFO]: ##### ... Returned from getAccessibleTableFromContextMethod");2261EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE);2262jobject globalRef = jniEnv->NewGlobalRef(accTable);2263EXCEPTION_CHECK("##### Getting AccessibleTable - call to NewGlobalRef()", FALSE);2264tableInfo->accessibleTable = (JOBJECT64)globalRef;2265PrintDebugString("[INFO]: ##### accessibleTable = %p", globalRef);2266} else {2267PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableFromContextMethod == 0");2268return FALSE;2269}22702271// cache the AccessibleContext2272if (getContextFromAccessibleTableMethod != (jmethodID) 0) {2273PrintDebugString("[INFO]: ##### Calling getContextFromAccessibleTable Method ...");2274jobject ac = jniEnv->CallObjectMethod(accessBridgeObject,2275getContextFromAccessibleTableMethod,2276accessibleContext);2277PrintDebugString("[INFO]: ##### ... Returned from getContextFromAccessibleTable Method");2278EXCEPTION_CHECK("##### Getting AccessibleTable - call to CallObjectMethod()", FALSE);2279jobject globalRef = jniEnv->NewGlobalRef(ac);2280EXCEPTION_CHECK("##### Getting AccessibleTable - call to NewGlobalRef()", FALSE);2281tableInfo->accessibleContext = (JOBJECT64)globalRef;2282PrintDebugString("[INFO]: ##### accessibleContext = %p", globalRef);2283} else {2284PrintDebugString("[ERROR]: either env == 0 or getContextFromAccessibleTable Method == 0");2285return FALSE;2286}22872288// FIX - set unused elements2289tableInfo->caption = NULL;2290tableInfo->summary = NULL;22912292PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableInfo succeeded");2293return TRUE;2294}22952296BOOL2297AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo(jobject accessibleTable, jint row, jint column,2298AccessibleTableCellInfo *tableCellInfo) {22992300jthrowable exception;23012302PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo(%p): row=%d, column=%d",2303accessibleTable, row, column);23042305// FIX2306ZeroMemory(tableCellInfo, sizeof(AccessibleTableCellInfo));2307tableCellInfo->row = row;2308tableCellInfo->column = column;2309// FIX END23102311// get the table cell index2312if (getAccessibleTableCellIndexMethod != (jmethodID) 0) {2313tableCellInfo->index = jniEnv->CallIntMethod(accessBridgeObject,2314getAccessibleTableCellIndexMethod,2315accessibleTable, row, column);2316EXCEPTION_CHECK("##### Getting AccessibleTableCellIndex - call to CallIntMethod()", FALSE);2317PrintDebugString("[INFO]: ##### table cell index = %d", tableCellInfo->index);2318} else {2319PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableCellIndexMethod == 0");2320return FALSE;2321}23222323// get the table cell row extent2324if (getAccessibleTableCellRowExtentMethod != (jmethodID) 0) {2325tableCellInfo->rowExtent = jniEnv->CallIntMethod(accessBridgeObject,2326getAccessibleTableCellRowExtentMethod,2327accessibleTable, row, column);2328EXCEPTION_CHECK("##### Getting AccessibleTableCellRowExtentCount - call to CallIntMethod()", FALSE);2329PrintDebugString("[INFO]: ##### table cell row extent = %d", tableCellInfo->rowExtent);2330} else {2331PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableCellRowExtentMethod == 0");2332return FALSE;2333}23342335// get the table cell column extent2336if (getAccessibleTableCellColumnExtentMethod != (jmethodID) 0) {2337tableCellInfo->columnExtent = jniEnv->CallIntMethod(accessBridgeObject,2338getAccessibleTableCellColumnExtentMethod,2339accessibleTable, row, column);2340EXCEPTION_CHECK("##### Getting AccessibleTableCellColumnExtentCount - call to CallIntMethod()", FALSE);2341PrintDebugString("[INFO]: ##### table cell column extent = %d", tableCellInfo->columnExtent);2342} else {2343PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableCellColumnExtentMethod == 0");2344return FALSE;2345}23462347// get whether the table cell is selected2348if (isAccessibleTableCellSelectedMethod != (jmethodID) 0) {2349tableCellInfo->isSelected = jniEnv->CallBooleanMethod(accessBridgeObject,2350isAccessibleTableCellSelectedMethod,2351accessibleTable, row, column);2352EXCEPTION_CHECK("##### Getting isAccessibleTableCellSelected - call to CallBooleanMethod()", FALSE);2353PrintDebugString("[INFO]: ##### table cell isSelected = %d", tableCellInfo->isSelected);2354} else {2355PrintDebugString("[ERROR]: either env == 0 or isAccessibleTableCellSelectedMethod == 0");2356return FALSE;2357}23582359// get the table cell AccessibleContext2360if (getAccessibleTableCellAccessibleContextMethod != (jmethodID) 0) {2361jobject tableCellAC = jniEnv->CallObjectMethod(accessBridgeObject,2362getAccessibleTableCellAccessibleContextMethod,2363accessibleTable, row, column);2364EXCEPTION_CHECK("##### Getting AccessibleTableCellAccessibleContext - call to CallObjectMethod()", FALSE);2365jobject globalRef = jniEnv->NewGlobalRef(tableCellAC);2366EXCEPTION_CHECK("##### Getting AccessibleTableCellAccessibleContext - call to NewGlobalRef()", FALSE);2367tableCellInfo->accessibleContext = (JOBJECT64)globalRef;2368PrintDebugString("[INFO]: ##### table cell AccessibleContext = %p", globalRef);2369} else {2370PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableCellAccessibleContextMethod == 0");2371return FALSE;2372}23732374PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableCellInfo succeeded");2375return TRUE;2376}23772378BOOL2379AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader(jobject acParent, AccessibleTableInfo *tableInfo) {23802381jthrowable exception;23822383PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader(%p):",2384acParent);23852386// get the header row count2387if (getAccessibleTableRowHeaderRowCountMethod != (jmethodID) 0) {2388tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject,2389getAccessibleTableRowHeaderRowCountMethod,2390acParent);2391EXCEPTION_CHECK("##### Getting AccessibleTableRowHeaderRowCount - call to CallIntMethod()", FALSE);2392PrintDebugString("[INFO]: ##### table row count = %d", tableInfo->rowCount);2393} else {2394PrintDebugString("[ERROR]: either env == 0 or getAccessibleRowHeaderRowCountMethod == 0");2395return FALSE;2396}23972398// get the header column count2399if (getAccessibleTableRowHeaderColumnCountMethod != (jmethodID) 0) {2400tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject,2401getAccessibleTableRowHeaderColumnCountMethod,2402acParent);2403EXCEPTION_CHECK("Getting AccessibleTableRowHeaderColumnCount - call to CallIntMethod()", FALSE);2404PrintDebugString("[INFO]: ##### table column count = %d", tableInfo->columnCount);2405} else {2406PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowHeaderColumnCountMethod == 0");2407return FALSE;2408}24092410// get the header AccessibleTable2411if (getAccessibleTableRowHeaderMethod != (jmethodID) 0) {2412jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject,2413getAccessibleTableRowHeaderMethod,2414acParent);2415EXCEPTION_CHECK("##### Getting AccessibleTableRowHeader - call to CallObjectMethod()", FALSE);2416jobject globalRef = jniEnv->NewGlobalRef(accTable);2417EXCEPTION_CHECK("##### Getting AccessibleTableRowHeader - call to NewGlobalRef()", FALSE);2418tableInfo->accessibleTable = (JOBJECT64)globalRef;2419PrintDebugString("[INFO]: ##### row header AccessibleTable = %p", globalRef);2420} else {2421PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowHeaderMethod == 0");2422return FALSE;2423}24242425// FIX - set unused elements2426tableInfo->caption = NULL;2427tableInfo->summary = NULL;2428tableInfo->accessibleContext = NULL;24292430PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowHeader succeeded");2431return TRUE;2432}24332434BOOL2435AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader(jobject acParent, AccessibleTableInfo *tableInfo) {2436jthrowable exception;24372438PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader(%p):",2439acParent);24402441// get the header row count2442if (getAccessibleTableColumnHeaderRowCountMethod != (jmethodID) 0) {2443tableInfo->rowCount = jniEnv->CallIntMethod(accessBridgeObject,2444getAccessibleTableColumnHeaderRowCountMethod,2445acParent);2446EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeaderRowCount - call to CallIntMethod()", FALSE);2447PrintDebugString("[INFO]: ##### table row count = %d", tableInfo->rowCount);2448} else {2449PrintDebugString("[ERROR]: either env == 0 or getAccessibleColumnHeaderRowCountMethod == 0");2450return FALSE;2451}24522453// get the header column count2454if (getAccessibleTableColumnHeaderColumnCountMethod != (jmethodID) 0) {2455tableInfo->columnCount = jniEnv->CallIntMethod(accessBridgeObject,2456getAccessibleTableColumnHeaderColumnCountMethod,2457acParent);2458EXCEPTION_CHECK("Getting AccessibleTableColumnHeaderColumnCount - call to CallIntMethod()", FALSE);2459PrintDebugString("[INFO]: ##### table column count = %d", tableInfo->columnCount);2460} else {2461PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnHeaderColumnCountMethod == 0");2462return FALSE;2463}2464// get the header AccessibleTable2465if (getAccessibleTableColumnHeaderMethod != (jmethodID) 0) {2466jobject accTable = jniEnv->CallObjectMethod(accessBridgeObject,2467getAccessibleTableColumnHeaderMethod,2468acParent);2469EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeader - call to CallObjectMethod()", FALSE);2470jobject globalRef = jniEnv->NewGlobalRef(accTable);2471EXCEPTION_CHECK("##### Getting AccessibleTableColumnHeader - call to NewGlobalRef()", FALSE);2472tableInfo->accessibleTable = (JOBJECT64)globalRef;2473PrintDebugString("[INFO]: ##### column header AccessibleTable = %p", globalRef);2474} else {2475PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnHeaderMethod == 0");2476return FALSE;2477}24782479// FIX - set unused elements2480tableInfo->caption = NULL;2481tableInfo->summary = NULL;2482tableInfo->accessibleContext = NULL;24832484PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnHeader succeeded");2485return TRUE;2486}24872488jobject2489AccessBridgeJavaEntryPoints::getAccessibleTableRowDescription(jobject acParent, jint row) {24902491jobject returnedAccessibleContext;2492jobject globalRef;2493jthrowable exception;24942495PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableRowDescription(%p):",2496acParent);24972498if (getAccessibleTableRowDescriptionMethod != (jmethodID) 0) {2499returnedAccessibleContext = jniEnv->CallObjectMethod(accessBridgeObject,2500getAccessibleTableRowDescriptionMethod,2501acParent, row);2502EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to CallObjectMethod()", FALSE);2503globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);2504EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to NewGlobalRef()", FALSE);2505jniEnv->DeleteLocalRef(returnedAccessibleContext);2506EXCEPTION_CHECK("Getting AccessibleTableRowDescription - call to DeleteLocalRef()", FALSE);2507PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",2508returnedAccessibleContext, globalRef);2509return globalRef;2510} else {2511PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowDescriptionMethod == 0");2512return (jobject) 0;2513}2514}25152516jobject2517AccessBridgeJavaEntryPoints::getAccessibleTableColumnDescription(jobject acParent, jint column) {25182519jobject returnedAccessibleContext;2520jobject globalRef;2521jthrowable exception;25222523PrintDebugString("[INFO]: ##### Calling AccessBridgeJavaEntryPoints::getAccessibleTableColumnDescription(%p):",2524acParent);25252526if (getAccessibleTableColumnDescriptionMethod != (jmethodID) 0) {2527returnedAccessibleContext = jniEnv->CallObjectMethod(2528accessBridgeObject,2529getAccessibleTableColumnDescriptionMethod,2530acParent, column);2531EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to CallObjectMethod()", FALSE);2532globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);2533EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to NewGlobalRef()", FALSE);2534jniEnv->DeleteLocalRef(returnedAccessibleContext);2535EXCEPTION_CHECK("Getting AccessibleTableColumnDescription - call to DeleteLocalRef()", FALSE);2536PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",2537returnedAccessibleContext, globalRef);2538return globalRef;2539} else {2540PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnDescriptionMethod == 0");2541return (jobject) 0;2542}2543}25442545jint2546AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount(jobject accessibleTable) {25472548jthrowable exception;2549jint count;25502551PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount(%p)",2552accessibleTable);25532554// Get the table row selection count2555if (getAccessibleTableRowSelectionCountMethod != (jmethodID) 0) {2556count = jniEnv->CallIntMethod(accessBridgeObject,2557getAccessibleTableRowSelectionCountMethod,2558accessibleTable);2559EXCEPTION_CHECK("##### Getting AccessibleTableRowSelectionCount - call to CallIntMethod()", FALSE);2560PrintDebugString("[INFO]: ##### table row selection count = %d", count);2561return count;2562} else {2563PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowSelectionCountMethod == 0");2564return 0;2565}25662567PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelectionCount failed");2568return 0;2569}25702571BOOL2572AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected(jobject accessibleTable, jint row) {2573jthrowable exception;2574BOOL result;25752576PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected(%p, %d)",2577accessibleTable, row);25782579if (isAccessibleTableRowSelectedMethod != (jmethodID) 0) {2580result = jniEnv->CallBooleanMethod(accessBridgeObject,2581isAccessibleTableRowSelectedMethod,2582accessibleTable, row);2583EXCEPTION_CHECK("##### Getting isAccessibleTableRowSelected - call to CallBooleanMethod()", FALSE);2584PrintDebugString("[INFO]: ##### table row isSelected = %d", result);2585return result;2586} else {2587PrintDebugString("[ERROR]: either env == 0 or isAccessibleTableRowSelectedMethod == 0");2588return FALSE;2589}25902591PrintDebugString("[ERROR]: AccessBridgeJavaEntryPoints::isAccessibleTableRowSelected failed");2592return FALSE;2593}25942595BOOL2596AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections(jobject accessibleTable, jint count,2597jint *selections) {25982599jthrowable exception;26002601PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections(%p, %d %p)",2602accessibleTable, count, selections);26032604if (getAccessibleTableRowSelectionsMethod == (jmethodID) 0) {2605return FALSE;2606}2607// Get the table row selections2608for (int i = 0; i < count; i++) {26092610selections[i] = jniEnv->CallIntMethod(accessBridgeObject,2611getAccessibleTableRowSelectionsMethod,2612accessibleTable,2613i);2614EXCEPTION_CHECK("##### Getting AccessibleTableRowSelections - call to CallIntMethod()", FALSE);2615PrintDebugString("[INFO]: ##### table row selection[%d] = %d", i, selections[i]);2616}26172618PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRowSelections succeeded");2619return TRUE;2620}262126222623jint2624AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount(jobject accessibleTable) {26252626jthrowable exception;2627jint count;26282629PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount(%p)",2630accessibleTable);26312632// Get the table column selection count2633if (getAccessibleTableColumnSelectionCountMethod != (jmethodID) 0) {2634count = jniEnv->CallIntMethod(accessBridgeObject,2635getAccessibleTableColumnSelectionCountMethod,2636accessibleTable);2637EXCEPTION_CHECK("##### Getting AccessibleTableColumnSelectionCount - call to CallIntMethod()", FALSE);2638PrintDebugString("[INFO]: ##### table column selection count = %d", count);2639return count;2640} else {2641PrintDebugString("[ERROR]: either env == 0 or getAccessibleRowCountMethod == 0");2642return 0;2643}26442645PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelectionCount failed");2646return 0;2647}26482649BOOL2650AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected(jobject accessibleTable, jint column) {2651jthrowable exception;2652BOOL result;26532654PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected(%p, %d)",2655accessibleTable, column);26562657if (isAccessibleTableColumnSelectedMethod != (jmethodID) 0) {2658result = jniEnv->CallBooleanMethod(accessBridgeObject,2659isAccessibleTableColumnSelectedMethod,2660accessibleTable, column);2661EXCEPTION_CHECK("##### Getting isAccessibleTableColumnSelected - call to CallBooleanMethod()", FALSE);2662PrintDebugString("[INFO]: ##### table column isSelected = %d", result);2663return result;2664} else {2665PrintDebugString("[ERROR]: either env == 0 or isAccessibleTableColumnSelectedMethod == 0");2666return FALSE;2667}26682669PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::isAccessibleTableColumnSelected failed");2670return FALSE;2671}26722673BOOL2674AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections(jobject accessibleTable, jint count,2675jint *selections) {2676jthrowable exception;26772678PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections(%p, %d, %p)",2679accessibleTable, count, selections);26802681if (getAccessibleTableColumnSelectionsMethod == (jmethodID) 0) {2682return FALSE;2683}2684// Get the table column selections2685for (int i = 0; i < count; i++) {26862687selections[i] = jniEnv->CallIntMethod(accessBridgeObject,2688getAccessibleTableColumnSelectionsMethod,2689accessibleTable,2690i);2691EXCEPTION_CHECK("##### Getting AccessibleTableColumnSelections - call to CallIntMethod()", FALSE);2692PrintDebugString("[INFO]: ##### table Column selection[%d] = %d", i, selections[i]);2693}26942695PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumnSelections succeeded");2696return TRUE;2697}269826992700jint2701AccessBridgeJavaEntryPoints::getAccessibleTableRow(jobject accessibleTable, jint index) {2702jthrowable exception;2703jint result;27042705PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRow(%p, index=%d)",2706accessibleTable, index);27072708if (getAccessibleTableRowMethod != (jmethodID) 0) {2709result = jniEnv->CallIntMethod(accessBridgeObject,2710getAccessibleTableRowMethod,2711accessibleTable, index);2712EXCEPTION_CHECK("##### Getting AccessibleTableRow - call to CallIntMethod()", FALSE);2713PrintDebugString("[INFO]: ##### table row = %d", result);2714return result;2715} else {2716PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableRowMethod == 0");2717return -1;2718}27192720PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableRow failed");2721return -1;2722}27232724jint2725AccessBridgeJavaEntryPoints::getAccessibleTableColumn(jobject accessibleTable, jint index) {2726jthrowable exception;2727jint result;27282729PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumn(%p, index=%d)",2730accessibleTable, index);27312732if (getAccessibleTableColumnMethod != (jmethodID) 0) {2733result = jniEnv->CallIntMethod(accessBridgeObject,2734getAccessibleTableColumnMethod,2735accessibleTable, index);2736EXCEPTION_CHECK("##### Getting AccessibleTableColumn - call to CallIntMethod()", FALSE);2737PrintDebugString("[INFO]: ##### table column = %d", result);2738return result;2739} else {2740PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableColumnMethod == 0");2741return -1;2742}27432744PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableColumn failed");2745return -1;2746}27472748jint2749AccessBridgeJavaEntryPoints::getAccessibleTableIndex(jobject accessibleTable, jint row, jint column) {2750jthrowable exception;2751jint result;27522753PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableIndex(%p, row=%d, col=%d)",2754accessibleTable, row, column);27552756if (getAccessibleTableIndexMethod != (jmethodID) 0) {2757result = jniEnv->CallIntMethod(accessBridgeObject,2758getAccessibleTableIndexMethod,2759accessibleTable, row, column);2760EXCEPTION_CHECK("##### Getting getAccessibleTableIndex - call to CallIntMethod()", FALSE);2761PrintDebugString("[INFO]: ##### table index = %d", result);2762return result;2763} else {2764PrintDebugString("[ERROR]: either env == 0 or getAccessibleTableIndexMethod == 0");2765return -1;2766}27672768PrintDebugString("[ERROR]: ##### AccessBridgeJavaEntryPoints::getAccessibleTableIndex failed");2769return -1;2770}27712772/********** end AccessibleTable routines ******************************/277327742775/********** begin AccessibleRelationSet routines **********************/27762777BOOL2778AccessBridgeJavaEntryPoints::getAccessibleRelationSet(jobject accessibleContext,2779AccessibleRelationSetInfo *relationSet) {27802781jthrowable exception;2782const wchar_t *stringBytes;2783jsize length;27842785PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleRelationSet(%p, %p)",2786accessibleContext, relationSet);27872788if (getAccessibleRelationCountMethod == (jmethodID) 0 ||2789getAccessibleRelationKeyMethod == (jmethodID) 0 ||2790getAccessibleRelationTargetCountMethod == (jmethodID) 0 ||2791getAccessibleRelationTargetMethod == (jmethodID) 0) {2792return FALSE;2793}27942795// Get the relations set count2796relationSet->relationCount = jniEnv->CallIntMethod(accessBridgeObject,2797getAccessibleRelationCountMethod,2798accessibleContext);2799EXCEPTION_CHECK("##### Getting AccessibleRelationCount - call to CallIntMethod()", FALSE);2800PrintDebugString("[INFO]: ##### AccessibleRelation count = %d", relationSet->relationCount);280128022803// Get the relation set2804for (int i = 0; i < relationSet->relationCount && i < MAX_RELATIONS; i++) {28052806jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,2807getAccessibleRelationKeyMethod,2808accessibleContext,2809i);28102811EXCEPTION_CHECK("Getting AccessibleRelationKey - call to CallObjectMethod()", FALSE);2812if (js != (jstring) 0) {2813stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);2814EXCEPTION_CHECK("Getting AccessibleRelation key - call to GetStringChars()", FALSE);2815wcsncpy(relationSet->relations[i].key, stringBytes, (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t)));2816length = jniEnv->GetStringLength(js);2817relationSet->relations[i].key [length < (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t)) ?2818length : (sizeof(relationSet->relations[i].key ) / sizeof(wchar_t))-2] = (wchar_t) 0;2819EXCEPTION_CHECK("Getting AccessibleRelation key - call to GetStringLength()", FALSE);2820jniEnv->ReleaseStringChars(js, stringBytes);2821EXCEPTION_CHECK("Getting AccessibleRelation key - call to ReleaseStringChars()", FALSE);2822// jniEnv->CallVoidMethod(accessBridgeObject,2823// decrementReferenceMethod, js);2824//EXCEPTION_CHECK("Getting AccessibleRelation key - call to CallVoidMethod()", FALSE);2825PrintDebugString("[INFO]: ##### AccessibleRelation key = %ls", relationSet->relations[i].key );2826jniEnv->DeleteLocalRef(js);2827EXCEPTION_CHECK("Getting AccessibleRelation key - call to DeleteLocalRef()", FALSE);2828} else {2829PrintDebugString("[WARN]: AccessibleRelation key is null.");2830relationSet->relations[i].key [0] = (wchar_t) 0;2831}28322833relationSet->relations[i].targetCount = jniEnv->CallIntMethod(accessBridgeObject,2834getAccessibleRelationTargetCountMethod,2835accessibleContext,2836i);28372838for (int j = 0; j < relationSet->relations[i].targetCount && j < MAX_RELATION_TARGETS; j++) {2839jobject target = jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleRelationTargetMethod,2840accessibleContext, i, j);2841EXCEPTION_CHECK("Getting AccessibleRelationSet - call to CallObjectMethod()", FALSE);2842jobject globalRef = jniEnv->NewGlobalRef(target);2843EXCEPTION_CHECK("Getting AccessibleRelationSet - call to NewGlobalRef()", FALSE);2844relationSet->relations[i].targets[j] = (JOBJECT64)globalRef;2845PrintDebugString("[INFO]: relation set item: %p", globalRef);2846}2847}28482849PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleRelationSet succeeded");2850return TRUE;2851}285228532854/********** end AccessibleRelationSet routines ************************/285528562857/********** begin AccessibleHypertext routines **********************/28582859BOOL2860AccessBridgeJavaEntryPoints::getAccessibleHypertext(jobject accessibleContext,2861AccessibleHypertextInfo *hypertext) {28622863jthrowable exception;2864const wchar_t *stringBytes;2865jsize length;28662867PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertext(%p, %p)",2868accessibleContext, hypertext);28692870// get the AccessibleHypertext2871jobject ht = jniEnv->CallObjectMethod(accessBridgeObject,2872getAccessibleHypertextMethod,2873accessibleContext);2874EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to CallObjectMethod()", FALSE);2875jobject globalRef = jniEnv->NewGlobalRef(ht);2876EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to NewGlobalRef()", FALSE);2877hypertext->accessibleHypertext = (JOBJECT64)globalRef;2878PrintDebugString("[INFO]: ##### AccessibleHypertext = %p", globalRef);28792880if (hypertext->accessibleHypertext == 0) {2881PrintDebugString("[WARN]: ##### null AccessibleHypertext; returning FALSE");2882return false;2883}28842885// get the hyperlink count2886hypertext->linkCount = jniEnv->CallIntMethod(accessBridgeObject,2887getAccessibleHyperlinkCountMethod,accessibleContext);28882889EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", FALSE);2890PrintDebugString("[INFO]: ##### hyperlink count = %d", hypertext->linkCount);289128922893// get the hypertext links2894for (int i = 0; i < hypertext->linkCount && i < MAX_HYPERLINKS; i++) {28952896// get the hyperlink2897jobject hl = jniEnv->CallObjectMethod(accessBridgeObject,2898getAccessibleHyperlinkMethod,2899accessibleContext,2900i);2901EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE);2902jobject globalRef = jniEnv->NewGlobalRef(hl);2903EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE);2904hypertext->links[i].accessibleHyperlink = (JOBJECT64)globalRef;2905PrintDebugString("[INFO]: ##### AccessibleHyperlink = %p", globalRef);29062907// get the hyperlink text2908jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,2909getAccessibleHyperlinkTextMethod,2910hypertext->links[i].accessibleHyperlink,2911i);29122913EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE);2914if (js != (jstring) 0) {2915stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);2916EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE);2917wcsncpy(hypertext->links[i].text, stringBytes, (sizeof(hypertext->links[i].text) / sizeof(wchar_t)));2918length = jniEnv->GetStringLength(js);2919if (length >= (sizeof(hypertext->links[i].text) / sizeof(wchar_t))) {2920length = (sizeof(hypertext->links[i].text) / sizeof(wchar_t)) - 2;2921}2922hypertext->links[i].text[length] = (wchar_t) 0;2923EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE);2924jniEnv->ReleaseStringChars(js, stringBytes);2925EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE);2926// jniEnv->CallVoidMethod(accessBridgeObject,2927// decrementReferenceMethod, js);2928//EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE);2929PrintDebugString("[INFO]: ##### AccessibleHyperlink text = %ls", hypertext->links[i].text );2930jniEnv->DeleteLocalRef(js);2931EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE);2932} else {2933PrintDebugString("[WARN]: AccessibleHyperlink text is null.");2934hypertext->links[i].text[0] = (wchar_t) 0;2935}29362937hypertext->links[i].startIndex = jniEnv->CallIntMethod(accessBridgeObject,2938getAccessibleHyperlinkStartIndexMethod,2939hypertext->links[i].accessibleHyperlink,2940i);2941EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE);2942PrintDebugString("[INFO]: ##### hyperlink start index = %d", hypertext->links[i].startIndex);294329442945hypertext->links[i].endIndex = jniEnv->CallIntMethod(accessBridgeObject,2946getAccessibleHyperlinkEndIndexMethod,2947hypertext->links[i].accessibleHyperlink,2948i);2949EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE);2950PrintDebugString("[INFO]: ##### hyperlink end index = %d", hypertext->links[i].endIndex);29512952}29532954PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertext succeeded");2955return TRUE;2956}29572958/*2959* Activates an AccessibleHyperlink2960*/2961BOOL2962AccessBridgeJavaEntryPoints::activateAccessibleHyperlink(jobject accessibleContext,2963jobject accessibleHyperlink) {29642965jthrowable exception;2966BOOL returnVal;29672968PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::activateAccessibleHyperlink(%p, %p):",2969accessibleContext, accessibleHyperlink);29702971if (activateAccessibleHyperlinkMethod != (jmethodID) 0) {2972returnVal = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject, activateAccessibleHyperlinkMethod,2973accessibleContext, accessibleHyperlink);2974EXCEPTION_CHECK("activateAccessibleHyperlink - call to CallBooleanMethod()", FALSE);2975return returnVal;2976} else {2977PrintDebugString("[ERROR]: either jniEnv == 0 or activateAccessibleHyperlinkMethod == 0");2978return FALSE;2979}2980}298129822983/*2984* This method is used to iterate through the hyperlinks in a component. It2985* returns hypertext information for a component starting at hyperlink index2986* nStartIndex. No more than MAX_HYPERLINKS AccessibleHypertextInfo objects will2987* be returned for each call to this method.2988* returns FALSE on error.2989*/2990BOOL2991AccessBridgeJavaEntryPoints::getAccessibleHypertextExt(const jobject accessibleContext,2992const jint nStartIndex,2993/* OUT */ AccessibleHypertextInfo *hypertext) {29942995jthrowable exception;2996const wchar_t *stringBytes;2997jsize length;2998PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertextExt(%p, %p, startIndex = %d)",2999accessibleContext, hypertext, nStartIndex);30003001// get the AccessibleHypertext3002jobject ht = jniEnv->CallObjectMethod(accessBridgeObject, getAccessibleHypertextMethod,3003accessibleContext);3004EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to CallObjectMethod()", FALSE);3005jobject globalRef = jniEnv->NewGlobalRef(ht);3006EXCEPTION_CHECK("##### Getting AccessibleHypertext - call to NewGlobalRef()", FALSE);3007hypertext->accessibleHypertext = (JOBJECT64)globalRef;3008PrintDebugString("[INFO]: ##### AccessibleHypertext = %p", globalRef);3009if (hypertext->accessibleHypertext == 0) {3010PrintDebugString("[WARN]: ##### null AccessibleHypertext; returning FALSE");3011return FALSE;3012}30133014// get the hyperlink count3015hypertext->linkCount = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHyperlinkCountMethod,3016accessibleContext);3017EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", FALSE);3018PrintDebugString("[INFO]: ##### hyperlink count = %d", hypertext->linkCount);30193020if (nStartIndex >= hypertext->linkCount) {3021return FALSE;3022}30233024// get the hypertext links3025// NOTE: To avoid a crash when there are more than MAX_HYPERLINKS (64) links3026// in the document, test for i < MAX_HYPERLINKS in addition to3027// i < hypertext->linkCount3028int bufIndex = 0;3029for (int i = nStartIndex; (i < hypertext->linkCount) && (i < nStartIndex + MAX_HYPERLINKS); i++) {3030PrintDebugString("[INFO]: getting hyperlink %d ...", i);30313032// get the hyperlink3033jobject hl = jniEnv->CallObjectMethod(accessBridgeObject,3034getAccessibleHyperlinkMethod,3035hypertext->accessibleHypertext,3036i);3037EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE);3038jobject globalRef = jniEnv->NewGlobalRef(hl);3039EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE);3040hypertext->links[bufIndex].accessibleHyperlink = (JOBJECT64)globalRef;3041PrintDebugString("[INFO]: ##### AccessibleHyperlink = %p", globalRef);30423043// get the hyperlink text3044jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,3045getAccessibleHyperlinkTextMethod,3046hypertext->links[bufIndex].accessibleHyperlink,3047i);30483049EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE);3050if (js != (jstring) 0) {3051stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3052EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE);3053wcsncpy(hypertext->links[bufIndex].text, stringBytes,3054(sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t)));3055length = jniEnv->GetStringLength(js);3056if (length >= (sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t))) {3057length = (sizeof(hypertext->links[bufIndex].text) / sizeof(wchar_t)) - 2;3058}3059hypertext->links[bufIndex].text[length] = (wchar_t) 0;3060EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE);3061jniEnv->ReleaseStringChars(js, stringBytes);3062EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE);3063// jniEnv->CallVoidMethod(accessBridgeObject,3064// decrementReferenceMethod, js);3065//EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE);3066PrintDebugString("[INFO]: ##### AccessibleHyperlink text = %ls", hypertext->links[bufIndex].text );3067jniEnv->DeleteLocalRef(js);3068EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE);30693070} else {3071PrintDebugString("[WARN]: AccessibleHyperlink text is null.");3072hypertext->links[bufIndex].text[0] = (wchar_t) 0;3073}30743075hypertext->links[bufIndex].startIndex = jniEnv->CallIntMethod(accessBridgeObject,3076getAccessibleHyperlinkStartIndexMethod,3077hypertext->links[bufIndex].accessibleHyperlink,3078i);3079EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE);3080PrintDebugString("[INFO]: ##### hyperlink start index = %d", hypertext->links[bufIndex].startIndex);30813082hypertext->links[bufIndex].endIndex = jniEnv->CallIntMethod(accessBridgeObject,3083getAccessibleHyperlinkEndIndexMethod,3084hypertext->links[bufIndex].accessibleHyperlink,3085i);3086EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE);3087PrintDebugString("[INFO]: ##### hyperlink end index = %d", hypertext->links[bufIndex].endIndex);30883089bufIndex++;3090}30913092PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertextExt succeeded");3093return TRUE;3094}30953096jint AccessBridgeJavaEntryPoints::getAccessibleHyperlinkCount(const jobject accessibleContext) {30973098jthrowable exception;30993100PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHyperlinkCount(%X)",3101accessibleContext);31023103if (getAccessibleHyperlinkCountMethod == (jmethodID)0) {3104return -1;3105}31063107// get the hyperlink count3108jint linkCount = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHyperlinkCountMethod,3109accessibleContext);3110EXCEPTION_CHECK("##### Getting hyperlink count - call to CallIntMethod()", -1);3111PrintDebugString("[INFO]: ##### hyperlink count = %d", linkCount);31123113return linkCount;3114}311531163117jint AccessBridgeJavaEntryPoints::getAccessibleHypertextLinkIndex(const jobject hypertext,3118const jint nIndex) {31193120jthrowable exception;31213122PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHypertextLinkIndex(%p, index = %d)",3123hypertext, nIndex);31243125if (getAccessibleHypertextLinkIndexMethod == (jmethodID)0) {3126return -1;3127}31283129// get the hyperlink index3130jint index = jniEnv->CallIntMethod(accessBridgeObject, getAccessibleHypertextLinkIndexMethod,3131hypertext, nIndex);31323133EXCEPTION_CHECK("##### Getting hyperlink index - call to CallIntMethod()", -1);3134PrintDebugString("[INFO]: ##### hyperlink index = %d", index);31353136return index;3137}31383139BOOL AccessBridgeJavaEntryPoints::getAccessibleHyperlink(jobject hypertext,3140const jint index,3141/* OUT */ AccessibleHyperlinkInfo *info) {31423143jthrowable exception;3144const wchar_t *stringBytes;3145jsize length;31463147PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleHyperlink(%p, index = %d)",3148hypertext, index);314931503151// get the hyperlink3152jobject hl = jniEnv->CallObjectMethod(accessBridgeObject,3153getAccessibleHyperlinkMethod,3154hypertext,3155index);3156EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to CallObjectMethod()", FALSE);3157jobject globalRef = jniEnv->NewGlobalRef(hl);3158EXCEPTION_CHECK("##### Getting AccessibleHyperlink - call to NewGlobalRef()", FALSE);3159info->accessibleHyperlink = (JOBJECT64)globalRef;3160PrintDebugString("[INFO]: ##### AccessibleHyperlink = %p", globalRef);31613162// get the hyperlink text3163jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,3164getAccessibleHyperlinkTextMethod,3165info->accessibleHyperlink,3166index);31673168EXCEPTION_CHECK("Getting hyperlink text - call to CallObjectMethod()", FALSE);3169if (js != (jstring) 0) {3170stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3171EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringChars()", FALSE);3172wcsncpy(info->text, stringBytes,3173(sizeof(info->text) / sizeof(wchar_t)));3174length = jniEnv->GetStringLength(js);3175if (length >= (sizeof(info->text) / sizeof(wchar_t))) {3176length = (sizeof(info->text) / sizeof(wchar_t)) - 2;3177}3178info->text[length] = (wchar_t) 0;3179EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to GetStringLength()", FALSE);3180jniEnv->ReleaseStringChars(js, stringBytes);3181EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to ReleaseStringChars()", FALSE);3182// jniEnv->CallVoidMethod(accessBridgeObject,3183// decrementReferenceMethod, js);3184//EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to CallVoidMethod()", FALSE);3185PrintDebugString("[INFO]: ##### AccessibleHyperlink text = %ls", info->text );3186jniEnv->DeleteLocalRef(js);3187EXCEPTION_CHECK("Getting AccessibleHyperlink text - call to DeleteLocalRef()", FALSE);31883189} else {3190PrintDebugString("[WARN]: AccessibleHyperlink text is null.");3191info->text[0] = (wchar_t) 0;3192}31933194info->startIndex = jniEnv->CallIntMethod(accessBridgeObject,3195getAccessibleHyperlinkStartIndexMethod,3196info->accessibleHyperlink,3197index);3198EXCEPTION_CHECK("##### Getting hyperlink start index - call to CallIntMethod()", FALSE);3199PrintDebugString("[INFO]: ##### hyperlink start index = %d", info->startIndex);32003201info->endIndex = jniEnv->CallIntMethod(accessBridgeObject,3202getAccessibleHyperlinkEndIndexMethod,3203info->accessibleHyperlink,3204index);3205EXCEPTION_CHECK("##### Getting hyperlink end index - call to CallIntMethod()", FALSE);3206PrintDebugString("[INFO]: ##### hyperlink end index = %d", info->endIndex);32073208return TRUE;3209}321032113212/********** end AccessibleHypertext routines ************************/32133214// Accessible Keybinding methods3215BOOL AccessBridgeJavaEntryPoints::getAccessibleKeyBindings(jobject accessibleContext,3216AccessibleKeyBindings *keyBindings) {32173218jthrowable exception;32193220PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleKeyBindings(%p, %p)",3221accessibleContext, keyBindings);32223223if (getAccessibleKeyBindingsCountMethod == (jmethodID) 0 ||3224getAccessibleKeyBindingCharMethod == (jmethodID) 0 ||3225getAccessibleKeyBindingModifiersMethod == (jmethodID) 0) {3226return FALSE;3227}32283229// get the key binding count3230keyBindings->keyBindingsCount = jniEnv->CallIntMethod(accessBridgeObject,3231getAccessibleKeyBindingsCountMethod, accessibleContext);32323233EXCEPTION_CHECK("##### Getting key bindings count - call to CallIntMethod()", FALSE);32343235PrintDebugString("[INFO]: ##### key bindings count = %d", keyBindings->keyBindingsCount);32363237// get the key bindings3238for (int i = 0; i < keyBindings->keyBindingsCount && i < MAX_KEY_BINDINGS; i++) {32393240// get the key binding character3241keyBindings->keyBindingInfo[i].character = jniEnv->CallCharMethod(accessBridgeObject,3242getAccessibleKeyBindingCharMethod,3243accessibleContext,3244i);3245EXCEPTION_CHECK("##### Getting key binding character - call to CallCharMethod()", FALSE);3246PrintDebugString("[INFO]: ##### key binding character = %c"\3247" ##### key binding character in hex = %hx"\3248, keyBindings->keyBindingInfo[i].character, keyBindings->keyBindingInfo[i].character);32493250// get the key binding modifiers3251keyBindings->keyBindingInfo[i].modifiers = jniEnv->CallIntMethod(accessBridgeObject,3252getAccessibleKeyBindingModifiersMethod,3253accessibleContext,3254i);3255EXCEPTION_CHECK("##### Getting key binding modifiers - call to CallIntMethod()", FALSE);3256PrintDebugString("[INFO]: ##### key binding modifiers = %x", keyBindings->keyBindingInfo[i].modifiers);3257}3258return FALSE;3259}32603261// AccessibleIcon methods3262BOOL AccessBridgeJavaEntryPoints::getAccessibleIcons(jobject accessibleContext,3263AccessibleIcons *icons) {32643265jthrowable exception;3266const wchar_t *stringBytes;3267jsize length;32683269PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleIcons(%p, %p)",3270accessibleContext, icons);32713272if (getAccessibleIconsCountMethod == (jmethodID) 0 ||3273getAccessibleIconDescriptionMethod == (jmethodID) 0 ||3274getAccessibleIconHeightMethod == (jmethodID) 0 ||3275getAccessibleIconWidthMethod == (jmethodID) 0) {3276PrintDebugString("[WARN]: ##### missing method(s) !!!");3277return FALSE;3278}327932803281// get the icons count3282icons->iconsCount = jniEnv->CallIntMethod(accessBridgeObject,3283getAccessibleIconsCountMethod, accessibleContext);32843285EXCEPTION_CHECK("##### Getting icons count - call to CallIntMethod()", FALSE);3286PrintDebugString("[INFO]: ##### icons count = %d", icons->iconsCount);328732883289// get the icons3290for (int i = 0; i < icons->iconsCount && i < MAX_ICON_INFO; i++) {32913292// get the icon description3293jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,3294getAccessibleIconDescriptionMethod,3295accessibleContext,3296i);32973298EXCEPTION_CHECK("Getting icon description - call to CallObjectMethod()", FALSE);3299if (js != (jstring) 0) {3300stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3301EXCEPTION_CHECK("Getting AccessibleIcon description - call to GetStringChars()", FALSE);3302wcsncpy(icons->iconInfo[i].description, stringBytes, (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t)));3303length = jniEnv->GetStringLength(js);3304if (length >= (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t))) {3305length = (sizeof(icons->iconInfo[i].description) / sizeof(wchar_t)) - 2;3306}3307icons->iconInfo[i].description[length] = (wchar_t) 0;3308EXCEPTION_CHECK("Getting AccessibleIcon description - call to GetStringLength()", FALSE);3309jniEnv->ReleaseStringChars(js, stringBytes);3310EXCEPTION_CHECK("Getting AccessibleIcon description - call to ReleaseStringChars()", FALSE);3311// jniEnv->CallVoidMethod(accessBridgeObject,3312// decrementReferenceMethod, js);3313//EXCEPTION_CHECK("Getting AccessibleIcon description - call to CallVoidMethod()", FALSE);3314PrintDebugString("[INFO]: ##### AccessibleIcon description = %ls", icons->iconInfo[i].description );3315jniEnv->DeleteLocalRef(js);3316EXCEPTION_CHECK("Getting AccessibleIcon description - call to DeleteLocalRef()", FALSE);3317} else {3318PrintDebugString("[WARN]: AccessibleIcon description is null.");3319icons->iconInfo[i].description[0] = (wchar_t) 0;3320}332133223323// get the icon height3324icons->iconInfo[i].height = jniEnv->CallIntMethod(accessBridgeObject,3325getAccessibleIconHeightMethod,3326accessibleContext,3327i);3328EXCEPTION_CHECK("##### Getting icon height - call to CallIntMethod()", FALSE);3329PrintDebugString("[INFO]: ##### icon height = %d", icons->iconInfo[i].height);33303331// get the icon width3332icons->iconInfo[i].width = jniEnv->CallIntMethod(accessBridgeObject,3333getAccessibleIconWidthMethod,3334accessibleContext,3335i);3336EXCEPTION_CHECK("##### Getting icon width - call to CallIntMethod()", FALSE);3337PrintDebugString("[INFO]: ##### icon width = %d", icons->iconInfo[i].width);3338}3339return FALSE;3340}33413342// AccessibleActionMethods3343BOOL AccessBridgeJavaEntryPoints::getAccessibleActions(jobject accessibleContext,3344AccessibleActions *actions) {33453346jthrowable exception;3347const wchar_t *stringBytes;3348jsize length;33493350PrintDebugString("[INFO]: ##### AccessBridgeJavaEntryPoints::getAccessibleIcons(%p, %p)",3351accessibleContext, actions);33523353if (getAccessibleActionsCountMethod == (jmethodID) 0 ||3354getAccessibleActionNameMethod == (jmethodID) 0) {3355PrintDebugString("[WARN]: ##### missing method(s) !!!");3356return FALSE;3357}335833593360// get the icons count3361actions->actionsCount = jniEnv->CallIntMethod(accessBridgeObject,3362getAccessibleActionsCountMethod,accessibleContext);33633364EXCEPTION_CHECK("##### Getting actions count - call to CallIntMethod()", FALSE);3365PrintDebugString("[INFO]: ##### key actions count = %d", actions->actionsCount);336633673368// get the actions3369for (int i = 0; i < actions->actionsCount && i < MAX_ACTION_INFO; i++) {33703371// get the action name3372jstring js = (jstring)jniEnv->CallObjectMethod(accessBridgeObject,3373getAccessibleActionNameMethod,3374accessibleContext,3375i);33763377EXCEPTION_CHECK("Getting Action Name - call to CallObjectMethod()", FALSE);3378if (js != (jstring) 0) {3379stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3380EXCEPTION_CHECK("Getting AccessibleAction Name - call to GetStringChars()", FALSE);3381wcsncpy(actions->actionInfo[i].name , stringBytes, (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t)));3382length = jniEnv->GetStringLength(js);3383if (length >= (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t))) {3384length = (sizeof(actions->actionInfo[i].name ) / sizeof(wchar_t)) - 2;3385}3386actions->actionInfo[i].name [length] = (wchar_t) 0;3387EXCEPTION_CHECK("Getting AccessibleAction name - call to GetStringLength()", FALSE);3388jniEnv->ReleaseStringChars(js, stringBytes);3389EXCEPTION_CHECK("Getting AccessibleAction name - call to ReleaseStringChars()", FALSE);3390// jniEnv->CallVoidMethod(accessBridgeObject,3391// decrementReferenceMethod, js);3392//EXCEPTION_CHECK("Getting AccessibleAction name - call to CallVoidMethod()", FALSE);3393PrintDebugString("[INFO]: ##### AccessibleAction name = %ls", actions->actionInfo[i].name );3394jniEnv->DeleteLocalRef(js);3395EXCEPTION_CHECK("Getting AccessibleAction name - call to DeleteLocalRef()", FALSE);3396} else {3397PrintDebugString("[WARN]: AccessibleAction name is null.");3398actions->actionInfo[i].name [0] = (wchar_t) 0;3399}3400}3401return FALSE;3402}34033404BOOL AccessBridgeJavaEntryPoints::doAccessibleActions(jobject accessibleContext,3405AccessibleActionsToDo *actionsToDo,3406jint *failure) {34073408jthrowable exception;3409BOOL returnVal;34103411PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::doAccessibleActions(%p, #actions %d %s):",3412accessibleContext,3413actionsToDo->actionsCount,3414actionsToDo->actions[0].name);34153416if (doAccessibleActionsMethod == (jmethodID) 0) {3417*failure = 0;3418return FALSE;3419}34203421PrintDebugString("[INFO]: doing %d actions ...", actionsToDo->actionsCount);3422for (int i = 0; i < actionsToDo->actionsCount && i < MAX_ACTIONS_TO_DO; i++) {3423PrintDebugString("[INFO]: doing action %d: %s ...", i, actionsToDo->actions[i].name);34243425// create a Java String for the action name3426wchar_t *actionName = (wchar_t *)actionsToDo->actions[i].name;3427jstring javaName = jniEnv->NewString(actionName, (jsize)wcslen(actionName));3428if (javaName == 0) {3429PrintDebugString("[ERROR]: NewString failed");3430*failure = i;3431return FALSE;3432}34333434returnVal = (BOOL)jniEnv->CallBooleanMethod(accessBridgeObject, doAccessibleActionsMethod,3435accessibleContext, javaName);3436jniEnv->DeleteLocalRef(javaName);3437EXCEPTION_CHECK("doAccessibleActions - call to CallBooleanMethod()", FALSE);34383439if (returnVal != TRUE) {3440PrintDebugString("[ERROR]: Action %d failed", i);3441*failure = i;3442return FALSE;3443}3444}3445*failure = -1;3446return TRUE;3447}344834493450/********** AccessibleText routines ***********************************/34513452BOOL3453AccessBridgeJavaEntryPoints::getAccessibleTextInfo(jobject accessibleContext,3454AccessibleTextInfo *textInfo,3455jint x, jint y) {3456jthrowable exception;34573458// Verify the Java VM still exists and AccessibleContext is3459// an instance of AccessibleText3460if (verifyAccessibleText(accessibleContext) == FALSE) {3461return FALSE;3462}34633464PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextInfo(%p, %d, %d):",3465accessibleContext, x, y);34663467// Get the character count3468if (getAccessibleCharCountFromContextMethod != (jmethodID) 0) {3469textInfo->charCount = jniEnv->CallIntMethod(accessBridgeObject,3470getAccessibleCharCountFromContextMethod,3471accessibleContext);3472EXCEPTION_CHECK("Getting AccessibleCharCount - call to CallIntMethod()", FALSE);3473PrintDebugString("[INFO]: Char count = %d", textInfo->charCount);3474} else {3475PrintDebugString("[ERROR]: either env == 0 or getAccessibleCharCountFromContextMethod == 0");3476return FALSE;3477}34783479// Get the index of the caret3480if (getAccessibleCaretPositionFromContextMethod != (jmethodID) 0) {3481textInfo->caretIndex = jniEnv->CallIntMethod(accessBridgeObject,3482getAccessibleCaretPositionFromContextMethod,3483accessibleContext);3484EXCEPTION_CHECK("Getting AccessibleCaretPosition - call to CallIntMethod()", FALSE);3485PrintDebugString("[INFO]: Index at caret = %d", textInfo->caretIndex);3486} else {3487PrintDebugString("[ERROR]: either env == 0 or getAccessibleCaretPositionFromContextMethod == 0");3488return FALSE;3489}34903491// Get the index at the given point3492if (getAccessibleIndexAtPointFromContextMethod != (jmethodID) 0) {3493textInfo->indexAtPoint = jniEnv->CallIntMethod(accessBridgeObject,3494getAccessibleIndexAtPointFromContextMethod,3495accessibleContext, x, y);3496EXCEPTION_CHECK("Getting AccessibleIndexAtPoint - call to CallIntMethod()", FALSE);3497PrintDebugString("[INFO]: Index at point = %d", textInfo->indexAtPoint);3498} else {3499PrintDebugString("[ERROR]: Error! either env == 0 or getAccessibleIndexAtPointFromContextMethod == 0");3500return FALSE;3501}3502return TRUE;3503}35043505BOOL3506AccessBridgeJavaEntryPoints::getAccessibleTextItems(jobject accessibleContext,3507AccessibleTextItemsInfo *textItems, jint index) {3508jstring js;3509const wchar_t *stringBytes;3510jthrowable exception;3511jsize length;35123513PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextItems(%p):", accessibleContext);35143515// Verify the Java VM still exists and AccessibleContext is3516// an instance of AccessibleText3517if (verifyAccessibleText(accessibleContext) == FALSE) {3518return FALSE;3519}35203521// Get the letter at index3522if (getAccessibleLetterAtIndexFromContextMethod != (jmethodID) 0) {3523js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3524getAccessibleLetterAtIndexFromContextMethod,3525accessibleContext, index);3526EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to CallIntMethod()", FALSE);3527PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);3528if (js != (jstring) 0) {3529stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3530EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to GetStringChars()", FALSE);3531textItems->letter = stringBytes[0];3532jniEnv->ReleaseStringChars(js, stringBytes);3533EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to ReleaseStringChars()", FALSE);3534jniEnv->CallVoidMethod(accessBridgeObject,3535decrementReferenceMethod, js);3536EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to CallVoidMethod()", FALSE);3537PrintDebugString("[INFO]: Accessible Text letter = %c", textItems->letter);3538jniEnv->DeleteLocalRef(js);3539EXCEPTION_CHECK("Getting AccessibleLetterAtIndex - call to DeleteLocalRef()", FALSE);3540} else {3541PrintDebugString("[WARN]: Accessible Text letter is null.");3542textItems->letter = (wchar_t) 0;3543}3544} else {3545PrintDebugString("[ERROR]: either env == 0 or getAccessibleLetterAtIndexFromContextMethod == 0");3546return FALSE;3547}354835493550// Get the word at index3551if (getAccessibleWordAtIndexFromContextMethod != (jmethodID) 0) {3552js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3553getAccessibleWordAtIndexFromContextMethod,3554accessibleContext, index);3555EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to CallIntMethod()", FALSE);3556PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);3557if (js != (jstring) 0) {3558stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3559EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to GetStringChars()", FALSE);3560wcsncpy(textItems->word, stringBytes, (sizeof(textItems->word) / sizeof(wchar_t)));3561length = jniEnv->GetStringLength(js);3562textItems->word[length < (sizeof(textItems->word) / sizeof(wchar_t)) ?3563length : (sizeof(textItems->word) / sizeof(wchar_t))-2] = (wchar_t) 0;3564EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to GetStringLength()", FALSE);3565jniEnv->ReleaseStringChars(js, stringBytes);3566EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to ReleaseStringChars()", FALSE);3567jniEnv->CallVoidMethod(accessBridgeObject,3568decrementReferenceMethod, js);3569EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to CallVoidMethod()", FALSE);3570wPrintDebugString(L"[INFO]: Accessible Text word = %ls", textItems->word);3571jniEnv->DeleteLocalRef(js);3572EXCEPTION_CHECK("Getting AccessibleWordAtIndex - call to DeleteLocalRef()", FALSE);3573} else {3574PrintDebugString("[WARN]: Accessible Text word is null.");3575textItems->word[0] = (wchar_t) 0;3576}3577} else {3578PrintDebugString("[ERROR]: either env == 0 or getAccessibleWordAtIndexFromContextMethod == 0");3579return FALSE;3580}35813582// Get the sentence at index3583if (getAccessibleSentenceAtIndexFromContextMethod != (jmethodID) 0) {3584js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3585getAccessibleSentenceAtIndexFromContextMethod,3586accessibleContext, index);3587EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to CallObjectMethod()", FALSE);3588PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);3589if (js != (jstring) 0) {3590stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3591EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to GetStringChars()", FALSE);3592wcsncpy(textItems->sentence, stringBytes, (sizeof(textItems->sentence) / sizeof(wchar_t))-2);3593length = jniEnv->GetStringLength(js);35943595if (length < sizeof(textItems->sentence) / sizeof(wchar_t)) {3596textItems->sentence[length] = (wchar_t) 0;3597} else {3598textItems->sentence[(sizeof(textItems->sentence) / sizeof(wchar_t))-2] = (wchar_t) 0;3599}3600EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to GetStringLength()", FALSE);3601jniEnv->ReleaseStringChars(js, stringBytes);3602EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to ReleaseStringChars()", FALSE);3603jniEnv->CallVoidMethod(accessBridgeObject,3604decrementReferenceMethod, js);3605EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to CallVoidMethod()", FALSE);3606wPrintDebugString(L"[INFO]: Accessible Text sentence = %ls", textItems->sentence);3607jniEnv->DeleteLocalRef(js);3608EXCEPTION_CHECK("Getting AccessibleSentenceAtIndex - call to DeleteLocalRef()", FALSE);3609} else {3610PrintDebugString("[WARN]: Accessible Text sentence is null.");3611textItems->sentence[0] = (wchar_t) 0;3612}3613} else {3614PrintDebugString("[ERROR]: either env == 0 or getAccessibleSentenceAtIndexFromContextMethod == 0");3615return FALSE;3616}36173618return TRUE;3619}36203621BOOL3622AccessBridgeJavaEntryPoints::getAccessibleTextSelectionInfo(jobject accessibleContext,3623AccessibleTextSelectionInfo *selectionInfo) {3624jstring js;3625const wchar_t *stringBytes;3626jthrowable exception;3627jsize length;36283629PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextSelectionInfo(%p):",3630accessibleContext);36313632// Verify the Java VM still exists and AccessibleContext is3633// an instance of AccessibleText3634if (verifyAccessibleText(accessibleContext) == FALSE) {3635return FALSE;3636}36373638// Get the selection start index3639if (getAccessibleTextSelectionStartFromContextMethod != (jmethodID) 0) {3640selectionInfo->selectionStartIndex = jniEnv->CallIntMethod(accessBridgeObject,3641getAccessibleTextSelectionStartFromContextMethod,3642accessibleContext);3643EXCEPTION_CHECK("Getting AccessibleTextSelectionStart - call to CallIntMethod()", FALSE);3644PrintDebugString("[INFO]: Selection start = %d", selectionInfo->selectionStartIndex);3645} else {3646PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextSelectionStartFromContextMethod == 0");3647return FALSE;3648}36493650// Get the selection end index3651if (getAccessibleTextSelectionEndFromContextMethod != (jmethodID) 0) {3652selectionInfo->selectionEndIndex = jniEnv->CallIntMethod(accessBridgeObject,3653getAccessibleTextSelectionEndFromContextMethod,3654accessibleContext);3655EXCEPTION_CHECK("Getting AccessibleTextSelectionEnd - call to CallIntMethod()", FALSE);3656PrintDebugString("[INFO]: Selection end = %d", selectionInfo->selectionEndIndex);3657} else {3658PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextSelectionEndFromContextMethod == 0");3659return FALSE;3660}36613662// Get the selected text3663if (getAccessibleTextSelectedTextFromContextMethod != (jmethodID) 0) {3664js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3665getAccessibleTextSelectedTextFromContextMethod,3666accessibleContext);3667EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to CallObjectMethod()", FALSE);3668PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);3669if (js != (jstring) 0) {3670stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3671EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to GetStringChars()", FALSE);3672wcsncpy(selectionInfo->selectedText, stringBytes, (sizeof(selectionInfo->selectedText) / sizeof(wchar_t)));3673length = jniEnv->GetStringLength(js);3674selectionInfo->selectedText[length < (sizeof(selectionInfo->selectedText) / sizeof(wchar_t)) ?3675length : (sizeof(selectionInfo->selectedText) / sizeof(wchar_t))-2] = (wchar_t) 0;3676EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to GetStringLength()", FALSE);3677jniEnv->ReleaseStringChars(js, stringBytes);3678EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to ReleaseStringChars()", FALSE);3679jniEnv->CallVoidMethod(accessBridgeObject,3680decrementReferenceMethod, js);3681EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to CallVoidMethod()", FALSE);3682PrintDebugString("[INFO]: Accessible's selected text = %s", selectionInfo->selectedText);3683jniEnv->DeleteLocalRef(js);3684EXCEPTION_CHECK("Getting AccessibleTextSelectedText - call to DeleteLocalRef()", FALSE);3685} else {3686PrintDebugString("[WARN]: Accessible's selected text is null.");3687selectionInfo->selectedText[0] = (wchar_t) 0;3688}3689} else {3690PrintDebugString("[WARN]: either env == 0 or getAccessibleTextSelectedTextFromContextMethod == 0");3691return FALSE;3692}3693return TRUE;3694}36953696BOOL3697AccessBridgeJavaEntryPoints::getAccessibleTextAttributes(jobject accessibleContext, jint index, AccessibleTextAttributesInfo *attributes) {3698jstring js;3699const wchar_t *stringBytes;3700jobject AttributeSet;3701jthrowable exception;3702jsize length;37033704PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextAttributes(%p):", accessibleContext);37053706// Verify the Java VM still exists and AccessibleContext is3707// an instance of AccessibleText3708if (verifyAccessibleText(accessibleContext) == FALSE) {3709return FALSE;3710}37113712if (accessibleContext == (jobject) 0) {3713PrintDebugString("[WARN]: passed in AccessibleContext == null! (oops)");37143715attributes->bold = FALSE;3716attributes->italic = FALSE;3717attributes->underline = FALSE;3718attributes->strikethrough = FALSE;3719attributes->superscript = FALSE;3720attributes->subscript = FALSE;3721attributes->backgroundColor[0] = (wchar_t) 0;3722attributes->foregroundColor[0] = (wchar_t) 0;3723attributes->fontFamily[0] = (wchar_t) 0;3724attributes->fontSize = -1;3725attributes->alignment = -1;3726attributes->bidiLevel = -1;3727attributes->firstLineIndent = -1;3728attributes->leftIndent = -1;3729attributes->rightIndent = -1;3730attributes->lineSpacing = -1;3731attributes->spaceAbove = -1;3732attributes->spaceBelow = -1;3733attributes->fullAttributesString[0] = (wchar_t) 0;37343735return (FALSE);3736}37373738// Get the AttributeSet3739if (getAccessibleAttributeSetAtIndexFromContextMethod != (jmethodID) 0) {3740PrintDebugString("[INFO]: Getting AttributeSet at index...");3741AttributeSet = jniEnv->CallObjectMethod(accessBridgeObject,3742getAccessibleAttributeSetAtIndexFromContextMethod,3743accessibleContext, index);3744EXCEPTION_CHECK("Getting AccessibleAttributeSetAtIndex - call to CallObjectMethod()", FALSE);3745} else {3746PrintDebugString("[ERROR]: either env == 0 or getAccessibleAttributeSetAtIndexFromContextMethod == 0");3747return FALSE;3748}37493750// It is legal for the AttributeSet object to be null, in which case we return false!3751if (AttributeSet == (jobject) 0) {3752PrintDebugString("[WARN]: AttributeSet returned at index is null (this is legal! - see AWT in J2SE 1.3");37533754attributes->bold = FALSE;3755attributes->italic = FALSE;3756attributes->underline = FALSE;3757attributes->strikethrough = FALSE;3758attributes->superscript = FALSE;3759attributes->subscript = FALSE;3760attributes->backgroundColor[0] = (wchar_t) 0;3761attributes->foregroundColor[0] = (wchar_t) 0;3762attributes->fontFamily[0] = (wchar_t) 0;3763attributes->fontSize = -1;3764attributes->alignment = -1;3765attributes->bidiLevel = -1;3766attributes->firstLineIndent = -1;3767attributes->leftIndent = -1;3768attributes->rightIndent = -1;3769attributes->lineSpacing = -1;3770attributes->spaceAbove = -1;3771attributes->spaceBelow = -1;3772attributes->fullAttributesString[0] = (wchar_t) 0;37733774return (FALSE);3775}37763777// Get the bold setting3778if (getBoldFromAttributeSetMethod != (jmethodID) 0) {3779PrintDebugString("[INFO]: Getting bold from AttributeSet...");3780attributes->bold = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3781getBoldFromAttributeSetMethod,3782AttributeSet);3783EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to CallBooleanMethod()", FALSE);3784} else {3785PrintDebugString("[ERROR]: either env == 0 or getBoldFromAttributeSetMethod == 0");3786jniEnv->CallVoidMethod(accessBridgeObject,3787decrementReferenceMethod, AttributeSet);3788EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to CallVoidMethod()", FALSE);3789jniEnv->DeleteLocalRef(AttributeSet);3790EXCEPTION_CHECK("Getting BoldFromAttributeSet - call to DeleteLocalRef()", FALSE);3791return FALSE;3792}37933794// Get the italic setting3795if (getItalicFromAttributeSetMethod != (jmethodID) 0) {3796PrintDebugString("[INFO]: Getting italic from AttributeSet...");3797attributes->italic = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3798getItalicFromAttributeSetMethod,3799AttributeSet);3800EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to CallBooleanMethod()", FALSE);3801} else {3802PrintDebugString("[ERROR]: either env == 0 or getItalicdFromAttributeSetMethod == 0");3803jniEnv->CallVoidMethod(accessBridgeObject,3804decrementReferenceMethod, AttributeSet);3805EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to CallVoidMethod()", FALSE);3806jniEnv->DeleteLocalRef(AttributeSet);3807EXCEPTION_CHECK("Getting ItalicFromAttributeSet - call to DeleteLocalRef()", FALSE);3808return FALSE;3809}38103811// Get the underline setting3812if (getUnderlineFromAttributeSetMethod != (jmethodID) 0) {3813PrintDebugString("[INFO]: Getting underline from AttributeSet...");3814attributes->underline = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3815getUnderlineFromAttributeSetMethod,3816AttributeSet);3817EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to CallBooleanMethod()", FALSE);3818} else {3819PrintDebugString("[ERROR]: either env == 0 or getUnderlineFromAttributeSetMethod == 0");3820jniEnv->CallVoidMethod(accessBridgeObject,3821decrementReferenceMethod, AttributeSet);3822EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to CallVoidMethod()", FALSE);3823jniEnv->DeleteLocalRef(AttributeSet);3824EXCEPTION_CHECK("Getting UnderlineFromAttributeSet - call to DeleteLocalRef()", FALSE);3825return FALSE;3826}38273828// Get the strikethrough setting3829if (getStrikethroughFromAttributeSetMethod != (jmethodID) 0) {3830PrintDebugString("[INFO]: Getting strikethrough from AttributeSet...");3831attributes->strikethrough = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3832getStrikethroughFromAttributeSetMethod,3833AttributeSet);3834EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to CallBooleanMethod()", FALSE);3835} else {3836PrintDebugString("[ERROR]: either env == 0 or getStrikethroughFromAttributeSetMethod == 0");3837jniEnv->CallVoidMethod(accessBridgeObject,3838decrementReferenceMethod, AttributeSet);3839EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to CallVoidMethod()", FALSE);3840jniEnv->DeleteLocalRef(AttributeSet);3841EXCEPTION_CHECK("Getting StrikethroughFromAttributeSet - call to DeleteLocalRef()", FALSE);3842return FALSE;3843}38443845// Get the superscript setting3846if (getSuperscriptFromAttributeSetMethod != (jmethodID) 0) {3847PrintDebugString("[INFO]: Getting superscript from AttributeSet...");3848attributes->superscript = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3849getSuperscriptFromAttributeSetMethod,3850AttributeSet);3851EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to CallBooleanMethod()", FALSE);3852} else {3853PrintDebugString("[ERROR]: either env == 0 or getSuperscripteFromAttributeSetMethod == 0");3854jniEnv->CallVoidMethod(accessBridgeObject,3855decrementReferenceMethod, AttributeSet);3856EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to CallVoidMethod()", FALSE);3857jniEnv->DeleteLocalRef(AttributeSet);3858EXCEPTION_CHECK("Getting SuperscriptFromAttributeSet - call to DeleteLocalRef()", FALSE);3859return FALSE;3860}38613862// Get the subscript setting3863if (getSubscriptFromAttributeSetMethod != (jmethodID) 0) {3864PrintDebugString("[INFO]: Getting subscript from AttributeSet...");3865attributes->subscript = (BOOL) jniEnv->CallBooleanMethod(accessBridgeObject,3866getSubscriptFromAttributeSetMethod,3867AttributeSet);3868EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to CallBooleanMethod()", FALSE);3869} else {3870PrintDebugString("[ERROR]: either env == 0 or getSubscriptFromAttributeSetMethod == 0");3871jniEnv->CallVoidMethod(accessBridgeObject,3872decrementReferenceMethod, AttributeSet);3873EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to CallVoidMethod()", FALSE);3874jniEnv->DeleteLocalRef(AttributeSet);3875EXCEPTION_CHECK("Getting SubscriptFromAttributeSet - call to DeleteLocalRef()", FALSE);3876return FALSE;3877}38783879// Get the backgroundColor setting3880if (getBackgroundColorFromAttributeSetMethod != (jmethodID) 0) {3881PrintDebugString("[INFO]: Getting backgroundColor from AttributeSet...");3882js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3883getBackgroundColorFromAttributeSetMethod,3884AttributeSet);3885EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallObjectMethod()", FALSE);3886if (js != (jstring) 0) {3887stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3888EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to GetStringChars()", FALSE);3889wcsncpy(attributes->backgroundColor, stringBytes, (sizeof(attributes->backgroundColor) / sizeof(wchar_t)));3890length = jniEnv->GetStringLength(js);3891attributes->backgroundColor[length < (sizeof(attributes->backgroundColor) / sizeof(wchar_t)) ?3892length : (sizeof(attributes->backgroundColor) / sizeof(wchar_t))-2] = (wchar_t) 0;3893EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to GetStringLength()", FALSE);3894jniEnv->ReleaseStringChars(js, stringBytes);3895EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to ReleaseStringChars()", FALSE);3896jniEnv->CallVoidMethod(accessBridgeObject,3897decrementReferenceMethod, js);3898EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallVoidMethod()", FALSE);3899wPrintDebugString(L"[INFO]: AttributeSet's background color = %ls", attributes->backgroundColor);3900jniEnv->DeleteLocalRef(js);3901EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE);3902} else {3903PrintDebugString("[WARN]: AttributeSet's background color is null.");3904attributes->backgroundColor[0] = (wchar_t) 0;3905}3906} else {3907PrintDebugString("[ERROR]: either env == 0 or getBackgroundColorFromAttributeSetMethod == 0");3908jniEnv->CallVoidMethod(accessBridgeObject,3909decrementReferenceMethod, AttributeSet);3910EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to CallVoidMethod()", FALSE);3911jniEnv->DeleteLocalRef(AttributeSet);3912EXCEPTION_CHECK("Getting BackgroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE);3913return FALSE;3914}39153916// Get the foregroundColor setting3917if (getForegroundColorFromAttributeSetMethod != (jmethodID) 0) {3918PrintDebugString("[INFO]: Getting foregroundColor from AttributeSet...");3919js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3920getForegroundColorFromAttributeSetMethod,3921AttributeSet);3922EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallObjectMethod()", FALSE);3923if (js != (jstring) 0) {3924stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3925EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to GetStringChars()", FALSE);3926wcsncpy(attributes->foregroundColor, stringBytes, (sizeof(attributes->foregroundColor) / sizeof(wchar_t)));3927length = jniEnv->GetStringLength(js);3928attributes->foregroundColor[length < (sizeof(attributes->foregroundColor) / sizeof(wchar_t)) ?3929length : (sizeof(attributes->foregroundColor) / sizeof(wchar_t))-2] = (wchar_t) 0;3930EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to GetStringLength()", FALSE);3931jniEnv->ReleaseStringChars(js, stringBytes);3932EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to ReleaseStringChars()", FALSE);3933jniEnv->CallVoidMethod(accessBridgeObject,3934decrementReferenceMethod, js);3935EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallVoidMethod()", FALSE);3936wPrintDebugString(L"[INFO]: AttributeSet's foreground color = %ls", attributes->foregroundColor);3937jniEnv->DeleteLocalRef(js);3938EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE);3939} else {3940PrintDebugString("[WARN]: AttributeSet's foreground color is null.");3941attributes->foregroundColor[0] = (wchar_t) 0;3942}3943} else {3944PrintDebugString("[ERROR]: either env == 0 or getForegroundColorFromAttributeSetMethod == 0");3945jniEnv->CallVoidMethod(accessBridgeObject,3946decrementReferenceMethod, AttributeSet);3947EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to CallVoidMethod()", FALSE);3948jniEnv->DeleteLocalRef(AttributeSet);3949EXCEPTION_CHECK("Getting ForegroundColorFromAttributeSet - call to DeleteLocalRef()", FALSE);3950return FALSE;3951}39523953// Get the fontFamily setting3954if (getFontFamilyFromAttributeSetMethod != (jmethodID) 0) {3955PrintDebugString("[INFO]: Getting fontFamily from AttributeSet...");3956js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,3957getFontFamilyFromAttributeSetMethod,3958AttributeSet);3959EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallObjectMethod()", FALSE);3960if (js != (jstring) 0) {3961stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);3962EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to GetStringChars()", FALSE);3963wcsncpy(attributes->fontFamily, stringBytes, (sizeof(attributes->fontFamily) / sizeof(wchar_t)));3964length = jniEnv->GetStringLength(js);3965attributes->fontFamily[length < (sizeof(attributes->fontFamily) / sizeof(wchar_t)) ?3966length : (sizeof(attributes->fontFamily) / sizeof(wchar_t))-2] = (wchar_t) 0;3967EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to GetStringLength()", FALSE);3968jniEnv->ReleaseStringChars(js, stringBytes);3969EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to ReleaseStringChars()", FALSE);3970jniEnv->CallVoidMethod(accessBridgeObject,3971decrementReferenceMethod, js);3972EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallVoidMethod()", FALSE);3973wPrintDebugString(L"[INFO]: AttributeSet's fontFamily = %ls", attributes->fontFamily);3974jniEnv->DeleteLocalRef(js);3975EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to DeleteLocalRef()", FALSE);3976} else {3977PrintDebugString("[WARN]: AttributeSet's fontFamily is null.");3978attributes->backgroundColor[0] = (wchar_t) 0;3979}3980} else {3981PrintDebugString("[ERROR]: either env == 0 or getFontFamilyFromAttributeSetMethod == 0");3982jniEnv->CallVoidMethod(accessBridgeObject,3983decrementReferenceMethod, AttributeSet);3984EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to CallVoidMethod()", FALSE);3985jniEnv->DeleteLocalRef(AttributeSet);3986EXCEPTION_CHECK("Getting FontFamilyFromAttributeSet - call to DeleteLocalRef()", FALSE);3987return FALSE;3988}39893990// Get the font size3991if (getFontSizeFromAttributeSetMethod != (jmethodID) 0) {3992PrintDebugString("[INFO]: Getting font size from AttributeSet...");3993attributes->fontSize = jniEnv->CallIntMethod(accessBridgeObject,3994getFontSizeFromAttributeSetMethod,3995AttributeSet);3996EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to CallIntMethod()", FALSE);3997PrintDebugString("[INFO]: AttributeSet's font size = %d", attributes->fontSize);3998} else {3999PrintDebugString("[ERROR]: either env == 0 or getAlignmentFromAttributeSetMethod == 0");4000jniEnv->CallVoidMethod(accessBridgeObject,4001decrementReferenceMethod, AttributeSet);4002EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to CallVoidMethod()", FALSE);4003jniEnv->DeleteLocalRef(AttributeSet);4004EXCEPTION_CHECK("Getting FontSizeFromAttributeSet - call to DeleteLocalRef()", FALSE);4005return FALSE;4006}400740084009// Get the alignment setting4010if (getAlignmentFromAttributeSetMethod != (jmethodID) 0) {4011PrintDebugString("[INFO]: Getting alignment from AttributeSet...");4012attributes->alignment = jniEnv->CallIntMethod(accessBridgeObject,4013getAlignmentFromAttributeSetMethod,4014AttributeSet);4015EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to CallIntMethod()", FALSE);4016} else {4017PrintDebugString("[ERROR]: either env == 0 or getAlignmentFromAttributeSetMethod == 0");4018jniEnv->CallVoidMethod(accessBridgeObject,4019decrementReferenceMethod, AttributeSet);4020EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to CallVoidMethod()", FALSE);4021jniEnv->DeleteLocalRef(AttributeSet);4022EXCEPTION_CHECK("Getting AlignmentFromAttributeSet - call to DeleteLocalRef()", FALSE);4023return FALSE;4024}40254026// Get the bidiLevel setting4027if (getBidiLevelFromAttributeSetMethod != (jmethodID) 0) {4028PrintDebugString("[INFO]: Getting bidiLevel from AttributeSet...");4029attributes->bidiLevel = jniEnv->CallIntMethod(accessBridgeObject,4030getBidiLevelFromAttributeSetMethod,4031AttributeSet);4032EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to CallIntMethod()", FALSE);4033} else {4034PrintDebugString("[ERROR]: either env == 0 or getBidiLevelFromAttributeSetMethod == 0");4035jniEnv->CallVoidMethod(accessBridgeObject,4036decrementReferenceMethod, AttributeSet);4037EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to CallVoidMethod()", FALSE);4038jniEnv->DeleteLocalRef(AttributeSet);4039EXCEPTION_CHECK("Getting BidiLevelFromAttributeSet - call to DeleteLocalRef()", FALSE);4040return FALSE;4041}40424043// Get the firstLineIndent setting4044if (getFirstLineIndentFromAttributeSetMethod != (jmethodID) 0) {4045PrintDebugString("[ERROR]: Getting firstLineIndent from AttributeSet...");4046attributes->firstLineIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4047getFirstLineIndentFromAttributeSetMethod,4048AttributeSet);4049EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to CallIntMethod()", FALSE);4050} else {4051PrintDebugString("[ERROR]: either env == 0 or getFirstLineIndentFromAttributeSetMethod == 0");4052jniEnv->CallVoidMethod(accessBridgeObject,4053decrementReferenceMethod, AttributeSet);4054EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to CallVoidMethod()", FALSE);4055jniEnv->DeleteLocalRef(AttributeSet);4056EXCEPTION_CHECK("Getting FirstLineIndentFromAttributeSet - call to DeleteLocalRef()", FALSE);4057return FALSE;4058}40594060// Get the leftIndent setting4061if (getLeftIndentFromAttributeSetMethod != (jmethodID) 0) {4062PrintDebugString("[INFO]: Getting leftIndent from AttributeSet...");4063attributes->leftIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4064getLeftIndentFromAttributeSetMethod,4065AttributeSet);4066EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to CallIntMethod()", FALSE);4067} else {4068PrintDebugString("[ERROR]: either env == 0 or getLeftIndentFromAttributeSetMethod == 0");4069jniEnv->CallVoidMethod(accessBridgeObject,4070decrementReferenceMethod, AttributeSet);4071EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to CallVoidMethod()", FALSE);4072jniEnv->DeleteLocalRef(AttributeSet);4073EXCEPTION_CHECK("Getting LeftIndentFromAttributeSet - call to DeleteLocalRef()", FALSE);4074return FALSE;4075}40764077// Get the rightIndent setting4078if (getRightIndentFromAttributeSetMethod != (jmethodID) 0) {4079PrintDebugString("[INFO]: Getting rightIndent from AttributeSet...");4080attributes->rightIndent = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4081getRightIndentFromAttributeSetMethod,4082AttributeSet);4083EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to CallIntMethod()", FALSE);4084} else {4085PrintDebugString("[ERROR]: either env == 0 or getRightIndentFromAttributeSetMethod == 0");4086jniEnv->CallVoidMethod(accessBridgeObject,4087decrementReferenceMethod, AttributeSet);4088EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to CallVoidMethod()", FALSE);4089jniEnv->DeleteLocalRef(AttributeSet);4090EXCEPTION_CHECK("Getting RightIndentFromAttributeSet - call to DeleteLocalRef()", FALSE);4091return FALSE;4092}40934094// Get the lineSpacing setting4095if (getLineSpacingFromAttributeSetMethod != (jmethodID) 0) {4096PrintDebugString("[INFO]: Getting lineSpacing from AttributeSet...");4097attributes->lineSpacing = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4098getLineSpacingFromAttributeSetMethod,4099AttributeSet);4100EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to CallIntMethod()", FALSE);4101} else {4102PrintDebugString("[ERROR]: either env == 0 or getLineSpacingFromAttributeSetMethod == 0");4103jniEnv->CallVoidMethod(accessBridgeObject,4104decrementReferenceMethod, AttributeSet);4105EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to CallVoidMethod()", FALSE);4106jniEnv->DeleteLocalRef(AttributeSet);4107EXCEPTION_CHECK("Getting LineSpacingFromAttributeSet - call to DeleteLocalRef()", FALSE);4108return FALSE;4109}41104111// Get the spaceAbove setting4112if (getSpaceAboveFromAttributeSetMethod != (jmethodID) 0) {4113PrintDebugString("[INFO]: Getting spaceAbove from AttributeSet...");4114attributes->spaceAbove = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4115getSpaceAboveFromAttributeSetMethod,4116AttributeSet);4117EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to CallIntMethod()", FALSE);4118} else {4119PrintDebugString("[ERROR]: either env == 0 or getSpaceAboveFromAttributeSetMethod == 0");4120jniEnv->CallVoidMethod(accessBridgeObject,4121decrementReferenceMethod, AttributeSet);4122EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to CallVoidMethod()", FALSE);4123jniEnv->DeleteLocalRef(AttributeSet);4124EXCEPTION_CHECK("Getting SpaceAboveFromAttributeSet - call to DeleteLocalRef()", FALSE);4125return FALSE;4126}41274128// Get the spaceBelow setting4129if (getSpaceBelowFromAttributeSetMethod != (jmethodID) 0) {4130PrintDebugString("[INFO]: Getting spaceBelow from AttributeSet...");4131attributes->spaceBelow = (jfloat) jniEnv->CallFloatMethod(accessBridgeObject,4132getSpaceBelowFromAttributeSetMethod,4133AttributeSet);4134EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to CallIntMethod()", FALSE);4135} else {4136PrintDebugString("[ERROR]: either env == 0 or getSpaceBelowFromAttributeSetMethod == 0");4137jniEnv->CallVoidMethod(accessBridgeObject,4138decrementReferenceMethod, AttributeSet);4139EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to CallVoidMethod()", FALSE);4140jniEnv->DeleteLocalRef(AttributeSet);4141EXCEPTION_CHECK("Getting SpaceBelowFromAttributeSet - call to DeleteLocalRef()", FALSE);4142return FALSE;4143}41444145// Release the AttributeSet object4146if (decrementReferenceMethod != (jmethodID) 0) {4147PrintDebugString("[INFO]: Decrementing reference to AttributeSet...");4148jniEnv->CallVoidMethod(accessBridgeObject,4149decrementReferenceMethod, AttributeSet);4150EXCEPTION_CHECK("Releasing AttributeSet object - call to CallVoidMethod()", FALSE);4151} else {4152PrintDebugString("[ERROR]: either env == 0 or accessBridgeObject == 0");4153jniEnv->DeleteLocalRef(AttributeSet);4154EXCEPTION_CHECK("Releasing AttributeSet object - call to DeleteLocalRef()", FALSE);4155return FALSE;4156}41574158// Get the full attributes string at index4159if (getAccessibleAttributesAtIndexFromContextMethod != (jmethodID) 0) {4160PrintDebugString("[INFO]: Getting full attributes string from Context...");4161js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4162getAccessibleAttributesAtIndexFromContextMethod,4163accessibleContext, index);4164EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallObjectMethod()", FALSE);4165PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4166if (js != (jstring) 0) {4167stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4168EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringChars()", FALSE);4169wcsncpy(attributes->fullAttributesString, stringBytes, (sizeof(attributes->fullAttributesString) / sizeof(wchar_t)));4170length = jniEnv->GetStringLength(js);4171attributes->fullAttributesString[length < (sizeof(attributes->fullAttributesString) / sizeof(wchar_t)) ?4172length : (sizeof(attributes->fullAttributesString) / sizeof(wchar_t))-2] = (wchar_t) 0;4173EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to GetStringLength()", FALSE);4174jniEnv->ReleaseStringChars(js, stringBytes);4175EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to ReleaseStringChars()", FALSE);4176jniEnv->CallVoidMethod(accessBridgeObject,4177decrementReferenceMethod, js);4178EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to CallVoidMethod()", FALSE);4179wPrintDebugString(L"[INFO]: Accessible Text attributes = %ls", attributes->fullAttributesString);4180jniEnv->DeleteLocalRef(js);4181EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE);4182} else {4183PrintDebugString("[WARN]: Accessible Text attributes is null.");4184attributes->fullAttributesString[0] = (wchar_t) 0;4185jniEnv->DeleteLocalRef(AttributeSet);4186EXCEPTION_CHECK("Getting AccessibleAttributesAtIndex - call to DeleteLocalRef()", FALSE);4187return FALSE;4188}4189} else {4190PrintDebugString("[ERROR]: either env == 0 or getAccessibleAttributesAtIndexFromContextMethod == 0");4191jniEnv->DeleteLocalRef(AttributeSet);4192return FALSE;4193}41944195jniEnv->DeleteLocalRef(AttributeSet);4196EXCEPTION_CHECK("Getting AccessibleAttributeSetAtIndex - call to DeleteLocalRef()", FALSE);4197return TRUE;4198}41994200BOOL4201AccessBridgeJavaEntryPoints::getAccessibleTextRect(jobject accessibleContext, AccessibleTextRectInfo *rectInfo, jint index) {42024203jthrowable exception;42044205PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextRect(%p), index = %d",4206accessibleContext, index);42074208// Verify the Java VM still exists and AccessibleContext is4209// an instance of AccessibleText4210if (verifyAccessibleText(accessibleContext) == FALSE) {4211return FALSE;4212}42134214// Get the x coord4215if (getAccessibleXcoordTextRectAtIndexFromContextMethod != (jmethodID) 0) {4216rectInfo->x = jniEnv->CallIntMethod(accessBridgeObject,4217getAccessibleXcoordTextRectAtIndexFromContextMethod,4218accessibleContext, index);4219EXCEPTION_CHECK("Getting AccessibleXcoordTextRect - call to CallIntMethod()", FALSE);4220PrintDebugString("[INFO]: X coord = %d", rectInfo->x);4221} else {4222PrintDebugString("[ERROR]: either env == 0 or getAccessibleXcoordTextRectAtIndexFromContextMethod == 0");4223return FALSE;4224}42254226// Get the y coord4227if (getAccessibleYcoordTextRectAtIndexFromContextMethod != (jmethodID) 0) {4228rectInfo->y = jniEnv->CallIntMethod(accessBridgeObject,4229getAccessibleYcoordTextRectAtIndexFromContextMethod,4230accessibleContext, index);4231EXCEPTION_CHECK("Getting AccessibleYcoordTextRect - call to CallIntMethod()", FALSE);4232PrintDebugString("[INFO]: Y coord = %d", rectInfo->y);4233} else {4234PrintDebugString("[INFO]: either env == 0 or getAccessibleYcoordTextRectAtIndexFromContextMethod == 0");4235return FALSE;4236}42374238// Get the width4239if (getAccessibleWidthTextRectAtIndexFromContextMethod != (jmethodID) 0) {4240rectInfo->width = jniEnv->CallIntMethod(accessBridgeObject,4241getAccessibleWidthTextRectAtIndexFromContextMethod,4242accessibleContext, index);4243EXCEPTION_CHECK("Getting AccessibleWidthTextRect - call to CallIntMethod()", FALSE);4244PrintDebugString("[INFO]: Width = %d", rectInfo->width);4245} else {4246PrintDebugString("[INFO]: either env == 0 or getAccessibleWidthTextRectAtIndexFromContextMethod == 0");4247return FALSE;4248}42494250// Get the height4251if (getAccessibleHeightTextRectAtIndexFromContextMethod != (jmethodID) 0) {4252rectInfo->height = jniEnv->CallIntMethod(accessBridgeObject,4253getAccessibleHeightTextRectAtIndexFromContextMethod,4254accessibleContext, index);4255EXCEPTION_CHECK("Getting AccessibleHeightTextRect - call to CallIntMethod()", FALSE);4256PrintDebugString("[INFO]: Height = %d", rectInfo->height);4257} else {4258PrintDebugString("[ERROR]: either env == 0 or getAccessibleHeightTextRectAtIndexFromContextMethod == 0");4259return FALSE;4260}42614262return TRUE;4263}42644265// =====42664267/**4268* gets the bounding rectangle for the text caret4269*/4270BOOL4271AccessBridgeJavaEntryPoints::getCaretLocation(jobject accessibleContext, AccessibleTextRectInfo *rectInfo, jint index) {42724273jthrowable exception;42744275PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getCaretLocation(%p), index = %d",4276accessibleContext, index);42774278// Verify the Java VM still exists and AccessibleContext is4279// an instance of AccessibleText4280if (verifyAccessibleText(accessibleContext) == FALSE) {4281return FALSE;4282}42834284// Get the x coord4285if (getCaretLocationXMethod != (jmethodID) 0) {4286rectInfo->x = jniEnv->CallIntMethod(accessBridgeObject,4287getCaretLocationXMethod,4288accessibleContext, index);4289EXCEPTION_CHECK("Getting caret X coordinate - call to CallIntMethod()", FALSE);4290PrintDebugString("[INFO]: X coord = %d", rectInfo->x);4291} else {4292PrintDebugString("[ERROR]: either env == 0 or getCaretLocationXMethod == 0");4293return FALSE;4294}42954296// Get the y coord4297if (getCaretLocationYMethod != (jmethodID) 0) {4298rectInfo->y = jniEnv->CallIntMethod(accessBridgeObject,4299getCaretLocationYMethod,4300accessibleContext, index);4301EXCEPTION_CHECK("Getting caret Y coordinate - call to CallIntMethod()", FALSE);4302PrintDebugString("[INFO]: Y coord = %d", rectInfo->y);4303} else {4304PrintDebugString("[ERROR]: either env == 0 or getCaretLocationYMethod == 0");4305return FALSE;4306}43074308// Get the width4309if (getCaretLocationWidthMethod != (jmethodID) 0) {4310rectInfo->width = jniEnv->CallIntMethod(accessBridgeObject,4311getCaretLocationWidthMethod,4312accessibleContext, index);4313EXCEPTION_CHECK("Getting caret width - call to CallIntMethod()", FALSE);4314PrintDebugString("[INFO]: Width = %d", rectInfo->width);4315} else {4316PrintDebugString("[ERROR]: either env == 0 or getCaretLocationWidthMethod == 0");4317return FALSE;4318}43194320// Get the height4321if (getCaretLocationHeightMethod != (jmethodID) 0) {4322rectInfo->height = jniEnv->CallIntMethod(accessBridgeObject,4323getCaretLocationHeightMethod,4324accessibleContext, index);4325EXCEPTION_CHECK("Getting caret height - call to CallIntMethod()", FALSE);4326PrintDebugString("[INFO]: Height = %d", rectInfo->height);4327} else {4328PrintDebugString("[ERROR]: either env == 0 or getCaretLocationHeightMethod == 0");4329return FALSE;4330}43314332return TRUE;4333}43344335// =====43364337BOOL4338AccessBridgeJavaEntryPoints::getAccessibleTextLineBounds(jobject accessibleContext, jint index, jint *startIndex, jint *endIndex) {43394340jthrowable exception;43414342PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextLineBounds(%p):", accessibleContext);43434344// Verify the Java VM still exists and AccessibleContext is4345// an instance of AccessibleText4346if (verifyAccessibleText(accessibleContext) == FALSE) {4347return FALSE;4348}43494350// Get the index of the left boundary of the line containing 'index'4351if (getAccessibleTextLineLeftBoundsFromContextMethod != (jmethodID) 0) {4352*startIndex = jniEnv->CallIntMethod(accessBridgeObject,4353getAccessibleTextLineLeftBoundsFromContextMethod,4354accessibleContext, index);4355EXCEPTION_CHECK("Getting AccessibleTextLineLeftBounds - call to CallIntMethod()", FALSE);4356PrintDebugString("[INFO]: startIndex = %d", *startIndex);4357} else {4358PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextLineLeftBoundsFromContextMethod == 0");4359return FALSE;4360}43614362// Get the index of the right boundary of the line containing 'index'4363if (getAccessibleTextLineRightBoundsFromContextMethod != (jmethodID) 0) {4364*endIndex = jniEnv->CallIntMethod(accessBridgeObject,4365getAccessibleTextLineRightBoundsFromContextMethod,4366accessibleContext, index);4367EXCEPTION_CHECK("Getting AccessibleTextLineRightBounds - call to CallIntMethod()", FALSE);4368PrintDebugString("[INFO]: endIndex = %d", *endIndex);4369} else {4370PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextLineRightBoundsFromContextMethod == 0");4371return FALSE;4372}43734374return TRUE;4375}43764377BOOL4378AccessBridgeJavaEntryPoints::getAccessibleTextRange(jobject accessibleContext,4379jint start, jint end, wchar_t *text, short len) {4380jstring js;4381const wchar_t *stringBytes;4382jthrowable exception;4383jsize length;43844385PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleTextRange(%p, %d, %d, *text, %d):", accessibleContext, start, end, len);43864387// Verify the Java VM still exists and AccessibleContext is4388// an instance of AccessibleText4389if (verifyAccessibleText(accessibleContext) == FALSE) {4390return FALSE;4391}43924393// range is inclusive4394if (end < start) {4395PrintDebugString("[ERROR]: end < start!");4396text[0] = (wchar_t) 0;4397return FALSE;4398}43994400// Get the text range within [start, end] inclusive4401if (getAccessibleTextRangeFromContextMethod != (jmethodID) 0) {4402js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4403getAccessibleTextRangeFromContextMethod,4404accessibleContext, start, end);4405EXCEPTION_CHECK("Getting AccessibleTextRange - call to CallObjectMethod()", FALSE);4406PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4407if (js != (jstring) 0) {4408stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4409EXCEPTION_CHECK("Getting AccessibleTextRange - call to GetStringChars()", FALSE);4410wPrintDebugString(L"[INFO]: Accessible Text stringBytes returned from Java = %ls", stringBytes);4411wcsncpy(text, stringBytes, len);4412length = jniEnv->GetStringLength(js);4413PrintDebugString("[INFO]: Accessible Text stringBytes length = %d", length);4414text[length < len ? length : len - 2] = (wchar_t) 0;4415wPrintDebugString(L"[INFO]: Accessible Text 'text' after null termination = %ls", text);4416EXCEPTION_CHECK("Getting AccessibleTextRange - call to GetStringLength()", FALSE);4417jniEnv->ReleaseStringChars(js, stringBytes);4418EXCEPTION_CHECK("Getting AccessibleTextRange - call to ReleaseStringChars()", FALSE);4419jniEnv->CallVoidMethod(accessBridgeObject,4420decrementReferenceMethod, js);4421EXCEPTION_CHECK("Getting AccessibleTextRange - call to CallVoidMethod()", FALSE);4422wPrintDebugString(L"[INFO]: Accessible Text range = %ls", text);4423jniEnv->DeleteLocalRef(js);4424EXCEPTION_CHECK("Getting AccessibleTextRange - call to DeleteLocalRef()", FALSE);4425} else {4426PrintDebugString("[WARN]: current Accessible Text range is null.");4427text[0] = (wchar_t) 0;4428return FALSE;4429}4430} else {4431PrintDebugString("[ERROR]: either env == 0 or getAccessibleTextRangeFromContextMethod == 0");4432return FALSE;4433}4434return TRUE;4435}44364437/********** AccessibleValue routines ***************/44384439BOOL4440AccessBridgeJavaEntryPoints::getCurrentAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) {4441jstring js;4442const wchar_t *stringBytes;4443jthrowable exception;4444jsize length;44454446PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getCurrentAccessibleValueFromContext(%p):", accessibleContext);44474448// Get the current Accessible Value4449if (getCurrentAccessibleValueFromContextMethod != (jmethodID) 0) {4450js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4451getCurrentAccessibleValueFromContextMethod,4452accessibleContext);4453EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to CallObjectMethod()", FALSE);4454PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4455if (js != (jstring) 0) {4456stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4457EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to GetStringChars()", FALSE);4458wcsncpy(value, stringBytes, len);4459length = jniEnv->GetStringLength(js);4460value[length < len ? length : len - 2] = (wchar_t) 0;4461EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to GetStringLength()", FALSE);4462jniEnv->ReleaseStringChars(js, stringBytes);4463EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to ReleaseStringChars()", FALSE);4464jniEnv->CallVoidMethod(accessBridgeObject,4465decrementReferenceMethod, js);4466EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to CallVoidMethod()", FALSE);4467PrintDebugString("[INFO]: current Accessible Value = %s", value);4468jniEnv->DeleteLocalRef(js);4469EXCEPTION_CHECK("Getting CurrentAccessibleValue - call to DeleteLocalRef()", FALSE);4470} else {4471PrintDebugString("[WARN]: current Accessible Value is null.");4472value[0] = (wchar_t) 0;4473return FALSE;4474}4475} else {4476PrintDebugString("[ERROR]: either env == 0 or getCurrentAccessibleValueFromContextMethod == 0");4477return FALSE;4478}4479return TRUE;4480}44814482BOOL4483AccessBridgeJavaEntryPoints::getMaximumAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) {4484jstring js;4485const wchar_t *stringBytes;4486jthrowable exception;4487jsize length;44884489PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getMaximumAccessibleValueFromContext(%p):", accessibleContext);44904491// Get the maximum Accessible Value4492if (getMaximumAccessibleValueFromContextMethod != (jmethodID) 0) {4493js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4494getMaximumAccessibleValueFromContextMethod,4495accessibleContext);4496EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to CallObjectMethod()", FALSE);4497PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4498if (js != (jstring) 0) {4499stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4500EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to GetStringChars()", FALSE);4501wcsncpy(value, stringBytes, len);4502length = jniEnv->GetStringLength(js);4503value[length < len ? length : len - 2] = (wchar_t) 0;4504EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to GetStringLength()", FALSE);4505jniEnv->ReleaseStringChars(js, stringBytes);4506EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to ReleaseStringChars()", FALSE);4507jniEnv->CallVoidMethod(accessBridgeObject,4508decrementReferenceMethod, js);4509EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to CallVoidMethod()", FALSE);4510PrintDebugString("[INFO]: maximum Accessible Value = %s", value);4511jniEnv->DeleteLocalRef(js);4512EXCEPTION_CHECK("Getting MaximumAccessibleValue - call to DeleteLocalRef()", FALSE);4513} else {4514PrintDebugString("[WARN]: maximum Accessible Value is null.");4515value[0] = (wchar_t) 0;4516return FALSE;4517}4518} else {4519PrintDebugString("[ERROR]: either env == 0 or getMaximumAccessibleValueFromContextMethod == 0");4520return FALSE;4521}4522return TRUE;4523}45244525BOOL4526AccessBridgeJavaEntryPoints::getMinimumAccessibleValueFromContext(jobject accessibleContext, wchar_t *value, short len) {4527jstring js;4528const wchar_t *stringBytes;4529jthrowable exception;4530jsize length;45314532PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getMinimumAccessibleValueFromContext(%p):", accessibleContext);45334534// Get the mimimum Accessible Value4535if (getMinimumAccessibleValueFromContextMethod != (jmethodID) 0) {4536js = (jstring) jniEnv->CallObjectMethod(accessBridgeObject,4537getMinimumAccessibleValueFromContextMethod,4538accessibleContext);4539EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to CallObjectMethod()", FALSE);4540PrintDebugString("[INFO]: returned from CallObjectMethod(), js = %p", js);4541if (js != (jstring) 0) {4542stringBytes = (const wchar_t *) jniEnv->GetStringChars(js, 0);4543EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to GetStringChars()", FALSE);4544wcsncpy(value, stringBytes, len);4545length = jniEnv->GetStringLength(js);4546value[length < len ? length : len - 2] = (wchar_t) 0;4547EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to GetStringLength()", FALSE);4548jniEnv->ReleaseStringChars(js, stringBytes);4549EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to ReleaseStringChars()", FALSE);4550jniEnv->CallVoidMethod(accessBridgeObject,4551decrementReferenceMethod, js);4552EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to CallVoidMethod()", FALSE);4553PrintDebugString("[INFO]: mimimum Accessible Value = %s", value);4554jniEnv->DeleteLocalRef(js);4555EXCEPTION_CHECK("Getting MinimumAccessibleValue - call to DeleteLocalRef()", FALSE);4556} else {4557PrintDebugString("[WARN]: mimimum Accessible Value is null.");4558value[0] = (wchar_t) 0;4559return FALSE;4560}4561} else {4562PrintDebugString("[ERROR]: either env == 0 or getMinimumAccessibleValueFromContextMethod == 0");4563return FALSE;4564}4565return TRUE;4566}456745684569/********** AccessibleSelection routines ***************/45704571void4572AccessBridgeJavaEntryPoints::addAccessibleSelectionFromContext(jobject accessibleContext, int i) {4573jthrowable exception;45744575PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::addAccessibleSelectionFromContext(%p):", accessibleContext);45764577// Add the child to the AccessibleSelection4578if (addAccessibleSelectionFromContextMethod != (jmethodID) 0) {4579jniEnv->CallVoidMethod(accessBridgeObject,4580addAccessibleSelectionFromContextMethod,4581accessibleContext, i);4582EXCEPTION_CHECK_VOID("Doing addAccessibleSelection - call to CallVoidMethod()");4583PrintDebugString("[INFO]: returned from CallObjectMethod()");4584} else {4585PrintDebugString("[ERROR]: either env == 0 or addAccessibleSelectionFromContextMethod == 0");4586}4587}45884589void4590AccessBridgeJavaEntryPoints::clearAccessibleSelectionFromContext(jobject accessibleContext) {4591jthrowable exception;45924593PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::clearAccessibleSelectionFromContext(%p):", accessibleContext);45944595// Clearing the Selection of the AccessibleSelection4596if (clearAccessibleSelectionFromContextMethod != (jmethodID) 0) {4597jniEnv->CallVoidMethod(accessBridgeObject,4598clearAccessibleSelectionFromContextMethod,4599accessibleContext);4600EXCEPTION_CHECK_VOID("Doing clearAccessibleSelection - call to CallVoidMethod()");4601PrintDebugString("[INFO]: returned from CallObjectMethod()");4602} else {4603PrintDebugString("[ERROR]: either env == 0 or clearAccessibleSelectionFromContextMethod == 0");4604}4605}46064607jobject4608AccessBridgeJavaEntryPoints::getAccessibleSelectionFromContext(jobject accessibleContext, int i) {4609jobject returnedAccessibleContext;4610jobject globalRef;4611jthrowable exception;46124613PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleSelectionFromContext(%p):", accessibleContext);46144615if (getAccessibleSelectionContextFromContextMethod != (jmethodID) 0) {4616returnedAccessibleContext = jniEnv->CallObjectMethod(4617accessBridgeObject,4618getAccessibleSelectionContextFromContextMethod,4619accessibleContext, i);4620EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to CallObjectMethod()", (jobject) 0);4621globalRef = jniEnv->NewGlobalRef(returnedAccessibleContext);4622EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to NewGlobalRef()", (jobject) 0);4623jniEnv->DeleteLocalRef(returnedAccessibleContext);4624EXCEPTION_CHECK("Getting AccessibleSelectionContext - call to DeleteLocalRef()", (jobject) 0);4625PrintDebugString("[INFO]: Returning - returnedAccessibleContext = %p; globalRef = %p",4626returnedAccessibleContext, globalRef);4627return globalRef;4628} else {4629PrintDebugString("[ERROR]: either env == 0 or getAccessibleSelectionContextFromContextMethod == 0");4630return (jobject) 0;4631}4632}46334634int4635AccessBridgeJavaEntryPoints::getAccessibleSelectionCountFromContext(jobject accessibleContext) {4636int count;4637jthrowable exception;46384639PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::getAccessibleSelectionCountFromContext(%p):", accessibleContext);46404641// Get (& return) the # of items selected in the AccessibleSelection4642if (getAccessibleSelectionCountFromContextMethod != (jmethodID) 0) {4643count = jniEnv->CallIntMethod(accessBridgeObject,4644getAccessibleSelectionCountFromContextMethod,4645accessibleContext);4646EXCEPTION_CHECK("Getting AccessibleSelectionCount - call to CallIntMethod()", -1);4647PrintDebugString("[INFO]: returned from CallObjectMethod()");4648return count;4649} else {4650PrintDebugString("[ERROR]: either env == 0 or getAccessibleSelectionCountFromContextMethod == 0");4651return -1;4652}4653}46544655BOOL4656AccessBridgeJavaEntryPoints::isAccessibleChildSelectedFromContext(jobject accessibleContext, int i) {4657jboolean result;4658jthrowable exception;46594660PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::isAccessibleChildSelectedFromContext(%p):", accessibleContext);46614662// Get (& return) the # of items selected in the AccessibleSelection4663if (isAccessibleChildSelectedFromContextMethod != (jmethodID) 0) {4664result = jniEnv->CallBooleanMethod(accessBridgeObject,4665isAccessibleChildSelectedFromContextMethod,4666accessibleContext, i);4667EXCEPTION_CHECK("Doing isAccessibleChildSelected - call to CallBooleanMethod()", FALSE);4668PrintDebugString("[INFO]: returned from CallObjectMethod()");4669if (result != 0) {4670return TRUE;4671}4672} else {4673PrintDebugString("[ERROR]: either env == 0 or isAccessibleChildSelectedFromContextMethod == 0");4674}4675return FALSE;4676}467746784679void4680AccessBridgeJavaEntryPoints::removeAccessibleSelectionFromContext(jobject accessibleContext, int i) {4681jthrowable exception;46824683PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::removeAccessibleSelectionFromContext(%p):", accessibleContext);46844685// Remove the i-th child from the AccessibleSelection4686if (removeAccessibleSelectionFromContextMethod != (jmethodID) 0) {4687jniEnv->CallVoidMethod(accessBridgeObject,4688removeAccessibleSelectionFromContextMethod,4689accessibleContext, i);4690EXCEPTION_CHECK_VOID("Doing removeAccessibleSelection - call to CallVoidMethod()");4691PrintDebugString("[INFO]: returned from CallObjectMethod()");4692} else {4693PrintDebugString("[ERROR]: either env == 0 or removeAccessibleSelectionFromContextMethod == 0");4694}4695}46964697void4698AccessBridgeJavaEntryPoints::selectAllAccessibleSelectionFromContext(jobject accessibleContext) {4699jthrowable exception;47004701PrintDebugString("[INFO]: Calling AccessBridgeJavaEntryPoints::selectAllAccessibleSelectionFromContext(%p):", accessibleContext);47024703// Select all children (if possible) of the AccessibleSelection4704if (selectAllAccessibleSelectionFromContextMethod != (jmethodID) 0) {4705jniEnv->CallVoidMethod(accessBridgeObject,4706selectAllAccessibleSelectionFromContextMethod,4707accessibleContext);4708EXCEPTION_CHECK_VOID("Doing selectAllAccessibleSelection - call to CallVoidMethod()");4709PrintDebugString("[INFO]: returned from CallObjectMethod()");4710} else {4711PrintDebugString("[ERROR]: either env == 0 or selectAllAccessibleSelectionFromContextMethod == 0");4712}4713}471447154716/********** Event Notification Registration routines ***************/47174718BOOL4719AccessBridgeJavaEntryPoints::addJavaEventNotification(jlong type) {4720jthrowable exception;47214722PrintDebugString("[INFO]: in AccessBridgeJavaEntryPoints::addJavaEventNotification(%016I64X);", type);47234724// Let AccessBridge know we want to add an event type4725if (addJavaEventNotificationMethod != (jmethodID) 0) {4726jniEnv->CallVoidMethod(accessBridgeObject,4727addJavaEventNotificationMethod, type);4728EXCEPTION_CHECK("Doing addJavaEventNotification - call to CallVoidMethod()", FALSE);4729} else {4730PrintDebugString("[ERROR]: either env == 0 or addJavaEventNotificationMethod == 0");4731return FALSE;4732}4733return TRUE;4734}47354736BOOL4737AccessBridgeJavaEntryPoints::removeJavaEventNotification(jlong type) {4738jthrowable exception;47394740PrintDebugString("[INFO]: in AccessBridgeJavaEntryPoints::removeJavaEventNotification(%016I64X):", type);47414742// Let AccessBridge know we want to remove an event type4743if (removeJavaEventNotificationMethod != (jmethodID) 0) {4744jniEnv->CallVoidMethod(accessBridgeObject,4745removeJavaEventNotificationMethod, type);4746EXCEPTION_CHECK("Doing removeJavaEventNotification - call to CallVoidMethod()", FALSE);4747} else {4748PrintDebugString("[ERROR]: either env == 0 or removeJavaEventNotificationMethod == 0");4749return FALSE;4750}4751return TRUE;4752}47534754BOOL4755AccessBridgeJavaEntryPoints::addAccessibilityEventNotification(jlong type) {4756jthrowable exception;47574758PrintDebugString("[INFO]: in AccessBridgeJavaEntryPoints::addAccessibilityEventNotification(%016I64X);", type);47594760// Let AccessBridge know we want to add an event type4761if (addAccessibilityEventNotificationMethod != (jmethodID) 0) {4762PrintDebugString("[INFO]: addAccessibilityEventNotification: calling void method: accessBridgeObject = %p", accessBridgeObject);4763jniEnv->CallVoidMethod(accessBridgeObject,4764addAccessibilityEventNotificationMethod, type);4765EXCEPTION_CHECK("Doing addAccessibilityEvent - call to CallVoidMethod()", FALSE);4766} else {4767PrintDebugString("[ERROR]: either env == 0 or addAccessibilityEventNotificationMethod == 0");4768return FALSE;4769}4770PrintDebugString("[INFO]: addAccessibilityEventNotification: just returning true");4771return TRUE;4772}47734774BOOL4775AccessBridgeJavaEntryPoints::removeAccessibilityEventNotification(jlong type) {4776jthrowable exception;47774778PrintDebugString("[INFO]: in AccessBridgeJavaEntryPoints::removeAccessibilityEventNotification(%016I64X):", type);47794780// Let AccessBridge know we want to remove an event type4781if (removeAccessibilityEventNotificationMethod != (jmethodID) 0) {4782jniEnv->CallVoidMethod(accessBridgeObject,4783removeAccessibilityEventNotificationMethod, type);4784EXCEPTION_CHECK("Doing removeAccessibilityEvent - call to CallVoidMethod()", FALSE);4785} else {4786PrintDebugString("[ERROR]: either env == 0 or removeAccessibilityEventNotificationMethod == 0");4787return FALSE;4788}4789return TRUE;4790}479147924793