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 XFA_FXFA_APP_XFA_FFTEXTEDIT_H_ | 7 #ifndef XFA_FXFA_APP_XFA_FFTEXTEDIT_H_ |
8 #define XFA_FXFA_APP_XFA_FFTEXTEDIT_H_ | 8 #define XFA_FXFA_APP_XFA_FFTEXTEDIT_H_ |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "xfa/fxfa/app/xfa_fffield.h" | 12 #include "xfa/fxfa/app/xfa_fffield.h" |
13 | 13 |
14 class CXFA_FFTextEdit : public CXFA_FFField { | 14 class CXFA_FFTextEdit : public CXFA_FFField { |
15 public: | 15 public: |
16 CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); | 16 CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); |
17 ~CXFA_FFTextEdit() override; | 17 ~CXFA_FFTextEdit() override; |
18 | 18 |
19 // CXFA_FFField | 19 // CXFA_FFField |
20 FX_BOOL LoadWidget() override; | 20 bool LoadWidget() override; |
21 void UpdateWidgetProperty() override; | 21 void UpdateWidgetProperty() override; |
22 FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 22 bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
23 FX_BOOL OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 23 bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
24 FX_BOOL OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; | 24 bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; |
25 FX_BOOL OnSetFocus(CXFA_FFWidget* pOldWidget) override; | 25 bool OnSetFocus(CXFA_FFWidget* pOldWidget) override; |
26 FX_BOOL OnKillFocus(CXFA_FFWidget* pNewWidget) override; | 26 bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; |
27 FX_BOOL CanUndo() override; | 27 bool CanUndo() override; |
28 FX_BOOL CanRedo() override; | 28 bool CanRedo() override; |
29 FX_BOOL Undo() override; | 29 bool Undo() override; |
30 FX_BOOL Redo() override; | 30 bool Redo() override; |
31 FX_BOOL CanCopy() override; | 31 bool CanCopy() override; |
32 FX_BOOL CanCut() override; | 32 bool CanCut() override; |
33 FX_BOOL CanPaste() override; | 33 bool CanPaste() override; |
34 FX_BOOL CanSelectAll() override; | 34 bool CanSelectAll() override; |
35 FX_BOOL Copy(CFX_WideString& wsCopy) override; | 35 bool Copy(CFX_WideString& wsCopy) override; |
36 FX_BOOL Cut(CFX_WideString& wsCut) override; | 36 bool Cut(CFX_WideString& wsCut) override; |
37 FX_BOOL Paste(const CFX_WideString& wsPaste) override; | 37 bool Paste(const CFX_WideString& wsPaste) override; |
38 FX_BOOL SelectAll() override; | 38 bool SelectAll() override; |
39 FX_BOOL Delete() override; | 39 bool Delete() override; |
40 FX_BOOL DeSelect() override; | 40 bool DeSelect() override; |
41 FX_BOOL GetSuggestWords(CFX_PointF pointf, | 41 bool GetSuggestWords(CFX_PointF pointf, |
42 std::vector<CFX_ByteString>& sSuggest) override; | 42 std::vector<CFX_ByteString>& sSuggest) override; |
43 FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, | 43 bool ReplaceSpellCheckWord(CFX_PointF pointf, |
44 const CFX_ByteStringC& bsReplace) override; | 44 const CFX_ByteStringC& bsReplace) override; |
45 void OnProcessMessage(CFWL_Message* pMessage) override; | 45 void OnProcessMessage(CFWL_Message* pMessage) override; |
46 void OnProcessEvent(CFWL_Event* pEvent) override; | 46 void OnProcessEvent(CFWL_Event* pEvent) override; |
47 void OnDrawWidget(CFX_Graphics* pGraphics, | 47 void OnDrawWidget(CFX_Graphics* pGraphics, |
48 const CFX_Matrix* pMatrix = nullptr) override; | 48 const CFX_Matrix* pMatrix = nullptr) override; |
49 | 49 |
50 void OnTextChanged(IFWL_Widget* pWidget, | 50 void OnTextChanged(IFWL_Widget* pWidget, |
51 const CFX_WideString& wsChanged, | 51 const CFX_WideString& wsChanged, |
52 const CFX_WideString& wsPrevText); | 52 const CFX_WideString& wsPrevText); |
53 void OnTextFull(IFWL_Widget* pWidget); | 53 void OnTextFull(IFWL_Widget* pWidget); |
54 FX_BOOL CheckWord(const CFX_ByteStringC& sWord); | 54 bool CheckWord(const CFX_ByteStringC& sWord); |
55 | 55 |
56 protected: | 56 protected: |
57 FX_BOOL CommitData() override; | 57 bool CommitData() override; |
58 FX_BOOL UpdateFWLData() override; | 58 bool UpdateFWLData() override; |
59 FX_BOOL IsDataChanged() override; | 59 bool IsDataChanged() override; |
60 | 60 |
61 uint32_t GetAlignment(); | 61 uint32_t GetAlignment(); |
62 void ValidateNumberField(const CFX_WideString& wsText); | 62 void ValidateNumberField(const CFX_WideString& wsText); |
63 | 63 |
64 IFWL_WidgetDelegate* m_pOldDelegate; | 64 IFWL_WidgetDelegate* m_pOldDelegate; |
65 }; | 65 }; |
66 | 66 |
67 class CXFA_FFNumericEdit : public CXFA_FFTextEdit { | 67 class CXFA_FFNumericEdit : public CXFA_FFTextEdit { |
68 public: | 68 public: |
69 CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); | 69 CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); |
70 ~CXFA_FFNumericEdit() override; | 70 ~CXFA_FFNumericEdit() override; |
71 | 71 |
72 // CXFA_FFTextEdit | 72 // CXFA_FFTextEdit |
73 FX_BOOL LoadWidget() override; | 73 bool LoadWidget() override; |
74 void UpdateWidgetProperty() override; | 74 void UpdateWidgetProperty() override; |
75 void OnProcessEvent(CFWL_Event* pEvent) override; | 75 void OnProcessEvent(CFWL_Event* pEvent) override; |
76 | 76 |
77 public: | 77 public: |
78 FX_BOOL OnValidate(IFWL_Widget* pWidget, CFX_WideString& wsText); | 78 bool OnValidate(IFWL_Widget* pWidget, CFX_WideString& wsText); |
79 }; | 79 }; |
80 | 80 |
81 class CXFA_FFPasswordEdit : public CXFA_FFTextEdit { | 81 class CXFA_FFPasswordEdit : public CXFA_FFTextEdit { |
82 public: | 82 public: |
83 CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); | 83 CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); |
84 ~CXFA_FFPasswordEdit() override; | 84 ~CXFA_FFPasswordEdit() override; |
85 | 85 |
86 // CXFA_FFTextEdit | 86 // CXFA_FFTextEdit |
87 FX_BOOL LoadWidget() override; | 87 bool LoadWidget() override; |
88 void UpdateWidgetProperty() override; | 88 void UpdateWidgetProperty() override; |
89 | 89 |
90 protected: | 90 protected: |
91 }; | 91 }; |
92 | 92 |
93 enum XFA_DATETIMETYPE { | 93 enum XFA_DATETIMETYPE { |
94 XFA_DATETIMETYPE_Date = 0, | 94 XFA_DATETIMETYPE_Date = 0, |
95 XFA_DATETIMETYPE_Time, | 95 XFA_DATETIMETYPE_Time, |
96 XFA_DATETIMETYPE_DateAndTime | 96 XFA_DATETIMETYPE_DateAndTime |
97 }; | 97 }; |
98 | 98 |
99 class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { | 99 class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { |
100 public: | 100 public: |
101 CXFA_FFDateTimeEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); | 101 CXFA_FFDateTimeEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc); |
102 ~CXFA_FFDateTimeEdit() override; | 102 ~CXFA_FFDateTimeEdit() override; |
103 | 103 |
104 // CXFA_FFTextEdit | 104 // CXFA_FFTextEdit |
105 FX_BOOL GetBBox(CFX_RectF& rtBox, | 105 bool GetBBox(CFX_RectF& rtBox, |
106 uint32_t dwStatus, | 106 uint32_t dwStatus, |
107 FX_BOOL bDrawFocus = FALSE) override; | 107 bool bDrawFocus = false) override; |
108 FX_BOOL LoadWidget() override; | 108 bool LoadWidget() override; |
109 void UpdateWidgetProperty() override; | 109 void UpdateWidgetProperty() override; |
110 | 110 |
111 FX_BOOL CanUndo() override; | 111 bool CanUndo() override; |
112 FX_BOOL CanRedo() override; | 112 bool CanRedo() override; |
113 FX_BOOL Undo() override; | 113 bool Undo() override; |
114 FX_BOOL Redo() override; | 114 bool Redo() override; |
115 FX_BOOL CanCopy() override; | 115 bool CanCopy() override; |
116 FX_BOOL CanCut() override; | 116 bool CanCut() override; |
117 FX_BOOL CanPaste() override; | 117 bool CanPaste() override; |
118 FX_BOOL CanSelectAll() override; | 118 bool CanSelectAll() override; |
119 FX_BOOL Copy(CFX_WideString& wsCopy) override; | 119 bool Copy(CFX_WideString& wsCopy) override; |
120 FX_BOOL Cut(CFX_WideString& wsCut) override; | 120 bool Cut(CFX_WideString& wsCut) override; |
121 FX_BOOL Paste(const CFX_WideString& wsPaste) override; | 121 bool Paste(const CFX_WideString& wsPaste) override; |
122 FX_BOOL SelectAll() override; | 122 bool SelectAll() override; |
123 FX_BOOL Delete() override; | 123 bool Delete() override; |
124 FX_BOOL DeSelect() override; | 124 bool DeSelect() override; |
125 void OnProcessEvent(CFWL_Event* pEvent) override; | 125 void OnProcessEvent(CFWL_Event* pEvent) override; |
126 | 126 |
127 void OnSelectChanged(IFWL_Widget* pWidget, | 127 void OnSelectChanged(IFWL_Widget* pWidget, |
128 int32_t iYear, | 128 int32_t iYear, |
129 int32_t iMonth, | 129 int32_t iMonth, |
130 int32_t iDay); | 130 int32_t iDay); |
131 | 131 |
132 protected: | 132 protected: |
133 FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; | 133 bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; |
134 FX_BOOL CommitData() override; | 134 bool CommitData() override; |
135 FX_BOOL UpdateFWLData() override; | 135 bool UpdateFWLData() override; |
136 FX_BOOL IsDataChanged() override; | 136 bool IsDataChanged() override; |
137 | 137 |
138 uint32_t GetAlignment(); | 138 uint32_t GetAlignment(); |
139 }; | 139 }; |
140 | 140 |
141 #endif // XFA_FXFA_APP_XFA_FFTEXTEDIT_H_ | 141 #endif // XFA_FXFA_APP_XFA_FFTEXTEDIT_H_ |
OLD | NEW |