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
Type(SkPdfNativeDoc * doc)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->isReference())) return ret->nameValue2();
15 // TODO(edisonn): warn about missing required field, assert for known good pdfs
16 return SkString();
17 }
18
has_Type() const19 bool SkPdfCatalogDictionary::has_Type() const {
20 return get("Type", "") != NULL;
21 }
22
Version(SkPdfNativeDoc * doc)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->isReference())) return ret->nameValue2();
27 // TODO(edisonn): warn about missing default value for optional fields
28 return SkString();
29 }
30
has_Version() const31 bool SkPdfCatalogDictionary::has_Version() const {
32 return get("Version", "") != NULL;
33 }
34
Pages(SkPdfNativeDoc * doc)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 (SkPdfPageTreeNodeDictionary*)ret;
39 // TODO(edisonn): warn about missing default value for optional fields
40 return NULL;
41 }
42
has_Pages() const43 bool SkPdfCatalogDictionary::has_Pages() const {
44 return get("Pages", "") != NULL;
45 }
46
isPageLabelsANumber(SkPdfNativeDoc * doc)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
getPageLabelsAsNumber(SkPdfNativeDoc * doc)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->isReference())) return ret->numberValue();
57 // TODO(edisonn): warn about missing default value for optional fields
58 return 0;
59 }
60
isPageLabelsATree(SkPdfNativeDoc * doc)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
getPageLabelsAsTree(SkPdfNativeDoc * doc)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
has_PageLabels() const75 bool SkPdfCatalogDictionary::has_PageLabels() const {
76 return get("PageLabels", "") != NULL;
77 }
78
Names(SkPdfNativeDoc * doc)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
has_Names() const87 bool SkPdfCatalogDictionary::has_Names() const {
88 return get("Names", "") != NULL;
89 }
90
Dests(SkPdfNativeDoc * doc)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
has_Dests() const99 bool SkPdfCatalogDictionary::has_Dests() const {
100 return get("Dests", "") != NULL;
101 }
102
ViewerPreferences(SkPdfNativeDoc * doc)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
has_ViewerPreferences() const111 bool SkPdfCatalogDictionary::has_ViewerPreferences() const {
112 return get("ViewerPreferences", "") != NULL;
113 }
114
PageLayout(SkPdfNativeDoc * doc)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->isReference())) return ret->nameValue2();
119 // TODO(edisonn): warn about missing default value for optional fields
120 return SkString();
121 }
122
has_PageLayout() const123 bool SkPdfCatalogDictionary::has_PageLayout() const {
124 return get("PageLayout", "") != NULL;
125 }
126
PageMode(SkPdfNativeDoc * doc)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->isReference())) return ret->nameValue2();
131 // TODO(edisonn): warn about missing default value for optional fields
132 return SkString();
133 }
134
has_PageMode() const135 bool SkPdfCatalogDictionary::has_PageMode() const {
136 return get("PageMode", "") != NULL;
137 }
138
Outlines(SkPdfNativeDoc * doc)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
has_Outlines() const147 bool SkPdfCatalogDictionary::has_Outlines() const {
148 return get("Outlines", "") != NULL;
149 }
150
Threads(SkPdfNativeDoc * doc)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->isReference())) return (SkPdfArray*)ret;
155 // TODO(edisonn): warn about missing default value for optional fields
156 return NULL;
157 }
158
has_Threads() const159 bool SkPdfCatalogDictionary::has_Threads() const {
160 return get("Threads", "") != NULL;
161 }
162
isOpenActionAArray(SkPdfNativeDoc * doc)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
getOpenActionAsArray(SkPdfNativeDoc * doc)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->isReference())) return (SkPdfArray*)ret;
173 // TODO(edisonn): warn about missing default value for optional fields
174 return NULL;
175 }
176
isOpenActionADictionary(SkPdfNativeDoc * doc)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
getOpenActionAsDictionary(SkPdfNativeDoc * doc)183 SkPdfDictionary* SkPdfCatalogDictionary::getOpenActionAsDictionary(SkPdfNativeDoc* 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
has_OpenAction() const191 bool SkPdfCatalogDictionary::has_OpenAction() const {
192 return get("OpenAction", "") != NULL;
193 }
194
AA(SkPdfNativeDoc * doc)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
has_AA() const203 bool SkPdfCatalogDictionary::has_AA() const {
204 return get("AA", "") != NULL;
205 }
206
URI(SkPdfNativeDoc * doc)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
has_URI() const215 bool SkPdfCatalogDictionary::has_URI() const {
216 return get("URI", "") != NULL;
217 }
218
AcroForm(SkPdfNativeDoc * doc)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
has_AcroForm() const227 bool SkPdfCatalogDictionary::has_AcroForm() const {
228 return get("AcroForm", "") != NULL;
229 }
230
Metadata(SkPdfNativeDoc * doc)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->isReference())) return ret->getStream();
235 // TODO(edisonn): warn about missing default value for optional fields
236 return NULL;
237 }
238
has_Metadata() const239 bool SkPdfCatalogDictionary::has_Metadata() const {
240 return get("Metadata", "") != NULL;
241 }
242
StructTreeRoot(SkPdfNativeDoc * doc)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
has_StructTreeRoot() const251 bool SkPdfCatalogDictionary::has_StructTreeRoot() const {
252 return get("StructTreeRoot", "") != NULL;
253 }
254
MarkInfo(SkPdfNativeDoc * doc)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
has_MarkInfo() const263 bool SkPdfCatalogDictionary::has_MarkInfo() const {
264 return get("MarkInfo", "") != NULL;
265 }
266
Lang(SkPdfNativeDoc * doc)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
has_Lang() const275 bool SkPdfCatalogDictionary::has_Lang() const {
276 return get("Lang", "") != NULL;
277 }
278
SpiderInfo(SkPdfNativeDoc * doc)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
has_SpiderInfo() const287 bool SkPdfCatalogDictionary::has_SpiderInfo() const {
288 return get("SpiderInfo", "") != NULL;
289 }
290
OutputIntents(SkPdfNativeDoc * doc)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->isReference())) return (SkPdfArray*)ret;
295 // TODO(edisonn): warn about missing default value for optional fields
296 return NULL;
297 }
298
has_OutputIntents() const299 bool SkPdfCatalogDictionary::has_OutputIntents() const {
300 return get("OutputIntents", "") != NULL;
301 }
302