}
public TestEnvironment createTestEnvironment(TestParameters param,
PrintWriter log) {
XInterface oObj = null;
XControl xCtrl1 = null;
XTabControllerModel tabCtrlModel = null;
XControlContainer aCtrlContainer = null;
// create object relations
FormTools.insertForm(xTextDoc,
FormTools.getForms(WriterTools.getDrawPage(
xTextDoc)), "MyForm");
XControlShape aShape = FormTools.createUnoControlShape(xTextDoc, 3000,
4500, 15000,
10000,
"CommandButton",
"UnoControlButton");
WriterTools.getDrawPage(xTextDoc).add((XShape) aShape);
XControlModel model = aShape.getControl();
XControlAccess access = (XControlAccess) UnoRuntime.queryInterface(
XControlAccess.class,
xTextDoc.getCurrentController());
try {
xCtrl1 = access.getControl(model);
} catch (Exception e) {
}
XForm form = null;
try {
form = (XForm) AnyConverter.toObject(new Type(XForm.class),
(FormTools.getForms(
WriterTools.getDrawPage(
xTextDoc)))
.getByName("MyForm"));
} catch (Exception e) {
log.println("Couldn't get Form");
e.printStackTrace(log);
}
tabCtrlModel = (XTabControllerModel) UnoRuntime.queryInterface(
XTabControllerModel.class, form);
aCtrlContainer = (XControlContainer) UnoRuntime.queryInterface(
XControlContainer.class, xCtrl1.getContext());
// create object
try {
oObj = (XInterface) ((XMultiServiceFactory) param.getMSF()).createInstance(
"com.sun.star.awt.TabController");