Search in sources :

Example 11 with XPropertySet

use of com.sun.star.beans.XPropertySet in project jabref by JabRef.

the class OOBibBase method italicizeOrBold.

private void italicizeOrBold(XTextCursor position, boolean italicize, int start, int end) throws UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException {
    XTextRange range = position.getStart();
    XTextCursor cursor = position.getText().createTextCursorByRange(range);
    cursor.goRight((short) start, false);
    cursor.goRight((short) (end - start), true);
    XPropertySet xcp = UnoRuntime.queryInterface(XPropertySet.class, cursor);
    if (italicize) {
        xcp.setPropertyValue("CharPosture", com.sun.star.awt.FontSlant.ITALIC);
    } else {
        xcp.setPropertyValue("CharWeight", com.sun.star.awt.FontWeight.BOLD);
    }
}
Also used : XPropertySet(com.sun.star.beans.XPropertySet) XTextRange(com.sun.star.text.XTextRange) XTextCursor(com.sun.star.text.XTextCursor)

Aggregations

XPropertySet (com.sun.star.beans.XPropertySet)11 IllegalArgumentException (com.sun.star.lang.IllegalArgumentException)6 PropertyVetoException (com.sun.star.beans.PropertyVetoException)4 UnknownPropertyException (com.sun.star.beans.UnknownPropertyException)4 WrappedTargetException (com.sun.star.lang.WrappedTargetException)4 Point (com.sun.star.awt.Point)3 XTextCursor (com.sun.star.text.XTextCursor)3 XTextRange (com.sun.star.text.XTextRange)3 ArrayList (java.util.ArrayList)3 BibDatabase (org.jabref.model.database.BibDatabase)3 BibEntry (org.jabref.model.entry.BibEntry)3 XNameAccess (com.sun.star.container.XNameAccess)2 DisposedException (com.sun.star.lang.DisposedException)2 XMultiComponentFactory (com.sun.star.lang.XMultiComponentFactory)2 XParagraphCursor (com.sun.star.text.XParagraphCursor)2 XTextContent (com.sun.star.text.XTextContent)2 XTextViewCursor (com.sun.star.text.XTextViewCursor)2 XComponentContext (com.sun.star.uno.XComponentContext)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2