Top Description Inners Fields Constructors Methods
org.jabref.model.openoffice.rangesort

public Class RangeSortVisual

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List, org.jabref.model.openoffice.uno.UnoScreenRefresh, com.sun.star.awt.Point, com.sun.star.text.XTextDocument, com.sun.star.text.XTextRange, com.sun.star.text.XTextViewCursor, org.slf4j.Logger, .LoggerFactory

Sort XTextRange values visually (top-down,left-to-right).

Requires functional XTextViewCursor.

Problem: for multicolumn layout and when viewing pages side-by-side in LO, the (top-down,left-to-right) order interpreted as-on-the-screen: an XTextRange at the top of the second column or second page is sorted before an XTextRange at the bottom of the first column of the first page.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
RangeSortVisual.ComparableMark<T>

A reference mark name paired with its visual position.

Field Summary

Modifier and TypeField and Description
private static final Logger

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static <T> int
private static com.sun.star.awt.Point
findPositionOfTextRange(com.sun.star.text.XTextRange
Location.
range
,
com.sun.star.text.XTextViewCursor
To get the position, we need az XTextViewCursor. It will be moved to the range.
cursor
)

Given a location, return its position: coordinates relative to the top left position of the first page of the document.

public static <T> List<RangeSortable<T>>

Returns:

The input, sorted by the elements XTextRange and getIndexInPosition.
visualSort
(List<RangeSortable<T>> inputs, com.sun.star.text.XTextDocument doc, FunctionalTextViewCursor fcursor)

Sort the input inputs visually.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final Logger LOGGER

Constructor Detail

RangeSortVisualback to summary
private RangeSortVisual()

Method Detail

compareTopToBottomLeftToRightback to summary
private static <T> int compareTopToBottomLeftToRight(RangeSortVisual.ComparableMark<T> a, RangeSortVisual.ComparableMark<T> b)
findPositionOfTextRangeback to summary
private static com.sun.star.awt.Point findPositionOfTextRange(com.sun.star.text.XTextRange range, com.sun.star.text.XTextViewCursor cursor)

Given a location, return its position: coordinates relative to the top left position of the first page of the document.

Note

for text layouts with two or more columns, this gives the wrong order: top-down/left-to-right does not match reading order.

Note

The "relative to the top left position of the first page" is meant "as it appears on the screen".

In particular: when viewing pages side-by-side, the top half of the right page is higher than the lower half of the left page. Again, top-down/left-to-right does not match reading order.

Parameters
range:com.sun.star.text.XTextRange

Location.

cursor:com.sun.star.text.XTextViewCursor

To get the position, we need az XTextViewCursor. It will be moved to the range.

visualSortback to summary
public static <T> List<RangeSortable<T>> visualSort(List<RangeSortable<T>> inputs, com.sun.star.text.XTextDocument doc, FunctionalTextViewCursor fcursor)

Sort the input inputs visually.

Requires a functional XTextViewCursor.

Returns:List<RangeSortable<T>>

The input, sorted by the elements XTextRange and getIndexInPosition.

org.jabref.model.openoffice.rangesort back to summary

private Class RangeSortVisual.ComparableMark<T>

extends Object
Class Inheritance
  • java.lang.Object
  • org.jabref.model.openoffice.rangesort.RangeSortVisual.ComparableMark

A reference mark name paired with its visual position.

Comparison is based on (Y,X,indexInPosition): vertical compared first, horizontal second, indexInPosition third.

Used for sorting reference marks by their visual positions.

Field Summary

Modifier and TypeField and Description
private final T
private final int
private final com.sun.star.awt.Point

Constructor Summary

AccessConstructor and Description
public
ComparableMark(com.sun.star.awt.Point position, int indexInPosition, T content)

Method Summary

Modifier and TypeMethod and Description
public T
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

contentback to summary
private final T content
indexInPositionback to summary
private final int indexInPosition
positionback to summary
private final com.sun.star.awt.Point position

Constructor Detail

ComparableMarkback to summary
public ComparableMark(com.sun.star.awt.Point position, int indexInPosition, T content)

Method Detail

getContentback to summary
public T getContent()