Verified Owner
Top Constructors Methods
org.jabref.model.openoffice.uno

public Class UnoReferenceMark

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .List, .Optional, org.jabref.model.openoffice.DocumentAnnotation, com.sun.star.container.NoSuchElementException, com.sun.star.container.XNameAccess, com.sun.star.container.XNamed, com.sun.star.lang.DisposedException, com.sun.star.lang.WrappedTargetException, com.sun.star.text.XReferenceMarksSupplier, com.sun.star.text.XTextContent, com.sun.star.text.XTextDocument, com.sun.star.text.XTextRange

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static com.sun.star.container.XNamed
create(DocumentAnnotation documentAnnotation)

Insert a new reference mark at the provided cursor position.

public static Optional<com.sun.star.text.XTextRange>
getAnchor(com.sun.star.text.XTextDocument doc, String name)

XTextRange for the named reference mark, Optional.empty if not found.

public static Optional<com.sun.star.text.XTextContent>
getAsTextContent(com.sun.star.text.XTextDocument doc, String name)

Returns: reference mark as XTextContent, Optional.empty if not found.

public static List<String>
getListOfNames(com.sun.star.text.XTextDocument doc)

Names of all reference marks.

public static com.sun.star.container.XNameAccess
getNameAccess(com.sun.star.text.XTextDocument doc)

Note

also used by isDocumentConnectionMissing to test if we have a working connection.

public static void
removeIfExists(com.sun.star.text.XTextDocument doc, String name)

Remove the named reference mark.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

UnoReferenceMarkback to summary
private UnoReferenceMark()

Method Detail

createback to summary
public static com.sun.star.container.XNamed create(DocumentAnnotation documentAnnotation) throws CreationException

Insert a new reference mark at the provided cursor position.

If documentAnnotation.getAbsorb is true, the text in the cursor range will become the text with gray background.

Note

LibreOffice 6.4.6.2 will create multiple reference marks with the same name without error or renaming. Its GUI does not allow this, but we can create them programmatically. In the GUI, clicking on any of those identical names will move the cursor to the same mark.

getAnchorback to summary
public static Optional<com.sun.star.text.XTextRange> getAnchor(com.sun.star.text.XTextDocument doc, String name) throws NoDocumentException, com.sun.star.lang.WrappedTargetException

XTextRange for the named reference mark, Optional.empty if not found.

getAsTextContentback to summary
public static Optional<com.sun.star.text.XTextContent> getAsTextContent(com.sun.star.text.XTextDocument doc, String name) throws NoDocumentException, com.sun.star.lang.WrappedTargetException
Returns:Optional<com.sun.star.text.XTextContent>

reference mark as XTextContent, Optional.empty if not found.

getListOfNamesback to summary
public static List<String> getListOfNames(com.sun.star.text.XTextDocument doc) throws NoDocumentException

Names of all reference marks.

Empty list for nothing.

getNameAccessback to summary
public static com.sun.star.container.XNameAccess getNameAccess(com.sun.star.text.XTextDocument doc) throws NoDocumentException

Note

also used by isDocumentConnectionMissing to test if we have a working connection.

Exceptions
NoDocumentException:
If cannot get reference marks
removeIfExistsback to summary
public static void removeIfExists(com.sun.star.text.XTextDocument doc, String name) throws com.sun.star.lang.WrappedTargetException, NoDocumentException

Remove the named reference mark.

Removes both the text and the mark itself.