use of com.sun.star.frame.XController in project jabref by JabRef.
the class OOBibBase method selectDocument.
public void selectDocument() throws UnknownPropertyException, WrappedTargetException, IndexOutOfBoundsException, NoSuchElementException, NoDocumentException {
List<XTextDocument> textDocumentList = getTextDocuments();
XTextDocument selected;
if (textDocumentList.isEmpty()) {
// No text documents found.
throw new NoDocumentException("No Writer documents found");
} else if (textDocumentList.size() == 1) {
// Get the only one
selected = textDocumentList.get(0);
} else {
// Bring up a dialog
selected = selectComponent(textDocumentList);
}
if (selected == null) {
return;
}
xCurrentComponent = UnoRuntime.queryInterface(XComponent.class, selected);
mxDoc = selected;
UnoRuntime.queryInterface(XDocumentIndexesSupplier.class, xCurrentComponent);
XModel xModel = UnoRuntime.queryInterface(XModel.class, xCurrentComponent);
XController xController = xModel.getCurrentController();
xViewCursorSupplier = UnoRuntime.queryInterface(XTextViewCursorSupplier.class, xController);
// get a reference to the body text of the document
text = mxDoc.getText();
// Access the text document's multi service factory:
mxDocFactory = UnoRuntime.queryInterface(XMultiServiceFactory.class, mxDoc);
XDocumentPropertiesSupplier supp = UnoRuntime.queryInterface(XDocumentPropertiesSupplier.class, mxDoc);
userProperties = supp.getDocumentProperties().getUserDefinedProperties();
propertySet = UnoRuntime.queryInterface(XPropertySet.class, userProperties);
}
Aggregations