TextMarker.java
5.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.text;
import com.adobe.xfa.text.PosnMarker;
import com.adobe.xfa.text.TextAttr;
import com.adobe.xfa.text.TextPosn;
import com.adobe.xfa.text.TextPosnBase;
import com.adobe.xfa.text.TextRange;
import com.adobe.xfa.text.TextStream;
public abstract class TextMarker {
public static final int SPLIT_NONE = 0;
public static final int SPLIT_PARA = 1;
public static final int SPLIT_INSERT = 2;
public static final int SPLIT_INSERT_WRAP = 3;
public static final int SPLIT_REASON_UNKNOWN = -1;
public static final int SPLIT_REASON_FORCED = 0;
public static final int SPLIT_REASON_INSERT_EMBED = 1;
public static final int SPLIT_REASON_INSERT_FIELD = 2;
public static final int SPLIT_REASON_INSERT_PARA_BREAK = 3;
public static final int SPLIT_REASON_INSERT_TEXT_PLAIN = 4;
public static final int SPLIT_REASON_INSERT_TEXT_RICH = 5;
public static final int SPLIT_REASON_PARA_MARKER = 6;
public static final int SPLIT_REASON_WORD_WRAP = 7;
private PosnMarker mpoLocation;
private int meSplitState;
private boolean mbAutoCoalesce;
private boolean mbAutoRemove;
private boolean mbParaMarker;
public boolean isPositionMarker() {
return this.mpoLocation != null && this.mpoLocation.getMate() == null;
}
public boolean isRangeMarker() {
return this.mpoLocation != null && this.mpoLocation.getMate() != null;
}
public boolean getAutoCoalesce() {
return this.mbAutoCoalesce;
}
public boolean getAutoRemove() {
return this.mbAutoRemove;
}
public boolean isParaMarker() {
return this.mbParaMarker;
}
public int getSplitState() {
return this.meSplitState;
}
public TextPosn getPosition() {
return this.isPositionMarker() ? this.mpoLocation : null;
}
public TextRange getRange() {
return new TextRange(this.mpoLocation.stream(), this.mpoLocation.index(), this.mpoLocation.getMate().index());
}
public void remove() {
TextStream poStream = this.getStream();
if (poStream == null) {
return;
}
poStream.removeMarker(this, false);
}
public TextMarker forceSplit(int nSplitStart, int nSplitEnd, int eReason) {
if (!this.isRangeMarker()) {
return null;
}
TextStream poStream = this.getStream();
if (poStream == null) {
return null;
}
return poStream.splitMarker(this, nSplitStart, nSplitEnd, eReason);
}
public boolean forceCoalesce(TextMarker poOther) {
if (!this.canCoalesce(poOther)) {
return false;
}
return this.getStream().coalesceMarker(this, poOther);
}
public abstract TextMarker cloneMarker();
public void onAttributeChange(int nStart, int nEnd, TextAttr poAttr) {
}
public boolean onClick(TextPosnBase oPosition) {
return false;
}
public boolean onCoalesce(TextMarker oOther) {
return true;
}
public void onDeleteContent(int nStart, int nEnd) {
}
public void onRemove(boolean bEditOnly) {
}
public TextMarker onSplit(int nSplitStart, int nSplitEnd, int eReason) {
return this.cloneMarker();
}
public boolean onTruncate(int nSplitStart, int nSplitEnd, boolean bEnd, int eReason) {
return true;
}
PosnMarker getLocation() {
return this.mpoLocation;
}
void setLocation(PosnMarker poLocation) {
this.mpoLocation = poLocation;
}
boolean canCoalesce(TextMarker poOther) {
TextStream poStream = this.getStream();
return poOther != null && poStream != null && poStream == poOther.getStream() && this.meSplitState == poOther.meSplitState && this.mbAutoCoalesce == poOther.mbAutoCoalesce && this.mbAutoRemove == poOther.mbAutoRemove && this.mbParaMarker == poOther.mbParaMarker;
}
protected TextMarker() {
this.mpoLocation = null;
this.meSplitState = 0;
this.mbAutoCoalesce = true;
this.mbAutoRemove = true;
this.mbParaMarker = false;
}
protected TextMarker(boolean bAutoCoalesce, boolean bAutoRemove, boolean bParaMarker, int eSplitState) {
this.mpoLocation = null;
this.meSplitState = eSplitState;
this.mbAutoCoalesce = bAutoCoalesce;
this.mbAutoRemove = bAutoRemove;
this.mbParaMarker = bParaMarker;
}
protected TextMarker(TextMarker oSource) {
this.copyFrom(oSource);
}
protected void setAutoCoalesce(boolean bAutoCoalesce) {
this.mbAutoCoalesce = bAutoCoalesce;
}
protected void setAutoRemove(boolean bAutoRemove) {
this.mbAutoRemove = bAutoRemove;
}
protected void setParaMarker(boolean bParaMarker) {
this.mbParaMarker = bParaMarker;
}
protected void setSplitState(int eSplitState) {
this.meSplitState = eSplitState;
}
protected void copyFrom(TextMarker oSource) {
this.meSplitState = oSource.meSplitState;
this.mbAutoCoalesce = oSource.mbAutoCoalesce;
this.mbAutoRemove = oSource.mbAutoRemove;
this.mbParaMarker = oSource.mbParaMarker;
}
protected TextStream getStream() {
return this.mpoLocation == null ? null : this.mpoLocation.stream();
}
}