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