XInterface oObj = null;
XTextFrame oFrame1 = null;
XText oText = null;
XTextCursor oCursor = null;
XMultiServiceFactory oDocMSF = null;
XTextFramesSupplier oInterface = null;
log.println( "creating a test environment" );
try {
oDocMSF = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc);
Object oInt = oDocMSF.createInstance("com.sun.star.text.TextFrame");
oFrame1 = (XTextFrame)
UnoRuntime.queryInterface( XTextFrame.class, oInt );
} catch ( com.sun.star.uno.Exception e ) {
e.printStackTrace(log);
throw new StatusException
("Couldn't create instance of TextFrame", e);
}
oText = xTextDoc.getText();
oCursor = oText.createTextCursor();
try {
oText.insertTextContent(oCursor, oFrame1, false);
} catch ( com.sun.star.lang.IllegalArgumentException e ) {
e.printStackTrace(log);
throw new StatusException
("Error: can't insert text content to text document", e);
}
oInterface = (XTextFramesSupplier)
UnoRuntime.queryInterface( XTextFramesSupplier.class, xTextDoc );
oObj = oInterface.getTextFrames();
log.println( "creating a new environment for Frame object" );
TestEnvironment tEnv = new TestEnvironment( oObj );
return tEnv;