OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2013 Google Inc. | |
3 | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #include "SkPdfCatalogDictionary_autogen.h" | |
9 #include "SkPdfNativeDoc.h" | |
10 | |
11 SkString SkPdfCatalogDictionary::Type(SkPdfNativeDoc* doc) { | |
12 SkPdfNativeObject* ret = get("Type", ""); | |
13 if (doc) {ret = doc->resolveReference(ret);} | |
14 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isRe
ference())) return ret->nameValue2(); | |
15 // TODO(edisonn): warn about missing required field, assert for known good pdf
s | |
16 return SkString(); | |
17 } | |
18 | |
19 bool SkPdfCatalogDictionary::has_Type() const { | |
20 return get("Type", "") != NULL; | |
21 } | |
22 | |
23 SkString SkPdfCatalogDictionary::Version(SkPdfNativeDoc* doc) { | |
24 SkPdfNativeObject* ret = get("Version", ""); | |
25 if (doc) {ret = doc->resolveReference(ret);} | |
26 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isRe
ference())) return ret->nameValue2(); | |
27 // TODO(edisonn): warn about missing default value for optional fields | |
28 return SkString(); | |
29 } | |
30 | |
31 bool SkPdfCatalogDictionary::has_Version() const { | |
32 return get("Version", "") != NULL; | |
33 } | |
34 | |
35 SkPdfPageTreeNodeDictionary* SkPdfCatalogDictionary::Pages(SkPdfNativeDoc* doc)
{ | |
36 SkPdfNativeObject* ret = get("Pages", ""); | |
37 if (doc) {ret = doc->resolveReference(ret);} | |
38 if ((ret != NULL && ret->isDictionary() && ((SkPdfPageTreeNodeDictionary*)ret)
->valid()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfP
ageTreeNodeDictionary*)ret; | |
39 // TODO(edisonn): warn about missing default value for optional fields | |
40 return NULL; | |
41 } | |
42 | |
43 bool SkPdfCatalogDictionary::has_Pages() const { | |
44 return get("Pages", "") != NULL; | |
45 } | |
46 | |
47 bool SkPdfCatalogDictionary::isPageLabelsANumber(SkPdfNativeDoc* doc) { | |
48 SkPdfNativeObject* ret = get("PageLabels", ""); | |
49 if (doc) {ret = doc->resolveReference(ret);} | |
50 return ret != NULL && ret->isNumber(); | |
51 } | |
52 | |
53 double SkPdfCatalogDictionary::getPageLabelsAsNumber(SkPdfNativeDoc* doc) { | |
54 SkPdfNativeObject* ret = get("PageLabels", ""); | |
55 if (doc) {ret = doc->resolveReference(ret);} | |
56 if ((ret != NULL && ret->isNumber()) || (doc == NULL && ret != NULL && ret->is
Reference())) return ret->numberValue(); | |
57 // TODO(edisonn): warn about missing default value for optional fields | |
58 return 0; | |
59 } | |
60 | |
61 bool SkPdfCatalogDictionary::isPageLabelsATree(SkPdfNativeDoc* doc) { | |
62 SkPdfNativeObject* ret = get("PageLabels", ""); | |
63 if (doc) {ret = doc->resolveReference(ret);} | |
64 return ret != NULL && false; | |
65 } | |
66 | |
67 SkPdfTree SkPdfCatalogDictionary::getPageLabelsAsTree(SkPdfNativeDoc* doc) { | |
68 SkPdfNativeObject* ret = get("PageLabels", ""); | |
69 if (doc) {ret = doc->resolveReference(ret);} | |
70 if ((ret != NULL && false) || (doc == NULL && ret != NULL && ret->isReference(
))) return ret->treeValue(); | |
71 // TODO(edisonn): warn about missing default value for optional fields | |
72 return SkPdfTree(); | |
73 } | |
74 | |
75 bool SkPdfCatalogDictionary::has_PageLabels() const { | |
76 return get("PageLabels", "") != NULL; | |
77 } | |
78 | |
79 SkPdfDictionary* SkPdfCatalogDictionary::Names(SkPdfNativeDoc* doc) { | |
80 SkPdfNativeObject* ret = get("Names", ""); | |
81 if (doc) {ret = doc->resolveReference(ret);} | |
82 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
83 // TODO(edisonn): warn about missing default value for optional fields | |
84 return NULL; | |
85 } | |
86 | |
87 bool SkPdfCatalogDictionary::has_Names() const { | |
88 return get("Names", "") != NULL; | |
89 } | |
90 | |
91 SkPdfDictionary* SkPdfCatalogDictionary::Dests(SkPdfNativeDoc* doc) { | |
92 SkPdfNativeObject* ret = get("Dests", ""); | |
93 if (doc) {ret = doc->resolveReference(ret);} | |
94 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
95 // TODO(edisonn): warn about missing default value for optional fields | |
96 return NULL; | |
97 } | |
98 | |
99 bool SkPdfCatalogDictionary::has_Dests() const { | |
100 return get("Dests", "") != NULL; | |
101 } | |
102 | |
103 SkPdfDictionary* SkPdfCatalogDictionary::ViewerPreferences(SkPdfNativeDoc* doc)
{ | |
104 SkPdfNativeObject* ret = get("ViewerPreferences", ""); | |
105 if (doc) {ret = doc->resolveReference(ret);} | |
106 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
107 // TODO(edisonn): warn about missing default value for optional fields | |
108 return NULL; | |
109 } | |
110 | |
111 bool SkPdfCatalogDictionary::has_ViewerPreferences() const { | |
112 return get("ViewerPreferences", "") != NULL; | |
113 } | |
114 | |
115 SkString SkPdfCatalogDictionary::PageLayout(SkPdfNativeDoc* doc) { | |
116 SkPdfNativeObject* ret = get("PageLayout", ""); | |
117 if (doc) {ret = doc->resolveReference(ret);} | |
118 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isRe
ference())) return ret->nameValue2(); | |
119 // TODO(edisonn): warn about missing default value for optional fields | |
120 return SkString(); | |
121 } | |
122 | |
123 bool SkPdfCatalogDictionary::has_PageLayout() const { | |
124 return get("PageLayout", "") != NULL; | |
125 } | |
126 | |
127 SkString SkPdfCatalogDictionary::PageMode(SkPdfNativeDoc* doc) { | |
128 SkPdfNativeObject* ret = get("PageMode", ""); | |
129 if (doc) {ret = doc->resolveReference(ret);} | |
130 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isRe
ference())) return ret->nameValue2(); | |
131 // TODO(edisonn): warn about missing default value for optional fields | |
132 return SkString(); | |
133 } | |
134 | |
135 bool SkPdfCatalogDictionary::has_PageMode() const { | |
136 return get("PageMode", "") != NULL; | |
137 } | |
138 | |
139 SkPdfDictionary* SkPdfCatalogDictionary::Outlines(SkPdfNativeDoc* doc) { | |
140 SkPdfNativeObject* ret = get("Outlines", ""); | |
141 if (doc) {ret = doc->resolveReference(ret);} | |
142 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
143 // TODO(edisonn): warn about missing default value for optional fields | |
144 return NULL; | |
145 } | |
146 | |
147 bool SkPdfCatalogDictionary::has_Outlines() const { | |
148 return get("Outlines", "") != NULL; | |
149 } | |
150 | |
151 SkPdfArray* SkPdfCatalogDictionary::Threads(SkPdfNativeDoc* doc) { | |
152 SkPdfNativeObject* ret = get("Threads", ""); | |
153 if (doc) {ret = doc->resolveReference(ret);} | |
154 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isR
eference())) return (SkPdfArray*)ret; | |
155 // TODO(edisonn): warn about missing default value for optional fields | |
156 return NULL; | |
157 } | |
158 | |
159 bool SkPdfCatalogDictionary::has_Threads() const { | |
160 return get("Threads", "") != NULL; | |
161 } | |
162 | |
163 bool SkPdfCatalogDictionary::isOpenActionAArray(SkPdfNativeDoc* doc) { | |
164 SkPdfNativeObject* ret = get("OpenAction", ""); | |
165 if (doc) {ret = doc->resolveReference(ret);} | |
166 return ret != NULL && ret->isArray(); | |
167 } | |
168 | |
169 SkPdfArray* SkPdfCatalogDictionary::getOpenActionAsArray(SkPdfNativeDoc* doc) { | |
170 SkPdfNativeObject* ret = get("OpenAction", ""); | |
171 if (doc) {ret = doc->resolveReference(ret);} | |
172 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isR
eference())) return (SkPdfArray*)ret; | |
173 // TODO(edisonn): warn about missing default value for optional fields | |
174 return NULL; | |
175 } | |
176 | |
177 bool SkPdfCatalogDictionary::isOpenActionADictionary(SkPdfNativeDoc* doc) { | |
178 SkPdfNativeObject* ret = get("OpenAction", ""); | |
179 if (doc) {ret = doc->resolveReference(ret);} | |
180 return ret != NULL && ret->isDictionary(); | |
181 } | |
182 | |
183 SkPdfDictionary* SkPdfCatalogDictionary::getOpenActionAsDictionary(SkPdfNativeDo
c* doc) { | |
184 SkPdfNativeObject* ret = get("OpenAction", ""); | |
185 if (doc) {ret = doc->resolveReference(ret);} | |
186 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
187 // TODO(edisonn): warn about missing default value for optional fields | |
188 return NULL; | |
189 } | |
190 | |
191 bool SkPdfCatalogDictionary::has_OpenAction() const { | |
192 return get("OpenAction", "") != NULL; | |
193 } | |
194 | |
195 SkPdfDictionary* SkPdfCatalogDictionary::AA(SkPdfNativeDoc* doc) { | |
196 SkPdfNativeObject* ret = get("AA", ""); | |
197 if (doc) {ret = doc->resolveReference(ret);} | |
198 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
199 // TODO(edisonn): warn about missing default value for optional fields | |
200 return NULL; | |
201 } | |
202 | |
203 bool SkPdfCatalogDictionary::has_AA() const { | |
204 return get("AA", "") != NULL; | |
205 } | |
206 | |
207 SkPdfDictionary* SkPdfCatalogDictionary::URI(SkPdfNativeDoc* doc) { | |
208 SkPdfNativeObject* ret = get("URI", ""); | |
209 if (doc) {ret = doc->resolveReference(ret);} | |
210 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
211 // TODO(edisonn): warn about missing default value for optional fields | |
212 return NULL; | |
213 } | |
214 | |
215 bool SkPdfCatalogDictionary::has_URI() const { | |
216 return get("URI", "") != NULL; | |
217 } | |
218 | |
219 SkPdfDictionary* SkPdfCatalogDictionary::AcroForm(SkPdfNativeDoc* doc) { | |
220 SkPdfNativeObject* ret = get("AcroForm", ""); | |
221 if (doc) {ret = doc->resolveReference(ret);} | |
222 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
223 // TODO(edisonn): warn about missing default value for optional fields | |
224 return NULL; | |
225 } | |
226 | |
227 bool SkPdfCatalogDictionary::has_AcroForm() const { | |
228 return get("AcroForm", "") != NULL; | |
229 } | |
230 | |
231 SkPdfStream* SkPdfCatalogDictionary::Metadata(SkPdfNativeDoc* doc) { | |
232 SkPdfNativeObject* ret = get("Metadata", ""); | |
233 if (doc) {ret = doc->resolveReference(ret);} | |
234 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->i
sReference())) return ret->getStream(); | |
235 // TODO(edisonn): warn about missing default value for optional fields | |
236 return NULL; | |
237 } | |
238 | |
239 bool SkPdfCatalogDictionary::has_Metadata() const { | |
240 return get("Metadata", "") != NULL; | |
241 } | |
242 | |
243 SkPdfDictionary* SkPdfCatalogDictionary::StructTreeRoot(SkPdfNativeDoc* doc) { | |
244 SkPdfNativeObject* ret = get("StructTreeRoot", ""); | |
245 if (doc) {ret = doc->resolveReference(ret);} | |
246 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
247 // TODO(edisonn): warn about missing default value for optional fields | |
248 return NULL; | |
249 } | |
250 | |
251 bool SkPdfCatalogDictionary::has_StructTreeRoot() const { | |
252 return get("StructTreeRoot", "") != NULL; | |
253 } | |
254 | |
255 SkPdfDictionary* SkPdfCatalogDictionary::MarkInfo(SkPdfNativeDoc* doc) { | |
256 SkPdfNativeObject* ret = get("MarkInfo", ""); | |
257 if (doc) {ret = doc->resolveReference(ret);} | |
258 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
259 // TODO(edisonn): warn about missing default value for optional fields | |
260 return NULL; | |
261 } | |
262 | |
263 bool SkPdfCatalogDictionary::has_MarkInfo() const { | |
264 return get("MarkInfo", "") != NULL; | |
265 } | |
266 | |
267 SkString SkPdfCatalogDictionary::Lang(SkPdfNativeDoc* doc) { | |
268 SkPdfNativeObject* ret = get("Lang", ""); | |
269 if (doc) {ret = doc->resolveReference(ret);} | |
270 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret-
>isReference())) return ret->stringValue2(); | |
271 // TODO(edisonn): warn about missing default value for optional fields | |
272 return SkString(); | |
273 } | |
274 | |
275 bool SkPdfCatalogDictionary::has_Lang() const { | |
276 return get("Lang", "") != NULL; | |
277 } | |
278 | |
279 SkPdfDictionary* SkPdfCatalogDictionary::SpiderInfo(SkPdfNativeDoc* doc) { | |
280 SkPdfNativeObject* ret = get("SpiderInfo", ""); | |
281 if (doc) {ret = doc->resolveReference(ret);} | |
282 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret
->isReference())) return (SkPdfDictionary*)ret; | |
283 // TODO(edisonn): warn about missing default value for optional fields | |
284 return NULL; | |
285 } | |
286 | |
287 bool SkPdfCatalogDictionary::has_SpiderInfo() const { | |
288 return get("SpiderInfo", "") != NULL; | |
289 } | |
290 | |
291 SkPdfArray* SkPdfCatalogDictionary::OutputIntents(SkPdfNativeDoc* doc) { | |
292 SkPdfNativeObject* ret = get("OutputIntents", ""); | |
293 if (doc) {ret = doc->resolveReference(ret);} | |
294 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isR
eference())) return (SkPdfArray*)ret; | |
295 // TODO(edisonn): warn about missing default value for optional fields | |
296 return NULL; | |
297 } | |
298 | |
299 bool SkPdfCatalogDictionary::has_OutputIntents() const { | |
300 return get("OutputIntents", "") != NULL; | |
301 } | |
OLD | NEW |