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 namespace pdfium { 14 15 class CFWL_EventTextWillChange final : public CFWL_Event { 16 public: 17 CFWL_EventTextWillChange(CFWL_Widget* pSrcTarget, 18 const WideString& change_text, 19 const WideString& previous_text, 20 size_t selection_start, 21 size_t selection_end); 22 ~CFWL_EventTextWillChange() override; 23 GetChangeText()24 WideString GetChangeText() const { return change_text_; } GetPreviousText()25 WideString GetPreviousText() const { return previous_text_; } GetSelectionStart()26 size_t GetSelectionStart() const { return selection_start_; } GetSelectionEnd()27 size_t GetSelectionEnd() const { return selection_end_; } GetCancelled()28 bool GetCancelled() const { return cancelled_; } 29 SetChangeText(const WideString & change_text)30 void SetChangeText(const WideString& change_text) { 31 change_text_ = change_text; 32 } SetPreviousText(const WideString & previous_text)33 void SetPreviousText(const WideString& previous_text) { 34 previous_text_ = previous_text; 35 } SetSelectionStart(size_t selection_start)36 void SetSelectionStart(size_t selection_start) { 37 selection_start_ = selection_start; 38 } SetSelectionEnd(size_t selection_end)39 void SetSelectionEnd(size_t selection_end) { selection_end_ = selection_end; } SetCancelled(bool cancelled)40 void SetCancelled(bool cancelled) { cancelled_ = cancelled; } 41 42 protected: 43 WideString change_text_; 44 WideString previous_text_; 45 size_t selection_start_; 46 size_t selection_end_; 47 bool cancelled_ = false; 48 }; 49 50 } // namespace pdfium 51 52 // TODO(crbug.com/42271761): Remove. 53 using pdfium::CFWL_EventTextWillChange; 54 55 #endif // XFA_FWL_CFWL_EVENTTEXTWILLCHANGE_H_ 56