OLD | NEW |
1 #ifndef __DEFINED__SkPdfStructureElementDictionary | 1 #ifndef __DEFINED__SkPdfStructureElementDictionary |
2 #define __DEFINED__SkPdfStructureElementDictionary | 2 #define __DEFINED__SkPdfStructureElementDictionary |
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 structure element dictionary |
8 class SkPdfStructureElementDictionary : public SkPdfDictionary { | 9 class SkPdfStructureElementDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kStructureElementDictionary_S
kPdfObjectType;} | 11 virtual SkPdfObjectType getType() const { return kStructureElementDictionary_S
kPdfObjectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kStructu
reElementDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kStructu
reElementDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfStructureElementDictionary* asStructureElementDictionary() {retur
n this;} | 14 virtual SkPdfStructureElementDictionary* asStructureElementDictionary() {retur
n this;} |
14 virtual const SkPdfStructureElementDictionary* asStructureElementDictionary()
const {return this;} | 15 virtual const SkPdfStructureElementDictionary* asStructureElementDictionary()
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 SkPdfStructureElementDictionary(const PdfMemDocument* podofoDoc = NULL, const
PdfObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfStructureElementDictionary(const PdfMemDocument* podofoDoc = NULL, const
PdfObject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
519 | 520 |
520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
521 | 522 |
522 SkPdfStructureElementDictionary& operator=(const SkPdfStructureElementDictiona
ry& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoOb
j; return *this;} | 523 SkPdfStructureElementDictionary& operator=(const SkPdfStructureElementDictiona
ry& from) {this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoOb
j; return *this;} |
523 | 524 |
| 525 /** (Optional) The type of PDF object that this dictionary describes; if |
| 526 * present, must be StructElem for a structure element. |
| 527 **/ |
| 528 bool has_Type() const { |
| 529 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type"
, "", NULL)); |
| 530 } |
| 531 |
524 std::string Type() const { | 532 std::string Type() const { |
525 std::string ret; | 533 std::string ret; |
526 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; | 534 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Type", "",
&ret)) return ret; |
527 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 535 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
528 return ""; | 536 return ""; |
529 } | 537 } |
530 | 538 |
| 539 /** (Required) The structure type, a name object identifying the nature of the |
| 540 * structure element and its role within the document, such as a chapter, |
| 541 * paragraph, or footnote (see Section 9.6.2, "Structure Types"). Names of |
| 542 * structure types must conform to the guidelines described in Appendix E. |
| 543 **/ |
| 544 bool has_S() const { |
| 545 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "
", NULL)); |
| 546 } |
| 547 |
531 std::string S() const { | 548 std::string S() const { |
532 std::string ret; | 549 std::string ret; |
533 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "", &re
t)) return ret; | 550 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "S", "", &re
t)) return ret; |
534 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 551 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
535 return ""; | 552 return ""; |
536 } | 553 } |
537 | 554 |
| 555 /** (Required; must be an indirect reference) The structure element that is the |
| 556 * immediate parent of this one in the structure hierarchy. |
| 557 **/ |
| 558 bool has_P() const { |
| 559 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "P", "
", NULL)); |
| 560 } |
| 561 |
538 SkPdfDictionary* P() const { | 562 SkPdfDictionary* P() const { |
539 SkPdfDictionary* ret; | 563 SkPdfDictionary* ret; |
540 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "P", "
", &ret)) return ret; | 564 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "P", "
", &ret)) return ret; |
541 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 565 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
542 return NULL; | 566 return NULL; |
543 } | 567 } |
544 | 568 |
| 569 /** (Optional) The element identifier, a string designating this structure |
| 570 * element. The string must be unique among all elements in the docu- |
| 571 * ment's structure hierarchy. The IDTree entry in the structure tree root |
| 572 * (see Table 9.9) defines the correspondence between element identifiers |
| 573 * and the structure elements they denote. |
| 574 **/ |
| 575 bool has_ID() const { |
| 576 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ID",
"", NULL)); |
| 577 } |
| 578 |
545 std::string ID() const { | 579 std::string ID() const { |
546 std::string ret; | 580 std::string ret; |
547 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ID", "",
&ret)) return ret; | 581 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ID", "",
&ret)) return ret; |
548 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 582 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
549 return ""; | 583 return ""; |
550 } | 584 } |
551 | 585 |
| 586 /** (Optional; must be an indirect reference) A page object representing a |
| 587 * page on which some or all of the content items designated by the K entry |
| 588 * are rendered. |
| 589 **/ |
| 590 bool has_Pg() const { |
| 591 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Pg",
"", NULL)); |
| 592 } |
| 593 |
552 SkPdfDictionary* Pg() const { | 594 SkPdfDictionary* Pg() const { |
553 SkPdfDictionary* ret; | 595 SkPdfDictionary* ret; |
554 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Pg",
"", &ret)) return ret; | 596 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Pg",
"", &ret)) return ret; |
555 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 597 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
556 return NULL; | 598 return NULL; |
557 } | 599 } |
558 | 600 |
| 601 /** (Optional) The contents of this structure element, which may consist of |
| 602 * one or more marked-content sequences, PDF objects, and other struc- |
| 603 * ture elements. The value of this entry may be any of the following: |
| 604 * * An integer marked-content identifier denoting a marked-content |
| 605 * sequence |
| 606 * * A marked-content reference dictionary denoting a marked-content |
| 607 * sequence |
| 608 * * An object reference dictionary denoting a PDF object |
| 609 * * A structure element dictionary denoting another structure element |
| 610 * * An array, each of whose elements is one of the objects listed above |
| 611 * See Section 9.6.3, "Structure Content" for further discussion of each of |
| 612 * these forms of representation. |
| 613 **/ |
| 614 bool has_K() const { |
| 615 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "K", "
", NULL)); |
| 616 } |
| 617 |
559 SkPdfObject* K() const { | 618 SkPdfObject* K() const { |
560 SkPdfObject* ret; | 619 SkPdfObject* ret; |
561 if (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "K", "", &
ret)) return ret; | 620 if (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "K", "", &
ret)) return ret; |
562 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 621 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
563 return NULL; | 622 return NULL; |
564 } | 623 } |
565 | 624 |
| 625 /** (Optional) The attribute object or objects, if any, associated with this |
| 626 * structure element. Each attribute object is either a dictionary or a |
| 627 * stream; the value of this entry may be either a single attribute object or |
| 628 * an array of such objects together with their revision numbers (see |
| 629 * Section 9.6.4, "Structure Attributes," and "Attribute Revision Numbers" |
| 630 * on page 606). |
| 631 **/ |
| 632 bool has_A() const { |
| 633 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "A", "
", NULL)); |
| 634 } |
| 635 |
566 SkPdfObject* A() const { | 636 SkPdfObject* A() const { |
567 SkPdfObject* ret; | 637 SkPdfObject* ret; |
568 if (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "A", "", &
ret)) return ret; | 638 if (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "A", "", &
ret)) return ret; |
569 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 639 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
570 return NULL; | 640 return NULL; |
571 } | 641 } |
572 | 642 |
| 643 /** (Optional) The attribute class or classes, if any, to which this structure |
| 644 * element belongs. The value of this entry may be either a single class |
| 645 * name or an array of class names together with their revision numbers |
| 646 * (see "Attribute Classes" on page 605 and "Attribute Revision Numbers" |
| 647 * on page 606). |
| 648 * Note: If both the A and C entries are present and a given attribute is speci
- |
| 649 * fied by both, the one specified by the A entry takes precedence. |
| 650 **/ |
| 651 bool has_C() const { |
| 652 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "
", NULL)); |
| 653 } |
| 654 |
573 bool isCAName() const { | 655 bool isCAName() const { |
574 SkPdfObject* ret = NULL; | 656 SkPdfObject* ret = NULL; |
575 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "",
&ret)) return false; | 657 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "",
&ret)) return false; |
576 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 658 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
577 } | 659 } |
578 | 660 |
579 std::string getCAsName() const { | 661 std::string getCAsName() const { |
580 std::string ret = ""; | 662 std::string ret = ""; |
581 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "", &re
t)) return ret; | 663 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "", &re
t)) return ret; |
582 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 664 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
583 return ""; | 665 return ""; |
584 } | 666 } |
585 | 667 |
586 bool isCAArray() const { | 668 bool isCAArray() const { |
587 SkPdfObject* ret = NULL; | 669 SkPdfObject* ret = NULL; |
588 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "",
&ret)) return false; | 670 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "",
&ret)) return false; |
589 return ret->podofo()->GetDataType() == ePdfDataType_Array; | 671 return ret->podofo()->GetDataType() == ePdfDataType_Array; |
590 } | 672 } |
591 | 673 |
592 SkPdfArray getCAsArray() const { | 674 SkPdfArray getCAsArray() const { |
593 SkPdfArray ret = SkPdfArray(); | 675 SkPdfArray ret = SkPdfArray(); |
594 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "", &r
et)) return ret; | 676 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "", &r
et)) return ret; |
595 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 677 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
596 return SkPdfArray(); | 678 return SkPdfArray(); |
597 } | 679 } |
598 | 680 |
| 681 /** (Optional) The current revision number of this structure element (see |
| 682 * "Attribute Revision Numbers" on page 606). The value must be a non- |
| 683 * negative integer. Default value: 0. |
| 684 **/ |
| 685 bool has_R() const { |
| 686 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "R", "
", NULL)); |
| 687 } |
| 688 |
599 long R() const { | 689 long R() const { |
600 long ret; | 690 long ret; |
601 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "R", "", &re
t)) return ret; | 691 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "R", "", &re
t)) return ret; |
602 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 692 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
603 return 0; | 693 return 0; |
604 } | 694 } |
605 | 695 |
| 696 /** (Optional) The title of the structure element, a text string representing it |
| 697 * in human-readable form. The title should characterize the specific struc- |
| 698 * ture element, such as Chapter 1, rather than merely a generic element |
| 699 * type, such as Chapter. |
| 700 **/ |
| 701 bool has_T() const { |
| 702 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "T", "
", NULL)); |
| 703 } |
| 704 |
606 std::string T() const { | 705 std::string T() const { |
607 std::string ret; | 706 std::string ret; |
608 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "T", "", &
ret)) return ret; | 707 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "T", "", &
ret)) return ret; |
609 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 708 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
610 return ""; | 709 return ""; |
611 } | 710 } |
612 | 711 |
| 712 /** (Optional; PDF 1.4) A language identifier specifying the natural language |
| 713 * for all text in the structure element except where overridden by language |
| 714 * specifications for nested structure elements or marked content (see Sec- |
| 715 * tion 9.8.1, "Natural Language Specification"). If this entry is absent, the |
| 716 * language (if any) specified in the document catalog applies. |
| 717 **/ |
| 718 bool has_Lang() const { |
| 719 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Lang"
, "", NULL)); |
| 720 } |
| 721 |
613 std::string Lang() const { | 722 std::string Lang() const { |
614 std::string ret; | 723 std::string ret; |
615 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Lang", ""
, &ret)) return ret; | 724 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Lang", ""
, &ret)) return ret; |
616 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 725 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
617 return ""; | 726 return ""; |
618 } | 727 } |
619 | 728 |
| 729 /** (Optional) An alternate description of the structure element and its |
| 730 * children in human-readable form, useful when extracting the docu- |
| 731 * ment's contents in support of accessibility to disabled users or for other |
| 732 * purposes (see Section 9.8.2, "Alternate Descriptions"). |
| 733 **/ |
| 734 bool has_Alt() const { |
| 735 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alt",
"", NULL)); |
| 736 } |
| 737 |
620 std::string Alt() const { | 738 std::string Alt() const { |
621 std::string ret; | 739 std::string ret; |
622 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alt", "",
&ret)) return ret; | 740 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Alt", "",
&ret)) return ret; |
623 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 741 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
624 return ""; | 742 return ""; |
625 } | 743 } |
626 | 744 |
| 745 /** (Optional; PDF 1.4) Text that is an exact replacement for the structure |
| 746 * element and its children. This replacement text (which should apply to |
| 747 * as small a piece of content as possible) is useful when extracting the doc- |
| 748 * ument's contents in support of accessibility to disabled users or for other |
| 749 * purposes (see Section 9.8.3, "Replacement Text"). |
| 750 **/ |
| 751 bool has_ActualText() const { |
| 752 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Actua
lText", "", NULL)); |
| 753 } |
| 754 |
627 std::string ActualText() const { | 755 std::string ActualText() const { |
628 std::string ret; | 756 std::string ret; |
629 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ActualTex
t", "", &ret)) return ret; | 757 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "ActualTex
t", "", &ret)) return ret; |
630 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 758 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
631 return ""; | 759 return ""; |
632 } | 760 } |
633 | 761 |
634 }; | 762 }; |
635 | 763 |
636 #endif // __DEFINED__SkPdfStructureElementDictionary | 764 #endif // __DEFINED__SkPdfStructureElementDictionary |
OLD | NEW |