OLD | NEW |
1 #ifndef __DEFINED__SkPdfReferenceDictionary | 1 #ifndef __DEFINED__SkPdfReferenceDictionary |
2 #define __DEFINED__SkPdfReferenceDictionary | 2 #define __DEFINED__SkPdfReferenceDictionary |
3 | 3 |
4 #include "SkPdfEnums_autogen.h" | 4 #include "SkPdfEnums_autogen.h" |
5 #include "SkPdfArray_autogen.h" | 5 #include "SkPdfArray_autogen.h" |
6 #include "SkPdfDictionary_autogen.h" | 6 #include "SkPdfDictionary_autogen.h" |
7 | 7 |
| 8 // Entries in a reference dictionary |
8 class SkPdfReferenceDictionary : public SkPdfDictionary { | 9 class SkPdfReferenceDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kReferenceDictionary_SkPdfObj
ectType;} | 11 virtual SkPdfObjectType getType() const { return kReferenceDictionary_SkPdfObj
ectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kReferen
ceDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kReferen
ceDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfReferenceDictionary* asReferenceDictionary() {return this;} | 14 virtual SkPdfReferenceDictionary* asReferenceDictionary() {return this;} |
14 virtual const SkPdfReferenceDictionary* asReferenceDictionary() const {return
this;} | 15 virtual const SkPdfReferenceDictionary* asReferenceDictionary() const {return
this;} |
15 | 16 |
16 private: | 17 private: |
17 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} | 18 virtual SkPdfALinkAnnotationDictionary* asALinkAnnotationDictionary() {return
NULL;} |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 | 515 |
515 public: | 516 public: |
516 private: | 517 private: |
517 public: | 518 public: |
518 SkPdfReferenceDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfReferenceDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfObje
ct* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
519 | 520 |
520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
521 | 522 |
522 SkPdfReferenceDictionary& operator=(const SkPdfReferenceDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} | 523 SkPdfReferenceDictionary& operator=(const SkPdfReferenceDictionary& from) {thi
s->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return *thi
s;} |
523 | 524 |
| 525 /** (Required) The file containing the target document. |
| 526 **/ |
| 527 bool has_F() const { |
| 528 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", "
", NULL)); |
| 529 } |
| 530 |
524 SkPdfFileSpec F() const { | 531 SkPdfFileSpec F() const { |
525 SkPdfFileSpec ret; | 532 SkPdfFileSpec ret; |
526 if (FileSpecFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", "",
&ret)) return ret; | 533 if (FileSpecFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", "",
&ret)) return ret; |
527 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 534 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
528 return SkPdfFileSpec(); | 535 return SkPdfFileSpec(); |
529 } | 536 } |
530 | 537 |
| 538 /** (Required) A page index or page label (see Section 8.3.1, "Page Labels") |
| 539 * identifying the page of the target document containing the content to be |
| 540 * imported. Note that the reference is a weak one and can be inadvertently in- |
| 541 * validated if the referenced page is changed or replaced in the target docume
nt |
| 542 * after the reference is created. |
| 543 **/ |
| 544 bool has_Page() const { |
| 545 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page"
, "", NULL)); |
| 546 } |
| 547 |
531 bool isPageAInteger() const { | 548 bool isPageAInteger() const { |
532 SkPdfObject* ret = NULL; | 549 SkPdfObject* ret = NULL; |
533 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page", "
", &ret)) return false; | 550 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page", "
", &ret)) return false; |
534 return ret->podofo()->GetDataType() == ePdfDataType_Number; | 551 return ret->podofo()->GetDataType() == ePdfDataType_Number; |
535 } | 552 } |
536 | 553 |
537 long getPageAsInteger() const { | 554 long getPageAsInteger() const { |
538 long ret = 0; | 555 long ret = 0; |
539 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page", "",
&ret)) return ret; | 556 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page", "",
&ret)) return ret; |
540 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 557 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
541 return 0; | 558 return 0; |
542 } | 559 } |
543 | 560 |
544 bool isPageAString() const { | 561 bool isPageAString() const { |
545 SkPdfObject* ret = NULL; | 562 SkPdfObject* ret = NULL; |
546 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page", "
", &ret)) return false; | 563 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page", "
", &ret)) return false; |
547 return ret->podofo()->GetDataType() == ePdfDataType_String || ret->podofo()-
>GetDataType() == ePdfDataType_HexString; | 564 return ret->podofo()->GetDataType() == ePdfDataType_String || ret->podofo()-
>GetDataType() == ePdfDataType_HexString; |
548 } | 565 } |
549 | 566 |
550 std::string getPageAsString() const { | 567 std::string getPageAsString() const { |
551 std::string ret = ""; | 568 std::string ret = ""; |
552 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page", ""
, &ret)) return ret; | 569 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Page", ""
, &ret)) return ret; |
553 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 570 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
554 return ""; | 571 return ""; |
555 } | 572 } |
556 | 573 |
| 574 /** (Optional) An array of two strings constituting a file identifier (see Secti
on 9.3, |
| 575 * "File Identifiers") for the file containing the target document. The use of
this |
| 576 * entry improves a viewer application's chances of finding the intended file a
nd |
| 577 * allows it to warn the user if the file has changed since the reference was c
reated. |
| 578 **/ |
| 579 bool has_ID() const { |
| 580 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ID",
"", NULL)); |
| 581 } |
| 582 |
557 SkPdfArray ID() const { | 583 SkPdfArray ID() const { |
558 SkPdfArray ret; | 584 SkPdfArray ret; |
559 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ID", "", &
ret)) return ret; | 585 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ID", "", &
ret)) return ret; |
560 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 586 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
561 return SkPdfArray(); | 587 return SkPdfArray(); |
562 } | 588 } |
563 | 589 |
564 }; | 590 }; |
565 | 591 |
566 #endif // __DEFINED__SkPdfReferenceDictionary | 592 #endif // __DEFINED__SkPdfReferenceDictionary |
OLD | NEW |