OLD | NEW |
1 #ifndef __DEFINED__SkPdfOutlineItemDictionary | 1 #ifndef __DEFINED__SkPdfOutlineItemDictionary |
2 #define __DEFINED__SkPdfOutlineItemDictionary | 2 #define __DEFINED__SkPdfOutlineItemDictionary |
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 an outline item dictionary |
8 class SkPdfOutlineItemDictionary : public SkPdfDictionary { | 9 class SkPdfOutlineItemDictionary : public SkPdfDictionary { |
9 public: | 10 public: |
10 virtual SkPdfObjectType getType() const { return kOutlineItemDictionary_SkPdfO
bjectType;} | 11 virtual SkPdfObjectType getType() const { return kOutlineItemDictionary_SkPdfO
bjectType;} |
11 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kOutline
ItemDictionary_SkPdfObjectType + 1);} | 12 virtual SkPdfObjectType getTypeEnd() const { return (SkPdfObjectType)(kOutline
ItemDictionary_SkPdfObjectType + 1);} |
12 public: | 13 public: |
13 virtual SkPdfOutlineItemDictionary* asOutlineItemDictionary() {return this;} | 14 virtual SkPdfOutlineItemDictionary* asOutlineItemDictionary() {return this;} |
14 virtual const SkPdfOutlineItemDictionary* asOutlineItemDictionary() const {ret
urn this;} | 15 virtual const SkPdfOutlineItemDictionary* asOutlineItemDictionary() const {ret
urn 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 SkPdfOutlineItemDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfOb
ject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} | 519 SkPdfOutlineItemDictionary(const PdfMemDocument* podofoDoc = NULL, const PdfOb
ject* podofoObj = NULL) : SkPdfDictionary(podofoDoc, podofoObj) {} |
519 | 520 |
520 virtual bool valid() const {return true;} | 521 virtual bool valid() const {return true;} |
521 | 522 |
522 SkPdfOutlineItemDictionary& operator=(const SkPdfOutlineItemDictionary& from)
{this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return
*this;} | 523 SkPdfOutlineItemDictionary& operator=(const SkPdfOutlineItemDictionary& from)
{this->fPodofoDoc = from.fPodofoDoc; this->fPodofoObj = from.fPodofoObj; return
*this;} |
523 | 524 |
| 525 /** (Required) The text to be displayed on the screen for this item. |
| 526 **/ |
| 527 bool has_Title() const { |
| 528 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Title
", "", NULL)); |
| 529 } |
| 530 |
524 std::string Title() const { | 531 std::string Title() const { |
525 std::string ret; | 532 std::string ret; |
526 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Title", "
", &ret)) return ret; | 533 if (StringFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Title", "
", &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 ""; | 535 return ""; |
529 } | 536 } |
530 | 537 |
| 538 /** (Required; must be an indirect reference) The parent of this item in the out
line |
| 539 * hierarchy. The parent of a top-level item is the outline dictionary itself. |
| 540 **/ |
| 541 bool has_Parent() const { |
| 542 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Paren
t", "", NULL)); |
| 543 } |
| 544 |
531 SkPdfDictionary* Parent() const { | 545 SkPdfDictionary* Parent() const { |
532 SkPdfDictionary* ret; | 546 SkPdfDictionary* ret; |
533 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Paren
t", "", &ret)) return ret; | 547 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Paren
t", "", &ret)) return ret; |
534 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 548 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
535 return NULL; | 549 return NULL; |
536 } | 550 } |
537 | 551 |
| 552 /** (Required for all but the first item at each level; must be an indirect refe
rence) |
| 553 * The previous item at this outline level. |
| 554 **/ |
| 555 bool has_Prev() const { |
| 556 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Prev"
, "", NULL)); |
| 557 } |
| 558 |
538 SkPdfDictionary* Prev() const { | 559 SkPdfDictionary* Prev() const { |
539 SkPdfDictionary* ret; | 560 SkPdfDictionary* ret; |
540 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Prev"
, "", &ret)) return ret; | 561 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Prev"
, "", &ret)) return ret; |
541 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 562 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
542 return NULL; | 563 return NULL; |
543 } | 564 } |
544 | 565 |
| 566 /** (Required for all but the last item at each level; must be an indirect refer
ence) |
| 567 * The next item at this outline level. |
| 568 **/ |
| 569 bool has_Next() const { |
| 570 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Next"
, "", NULL)); |
| 571 } |
| 572 |
545 SkPdfDictionary* Next() const { | 573 SkPdfDictionary* Next() const { |
546 SkPdfDictionary* ret; | 574 SkPdfDictionary* ret; |
547 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Next"
, "", &ret)) return ret; | 575 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Next"
, "", &ret)) return ret; |
548 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 576 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
549 return NULL; | 577 return NULL; |
550 } | 578 } |
551 | 579 |
| 580 /** (Required if the item has any descendants; must be an indirect reference) Th
e |
| 581 * first of this item's immediate children in the outline hierarchy. |
| 582 **/ |
| 583 bool has_First() const { |
| 584 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "First
", "", NULL)); |
| 585 } |
| 586 |
552 SkPdfDictionary* First() const { | 587 SkPdfDictionary* First() const { |
553 SkPdfDictionary* ret; | 588 SkPdfDictionary* ret; |
554 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "First
", "", &ret)) return ret; | 589 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "First
", "", &ret)) return ret; |
555 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 590 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
556 return NULL; | 591 return NULL; |
557 } | 592 } |
558 | 593 |
| 594 /** (Required if the item has any descendants; must be an indirect reference) Th
e |
| 595 * last of this item's immediate children in the outline hierarchy. |
| 596 **/ |
| 597 bool has_Last() const { |
| 598 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Last"
, "", NULL)); |
| 599 } |
| 600 |
559 SkPdfDictionary* Last() const { | 601 SkPdfDictionary* Last() const { |
560 SkPdfDictionary* ret; | 602 SkPdfDictionary* ret; |
561 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Last"
, "", &ret)) return ret; | 603 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Last"
, "", &ret)) return ret; |
562 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 604 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
563 return NULL; | 605 return NULL; |
564 } | 606 } |
565 | 607 |
| 608 /** (Required if the item has any descendants) If the item is open, the total nu
m- |
| 609 * ber of its open descendants at all lower levels of the outline hierarchy. If
the |
| 610 * item is closed, a negative integer whose absolute value specifies how many |
| 611 * descendants would appear if the item were reopened. |
| 612 **/ |
| 613 bool has_Count() const { |
| 614 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Count
", "", NULL)); |
| 615 } |
| 616 |
566 long Count() const { | 617 long Count() const { |
567 long ret; | 618 long ret; |
568 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Count", "",
&ret)) return ret; | 619 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Count", "",
&ret)) return ret; |
569 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 620 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
570 return 0; | 621 return 0; |
571 } | 622 } |
572 | 623 |
| 624 /** (Optional; not permitted if an A entry is present) The destination to be |
| 625 * displayed when this item is activated (see Section 8.2.1, "Destinations"; se
e |
| 626 * also implementation note 56 in Appendix H). |
| 627 **/ |
| 628 bool has_Dest() const { |
| 629 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Dest"
, "", NULL)); |
| 630 } |
| 631 |
573 bool isDestAName() const { | 632 bool isDestAName() const { |
574 SkPdfObject* ret = NULL; | 633 SkPdfObject* ret = NULL; |
575 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Dest", "
", &ret)) return false; | 634 if (!ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Dest", "
", &ret)) return false; |
576 return ret->podofo()->GetDataType() == ePdfDataType_Name; | 635 return ret->podofo()->GetDataType() == ePdfDataType_Name; |
577 } | 636 } |
578 | 637 |
579 std::string getDestAsName() const { | 638 std::string getDestAsName() const { |
580 std::string ret = ""; | 639 std::string ret = ""; |
581 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Dest", "",
&ret)) return ret; | 640 if (NameFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Dest", "",
&ret)) return ret; |
582 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 641 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
(...skipping 19 matching lines...) Expand all Loading... |
602 return ret->podofo()->GetDataType() == ePdfDataType_Array; | 661 return ret->podofo()->GetDataType() == ePdfDataType_Array; |
603 } | 662 } |
604 | 663 |
605 SkPdfArray getDestAsArray() const { | 664 SkPdfArray getDestAsArray() const { |
606 SkPdfArray ret = SkPdfArray(); | 665 SkPdfArray ret = SkPdfArray(); |
607 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Dest", "",
&ret)) return ret; | 666 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "Dest", "",
&ret)) return ret; |
608 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 667 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
609 return SkPdfArray(); | 668 return SkPdfArray(); |
610 } | 669 } |
611 | 670 |
| 671 /** (Optional; PDF 1.1; not permitted if a Dest entry is present) The action to
be |
| 672 * performed when this item is activated (see Section 8.5, "Actions"). |
| 673 **/ |
| 674 bool has_A() const { |
| 675 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "A", "
", NULL)); |
| 676 } |
| 677 |
612 SkPdfDictionary* A() const { | 678 SkPdfDictionary* A() const { |
613 SkPdfDictionary* ret; | 679 SkPdfDictionary* ret; |
614 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "A", "
", &ret)) return ret; | 680 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "A", "
", &ret)) return ret; |
615 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 681 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
616 return NULL; | 682 return NULL; |
617 } | 683 } |
618 | 684 |
| 685 /** (Optional; PDF 1.3; must be an indirect reference) The structure element to |
| 686 * which the item refers (see Section 9.6.1, "Structure Hierarchy"). |
| 687 * Note: The ability to associate an outline item with a structure element (suc
h as |
| 688 * the beginning of a chapter) is a PDF 1.3 feature. For backward compatibility |
| 689 * with earlier PDF versions, such an item should also specify a destination (D
est) |
| 690 * corresponding to an area of a page where the contents of the designated stru
cture |
| 691 * element are displayed. |
| 692 **/ |
| 693 bool has_SE() const { |
| 694 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SE",
"", NULL)); |
| 695 } |
| 696 |
619 SkPdfDictionary* SE() const { | 697 SkPdfDictionary* SE() const { |
620 SkPdfDictionary* ret; | 698 SkPdfDictionary* ret; |
621 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SE",
"", &ret)) return ret; | 699 if (DictionaryFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "SE",
"", &ret)) return ret; |
622 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 700 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
623 return NULL; | 701 return NULL; |
624 } | 702 } |
625 | 703 |
| 704 /** (Optional; PDF 1.4) An array of three numbers in the range 0.0 to 1.0, repre
- |
| 705 * senting the components in the DeviceRGB color space of the color to be used |
| 706 * for the outline entry's text. Default value: [0.0 0.0 0.0]. |
| 707 **/ |
| 708 bool has_C() const { |
| 709 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "
", NULL)); |
| 710 } |
| 711 |
626 SkPdfArray C() const { | 712 SkPdfArray C() const { |
627 SkPdfArray ret; | 713 SkPdfArray ret; |
628 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "", &r
et)) return ret; | 714 if (ArrayFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "C", "", &r
et)) return ret; |
629 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 715 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
630 return SkPdfArray(); | 716 return SkPdfArray(); |
631 } | 717 } |
632 | 718 |
| 719 /** (Optional; PDF 1.4) A set of flags specifying style characteristics for disp
lay- |
| 720 * ing the outline item's text (see Table 8.5). Default value: 0. |
| 721 **/ |
| 722 bool has_F() const { |
| 723 return (ObjectFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", "
", NULL)); |
| 724 } |
| 725 |
633 long F() const { | 726 long F() const { |
634 long ret; | 727 long ret; |
635 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", "", &re
t)) return ret; | 728 if (LongFromDictionary(fPodofoDoc, fPodofoObj->GetDictionary(), "F", "", &re
t)) return ret; |
636 // TODO(edisonn): warn about missing required field, assert for known good p
dfs | 729 // TODO(edisonn): warn about missing required field, assert for known good p
dfs |
637 return 0; | 730 return 0; |
638 } | 731 } |
639 | 732 |
640 }; | 733 }; |
641 | 734 |
642 #endif // __DEFINED__SkPdfOutlineItemDictionary | 735 #endif // __DEFINED__SkPdfOutlineItemDictionary |
OLD | NEW |