Top Description Fields Constructors Methods
org.jabref.logic.openoffice.backend

public Class Backend52

extends Object
Class Inheritance
Imports
java.util.ArrayList, .HashMap, .HashSet, .List, .Map, .Objects, .Optional, .Set, java.util.stream.Collectors, org.jabref.model.openoffice.CitationEntry, org.jabref.model.openoffice.backend.NamedRange, .NamedRangeManager, org.jabref.model.openoffice.ootext.OOText, org.jabref.model.openoffice.style.Citation, .CitationGroup, .CitationGroupId, .CitationGroups, .CitationType, .OODataModel, .PageInfo, org.jabref.model.openoffice.uno.CreationException, .NoDocumentException, .UnoUserDefinedProperty, org.jabref.model.openoffice.util.OOListUtil, com.sun.star.beans.IllegalTypeException, com.sun.star.beans.NotRemoveableException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.WrappedTargetException, com.sun.star.text.XTextCursor, com.sun.star.text.XTextDocument, com.sun.star.text.XTextRange, org.slf4j.Logger, .LoggerFactory

Backend52, Codec52 and OODataModel.JabRef52 refer to the mode of storage, encoding and what-is-stored in the document under JabRef version 5.2. These basically did not change up to JabRef 5.4.

Field Summary

Modifier and TypeField and Description
private final Map<CitationGroupId, NamedRange>
private final NamedRangeManager
public final OODataModel
private static final Logger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
applyCitationEntries(com.sun.star.text.XTextDocument doc, List<CitationEntry> citationEntries)

Only applies to storage.

public void
cleanFillCursorForCitationGroup(CitationGroup group, com.sun.star.text.XTextDocument doc)

To be called after getFillCursorForCitationGroup

public List<Optional<OOText>>
public static List<Optional<OOText>>

Returns:

A list with a nullable pageInfo entry for each citation in joinableGroups.

Todo

JabRef52 combinePageInfos is not reversible. Should warn user to check the result. Or ask what to do.

combinePageInfosCommon
(OODataModel dataModel, List<CitationGroup> joinableGroup)

public CitationGroup
createCitationGroup(com.sun.star.text.XTextDocument doc, List<String>
Keys to be cited.
citationKeys
,
List<Optional<OOText>>
An optional pageInfo for each citation key. Backend52 only uses and stores the last pageInfo, all others should be Optional.empty()
pageInfos
,
CitationType citationType, com.sun.star.text.XTextCursor
Collapsed to its end.
position
,
boolean
We insert a space after the mark, that carries on format of characters from the original position.
insertSpaceAfter
)

Create a reference mark at the end of position in the document.

private List<String>
findUnusedJabrefPropertyNames(com.sun.star.text.XTextDocument doc, List<String>
These are the names that are used.
citationGroupNames
)

Names of custom properties belonging to us, but without a corresponding reference mark.

public List<CitationEntry>
getCitationEntries(com.sun.star.text.XTextDocument doc, CitationGroups citationGroups)

public com.sun.star.text.XTextCursor
getFillCursorForCitationGroup(CitationGroup group, com.sun.star.text.XTextDocument doc)

Must be followed by call to cleanFillCursorForCitationGroup

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

Get reference mark names from the document matching the pattern used for JabRef reference mark names.

public Optional<com.sun.star.text.XTextRange>

Returns:

Optional.empty if the reference mark is missing.
getMarkRange
(CitationGroup group, com.sun.star.text.XTextDocument doc)

private NamedRange
private static Optional<OOText>
public Optional<com.sun.star.text.XTextCursor>
getRawCursorForCitationGroup(CitationGroup group, com.sun.star.text.XTextDocument doc)

Cursor for the reference marks as is: not prepared for filling, but does not need cleanFillCursorForCitationGroup either.

public Optional<String>

Returns:

Optional.empty if all is OK, message text otherwise.
healthReport
(com.sun.star.text.XTextDocument doc)

public CitationGroup
readCitationGroupFromDocumentOrThrow(com.sun.star.text.XTextDocument doc, String
Reference mark name
markName
)

public void
removeCitationGroup(CitationGroup group, com.sun.star.text.XTextDocument doc)

private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cgidToNamedRangeback to summary
private final Map<CitationGroupId, NamedRange> cgidToNamedRange
citationStorageManagerback to summary
private final NamedRangeManager citationStorageManager
dataModelback to summary
public final OODataModel dataModel
LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

Backend52back to summary
public Backend52()

Method Detail

applyCitationEntriesback to summary
public void applyCitationEntries(com.sun.star.text.XTextDocument doc, List<CitationEntry> citationEntries) throws com.sun.star.beans.PropertyVetoException, com.sun.star.beans.IllegalTypeException, IllegalArgumentException, com.sun.star.lang.WrappedTargetException

Only applies to storage. Citation markers are not changed.

