| OLD | NEW |
| 1 #ifndef __DEFINED__SkPdfType1FormDictionary | 1 #ifndef __DEFINED__SkPdfType1FormDictionary |
| 2 #define __DEFINED__SkPdfType1FormDictionary | 2 #define __DEFINED__SkPdfType1FormDictionary |
| 3 | 3 |
| 4 #include "SkPdfUtils.h" | 4 #include "SkPdfUtils.h" |
| 5 #include "SkPdfEnums_autogen.h" | 5 #include "SkPdfEnums_autogen.h" |
| 6 #include "SkPdfArray_autogen.h" | 6 #include "SkPdfArray_autogen.h" |
| 7 #include "SkPdfXObjectDictionary_autogen.h" | 7 #include "SkPdfXObjectDictionary_autogen.h" |
| 8 | 8 |
| 9 // Additional entries specific to a type 1 form dictionary | 9 // Additional entries specific to a type 1 form dictionary |
| 10 class SkPdfType1FormDictionary : public SkPdfXObjectDictionary { | 10 class SkPdfType1FormDictionary : public SkPdfXObjectDictionary { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 SkPdfType1FormDictionary& operator=(const SkPdfType1FormDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | 31 SkPdfType1FormDictionary& operator=(const SkPdfType1FormDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} |
| 32 | 32 |
| 33 /** (Optional) The type of PDF object that this dictionary describes; if present
, | 33 /** (Optional) The type of PDF object that this dictionary describes; if present
, |
| 34 * must be XObject for a form XObject. | 34 * must be XObject for a form XObject. |
| 35 **/ | 35 **/ |
| 36 bool has_Type() const { | 36 bool has_Type() const { |
| 37 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); | 37 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 std::string Type() const { | 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 | 41 /** (Required) The type of XObject that this dictionary describes; must be Form |
| 48 * for a form XObject. | 42 * for a form XObject. |
| 49 **/ | 43 **/ |
| 50 bool has_Subtype() const { | 44 bool has_Subtype() const { |
| 51 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); | 45 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Subty
pe", "", NULL)); |
| 52 } | 46 } |
| 53 | 47 |
| 54 std::string Subtype() const { | 48 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 | 49 /** (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 | 50 * describes. The only valid value defined at the time of publication is 1. Def
ault |
| 63 * value: 1. | 51 * value: 1. |
| 64 **/ | 52 **/ |
| 65 bool has_FormType() const { | 53 bool has_FormType() const { |
| 66 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FormT
ype", "", NULL)); | 54 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "FormT
ype", "", NULL)); |
| 67 } | 55 } |
| 68 | 56 |
| 69 long FormType() const { | 57 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 | 58 /** (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 | 59 * XObject is referenced in the XObject subdictionary of the current resource |
| 78 * dictionary (see Section 3.7.2, "Resource Dictionaries"). | 60 * dictionary (see Section 3.7.2, "Resource Dictionaries"). |
| 79 * Note: This entry is obsolescent and its use is no longer recommended. (See | 61 * Note: This entry is obsolescent and its use is no longer recommended. (See |
| 80 * implementation note 38 in Appendix H.) | 62 * implementation note 38 in Appendix H.) |
| 81 **/ | 63 **/ |
| 82 bool has_Name() const { | 64 bool has_Name() const { |
| 83 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name"
, "", NULL)); | 65 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Name"
, "", NULL)); |
| 84 } | 66 } |
| 85 | 67 |
| 86 std::string Name() const { | 68 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 | 69 /** (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 | 70 * 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 | 71 * 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
- | 72 * 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 | 73 * aries it contains correspond to the current content of the form (see Section |
| 98 * 9.4, "Page-Piece Dictionaries"). | 74 * 9.4, "Page-Piece Dictionaries"). |
| 99 **/ | 75 **/ |
| 100 bool has_LastModified() const { | 76 bool has_LastModified() const { |
| 101 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastM
odified", "", NULL)); | 77 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "LastM
odified", "", NULL)); |
| 102 } | 78 } |
| 103 | 79 |
| 104 SkPdfDate LastModified() const { | 80 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 | 81 /** (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, | 82 * 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 | 83 * 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. | 84 * to clip the form XObject and to determine its size for caching. |
| 115 **/ | 85 **/ |
| 116 bool has_BBox() const { | 86 bool has_BBox() const { |
| 117 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox"
, "", NULL)); | 87 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "BBox"
, "", NULL)); |
| 118 } | 88 } |
| 119 | 89 |
| 120 SkRect* BBox() const { | 90 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 | 91 /** (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"). | 92 * form space into user space (see Section 4.2.3, "Transformation Matrices"). |
| 129 * Default value: the identity matrix [1 0 0 1 0 0]. | 93 * Default value: the identity matrix [1 0 0 1 0 0]. |
| 130 **/ | 94 **/ |
| 131 bool has_Matrix() const { | 95 bool has_Matrix() const { |
| 132 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Matri
x", "", NULL)); | 96 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Matri
x", "", NULL)); |
| 133 } | 97 } |
| 134 | 98 |
| 135 SkMatrix* Matrix() const { | 99 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 | 100 /** (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- | 101 * resources (such as fonts and images) required by the form XObject (see Sec- |
| 144 * tion 3.7, "Content Streams and Resources"). | 102 * tion 3.7, "Content Streams and Resources"). |
| 145 * In PDF 1.1 and earlier, all named resources used in the form XObject must be | 103 * 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 | 104 * 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 | 105 * 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 | 106 * 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 | 107 * 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 | 108 * 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. | 109 * 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 | 110 * 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 | 111 * content streams in which they appear, and this is strongly recommended |
| 154 * although not required. In an independent form XObject, the resource dic
- | 112 * 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 | 113 * 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 | 114 * 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- | 115 * content stream's resource dictionary, although that stream's resource d
iction- |
| 158 * ary will refer to the form XObject itself. | 116 * ary will refer to the form XObject itself. |
| 159 **/ | 117 **/ |
| 160 bool has_Resources() const { | 118 bool has_Resources() const { |
| 161 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", NULL)); | 119 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Resou
rces", "", NULL)); |
| 162 } | 120 } |
| 163 | 121 |
| 164 SkPdfResourceDictionary* Resources() const { | 122 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 | 123 /** (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 | 124 * 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"). | 125 * 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 | 126 * 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 | 127 * external page imported by that entry. This allows such an imported page to b
e |
| 176 * treated as a group without further modification. | 128 * treated as a group without further modification. |
| 177 **/ | 129 **/ |
| 178 bool has_Group() const { | 130 bool has_Group() const { |
| 179 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Group
", "", NULL)); | 131 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Group
", "", NULL)); |
| 180 } | 132 } |
| 181 | 133 |
| 182 SkPdfDictionary* Group() const { | 134 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 | 135 /** (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 | 136 * from another PDF file, and for which the form XObject serves as a proxy (see |
| 191 * Section 4.9.3, "Reference XObjects"). | 137 * Section 4.9.3, "Reference XObjects"). |
| 192 **/ | 138 **/ |
| 193 bool has_Ref() const { | 139 bool has_Ref() const { |
| 194 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ref",
"", NULL)); | 140 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Ref",
"", NULL)); |
| 195 } | 141 } |
| 196 | 142 |
| 197 SkPdfDictionary* Ref() const { | 143 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 | 144 /** (Optional; PDF 1.4) A metadata stream containing metadata for the form |
| 205 * XObject (see Section 9.2.2, "Metadata Streams"). | 145 * XObject (see Section 9.2.2, "Metadata Streams"). |
| 206 **/ | 146 **/ |
| 207 bool has_Metadata() const { | 147 bool has_Metadata() const { |
| 208 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metad
ata", "", NULL)); | 148 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Metad
ata", "", NULL)); |
| 209 } | 149 } |
| 210 | 150 |
| 211 SkPdfStream* Metadata() const { | 151 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 | 152 /** (Optional; PDF 1.3) A page-piece dictionary associated with the form |
| 219 * XObject (see Section 9.4, "Page-Piece Dictionaries"). | 153 * XObject (see Section 9.4, "Page-Piece Dictionaries"). |
| 220 **/ | 154 **/ |
| 221 bool has_PieceInfo() const { | 155 bool has_PieceInfo() const { |
| 222 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Piece
Info", "", NULL)); | 156 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Piece
Info", "", NULL)); |
| 223 } | 157 } |
| 224 | 158 |
| 225 SkPdfDictionary* PieceInfo() const { | 159 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 | 160 /** (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 | 161 * key of the form XObject's entry in the structural parent tree (see "Finding |
| 234 * Structure Elements from Content Items" on page 600). | 162 * Structure Elements from Content Items" on page 600). |
| 235 **/ | 163 **/ |
| 236 bool has_StructParent() const { | 164 bool has_StructParent() const { |
| 237 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Struc
tParent", "", NULL)); | 165 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Struc
tParent", "", NULL)); |
| 238 } | 166 } |
| 239 | 167 |
| 240 long StructParent() const { | 168 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- | 169 /** (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 | 170 * 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 | 171 * the structural parent tree (see "Finding Structure Elements from Content |
| 250 * Items" on page 600). | 172 * Items" on page 600). |
| 251 * Note: At most one of the entries StructParent or StructParents may be presen
t. A | 173 * 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 | 174 * 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. | 175 * marked-content sequences that are content items, but not both. |
| 254 **/ | 176 **/ |
| 255 bool has_StructParents() const { | 177 bool has_StructParents() const { |
| 256 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Struc
tParents", "", NULL)); | 178 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Struc
tParents", "", NULL)); |
| 257 } | 179 } |
| 258 | 180 |
| 259 long StructParents() const { | 181 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 | 182 /** (Optional; PDF 1.2) An OPI version dictionary for the form XObject (see |
| 267 * Section 9.10.6, "Open Prepress Interface (OPI)"). | 183 * Section 9.10.6, "Open Prepress Interface (OPI)"). |
| 268 **/ | 184 **/ |
| 269 bool has_OPI() const { | 185 bool has_OPI() const { |
| 270 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPI",
"", NULL)); | 186 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "OPI",
"", NULL)); |
| 271 } | 187 } |
| 272 | 188 |
| 273 SkPdfDictionary* OPI() const { | 189 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 }; | 190 }; |
| 281 | 191 |
| 282 #endif // __DEFINED__SkPdfType1FormDictionary | 192 #endif // __DEFINED__SkPdfType1FormDictionary |
| OLD | NEW |