LayoutEnv.java
4.34 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
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.xfa.layout;
import com.adobe.xfa.Model;
import com.adobe.xfa.font.FontService;
import com.adobe.xfa.gfx.GFXDriver;
import com.adobe.xfa.gfx.GFXEnv;
import com.adobe.xfa.layout.LayoutDriver;
import com.adobe.xfa.layout.LayoutHandler;
import com.adobe.xfa.service.Service;
import com.adobe.xfa.service.href.HrefService;
import com.adobe.xfa.text.TextContext;
import com.adobe.xfa.text.TextDisplay;
import com.adobe.xfa.text.TextResolver;
import com.adobe.xfa.ut.Angle;
import com.adobe.xfa.ut.CoordPair;
import com.adobe.xfa.ut.ExFull;
import com.adobe.xfa.ut.Rect;
import com.adobe.xfa.ut.ResId;
public class LayoutEnv
extends GFXEnv {
private HrefService moHrefService;
private FontService moFontService;
private Model moModel;
private LayoutHandler moLayoutHandler;
private LayoutDriver moLayoutDriver;
private TextResolver moTextResolver;
private TextContext moTextContext;
public LayoutEnv() {
this(null, null, null, new LayoutDriver());
}
protected LayoutEnv(LayoutEnv oSource) {
}
public LayoutEnv(FontService oFontService, Service oImageService, HrefService oHrefService, LayoutDriver oDriver) {
this.moLayoutDriver = oDriver;
this.moHrefService = oHrefService;
this.moFontService = oFontService;
this.moLayoutHandler = null;
this.moTextResolver = null;
this.moTextContext = null;
this.moTextContext = new TextContext();
assert (null != oDriver);
this.fontService(this.moFontService);
this.moLayoutDriver.setLayoutEnv(this);
}
public void layoutHandler(LayoutHandler pHandler) {
this.moLayoutHandler = pHandler;
}
public LayoutHandler layoutHandler() {
return this.moLayoutHandler;
}
public HrefService getHrefService() {
return this.moHrefService;
}
public void setFontService(FontService oFontService) {
this.moFontService = oFontService;
this.fontService(oFontService);
}
public FontService getFontService() {
return this.moFontService;
}
public LayoutDriver setDriver(LayoutDriver oDriver) {
LayoutDriver oOldDriver = this.moLayoutDriver;
this.moLayoutDriver = oDriver;
return oOldDriver;
}
public TextContext getTextContext() {
return this.moTextContext;
}
public void setModel(Model oModel) {
this.moModel = oModel;
}
public Model getModel() {
return this.moModel;
}
public void setTextResolver(TextResolver pResolver) {
assert (null != pResolver);
this.moTextResolver = pResolver;
}
public TextResolver getTextResolver() {
return this.moTextResolver;
}
public LayoutDriver getLayoutDriver() {
return this.moLayoutDriver;
}
public int getMetaFileData(byte[] pClipData, int size, Rect oDrawArea) {
throw new ExFull(ResId.UNSUPPORTED_OPERATION, "LayoutEnv#getMetaFileData");
}
public void setClipRect(Rect oRect) {
this.moLayoutDriver.setClipRect(oRect);
}
public boolean renderText(LayoutHandler oLayoutHandler, TextDisplay oDisplay, CoordPair oOffset, boolean bWrap, boolean bTruncate, Rect oInvalidatedRect) {
return this.renderText(oLayoutHandler, oDisplay, oOffset, bWrap, bTruncate, Angle.ZERO, oInvalidatedRect);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
public boolean renderText(LayoutHandler oLayoutHandler, TextDisplay oDisplay, CoordPair oOffset, boolean bWrap, boolean bTruncate, Angle oAngle, Rect oInvalidatedRect) {
boolean bTextFits = false;
if (oDisplay == null || null == this.moLayoutDriver) {
return bTextFits;
}
this.moLayoutHandler = oLayoutHandler;
GFXDriver oDriver = this.driverAttach();
assert (oDriver == this.moLayoutDriver);
LayoutEnv oEnv = this;
try {
this.moLayoutDriver.pushOffset(true, oOffset);
this.moLayoutDriver.pushAngle(true, oAngle, false, oOffset);
this.moLayoutHandler = null;
}
finally {
oEnv.driverDetach();
oDriver.popOffset();
oDriver.popAngle();
}
return bTextFits;
}
@Override
protected GFXDriver driver() {
return this.moLayoutDriver;
}
}