1 // Copyright 2016 The PDFium Authors 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_FWL_CFWL_EVENTTEXTWILLCHANGE_H_ 8 #define XFA_FWL_CFWL_EVENTTEXTWILLCHANGE_H_ 9 10 #include "core/fxcrt/widestring.h" 11 #include "xfa/fwl/cfwl_event.h" 12 13 class CFWL_EventTextWillChange final : public CFWL_Event { 14 public: 15 CFWL_EventTextWillChange(CFWL_Widget* pSrcTarget, 16 const WideString& change_text, 17 const WideString& previous_text, 18 size_t selection_start, 19 size_t selection_end); 20 ~CFWL_EventTextWillChange() override; 21 GetChangeText()22 WideString GetChangeText() const { return change_text_; } GetPreviousText()23 WideString GetPreviousText() const { return previous_text_; } GetSelectionStart()24 size_t GetSelectionStart() const { return selection_start_; } GetSelectionEnd()25 size_t GetSelectionEnd() const { return selection_end_; } GetCancelled()26 bool GetCancelled() const { return cancelled_; } 27 SetChangeText(const WideString & change_text)28 void SetChangeText(const WideString& change_text) { 29 change_text_ = change_text; 30 } SetPreviousText(const WideString & previous_text)31 void SetPreviousText(const WideString& previous_text) { 32 previous_text_ = previous_text; 33 } SetSelectionStart(size_t selection_start)34 void SetSelectionStart(size_t selection_start) { 35 selection_start_ = selection_start; 36 } SetSelectionEnd(size_t selection_end)37 void SetSelectionEnd(size_t selection_end) { selection_end_ = selection_end; } SetCancelled(bool cancelled)38 void SetCancelled(bool cancelled) { cancelled_ = cancelled; } 39 40 protected: 41 WideString change_text_; 42 WideString previous_text_; 43 size_t selection_start_; 44 size_t selection_end_; 45 bool cancelled_ = false; 46 }; 47 48 #endif // XFA_FWL_CFWL_EVENTTEXTWILLCHANGE_H_ 49