* @see com.sun.star.chart.ChartDocument
*/
protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam,
PrintWriter log) {
// get a soffice factory object
SOfficeFactory SOF = SOfficeFactory.getFactory(
(XMultiServiceFactory) tParam.getMSF());
try {
log.println("creating a chartdocument");
xChartDoc = SOF.createChartDoc(null);
log.println("Waiting before opening second document");
doc2 = SOF.createChartDoc(null);
} catch (com.sun.star.uno.Exception e) {
// Some exception occures.FAILED
e.printStackTrace(log);
throw new StatusException("Couldn't create document", e);
}
// get the chartdocument
log.println("getting ChartDocument");
XInterface oObj = (XChartDocument) xChartDoc;
XController cont1 = xChartDoc.getCurrentController();
XController cont2 = doc2.getCurrentController();
cont1.getFrame().setName("cont1");
cont2.getFrame().setName("cont2");
XSelectionSupplier sel = (XSelectionSupplier) UnoRuntime.queryInterface(
XSelectionSupplier.class, cont1);
log.println("creating a new environment for chartdocument object");
TestEnvironment tEnv = new TestEnvironment(oObj);
log.println("Adding SelectionSupplier and Shape to select for XModel");
tEnv.addObjRelation("SELSUPP", sel);
tEnv.addObjRelation("TOSELECT", xChartDoc.getTitle());
log.println("adding Controller as ObjRelation for XModel");
tEnv.addObjRelation("CONT2", cont2);
log.println("adding another Diagram as mod relation to environment");
tEnv.addObjRelation("DIAGRAM",
SOF.createDiagram(xChartDoc, "PieDiagram"));
log.println("adding another ChartData as mod relation to environment");
XChartData ChartData = doc2.getData();
tEnv.addObjRelation("CHARTDATA", ChartData);