| OLD | NEW |
| (Empty) |
| 1 #ifndef __DEFINED__SkPdfType1FormDictionary | |
| 2 #define __DEFINED__SkPdfType1FormDictionary | |
| 3 | |
| 4 #include "SkPdfEnums_autogen.h" | |
| 5 #include "SkPdfArray_autogen.h" | |
| 6 #include "SkPdfXObjectDictionary_autogen.h" | |
| 7 | |
| 8 // Additional entries specific to a type 1 form dictionary | |
| 9 class SkPdfType1FormDictionary : public SkPdfXObjectDictionary { | |
| 10 public: | |
| 11 virtual SkPdfObjectType getType() const { return kType1FormDictionary_SkPdfObj
ectType;} | |
| 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType1Fo
rmDictionary_SkPdfObjectType + 1);} | |
| 13 public: | |
| 14 virtual SkPdfType1FormDictionary* asType1FormDictionary() {return this;} | |
| 15 virtual const SkPdfType1FormDictionary* asType1FormDictionary() const {return
this;} | |
| 16 | |
| 17 private: | |
| 18 virtual SkPdfImageDictionary* asImageDictionary() {return NULL;} | |
| 19 virtual const SkPdfImageDictionary* asImageDictionary() const {return NULL;} | |
| 20 | |
| 21 public: | |
| 22 private: | |
| 23 public: | |
| 24 SkPdfType1FormDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfXObjectDictionary(podofoDoc, podofoObj) {} | |
| 25 | |
| 26 virtual bool valid() const {return true;} | |
| 27 | |
| 28 SkPdfType1FormDictionary& operator=(const SkPdfType1FormDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | |
| 29 | |
| 30 /** (Optional) The type of PDF object that this dictionary describes; if present
, | |
| 31 * must be XObject for a form XObject. | |
| 32 **/ | |
| 33 bool has_Type() const { | |
| 34 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); | |
| 35 } | |
| 36 | |
| 37 std::string Type() const { | |
| 38 std::string ret; | |
| 39 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | |
| 40 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 41 return ""; | |
| 42 } | |
| 43 | |
| 44 /** (Required) The type of XObject that this dictionary describes; must be Form | |
| 45 * for a form XObject. | |
| 46 **/ | |
| 47 bool has_Subtype() const { | |
| 48 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); | |
| 49 } | |
| 50 | |
| 51 std::string Subtype() const { | |
| 52 std::string ret; | |
| 53 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; | |
| 54 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 55 return ""; | |
| 56 } | |
| 57 | |
| 58 /** (Optional) A code identifying the type of form XObject that this dictionary | |
| 59 * describes. The only valid value defined at the time of publication is 1. Def
ault | |
| 60 * value: 1. | |
| 61 **/ | |
| 62 bool has_FormType() const { | |
| 63 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FormT
ype", "", NULL)); | |
| 64 } | |
| 65 | |
| 66 long FormType() const { | |
| 67 long ret; | |
| 68 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FormType",
"", &ret)) return ret; | |
| 69 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 70 return 0; | |
| 71 } | |
| 72 | |
| 73 /** (Required in PDF 1.0; optional otherwise) The name by which this form | |
| 74 * XObject is referenced in the XObject subdictionary of the current resource | |
| 75 * dictionary (see Section 3.7.2, "Resource Dictionaries"). | |
| 76 * Note: This entry is obsolescent and its use is no longer recommended. (See | |
| 77 * implementation note 38 in Appendix H.) | |
| 78 **/ | |
| 79 bool has_Name() const { | |
| 80 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name"
, "", NULL)); | |
| 81 } | |
| 82 | |
| 83 std::string Name() const { | |
| 84 std::string ret; | |
| 85 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name", "",
&ret)) return ret; | |
| 86 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 87 return ""; | |
| 88 } | |
| 89 | |
| 90 /** (Required if PieceInfo is present; optional otherwise; PDF 1.3) The date and | |
| 91 * time (see Section 3.8.2, "Dates") when the form XObject's contents were | |
| 92 * most recently modified. If a page-piece dictionary (PieceInfo) is present, t
he | |
| 93 * modification date is used to ascertain which of the application data diction
- | |
| 94 * aries it contains correspond to the current content of the form (see Section | |
| 95 * 9.4, "Page-Piece Dictionaries"). | |
| 96 **/ | |
| 97 bool has_LastModified() const { | |
| 98 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastM
odified", "", NULL)); | |
| 99 } | |
| 100 | |
| 101 SkPdfDate LastModified() const { | |
| 102 SkPdfDate ret; | |
| 103 if (DateFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastModifie
d", "", &ret)) return ret; | |
| 104 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 105 return SkPdfDate(); | |
| 106 } | |
| 107 | |
| 108 /** (Required) An array of four numbers in the form coordinate system (see | |
| 109 * below), giving the coordinates of the left, bottom, right, and top edges, | |
| 110 * respectively, of the form XObject's bounding box. These boundaries are used | |
| 111 * to clip the form XObject and to determine its size for caching. | |
| 112 **/ | |
| 113 bool has_BBox() const { | |
| 114 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox"
, "", NULL)); | |
| 115 } | |
| 116 | |
| 117 SkRect BBox() const { | |
| 118 SkRect ret; | |
| 119 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox", ""
, &ret)) return ret; | |
| 120 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 121 return SkRect(); | |
| 122 } | |
| 123 | |
| 124 /** (Optional) An array of six numbers specifying the form matrix, which maps | |
| 125 * form space into user space (see Section 4.2.3, "Transformation Matrices"). | |
| 126 * Default value: the identity matrix [1 0 0 1 0 0]. | |
| 127 **/ | |
| 128 bool has_Matrix() const { | |
| 129 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Matri
x", "", NULL)); | |
| 130 } | |
| 131 | |
| 132 SkPdfArray Matrix() const { | |
| 133 SkPdfArray ret; | |
| 134 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Matrix", "
", &ret)) return ret; | |
| 135 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 136 return SkPdfArray(); | |
| 137 } | |
| 138 | |
| 139 /** (Optional but strongly recommended; PDF 1.2) A dictionary specifying any | |
| 140 * resources (such as fonts and images) required by the form XObject (see Sec- | |
| 141 * tion 3.7, "Content Streams and Resources"). | |
| 142 * In PDF 1.1 and earlier, all named resources used in the form XObject must be | |
| 143 * included in the resource dictionary of each page object on which the form | |
| 144 * XObject appears, whether or not they also appear in the resource dictionary | |
| 145 * of the form XObject itself. It can be useful to specify these resources in t
he | |
| 146 * form XObject's own resource dictionary as well, in order to determine which | |
| 147 * resources are used inside the form XObject. If a resource is included in bot
h | |
| 148 * dictionaries, it should have the same name in both locations. | |
| 149 * In PDF 1.2 and later versions, form XObjects can be independent of the | |
| 150 * content streams in which they appear, and this is strongly recommended | |
| 151 * although not required. In an independent form XObject, the resource dic
- | |
| 152 * tionary of the form XObject is required and contains all named resource
s | |
| 153 * used by the form XObject. These resources are not "promoted" to the out
er | |
| 154 * content stream's resource dictionary, although that stream's resource d
iction- | |
| 155 * ary will refer to the form XObject itself. | |
| 156 **/ | |
| 157 bool has_Resources() const { | |
| 158 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", NULL)); | |
| 159 } | |
| 160 | |
| 161 SkPdfDictionary* Resources() const { | |
| 162 SkPdfDictionary* ret; | |
| 163 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", &ret)) return ret; | |
| 164 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 165 return NULL; | |
| 166 } | |
| 167 | |
| 168 /** (Optional; PDF 1.4) A group attributes dictionary indicating that the conten
ts | |
| 169 * of the form XObject are to be treated as a group and specifying the attribut
es | |
| 170 * of that group (see Section 4.9.2, "Group XObjects"). | |
| 171 * Note: If a Ref entry (see below) is present, the group attributes also apply
to the | |
| 172 * external page imported by that entry. This allows such an imported page to b
e | |
| 173 * treated as a group without further modification. | |
| 174 **/ | |
| 175 bool has_Group() const { | |
| 176 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Group
", "", NULL)); | |
| 177 } | |
| 178 | |
| 179 SkPdfDictionary* Group() const { | |
| 180 SkPdfDictionary* ret; | |
| 181 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Group
", "", &ret)) return ret; | |
| 182 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 183 return NULL; | |
| 184 } | |
| 185 | |
| 186 /** (Optional; PDF 1.4) A reference dictionary identifying a page to be imported | |
| 187 * from another PDF file, and for which the form XObject serves as a proxy (see | |
| 188 * Section 4.9.3, "Reference XObjects"). | |
| 189 **/ | |
| 190 bool has_Ref() const { | |
| 191 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ref",
"", NULL)); | |
| 192 } | |
| 193 | |
| 194 SkPdfDictionary* Ref() const { | |
| 195 SkPdfDictionary* ret; | |
| 196 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ref",
"", &ret)) return ret; | |
| 197 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 198 return NULL; | |
| 199 } | |
| 200 | |
| 201 /** (Optional; PDF 1.4) A metadata stream containing metadata for the form | |
| 202 * XObject (see Section 9.2.2, "Metadata Streams"). | |
| 203 **/ | |
| 204 bool has_Metadata() const { | |
| 205 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metad
ata", "", NULL)); | |
| 206 } | |
| 207 | |
| 208 SkPdfStream* Metadata() const { | |
| 209 SkPdfStream* ret; | |
| 210 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metadata"
, "", &ret)) return ret; | |
| 211 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 212 return NULL; | |
| 213 } | |
| 214 | |
| 215 /** (Optional; PDF 1.3) A page-piece dictionary associated with the form | |
| 216 * XObject (see Section 9.4, "Page-Piece Dictionaries"). | |
| 217 **/ | |
| 218 bool has_PieceInfo() const { | |
| 219 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Piece
Info", "", NULL)); | |
| 220 } | |
| 221 | |
| 222 SkPdfDictionary* PieceInfo() const { | |
| 223 SkPdfDictionary* ret; | |
| 224 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Piece
Info", "", &ret)) return ret; | |
| 225 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 226 return NULL; | |
| 227 } | |
| 228 | |
| 229 /** (Required if the form XObject is a structural content item; PDF 1.3) The int
eger | |
| 230 * key of the form XObject's entry in the structural parent tree (see "Finding | |
| 231 * Structure Elements from Content Items" on page 600). | |
| 232 **/ | |
| 233 bool has_StructParent() const { | |
| 234 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Struc
tParent", "", NULL)); | |
| 235 } | |
| 236 | |
| 237 long StructParent() const { | |
| 238 long ret; | |
| 239 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StructParen
t", "", &ret)) return ret; | |
| 240 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 241 return 0; | |
| 242 } | |
| 243 | |
| 244 /** (Required if the form XObject contains marked-content sequences that are str
uc- | |
| 245 * tural content items; PDF 1.3) The integer key of the form XObject's entry in | |
| 246 * the structural parent tree (see "Finding Structure Elements from Content | |
| 247 * Items" on page 600). | |
| 248 * Note: At most one of the entries StructParent or StructParents may be presen
t. A | |
| 249 * form XObject can be either a content item in its entirety or a container for | |
| 250 * marked-content sequences that are content items, but not both. | |
| 251 **/ | |
| 252 bool has_StructParents() const { | |
| 253 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Struc
tParents", "", NULL)); | |
| 254 } | |
| 255 | |
| 256 long StructParents() const { | |
| 257 long ret; | |
| 258 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StructParen
ts", "", &ret)) return ret; | |
| 259 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 260 return 0; | |
| 261 } | |
| 262 | |
| 263 /** (Optional; PDF 1.2) An OPI version dictionary for the form XObject (see | |
| 264 * Section 9.10.6, "Open Prepress Interface (OPI)"). | |
| 265 **/ | |
| 266 bool has_OPI() const { | |
| 267 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPI",
"", NULL)); | |
| 268 } | |
| 269 | |
| 270 SkPdfDictionary* OPI() const { | |
| 271 SkPdfDictionary* ret; | |
| 272 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPI",
"", &ret)) return ret; | |
| 273 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | |
| 274 return NULL; | |
| 275 } | |
| 276 | |
| 277 }; | |
| 278 | |
| 279 #endif // __DEFINED__SkPdfType1FormDictionary | |
| OLD | NEW |