Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(845)

Side by Side Diff: fpdfsdk/src/fsdk_baseannot.cpp

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

Powered by Google App Engine
This is Rietveld 408576698