* to the text, and finally gets all footnotes of text document
* through <code>XFootnotesSupplier</code> interface.
*/
public synchronized TestEnvironment createTestEnvironment(
TestParameters Param, PrintWriter log ) throws StatusException {
XFootnotesSupplier oInterface = null;
XInterface oObj = null;
log.println( "Creating a test environment" );
XMultiServiceFactory msf = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc);
log.println("creating a footnote");
XFootnote oFootnote;
try {
oFootnote = (XFootnote) UnoRuntime.queryInterface(XFootnote.class,
msf.createInstance("com.sun.star.text.Footnote"));
} catch (com.sun.star.uno.Exception e) {
e.printStackTrace(log);
throw new StatusException("Couldn't create footnote", e);
}
XText oText = xTextDoc.getText();
XTextCursor oCursor = oText.createTextCursor();
log.println("inserting the footnote into text document");
try {
oText.insertTextContent(oCursor, oFootnote, false);
} catch (com.sun.star.lang.IllegalArgumentException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't insert the footnote", e);
}
oInterface = (XFootnotesSupplier)
UnoRuntime.queryInterface(XFootnotesSupplier.class, xTextDoc);
oObj = oInterface.getFootnotes();
log.println( "creating a new environment for Foontnotes object" );
TestEnvironment tEnv = new TestEnvironment(oObj);
return tEnv;
}