*/
protected TestEnvironment createTestEnvironment
(TestParameters tParam, PrintWriter log) {
XInterface oObj = null;
XShape oShape = null;
// creation of testobject here
// first we write what we are intend to do to log file
log.println( "creating a test environment" );
try {
XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class,xDrawDoc);
Object oInt = oDocMSF.createInstance
( "com.sun.star.drawing.ConnectorShape" );
oShape = (XShape)UnoRuntime.queryInterface( XShape.class, oInt );
DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape);
}
catch (Exception e) {
log.println("Couldn't create insance");
e.printStackTrace(log);
}
// create testobject here
oObj = oShape;
TestEnvironment tEnv = new TestEnvironment( oObj );
SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
oShape = SOF.createShape(xDrawDoc,3000,4500,15000,1000,"Ellipse");
DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape);
for (int i=0;i<10;i++) {
DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(
SOF.createShape(xDrawDoc,
3000,4500,7510+10*i,5010+10*i,"Rectangle"));
}
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"));
} catch (Exception 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 (Exception e) {}
tEnv.addObjRelation("Style2",aStyle);
DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent",
"com.sun.star.text.TextField.URL");
log.println( " adding InstCreator object" );
tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xDrawDoc, tDsc ) );
tEnv.addObjRelation("NoSetSize","SvxShapeConnector");
// adding relation for XConnectorShape
XShape oShape1 = SOF.createShape(xDrawDoc,1000,2000,1500,1000,"Line");
XShape oShape2 = SOF.createShape(xDrawDoc,1000,2000,4000,3000,"Line");
DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape1);
DrawTools.getShapes(DrawTools.getDrawPage(xDrawDoc,0)).add(oShape2);
tEnv.addObjRelation("XConnectorShape.Shapes",
new XShape[] {oShape1, oShape2}) ;
System.out.println("IName: "+util.utils.getImplName(oObj));