summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfwl_edit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl/cfwl_edit.cpp')
-rw-r--r--xfa/fwl/cfwl_edit.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 7bdb818192..7c4f0e1607 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -19,7 +19,7 @@
#include "xfa/fwl/cfwl_app.h"
#include "xfa/fwl/cfwl_caret.h"
#include "xfa/fwl/cfwl_event.h"
-#include "xfa/fwl/cfwl_eventtextchanged.h"
+#include "xfa/fwl/cfwl_eventtextwillchange.h"
#include "xfa/fwl/cfwl_eventvalidate.h"
#include "xfa/fwl/cfwl_messagekey.h"
#include "xfa/fwl/cfwl_messagemouse.h"
@@ -171,9 +171,10 @@ void CFWL_Edit::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
m_pProperties->m_pThemeProvider = pThemeProvider;
}
-void CFWL_Edit::SetText(const WideString& wsText) {
+void CFWL_Edit::SetText(const WideString& wsText,
+ CFDE_TextEditEngine::RecordOperation op) {
m_EdtEngine.Clear();
- m_EdtEngine.Insert(0, wsText);
+ m_EdtEngine.Insert(0, wsText, op);
}
int32_t CFWL_Edit::GetTextLength() const {
@@ -297,14 +298,26 @@ void CFWL_Edit::OnCaretChanged() {
}
}
-void CFWL_Edit::OnTextChanged(const WideString& prevText) {
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VAlignMask)
- UpdateVAlignment();
+void CFWL_Edit::OnTextWillChange(CFDE_TextEditEngine::TextChange* change) {
+ CFWL_EventTextWillChange event(this);
+ event.previous_text = change->previous_text;
+ event.change_text = change->text;
+ event.selection_start = change->selection_start;
+ event.selection_end = change->selection_end;
+ event.cancelled = false;
- CFWL_EventTextChanged event(this);
- event.wsPrevText = prevText;
DispatchEvent(&event);
+ change->text = event.change_text;
+ change->selection_start = event.selection_start;
+ change->selection_end = event.selection_end;
+ change->cancelled = event.cancelled;
+}
+
+void CFWL_Edit::OnTextChanged() {
+ if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_VAlignMask)
+ UpdateVAlignment();
+
LayoutScrollBar();
RepaintRect(GetClientRect());
}