OLD | NEW |
1 #ifndef __DEFINED__SkPdfType1FormDictionary | 1 #ifndef __DEFINED__SkPdfType1FormDictionary |
2 #define __DEFINED__SkPdfType1FormDictionary | 2 #define __DEFINED__SkPdfType1FormDictionary |
3 | 3 |
4 #include "SkPdfEnums_autogen.h" | 4 #include "SkPdfEnums_autogen.h" |
5 #include "SkPdfArray_autogen.h" | 5 #include "SkPdfArray_autogen.h" |
6 #include "SkPdfXObjectDictionary_autogen.h" | 6 #include "SkPdfXObjectDictionary_autogen.h" |
7 | 7 |
| 8 // Additional entries specific to a type 1 form dictionary |
8 class SkPdfType1FormDictionary : public SkPdfXObjectDictionary { | 9 class SkPdfType1FormDictionary : public SkPdfXObjectDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kType1FormDictionary_SkPdfObj
ectType;} | 11 virtual SkPdfObjectType getType() const { return kType1FormDictionary_SkPdfObj
ectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType1Fo
rmDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kType1Fo
rmDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfType1FormDictionary* asType1FormDictionary() {return this;} | 14 virtual SkPdfType1FormDictionary* asType1FormDictionary() {return this;} |
14 virtual const SkPdfType1FormDictionary* asType1FormDictionary() const {return
this;} | 15 virtual const SkPdfType1FormDictionary* asType1FormDictionary() const {return
this;} |
15 | 16 |
16 private: | 17 private: |
17 virtual SkPdfImageDictionary* asImageDictionary() {return NULL;} | 18 virtual SkPdfImageDictionary* asImageDictionary() {return NULL;} |
18 virtual const SkPdfImageDictionary* asImageDictionary() const {return NULL;} | 19 virtual const SkPdfImageDictionary* asImageDictionary() const {return NULL;} |
19 | 20 |
20 public: | 21 public: |
21 private: | 22 private: |
22 public: | 23 public: |
23 SkPdfType1FormDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfXObjectDictionary(podofoDoc, podofoObj) {} | 24 SkPdfType1FormDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfXObjectDictionary(podofoDoc, podofoObj) {} |
24 | 25 |
25 virtual bool valid() const {return true;} | 26 virtual bool valid() const {return true;} |
26 | 27 |
27 SkPdfType1FormDictionary& operator=(const SkPdfType1FormDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | 28 SkPdfType1FormDictionary& operator=(const SkPdfType1FormDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} |
28 | 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 |
29 std::string Type() const { | 37 std::string Type() const { |
30 std::string ret; | 38 std::string ret; |
31 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | 39 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; |
32 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 40 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
33 return ""; | 41 return ""; |
34 } | 42 } |
35 | 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 |
36 std::string Subtype() const { | 51 std::string Subtype() const { |
37 std::string ret; | 52 std::string ret; |
38 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; | 53 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subtype", "
", &ret)) return ret; |
39 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 54 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
40 return ""; | 55 return ""; |
41 } | 56 } |
42 | 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 |
43 long FormType() const { | 66 long FormType() const { |
44 long ret; | 67 long ret; |
45 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FormType",
"", &ret)) return ret; | 68 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FormType",
"", &ret)) return ret; |
46 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 69 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
47 return 0; | 70 return 0; |
48 } | 71 } |
49 | 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 |
50 std::string Name() const { | 83 std::string Name() const { |
51 std::string ret; | 84 std::string ret; |
52 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name", "",
&ret)) return ret; | 85 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name", "",
&ret)) return ret; |
53 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 86 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
54 return ""; | 87 return ""; |
55 } | 88 } |
56 | 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 |
57 SkPdfDate LastModified() const { | 101 SkPdfDate LastModified() const { |
58 SkPdfDate ret; | 102 SkPdfDate ret; |
59 if (DateFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastModifie
d", "", &ret)) return ret; | 103 if (DateFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastModifie
d", "", &ret)) return ret; |
60 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 104 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
61 return SkPdfDate(); | 105 return SkPdfDate(); |
62 } | 106 } |
63 | 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 |
64 SkRect BBox() const { | 117 SkRect BBox() const { |
65 SkRect ret; | 118 SkRect ret; |
66 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox", ""
, &ret)) return ret; | 119 if (SkRectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox", ""
, &ret)) return ret; |
67 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 120 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
68 return SkRect(); | 121 return SkRect(); |
69 } | 122 } |
70 | 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 |
71 SkPdfArray Matrix() const { | 132 SkPdfArray Matrix() const { |
72 SkPdfArray ret; | 133 SkPdfArray ret; |
73 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Matrix", "
", &ret)) return ret; | 134 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Matrix", "
", &ret)) return ret; |
74 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 135 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
75 return SkPdfArray(); | 136 return SkPdfArray(); |
76 } | 137 } |
77 | 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 |
78 SkPdfDictionary* Resources() const { | 161 SkPdfDictionary* Resources() const { |
79 SkPdfDictionary* ret; | 162 SkPdfDictionary* ret; |
80 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", &ret)) return ret; | 163 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", &ret)) return ret; |
81 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 164 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
82 return NULL; | 165 return NULL; |
83 } | 166 } |
84 | 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 |
85 SkPdfDictionary* Group() const { | 179 SkPdfDictionary* Group() const { |
86 SkPdfDictionary* ret; | 180 SkPdfDictionary* ret; |
87 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Group
", "", &ret)) return ret; | 181 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Group
", "", &ret)) return ret; |
88 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 182 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
89 return NULL; | 183 return NULL; |
90 } | 184 } |
91 | 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 |
92 SkPdfDictionary* Ref() const { | 194 SkPdfDictionary* Ref() const { |
93 SkPdfDictionary* ret; | 195 SkPdfDictionary* ret; |
94 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ref",
"", &ret)) return ret; | 196 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ref",
"", &ret)) return ret; |
95 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 197 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
96 return NULL; | 198 return NULL; |
97 } | 199 } |
98 | 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 |
99 SkPdfStream Metadata() const { | 208 SkPdfStream Metadata() const { |
100 SkPdfStream ret; | 209 SkPdfStream ret; |
101 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metadata"
, "", &ret)) return ret; | 210 if (StreamFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metadata"
, "", &ret)) return ret; |
102 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 211 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
103 return SkPdfStream(); | 212 return SkPdfStream(); |
104 } | 213 } |
105 | 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 |
106 SkPdfDictionary* PieceInfo() const { | 222 SkPdfDictionary* PieceInfo() const { |
107 SkPdfDictionary* ret; | 223 SkPdfDictionary* ret; |
108 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Piece
Info", "", &ret)) return ret; | 224 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Piece
Info", "", &ret)) return ret; |
109 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 225 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
110 return NULL; | 226 return NULL; |
111 } | 227 } |
112 | 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 |
113 long StructParent() const { | 237 long StructParent() const { |
114 long ret; | 238 long ret; |
115 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StructParen
t", "", &ret)) return ret; | 239 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StructParen
t", "", &ret)) return ret; |
116 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 240 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
117 return 0; | 241 return 0; |
118 } | 242 } |
119 | 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 |
120 long StructParents() const { | 256 long StructParents() const { |
121 long ret; | 257 long ret; |
122 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StructParen
ts", "", &ret)) return ret; | 258 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "StructParen
ts", "", &ret)) return ret; |
123 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 259 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
124 return 0; | 260 return 0; |
125 } | 261 } |
126 | 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 |
127 SkPdfDictionary* OPI() const { | 270 SkPdfDictionary* OPI() const { |
128 SkPdfDictionary* ret; | 271 SkPdfDictionary* ret; |
129 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPI",
"", &ret)) return ret; | 272 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPI",
"", &ret)) return ret; |
130 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 273 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
131 return NULL; | 274 return NULL; |
132 } | 275 } |
133 | 276 |
134 }; | 277 }; |
135 | 278 |
136 #endif // __DEFINED__SkPdfType1FormDictionary | 279 #endif // __DEFINED__SkPdfType1FormDictionary |
OLD | NEW |