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