//creates an instance of TextDocument and creates a frame with an empty document
public TextDocument(XMultiServiceFactory xMSF, boolean bshowStatusIndicator, boolean bgetCurrentFrame, XTerminateListener listener, String _sUrl, boolean bShowPreview) {
this.xMSF = xMSF;
XDesktop xDesktop = Desktop.getDesktop(xMSF);
if (bgetCurrentFrame) {
XFramesSupplier xFrameSupplier = (XFramesSupplier) UnoRuntime.queryInterface(XFramesSupplier.class, xDesktop);
xFrame = xFrameSupplier.getActiveFrame();
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xFrame.getController().getModel());
xTextDocument = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xComponent);
} else {
xFrame = OfficeDocument.createNewFrame(xMSF, listener);
if (bShowPreview){