XWindow anotherWindow = (XWindow) UnoRuntime.queryInterface(
XWindow.class,aModel2.getCurrentController());
log.println( "creating a new environment for impress view object" );
TestEnvironment tEnv = new TestEnvironment( oObj );
if (anotherWindow != null) {
tEnv.addObjRelation("XWindow.AnotherWindow",anotherWindow);
}
Object oShapeCol1 = null;
Object oShapeCol2 = null;
try {
oShapeCol1 = xMSF.
createInstance("com.sun.star.drawing.ShapeCollection");
oShapeCol2 = xMSF.
createInstance("com.sun.star.drawing.ShapeCollection");
} catch(com.sun.star.uno.Exception e) {
e.printStackTrace(log);
throw new StatusException(Status.failed("Couldn't create instance"));
}
XShapes xShapes1 = (XShapes)
UnoRuntime.queryInterface(XShapes.class, oShapeCol1);
XShapes xShapes2 = (XShapes)
UnoRuntime.queryInterface(XShapes.class, oShapeCol2);
xShapes1.add(shape2);
xShapes1.add(shape3);
xShapes2.add(shape1);
shortWait();
tEnv.addObjRelation("Selections", new Object[] {
oDrawPage, oShapeCol1, oShapeCol2});
tEnv.addObjRelation("Comparer", new Comparator() {
public int compare(Object o1, Object o2) {
XIndexAccess indAc1 = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, o1);
XIndexAccess indAc2 = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, o2);
if (indAc1 == null || indAc2 == null) return -1;
if (indAc1.getCount() == indAc2.getCount()) {
return 0;
}
return 1;
}
public boolean equals(Object obj) {
return compare(this, obj) == 0;
} });
tEnv.addObjRelation("Pages", the_pages);
//Adding ObjRelations for XController
tEnv.addObjRelation("FirstModel", aModel);
tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
XFrame the_frame = the_Desk.getCurrentFrame();
tEnv.addObjRelation("Frame", the_frame);
aModel = (XModel)
UnoRuntime.queryInterface(XModel.class, xSecondDrawDoc);
//Adding ObjRelations for XController
tEnv.addObjRelation("SecondModel", aModel);
XController secondController = aModel.getCurrentController();
tEnv.addObjRelation("SecondController", secondController);
tEnv.addObjRelation("XDispatchProvider.URL",
"slot:27009");
//Adding relations for DrawingDocumentDrawView
XDrawPage new_page = the_pages.insertNewByIndex(1);
tEnv.addObjRelation("DrawPage", new_page);
log.println("Implementation Name: "+utils.getImplName(oObj));
XModifiable modify = (XModifiable)
UnoRuntime.queryInterface(XModifiable.class,xDrawDoc);
tEnv.addObjRelation("Modifiable",modify);
tEnv.addObjRelation("XComponent.DisposeThis", xDrawDoc);
return tEnv;
} // finish method getTestEnvironment