log.println("ImplementationName " + utils.getImplName(oObj));
TestEnvironment tEnv = new TestEnvironment(oObj);
// relation for XAccessibleEventBroadcaster
XCell xCell = null;
final String text = "XAccessibleText";
try {
XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ;
XIndexAccess oIndexSheets = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
XSpreadsheet oSheet = null;
try {
oSheet = (XSpreadsheet) AnyConverter.toObject(
new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
} catch (com.sun.star.lang.IllegalArgumentException iae) {
throw new StatusException("couldn't get sheet",iae);
}
xCell = oSheet.getCellByPosition(1, 0) ;
xCell.setFormula(text);
XColumnRowRange oColumnRowRange = (XColumnRowRange)
UnoRuntime.queryInterface(XColumnRowRange.class, oSheet);
XTableColumns oColumns = (XTableColumns) oColumnRowRange.getColumns();
XIndexAccess oIndexAccess = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, oColumns);
XPropertySet column = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class,oIndexAccess.getByIndex(1));
column.setPropertyValue("OptimalWidth", new Boolean(true));
} catch(com.sun.star.lang.WrappedTargetException e) {
log.println("Exception ceating relation :");
e.printStackTrace(log);
} catch(com.sun.star.lang.IndexOutOfBoundsException e) {
log.println("Exception ceating relation :");
e.printStackTrace(log);
} catch(com.sun.star.beans.UnknownPropertyException e) {
log.println("Exception ceating relation :");
e.printStackTrace(log);
} catch(com.sun.star.beans.PropertyVetoException e) {
log.println("Exception ceating relation :");
e.printStackTrace(log);
} catch(com.sun.star.lang.IllegalArgumentException e) {
log.println("Exception ceating relation :");
e.printStackTrace(log);
}
tEnv.addObjRelation("EditOnly",
"This method is only supported if the Cell is in edit mode");
final XCell fCell = xCell ;
tEnv.addObjRelation("EventProducer",
new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
public void fireEvent() {
fCell.setFormula("firing event");
fCell.setFormula(text);
}
});
tEnv.addObjRelation("XAccessibleText.Text", text);