protected TestEnvironment createTestEnvironment(TestParameters Param,
PrintWriter log) {
XInterface oObj = null;
XWindowPeer the_win = null;
XToolkit the_kit = null;
XDevice aDevice = null;
XGraphics aGraphic = null;
XControl aControl = null;
//Insert a ControlShape and get the ControlModel
XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000,
4500, 15000,
10000,
"DatabaseFormattedField",
"UnoControlFormattedField");
WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);
XControlModel the_Model = aShape.getControl();
XControlShape aShape2 = FormTools.createControlShape(xTextDoc, 3000,
4500, 5000, 10000,
"TextField");
WriterTools.getDrawPage(xTextDoc).add((XShape) aShape2);
XControlModel the_Model2 = aShape2.getControl();
XPropertySet xPS = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, the_Model);
//Try to query XControlAccess
XControlAccess the_access = (XControlAccess) UnoRuntime.queryInterface(
XControlAccess.class,
xTextDoc.getCurrentController());
//get the EditControl for the needed Object relations
try {
oObj = the_access.getControl(the_Model);
aControl = the_access.getControl(the_Model2);
the_win = the_access.getControl(the_Model).getPeer();
the_kit = the_win.getToolkit();
aDevice = the_kit.createScreenCompatibleDevice(200, 200);
aGraphic = aDevice.createGraphics();
xPS.setPropertyValue("Spin", new Boolean(true));
} catch (com.sun.star.uno.Exception e) {
log.println("Couldn't get EditControl");
e.printStackTrace(log);