Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: experimental/PdfViewer/autogen/SkPdfType1FormDictionary_autogen.h

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

Powered by Google App Engine
This is Rietveld 408576698