FrameCaretPosn.java
1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.text;
import com.adobe.xfa.text.ABXY;
import com.adobe.xfa.text.DispLineWrapped;
import com.adobe.xfa.text.FrameCaret;
import com.adobe.xfa.text.TextFrame;
import com.adobe.xfa.text.TextPosnBase;
import com.adobe.xfa.text.TextSparseStream;
import com.adobe.xfa.text.TextStream;
import com.adobe.xfa.ut.CoordPair;
import com.adobe.xfa.ut.UnitSpan;
class FrameCaretPosn
extends FrameCaret {
private TextStream mpoSearchStream;
private CoordPair moSearchPoint;
private boolean mbAllowDescendents;
private TextPosnBase mpoResult;
FrameCaretPosn(TextSparseStream poStream, TextStream poSearchStream, CoordPair oSearchPoint, boolean bAllowDescendents, TextPosnBase poResult) {
super(poStream, 0);
this.mpoSearchStream = poSearchStream;
this.moSearchPoint = oSearchPoint;
this.mbAllowDescendents = bAllowDescendents;
this.mpoResult = poResult;
}
@Override
protected int processCaretLine(DispLineWrapped poLine) {
TextFrame poFrame = this.getFrame();
int nCurrentFrame = this.getFrameIndex();
int nCurrentLine = this.getLineIndex();
CoordPair oSearch = new CoordPair(this.moSearchPoint.x(), this.moSearchPoint.y().subtract(this.getOffset()));
oSearch = ABXY.toAB(poLine.getXYOrigin(), oSearch, poFrame.getLayoutOrientation());
if ((nCurrentFrame > 0 || nCurrentLine > 0) && oSearch.y().value() < 0) {
return 0;
}
if ((nCurrentFrame + 1 < poFrame.getStream().getFrameCount() || nCurrentLine + 1 < poFrame.getLineCount()) && oSearch.y().gt(poLine.getBExtent())) {
return 0;
}
return poLine.getCaretPosn(this.mpoSearchStream, oSearch.x(), this.mpoResult, this.mbAllowDescendents);
}
}