use of com.sun.star.text.XTextSection in project jabref by JabRef.
the class OOBibBase method clearBibTextSectionContent2.
private void clearBibTextSectionContent2() throws NoSuchElementException, WrappedTargetException, IllegalArgumentException, CreationException {
// Check if the section exists:
XTextSectionsSupplier supplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, mxDoc);
if (supplier.getTextSections().hasByName(OOBibBase.BIB_SECTION_NAME)) {
XTextSection section = (XTextSection) ((Any) supplier.getTextSections().getByName(OOBibBase.BIB_SECTION_NAME)).getObject();
// Clear it:
XTextCursor cursor = text.createTextCursorByRange(section.getAnchor());
cursor.gotoRange(section.getAnchor(), false);
cursor.setString("");
} else {
createBibTextSection2(atEnd);
}
}
use of com.sun.star.text.XTextSection in project jabref by JabRef.
the class OOBibBase method populateBibTextSection.
private void populateBibTextSection(Map<BibEntry, BibDatabase> entries, OOBibStyle style) throws NoSuchElementException, WrappedTargetException, PropertyVetoException, UnknownPropertyException, UndefinedParagraphFormatException, IllegalArgumentException, CreationException {
XTextSectionsSupplier supplier = UnoRuntime.queryInterface(XTextSectionsSupplier.class, mxDoc);
XTextSection section = (XTextSection) ((Any) supplier.getTextSections().getByName(OOBibBase.BIB_SECTION_NAME)).getObject();
XTextCursor cursor = text.createTextCursorByRange(section.getAnchor());
OOUtil.insertTextAtCurrentLocation(text, cursor, (String) style.getProperty(OOBibStyle.TITLE), (String) style.getProperty(OOBibStyle.REFERENCE_HEADER_PARAGRAPH_FORMAT));
insertFullReferenceAtCursor(cursor, entries, style, (String) style.getProperty(OOBibStyle.REFERENCE_PARAGRAPH_FORMAT));
insertBookMark(OOBibBase.BIB_SECTION_END_NAME, cursor);
}
Aggregations