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_FWL_BASEWIDGET_FWL_EDITIMP_H_ | 7 #ifndef XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ |
8 #define XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ | 8 #define XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "xfa/fee/ifde_txtedtengine.h" | 13 #include "xfa/fee/ifde_txtedtengine.h" |
14 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" | 14 #include "xfa/fwl/basewidget/ifwl_scrollbar.h" |
15 #include "xfa/fwl/core/fwl_widgetimp.h" | 15 #include "xfa/fwl/core/fwl_widgetimp.h" |
16 #include "xfa/fxgraphics/cfx_path.h" | 16 #include "xfa/fxgraphics/cfx_path.h" |
17 | 17 |
18 class CFWL_MsgActivate; | 18 class CFWL_MsgActivate; |
19 class CFWL_MsgDeactivate; | 19 class CFWL_MsgDeactivate; |
20 class CFWL_MsgMouse; | 20 class CFWL_MsgMouse; |
21 class CFWL_WidgetImpProperties; | 21 class CFWL_WidgetImpProperties; |
22 class CFWL_WidgetImpDelegate; | 22 class CFWL_WidgetImpDelegate; |
23 class IFWL_Caret; | 23 class IFWL_Caret; |
24 class CFWL_EditImp; | 24 class CFWL_EditImp; |
25 class CFWL_EditImpDelegate; | 25 class CFWL_EditImpDelegate; |
26 | 26 |
27 class CFWL_EditImp : public CFWL_WidgetImp, public IFDE_TxtEdtEventSink { | 27 class CFWL_EditImp : public CFWL_WidgetImp { |
28 public: | 28 public: |
29 CFWL_EditImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); | 29 CFWL_EditImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); |
30 ~CFWL_EditImp() override; | 30 ~CFWL_EditImp() override; |
31 | 31 |
32 // CFWL_WidgetImp: | 32 // CFWL_WidgetImp: |
33 FWL_ERR GetClassName(CFX_WideString& wsClass) const override; | 33 FWL_ERR GetClassName(CFX_WideString& wsClass) const override; |
34 uint32_t GetClassID() const override; | 34 uint32_t GetClassID() const override; |
35 FWL_ERR Initialize() override; | 35 FWL_ERR Initialize() override; |
36 FWL_ERR Finalize() override; | 36 FWL_ERR Finalize() override; |
37 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; | 37 FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 virtual FX_BOOL Delete(); | 72 virtual FX_BOOL Delete(); |
73 virtual FX_BOOL Redo(const CFX_ByteStringC& bsRecord); | 73 virtual FX_BOOL Redo(const CFX_ByteStringC& bsRecord); |
74 virtual FX_BOOL Undo(const CFX_ByteStringC& bsRecord); | 74 virtual FX_BOOL Undo(const CFX_ByteStringC& bsRecord); |
75 virtual FX_BOOL Undo(); | 75 virtual FX_BOOL Undo(); |
76 virtual FX_BOOL Redo(); | 76 virtual FX_BOOL Redo(); |
77 virtual FX_BOOL CanUndo(); | 77 virtual FX_BOOL CanUndo(); |
78 virtual FX_BOOL CanRedo(); | 78 virtual FX_BOOL CanRedo(); |
79 virtual FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); | 79 virtual FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); |
80 virtual FWL_ERR SetOuter(IFWL_Widget* pOuter); | 80 virtual FWL_ERR SetOuter(IFWL_Widget* pOuter); |
81 virtual FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); | 81 virtual FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); |
82 void On_CaretChanged(IFDE_TxtEdtEngine* pEdit, | |
83 int32_t nPage, | |
84 FX_BOOL bVisible = true) override; | |
85 void On_TextChanged(IFDE_TxtEdtEngine* pEdit, | |
86 FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo) override; | |
87 void On_PageCountChanged(IFDE_TxtEdtEngine* pEdit) override {} | |
88 void On_SelChanged(IFDE_TxtEdtEngine* pEdit) override; | |
89 FX_BOOL On_PageLoad(IFDE_TxtEdtEngine* pEdit, | |
90 int32_t nPageIndex, | |
91 int32_t nPurpose) override; | |
92 FX_BOOL On_PageUnload(IFDE_TxtEdtEngine* pEdit, | |
93 int32_t nPageIndex, | |
94 int32_t nPurpose) override; | |
95 FX_BOOL On_PageChange(IFDE_TxtEdtEngine* pEdit, int32_t nPageIndex) override { | |
96 return TRUE; | |
97 } | |
98 void On_AddDoRecord(IFDE_TxtEdtEngine* pEdit, | |
99 const CFX_ByteStringC& bsDoRecord) override; | |
100 FX_BOOL On_ValidateField(IFDE_TxtEdtEngine* pEdit, | |
101 int32_t nBlockIndex, | |
102 int32_t nFieldIndex, | |
103 const CFX_WideString& wsFieldText, | |
104 int32_t nCharIndex) override; | |
105 FX_BOOL On_ValidateBlock(IFDE_TxtEdtEngine* pEdit, | |
106 int32_t nBlockIndex) override; | |
107 FX_BOOL On_GetBlockFormatText(IFDE_TxtEdtEngine* pEdit, | |
108 int32_t nBlockIndex, | |
109 CFX_WideString& wsBlockText) override; | |
110 FX_BOOL On_Validate(IFDE_TxtEdtEngine* pEdit, | |
111 CFX_WideString& wsText) override; | |
112 virtual FWL_ERR SetBackgroundColor(uint32_t color); | 82 virtual FWL_ERR SetBackgroundColor(uint32_t color); |
113 virtual FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); | 83 virtual FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); |
| 84 |
| 85 void On_CaretChanged(CFDE_TxtEdtEngine* pEdit, |
| 86 int32_t nPage, |
| 87 FX_BOOL bVisible = true); |
| 88 void On_TextChanged(CFDE_TxtEdtEngine* pEdit, |
| 89 FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo); |
| 90 void On_SelChanged(CFDE_TxtEdtEngine* pEdit); |
| 91 FX_BOOL On_PageLoad(CFDE_TxtEdtEngine* pEdit, |
| 92 int32_t nPageIndex, |
| 93 int32_t nPurpose); |
| 94 FX_BOOL On_PageUnload(CFDE_TxtEdtEngine* pEdit, |
| 95 int32_t nPageIndex, |
| 96 int32_t nPurpose); |
| 97 void On_AddDoRecord(CFDE_TxtEdtEngine* pEdit, |
| 98 const CFX_ByteStringC& bsDoRecord); |
| 99 FX_BOOL On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText); |
114 void SetScrollOffset(FX_FLOAT fScrollOffset); | 100 void SetScrollOffset(FX_FLOAT fScrollOffset); |
115 FX_BOOL GetSuggestWords(CFX_PointF pointf, | 101 FX_BOOL GetSuggestWords(CFX_PointF pointf, |
116 std::vector<CFX_ByteString>& sSuggest); | 102 std::vector<CFX_ByteString>& sSuggest); |
117 FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, | 103 FX_BOOL ReplaceSpellCheckWord(CFX_PointF pointf, |
118 const CFX_ByteStringC& bsReplace); | 104 const CFX_ByteStringC& bsReplace); |
119 | 105 |
120 protected: | 106 protected: |
121 void DrawTextBk(CFX_Graphics* pGraphics, | 107 void DrawTextBk(CFX_Graphics* pGraphics, |
122 IFWL_ThemeProvider* pTheme, | 108 IFWL_ThemeProvider* pTheme, |
123 const CFX_Matrix* pMatrix = NULL); | 109 const CFX_Matrix* pMatrix = NULL); |
(...skipping 29 matching lines...) Expand all Loading... |
153 int32_t nCount, | 139 int32_t nCount, |
154 FX_FLOAT fOffSetX, | 140 FX_FLOAT fOffSetX, |
155 FX_FLOAT fOffSetY); | 141 FX_FLOAT fOffSetY); |
156 int32_t GetWordAtPoint(CFX_PointF pointf, int32_t& nCount); | 142 int32_t GetWordAtPoint(CFX_PointF pointf, int32_t& nCount); |
157 CFX_RectF m_rtClient; | 143 CFX_RectF m_rtClient; |
158 CFX_RectF m_rtEngine; | 144 CFX_RectF m_rtEngine; |
159 CFX_RectF m_rtStatic; | 145 CFX_RectF m_rtStatic; |
160 FX_FLOAT m_fVAlignOffset; | 146 FX_FLOAT m_fVAlignOffset; |
161 FX_FLOAT m_fScrollOffsetX; | 147 FX_FLOAT m_fScrollOffsetX; |
162 FX_FLOAT m_fScrollOffsetY; | 148 FX_FLOAT m_fScrollOffsetY; |
163 IFDE_TxtEdtEngine* m_pEdtEngine; | 149 CFDE_TxtEdtEngine* m_pEdtEngine; |
164 FX_BOOL m_bLButtonDown; | 150 FX_BOOL m_bLButtonDown; |
165 int32_t m_nSelStart; | 151 int32_t m_nSelStart; |
166 int32_t m_nLimit; | 152 int32_t m_nLimit; |
167 FX_FLOAT m_fSpaceAbove; | 153 FX_FLOAT m_fSpaceAbove; |
168 FX_FLOAT m_fSpaceBelow; | 154 FX_FLOAT m_fSpaceBelow; |
169 FX_FLOAT m_fFontSize; | 155 FX_FLOAT m_fFontSize; |
170 FX_ARGB m_argbSel; | 156 FX_ARGB m_argbSel; |
171 FX_BOOL m_bSetRange; | 157 FX_BOOL m_bSetRange; |
172 int32_t m_iMin; | 158 int32_t m_iMin; |
173 int32_t m_iMax; | 159 int32_t m_iMax; |
(...skipping 29 matching lines...) Expand all Loading... |
203 void OnButtonDblClk(CFWL_MsgMouse* pMsg); | 189 void OnButtonDblClk(CFWL_MsgMouse* pMsg); |
204 void OnMouseMove(CFWL_MsgMouse* pMsg); | 190 void OnMouseMove(CFWL_MsgMouse* pMsg); |
205 void OnKeyDown(CFWL_MsgKey* pMsg); | 191 void OnKeyDown(CFWL_MsgKey* pMsg); |
206 void OnChar(CFWL_MsgKey* pMsg); | 192 void OnChar(CFWL_MsgKey* pMsg); |
207 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); | 193 FX_BOOL OnScroll(IFWL_ScrollBar* pScrollBar, uint32_t dwCode, FX_FLOAT fPos); |
208 void DoCursor(CFWL_MsgMouse* pMsg); | 194 void DoCursor(CFWL_MsgMouse* pMsg); |
209 CFWL_EditImp* m_pOwner; | 195 CFWL_EditImp* m_pOwner; |
210 }; | 196 }; |
211 | 197 |
212 #endif // XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ | 198 #endif // XFA_FWL_BASEWIDGET_FWL_EDITIMP_H_ |
OLD | NEW |