-
public final class TextSelectionManagerManages text selection state and logic for PDF pages. This class handles character-level selection, word/paragraph expansion, and provides the selected text and bounding rectangles.
-
-
Field Summary
Fields Modifier and Type Field Description private BooleanisSelectingprivate IntegerselectionPageprivate IntegerstartCharIndexprivate IntegerendCharIndexprivate final List<RectF>selectionRectsprivate final StringselectedText
-
Constructor Summary
Constructors Constructor Description TextSelectionManager(PdfFile pdfFile)
-
Method Summary
Modifier and Type Method Description final BooleangetIsSelecting()final UnitsetIsSelecting(Boolean isSelecting)final IntegergetSelectionPage()final UnitsetSelectionPage(Integer selectionPage)final IntegergetStartCharIndex()final UnitsetStartCharIndex(Integer startCharIndex)final IntegergetEndCharIndex()final UnitsetEndCharIndex(Integer endCharIndex)final List<RectF>getSelectionRects()final StringgetSelectedText()final BooleanstartSelectionAt(Integer page, Float pdfX, Float pdfY)Start selection at a specific point. final UnitselectWordAt(Integer page, Integer charIndex)Select the word containing the given character index. final UnitupdateSelectionTo(Float pdfX, Float pdfY)Expand or contract selection to a new end point. final UnitupdateStartHandle(Float pdfX, Float pdfY)Update selection by moving the start handle. final UnitupdateEndHandle(Float pdfX, Float pdfY)Update selection by moving the end handle. final UnitselectAll(Integer page)Select all text on the current page. final UnitclearSelection()Clear the current selection. final BooleanhasSelection()Check if there is an active selection. final Pair<PointF, PointF>getHandlePositions()Get the positions for start and end handles (in PDF coordinates). -
-
Constructor Detail
-
TextSelectionManager
TextSelectionManager(PdfFile pdfFile)
-
-
Method Detail
-
getIsSelecting
final Boolean getIsSelecting()
-
setIsSelecting
final Unit setIsSelecting(Boolean isSelecting)
-
getSelectionPage
final Integer getSelectionPage()
-
setSelectionPage
final Unit setSelectionPage(Integer selectionPage)
-
getStartCharIndex
final Integer getStartCharIndex()
-
setStartCharIndex
final Unit setStartCharIndex(Integer startCharIndex)
-
getEndCharIndex
final Integer getEndCharIndex()
-
setEndCharIndex
final Unit setEndCharIndex(Integer endCharIndex)
-
getSelectionRects
final List<RectF> getSelectionRects()
-
getSelectedText
final String getSelectedText()
-
startSelectionAt
final Boolean startSelectionAt(Integer page, Float pdfX, Float pdfY)
Start selection at a specific point. Finds the character at the point and selects the word containing it.
-
selectWordAt
final Unit selectWordAt(Integer page, Integer charIndex)
Select the word containing the given character index.
-
updateSelectionTo
final Unit updateSelectionTo(Float pdfX, Float pdfY)
Expand or contract selection to a new end point.
-
updateStartHandle
final Unit updateStartHandle(Float pdfX, Float pdfY)
Update selection by moving the start handle.
-
updateEndHandle
final Unit updateEndHandle(Float pdfX, Float pdfY)
Update selection by moving the end handle.
-
clearSelection
final Unit clearSelection()
Clear the current selection.
-
hasSelection
final Boolean hasSelection()
Check if there is an active selection.
-
getHandlePositions
final Pair<PointF, PointF> getHandlePositions()
Get the positions for start and end handles (in PDF coordinates). Returns Pair(startPoint, endPoint) or null if no selection.
-
-
-
-