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