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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "core/include/fxcrt/fx_ext.h" | 9 #include "core/include/fxcrt/fx_ext.h" |
10 #include "fpdfsdk/include/fsdk_baseannot.h" | 10 #include "fpdfsdk/include/fsdk_baseannot.h" |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 | 556 |
557 void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, | 557 void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, |
558 const CFX_Matrix* pUser2Device, | 558 const CFX_Matrix* pUser2Device, |
559 CPDF_Annot::AppearanceMode mode, | 559 CPDF_Annot::AppearanceMode mode, |
560 const CPDF_RenderOptions* pOptions) { | 560 const CPDF_RenderOptions* pOptions) { |
561 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, | 561 m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device, |
562 mode, pOptions); | 562 mode, pOptions); |
563 } | 563 } |
564 | 564 |
565 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { | 565 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() { |
566 return m_pAnnot->GetAnnotDict()->GetDict("AP") != NULL; | 566 return m_pAnnot->GetAnnotDict()->GetDictBy("AP") != NULL; |
567 } | 567 } |
568 | 568 |
569 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { | 569 FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) { |
570 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDict("AP"); | 570 CPDF_Dictionary* pAP = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); |
571 if (!pAP) | 571 if (!pAP) |
572 return FALSE; | 572 return FALSE; |
573 | 573 |
574 // Choose the right sub-ap | 574 // Choose the right sub-ap |
575 const FX_CHAR* ap_entry = "N"; | 575 const FX_CHAR* ap_entry = "N"; |
576 if (mode == CPDF_Annot::Down) | 576 if (mode == CPDF_Annot::Down) |
577 ap_entry = "D"; | 577 ap_entry = "D"; |
578 else if (mode == CPDF_Annot::Rollover) | 578 else if (mode == CPDF_Annot::Rollover) |
579 ap_entry = "R"; | 579 ap_entry = "R"; |
580 if (!pAP->KeyExist(ap_entry)) | 580 if (!pAP->KeyExist(ap_entry)) |
(...skipping 16 matching lines...) Expand all Loading... |
597 | 597 |
598 void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) { | 598 void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) { |
599 if (sContents.IsEmpty()) | 599 if (sContents.IsEmpty()) |
600 m_pAnnot->GetAnnotDict()->RemoveAt("Contents"); | 600 m_pAnnot->GetAnnotDict()->RemoveAt("Contents"); |
601 else | 601 else |
602 m_pAnnot->GetAnnotDict()->SetAtString("Contents", | 602 m_pAnnot->GetAnnotDict()->SetAtString("Contents", |
603 PDF_EncodeText(sContents)); | 603 PDF_EncodeText(sContents)); |
604 } | 604 } |
605 | 605 |
606 CFX_WideString CPDFSDK_BAAnnot::GetContents() const { | 606 CFX_WideString CPDFSDK_BAAnnot::GetContents() const { |
607 return m_pAnnot->GetAnnotDict()->GetUnicodeText("Contents"); | 607 return m_pAnnot->GetAnnotDict()->GetUnicodeTextBy("Contents"); |
608 } | 608 } |
609 | 609 |
610 void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) { | 610 void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) { |
611 if (sName.IsEmpty()) | 611 if (sName.IsEmpty()) |
612 m_pAnnot->GetAnnotDict()->RemoveAt("NM"); | 612 m_pAnnot->GetAnnotDict()->RemoveAt("NM"); |
613 else | 613 else |
614 m_pAnnot->GetAnnotDict()->SetAtString("NM", PDF_EncodeText(sName)); | 614 m_pAnnot->GetAnnotDict()->SetAtString("NM", PDF_EncodeText(sName)); |
615 } | 615 } |
616 | 616 |
617 CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const { | 617 CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const { |
618 return m_pAnnot->GetAnnotDict()->GetUnicodeText("NM"); | 618 return m_pAnnot->GetAnnotDict()->GetUnicodeTextBy("NM"); |
619 } | 619 } |
620 | 620 |
621 void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) { | 621 void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) { |
622 CPDFSDK_DateTime dt(st); | 622 CPDFSDK_DateTime dt(st); |
623 CFX_ByteString str = dt.ToPDFDateTimeString(); | 623 CFX_ByteString str = dt.ToPDFDateTimeString(); |
624 | 624 |
625 if (str.IsEmpty()) | 625 if (str.IsEmpty()) |
626 m_pAnnot->GetAnnotDict()->RemoveAt("M"); | 626 m_pAnnot->GetAnnotDict()->RemoveAt("M"); |
627 else | 627 else |
628 m_pAnnot->GetAnnotDict()->SetAtString("M", str); | 628 m_pAnnot->GetAnnotDict()->SetAtString("M", str); |
629 } | 629 } |
630 | 630 |
631 FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const { | 631 FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const { |
632 FX_SYSTEMTIME systime; | 632 FX_SYSTEMTIME systime; |
633 CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetString("M"); | 633 CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringBy("M"); |
634 | 634 |
635 CPDFSDK_DateTime dt(str); | 635 CPDFSDK_DateTime dt(str); |
636 dt.ToSystemTime(systime); | 636 dt.ToSystemTime(systime); |
637 | 637 |
638 return systime; | 638 return systime; |
639 } | 639 } |
640 | 640 |
641 void CPDFSDK_BAAnnot::SetFlags(int nFlags) { | 641 void CPDFSDK_BAAnnot::SetFlags(int nFlags) { |
642 m_pAnnot->GetAnnotDict()->SetAtInteger("F", nFlags); | 642 m_pAnnot->GetAnnotDict()->SetAtInteger("F", nFlags); |
643 } | 643 } |
644 | 644 |
645 int CPDFSDK_BAAnnot::GetFlags() const { | 645 int CPDFSDK_BAAnnot::GetFlags() const { |
646 return m_pAnnot->GetAnnotDict()->GetInteger("F"); | 646 return m_pAnnot->GetAnnotDict()->GetIntegerBy("F"); |
647 } | 647 } |
648 | 648 |
649 void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) { | 649 void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) { |
650 if (str.IsEmpty()) | 650 if (str.IsEmpty()) |
651 m_pAnnot->GetAnnotDict()->RemoveAt("AS"); | 651 m_pAnnot->GetAnnotDict()->RemoveAt("AS"); |
652 else | 652 else |
653 m_pAnnot->GetAnnotDict()->SetAtString("AS", str); | 653 m_pAnnot->GetAnnotDict()->SetAtString("AS", str); |
654 } | 654 } |
655 | 655 |
656 CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const { | 656 CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const { |
657 return m_pAnnot->GetAnnotDict()->GetString("AS"); | 657 return m_pAnnot->GetAnnotDict()->GetStringBy("AS"); |
658 } | 658 } |
659 | 659 |
660 void CPDFSDK_BAAnnot::SetStructParent(int key) { | 660 void CPDFSDK_BAAnnot::SetStructParent(int key) { |
661 m_pAnnot->GetAnnotDict()->SetAtInteger("StructParent", key); | 661 m_pAnnot->GetAnnotDict()->SetAtInteger("StructParent", key); |
662 } | 662 } |
663 | 663 |
664 int CPDFSDK_BAAnnot::GetStructParent() const { | 664 int CPDFSDK_BAAnnot::GetStructParent() const { |
665 return m_pAnnot->GetAnnotDict()->GetInteger("StructParent"); | 665 return m_pAnnot->GetAnnotDict()->GetIntegerBy("StructParent"); |
666 } | 666 } |
667 | 667 |
668 // border | 668 // border |
669 void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) { | 669 void CPDFSDK_BAAnnot::SetBorderWidth(int nWidth) { |
670 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); | 670 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border"); |
671 | 671 |
672 if (pBorder) { | 672 if (pBorder) { |
673 pBorder->SetAt(2, new CPDF_Number(nWidth)); | 673 pBorder->SetAt(2, new CPDF_Number(nWidth)); |
674 } else { | 674 } else { |
675 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); | 675 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); |
676 | 676 |
677 if (!pBSDict) { | 677 if (!pBSDict) { |
678 pBSDict = new CPDF_Dictionary; | 678 pBSDict = new CPDF_Dictionary; |
679 m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); | 679 m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
680 } | 680 } |
681 | 681 |
682 pBSDict->SetAtInteger("W", nWidth); | 682 pBSDict->SetAtInteger("W", nWidth); |
683 } | 683 } |
684 } | 684 } |
685 | 685 |
686 int CPDFSDK_BAAnnot::GetBorderWidth() const { | 686 int CPDFSDK_BAAnnot::GetBorderWidth() const { |
687 if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border")) { | 687 if (CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border")) { |
688 return pBorder->GetInteger(2); | 688 return pBorder->GetIntegerAt(2); |
689 } | 689 } |
690 if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS")) { | 690 if (CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS")) { |
691 return pBSDict->GetInteger("W", 1); | 691 return pBSDict->GetIntegerBy("W", 1); |
692 } | 692 } |
693 return 1; | 693 return 1; |
694 } | 694 } |
695 | 695 |
696 void CPDFSDK_BAAnnot::SetBorderStyle(int nStyle) { | 696 void CPDFSDK_BAAnnot::SetBorderStyle(int nStyle) { |
697 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); | 697 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); |
698 if (!pBSDict) { | 698 if (!pBSDict) { |
699 pBSDict = new CPDF_Dictionary; | 699 pBSDict = new CPDF_Dictionary; |
700 m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); | 700 m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
701 } | 701 } |
702 | 702 |
703 switch (nStyle) { | 703 switch (nStyle) { |
704 case BBS_SOLID: | 704 case BBS_SOLID: |
705 pBSDict->SetAtName("S", "S"); | 705 pBSDict->SetAtName("S", "S"); |
706 break; | 706 break; |
707 case BBS_DASH: | 707 case BBS_DASH: |
708 pBSDict->SetAtName("S", "D"); | 708 pBSDict->SetAtName("S", "D"); |
709 break; | 709 break; |
710 case BBS_BEVELED: | 710 case BBS_BEVELED: |
711 pBSDict->SetAtName("S", "B"); | 711 pBSDict->SetAtName("S", "B"); |
712 break; | 712 break; |
713 case BBS_INSET: | 713 case BBS_INSET: |
714 pBSDict->SetAtName("S", "I"); | 714 pBSDict->SetAtName("S", "I"); |
715 break; | 715 break; |
716 case BBS_UNDERLINE: | 716 case BBS_UNDERLINE: |
717 pBSDict->SetAtName("S", "U"); | 717 pBSDict->SetAtName("S", "U"); |
718 break; | 718 break; |
719 } | 719 } |
720 } | 720 } |
721 | 721 |
722 int CPDFSDK_BAAnnot::GetBorderStyle() const { | 722 int CPDFSDK_BAAnnot::GetBorderStyle() const { |
723 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); | 723 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); |
724 if (pBSDict) { | 724 if (pBSDict) { |
725 CFX_ByteString sBorderStyle = pBSDict->GetString("S", "S"); | 725 CFX_ByteString sBorderStyle = pBSDict->GetStringBy("S", "S"); |
726 if (sBorderStyle == "S") | 726 if (sBorderStyle == "S") |
727 return BBS_SOLID; | 727 return BBS_SOLID; |
728 if (sBorderStyle == "D") | 728 if (sBorderStyle == "D") |
729 return BBS_DASH; | 729 return BBS_DASH; |
730 if (sBorderStyle == "B") | 730 if (sBorderStyle == "B") |
731 return BBS_BEVELED; | 731 return BBS_BEVELED; |
732 if (sBorderStyle == "I") | 732 if (sBorderStyle == "I") |
733 return BBS_INSET; | 733 return BBS_INSET; |
734 if (sBorderStyle == "U") | 734 if (sBorderStyle == "U") |
735 return BBS_UNDERLINE; | 735 return BBS_UNDERLINE; |
736 } | 736 } |
737 | 737 |
738 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); | 738 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border"); |
739 if (pBorder) { | 739 if (pBorder) { |
740 if (pBorder->GetCount() >= 4) { | 740 if (pBorder->GetCount() >= 4) { |
741 CPDF_Array* pDP = pBorder->GetArray(3); | 741 CPDF_Array* pDP = pBorder->GetArrayAt(3); |
742 if (pDP && pDP->GetCount() > 0) | 742 if (pDP && pDP->GetCount() > 0) |
743 return BBS_DASH; | 743 return BBS_DASH; |
744 } | 744 } |
745 } | 745 } |
746 | 746 |
747 return BBS_SOLID; | 747 return BBS_SOLID; |
748 } | 748 } |
749 | 749 |
750 void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array) { | 750 void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array) { |
751 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); | 751 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); |
752 if (!pBSDict) { | 752 if (!pBSDict) { |
753 pBSDict = new CPDF_Dictionary; | 753 pBSDict = new CPDF_Dictionary; |
754 m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); | 754 m_pAnnot->GetAnnotDict()->SetAt("BS", pBSDict); |
755 } | 755 } |
756 | 756 |
757 CPDF_Array* pArray = new CPDF_Array; | 757 CPDF_Array* pArray = new CPDF_Array; |
758 for (int i = 0, sz = array.GetSize(); i < sz; i++) { | 758 for (int i = 0, sz = array.GetSize(); i < sz; i++) { |
759 pArray->AddInteger(array[i]); | 759 pArray->AddInteger(array[i]); |
760 } | 760 } |
761 | 761 |
762 pBSDict->SetAt("D", pArray); | 762 pBSDict->SetAt("D", pArray); |
763 } | 763 } |
764 | 764 |
765 void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const { | 765 void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const { |
766 CPDF_Array* pDash = NULL; | 766 CPDF_Array* pDash = NULL; |
767 | 767 |
768 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArray("Border"); | 768 CPDF_Array* pBorder = m_pAnnot->GetAnnotDict()->GetArrayBy("Border"); |
769 if (pBorder) { | 769 if (pBorder) { |
770 pDash = pBorder->GetArray(3); | 770 pDash = pBorder->GetArrayAt(3); |
771 } else { | 771 } else { |
772 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDict("BS"); | 772 CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictBy("BS"); |
773 if (pBSDict) { | 773 if (pBSDict) { |
774 pDash = pBSDict->GetArray("D"); | 774 pDash = pBSDict->GetArrayBy("D"); |
775 } | 775 } |
776 } | 776 } |
777 | 777 |
778 if (pDash) { | 778 if (pDash) { |
779 for (int i = 0, sz = pDash->GetCount(); i < sz; i++) { | 779 for (int i = 0, sz = pDash->GetCount(); i < sz; i++) { |
780 array.Add(pDash->GetInteger(i)); | 780 array.Add(pDash->GetIntegerAt(i)); |
781 } | 781 } |
782 } | 782 } |
783 } | 783 } |
784 | 784 |
785 void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { | 785 void CPDFSDK_BAAnnot::SetColor(FX_COLORREF color) { |
786 CPDF_Array* pArray = new CPDF_Array; | 786 CPDF_Array* pArray = new CPDF_Array; |
787 pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); | 787 pArray->AddNumber((FX_FLOAT)FXSYS_GetRValue(color) / 255.0f); |
788 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); | 788 pArray->AddNumber((FX_FLOAT)FXSYS_GetGValue(color) / 255.0f); |
789 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); | 789 pArray->AddNumber((FX_FLOAT)FXSYS_GetBValue(color) / 255.0f); |
790 m_pAnnot->GetAnnotDict()->SetAt("C", pArray); | 790 m_pAnnot->GetAnnotDict()->SetAt("C", pArray); |
791 } | 791 } |
792 | 792 |
793 void CPDFSDK_BAAnnot::RemoveColor() { | 793 void CPDFSDK_BAAnnot::RemoveColor() { |
794 m_pAnnot->GetAnnotDict()->RemoveAt("C"); | 794 m_pAnnot->GetAnnotDict()->RemoveAt("C"); |
795 } | 795 } |
796 | 796 |
797 FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { | 797 FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const { |
798 if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArray("C")) { | 798 if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayBy("C")) { |
799 int nCount = pEntry->GetCount(); | 799 int nCount = pEntry->GetCount(); |
800 if (nCount == 1) { | 800 if (nCount == 1) { |
801 FX_FLOAT g = pEntry->GetNumber(0) * 255; | 801 FX_FLOAT g = pEntry->GetNumberAt(0) * 255; |
802 | 802 |
803 color = FXSYS_RGB((int)g, (int)g, (int)g); | 803 color = FXSYS_RGB((int)g, (int)g, (int)g); |
804 | 804 |
805 return TRUE; | 805 return TRUE; |
806 } else if (nCount == 3) { | 806 } else if (nCount == 3) { |
807 FX_FLOAT r = pEntry->GetNumber(0) * 255; | 807 FX_FLOAT r = pEntry->GetNumberAt(0) * 255; |
808 FX_FLOAT g = pEntry->GetNumber(1) * 255; | 808 FX_FLOAT g = pEntry->GetNumberAt(1) * 255; |
809 FX_FLOAT b = pEntry->GetNumber(2) * 255; | 809 FX_FLOAT b = pEntry->GetNumberAt(2) * 255; |
810 | 810 |
811 color = FXSYS_RGB((int)r, (int)g, (int)b); | 811 color = FXSYS_RGB((int)r, (int)g, (int)b); |
812 | 812 |
813 return TRUE; | 813 return TRUE; |
814 } else if (nCount == 4) { | 814 } else if (nCount == 4) { |
815 FX_FLOAT c = pEntry->GetNumber(0); | 815 FX_FLOAT c = pEntry->GetNumberAt(0); |
816 FX_FLOAT m = pEntry->GetNumber(1); | 816 FX_FLOAT m = pEntry->GetNumberAt(1); |
817 FX_FLOAT y = pEntry->GetNumber(2); | 817 FX_FLOAT y = pEntry->GetNumberAt(2); |
818 FX_FLOAT k = pEntry->GetNumber(3); | 818 FX_FLOAT k = pEntry->GetNumberAt(3); |
819 | 819 |
820 FX_FLOAT r = 1.0f - std::min(1.0f, c + k); | 820 FX_FLOAT r = 1.0f - std::min(1.0f, c + k); |
821 FX_FLOAT g = 1.0f - std::min(1.0f, m + k); | 821 FX_FLOAT g = 1.0f - std::min(1.0f, m + k); |
822 FX_FLOAT b = 1.0f - std::min(1.0f, y + k); | 822 FX_FLOAT b = 1.0f - std::min(1.0f, y + k); |
823 | 823 |
824 color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255)); | 824 color = FXSYS_RGB((int)(r * 255), (int)(g * 255), (int)(b * 255)); |
825 | 825 |
826 return TRUE; | 826 return TRUE; |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
830 return FALSE; | 830 return FALSE; |
831 } | 831 } |
832 | 832 |
833 void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, | 833 void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType, |
834 const CPDF_Rect& rcBBox, | 834 const CPDF_Rect& rcBBox, |
835 const CFX_Matrix& matrix, | 835 const CFX_Matrix& matrix, |
836 const CFX_ByteString& sContents, | 836 const CFX_ByteString& sContents, |
837 const CFX_ByteString& sAPState) { | 837 const CFX_ByteString& sAPState) { |
838 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDict("AP"); | 838 CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP"); |
839 | 839 |
840 if (!pAPDict) { | 840 if (!pAPDict) { |
841 pAPDict = new CPDF_Dictionary; | 841 pAPDict = new CPDF_Dictionary; |
842 m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); | 842 m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); |
843 } | 843 } |
844 | 844 |
845 CPDF_Stream* pStream = nullptr; | 845 CPDF_Stream* pStream = nullptr; |
846 CPDF_Dictionary* pParentDict = nullptr; | 846 CPDF_Dictionary* pParentDict = nullptr; |
847 | 847 |
848 if (sAPState.IsEmpty()) { | 848 if (sAPState.IsEmpty()) { |
849 pParentDict = pAPDict; | 849 pParentDict = pAPDict; |
850 pStream = pAPDict->GetStream(sAPType); | 850 pStream = pAPDict->GetStreamBy(sAPType); |
851 } else { | 851 } else { |
852 CPDF_Dictionary* pAPTypeDict = pAPDict->GetDict(sAPType); | 852 CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictBy(sAPType); |
853 if (!pAPTypeDict) { | 853 if (!pAPTypeDict) { |
854 pAPTypeDict = new CPDF_Dictionary; | 854 pAPTypeDict = new CPDF_Dictionary; |
855 pAPDict->SetAt(sAPType, pAPTypeDict); | 855 pAPDict->SetAt(sAPType, pAPTypeDict); |
856 } | 856 } |
857 | 857 |
858 pParentDict = pAPTypeDict; | 858 pParentDict = pAPTypeDict; |
859 pStream = pAPTypeDict->GetStream(sAPState); | 859 pStream = pAPTypeDict->GetStreamBy(sAPState); |
860 } | 860 } |
861 | 861 |
862 if (!pStream) { | 862 if (!pStream) { |
863 pStream = new CPDF_Stream(nullptr, 0, nullptr); | 863 pStream = new CPDF_Stream(nullptr, 0, nullptr); |
864 | 864 |
865 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); | 865 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
866 int32_t objnum = pDoc->AddIndirectObject(pStream); | 866 int32_t objnum = pDoc->AddIndirectObject(pStream); |
867 pParentDict->SetAtReference(sAPType, pDoc, objnum); | 867 pParentDict->SetAtReference(sAPType, pDoc, objnum); |
868 } | 868 } |
869 | 869 |
(...skipping 29 matching lines...) Expand all Loading... |
899 FX_BOOL CPDFSDK_BAAnnot::CreateFormFiller() { | 899 FX_BOOL CPDFSDK_BAAnnot::CreateFormFiller() { |
900 return TRUE; | 900 return TRUE; |
901 } | 901 } |
902 FX_BOOL CPDFSDK_BAAnnot::IsVisible() const { | 902 FX_BOOL CPDFSDK_BAAnnot::IsVisible() const { |
903 int nFlags = GetFlags(); | 903 int nFlags = GetFlags(); |
904 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || | 904 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) || |
905 (nFlags & ANNOTFLAG_NOVIEW)); | 905 (nFlags & ANNOTFLAG_NOVIEW)); |
906 } | 906 } |
907 | 907 |
908 CPDF_Action CPDFSDK_BAAnnot::GetAction() const { | 908 CPDF_Action CPDFSDK_BAAnnot::GetAction() const { |
909 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A")); | 909 return CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictBy("A")); |
910 } | 910 } |
911 | 911 |
912 void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) { | 912 void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) { |
913 ASSERT(action); | 913 ASSERT(action); |
914 if ((CPDF_Action&)action != | 914 if ((CPDF_Action&)action != |
915 CPDF_Action(m_pAnnot->GetAnnotDict()->GetDict("A"))) { | 915 CPDF_Action(m_pAnnot->GetAnnotDict()->GetDictBy("A"))) { |
916 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); | 916 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
917 CPDF_Dictionary* pDict = action.GetDict(); | 917 CPDF_Dictionary* pDict = action.GetDict(); |
918 if (pDict && pDict->GetObjNum() == 0) { | 918 if (pDict && pDict->GetObjNum() == 0) { |
919 pDoc->AddIndirectObject(pDict); | 919 pDoc->AddIndirectObject(pDict); |
920 } | 920 } |
921 m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetObjNum()); | 921 m_pAnnot->GetAnnotDict()->SetAtReference("A", pDoc, pDict->GetObjNum()); |
922 } | 922 } |
923 } | 923 } |
924 | 924 |
925 void CPDFSDK_BAAnnot::RemoveAction() { | 925 void CPDFSDK_BAAnnot::RemoveAction() { |
926 m_pAnnot->GetAnnotDict()->RemoveAt("A"); | 926 m_pAnnot->GetAnnotDict()->RemoveAt("A"); |
927 } | 927 } |
928 | 928 |
929 CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { | 929 CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const { |
930 return m_pAnnot->GetAnnotDict()->GetDict("AA"); | 930 return m_pAnnot->GetAnnotDict()->GetDictBy("AA"); |
931 } | 931 } |
932 | 932 |
933 void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { | 933 void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) { |
934 if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDict("AA")) | 934 if ((CPDF_AAction&)aa != m_pAnnot->GetAnnotDict()->GetDictBy("AA")) |
935 m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); | 935 m_pAnnot->GetAnnotDict()->SetAt("AA", (CPDF_AAction&)aa); |
936 } | 936 } |
937 | 937 |
938 void CPDFSDK_BAAnnot::RemoveAAction() { | 938 void CPDFSDK_BAAnnot::RemoveAAction() { |
939 m_pAnnot->GetAnnotDict()->RemoveAt("AA"); | 939 m_pAnnot->GetAnnotDict()->RemoveAt("AA"); |
940 } | 940 } |
941 | 941 |
942 CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) { | 942 CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) { |
943 CPDF_AAction AAction = GetAAction(); | 943 CPDF_AAction AAction = GetAAction(); |
944 | 944 |
(...skipping 14 matching lines...) Expand all Loading... |
959 CPDF_Annot::Normal, NULL); | 959 CPDF_Annot::Normal, NULL); |
960 } | 960 } |
961 | 961 |
962 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { | 962 UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() { |
963 return GetPDFPage(); | 963 return GetPDFPage(); |
964 } | 964 } |
965 | 965 |
966 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 966 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
967 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 967 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
968 } | 968 } |
OLD | NEW |