FrameCaretRect.java
2.25 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.text;
import com.adobe.xfa.text.DispLineWrapped;
import com.adobe.xfa.text.FrameCaret;
import com.adobe.xfa.text.TextFrame;
import com.adobe.xfa.text.TextNullFrame;
import com.adobe.xfa.text.TextPosn;
import com.adobe.xfa.text.TextPosnBase;
import com.adobe.xfa.text.TextSparseStream;
import com.adobe.xfa.ut.Rect;
class FrameCaretRect
extends FrameCaret {
private final TextPosnBase moPosition;
private final boolean mbAllowDangling;
private final boolean mbAB;
private final DispLineWrapped.CaretInfo mCaretInfo = new DispLineWrapped.CaretInfo();
private Rect mCaret;
FrameCaretRect(TextSparseStream poStream, TextPosnBase oPosition, boolean bAllowDangling, boolean bAB) {
super(poStream, 1);
this.moPosition = new TextPosnBase(oPosition);
this.mbAllowDangling = bAllowDangling;
this.mbAB = bAB;
this.moPosition.position(1);
}
Rect getCaret() {
return this.mCaret;
}
TextPosnBase getPosition() {
return this.moPosition;
}
@Override
protected boolean processOneFrame(TextFrame poFrame) {
if (poFrame == null) {
if (this.getStream().isAutoLoadSuppressed()) {
return true;
}
int nFrameIndex = this.getFrameIndex();
poFrame = this.getStream().getFrame(nFrameIndex, true);
assert (poFrame != null);
assert (poFrame.isNullFrame() != null);
if (!this.moPosition.isSamePosition(poFrame.getStart())) {
if (nFrameIndex + 1 != this.getStream().getFrameCount()) {
return true;
}
this.moPosition.position(0);
}
poFrame = this.getStream().forceFrame(nFrameIndex);
this.setFrame(poFrame);
}
return super.processOneFrame(poFrame);
}
@Override
protected int processCaretLine(DispLineWrapped poLine) {
int eCaret = poLine.getCaretRect(this.moPosition, this.mbAB, this.mCaretInfo);
if (eCaret != 0) {
this.mCaret = this.mCaretInfo.mCaret;
if (this.mbAllowDangling && eCaret == 1) {
eCaret = 2;
}
}
return eCaret;
}
}