cleanFillCursorForCitationGroupback to summary
public void cleanFillCursorForCitationGroup(CitationGroup group, com.sun.star.text.XTextDocument doc) throws NoDocumentException, com.sun.star.lang.WrappedTargetException

To be called after getFillCursorForCitationGroup

combinePageInfosback to summary
public List<Optional<OOText>> combinePageInfos(List<CitationGroup> joinableGroup)
combinePageInfosCommonback to summary
public static List<Optional<OOText>> combinePageInfosCommon(OODataModel dataModel, List<CitationGroup> joinableGroup)
Returns:List<Optional<OOText>>

A list with a nullable pageInfo entry for each citation in joinableGroups.

Todo

JabRef52 combinePageInfos is not reversible. Should warn user to check the result. Or ask what to do.

createCitationGroupback to summary
public CitationGroup createCitationGroup(com.sun.star.text.XTextDocument doc, List<String> citationKeys, List<Optional<OOText>> pageInfos, CitationType citationType, com.sun.star.text.XTextCursor position, boolean insertSpaceAfter) throws CreationException, NoDocumentException, com.sun.star.lang.WrappedTargetException, com.sun.star.beans.NotRemoveableException, com.sun.star.beans.PropertyVetoException, com.sun.star.beans.IllegalTypeException

Create a reference mark at the end of position in the document.

On return position is collapsed, and is after the inserted space, or at the end of the reference mark.

Parameters
citationKeys:List<String>

Keys to be cited.

pageInfos:List<Optional<OOText>>

An optional pageInfo for each citation key. Backend52 only uses and stores the last pageInfo, all others should be Optional.empty()

position:com.sun.star.text.XTextCursor

Collapsed to its end.

insertSpaceAfter:boolean

We insert a space after the mark, that carries on format of characters from the original position.

findUnusedJabrefPropertyNamesback to summary
private List<String> findUnusedJabrefPropertyNames(com.sun.star.text.XTextDocument doc, List<String> citationGroupNames)

Names of custom properties belonging to us, but without a corresponding reference mark. These can be deleted.

Parameters
citationGroupNames:List<String>

These are the names that are used.

getCitationEntriesback to summary
public List<CitationEntry> getCitationEntries(com.sun.star.text.XTextDocument doc, CitationGroups citationGroups) throws com.sun.star.lang.WrappedTargetException, NoDocumentException
getFillCursorForCitationGroupback to summary
public com.sun.star.text.XTextCursor getFillCursorForCitationGroup(CitationGroup group, com.sun.star.text.XTextDocument doc) throws NoDocumentException, com.sun.star.lang.WrappedTargetException, CreationException

Must be followed by call to cleanFillCursorForCitationGroup

getJabRefReferenceMarkNamesback to summary
public List<String> getJabRefReferenceMarkNames(com.sun.star.text.XTextDocument doc) throws NoDocumentException

Get reference mark names from the document matching the pattern used for JabRef reference mark names.

Note

the names returned are in arbitrary order.

getMarkRangeback to summary
public Optional<com.sun.star.text.XTextRange> getMarkRange(CitationGroup group, com.sun.star.text.XTextDocument doc) throws NoDocumentException, com.sun.star.lang.WrappedTargetException
Returns:Optional<com.sun.star.text.XTextRange>

Optional.empty if the reference mark is missing.

getNamedRangeOrThrowback to summary
private NamedRange getNamedRangeOrThrow(CitationGroup group)
getPageInfoFromDataback to summary
private static Optional<OOText> getPageInfoFromData(CitationGroup group)
getRawCursorForCitationGroupback to summary
public Optional<com.sun.star.text.XTextCursor> getRawCursorForCitationGroup(CitationGroup group, com.sun.star.text.XTextDocument doc) throws NoDocumentException, com.sun.star.lang.WrappedTargetException

Cursor for the reference marks as is: not prepared for filling, but does not need cleanFillCursorForCitationGroup either.

healthReportback to summary
public Optional<String> healthReport(com.sun.star.text.XTextDocument doc) throws NoDocumentException
Returns:Optional<String>

Optional.empty if all is OK, message text otherwise.

readCitationGroupFromDocumentOrThrowback to summary
public CitationGroup readCitationGroupFromDocumentOrThrow(com.sun.star.text.XTextDocument doc, String markName) throws com.sun.star.lang.WrappedTargetException, NoDocumentException
Parameters
markName:String

Reference mark name

removeCitationGroupback to summary
public void removeCitationGroup(CitationGroup group, com.sun.star.text.XTextDocument doc) throws com.sun.star.lang.WrappedTargetException, NoDocumentException, com.sun.star.beans.NotRemoveableException
setPageInfoInDataInitialback to summary
private static void setPageInfoInDataInitial(List<Citation> citations, Optional<OOText> pageInfo)