(TestParameters Param, PrintWriter log) {
log.println( "creating a test environment" );
XMultiServiceFactory xMSF = (XMultiServiceFactory)Param.getMSF();
// get a soffice factory object
SOfficeFactory SOF = SOfficeFactory.getFactory(xMSF);
try {
log.println( "creating two impress documents" );
xSecondDrawDoc = SOF.createImpressDoc(null);
shortWait();
xDrawDoc = SOF.createImpressDoc(null);
shortWait();
} catch (com.sun.star.uno.Exception e) {
e.printStackTrace( log );
throw new StatusException("Couldn't create document", e);
}
// get the drawpage of drawing here
log.println( "getting Drawpage" );
XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
UnoRuntime.queryInterface(XDrawPagesSupplier.class, xDrawDoc);
XDrawPages the_pages = oDPS.getDrawPages();
for (int i = 1; i < 10; i++){
the_pages.insertNewByIndex(i);
}
XIndexAccess oDPi = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class,the_pages);
XDrawPage oDrawPage = null;
try {
oDrawPage = (XDrawPage) AnyConverter.toObject(
new Type(XDrawPage.class),oDPi.getByIndex(0));
} catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace( log );
throw new StatusException("Couldn't get DrawPage", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace( log );
throw new StatusException("Couldn't get DrawPage", e);
} catch (com.sun.star.lang.IllegalArgumentException e) {
e.printStackTrace( log );
throw new StatusException("Couldn't get DrawPage", e);
}
//put something on the drawpage
log.println( "inserting some Shapes" );
XShapes oShapes = (XShapes)
UnoRuntime.queryInterface(XShapes.class, oDrawPage);
XShape shape1 = SOF.createShape(
xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
XShape shape2 = SOF.createShape(
xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
XShape shape3 = SOF.createShape(
xDrawDoc, 3000, 500, 5000, 1000, "Line");
oShapes.add(shape1);
oShapes.add(shape2);
oShapes.add(shape3);
shortWait();