| 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 #ifndef CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 7 #ifndef CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
| 8 #define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 8 #define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <vector> |
| 11 | 12 |
| 12 #include "../../../third_party/base/nonstd_unique_ptr.h" | 13 #include "../../../third_party/base/nonstd_unique_ptr.h" |
| 13 #include "../fpdfapi/fpdf_parser.h" | 14 #include "../fpdfapi/fpdf_parser.h" |
| 14 #include "../fpdfapi/fpdf_render.h" | 15 #include "../fpdfapi/fpdf_render.h" |
| 15 | 16 |
| 16 class CFieldTree; | 17 class CFieldTree; |
| 17 class CPDF_AAction; | 18 class CPDF_AAction; |
| 18 class CPDF_Action; | 19 class CPDF_Action; |
| 19 class CPDF_ActionFields; | 20 class CPDF_ActionFields; |
| 20 class CPDF_Annot; | 21 class CPDF_Annot; |
| 21 class CPDF_AnnotList; | 22 class CPDF_AnnotList; |
| 22 class CPDF_ApSettings; | 23 class CPDF_ApSettings; |
| 23 class CPDF_Bookmark; | 24 class CPDF_Bookmark; |
| 24 class CPDF_BookmarkTree; | 25 class CPDF_BookmarkTree; |
| 25 class CPDF_DefaultAppearance; | 26 class CPDF_DefaultAppearance; |
| 26 class CPDF_Dest; | 27 class CPDF_Dest; |
| 27 class CPDF_DocJSActions; | 28 class CPDF_DocJSActions; |
| 28 class CPDF_FileSpec; | 29 class CPDF_FileSpec; |
| 29 class CPDF_FormControl; | 30 class CPDF_FormControl; |
| 30 class CPDF_FormField; | 31 class CPDF_FormField; |
| 31 class CPDF_FormNotify; | 32 class CPDF_FormNotify; |
| 32 class CPDF_IconFit; | 33 class CPDF_IconFit; |
| 33 class CPDF_InterForm; | 34 class CPDF_InterForm; |
| 34 class CPDF_Link; | 35 class CPDF_Link; |
| 35 class CPDF_LinkList; | |
| 36 class CPDF_LWinParam; | 36 class CPDF_LWinParam; |
| 37 class CPDF_Metadata; | 37 class CPDF_Metadata; |
| 38 class CPDF_NumberTree; | 38 class CPDF_NumberTree; |
| 39 class CPDF_OCContext; | 39 class CPDF_OCContext; |
| 40 class CPDF_Page; | 40 class CPDF_Page; |
| 41 class CPDF_RenderOptions; | 41 class CPDF_RenderOptions; |
| 42 class CPDF_TextObject; | 42 class CPDF_TextObject; |
| 43 class CPDF_ViewerPreferences; | 43 class CPDF_ViewerPreferences; |
| 44 class CXML_Element; | 44 class CXML_Element; |
| 45 | 45 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 | 351 |
| 352 FX_BOOL GetFileName(CFX_WideString& wsFileName) const; | 352 FX_BOOL GetFileName(CFX_WideString& wsFileName) const; |
| 353 | 353 |
| 354 CPDF_Stream* GetFileStream() const; | 354 CPDF_Stream* GetFileStream() const; |
| 355 | 355 |
| 356 void SetFileName(const CFX_WideStringC& wsFileName, FX_BOOL bURL = FALSE); | 356 void SetFileName(const CFX_WideStringC& wsFileName, FX_BOOL bURL = FALSE); |
| 357 | 357 |
| 358 protected: | 358 protected: |
| 359 CPDF_Object* m_pObj; | 359 CPDF_Object* m_pObj; |
| 360 }; | 360 }; |
| 361 |
| 361 class CPDF_LinkList { | 362 class CPDF_LinkList { |
| 362 public: | 363 public: |
| 363 CPDF_LinkList(CPDF_Document* pDoc) { m_pDocument = pDoc; } | 364 CPDF_LinkList(); |
| 364 | |
| 365 ~CPDF_LinkList(); | 365 ~CPDF_LinkList(); |
| 366 | 366 |
| 367 CPDF_Link GetLinkAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y); | 367 CPDF_Link GetLinkAtPoint(CPDF_Page* pPage, |
| 368 FX_FLOAT pdf_x, |
| 369 FX_FLOAT pdf_y, |
| 370 int* z_order); |
| 368 | 371 |
| 369 int CountLinks(CPDF_Page* pPage); | 372 private: |
| 373 const std::vector<CPDF_Dictionary*>* GetPageLinks(CPDF_Page* pPage); |
| 370 | 374 |
| 371 CPDF_Link GetLink(CPDF_Page* pPage, int index); | 375 void LoadPageLinks(CPDF_Page* pPage, std::vector<CPDF_Dictionary*>* pList); |
| 372 | 376 |
| 373 CPDF_Document* GetDocument() const { return m_pDocument; } | 377 std::map<FX_DWORD, std::vector<CPDF_Dictionary*>> m_PageMap; |
| 378 }; |
| 374 | 379 |
| 375 protected: | |
| 376 CPDF_Document* m_pDocument; | |
| 377 | |
| 378 CFX_MapPtrToPtr m_PageMap; | |
| 379 | |
| 380 CFX_PtrArray* GetPageLinks(CPDF_Page* pPage); | |
| 381 | |
| 382 void LoadPageLinks(CPDF_Page* pPage, CFX_PtrArray* pList); | |
| 383 }; | |
| 384 class CPDF_Link { | 380 class CPDF_Link { |
| 385 public: | 381 public: |
| 386 CPDF_Link() : m_pDict(nullptr) {} | 382 CPDF_Link() : m_pDict(nullptr) {} |
| 387 explicit CPDF_Link(CPDF_Dictionary* pDict) : m_pDict(pDict) {} | 383 explicit CPDF_Link(CPDF_Dictionary* pDict) : m_pDict(pDict) {} |
| 388 | 384 |
| 389 CPDF_Dictionary* GetDict() const { return m_pDict; } | 385 CPDF_Dictionary* GetDict() const { return m_pDict; } |
| 390 | 386 |
| 391 CFX_FloatRect GetRect(); | 387 CFX_FloatRect GetRect(); |
| 392 CPDF_Dest GetDest(CPDF_Document* pDoc); | 388 CPDF_Dest GetDest(CPDF_Document* pDoc); |
| 393 CPDF_Action GetAction(); | 389 CPDF_Action GetAction(); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 633 |
| 638 CPDF_FormField* GetField(FX_DWORD index, | 634 CPDF_FormField* GetField(FX_DWORD index, |
| 639 const CFX_WideString& csFieldName = L""); | 635 const CFX_WideString& csFieldName = L""); |
| 640 | 636 |
| 641 void GetAllFieldNames(CFX_WideStringArray& allFieldNames); | 637 void GetAllFieldNames(CFX_WideStringArray& allFieldNames); |
| 642 | 638 |
| 643 FX_BOOL IsValidFormField(const void* pField); | 639 FX_BOOL IsValidFormField(const void* pField); |
| 644 | 640 |
| 645 CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const; | 641 CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const; |
| 646 | 642 |
| 647 FX_DWORD CountControls(CFX_WideString csFieldName = L""); | |
| 648 | |
| 649 CPDF_FormControl* GetControl(FX_DWORD index, | |
| 650 CFX_WideString csFieldName = L""); | |
| 651 | |
| 652 FX_BOOL IsValidFormControl(const void* pControl); | |
| 653 | |
| 654 int CountPageControls(CPDF_Page* pPage) const; | |
| 655 | |
| 656 CPDF_FormControl* GetPageControl(CPDF_Page* pPage, int index) const; | |
| 657 | |
| 658 CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage, | 643 CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage, |
| 659 FX_FLOAT pdf_x, | 644 FX_FLOAT pdf_x, |
| 660 FX_FLOAT pdf_y) const; | 645 FX_FLOAT pdf_y, |
| 646 int* z_order) const; |
| 661 | 647 |
| 662 CPDF_FormControl* GetControlByDict(CPDF_Dictionary* pWidgetDict) const; | 648 CPDF_FormControl* GetControlByDict(CPDF_Dictionary* pWidgetDict) const; |
| 663 | 649 |
| 664 FX_DWORD CountInternalFields(const CFX_WideString& csFieldName = L"") const; | |
| 665 | |
| 666 CPDF_Dictionary* GetInternalField( | |
| 667 FX_DWORD index, | |
| 668 const CFX_WideString& csFieldName = L"") const; | |
| 669 | |
| 670 CPDF_Document* GetDocument() const { return m_pDocument; } | 650 CPDF_Document* GetDocument() const { return m_pDocument; } |
| 671 | 651 |
| 672 CPDF_Dictionary* GetFormDict() const { return m_pFormDict; } | 652 CPDF_Dictionary* GetFormDict() const { return m_pFormDict; } |
| 673 | 653 |
| 674 FX_BOOL NeedConstructAP(); | 654 FX_BOOL NeedConstructAP(); |
| 675 | 655 |
| 676 void NeedConstructAP(FX_BOOL bNeedAP); | 656 void NeedConstructAP(FX_BOOL bNeedAP); |
| 677 | 657 |
| 678 int CountFieldsInCalculationOrder(); | 658 int CountFieldsInCalculationOrder(); |
| 679 | 659 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 FX_BOOL bSimpleFileSpec = FALSE) const; | 713 FX_BOOL bSimpleFileSpec = FALSE) const; |
| 734 | 714 |
| 735 FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE); | 715 FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE); |
| 736 | 716 |
| 737 FX_BOOL ResetForm(const CFX_PtrArray& fields, | 717 FX_BOOL ResetForm(const CFX_PtrArray& fields, |
| 738 FX_BOOL bIncludeOrExclude = TRUE, | 718 FX_BOOL bIncludeOrExclude = TRUE, |
| 739 FX_BOOL bNotify = FALSE); | 719 FX_BOOL bNotify = FALSE); |
| 740 | 720 |
| 741 FX_BOOL ResetForm(FX_BOOL bNotify = FALSE); | 721 FX_BOOL ResetForm(FX_BOOL bNotify = FALSE); |
| 742 | 722 |
| 743 void ReloadForm(); | |
| 744 | |
| 745 CPDF_FormNotify* GetFormNotify() const { return m_pFormNotify; } | 723 CPDF_FormNotify* GetFormNotify() const { return m_pFormNotify; } |
| 746 | 724 |
| 747 void SetFormNotify(const CPDF_FormNotify* pNotify); | 725 void SetFormNotify(const CPDF_FormNotify* pNotify); |
| 748 | 726 |
| 749 int GetPageWithWidget(int iCurPage, FX_BOOL bNext); | |
| 750 | |
| 751 FX_BOOL IsUpdated() { return m_bUpdated; } | 727 FX_BOOL IsUpdated() { return m_bUpdated; } |
| 752 | 728 |
| 753 void ClearUpdatedFlag() { m_bUpdated = FALSE; } | 729 void ClearUpdatedFlag() { m_bUpdated = FALSE; } |
| 754 | 730 |
| 755 FX_BOOL HasXFAForm() const; | 731 FX_BOOL HasXFAForm() const; |
| 756 | 732 |
| 757 void FixPageFields(const CPDF_Page* pPage); | 733 void FixPageFields(const CPDF_Page* pPage); |
| 758 | 734 |
| 759 protected: | 735 protected: |
| 760 static FX_BOOL m_bUpdateAP; | 736 static FX_BOOL m_bUpdateAP; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 783 | 759 |
| 784 int CompareFieldName(const CFX_ByteString& name1, | 760 int CompareFieldName(const CFX_ByteString& name1, |
| 785 const CFX_ByteString& name2); | 761 const CFX_ByteString& name2); |
| 786 | 762 |
| 787 CPDF_Document* m_pDocument; | 763 CPDF_Document* m_pDocument; |
| 788 | 764 |
| 789 FX_BOOL m_bGenerateAP; | 765 FX_BOOL m_bGenerateAP; |
| 790 | 766 |
| 791 CPDF_Dictionary* m_pFormDict; | 767 CPDF_Dictionary* m_pFormDict; |
| 792 | 768 |
| 793 CFX_MapPtrToPtr m_ControlMap; | 769 std::map<const CPDF_Dictionary*, CPDF_FormControl*> m_ControlMap; |
| 794 | 770 |
| 795 CFieldTree* m_pFieldTree; | 771 CFieldTree* m_pFieldTree; |
| 796 | 772 |
| 797 CFX_ByteString m_bsEncoding; | 773 CFX_ByteString m_bsEncoding; |
| 798 | 774 |
| 799 CPDF_FormNotify* m_pFormNotify; | 775 CPDF_FormNotify* m_pFormNotify; |
| 800 | 776 |
| 801 FX_BOOL m_bUpdated; | 777 FX_BOOL m_bUpdated; |
| 802 friend class CPDF_FormControl; | 778 friend class CPDF_FormControl; |
| 803 friend class CPDF_FormField; | 779 friend class CPDF_FormField; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 827 ComboBox, | 803 ComboBox, |
| 828 Sign | 804 Sign |
| 829 }; | 805 }; |
| 830 | 806 |
| 831 CFX_WideString GetFullName(); | 807 CFX_WideString GetFullName(); |
| 832 | 808 |
| 833 Type GetType() { return m_Type; } | 809 Type GetType() { return m_Type; } |
| 834 | 810 |
| 835 FX_DWORD GetFlags() { return m_Flags; } | 811 FX_DWORD GetFlags() { return m_Flags; } |
| 836 | 812 |
| 837 CPDF_InterForm* GetInterForm() const { return m_pForm; } | |
| 838 | |
| 839 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } | 813 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } |
| 840 | 814 |
| 841 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } | 815 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } |
| 842 | 816 |
| 843 FX_BOOL ResetField(FX_BOOL bNotify = FALSE); | 817 FX_BOOL ResetField(FX_BOOL bNotify = FALSE); |
| 844 | 818 |
| 845 int CountControls() { return m_ControlList.GetSize(); } | 819 int CountControls() { return m_ControlList.GetSize(); } |
| 846 | 820 |
| 847 CPDF_FormControl* GetControl(int index) { | 821 CPDF_FormControl* GetControl(int index) { |
| 848 return (CPDF_FormControl*)m_ControlList.GetAt(index); | 822 return (CPDF_FormControl*)m_ControlList.GetAt(index); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 class CPDF_FormControl { | 975 class CPDF_FormControl { |
| 1002 public: | 976 public: |
| 1003 CPDF_FormField::Type GetType() { return m_pField->GetType(); } | 977 CPDF_FormField::Type GetType() { return m_pField->GetType(); } |
| 1004 | 978 |
| 1005 CPDF_InterForm* GetInterForm() const { return m_pForm; } | 979 CPDF_InterForm* GetInterForm() const { return m_pForm; } |
| 1006 | 980 |
| 1007 CPDF_FormField* GetField() const { return m_pField; } | 981 CPDF_FormField* GetField() const { return m_pField; } |
| 1008 | 982 |
| 1009 CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } | 983 CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } |
| 1010 | 984 |
| 1011 CFX_FloatRect GetRect(); | 985 CFX_FloatRect GetRect() const; |
| 1012 | 986 |
| 1013 void DrawControl(CFX_RenderDevice* pDevice, | 987 void DrawControl(CFX_RenderDevice* pDevice, |
| 1014 CFX_AffineMatrix* pMatrix, | 988 CFX_AffineMatrix* pMatrix, |
| 1015 CPDF_Page* pPage, | 989 CPDF_Page* pPage, |
| 1016 CPDF_Annot::AppearanceMode mode, | 990 CPDF_Annot::AppearanceMode mode, |
| 1017 const CPDF_RenderOptions* pOptions = NULL); | 991 const CPDF_RenderOptions* pOptions = NULL); |
| 1018 | 992 |
| 1019 CFX_ByteString GetCheckedAPState(); | 993 CFX_ByteString GetCheckedAPState(); |
| 1020 | 994 |
| 1021 CFX_WideString GetExportValue(); | 995 CFX_WideString GetExportValue(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 FX_FLOAT fc[4], | 1228 FX_FLOAT fc[4], |
| 1255 const CFX_ByteStringC& csEntry); | 1229 const CFX_ByteStringC& csEntry); |
| 1256 | 1230 |
| 1257 CFX_WideString GetCaption(const CFX_ByteStringC& csEntry); | 1231 CFX_WideString GetCaption(const CFX_ByteStringC& csEntry); |
| 1258 | 1232 |
| 1259 CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry); | 1233 CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry); |
| 1260 friend class CPDF_FormControl; | 1234 friend class CPDF_FormControl; |
| 1261 }; | 1235 }; |
| 1262 | 1236 |
| 1263 #endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ | 1237 #endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ |
| OLD | NEW |