PDFActionFactory.java
5.83 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
/*
* Decompiled with CFR 0_118.
*
* Could not load the following classes:
* com.adobe.internal.pdftoolkit.core.cos.CosDictionary
* com.adobe.internal.pdftoolkit.core.cos.CosObject
* 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.ASName
*/
package com.adobe.internal.pdftoolkit.pdf.interactive.action;
import com.adobe.internal.pdftoolkit.core.cos.CosDictionary;
import com.adobe.internal.pdftoolkit.core.cos.CosObject;
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.ASName;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFAction;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionFormImportData;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionFormReset;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionFormSubmit;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionGoTo;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionGoTo3DView;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionGoToEmbedded;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionGoToRemote;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionHide;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionJavaScript;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionLaunch;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionMovie;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionNamed;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionNoOp;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionRendition;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionSetOCGState;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionSetState;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionSound;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionThread;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionTransition;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionURI;
import com.adobe.internal.pdftoolkit.pdf.interactive.action.PDFActionUnknown;
public class PDFActionFactory {
public static PDFAction getInstance(CosObject cosObject) throws PDFInvalidDocumentException, PDFIOException, PDFSecurityException {
if (cosObject == null) {
return null;
}
if (cosObject.getType() == 0) {
return null;
}
if (!(cosObject instanceof CosDictionary)) {
throw new PDFInvalidDocumentException("cosObject is not an itnstance of CosDictionary which was expected. Object Number =" + cosObject.getObjNum());
}
CosDictionary cosDict = (CosDictionary)cosObject;
if (cosDict.containsKey((Object)ASName.k_S)) {
ASName subtype = cosDict.getName(ASName.k_S);
if (subtype == ASName.k_GoTo) {
return PDFActionGoTo.getInstance(cosObject);
}
if (subtype == ASName.k_GoToE) {
return PDFActionGoToEmbedded.getInstance(cosObject);
}
if (subtype == ASName.k_GoToR) {
return PDFActionGoToRemote.getInstance(cosObject);
}
if (subtype == ASName.k_Launch) {
return PDFActionLaunch.getInstance(cosObject);
}
if (subtype == ASName.k_Thread) {
return PDFActionThread.getInstance(cosObject);
}
if (subtype == ASName.k_URI) {
return PDFActionURI.getInstance(cosObject);
}
if (subtype == ASName.k_Sound) {
return PDFActionSound.getInstance(cosObject);
}
if (subtype == ASName.k_Movie) {
return PDFActionMovie.getInstance(cosObject);
}
if (subtype == ASName.k_Hide) {
return PDFActionHide.getInstance(cosObject);
}
if (subtype == ASName.k_Named) {
return PDFActionNamed.getInstance(cosObject);
}
if (subtype == ASName.k_SetOCGState) {
return PDFActionSetOCGState.getInstance(cosObject);
}
if (subtype == ASName.k_Rendition) {
return PDFActionRendition.getInstance(cosObject);
}
if (subtype == ASName.k_Trans) {
return PDFActionTransition.getInstance(cosObject);
}
if (subtype == ASName.k_GoTo3DView) {
return PDFActionGoTo3DView.getInstance(cosObject);
}
if (subtype == ASName.create((String)"set-state")) {
return PDFActionSetState.getInstance(cosObject);
}
if (subtype == ASName.create((String)"no-op")) {
return PDFActionNoOp.getInstance(cosObject);
}
if (subtype == ASName.k_SubmitForm) {
return PDFActionFormSubmit.getInstance(cosObject);
}
if (subtype == ASName.k_ResetForm) {
return PDFActionFormReset.getInstance(cosObject);
}
if (subtype == ASName.k_ImportData) {
return PDFActionFormImportData.getInstance(cosObject);
}
if (subtype == ASName.k_JavaScript) {
return PDFActionJavaScript.getInstance(cosObject);
}
}
return PDFActionUnknown.getInstance(cosObject);
}
}