1 // Copyright 2017 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_FXFA_CXFA_FFTEXTEDIT_H_ 8 #define XFA_FXFA_CXFA_FFTEXTEDIT_H_ 9 10 #include "core/fxcrt/fx_coordinates.h" 11 #include "core/fxcrt/fx_string.h" 12 #include "xfa/fxfa/cxfa_fffield.h" 13 14 class CFWL_Event; 15 class CFWL_Widget; 16 class CFX_Matrix; 17 class CXFA_FFWidget; 18 class CXFA_WidgetAcc; 19 class IFWL_WidgetDelegate; 20 21 class CXFA_FFTextEdit : public CXFA_FFField { 22 public: 23 explicit CXFA_FFTextEdit(CXFA_Node* pNode); 24 ~CXFA_FFTextEdit() override; 25 26 // CXFA_FFField 27 bool LoadWidget() override; 28 void UpdateWidgetProperty() override; 29 bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; 30 bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; 31 bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; 32 bool OnSetFocus(CXFA_FFWidget* pOldWidget) override; 33 bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; 34 void OnProcessMessage(CFWL_Message* pMessage) override; 35 void OnProcessEvent(CFWL_Event* pEvent) override; 36 void OnDrawWidget(CXFA_Graphics* pGraphics, 37 const CFX_Matrix& matrix) override; 38 39 void OnTextChanged(CFWL_Widget* pWidget, 40 const WideString& wsChanged, 41 const WideString& wsPrevText); 42 void OnTextFull(CFWL_Widget* pWidget); 43 bool CheckWord(const ByteStringView& sWord); 44 45 // CXFA_FFWidget 46 bool CanUndo() override; 47 bool CanRedo() override; 48 bool Undo() override; 49 bool Redo() override; 50 bool CanCopy() override; 51 bool CanCut() override; 52 bool CanPaste() override; 53 bool CanSelectAll() override; 54 Optional<WideString> Copy() override; 55 Optional<WideString> Cut() override; 56 bool Paste(const WideString& wsPaste) override; 57 void SelectAll() override; 58 void Delete() override; 59 void DeSelect() override; 60 FormFieldType GetFormFieldType() override; 61 62 protected: 63 uint32_t GetAlignment(); 64 65 IFWL_WidgetDelegate* m_pOldDelegate; 66 67 private: 68 bool CommitData() override; 69 bool UpdateFWLData() override; 70 bool IsDataChanged() override; 71 void ValidateNumberField(const WideString& wsText); 72 }; 73 74 #endif // XFA_FXFA_CXFA_FFTEXTEDIT_H_ 75