}
//creates an instance of TextDocument and creates a frame and loads a document
public TextDocument(XMultiServiceFactory xMSF, String URL, PropertyValue[] xArgs, XTerminateListener listener) {
this.xMSF = xMSF;
XDesktop xDesktop = Desktop.getDesktop(xMSF);
xFrame = OfficeDocument.createNewFrame(xMSF,listener);
Object oDoc = OfficeDocument.load(xFrame, URL, "_self", xArgs);
xTextDocument = (XTextDocument) oDoc;
xComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, xTextDocument);