Verified Owner
Top Description Fields Constructors Methods
org.jabref.logic.openoffice.oocsltext

public Class CSLReferenceMarkManager

extends Object
Class Inheritance
Imports
java.util.ArrayList, .HashMap, .LinkedHashMap, .List, .Map, .Optional, .Set, java.util.regex.Matcher, .Pattern, java.util.stream.Collectors, org.jabref.logic.openoffice.JabRefReferenceMark, .OpenOfficeReferenceMarkFormat, .ReferenceMark, .ZoteroReferenceMark, org.jabref.model.database.BibDatabase, .BibDatabaseContext, org.jabref.model.entry.BibEntry, .BibEntryTypesManager, org.jabref.model.openoffice.DocumentAnnotation, org.jabref.model.openoffice.ootext.OOText, .OOTextIntoOO, org.jabref.model.openoffice.rangesort.RangeSort, .RangeSortEntry, org.jabref.model.openoffice.uno.CreationException, .UnoDispatch, .UnoReferenceMark, .UnoTextRange, .UnoUserDefinedProperty, com.sun.star.beans.NotRemoveableException, com.sun.star.beans.XPropertySet, com.sun.star.container.NoSuchElementException, com.sun.star.container.XNameAccess, com.sun.star.container.XNamed, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException, com.sun.star.lang.XMultiServiceFactory, com.sun.star.text.XReferenceMarksSupplier, com.sun.star.text.XText, com.sun.star.text.XTextContent, com.sun.star.text.XTextCursor, com.sun.star.text.XTextDocument, com.sun.star.text.XTextRange, com.sun.star.text.XTextRangeCompare, com.sun.star.uno.Exception, com.sun.star.uno.UnoRuntime, com.sun.star.uno.XComponentContext, io.github.thibaultmeyer.cuid.CUID, org.slf4j.Logger, .LoggerFactory

Class for generation, insertion and management of all reference marks in the document.

Field Summary

Modifier and TypeField and Description
private static final Pattern
private Map<String, Integer>
private CSLCitationType
private final com.sun.star.uno.XComponentContext
private final com.sun.star.text.XTextDocument
private final com.sun.star.lang.XMultiServiceFactory
private static final String
private static final Pattern
private static final Pattern
private int
private static final Pattern
private boolean
private static final Logger
private final Map<String, CSLReferenceMark>
private final List<CSLReferenceMark>
private int
private final com.sun.star.text.XTextRangeCompare

Constructor Summary

AccessConstructor and Description
public
CSLReferenceMarkManager(com.sun.star.text.XTextDocument document, com.sun.star.uno.XComponentContext componentContext)

Method Summary

Modifier and TypeMethod and Description
private static int
appendUpdatedCitationTextSegment(StringBuilder result, String textSegment, List<Integer> newNumbers, int numberIndex)

private Optional<String>
buildConvertedReferenceMarkName(CSLReferenceMark mark, OpenOfficeReferenceMarkFormat referenceMarkFormat, List<BibDatabase> selectedDatabases, BibEntryTypesManager entryTypesManager, Map<String, String> zoteroUriByCitationKey)

private Optional<String>
buildZoteroReferenceMarkName(CSLReferenceMark mark, List<BibDatabase> selectedDatabases, BibEntryTypesManager entryTypesManager, Map<String, String> zoteroUriByCitationKey)

private int
private static boolean
public int
convertReferenceMarks(OpenOfficeReferenceMarkFormat referenceMarkFormat, List<BibDatabase> selectedDatabases, BibEntryTypesManager entryTypesManager)

public CSLReferenceMark
createReferenceMark(List<BibEntry> entries, CSLCitationType citationType, BibDatabaseContext bibDatabaseContext, BibEntryTypesManager entryTypesManager, OpenOfficeReferenceMarkFormat referenceMarkFormat)

private Optional<List<BibEntry>>
findEntriesByCitationKeys(List<String> citationKeys, List<BibDatabase> selectedDatabases)

private Optional<BibEntry>
findEntryByCitationKey(String citationKey, List<BibDatabase> selectedDatabases)

