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 "SkPdfType1FormDictionary_autogen.h" 9 #include "SkPdfNativeDoc.h" 10 11 SkString SkPdfType1FormDictionary::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 default value for optional fields 16 return SkString(); 17 } 18 19 bool SkPdfType1FormDictionary::has_Type() const { 20 return get("Type", "") != NULL; 21 } 22 23 SkString SkPdfType1FormDictionary::Subtype(SkPdfNativeDoc* doc) { 24 SkPdfNativeObject* ret = get("Subtype", ""); 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 required field, assert for known good pdfs 28 return SkString(); 29 } 30 31 bool SkPdfType1FormDictionary::has_Subtype() const { 32 return get("Subtype", "") != NULL; 33 } 34 35 int64_t SkPdfType1FormDictionary::FormType(SkPdfNativeDoc* doc) { 36 SkPdfNativeObject* ret = get("FormType", ""); 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 43 bool SkPdfType1FormDictionary::has_FormType() const { 44 return get("FormType", "") != NULL; 45 } 46 47 SkString SkPdfType1FormDictionary::Name(SkPdfNativeDoc* doc) { 48 SkPdfNativeObject* ret = get("Name", ""); 49 if (doc) {ret = doc->resolveReference(ret);} 50 if ((ret != NULL && ret->isName()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->nameValue2(); 51 // TODO(edisonn): warn about missing default value for optional fields 52 return SkString(); 53 } 54 55 bool SkPdfType1FormDictionary::has_Name() const { 56 return get("Name", "") != NULL; 57 } 58 59 SkPdfDate SkPdfType1FormDictionary::LastModified(SkPdfNativeDoc* doc) { 60 SkPdfNativeObject* ret = get("LastModified", ""); 61 if (doc) {ret = doc->resolveReference(ret);} 62 if ((ret != NULL && ret->isDate()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->dateValue(); 63 // TODO(edisonn): warn about missing default value for optional fields 64 return SkPdfDate(); 65 } 66 67 bool SkPdfType1FormDictionary::has_LastModified() const { 68 return get("LastModified", "") != NULL; 69 } 70 71 SkRect SkPdfType1FormDictionary::BBox(SkPdfNativeDoc* doc) { 72 SkPdfNativeObject* ret = get("BBox", ""); 73 if (doc) {ret = doc->resolveReference(ret);} 74 if ((ret != NULL && ret->isRectangle()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->rectangleValue(); 75 // TODO(edisonn): warn about missing required field, assert for known good pdfs 76 return SkRect::MakeEmpty(); 77 } 78 79 bool SkPdfType1FormDictionary::has_BBox() const { 80 return get("BBox", "") != NULL; 81 } 82 83 SkMatrix SkPdfType1FormDictionary::Matrix(SkPdfNativeDoc* doc) { 84 SkPdfNativeObject* ret = get("Matrix", ""); 85 if (doc) {ret = doc->resolveReference(ret);} 86 if ((ret != NULL && ret->isMatrix()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->matrixValue(); 87 // TODO(edisonn): warn about missing default value for optional fields 88 return SkMatrix::I(); 89 } 90 91 bool SkPdfType1FormDictionary::has_Matrix() const { 92 return get("Matrix", "") != NULL; 93 } 94 95 SkPdfResourceDictionary* SkPdfType1FormDictionary::Resources(SkPdfNativeDoc* doc) { 96 SkPdfNativeObject* ret = get("Resources", ""); 97 if (doc) {ret = doc->resolveReference(ret);} 98 if ((ret != NULL && ret->isDictionary() && ((SkPdfResourceDictionary*)ret)->valid()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfResourceDictionary*)ret; 99 // TODO(edisonn): warn about missing default value for optional fields 100 return NULL; 101 } 102 103 bool SkPdfType1FormDictionary::has_Resources() const { 104 return get("Resources", "") != NULL; 105 } 106 107 SkPdfTransparencyGroupDictionary* SkPdfType1FormDictionary::Group(SkPdfNativeDoc* doc) { 108 SkPdfNativeObject* ret = get("Group", ""); 109 if (doc) {ret = doc->resolveReference(ret);} 110 if ((ret != NULL && ret->isDictionary() && ((SkPdfTransparencyGroupDictionary*)ret)->valid()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfTransparencyGroupDictionary*)ret; 111 // TODO(edisonn): warn about missing default value for optional fields 112 return NULL; 113 } 114 115 bool SkPdfType1FormDictionary::has_Group() const { 116 return get("Group", "") != NULL; 117 } 118 119 SkPdfDictionary* SkPdfType1FormDictionary::Ref(SkPdfNativeDoc* doc) { 120 SkPdfNativeObject* ret = get("Ref", ""); 121 if (doc) {ret = doc->resolveReference(ret);} 122 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret; 123 // TODO(edisonn): warn about missing default value for optional fields 124 return NULL; 125 } 126 127 bool SkPdfType1FormDictionary::has_Ref() const { 128 return get("Ref", "") != NULL; 129 } 130 131 SkPdfStream* SkPdfType1FormDictionary::Metadata(SkPdfNativeDoc* doc) { 132 SkPdfNativeObject* ret = get("Metadata", ""); 133 if (doc) {ret = doc->resolveReference(ret);} 134 if ((ret != NULL && ret->hasStream()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->getStream(); 135 // TODO(edisonn): warn about missing default value for optional fields 136 return NULL; 137 } 138 139 bool SkPdfType1FormDictionary::has_Metadata() const { 140 return get("Metadata", "") != NULL; 141 } 142 143 SkPdfDictionary* SkPdfType1FormDictionary::PieceInfo(SkPdfNativeDoc* doc) { 144 SkPdfNativeObject* ret = get("PieceInfo", ""); 145 if (doc) {ret = doc->resolveReference(ret);} 146 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret; 147 // TODO(edisonn): warn about missing default value for optional fields 148 return NULL; 149 } 150 151 bool SkPdfType1FormDictionary::has_PieceInfo() const { 152 return get("PieceInfo", "") != NULL; 153 } 154 155 int64_t SkPdfType1FormDictionary::StructParent(SkPdfNativeDoc* doc) { 156 SkPdfNativeObject* ret = get("StructParent", ""); 157 if (doc) {ret = doc->resolveReference(ret);} 158 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue(); 159 // TODO(edisonn): warn about missing default value for optional fields 160 return 0; 161 } 162 163 bool SkPdfType1FormDictionary::has_StructParent() const { 164 return get("StructParent", "") != NULL; 165 } 166 167 int64_t SkPdfType1FormDictionary::StructParents(SkPdfNativeDoc* doc) { 168 SkPdfNativeObject* ret = get("StructParents", ""); 169 if (doc) {ret = doc->resolveReference(ret);} 170 if ((ret != NULL && ret->isInteger()) || (doc == NULL && ret != NULL && ret->isReference())) return ret->intValue(); 171 // TODO(edisonn): warn about missing default value for optional fields 172 return 0; 173 } 174 175 bool SkPdfType1FormDictionary::has_StructParents() const { 176 return get("StructParents", "") != NULL; 177 } 178 179 SkPdfDictionary* SkPdfType1FormDictionary::OPI(SkPdfNativeDoc* doc) { 180 SkPdfNativeObject* ret = get("OPI", ""); 181 if (doc) {ret = doc->resolveReference(ret);} 182 if ((ret != NULL && ret->isDictionary()) || (doc == NULL && ret != NULL && ret->isReference())) return (SkPdfDictionary*)ret; 183 // TODO(edisonn): warn about missing default value for optional fields 184 return NULL; 185 } 186 187 bool SkPdfType1FormDictionary::has_OPI() const { 188 return get("OPI", "") != NULL; 189 } 190