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

Side by Side Diff: core/fpdfdoc/include/fpdf_doc.h

Issue 2003853003: Remove dead code from CPDF_InterForm. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 7 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 | « core/fpdfdoc/doc_formfield.cpp ('k') | fpdfsdk/fpdf_ext.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 #ifndef CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ 7 #ifndef CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_
8 #define CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ 8 #define CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <unordered_map> 12 #include <unordered_map>
13 #include <vector> 13 #include <vector>
14 14
15 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
16 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" 16 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
17 #include "core/fxge/include/fx_dib.h" 17 #include "core/fxge/include/fx_dib.h"
18 18
19 class CFDF_Document; 19 class CFDF_Document;
20 class CFieldTree; 20 class CFieldTree;
21 class CFX_RenderDevice;
21 class CPDF_AAction; 22 class CPDF_AAction;
22 class CPDF_Action; 23 class CPDF_Action;
23 class CPDF_ActionFields; 24 class CPDF_ActionFields;
24 class CPDF_Annot; 25 class CPDF_Annot;
25 class CPDF_AnnotList; 26 class CPDF_AnnotList;
26 class CPDF_ApSettings; 27 class CPDF_ApSettings;
27 class CPDF_Bookmark; 28 class CPDF_Bookmark;
28 class CPDF_BookmarkTree; 29 class CPDF_BookmarkTree;
29 class CPDF_DefaultAppearance; 30 class CPDF_DefaultAppearance;
30 class CPDF_Dest; 31 class CPDF_Dest;
32 class CPDF_DocJSActions;
31 class CPDF_Document; 33 class CPDF_Document;
32 class CPDF_DocJSActions;
33 class CPDF_FileSpec; 34 class CPDF_FileSpec;
35 class CPDF_Font;
36 class CPDF_Form;
34 class CPDF_FormControl; 37 class CPDF_FormControl;
35 class CPDF_FormField; 38 class CPDF_FormField;
36 class CPDF_FormNotify;
37 class CPDF_IconFit; 39 class CPDF_IconFit;
38 class CPDF_InterForm;
39 class CPDF_Link; 40 class CPDF_Link;
40 class CPDF_Metadata; 41 class CPDF_Metadata;
41 class CPDF_OCContext; 42 class CPDF_OCContext;
42 class CPDF_Page; 43 class CPDF_Page;
43 class CPDF_PageObject; 44 class CPDF_PageObject;
44 class CPDF_Font; 45 class CPDF_RenderContext;
45 class CPDF_Form;
46 class CPDF_RenderOptions; 46 class CPDF_RenderOptions;
47 class CPDF_RenderContext;
48 class CPDF_ViewerPreferences; 47 class CPDF_ViewerPreferences;
49 class CXML_Element; 48 class CXML_Element;
50 class CFX_RenderDevice; 49 class IPDF_FormNotify;
51 50
52 enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE }; 51 enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE };
53 52
54 class CPDF_NameTree { 53 class CPDF_NameTree {
55 public: 54 public:
56 explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {} 55 explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {}
57 CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteString& category); 56 CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteString& category);
58 57
59 CPDF_Object* LookupValue(int nIndex, CFX_ByteString& csName) const; 58 CPDF_Object* LookupValue(int nIndex, CFX_ByteString& csName) const;
60 CPDF_Object* LookupValue(const CFX_ByteString& csName) const; 59 CPDF_Object* LookupValue(const CFX_ByteString& csName) const;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 }; 437 };
439 438
440 #define FIELDTYPE_UNKNOWN 0 439 #define FIELDTYPE_UNKNOWN 0
441 #define FIELDTYPE_PUSHBUTTON 1 440 #define FIELDTYPE_PUSHBUTTON 1
442 #define FIELDTYPE_CHECKBOX 2 441 #define FIELDTYPE_CHECKBOX 2
443 #define FIELDTYPE_RADIOBUTTON 3 442 #define FIELDTYPE_RADIOBUTTON 3
444 #define FIELDTYPE_COMBOBOX 4 443 #define FIELDTYPE_COMBOBOX 4
445 #define FIELDTYPE_LISTBOX 5 444 #define FIELDTYPE_LISTBOX 5
446 #define FIELDTYPE_TEXTFIELD 6 445 #define FIELDTYPE_TEXTFIELD 6
447 #define FIELDTYPE_SIGNATURE 7 446 #define FIELDTYPE_SIGNATURE 7
447
448 class CPDF_InterForm : public CFX_PrivateData { 448 class CPDF_InterForm : public CFX_PrivateData {
449 public: 449 public:
450 CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP); 450 explicit CPDF_InterForm(CPDF_Document* pDocument);
451 ~CPDF_InterForm(); 451 ~CPDF_InterForm();
452 452
453 static void EnableUpdateAP(FX_BOOL bUpdateAP); 453 static void EnableUpdateAP(FX_BOOL bUpdateAP);
454 454
455 static FX_BOOL UpdatingAPEnabled(); 455 static FX_BOOL UpdatingAPEnabled();
456 456
457 static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict, 457 static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict,
458 const FX_CHAR* csType, 458 const FX_CHAR* csType,
459 int iMinLen = 2, 459 int iMinLen = 2,
460 const FX_CHAR* csPrefix = ""); 460 const FX_CHAR* csPrefix = "");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 FX_FLOAT pdf_x, 492 FX_FLOAT pdf_x,
493 FX_FLOAT pdf_y, 493 FX_FLOAT pdf_y,
494 int* z_order) const; 494 int* z_order) const;
495 495
496 CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const; 496 CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const;
497 497
498 CPDF_Document* GetDocument() const { return m_pDocument; } 498 CPDF_Document* GetDocument() const { return m_pDocument; }
499 499
500 CPDF_Dictionary* GetFormDict() const { return m_pFormDict; } 500 CPDF_Dictionary* GetFormDict() const { return m_pFormDict; }
501 501
502 FX_BOOL NeedConstructAP(); 502 FX_BOOL NeedConstructAP() const;
503
504 void NeedConstructAP(FX_BOOL bNeedAP);
505 503
506 int CountFieldsInCalculationOrder(); 504 int CountFieldsInCalculationOrder();
507 505
508 CPDF_FormField* GetFieldInCalculationOrder(int index); 506 CPDF_FormField* GetFieldInCalculationOrder(int index);
509 507
510 int FindFieldInCalculationOrder(const CPDF_FormField* pField); 508 int FindFieldInCalculationOrder(const CPDF_FormField* pField);
511 509
512 uint32_t CountFormFonts(); 510 uint32_t CountFormFonts();
513 511
514 CPDF_Font* GetFormFont(uint32_t index, CFX_ByteString& csNameTag); 512 CPDF_Font* GetFormFont(uint32_t index, CFX_ByteString& csNameTag);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 bool bSimpleFileSpec = false) const; 560 bool bSimpleFileSpec = false) const;
563 561
564 FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE); 562 FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE);
565 563
566 bool ResetForm(const std::vector<CPDF_FormField*>& fields, 564 bool ResetForm(const std::vector<CPDF_FormField*>& fields,
567 bool bIncludeOrExclude = true, 565 bool bIncludeOrExclude = true,
568 bool bNotify = false); 566 bool bNotify = false);
569 567
570 bool ResetForm(bool bNotify = false); 568 bool ResetForm(bool bNotify = false);
571 569
572 CPDF_FormNotify* GetFormNotify() const { return m_pFormNotify; } 570 void SetFormNotify(IPDF_FormNotify* pNotify);
573
574 void SetFormNotify(const CPDF_FormNotify* pNotify);
575
576 FX_BOOL IsUpdated() { return m_bUpdated; }
577
578 void ClearUpdatedFlag() { m_bUpdated = FALSE; }
579 571
580 FX_BOOL HasXFAForm() const; 572 FX_BOOL HasXFAForm() const;
581 573
582 void FixPageFields(const CPDF_Page* pPage); 574 void FixPageFields(const CPDF_Page* pPage);
583 575
584 protected: 576 protected:
585 static FX_BOOL m_bUpdateAP; 577 static FX_BOOL m_bUpdateAP;
586 578
587 void LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0); 579 void LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0);
588 580
(...skipping 15 matching lines...) Expand all
604 const CPDF_FormControl* pExcludedControl); 596 const CPDF_FormControl* pExcludedControl);
605 597
606 int CompareFieldName(const CFX_WideString& name1, 598 int CompareFieldName(const CFX_WideString& name1,
607 const CFX_WideString& name2); 599 const CFX_WideString& name2);
608 600
609 int CompareFieldName(const CFX_ByteString& name1, 601 int CompareFieldName(const CFX_ByteString& name1,
610 const CFX_ByteString& name2); 602 const CFX_ByteString& name2);
611 603
612 CPDF_Document* const m_pDocument; 604 CPDF_Document* const m_pDocument;
613 605
614 FX_BOOL m_bGenerateAP;
615
616 CPDF_Dictionary* m_pFormDict; 606 CPDF_Dictionary* m_pFormDict;
617 607
618 std::map<const CPDF_Dictionary*, CPDF_FormControl*> m_ControlMap; 608 std::map<const CPDF_Dictionary*, CPDF_FormControl*> m_ControlMap;
619 609
620 std::unique_ptr<CFieldTree> m_pFieldTree; 610 std::unique_ptr<CFieldTree> m_pFieldTree;
621 611
622 CFX_ByteString m_bsEncoding; 612 CFX_ByteString m_bsEncoding;
623 613
624 CPDF_FormNotify* m_pFormNotify; 614 IPDF_FormNotify* m_pFormNotify;
625 615
626 FX_BOOL m_bUpdated;
627 friend class CPDF_FormControl; 616 friend class CPDF_FormControl;
628 friend class CPDF_FormField; 617 friend class CPDF_FormField;
629 }; 618 };
630 619
631 #define FORMFIELD_READONLY 0x01 620 #define FORMFIELD_READONLY 0x01
632 #define FORMFIELD_REQUIRED 0x02 621 #define FORMFIELD_REQUIRED 0x02
633 #define FORMFIELD_NOEXPORT 0x04 622 #define FORMFIELD_NOEXPORT 0x04
634 #define FORMRADIO_NOTOGGLEOFF 0x100 623 #define FORMRADIO_NOTOGGLEOFF 0x100
635 #define FORMRADIO_UNISON 0x200 624 #define FORMRADIO_UNISON 0x200
636 #define FORMTEXT_MULTILINE 0x100 625 #define FORMTEXT_MULTILINE 0x100
(...skipping 20 matching lines...) Expand all
657 CFX_WideString GetFullName(); 646 CFX_WideString GetFullName();
658 647
659 Type GetType() const { return m_Type; } 648 Type GetType() const { return m_Type; }
660 uint32_t GetFlags() const { return m_Flags; } 649 uint32_t GetFlags() const { return m_Flags; }
661 650
662 CPDF_Dictionary* GetFieldDict() const { return m_pDict; } 651 CPDF_Dictionary* GetFieldDict() const { return m_pDict; }
663 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } 652 void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; }
664 653
665 FX_BOOL ResetField(FX_BOOL bNotify = FALSE); 654 FX_BOOL ResetField(FX_BOOL bNotify = FALSE);
666 655
667 int CountControls() { return m_ControlList.GetSize(); } 656 int CountControls() const { return m_ControlList.GetSize(); }
668 657
669 CPDF_FormControl* GetControl(int index) { return m_ControlList.GetAt(index); } 658 CPDF_FormControl* GetControl(int index) const {
659 return m_ControlList.GetAt(index);
660 }
670 661
671 int GetControlIndex(const CPDF_FormControl* pControl); 662 int GetControlIndex(const CPDF_FormControl* pControl);
672 663
673 int GetFieldType(); 664 int GetFieldType();
674 665
675 CPDF_AAction GetAdditionalAction(); 666 CPDF_AAction GetAdditionalAction();
676 667
677 CFX_WideString GetAlternateName(); 668 CFX_WideString GetAlternateName();
678 669
679 CFX_WideString GetMappingName(); 670 CFX_WideString GetMappingName();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 FX_BOOL bNotify); 748 FX_BOOL bNotify);
758 749
759 void SyncFieldFlags(); 750 void SyncFieldFlags();
760 751
761 int FindListSel(CPDF_String* str); 752 int FindListSel(CPDF_String* str);
762 753
763 CFX_WideString GetOptionText(int index, int sub_index); 754 CFX_WideString GetOptionText(int index, int sub_index);
764 755
765 void LoadDA(); 756 void LoadDA();
766 757
767 void UpdateAP(CPDF_FormControl* pControl);
768
769 CFX_WideString GetCheckValue(FX_BOOL bDefault); 758 CFX_WideString GetCheckValue(FX_BOOL bDefault);
770 759
771 FX_BOOL SetCheckValue(const CFX_WideString& value, 760 FX_BOOL SetCheckValue(const CFX_WideString& value,
772 FX_BOOL bDefault, 761 FX_BOOL bDefault,
773 FX_BOOL bNotify); 762 FX_BOOL bNotify);
774 763
764 bool NotifyBeforeSelectionChange(const CFX_WideString& value);
765 void NotifyAfterSelectionChange();
766
767 bool NotifyBeforeValueChange(const CFX_WideString& value);
768 void NotifyAfterValueChange();
769
770 bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value);
771 void NotifyListOrComboBoxAfterChange();
772
775 CPDF_FormField::Type m_Type; 773 CPDF_FormField::Type m_Type;
776 uint32_t m_Flags; 774 uint32_t m_Flags;
777 CPDF_InterForm* m_pForm; 775 CPDF_InterForm* m_pForm;
778 CPDF_Dictionary* m_pDict; 776 CPDF_Dictionary* m_pDict;
779 CFX_ArrayTemplate<CPDF_FormControl*> m_ControlList; 777 CFX_ArrayTemplate<CPDF_FormControl*> m_ControlList;
780 FX_FLOAT m_FontSize; 778 FX_FLOAT m_FontSize;
781 CPDF_Font* m_pFont; 779 CPDF_Font* m_pFont;
782 780
783 friend class CPDF_InterForm; 781 friend class CPDF_InterForm;
784 friend class CPDF_FormControl; 782 friend class CPDF_FormControl;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } 819 CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; }
822 CFX_FloatRect GetRect() const; 820 CFX_FloatRect GetRect() const;
823 821
824 void DrawControl(CFX_RenderDevice* pDevice, 822 void DrawControl(CFX_RenderDevice* pDevice,
825 CFX_Matrix* pMatrix, 823 CFX_Matrix* pMatrix,
826 CPDF_Page* pPage, 824 CPDF_Page* pPage,
827 CPDF_Annot::AppearanceMode mode, 825 CPDF_Annot::AppearanceMode mode,
828 const CPDF_RenderOptions* pOptions = nullptr); 826 const CPDF_RenderOptions* pOptions = nullptr);
829 827
830 CFX_ByteString GetCheckedAPState(); 828 CFX_ByteString GetCheckedAPState();
831 CFX_WideString GetExportValue(); 829 CFX_WideString GetExportValue() const;
832 830
833 bool IsChecked() const; 831 bool IsChecked() const;
834 bool IsDefaultChecked() const; 832 bool IsDefaultChecked() const;
835 833
836 HighlightingMode GetHighlightingMode(); 834 HighlightingMode GetHighlightingMode();
837 bool HasMKEntry(const CFX_ByteString& csEntry) const; 835 bool HasMKEntry(const CFX_ByteString& csEntry) const;
838 int GetRotation(); 836 int GetRotation();
839 837
840 inline FX_ARGB GetBorderColor(int& iColorType) { 838 inline FX_ARGB GetBorderColor(int& iColorType) {
841 return GetColor(iColorType, "BC"); 839 return GetColor(iColorType, "BC");
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry); 885 FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry);
888 FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry); 886 FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry);
889 void GetOriginalColor(int& iColorType, 887 void GetOriginalColor(int& iColorType,
890 FX_FLOAT fc[4], 888 FX_FLOAT fc[4],
891 const CFX_ByteString& csEntry); 889 const CFX_ByteString& csEntry);
892 890
893 CFX_WideString GetCaption(const CFX_ByteString& csEntry); 891 CFX_WideString GetCaption(const CFX_ByteString& csEntry);
894 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry); 892 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry);
895 CPDF_ApSettings GetMK() const; 893 CPDF_ApSettings GetMK() const;
896 894
897 CPDF_InterForm* m_pForm; 895 CPDF_FormField* const m_pField;
898 CPDF_FormField* m_pField; 896 CPDF_Dictionary* const m_pWidgetDict;
899 CPDF_Dictionary* m_pWidgetDict; 897 CPDF_InterForm* const m_pForm;
900 898
901 friend class CPDF_InterForm; 899 friend class CPDF_InterForm;
902 friend class CPDF_FormField; 900 friend class CPDF_FormField;
903 }; 901 };
904 902
905 class CPDF_FormNotify { 903 class IPDF_FormNotify {
906 public: 904 public:
907 virtual ~CPDF_FormNotify() {} 905 virtual ~IPDF_FormNotify() {}
908 906
909 virtual int BeforeValueChange(CPDF_FormField* pField, 907 virtual int BeforeValueChange(CPDF_FormField* pField,
910 const CFX_WideString& csValue) { 908 const CFX_WideString& csValue) {
911 return 0; 909 return 0;
912 } 910 }
913 virtual void AfterValueChange(CPDF_FormField* pField) {} 911 virtual void AfterValueChange(CPDF_FormField* pField) {}
914 virtual int BeforeSelectionChange(CPDF_FormField* pField, 912 virtual int BeforeSelectionChange(CPDF_FormField* pField,
915 const CFX_WideString& csValue) { 913 const CFX_WideString& csValue) {
916 return 0; 914 return 0;
917 } 915 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 void GetOriginalColor(int& iColorType, 1007 void GetOriginalColor(int& iColorType,
1010 FX_FLOAT fc[4], 1008 FX_FLOAT fc[4],
1011 const CFX_ByteString& csEntry) const; 1009 const CFX_ByteString& csEntry) const;
1012 1010
1013 CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; 1011 CFX_WideString GetCaption(const CFX_ByteString& csEntry) const;
1014 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const; 1012 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const;
1015 1013
1016 CPDF_Dictionary* const m_pDict; 1014 CPDF_Dictionary* const m_pDict;
1017 }; 1015 };
1018 1016
1017 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
1018 CPDF_Annot::AppearanceMode mode);
1019
1019 #endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ 1020 #endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_
OLDNEW
« no previous file with comments | « core/fpdfdoc/doc_formfield.cpp ('k') | fpdfsdk/fpdf_ext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698