public int
public CSLCitationType
private String
public List<CSLReferenceMark>
pack-priv static String
private String
private Map<String, String>
public boolean
public void
insertReferenceIntoOO(List<BibEntry> entries, com.sun.star.text.XTextDocument doc, com.sun.star.text.XTextCursor position, OOText ooText, boolean insertSpaceBefore, boolean insertSpaceAfter, CSLCitationType citationType, BibDatabaseContext bibDatabaseContext, BibEntryTypesManager entryTypesManager, OpenOfficeReferenceMarkFormat referenceMarkFormat)

public boolean
public void
public void
private void
private void
removeUnusedFormattedCitationTextProperties(Set<String> existingReferenceMarkUniqueIds)

private void
restoreEscapementFormattingIfNeeded(String text, com.sun.star.text.XTextCursor cursor)

public void
private void
private void
public void
updateAllCitationNumbers(Map<String, Integer> preferredCitationKeyToNumber)

private void
private void
public void
private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CITATION_NUMBER_PATTERNback to summary
private static final Pattern CITATION_NUMBER_PATTERN
citationKeyToNumberback to summary
private Map<String, Integer> citationKeyToNumber
citationTypeback to summary
private CSLCitationType citationType
componentContextback to summary
private final com.sun.star.uno.XComponentContext componentContext
documentback to summary
private final com.sun.star.text.XTextDocument document
factoryback to summary
private final com.sun.star.lang.XMultiServiceFactory factory
FORMATTED_CITATION_TEXT_PROPERTY_PREFIXback to summary
private static final String FORMATTED_CITATION_TEXT_PROPERTY_PREFIX
FULL_SUBSCRIPT_PATTERNback to summary
private static final Pattern FULL_SUBSCRIPT_PATTERN
FULL_SUPERSCRIPT_PATTERNback to summary
private static final Pattern FULL_SUPERSCRIPT_PATTERN
highestCitationNumberback to summary
private int highestCitationNumber
HTML_TAG_PATTERNback to summary
private static final Pattern HTML_TAG_PATTERN
isNumberUpdateRequiredback to summary
private boolean isNumberUpdateRequired
LOGGERback to summary
private static final Logger LOGGER
marksByNameback to summary
private final Map<String, CSLReferenceMark> marksByName
marksInOrderback to summary
private final List<CSLReferenceMark> marksInOrder
nextZoteroItemIdback to summary
private int nextZoteroItemId
textRangeCompareback to summary
private final com.sun.star.text.XTextRangeCompare textRangeCompare

Constructor Detail

CSLReferenceMarkManagerback to summary
public CSLReferenceMarkManager(com.sun.star.text.XTextDocument document, com.sun.star.uno.XComponentContext componentContext)

Method Detail

