| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef CORE_FPDFDOC_INCLUDE_CPDF_FORMCONTROL_H_ | |
| 8 #define CORE_FPDFDOC_INCLUDE_CPDF_FORMCONTROL_H_ | |
| 9 | |
| 10 #include "core/fpdfdoc/cpdf_apsettings.h" | |
| 11 #include "core/fpdfdoc/include/cpdf_aaction.h" | |
| 12 #include "core/fpdfdoc/include/cpdf_action.h" | |
| 13 #include "core/fpdfdoc/include/cpdf_annot.h" | |
| 14 #include "core/fpdfdoc/include/cpdf_annotlist.h" | |
| 15 #include "core/fpdfdoc/include/cpdf_defaultappearance.h" | |
| 16 #include "core/fpdfdoc/include/cpdf_formfield.h" | |
| 17 #include "core/fpdfdoc/include/cpdf_iconfit.h" | |
| 18 #include "core/fpdfdoc/include/ipdf_formnotify.h" | |
| 19 #include "core/fxcrt/include/fx_coordinates.h" | |
| 20 #include "core/fxcrt/include/fx_string.h" | |
| 21 #include "core/fxge/include/fx_dib.h" | |
| 22 | |
| 23 #define TEXTPOS_CAPTION 0 | |
| 24 #define TEXTPOS_ICON 1 | |
| 25 #define TEXTPOS_BELOW 2 | |
| 26 #define TEXTPOS_ABOVE 3 | |
| 27 #define TEXTPOS_RIGHT 4 | |
| 28 #define TEXTPOS_LEFT 5 | |
| 29 #define TEXTPOS_OVERLAID 6 | |
| 30 | |
| 31 #define COLORTYPE_TRANSPARENT 0 | |
| 32 #define COLORTYPE_GRAY 1 | |
| 33 #define COLORTYPE_RGB 2 | |
| 34 #define COLORTYPE_CMYK 3 | |
| 35 | |
| 36 class CFX_RenderDevice; | |
| 37 class CPDF_Dictionary; | |
| 38 class CPDF_Font; | |
| 39 class CPDF_FormField; | |
| 40 class CPDF_InterForm; | |
| 41 class CPDF_OCContext; | |
| 42 class CPDF_RenderOptions; | |
| 43 class CPDF_Stream; | |
| 44 | |
| 45 class CPDF_FormControl { | |
| 46 public: | |
| 47 enum HighlightingMode { None = 0, Invert, Outline, Push, Toggle }; | |
| 48 | |
| 49 CPDF_FormField::Type GetType() const { return m_pField->GetType(); } | |
| 50 CPDF_InterForm* GetInterForm() const { return m_pForm; } | |
| 51 CPDF_FormField* GetField() const { return m_pField; } | |
| 52 CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } | |
| 53 CFX_FloatRect GetRect() const { return m_pWidgetDict->GetRectFor("Rect"); } | |
| 54 | |
| 55 void DrawControl(CFX_RenderDevice* pDevice, | |
| 56 CFX_Matrix* pMatrix, | |
| 57 CPDF_Page* pPage, | |
| 58 CPDF_Annot::AppearanceMode mode, | |
| 59 const CPDF_RenderOptions* pOptions = nullptr); | |
| 60 | |
| 61 CFX_ByteString GetCheckedAPState(); | |
| 62 CFX_WideString GetExportValue() const; | |
| 63 | |
| 64 bool IsChecked() const; | |
| 65 bool IsDefaultChecked() const; | |
| 66 | |
| 67 HighlightingMode GetHighlightingMode(); | |
| 68 bool HasMKEntry(const CFX_ByteString& csEntry) const; | |
| 69 int GetRotation(); | |
| 70 | |
| 71 FX_ARGB GetBorderColor(int& iColorType) { return GetColor(iColorType, "BC"); } | |
| 72 | |
| 73 FX_FLOAT GetOriginalBorderColor(int index) { | |
| 74 return GetOriginalColor(index, "BC"); | |
| 75 } | |
| 76 | |
| 77 void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) { | |
| 78 GetOriginalColor(iColorType, fc, "BC"); | |
| 79 } | |
| 80 | |
| 81 FX_ARGB GetBackgroundColor(int& iColorType) { | |
| 82 return GetColor(iColorType, "BG"); | |
| 83 } | |
| 84 | |
| 85 FX_FLOAT GetOriginalBackgroundColor(int index) { | |
| 86 return GetOriginalColor(index, "BG"); | |
| 87 } | |
| 88 | |
| 89 void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) { | |
| 90 GetOriginalColor(iColorType, fc, "BG"); | |
| 91 } | |
| 92 | |
| 93 CFX_WideString GetNormalCaption() { return GetCaption("CA"); } | |
| 94 CFX_WideString GetRolloverCaption() { return GetCaption("RC"); } | |
| 95 CFX_WideString GetDownCaption() { return GetCaption("AC"); } | |
| 96 | |
| 97 CPDF_Stream* GetNormalIcon() { return GetIcon("I"); } | |
| 98 CPDF_Stream* GetRolloverIcon() { return GetIcon("RI"); } | |
| 99 CPDF_Stream* GetDownIcon() { return GetIcon("IX"); } | |
| 100 CPDF_IconFit GetIconFit(); | |
| 101 | |
| 102 int GetTextPosition(); | |
| 103 CPDF_Action GetAction(); | |
| 104 CPDF_AAction GetAdditionalAction(); | |
| 105 CPDF_DefaultAppearance GetDefaultAppearance(); | |
| 106 | |
| 107 CPDF_Font* GetDefaultControlFont(); | |
| 108 int GetControlAlignment(); | |
| 109 | |
| 110 private: | |
| 111 friend class CPDF_InterForm; | |
| 112 friend class CPDF_FormField; | |
| 113 | |
| 114 CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict); | |
| 115 | |
| 116 CFX_ByteString GetOnStateName() const; | |
| 117 void SetOnStateName(const CFX_ByteString& csOn); | |
| 118 void CheckControl(FX_BOOL bChecked); | |
| 119 FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry); | |
| 120 FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry); | |
| 121 void GetOriginalColor(int& iColorType, | |
| 122 FX_FLOAT fc[4], | |
| 123 const CFX_ByteString& csEntry); | |
| 124 | |
| 125 CFX_WideString GetCaption(const CFX_ByteString& csEntry); | |
| 126 CPDF_Stream* GetIcon(const CFX_ByteString& csEntry); | |
| 127 CPDF_ApSettings GetMK() const; | |
| 128 | |
| 129 CPDF_FormField* const m_pField; | |
| 130 CPDF_Dictionary* const m_pWidgetDict; | |
| 131 CPDF_InterForm* const m_pForm; | |
| 132 }; | |
| 133 | |
| 134 #endif // CORE_FPDFDOC_INCLUDE_CPDF_FORMCONTROL_H_ | |
| OLD | NEW |