CSLReferenceMarkManager for management of reference marks tied to the CSL citations.
It uses OpenOfficePreferences to retrieve the initial style (last selected style), the bibliography title and its paragraph style.
Any method in this class is NOT supposed to be moved (OR internally refactored without complete understanding - see implementation note).Implementation Note
UNO API calls are expensive, and any additional operation slows down the net "macro-task" we are trying to achieve in the document.
These "additional" operations may or may not be visible at the level of code in the form of additional function calls.
In some cases, the same macro-task may be achieved by two different orders of actions, which may look semantically the same overall, but one order may result into more UNO API calls.
For example, see the comment inside CSLCitationOOAdapter#insertCitation(XTextCursor, CitationStyle, List, BibDatabaseContext).
| Modifier and Type | Field and Description |
|---|---|
| private final BibEntryTypesManager | |
| private static final String | |
| private static final Pattern | |
| private CSLCitationType | |
| private final com. | |
| private List | |
| private CitationStyle | |
| private final com. | |
| private static final CitationStyleOutputFormat | |
| private static final Logger | |
| private final CSLReferenceMarkManager | |
| private boolean | |
| private final OpenOfficePreferences | |
| private final ChangeListener |
| Access | Constructor and Description |
|---|---|
| public | CSLCitationOOAdapter(com.
|
| Modifier and Type | Method and Description |
|---|---|
| private Map | computeBibliographyOrderedCitationNumbers(CitationStyle selectedStyle, List<BibDatabase> selectedDatabases)
|
| public void | |
| private @NonNull String | createCitationText(CitationStyle style, List<BibEntry> entries, BibDatabaseContext unifiedBibDatabaseContext)
Helper method for creating citations for |
| private @NonNull String | createInTextCitationGroupText(CitationStyle style, List<BibEntry> entries, BibDatabaseContext bibDatabaseContext)
Helper method for creating citation group for |
| private @NonNull String | createInTextCitationText(CitationStyle style, BibEntry currentEntry, BibDatabaseContext bibDatabaseContext)
Helper method for creating in-text citations for |
| public void | |
| public List | |
| private List | |
| public void | insertCitation(com.
Inserts a citation for a group of entries. |
| public void | insertEmptyCitation(com.
Inserts "empty" citations for a list of entries at the cursor to the document. |
| public void | insertInTextCitation(com.
Inserts in-text citations for a group of entries. |
| public void | insertJabRefBibliography(com.
Creates a "Bibliography" section in the document and inserts a list of references. |
| private void | insertReferences(com.
Inserts references and also adds a space before the citation if not already present ("smart space"). |
| public void | insertZoteroBibliography(com.
|
| public boolean | |
| public void | |
| public boolean | |
| private List | prepareBibliographyEntries(CitationStyle selectedStyle, List<BibEntry> entries, List<BibDatabase> selectedDatabases)
|
| public void | prepareCitationInsertion(CitationStyle newStyle, CSLCitationType newCitationType, BibDatabaseContext currentEntryContext, List<BibDatabase> selectedDatabases)
|
| public void | |
| private void | setCitationStyleParameters(CitationStyle newStyle, CSLCitationType newCitationType, List<BibDatabase> selectedDatabases)
This method is used to determine whether citation style and citation type should be updated. |
| private void | |
| private void | |
| private void | updateAllCitationsWithNewStyle(CitationStyle style, CSLCitationType citationType, List<BibDatabase> selectedDatabases)
Ideally, the methods of this class are supposed to work with |
| private void | updateNumericCitationsFromBibliographyOrder(CitationStyle selectedStyle, List<BibDatabase> selectedDatabases)
|
| private String | updateSingleOrMultipleCitationNumbers(String citation, List<BibEntry> entries)
Transforms the numbers in the citation to globally-unique (and thus, reusable) numbers. |
| private void | writeBibliographyEntries(com.
Writes bibliography entries using JabRef's standard CSL bibliography rendering. |
| bibEntryTypesManager | back to summary |
|---|---|
| private final BibEntryTypesManager bibEntryTypesManager | |
| CITATION_DELIMITER | back to summary |
|---|---|
| private static final String CITATION_DELIMITER | |
| CITATION_NUMBER_PATTERN | back to summary |
|---|---|
| private static final Pattern CITATION_NUMBER_PATTERN | |
| citationType | back to summary |
|---|---|
| private CSLCitationType citationType | |
| componentContext | back to summary |
|---|---|
| private final com. | |
| currentSelectedDatabases | back to summary |
|---|---|
| private List<BibDatabase> currentSelectedDatabases | |
| currentStyle | back to summary |
|---|---|
| private CitationStyle currentStyle | |
| document | back to summary |
|---|---|
| private final com. | |
| HTML_OUTPUT_FORMAT | back to summary |
|---|---|
| private static final CitationStyleOutputFormat HTML_OUTPUT_FORMAT | |
| LOGGER | back to summary |
|---|---|
| private static final Logger LOGGER | |
| markManager | back to summary |
|---|---|
| private final CSLReferenceMarkManager markManager | |
| needsCSLReferenceMarkConversion | back to summary |
|---|---|
| private boolean needsCSLReferenceMarkConversion | |
| openOfficePreferences | back to summary |
|---|---|
| private final OpenOfficePreferences openOfficePreferences | |
| zoteroCompatibilityModeListener | back to summary |
|---|---|
| private final ChangeListener<Boolean> zoteroCompatibilityModeListener | |
| CSLCitationOOAdapter | back to summary |
|---|---|
| public CSLCitationOOAdapter(com. | |
| computeBibliographyOrderedCitationNumbers | back to summary |
|---|---|
| private Map | |
| convertReferenceMarksToPreference | back to summary |
|---|---|
| public void convertReferenceMarksToPreference(List<BibDatabase> selectedDatabases) throws CreationException, com.sun.star.uno.Exception | |
| createCitationText | back to summary |
|---|---|
| private @NonNull String createCitationText(CitationStyle style, List<BibEntry> entries, BibDatabaseContext unifiedBibDatabaseContext) Helper method for creating citations for | |
| createInTextCitationGroupText | back to summary |
|---|---|
| private @NonNull String createInTextCitationGroupText(CitationStyle style, List<BibEntry> entries, BibDatabaseContext bibDatabaseContext) Helper method for creating citation group for | |
| createInTextCitationText | back to summary |
|---|---|
| private @NonNull String createInTextCitationText(CitationStyle style, BibEntry currentEntry, BibDatabaseContext bibDatabaseContext) Helper method for creating in-text citations for | |
| dispose | back to summary |
|---|---|
| public void dispose() | |
| getCitedCitationKeys | back to summary |
|---|---|
| public List | |
| getResolvedEntriesForMark | back to summary |
|---|---|
| private List | |
| insertCitation | back to summary |
|---|---|
| public void insertCitation(com. Inserts a citation for a group of entries. Comparable to LaTeX's \cite command. | |
| insertEmptyCitation | back to summary |
|---|---|
| public void insertEmptyCitation(com. Inserts "empty" citations for a list of entries at the cursor to the document. Adds the entries to the list for which bibliography is to be generated. | |
| insertInTextCitation | back to summary |
|---|---|
| public void insertInTextCitation(com. Inserts in-text citations for a group of entries. Comparable to LaTeX's \citet command. Implementation Note Very similar to the insertCitation method. | |
| insertJabRefBibliography | back to summary |
|---|---|
| public void insertJabRefBibliography(com. Creates a "Bibliography" section in the document and inserts a list of references. The list is generated based on the existing citations, in-text citations and empty citations in the document. | |
| insertReferences | back to summary |
|---|---|
| private void insertReferences(com. Inserts references and also adds a space before the citation if not already present ("smart space"). | |
| insertZoteroBibliography | back to summary |
|---|---|
| public void insertZoteroBibliography(com. | |
| isCitedEntry | back to summary |
|---|---|
| public boolean isCitedEntry(BibEntry entry) Checks if an entry has already been cited before in the document. Required for consistent numbering of numeric citations - if present, the number is to be reused, else a new number is to be assigned. | |
| linkZoteroCitations | back to summary |
|---|---|
| public void linkZoteroCitations(BibDatabaseContext currentEntryContext) | |
| needsReferenceMarkConversion | back to summary |
|---|---|
| public boolean needsReferenceMarkConversion() throws com.sun.star.lang.WrappedTargetException, com.sun.star.container.NoSuchElementException | |
| prepareBibliographyEntries | back to summary |
|---|---|
| private List | |
| prepareCitationInsertion | back to summary |
|---|---|
| public void prepareCitationInsertion(CitationStyle newStyle, CSLCitationType newCitationType, BibDatabaseContext currentEntryContext, List<BibDatabase> selectedDatabases) throws CreationException, com.sun.star.uno.Exception | |
| refreshCitationState | back to summary |
|---|---|
| public void refreshCitationState() throws com.sun.star.lang.WrappedTargetException, com.sun.star.container.NoSuchElementException | |
| setCitationStyleParameters | back to summary |
|---|---|
| private void setCitationStyleParameters(CitationStyle newStyle, CSLCitationType newCitationType, List<BibDatabase> selectedDatabases) throws CreationException, com.sun.star.uno.Exception This method is used to determine whether citation style and citation type should be updated. Citation type and citation style are extracted into one method for more readability and uniformity. | |
| sortBibliographyEntriesByCurrentCitationNumbers | back to summary |
|---|---|
| private void sortBibliographyEntriesByCurrentCitationNumbers(List<BibEntry> bibliographyEntries) | |
| sortBibliographyEntriesByPreferredCitationNumbers | back to summary |
|---|---|
| private void sortBibliographyEntriesByPreferredCitationNumbers(List<BibEntry> bibliographyEntries, Map<String, Integer> citationKeyToNumber) | |
| updateAllCitationsWithNewStyle | back to summary |
|---|---|
| private void updateAllCitationsWithNewStyle(CitationStyle style, CSLCitationType citationType, List<BibDatabase> selectedDatabases) throws com.sun.star.uno.Exception, CreationException Ideally, the methods of this class are supposed to work with | |
| updateNumericCitationsFromBibliographyOrder | back to summary |
|---|---|
| private void updateNumericCitationsFromBibliographyOrder(CitationStyle selectedStyle, List<BibDatabase> selectedDatabases) throws CreationException, com.sun.star.uno.Exception | |
| updateSingleOrMultipleCitationNumbers | back to summary |
|---|---|
| private String updateSingleOrMultipleCitationNumbers(String citation, List<BibEntry> entries) Transforms the numbers in the citation to globally-unique (and thus, reusable) numbers. | |
| writeBibliographyEntries | back to summary |
|---|---|
| private void writeBibliographyEntries(com. Writes bibliography entries using JabRef's standard CSL bibliography rendering. Numeric styles without a bibliography sort keep first-appearance ordering. Numeric styles with a bibliography sort are preordered to the citeproc-emitted bibliography order so in-text numbers and bibliography numbers stay aligned. For non-numeric styles, ordering is left to the citeproc item data provider. | |