MarkedContentOperands.java
4.93 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException
* com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException
* com.adobe.internal.pdftoolkit.core.types.ASArray
* com.adobe.internal.pdftoolkit.core.types.ASDictionary
* com.adobe.internal.pdftoolkit.core.types.ASName
* com.adobe.internal.pdftoolkit.core.types.ASNumber
* com.adobe.internal.pdftoolkit.core.types.ASObject
* com.adobe.internal.pdftoolkit.core.types.ASString
*/
package com.adobe.internal.pdftoolkit.pdf.content;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFIOException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFInvalidDocumentException;
import com.adobe.internal.pdftoolkit.core.exceptions.PDFSecurityException;
import com.adobe.internal.pdftoolkit.core.types.ASArray;
import com.adobe.internal.pdftoolkit.core.types.ASDictionary;
import com.adobe.internal.pdftoolkit.core.types.ASName;
import com.adobe.internal.pdftoolkit.core.types.ASNumber;
import com.adobe.internal.pdftoolkit.core.types.ASObject;
import com.adobe.internal.pdftoolkit.core.types.ASString;
import com.adobe.internal.pdftoolkit.pdf.content.Instruction;
import com.adobe.internal.pdftoolkit.pdf.content.InstructionFactory;
import com.adobe.internal.pdftoolkit.pdf.graphics.PDFRectangle;
import com.adobe.internal.pdftoolkit.pdf.interchange.structure.PDFStructureArtifact;
import com.adobe.internal.pdftoolkit.pdf.interchange.structure.PDFStructureElement;
public class MarkedContentOperands {
public static final ASName k_Artifact = ASName.create((String)"Artifact");
public static final ASName k_Attached = ASName.create((String)"Attached");
private PDFStructureElement mElement;
private int mMCID;
private PDFStructureArtifact mArtifact;
private ASName mTag;
private ASDictionary mParams = null;
public MarkedContentOperands(PDFStructureElement element, int mcid) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
this.mElement = element;
this.mMCID = mcid;
this.mArtifact = null;
this.mTag = element.requireStructureType();
this.mParams = new ASDictionary();
this.mParams.put(ASName.k_MCID, (ASObject)new ASNumber(mcid));
}
public MarkedContentOperands(PDFStructureArtifact artifact) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
ASString[] batesNumber;
PDFRectangle bBox;
ASName[] position;
ASName subtype;
this.mArtifact = artifact;
this.mElement = null;
this.mMCID = -1;
this.mTag = k_Artifact;
this.mParams = new ASDictionary();
ASName type = artifact.getType();
this.mParams.put(ASName.k_Type, (ASObject)type);
if (type.equals((Object)PDFStructureArtifact.k_Pagination) && (subtype = artifact.getSubtype()) != null) {
this.mParams.put(ASName.k_Subtype, (ASObject)subtype);
}
if ((bBox = artifact.getBBox()) != null) {
ASArray location = new ASArray();
location.add((ASObject)new ASNumber(bBox.left()));
location.add((ASObject)new ASNumber(bBox.bottom()));
location.add((ASObject)new ASNumber(bBox.right()));
location.add((ASObject)new ASNumber(bBox.top()));
this.mParams.put(ASName.k_BBox, (ASObject)location);
}
if ((position = artifact.getPosition()) != null) {
ASArray posArray = new ASArray();
for (int posInd = 0; posInd < position.length; ++posInd) {
posArray.add((ASObject)position[posInd]);
}
this.mParams.put(k_Attached, (ASObject)posArray);
}
if ((batesNumber = artifact.getContents()) != null && batesNumber.length > 0) {
if (batesNumber.length == 1) {
this.mParams.put(ASName.k_Contents, (ASObject)batesNumber[0]);
} else {
ASArray batesArray = new ASArray();
for (int iBates = 0; iBates < batesNumber.length; ++iBates) {
if (batesNumber == null) continue;
batesArray.add((ASObject)batesNumber[iBates]);
}
this.mParams.put(ASName.k_Contents, (ASObject)batesArray);
}
}
}
public PDFStructureArtifact getArtifact() {
return this.mArtifact;
}
public ASName getTag() {
return this.mTag;
}
public ASDictionary getParameters() {
return this.mParams;
}
public PDFStructureElement getElement() {
return this.mElement;
}
public int getMCID() {
return this.mMCID;
}
public Instruction startMarkedContent() {
return this.mParams == null ? InstructionFactory.newBeginMarkedContent(this.getTag()) : InstructionFactory.newBeginMarkedContent(this.getTag(), this.getParameters());
}
}