TextRegion.java
4.66 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.text;
import com.adobe.xfa.text.RegionFrame;
import com.adobe.xfa.text.TextDispStr;
import com.adobe.xfa.text.TextStream;
import com.adobe.xfa.text.TraditionalFrame;
import com.adobe.xfa.ut.Rect;
import com.adobe.xfa.ut.UnitSpan;
public class TextRegion
extends TextDispStr {
public TextRegion() {
this.setTraditionalFrame(new RegionFrame());
}
public TextRegion(String sSource) {
super(sSource);
this.setTraditionalFrame(new RegionFrame());
}
public UnitSpan getMinWidth() {
return this.minWidth();
}
public void setMinWidth(UnitSpan oNewWidth) {
if (oNewWidth.equals(this.minWidth())) {
return;
}
this.getRegionFrame().setMinWidth(oNewWidth);
if (!this.enforceJustifyWidth()) {
this.updateDisplay(true);
}
}
public UnitSpan getMinHeight() {
return this.minHeight();
}
public void setMinHeight(UnitSpan oNewHeight) {
if (oNewHeight.equals(this.minHeight())) {
return;
}
this.getRegionFrame().setMinHeight(oNewHeight);
if (!this.enforceJustifyHeight()) {
this.updateDisplay(true);
}
}
public UnitSpan getMaxWidth() {
return this.maxWidth();
}
public void setMaxWidth(UnitSpan oNewWidth) {
if (oNewWidth.equals(this.maxWidth())) {
return;
}
boolean bUpdateDisplay = false;
if (oNewWidth.value() < 0) {
bUpdateDisplay = true;
} else if (!this.unlimitedWidth() && oNewWidth.gt(this.maxWidth())) {
bUpdateDisplay = true;
} else if (oNewWidth.lt(this.extent().width())) {
bUpdateDisplay = true;
}
this.getRegionFrame().setMaxWidth(oNewWidth);
if (bUpdateDisplay) {
this.updateDisplay();
}
}
public UnitSpan getMaxHeight() {
return this.maxHeight();
}
public void setMaxHeight(UnitSpan oNewHeight) {
if (oNewHeight.equals(this.maxHeight())) {
return;
}
boolean bUpdateDisplay = false;
if (oNewHeight.value() < 0) {
bUpdateDisplay = true;
} else if (!this.unlimitedHeight() && oNewHeight.gt(this.maxHeight())) {
bUpdateDisplay = true;
} else if (oNewHeight.lt(this.extent().height())) {
bUpdateDisplay = true;
}
this.getRegionFrame().setMaxHeight(oNewHeight);
if (bUpdateDisplay) {
this.updateDisplay(true);
}
}
public void setJustifyHeight(UnitSpan oJustifyHeight) {
if (this.enforceJustifyHeight() && oJustifyHeight.equals(this.justifyHeight())) {
return;
}
this.getRegionFrame().setAlignmentHeight(oJustifyHeight);
this.updateDisplay(true);
}
public void setJustifyWidth(UnitSpan oJustifyWidth) {
if (this.enforceJustifyWidth() && oJustifyWidth.equals(this.justifyWidth())) {
return;
}
this.getRegionFrame().setAlignmentWidth(oJustifyWidth);
this.updateDisplay(true);
}
public void setJustifyExtents(UnitSpan oJustifyWidth, UnitSpan oJustifyHeight) {
if (this.enforceJustifyHeight() && oJustifyHeight.equals(this.justifyHeight()) && this.enforceJustifyWidth() && oJustifyWidth.equals(this.justifyWidth())) {
return;
}
this.getRegionFrame().setAlignmentWidth(oJustifyWidth);
this.getRegionFrame().setAlignmentHeight(oJustifyHeight);
this.updateDisplay(true);
}
public boolean enforceSize() {
return this.getRegionFrame().testFitSize();
}
public void enforceSize(boolean bNewEnforce) {
this.getRegionFrame().setTestFitSize(bNewEnforce);
}
public void copyFrom(TextRegion oSource) {
if (this != oSource) {
super.copyFrom(oSource);
this.getRegionFrame().copyFrom(oSource.getRegionFrame());
}
}
@Override
public boolean equals(Object object) {
if (object == this) {
return true;
}
if (!super.equals(object)) {
return false;
}
TextRegion cmp = (TextRegion)object;
return this.getRegionFrame().equals(cmp.getRegionFrame());
}
@Override
public int hashCode() {
int hash = 61;
hash = hash * 31 ^ super.hashCode();
hash = hash * 31 ^ this.getRegionFrame().hashCode();
return hash;
}
public boolean notEqual(TextRegion oCompare) {
return !this.equals(oCompare);
}
private RegionFrame getRegionFrame() {
return (RegionFrame)this.getTraditionalFrame();
}
}