Search in sources :

Example 1 with XDispatchHelper

use of com.sun.star.frame.XDispatchHelper in project zotero-libreoffice-integration by zotero.

the class ReferenceMark method getOutOfField.

private void getOutOfField() {
    try {
        XTextCursor cursor = doc.getSelection();
        if (cursor.isCollapsed() && textRangeCompare.compareRegionEnds(cursor, range) == 0) {
            cursor.gotoRange(range.getEnd(), false);
            XDispatchProvider dispatchProvider = (XDispatchProvider) UnoRuntime.queryInterface(XDispatchProvider.class, doc.controller);
            XDispatchHelper dispatchHelper = (XDispatchHelper) UnoRuntime.queryInterface(XDispatchHelper.class, doc.factory.createInstance("com.sun.star.frame.DispatchHelper"));
            dispatchHelper.executeDispatch(dispatchProvider, ".uno:ResetAttributes", "", 0, new PropertyValue[] {});
        }
    } catch (Exception e) {
    }
}
Also used : XDispatchHelper(com.sun.star.frame.XDispatchHelper) XTextCursor(com.sun.star.text.XTextCursor) XDispatchProvider(com.sun.star.frame.XDispatchProvider) WrappedTargetException(com.sun.star.lang.WrappedTargetException) UnknownPropertyException(com.sun.star.beans.UnknownPropertyException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Aggregations

UnknownPropertyException (com.sun.star.beans.UnknownPropertyException)1 XDispatchHelper (com.sun.star.frame.XDispatchHelper)1 XDispatchProvider (com.sun.star.frame.XDispatchProvider)1 WrappedTargetException (com.sun.star.lang.WrappedTargetException)1 XTextCursor (com.sun.star.text.XTextCursor)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1