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