// get the accessible content
AccessibilityTools at = new AccessibilityTools();
XWindow xWindow = at.getCurrentWindow(mXMSF, aModel);
XAccessible xRoot = at.getAccessibleObject(xWindow);
XAccessible parent = null;
try {
parent = at.getAccessibleObjectForRole
(xRoot, AccessibleRole.HEADER, "").getAccessibleChild(0);
oObj = parent.getAccessibleContext().getAccessibleChild(0);
} catch (com.sun.star.lang.IndexOutOfBoundsException iabe) {
failed(iabe.getMessage());
return;
}
log.println("ImplementationName " + utils.getImplName(oObj));
XAccessibleComponent accPC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class, parent);
log.println("Parent-BoundsX= "+accPC.getBounds().X);
log.println("Parent-BoundsY= "+accPC.getBounds().Y);
log.println("Parent-BoundsWidth= "+accPC.getBounds().Width);
log.println("Parent-BoundsHeight= "+accPC.getBounds().Height);
XAccessibleComponent accPPC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class,
parent.getAccessibleContext().getAccessibleParent());
log.println("P-Parent-BoundsX= "+accPPC.getBounds().X);
log.println("P-Parent-BoundsY= "+accPPC.getBounds().Y);
log.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width);
log.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height);
try {
Thread.sleep(500);
} catch (InterruptedException ex) {}
log.println("Press any key when the second line is on top");
try{
byte[]b = new byte[16];
System.in.read(b);
} catch (Exception e) {
e.printStackTrace();
}
try {
log.println("ChildCount: "+
parent.getAccessibleContext().getAccessibleChildCount());
log.println("Getting child 0 again");
oObj = parent.getAccessibleContext().getAccessibleChild(0);
} catch (com.sun.star.lang.IndexOutOfBoundsException iabe) {
failed(iabe.getMessage());
return;
}
XAccessibleText accT = (XAccessibleText)
UnoRuntime.queryInterface(XAccessibleText.class, oObj);
log.println("Getting the text: "+accT.getText());
XAccessibleComponent accC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class, oObj);
log.println("BoundsX= "+accC.getBounds().X);
log.println("BoundsY= "+accC.getBounds().Y);
log.println("BoundsWidth= "+accC.getBounds().Width);
log.println("BoundsHeight= "+accC.getBounds().Height);
accPC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class, parent);
log.println("Parent-BoundsX= "+accPC.getBounds().X);
log.println("Parent-BoundsY= "+accPC.getBounds().Y);
log.println("Parent-BoundsWidth= "+accPC.getBounds().Width);
log.println("Parent-BoundsHeight= "+accPC.getBounds().Height);
accPPC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class,
parent.getAccessibleContext().getAccessibleParent());
log.println("P-Parent-BoundsX= "+accPPC.getBounds().X);
log.println("P-Parent-BoundsY= "+accPPC.getBounds().Y);
log.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width);
log.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height);
log.println("Press any key when the footer is visible.");
try{
byte[]b = new byte[16];
System.in.read(b);
} catch (Exception e) {
e.printStackTrace();
}
try {
parent = at.getAccessibleObjectForRole
(xRoot, AccessibleRole.FOOTER, "").getAccessibleChild(0);
} catch (com.sun.star.lang.IndexOutOfBoundsException iabe) {
failed(iabe.getMessage());
return;
}
accPC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class, parent);
try {
log.println("ChildCount: "+
parent.getAccessibleContext().getAccessibleChildCount());
log.println("Getting child 0 again");
oObj = parent.getAccessibleContext().getAccessibleChild(0);
} catch (com.sun.star.lang.IndexOutOfBoundsException iabe) {
failed(iabe.getMessage());
return;
}
accT = (XAccessibleText)
UnoRuntime.queryInterface(XAccessibleText.class, oObj);
log.println("Getting the text: "+accT.getText());
accC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class, oObj);
log.println("BoundsX= "+accC.getBounds().X);
log.println("BoundsY= "+accC.getBounds().Y);
log.println("BoundsWidth= "+accC.getBounds().Width);
log.println("BoundsHeight= "+accC.getBounds().Height);
accPC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class, parent);
log.println("Parent-BoundsX= "+accPC.getBounds().X);
log.println("Parent-BoundsY= "+accPC.getBounds().Y);
log.println("Parent-BoundsWidth= "+accPC.getBounds().Width);
log.println("Parent-BoundsHeight= "+accPC.getBounds().Height);
accPPC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class,
parent.getAccessibleContext().getAccessibleParent());
log.println("P-Parent-BoundsX= "+accPPC.getBounds().X);
log.println("P-Parent-BoundsY= "+accPPC.getBounds().Y);
log.println("P-Parent-BoundsWidth= "+accPPC.getBounds().Width);
log.println("P-Parent-BoundsHeight= "+accPPC.getBounds().Height);
log.println("Press any key when the page content is on top");
try{
byte[]b = new byte[16];
System.in.read(b);
} catch (Exception e) {
e.printStackTrace();
}
try {
parent = at.getAccessibleObjectForRole
(xRoot, AccessibleRole.DOCUMENT, "").getAccessibleChild(0);
} catch (com.sun.star.lang.IndexOutOfBoundsException iabe) {
failed(iabe.getMessage());
return;
}
System.out.println("PARENT: " + parent.getAccessibleContext().getAccessibleName());
accPC = (XAccessibleComponent)
UnoRuntime.queryInterface(XAccessibleComponent.class, parent);
int cCount = 0;
try {
cCount =
parent.getAccessibleContext().getAccessibleChildCount();
log.println("ChildCount: "+cCount);
log.println("Getting child 0 again");
oObj = parent.getAccessibleContext().getAccessibleChild(0);
} catch (com.sun.star.lang.IndexOutOfBoundsException iabe) {
failed(iabe.getMessage());
return;
}
for (int i=0; i<cCount; i++) {
try {
XAccessible xA = parent.getAccessibleContext().getAccessibleChild(i);
System.out.println("NAME object " + i + ": " + xA.getAccessibleContext().getAccessibleName());
} catch (com.sun.star.lang.IndexOutOfBoundsException iabe) {
failed(iabe.getMessage());
return;
}
}