* are accessible.
*/
public void checkPreviewShape() {
SOfficeFactory SOF = SOfficeFactory.getFactory( mXMSF );
XSpreadsheetDocument xSpreadsheetDoc = null;
XComponent xComp = null;
XInterface oObj = null;
try {
String docName = "calcshapes.sxc";
log.println("Loading a spreadsheetdocument.");
String url = utils.getFullURL(
(String)param.get("TestDocumentPath") + "/" + docName);
log.println("loading document '" + url + "'");
xComp = SOF.loadDocument(url);
} catch (com.sun.star.uno.Exception e) {
failed(e.getMessage());
return;
}
try {
Thread.currentThread().sleep(500) ;
} catch (InterruptedException e) {
System.out.println("While waiting :" + e) ;
}
if (xComp == null) {
failed("loading document failed.");
return;
}
xSpreadsheetDoc = (XSpreadsheetDocument)UnoRuntime.queryInterface(
XSpreadsheetDocument.class, xComp);
XModel aModel = (XModel)
UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
XController xController = aModel.getCurrentController();
// switching to 'Page Preview' mode
try {
XDispatchProvider xDispProv = (XDispatchProvider)
UnoRuntime.queryInterface(XDispatchProvider.class, xController);
XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
UnoRuntime.queryInterface(XURLTransformer.class,
mXMSF.createInstance("com.sun.star.util.URLTransformer"));
// Because it's an in/out parameter we must use an
// array of URL objects.
URL[] aParseURL = new URL[1];
aParseURL[0] = new URL();
aParseURL[0].Complete = ".uno:PrintPreview";
xParser.parseStrict(aParseURL);
URL aURL = aParseURL[0];
XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
if(xDispatcher != null)
xDispatcher.dispatch( aURL, null );
} catch (com.sun.star.uno.Exception e) {
failed("Couldn't change mode");
return;
}
try {
Thread.currentThread().sleep(500) ;
} catch (InterruptedException e) {
System.out.println("While waiting :" + e) ;
}
log.println("Press any key when a shape is on top.");
try{
byte[]b = new byte[16];
System.in.read(b);
} catch (Exception e) {
e.printStackTrace();
}
// get the accessible content
AccessibilityTools at = new AccessibilityTools();
XWindow xWindow = at.getCurrentWindow(mXMSF, aModel);
XAccessible xRoot = at.getAccessibleObject(xWindow);
XAccessible parent = null;
try {
XAccessibleContext con = at.getAccessibleObjectForRole
(xRoot, AccessibleRole.SHAPE, "");
log.println("Name of AccessibleContext: " + con.getAccessibleName());
oObj = con;
} catch (Exception e) {
failed(e.getMessage());
return;
}
log.println("ImplementationName: " + utils.getImplName(oObj));
util.dbg.printInterfaces(oObj);
xComp.dispose();
}