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 "SkPdfInteractiveFormDictionary_autogen.h"
9 #include "SkPdfNativeDoc.h"
10
Fields(SkPdfNativeDoc * doc)11 SkPdfArray* SkPdfInteractiveFormDictionary::Fields(SkPdfNativeDoc* doc) {
12 SkPdfNativeObject* ret = get("Fields", "");
13 if (doc) {ret = doc->resolveReference(ret);}
14 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
15 // TODO(edisonn): warn about missing required field, assert for known good pdfs
16 return NULL;
17 }
18
has_Fields() const19 bool SkPdfInteractiveFormDictionary::has_Fields() const {
20 return get("Fields", "") != NULL;
21 }
22
NeedAppearances(SkPdfNativeDoc * doc)23 bool SkPdfInteractiveFormDictionary::NeedAppearances(SkPdfNativeDoc* doc) {
24 SkPdfNativeObject* ret = get("NeedAppearances", "");
25 if (doc) {ret = doc->resolveReference(ret);}
26 if ((ret != NULL && ret->isBoolean()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->boolValue();
27 // TODO(edisonn): warn about missing default value for optional fields
28 return false;
29 }
30
has_NeedAppearances() const31 bool SkPdfInteractiveFormDictionary::has_NeedAppearances() const {
32 return get("NeedAppearances", "") != NULL;
33 }
34
SigFlags(SkPdfNativeDoc * doc)35 int64_t SkPdfInteractiveFormDictionary::SigFlags(SkPdfNativeDoc* doc) {
36 SkPdfNativeObject* ret = get("SigFlags", "");
37 if (doc) {ret = doc->resolveReference(ret);}
38 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
39 // TODO(edisonn): warn about missing default value for optional fields
40 return 0;
41 }
42
has_SigFlags() const43 bool SkPdfInteractiveFormDictionary::has_SigFlags() const {
44 return get("SigFlags", "") != NULL;
45 }
46
CO(SkPdfNativeDoc * doc)47 SkPdfArray* SkPdfInteractiveFormDictionary::CO(SkPdfNativeDoc* doc) {
48 SkPdfNativeObject* ret = get("CO", "");
49 if (doc) {ret = doc->resolveReference(ret);}
50 if ((ret != NULL && ret->isArray()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfArray*)ret;
51 // TODO(edisonn): warn about missing default value for optional fields
52 return NULL;
53 }
54
has_CO() const55 bool SkPdfInteractiveFormDictionary::has_CO() const {
56 return get("CO", "") != NULL;
57 }
58
DR(SkPdfNativeDoc * doc)59 SkPdfDictionary* SkPdfInteractiveFormDictionary::DR(SkPdfNativeDoc* doc) {
60 SkPdfNativeObject* ret = get("DR", "");
61 if (doc) {ret = doc->resolveReference(ret);}
62 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret;
63 // TODO(edisonn): warn about missing default value for optional fields
64 return NULL;
65 }
66
has_DR() const67 bool SkPdfInteractiveFormDictionary::has_DR() const {
68 return get("DR", "") != NULL;
69 }
70
DA(SkPdfNativeDoc * doc)71 SkString SkPdfInteractiveFormDictionary::DA(SkPdfNativeDoc* doc) {
72 SkPdfNativeObject* ret = get("DA", "");
73 if (doc) {ret = doc->resolveReference(ret);}
74 if ((ret != NULL && ret->isAnyString()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->stringValue2();
75 // TODO(edisonn): warn about missing default value for optional fields
76 return SkString();
77 }
78
has_DA() const79 bool SkPdfInteractiveFormDictionary::has_DA() const {
80 return get("DA", "") != NULL;
81 }
82
Q(SkPdfNativeDoc * doc)83 int64_t SkPdfInteractiveFormDictionary::Q(SkPdfNativeDoc* doc) {
84 SkPdfNativeObject* ret = get("Q", "");
85 if (doc) {ret = doc->resolveReference(ret);}
86 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue();
87 // TODO(edisonn): warn about missing default value for optional fields
88 return 0;
89 }
90
has_Q() const91 bool SkPdfInteractiveFormDictionary::has_Q() const {
92 return get("Q", "") != NULL;
93 }
94