XIndexAccess oDPi = (XIndexAccess)
UnoRuntime.queryInterface(XIndexAccess.class, oDPn);
XDrawPage oDP = null;
try {
oDP = (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 by index", e);
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace( log );
throw new StatusException("Couldn't get by index", e);
} catch (com.sun.star.lang.IllegalArgumentException e) {
e.printStackTrace( log );
throw new StatusException("Couldn't get by index", e);
}
//get a Shape
log.println( "getting Shape" );
XShapes oShapes = (XShapes) UnoRuntime.queryInterface
(XShapes.class, oDP);
XInterface oObj = SOF.createShape
(xDrawDoc, 5000, 3500, 7500, 5000, "Rectangle");
for (int i=0; i < 10; i++) {
oShapes.add(
SOF.createShape(xDrawDoc,
5000, 3500, 7510 + 10 * i, 5010 + 10 * i, "Rectangle"));
}
XShape oShape = SOF.createShape
(xDrawDoc, 3000, 4500, 15000, 1000, "Ellipse");
oShapes.add((XShape) oObj);
oShapes.add((XShape) oShape);
log.println( "creating a new environment for XShape object" );
TestEnvironment tEnv = new TestEnvironment( oObj );
log.println( "adding two style as ObjRelation for ShapeDescriptor" );
XPropertySet oShapeProps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, oObj);
XStyle aStyle = null;
try {
aStyle = (XStyle) AnyConverter.toObject(
new Type(XStyle.class),oShapeProps.getPropertyValue("Style"));
oShapeProps.setPropertyValue("ZOrder", new Integer(1));
} catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't set or get property value", e);
} catch (com.sun.star.beans.UnknownPropertyException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't set or get property value", e);
} catch (com.sun.star.lang.IllegalArgumentException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't set or get property value", e);
} catch (com.sun.star.beans.PropertyVetoException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't set or get property value", e);
}
tEnv.addObjRelation("Style1", aStyle);
oShapeProps = (XPropertySet)
UnoRuntime.queryInterface(XPropertySet.class, oShape);
try {
aStyle = (XStyle) AnyConverter.toObject(
new Type(XStyle.class),oShapeProps.getPropertyValue("Style"));
} catch (com.sun.star.lang.WrappedTargetException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't get property value", e);
} catch (com.sun.star.beans.UnknownPropertyException e) {
e.printStackTrace(log);