* to the text document, and finally endnote settings are gotten from text
* document using <code>XEndnotesSupplier</code> interface.
*/
public synchronized TestEnvironment createTestEnvironment(
TestParameters Param, PrintWriter log ) throws StatusException {
XEndnotesSupplier oInterface = null;
XInterface oObj = null;
XInterface oEndnote;
log.println( "Creating a test environment" );
XMultiServiceFactory msf = (XMultiServiceFactory)
UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDoc);
log.println("creating a endnote");
try {
oEndnote = (XInterface) UnoRuntime.queryInterface(XInterface.class,
msf.createInstance("com.sun.star.text.Endnote"));
} catch (com.sun.star.uno.Exception e) {
e.printStackTrace(log);
throw new StatusException("Couldn't create endnote", e);
}
XText oText = xTextDoc.getText();
XTextCursor oCursor = oText.createTextCursor();
log.println("inserting the footnote into text document");
XTextContent xTC = (XTextContent)
UnoRuntime.queryInterface(XTextContent.class, oEndnote);
try {
oText.insertTextContent(oCursor, xTC, false);
} catch (com.sun.star.lang.IllegalArgumentException e) {
e.printStackTrace(log);
throw new StatusException("Couldn't insert the endnote", e);
}
oInterface = (XEndnotesSupplier)
UnoRuntime.queryInterface(XEndnotesSupplier.class, xTextDoc);
oObj = oInterface.getEndnoteSettings();
dbg.printPropertiesNames((XPropertySet) oObj);
TestEnvironment tEnv = new TestEnvironment(oObj);
return tEnv;
}