}
protected static void printAccessibleTree(PrintWriter log,
XAccessible xacc, String indent) {
XAccessibleContext ac = xacc.getAccessibleContext();
logging(log,indent + ac.getAccessibleRole() + "," +
ac.getAccessibleName() + "(" +
ac.getAccessibleDescription() + "):" +
utils.getImplName(ac));
XAccessibleComponent aComp = (XAccessibleComponent) UnoRuntime.queryInterface(
XAccessibleComponent.class, xacc);
if (aComp != null) {
String bounds = "(" + aComp.getBounds().X + "," +
aComp.getBounds().Y + ")" + " (" +
aComp.getBounds().Width + "," +
aComp.getBounds().Height + ")";
bounds = "The boundary Rectangle is " + bounds;
logging(log,indent + indent + bounds);
}
boolean isShowing = ac.getAccessibleStateSet()
.contains(com.sun.star.accessibility.AccessibleStateType.SHOWING);
logging(log,indent + indent + "StateType contains SHOWING: " +
isShowing);
int k = ac.getAccessibleChildCount();
if (ac.getAccessibleChildCount() > 100) {
k = 50;
}
for (int i = 0; i < k; i++) {
try {
printAccessibleTree(log, ac.getAccessibleChild(i),
indent + " ");
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
System.out.println("Couldn't get Child");
}
}
if (ac.getAccessibleChildCount() > 100) {
k = ac.getAccessibleChildCount();
int st = ac.getAccessibleChildCount() - 50;
logging(log,indent + " " + " ...... [skipped] ......");
for (int i = st; i < k; i++) {
try {
printAccessibleTree(log, ac.getAccessibleChild(i),
indent + " ");
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
System.out.println("Couldn't get Child");
}
}