appendUpdatedCitationTextSegmentback to summary
private static int appendUpdatedCitationTextSegment(StringBuilder result, String textSegment, List<Integer> newNumbers, int numberIndex)
buildConvertedReferenceMarkNameback to summary
private Optional<String> buildConvertedReferenceMarkName(CSLReferenceMark mark, OpenOfficeReferenceMarkFormat referenceMarkFormat, List<BibDatabase> selectedDatabases, BibEntryTypesManager entryTypesManager, Map<String, String> zoteroUriByCitationKey)
buildZoteroReferenceMarkNameback to summary
private Optional<String> buildZoteroReferenceMarkName(CSLReferenceMark mark, List<BibDatabase> selectedDatabases, BibEntryTypesManager entryTypesManager, Map<String, String> zoteroUriByCitationKey)
compareTextRangesback to summary
private int compareTextRanges(RangeSortEntry<CSLReferenceMark> first, RangeSortEntry<CSLReferenceMark> second)
containsEscapementMarkupback to summary
private static boolean containsEscapementMarkup(String text)
convertReferenceMarksback to summary
public int convertReferenceMarks(OpenOfficeReferenceMarkFormat referenceMarkFormat, List<BibDatabase> selectedDatabases, BibEntryTypesManager entryTypesManager) throws com.sun.star.uno.Exception, CreationException
createReferenceMarkback to summary
public CSLReferenceMark createReferenceMark(List<BibEntry> entries, CSLCitationType citationType, BibDatabaseContext bibDatabaseContext, BibEntryTypesManager entryTypesManager, OpenOfficeReferenceMarkFormat referenceMarkFormat) throws com.sun.star.uno.Exception
findEntriesByCitationKeysback to summary
private Optional<List<BibEntry>> findEntriesByCitationKeys(List<String> citationKeys, List<BibDatabase> selectedDatabases)
findEntryByCitationKeyback to summary
private Optional<BibEntry> findEntryByCitationKey(String citationKey, List<BibDatabase> selectedDatabases)
getCitationNumberback to summary
public int getCitationNumber(String citationKey)
getCitationTypeback to summary
public CSLCitationType getCitationType()
getCurrentCitationTextback to summary
private String getCurrentCitationText(CSLReferenceMark mark) throws com.sun.star.lang.WrappedTargetException
getMarksInOrderback to summary
public List<CSLReferenceMark> getMarksInOrder()
getUpdatedCitationTextWithNewNumbersback to summary
pack-priv static String getUpdatedCitationTextWithNewNumbers(String currentText, List<Integer> newNumbers)
getUpdatedReferenceMarkNameWithNewNumbersback to summary
private String getUpdatedReferenceMarkNameWithNewNumbers(String oldName, List<Integer> newNumbers)
getZoteroUriByCitationKeyback to summary
private Map<String, String> getZoteroUriByCitationKey()
hasCitationForKeyback to summary
public boolean hasCitationForKey(String citationKey)
insertReferenceIntoOOback to summary
public void insertReferenceIntoOO(List<BibEntry> entries, com.sun.star.text.XTextDocument doc, com.sun.star.text.XTextCursor position, OOText ooText, boolean insertSpaceBefore, boolean insertSpaceAfter, CSLCitationType citationType, BibDatabaseContext bibDatabaseContext, BibEntryTypesManager entryTypesManager, OpenOfficeReferenceMarkFormat referenceMarkFormat) throws CreationException, com.sun.star.uno.Exception
isConversionNeededForFirstReferenceMarkback to summary
public boolean isConversionNeededForFirstReferenceMark(OpenOfficeReferenceMarkFormat referenceMarkFormat)
readAndUpdateExistingMarksback to summary
public void readAndUpdateExistingMarks() throws com.sun.star.lang.WrappedTargetException, com.sun.star.container.NoSuchElementException
readExistingMarksback to summary
public void readExistingMarks() throws com.sun.star.lang.WrappedTargetException, com.sun.star.container.NoSuchElementException
rebuildCitationNumberStateback to summary
private void rebuildCitationNumberState()
removeUnusedFormattedCitationTextPropertiesback to summary
private void removeUnusedFormattedCitationTextProperties(Set<String> existingReferenceMarkUniqueIds)
restoreEscapementFormattingIfNeededback to summary
private void restoreEscapementFormattingIfNeeded(String text, com.sun.star.text.XTextCursor cursor)
setRealTimeNumberUpdateRequiredback to summary
public void setRealTimeNumberUpdateRequired(boolean isNumeric)
sortMarksInOrderback to summary
private void sortMarksInOrder()
updateAllCitationNumbersback to summary
private void updateAllCitationNumbers() throws com.sun.star.uno.Exception, CreationException
updateAllCitationNumbersback to summary
public void updateAllCitationNumbers(Map<String, Integer> preferredCitationKeyToNumber) throws com.sun.star.uno.Exception, CreationException
updateMarkAndTextback to summary
private void updateMarkAndText(CSLReferenceMark mark, String newText, String markName) throws com.sun.star.uno.Exception, CreationException
updateMarkAndTextWithNewNumbersback to summary
private void updateMarkAndTextWithNewNumbers(CSLReferenceMark mark, List<Integer> newNumbers, String currentText) throws com.sun.star.uno.Exception, CreationException
updateMarkAndTextWithNewStyleback to summary
public void updateMarkAndTextWithNewStyle(CSLReferenceMark mark, String newText, CSLCitationType citationType) throws com.sun.star.uno.Exception, CreationException
updateReferenceMarkNameback to summary
private boolean updateReferenceMarkName(CSLReferenceMark mark, String markName) throws com.sun.star.uno.Exception, CreationException