public XComponent xComponent; protected com.sun.star.text.XTextDocument xTextDocument; protected com.sun.star.task.XStatusIndicator xProgressBar; public com.sun.star.frame.XFrame xFrame; public XText xText; protected XMultiServiceFactory xMSFDoc; public XMultiServiceFactory xMSF; public com.sun.star.awt.XWindowPeer xWindowPeer;
// creates an instance of TextDocument by loading a given URL as preview public TextDocument(XMultiServiceFactory xMSF, String _sPreviewURL, boolean bShowStatusIndicator, XTerminateListener listener)
{ this.xMSF = xMSF;
public ModuleIdentifier(String _identifier)
{
m_identifier = _identifier;
}
}
// creates an instance of TextDocument containing a blank text document public TextDocument(XMultiServiceFactory xMSF, ModuleIdentifier _moduleIdentifier, boolean bShowStatusIndicator)
{ this.xMSF = xMSF;
try
{ // create the empty document, and set its module identifier
xTextDocument = UnoRuntime.queryInterface(XTextDocument.class,
xMSF.createInstance("com.sun.star.text.TextDocument"));
// load the document into a blank frame
XDesktop xDesktop = Desktop.getDesktop(xMSF);
XComponentLoader xLoader = UnoRuntime.queryInterface(XComponentLoader.class, xDesktop);
PropertyValue[] loadArgs = new PropertyValue[]
{ new PropertyValue("Model", -1, xTextDocument, com.sun.star.beans.PropertyState.DIRECT_VALUE)
};
xLoader.loadComponentFromURL("private:object", "_blank", 0, loadArgs);
// remember some things for later usage
xFrame = xTextDocument.getCurrentController().getFrame();
xComponent = UnoRuntime.queryInterface(XComponent.class, xTextDocument);
} catch (Exception e)
{ // TODO: it seems the whole project does not really have an error handling. Other methods // seem to generally silence errors, so we can't do anything else here...
e.printStackTrace();
}
if (bShowStatusIndicator)
{
showStatusIndicator();
}
init();
}
//creates an instance of TextDocument from a given XTextDocument public TextDocument(XMultiServiceFactory xMSF, XTextDocument _textDocument, boolean bshowStatusIndicator)
{ this.xMSF = xMSF;
xFrame = _textDocument.getCurrentController().getFrame();
xComponent = UnoRuntime.queryInterface(XComponent.class, _textDocument);
xTextDocument = UnoRuntime.queryInterface(XTextDocument.class, xComponent); //PosSize = xFrame.getComponentWindow().getPosSize(); if (bshowStatusIndicator)
{
XStatusIndicatorFactory xStatusIndicatorFactory = UnoRuntime.queryInterface(XStatusIndicatorFactory.class, xFrame);
xProgressBar = xStatusIndicatorFactory.createStatusIndicator();
xProgressBar.start(PropertyNames.EMPTY_STRING, 100);
xProgressBar.setValue(5);
}
xWindowPeer = UnoRuntime.queryInterface(XWindowPeer.class, xFrame.getComponentWindow());
xMSFDoc = UnoRuntime.queryInterface(XMultiServiceFactory.class, xTextDocument);
UnoRuntime.queryInterface(XNumberFormatsSupplier.class, xTextDocument);
// Todo: This method is unsecure because the last index is not necessarily the last section
// Todo: This Routine should be modified, because I cannot rely on the last Table in the document to be the last in the TextTables sequence // to make it really safe you must acquire the Tablenames before the insertion and after the insertion of the new Table. By comparing the // two sequences of tablenames you can find out the tablename of the last inserted Table
publicvoid unlockallControllers()
{ while (xTextDocument.hasControllersLocked())
{
xTextDocument.unlockControllers();
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.