OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../include/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../include/fsdk_mgr.h" | 8 #include "../include/fsdk_mgr.h" |
9 #include "../include/fsdk_baseannot.h" | 9 #include "../include/fsdk_baseannot.h" |
10 | 10 |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 557 |
558 void CPDFSDK_Annot::SetTabOrder(int iTabOrder) | 558 void CPDFSDK_Annot::SetTabOrder(int iTabOrder) |
559 { | 559 { |
560 m_nTabOrder = iTabOrder; | 560 m_nTabOrder = iTabOrder; |
561 } | 561 } |
562 | 562 |
563 CPDF_Dictionary* CPDFSDK_Annot::GetAnnotDict() const | 563 CPDF_Dictionary* CPDFSDK_Annot::GetAnnotDict() const |
564 { | 564 { |
565 ASSERT(m_pAnnot != NULL); | 565 ASSERT(m_pAnnot != NULL); |
566 | 566 |
567 » return m_pAnnot->m_pAnnotDict; | 567 » return m_pAnnot->GetAnnotDict(); |
568 } | 568 } |
569 | 569 |
570 void CPDFSDK_Annot::SetRect(const CPDF_Rect& rect) | 570 void CPDFSDK_Annot::SetRect(const CPDF_Rect& rect) |
571 { | 571 { |
572 ASSERT(m_pAnnot != NULL); | 572 ASSERT(m_pAnnot != NULL); |
573 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 573 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
574 ASSERT(rect.right - rect.left >= GetMinWidth()); | 574 ASSERT(rect.right - rect.left >= GetMinWidth()); |
575 ASSERT(rect.top - rect.bottom >= GetMinHeight()); | 575 ASSERT(rect.top - rect.bottom >= GetMinHeight()); |
576 | 576 |
577 » m_pAnnot->m_pAnnotDict->SetAtRect("Rect", rect); | 577 » m_pAnnot->GetAnnotDict()->SetAtRect("Rect", rect); |
578 } | 578 } |
579 | 579 |
580 CPDF_Rect CPDFSDK_Annot::GetRect() const | 580 CPDF_Rect CPDFSDK_Annot::GetRect() const |
581 { | 581 { |
582 ASSERT(m_pAnnot != NULL); | 582 ASSERT(m_pAnnot != NULL); |
583 | 583 |
584 CPDF_Rect rect; | 584 CPDF_Rect rect; |
585 m_pAnnot->GetRect(rect); | 585 m_pAnnot->GetRect(rect); |
586 | 586 |
587 return rect; | 587 return rect; |
(...skipping 16 matching lines...) Expand all Loading... |
604 { | 604 { |
605 ASSERT(m_pPageView != NULL); | 605 ASSERT(m_pPageView != NULL); |
606 ASSERT(m_pAnnot != NULL); | 606 ASSERT(m_pAnnot != NULL); |
607 | 607 |
608 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Devic
e, mode, pOptions); | 608 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Devic
e, mode, pOptions); |
609 } | 609 } |
610 | 610 |
611 FX_BOOL CPDFSDK_Annot::IsAppearanceValid() | 611 FX_BOOL CPDFSDK_Annot::IsAppearanceValid() |
612 { | 612 { |
613 ASSERT(m_pAnnot != NULL); | 613 ASSERT(m_pAnnot != NULL); |
614 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 614 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
615 | 615 |
616 » return m_pAnnot->m_pAnnotDict->GetDict("AP") != NULL; | 616 » return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; |
617 } | 617 } |
618 | 618 |
619 FX_BOOL CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) | 619 FX_BOOL CPDFSDK_Annot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) |
620 { | 620 { |
621 ASSERT(m_pAnnot != NULL); | 621 ASSERT(m_pAnnot != NULL); |
622 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 622 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
623 | 623 |
624 » CPDF_Dictionary* pAP = m_pAnnot->m_pAnnotDict->GetDict("AP"); | 624 » CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
625 if (pAP == NULL) return FALSE; | 625 if (pAP == NULL) return FALSE; |
626 | 626 |
627 // Choose the right sub-ap | 627 // Choose the right sub-ap |
628 const FX_CHAR* ap_entry = "N"; | 628 const FX_CHAR* ap_entry = "N"; |
629 if (mode == CPDF_Annot::Down) | 629 if (mode == CPDF_Annot::Down) |
630 ap_entry = "D"; | 630 ap_entry = "D"; |
631 else if (mode == CPDF_Annot::Rollover) | 631 else if (mode == CPDF_Annot::Rollover) |
632 ap_entry = "R"; | 632 ap_entry = "R"; |
633 if (!pAP->KeyExist(ap_entry)) | 633 if (!pAP->KeyExist(ap_entry)) |
634 ap_entry = "N"; | 634 ap_entry = "N"; |
(...skipping 14 matching lines...) Expand all Loading... |
649 | 649 |
650 void CPDFSDK_Annot::ClearCachedAP() | 650 void CPDFSDK_Annot::ClearCachedAP() |
651 { | 651 { |
652 ASSERT(m_pAnnot != NULL); | 652 ASSERT(m_pAnnot != NULL); |
653 m_pAnnot->ClearCachedAP(); | 653 m_pAnnot->ClearCachedAP(); |
654 } | 654 } |
655 | 655 |
656 void CPDFSDK_Annot::SetContents(const CFX_WideString& sContents) | 656 void CPDFSDK_Annot::SetContents(const CFX_WideString& sContents) |
657 { | 657 { |
658 ASSERT(m_pAnnot != NULL); | 658 ASSERT(m_pAnnot != NULL); |
659 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 659 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
660 | 660 |
661 if (sContents.IsEmpty()) | 661 if (sContents.IsEmpty()) |
662 » » m_pAnnot->m_pAnnotDict->RemoveAt("Contents"); | 662 » » m_pAnnot->GetAnnotDict()->RemoveAt("Contents"); |
663 else | 663 else |
664 » » m_pAnnot->m_pAnnotDict->SetAtString("Contents", PDF_EncodeText(s
Contents)); | 664 » » m_pAnnot->GetAnnotDict()->SetAtString("Contents", PDF_EncodeText
(sContents)); |
665 } | 665 } |
666 | 666 |
667 CFX_WideString CPDFSDK_Annot::GetContents() const | 667 CFX_WideString CPDFSDK_Annot::GetContents() const |
668 { | 668 { |
669 ASSERT(m_pAnnot != NULL); | 669 ASSERT(m_pAnnot != NULL); |
670 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 670 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
671 | 671 |
672 » return m_pAnnot->m_pAnnotDict->GetUnicodeText("Contents"); | 672 » return m_pAnnot->GetAnnotDict()->GetUnicodeText("Contents"); |
673 } | 673 } |
674 | 674 |
675 void CPDFSDK_Annot::SetAnnotName(const CFX_WideString& sName) | 675 void CPDFSDK_Annot::SetAnnotName(const CFX_WideString& sName) |
676 { | 676 { |
677 ASSERT(m_pAnnot != NULL); | 677 ASSERT(m_pAnnot != NULL); |
678 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 678 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
679 | 679 |
680 if (sName.IsEmpty()) | 680 if (sName.IsEmpty()) |
681 » » m_pAnnot->m_pAnnotDict->RemoveAt("NM"); | 681 » » m_pAnnot->GetAnnotDict()->RemoveAt("NM"); |
682 else | 682 else |
683 » » m_pAnnot->m_pAnnotDict->SetAtString("NM", PDF_EncodeText(sName))
; | 683 » » m_pAnnot->GetAnnotDict()->SetAtString("NM", PDF_EncodeText(sName
)); |
684 } | 684 } |
685 | 685 |
686 CFX_WideString CPDFSDK_Annot::GetAnnotName() const | 686 CFX_WideString CPDFSDK_Annot::GetAnnotName() const |
687 { | 687 { |
688 ASSERT(m_pAnnot != NULL); | 688 ASSERT(m_pAnnot != NULL); |
689 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 689 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
690 | 690 |
691 » return m_pAnnot->m_pAnnotDict->GetUnicodeText("NM"); | 691 » return m_pAnnot->GetAnnotDict()->GetUnicodeText("NM"); |
692 } | 692 } |
693 | 693 |
694 void CPDFSDK_Annot::SetModifiedDate(const FX_SYSTEMTIME& st) | 694 void CPDFSDK_Annot::SetModifiedDate(const FX_SYSTEMTIME& st) |
695 { | 695 { |
696 ASSERT(m_pAnnot != NULL); | 696 ASSERT(m_pAnnot != NULL); |
697 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 697 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
698 | 698 |
699 CPDFSDK_DateTime dt(st); | 699 CPDFSDK_DateTime dt(st); |
700 CFX_ByteString str = dt.ToPDFDateTimeString(); | 700 CFX_ByteString str = dt.ToPDFDateTimeString(); |
701 | 701 |
702 if (str.IsEmpty()) | 702 if (str.IsEmpty()) |
703 » » m_pAnnot->m_pAnnotDict->RemoveAt("M"); | 703 » » m_pAnnot->GetAnnotDict()->RemoveAt("M"); |
704 else | 704 else |
705 » » m_pAnnot->m_pAnnotDict->SetAtString("M", str); | 705 » » m_pAnnot->GetAnnotDict()->SetAtString("M", str); |
706 } | 706 } |
707 | 707 |
708 FX_SYSTEMTIME CPDFSDK_Annot::GetModifiedDate() const | 708 FX_SYSTEMTIME CPDFSDK_Annot::GetModifiedDate() const |
709 { | 709 { |
710 ASSERT(m_pAnnot != NULL); | 710 ASSERT(m_pAnnot != NULL); |
711 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 711 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
712 | 712 |
713 FX_SYSTEMTIME systime; | 713 FX_SYSTEMTIME systime; |
714 » CFX_ByteString str = m_pAnnot->m_pAnnotDict->GetString("M"); | 714 » CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetString("M"); |
715 | 715 |
716 CPDFSDK_DateTime dt(str); | 716 CPDFSDK_DateTime dt(str); |
717 dt.ToSystemTime(systime); | 717 dt.ToSystemTime(systime); |
718 | 718 |
719 return systime; | 719 return systime; |
720 } | 720 } |
721 | 721 |
722 void CPDFSDK_Annot::SetFlags(int nFlags) | 722 void CPDFSDK_Annot::SetFlags(int nFlags) |
723 { | 723 { |
724 ASSERT(m_pAnnot != NULL); | 724 ASSERT(m_pAnnot != NULL); |
725 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 725 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
726 | 726 |
727 » m_pAnnot->m_pAnnotDict->SetAtInteger("F", nFlags); | 727 » m_pAnnot->GetAnnotDict()->SetAtInteger("F", nFlags); |
728 } | 728 } |
729 | 729 |
730 int CPDFSDK_Annot::GetFlags() const | 730 int CPDFSDK_Annot::GetFlags() const |
731 { | 731 { |
732 ASSERT(m_pAnnot != NULL); | 732 ASSERT(m_pAnnot != NULL); |
733 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 733 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
734 | 734 |
735 » return m_pAnnot->m_pAnnotDict->GetInteger("F"); | 735 » return m_pAnnot->GetAnnotDict()->GetInteger("F"); |
736 } | 736 } |
737 | 737 |
738 void CPDFSDK_Annot::SetAppState(const CFX_ByteString& str) | 738 void CPDFSDK_Annot::SetAppState(const CFX_ByteString& str) |
739 { | 739 { |
740 ASSERT(m_pAnnot != NULL); | 740 ASSERT(m_pAnnot != NULL); |
741 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 741 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
742 | 742 |
743 if (str.IsEmpty()) | 743 if (str.IsEmpty()) |
744 » » m_pAnnot->m_pAnnotDict->RemoveAt("AS"); | 744 » » m_pAnnot->GetAnnotDict()->RemoveAt("AS"); |
745 else | 745 else |
746 » » m_pAnnot->m_pAnnotDict->SetAtString("AS", str); | 746 » » m_pAnnot->GetAnnotDict()->SetAtString("AS", str); |
747 } | 747 } |
748 | 748 |
749 CFX_ByteString CPDFSDK_Annot::GetAppState() const | 749 CFX_ByteString CPDFSDK_Annot::GetAppState() const |
750 { | 750 { |
751 ASSERT(m_pAnnot != NULL); | 751 ASSERT(m_pAnnot != NULL); |
752 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 752 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
753 | 753 |
754 » return m_pAnnot->m_pAnnotDict->GetString("AS"); | 754 » return m_pAnnot->GetAnnotDict()->GetString("AS"); |
755 } | 755 } |
756 | 756 |
757 void CPDFSDK_Annot::SetStructParent(int key) | 757 void CPDFSDK_Annot::SetStructParent(int key) |
758 { | 758 { |
759 ASSERT(m_pAnnot != NULL); | 759 ASSERT(m_pAnnot != NULL); |
760 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 760 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
761 | 761 |
762 » m_pAnnot->m_pAnnotDict->SetAtInteger("StructParent", key); | 762 » m_pAnnot->GetAnnotDict()->SetAtInteger("StructParent", key); |
763 } | 763 } |
764 | 764 |
765 int CPDFSDK_Annot::GetStructParent() const | 765 int CPDFSDK_Annot::GetStructParent() const |
766 { | 766 { |
767 ASSERT(m_pAnnot != NULL); | 767 ASSERT(m_pAnnot != NULL); |
768 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 768 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
769 | 769 |
770 » return m_pAnnot->m_pAnnotDict->GetInteger("StructParent"); | 770 » return m_pAnnot->GetAnnotDict()->GetInteger("StructParent"); |
771 } | 771 } |
772 | 772 |
773 //border | 773 //border |
774 void CPDFSDK_Annot::SetBorderWidth(int nWidth) | 774 void CPDFSDK_Annot::SetBorderWidth(int nWidth) |
775 { | 775 { |
776 ASSERT(m_pAnnot != NULL); | 776 ASSERT(m_pAnnot != NULL); |
777 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 777 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
778 | 778 |
779 » CPDF_Array* pBorder = m_pAnnot->m_pAnnotDict->GetArray("Border"); | 779 » CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); |
780 | 780 |
781 if (pBorder) | 781 if (pBorder) |
782 { | 782 { |
783 pBorder->SetAt(2, new CPDF_Number(nWidth)); | 783 pBorder->SetAt(2, new CPDF_Number(nWidth)); |
784 } | 784 } |
785 else | 785 else |
786 { | 786 { |
787 » » CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS")
; | 787 » » CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS
"); |
788 | 788 |
789 if (!pBSDict) | 789 if (!pBSDict) |
790 { | 790 { |
791 pBSDict = new CPDF_Dictionary; | 791 pBSDict = new CPDF_Dictionary; |
792 » » » m_pAnnot->m_pAnnotDict->SetAt("BS", pBSDict); | 792 » » » m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
793 } | 793 } |
794 | 794 |
795 pBSDict->SetAtInteger("W", nWidth); | 795 pBSDict->SetAtInteger("W", nWidth); |
796 } | 796 } |
797 } | 797 } |
798 | 798 |
799 int CPDFSDK_Annot::GetBorderWidth() const | 799 int CPDFSDK_Annot::GetBorderWidth() const |
800 { | 800 { |
801 ASSERT(m_pAnnot != NULL); | 801 ASSERT(m_pAnnot != NULL); |
802 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 802 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
803 | 803 |
804 » CPDF_Array* pBorder = m_pAnnot->m_pAnnotDict->GetArray("Border"); | 804 » CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); |
805 | 805 |
806 if (pBorder) | 806 if (pBorder) |
807 { | 807 { |
808 return pBorder->GetInteger(2); | 808 return pBorder->GetInteger(2); |
809 } | 809 } |
810 else | 810 else |
811 { | 811 { |
812 » » CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS")
; | 812 » » CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS
"); |
813 | 813 |
814 if (pBSDict) | 814 if (pBSDict) |
815 { | 815 { |
816 return pBSDict->GetInteger("W", 1); | 816 return pBSDict->GetInteger("W", 1); |
817 } | 817 } |
818 } | 818 } |
819 return 1; | 819 return 1; |
820 } | 820 } |
821 | 821 |
822 void CPDFSDK_Annot::SetBorderStyle(int nStyle) | 822 void CPDFSDK_Annot::SetBorderStyle(int nStyle) |
823 { | 823 { |
824 ASSERT(m_pAnnot != NULL); | 824 ASSERT(m_pAnnot != NULL); |
825 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 825 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
826 | 826 |
827 » CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS"); | 827 » CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); |
828 if (!pBSDict) | 828 if (!pBSDict) |
829 { | 829 { |
830 pBSDict = new CPDF_Dictionary; | 830 pBSDict = new CPDF_Dictionary; |
831 » » m_pAnnot->m_pAnnotDict->SetAt("BS", pBSDict); | 831 » » m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
832 } | 832 } |
833 | 833 |
834 switch (nStyle) | 834 switch (nStyle) |
835 { | 835 { |
836 case BBS_SOLID: | 836 case BBS_SOLID: |
837 pBSDict->SetAtName("S", "S"); | 837 pBSDict->SetAtName("S", "S"); |
838 break; | 838 break; |
839 case BBS_DASH: | 839 case BBS_DASH: |
840 pBSDict->SetAtName("S", "D"); | 840 pBSDict->SetAtName("S", "D"); |
841 break; | 841 break; |
842 case BBS_BEVELED: | 842 case BBS_BEVELED: |
843 pBSDict->SetAtName("S", "B"); | 843 pBSDict->SetAtName("S", "B"); |
844 break; | 844 break; |
845 case BBS_INSET: | 845 case BBS_INSET: |
846 pBSDict->SetAtName("S", "I"); | 846 pBSDict->SetAtName("S", "I"); |
847 break; | 847 break; |
848 case BBS_UNDERLINE: | 848 case BBS_UNDERLINE: |
849 pBSDict->SetAtName("S", "U"); | 849 pBSDict->SetAtName("S", "U"); |
850 break; | 850 break; |
851 } | 851 } |
852 } | 852 } |
853 | 853 |
854 int CPDFSDK_Annot::GetBorderStyle() const | 854 int CPDFSDK_Annot::GetBorderStyle() const |
855 { | 855 { |
856 ASSERT(m_pAnnot != NULL); | 856 ASSERT(m_pAnnot != NULL); |
857 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 857 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
858 | 858 |
859 » CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS"); | 859 » CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); |
860 if (pBSDict) | 860 if (pBSDict) |
861 { | 861 { |
862 CFX_ByteString sBorderStyle = pBSDict->GetString("S", "S"); | 862 CFX_ByteString sBorderStyle = pBSDict->GetString("S", "S"); |
863 if (sBorderStyle == "S") return BBS_SOLID; | 863 if (sBorderStyle == "S") return BBS_SOLID; |
864 if (sBorderStyle == "D") return BBS_DASH; | 864 if (sBorderStyle == "D") return BBS_DASH; |
865 if (sBorderStyle == "B") return BBS_BEVELED; | 865 if (sBorderStyle == "B") return BBS_BEVELED; |
866 if (sBorderStyle == "I") return BBS_INSET; | 866 if (sBorderStyle == "I") return BBS_INSET; |
867 if (sBorderStyle == "U") return BBS_UNDERLINE; | 867 if (sBorderStyle == "U") return BBS_UNDERLINE; |
868 } | 868 } |
869 | 869 |
870 » CPDF_Array* pBorder = m_pAnnot->m_pAnnotDict->GetArray("Border"); | 870 » CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); |
871 if (pBorder) | 871 if (pBorder) |
872 { | 872 { |
873 if (pBorder->GetCount() >= 4) | 873 if (pBorder->GetCount() >= 4) |
874 { | 874 { |
875 CPDF_Array *pDP = pBorder->GetArray(3); | 875 CPDF_Array *pDP = pBorder->GetArray(3); |
876 if (pDP && pDP->GetCount() > 0) | 876 if (pDP && pDP->GetCount() > 0) |
877 return BBS_DASH; | 877 return BBS_DASH; |
878 } | 878 } |
879 } | 879 } |
880 | 880 |
881 return BBS_SOLID; | 881 return BBS_SOLID; |
882 } | 882 } |
883 | 883 |
884 void CPDFSDK_Annot::SetBorderDash(const CFX_IntArray& array) | 884 void CPDFSDK_Annot::SetBorderDash(const CFX_IntArray& array) |
885 { | 885 { |
886 ASSERT(m_pAnnot != NULL); | 886 ASSERT(m_pAnnot != NULL); |
887 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 887 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
888 | 888 |
889 » CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS"); | 889 » CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); |
890 if (!pBSDict) | 890 if (!pBSDict) |
891 { | 891 { |
892 pBSDict = new CPDF_Dictionary; | 892 pBSDict = new CPDF_Dictionary; |
893 » » m_pAnnot->m_pAnnotDict->SetAt("BS", pBSDict); | 893 » » m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
894 } | 894 } |
895 | 895 |
896 CPDF_Array* pArray = new CPDF_Array; | 896 CPDF_Array* pArray = new CPDF_Array; |
897 for (int i=0,sz=array.GetSize(); i<sz; i++) | 897 for (int i=0,sz=array.GetSize(); i<sz; i++) |
898 { | 898 { |
899 pArray->AddInteger(array[i]); | 899 pArray->AddInteger(array[i]); |
900 } | 900 } |
901 | 901 |
902 pBSDict->SetAt("D", pArray); | 902 pBSDict->SetAt("D", pArray); |
903 } | 903 } |
904 | 904 |
905 void CPDFSDK_Annot::GetBorderDash(CFX_IntArray& array) const | 905 void CPDFSDK_Annot::GetBorderDash(CFX_IntArray& array) const |
906 { | 906 { |
907 ASSERT(m_pAnnot != NULL); | 907 ASSERT(m_pAnnot != NULL); |
908 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 908 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
909 | 909 |
910 CPDF_Array* pDash = NULL; | 910 CPDF_Array* pDash = NULL; |
911 | 911 |
912 » CPDF_Array* pBorder = m_pAnnot->m_pAnnotDict->GetArray("Border"); | 912 » CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); |
913 if (pBorder) | 913 if (pBorder) |
914 { | 914 { |
915 pDash = pBorder->GetArray(3); | 915 pDash = pBorder->GetArray(3); |
916 } | 916 } |
917 else | 917 else |
918 { | 918 { |
919 » » CPDF_Dictionary* pBSDict = m_pAnnot->m_pAnnotDict->GetDict("BS")
; | 919 » » CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS
"); |
920 if (pBSDict) | 920 if (pBSDict) |
921 { | 921 { |
922 pDash = pBSDict->GetArray("D"); | 922 pDash = pBSDict->GetArray("D"); |
923 } | 923 } |
924 } | 924 } |
925 | 925 |
926 if (pDash) | 926 if (pDash) |
927 { | 927 { |
928 for (int i=0,sz=pDash->GetCount(); i<sz; i++) | 928 for (int i=0,sz=pDash->GetCount(); i<sz; i++) |
929 { | 929 { |
930 array.Add(pDash->GetInteger(i)); | 930 array.Add(pDash->GetInteger(i)); |
931 } | 931 } |
932 } | 932 } |
933 } | 933 } |
934 | 934 |
935 void CPDFSDK_Annot::SetColor(FX_COLORREF color) | 935 void CPDFSDK_Annot::SetColor(FX_COLORREF color) |
936 { | 936 { |
937 ASSERT(m_pAnnot != NULL); | 937 ASSERT(m_pAnnot != NULL); |
938 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 938 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
939 | 939 |
940 CPDF_Array* pArray = new CPDF_Array; | 940 CPDF_Array* pArray = new CPDF_Array; |
941 pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); | 941 pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); |
942 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); | 942 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); |
943 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); | 943 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); |
944 » m_pAnnot->m_pAnnotDict->SetAt("C", pArray); | 944 » m_pAnnot->GetAnnotDict()->SetAt("C", pArray); |
945 } | 945 } |
946 | 946 |
947 void CPDFSDK_Annot::RemoveColor() | 947 void CPDFSDK_Annot::RemoveColor() |
948 { | 948 { |
949 ASSERT(m_pAnnot != NULL); | 949 ASSERT(m_pAnnot != NULL); |
950 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 950 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
951 | 951 |
952 » m_pAnnot->m_pAnnotDict->RemoveAt("C") ; | 952 » m_pAnnot->GetAnnotDict()->RemoveAt("C"); |
953 } | 953 } |
954 | 954 |
955 FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const | 955 FX_BOOL CPDFSDK_Annot::GetColor(FX_COLORREF& color) const |
956 { | 956 { |
957 ASSERT(m_pAnnot != NULL); | 957 ASSERT(m_pAnnot != NULL); |
958 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 958 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
959 | 959 |
960 » if (CPDF_Array* pEntry = m_pAnnot->m_pAnnotDict->GetArray("C"))»» | 960 » if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C")) |
961 { | 961 { |
962 int nCount = pEntry->GetCount(); | 962 int nCount = pEntry->GetCount(); |
963 if (nCount == 1) | 963 if (nCount == 1) |
964 { | 964 { |
965 FX_FLOAT g = pEntry->GetNumber(0) * 255; | 965 FX_FLOAT g = pEntry->GetNumber(0) * 255; |
966 | 966 |
967 color = FXSYS_RGB((int)g, (int)g, (int)g); | 967 color = FXSYS_RGB((int)g, (int)g, (int)g); |
968 | 968 |
969 return TRUE; | 969 return TRUE; |
970 } | 970 } |
(...skipping 26 matching lines...) Expand all Loading... |
997 | 997 |
998 return FALSE; | 998 return FALSE; |
999 } | 999 } |
1000 | 1000 |
1001 | 1001 |
1002 void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re
ct& rcBBox, | 1002 void CPDFSDK_Annot::WriteAppearance(const CFX_ByteString& sAPType, const CPDF_Re
ct& rcBBox, |
1003 const CPDF_Matri
x& matrix, const CFX_ByteString& sContents, | 1003 const CPDF_Matri
x& matrix, const CFX_ByteString& sContents, |
1004 const CFX_ByteSt
ring& sAPState) | 1004 const CFX_ByteSt
ring& sAPState) |
1005 { | 1005 { |
1006 ASSERT(m_pAnnot != NULL); | 1006 ASSERT(m_pAnnot != NULL); |
1007 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 1007 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
1008 | 1008 |
1009 » CPDF_Dictionary* pAPDict = m_pAnnot->m_pAnnotDict->GetDict("AP"); | 1009 » CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); |
1010 | 1010 |
1011 if (!pAPDict) | 1011 if (!pAPDict) |
1012 { | 1012 { |
1013 pAPDict = new CPDF_Dictionary; | 1013 pAPDict = new CPDF_Dictionary; |
1014 » » m_pAnnot->m_pAnnotDict->SetAt("AP", pAPDict); | 1014 » » m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); |
1015 } | 1015 } |
1016 | 1016 |
1017 CPDF_Stream* pStream = NULL; | 1017 CPDF_Stream* pStream = NULL; |
1018 CPDF_Dictionary* pParentDict = NULL; | 1018 CPDF_Dictionary* pParentDict = NULL; |
1019 | 1019 |
1020 if (sAPState.IsEmpty()) | 1020 if (sAPState.IsEmpty()) |
1021 { | 1021 { |
1022 pParentDict = pAPDict; | 1022 pParentDict = pAPDict; |
1023 pStream = pAPDict->GetStream(sAPType); | 1023 pStream = pAPDict->GetStream(sAPType); |
1024 } | 1024 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 return TRUE; | 1080 return TRUE; |
1081 } | 1081 } |
1082 FX_BOOL CPDFSDK_Annot::IsVisible() const | 1082 FX_BOOL CPDFSDK_Annot::IsVisible() const |
1083 { | 1083 { |
1084 int nFlags = GetFlags(); | 1084 int nFlags = GetFlags(); |
1085 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) |
| (nFlags & ANNOTFLAG_NOVIEW)); | 1085 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) |
| (nFlags & ANNOTFLAG_NOVIEW)); |
1086 } | 1086 } |
1087 | 1087 |
1088 CPDF_Action CPDFSDK_Annot::GetAction() const | 1088 CPDF_Action CPDFSDK_Annot::GetAction() const |
1089 { | 1089 { |
1090 » return CPDF_Action(m_pAnnot->m_pAnnotDict->GetDict("A")); | 1090 » return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A")); |
1091 } | 1091 } |
1092 | 1092 |
1093 void CPDFSDK_Annot::SetAction(const CPDF_Action& action) | 1093 void CPDFSDK_Annot::SetAction(const CPDF_Action& action) |
1094 { | 1094 { |
1095 ASSERT(action); | 1095 ASSERT(action); |
1096 » if ((CPDF_Action&)action != CPDF_Action(m_pAnnot->m_pAnnotDict->GetDict(
"A"))) | 1096 » if ((CPDF_Action&)action != CPDF_Action(m_pAnnot->GetAnnotDict()->GetDic
t("A"))) |
1097 { | 1097 { |
1098 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); | 1098 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
1099 CPDF_Dictionary* pDict = action.GetDict(); | 1099 CPDF_Dictionary* pDict = action.GetDict(); |
1100 if (pDict && pDict->GetObjNum() == 0) { | 1100 if (pDict && pDict->GetObjNum() == 0) { |
1101 pDoc->AddIndirectObject(pDict); | 1101 pDoc->AddIndirectObject(pDict); |
1102 } | 1102 } |
1103 » » m_pAnnot->m_pAnnotDict->SetAtReference("A", pDoc, pDict->GetObjN
um()); | 1103 » » m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetOb
jNum()); |
1104 } | 1104 } |
1105 } | 1105 } |
1106 | 1106 |
1107 void CPDFSDK_Annot::RemoveAction() | 1107 void CPDFSDK_Annot::RemoveAction() |
1108 { | 1108 { |
1109 » m_pAnnot->m_pAnnotDict->RemoveAt("A"); | 1109 » m_pAnnot->GetAnnotDict()->RemoveAt("A"); |
1110 } | 1110 } |
1111 | 1111 |
1112 CPDF_AAction CPDFSDK_Annot::GetAAction() const | 1112 CPDF_AAction CPDFSDK_Annot::GetAAction() const |
1113 { | 1113 { |
1114 » return m_pAnnot->m_pAnnotDict->GetDict("AA"); | 1114 » return m_pAnnot->GetAnnotDict()->GetDict("AA"); |
1115 } | 1115 } |
1116 | 1116 |
1117 void CPDFSDK_Annot::SetAAction(const CPDF_AAction& aa) | 1117 void CPDFSDK_Annot::SetAAction(const CPDF_AAction& aa) |
1118 { | 1118 { |
1119 ASSERT(m_pAnnot != NULL); | 1119 ASSERT(m_pAnnot != NULL); |
1120 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 1120 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
1121 ASSERT(aa != NULL); | 1121 ASSERT(aa != NULL); |
1122 | 1122 |
1123 » if ((CPDF_AAction&)aa != m_pAnnot->m_pAnnotDict->GetDict("AA")) | 1123 » if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA")) |
1124 » » m_pAnnot->m_pAnnotDict->SetAt("AA", (CPDF_AAction&)aa); | 1124 » » m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); |
1125 } | 1125 } |
1126 | 1126 |
1127 void CPDFSDK_Annot::RemoveAAction() | 1127 void CPDFSDK_Annot::RemoveAAction() |
1128 { | 1128 { |
1129 ASSERT(m_pAnnot != NULL); | 1129 ASSERT(m_pAnnot != NULL); |
1130 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 1130 » ASSERT(m_pAnnot->GetAnnotDict() != NULL); |
1131 | 1131 |
1132 » m_pAnnot->m_pAnnotDict->RemoveAt("AA"); | 1132 » m_pAnnot->GetAnnotDict()->RemoveAt("AA"); |
1133 } | 1133 } |
1134 | 1134 |
1135 CPDF_Action CPDFSDK_Annot::GetAAction(CPDF_AAction::AActionType eAAT) | 1135 CPDF_Action CPDFSDK_Annot::GetAAction(CPDF_AAction::AActionType eAAT) |
1136 { | 1136 { |
1137 CPDF_AAction AAction = GetAAction(); | 1137 CPDF_AAction AAction = GetAAction(); |
1138 | 1138 |
1139 if (AAction.ActionExist(eAAT)) | 1139 if (AAction.ActionExist(eAAT)) |
1140 return AAction.GetAction(eAAT); | 1140 return AAction.GetAction(eAAT); |
1141 | 1141 |
1142 if (eAAT == CPDF_AAction::ButtonUp) | 1142 if (eAAT == CPDF_AAction::ButtonUp) |
(...skipping 11 matching lines...) Expand all Loading... |
1154 return ; | 1154 return ; |
1155 } | 1155 } |
1156 | 1156 |
1157 CPDF_Page* CPDFSDK_Annot::GetPDFPage() | 1157 CPDF_Page* CPDFSDK_Annot::GetPDFPage() |
1158 { | 1158 { |
1159 if(m_pPageView) | 1159 if(m_pPageView) |
1160 return m_pPageView->GetPDFPage(); | 1160 return m_pPageView->GetPDFPage(); |
1161 return NULL; | 1161 return NULL; |
1162 } | 1162 } |
1163 | 1163 |
OLD | NEW |