summaryrefslogtreecommitdiff
path: root/xfa/fwl/core
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl/core')
-rw-r--r--xfa/fwl/core/cfwl_evtcheckword.cpp15
-rw-r--r--xfa/fwl/core/cfwl_evtcheckword.h23
-rw-r--r--xfa/fwl/core/cfwl_evttextchanged.cpp15
-rw-r--r--xfa/fwl/core/cfwl_evttextchanged.h25
-rw-r--r--xfa/fwl/core/cfwl_evttextfull.cpp15
-rw-r--r--xfa/fwl/core/cfwl_evttextfull.h20
-rw-r--r--xfa/fwl/core/cfwl_evtvalidate.cpp15
-rw-r--r--xfa/fwl/core/cfwl_evtvalidate.h24
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp5
-rw-r--r--xfa/fwl/core/ifwl_edit.cpp27
-rw-r--r--xfa/fwl/core/ifwl_edit.h26
11 files changed, 169 insertions, 41 deletions
diff --git a/xfa/fwl/core/cfwl_evtcheckword.cpp b/xfa/fwl/core/cfwl_evtcheckword.cpp
new file mode 100644
index 0000000000..99ecee96e0
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evtcheckword.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fwl/core/cfwl_evtcheckword.h"
+
+CFWL_EvtCheckWord::CFWL_EvtCheckWord() {}
+
+CFWL_EvtCheckWord::~CFWL_EvtCheckWord() {}
+
+CFWL_EventType CFWL_EvtCheckWord::GetClassID() const {
+ return CFWL_EventType::CheckWord;
+}
diff --git a/xfa/fwl/core/cfwl_evtcheckword.h b/xfa/fwl/core/cfwl_evtcheckword.h
new file mode 100644
index 0000000000..aceb865cf5
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evtcheckword.h
@@ -0,0 +1,23 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FWL_CORE_CFWL_EVTCHECKWORD_H_
+#define XFA_FWL_CORE_CFWL_EVTCHECKWORD_H_
+
+#include "xfa/fwl/core/cfwl_event.h"
+
+class CFWL_EvtCheckWord : public CFWL_Event {
+ public:
+ CFWL_EvtCheckWord();
+ ~CFWL_EvtCheckWord() override;
+
+ CFWL_EventType GetClassID() const override;
+
+ CFX_ByteString bsWord;
+ bool bCheckWord;
+};
+
+#endif // XFA_FWL_CORE_CFWL_EVTCHECKWORD_H_
diff --git a/xfa/fwl/core/cfwl_evttextchanged.cpp b/xfa/fwl/core/cfwl_evttextchanged.cpp
new file mode 100644
index 0000000000..76718be6a2
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evttextchanged.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fwl/core/cfwl_evttextchanged.h"
+
+CFWL_EvtTextChanged::CFWL_EvtTextChanged() {}
+
+CFWL_EvtTextChanged::~CFWL_EvtTextChanged() {}
+
+CFWL_EventType CFWL_EvtTextChanged::GetClassID() const {
+ return CFWL_EventType::TextChanged;
+}
diff --git a/xfa/fwl/core/cfwl_evttextchanged.h b/xfa/fwl/core/cfwl_evttextchanged.h
new file mode 100644
index 0000000000..69d28bb4a6
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evttextchanged.h
@@ -0,0 +1,25 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FWL_CORE_CFWL_EVTTEXTCHANGED_H_
+#define XFA_FWL_CORE_CFWL_EVTTEXTCHANGED_H_
+
+#include "xfa/fwl/core/cfwl_event.h"
+
+class CFWL_EvtTextChanged : public CFWL_Event {
+ public:
+ CFWL_EvtTextChanged();
+ ~CFWL_EvtTextChanged() override;
+
+ CFWL_EventType GetClassID() const override;
+
+ int32_t nChangeType;
+ CFX_WideString wsInsert;
+ CFX_WideString wsDelete;
+ CFX_WideString wsPrevText;
+};
+
+#endif // XFA_FWL_CORE_CFWL_EVTTEXTCHANGED_H_
diff --git a/xfa/fwl/core/cfwl_evttextfull.cpp b/xfa/fwl/core/cfwl_evttextfull.cpp
new file mode 100644
index 0000000000..4762f24755
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evttextfull.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fwl/core/cfwl_evttextfull.h"
+
+CFWL_EvtTextFull::CFWL_EvtTextFull() {}
+
+CFWL_EvtTextFull::~CFWL_EvtTextFull() {}
+
+CFWL_EventType CFWL_EvtTextFull::GetClassID() const {
+ return CFWL_EventType::TextFull;
+}
diff --git a/xfa/fwl/core/cfwl_evttextfull.h b/xfa/fwl/core/cfwl_evttextfull.h
new file mode 100644
index 0000000000..40fcd8a84e
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evttextfull.h
@@ -0,0 +1,20 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FWL_CORE_CFWL_EVTTEXTFULL_H_
+#define XFA_FWL_CORE_CFWL_EVTTEXTFULL_H_
+
+#include "xfa/fwl/core/cfwl_event.h"
+
+class CFWL_EvtTextFull : public CFWL_Event {
+ public:
+ CFWL_EvtTextFull();
+ ~CFWL_EvtTextFull() override;
+
+ CFWL_EventType GetClassID() const override;
+};
+
+#endif // XFA_FWL_CORE_CFWL_EVTTEXTFULL_H_
diff --git a/xfa/fwl/core/cfwl_evtvalidate.cpp b/xfa/fwl/core/cfwl_evtvalidate.cpp
new file mode 100644
index 0000000000..7b795f6ca6
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evtvalidate.cpp
@@ -0,0 +1,15 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "xfa/fwl/core/cfwl_evtvalidate.h"
+
+CFWL_EvtValidate::CFWL_EvtValidate() {}
+
+CFWL_EvtValidate::~CFWL_EvtValidate() {}
+
+CFWL_EventType CFWL_EvtValidate::GetClassID() const {
+ return CFWL_EventType::Validate;
+}
diff --git a/xfa/fwl/core/cfwl_evtvalidate.h b/xfa/fwl/core/cfwl_evtvalidate.h
new file mode 100644
index 0000000000..be9fd5642e
--- /dev/null
+++ b/xfa/fwl/core/cfwl_evtvalidate.h
@@ -0,0 +1,24 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef XFA_FWL_CORE_CFWL_EVTVALIDATE_H_
+#define XFA_FWL_CORE_CFWL_EVTVALIDATE_H_
+
+#include "xfa/fwl/core/cfwl_event.h"
+
+class CFWL_EvtValidate : public CFWL_Event {
+ public:
+ CFWL_EvtValidate();
+ ~CFWL_EvtValidate() override;
+
+ CFWL_EventType GetClassID() const override;
+
+ IFWL_Widget* pDstWidget;
+ CFX_WideString wsInsert;
+ bool bValidate;
+};
+
+#endif // XFA_FWL_CORE_CFWL_EVTVALIDATE_H_
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index f47e4a1a5e..5221f773e5 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -9,6 +9,7 @@
#include "third_party/base/ptr_util.h"
#include "xfa/fde/cfde_txtedtengine.h"
#include "xfa/fde/tto/fde_textout.h"
+#include "xfa/fwl/core/cfwl_evttextchanged.h"
#include "xfa/fwl/core/cfwl_msgkey.h"
#include "xfa/fwl/core/cfwl_msgkillfocus.h"
#include "xfa/fwl/core/cfwl_msgmouse.h"
@@ -865,8 +866,8 @@ void IFWL_ComboBox::OnProcessEvent(CFWL_Event* pEvent) {
pScrollEv.m_fPos = pScrollEvent->m_fPos;
DispatchEvent(&pScrollEv);
} else if (dwFlag == CFWL_EventType::TextChanged) {
- CFWL_EvtEdtTextChanged* pTextChangedEvent =
- static_cast<CFWL_EvtEdtTextChanged*>(pEvent);
+ CFWL_EvtTextChanged* pTextChangedEvent =
+ static_cast<CFWL_EvtTextChanged*>(pEvent);
CFWL_EvtCmbEditChanged pTemp;
pTemp.m_pSrcTarget = this;
pTemp.wsInsert = pTextChangedEvent->wsInsert;
diff --git a/xfa/fwl/core/ifwl_edit.cpp b/xfa/fwl/core/ifwl_edit.cpp
index d046a624a8..c3b0be0240 100644
--- a/xfa/fwl/core/ifwl_edit.cpp
+++ b/xfa/fwl/core/ifwl_edit.cpp
@@ -17,6 +17,10 @@
#include "xfa/fde/fde_render.h"
#include "xfa/fde/ifde_txtedtpage.h"
#include "xfa/fgas/font/fgas_gefont.h"
+#include "xfa/fwl/core/cfwl_evtcheckword.h"
+#include "xfa/fwl/core/cfwl_evttextchanged.h"
+#include "xfa/fwl/core/cfwl_evttextfull.h"
+#include "xfa/fwl/core/cfwl_evtvalidate.h"
#include "xfa/fwl/core/cfwl_msgkey.h"
#include "xfa/fwl/core/cfwl_msgmouse.h"
#include "xfa/fwl/core/cfwl_themebackground.h"
@@ -196,7 +200,7 @@ void IFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics,
pGraphics->ConcatMatrix(const_cast<CFX_Matrix*>(pMatrix));
CFX_Color crLine(0xFFFF0000);
- CFWL_EvtEdtCheckWord checkWordEvent;
+ CFWL_EvtCheckWord checkWordEvent;
checkWordEvent.m_pSrcTarget = this;
CFX_ByteString sLatinWord;
@@ -220,6 +224,7 @@ void IFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics,
checkWordEvent.bsWord = sLatinWord;
checkWordEvent.bCheckWord = true;
DispatchEvent(&checkWordEvent);
+
if (!sLatinWord.IsEmpty() && !checkWordEvent.bCheckWord) {
AddSpellCheckObj(pathSpell, nStart, sLatinWord.GetLength(), fOffSetX,
fOffSetY);
@@ -450,7 +455,7 @@ void IFWL_Edit::On_TextChanged(CFDE_TxtEdtEngine* pEdit,
CFX_RectF rtTemp;
GetClientRect(rtTemp);
- CFWL_EvtEdtTextChanged event;
+ CFWL_EvtTextChanged event;
event.m_pSrcTarget = this;
event.nChangeType = ChangeInfo.nChangeType;
event.wsInsert = ChangeInfo.wsInsert;
@@ -500,7 +505,7 @@ bool IFWL_Edit::On_Validate(CFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText) {
if (!pDst)
pDst = this;
- CFWL_EvtEdtValidate event;
+ CFWL_EvtValidate event;
event.pDstWidget = pDst;
event.m_pSrcTarget = this;
event.wsInsert = wsText;
@@ -1273,16 +1278,12 @@ void IFWL_Edit::ClearRecord() {
}
void IFWL_Edit::ProcessInsertError(int32_t iError) {
- switch (iError) {
- case -2: {
- CFWL_EvtEdtTextFull textFullEvent;
- textFullEvent.m_pSrcTarget = this;
- DispatchEvent(&textFullEvent);
- break;
- }
- default:
- break;
- }
+ if (iError != -2)
+ return;
+
+ CFWL_EvtTextFull textFullEvent;
+ textFullEvent.m_pSrcTarget = this;
+ DispatchEvent(&textFullEvent);
}
void IFWL_Edit::OnProcessMessage(CFWL_Message* pMessage) {
diff --git a/xfa/fwl/core/ifwl_edit.h b/xfa/fwl/core/ifwl_edit.h
index 0f8b7a1219..e02ae31d7f 100644
--- a/xfa/fwl/core/ifwl_edit.h
+++ b/xfa/fwl/core/ifwl_edit.h
@@ -50,32 +50,6 @@
#define FWL_STYLEEXT_EDT_OuterScrollbar (1L << 26)
#define FWL_STYLEEXT_EDT_LastLineHeight (1L << 27)
-enum FWL_EDT_TEXTCHANGED {
- FWL_EDT_TEXTCHANGED_Insert = 0,
- FWL_EDT_TEXTCHANGED_Delete,
- FWL_EDT_TEXTCHANGED_Replace,
-};
-
-FWL_EVENT_DEF(CFWL_EvtEdtTextChanged,
- CFWL_EventType::TextChanged,
- int32_t nChangeType;
- CFX_WideString wsInsert;
- CFX_WideString wsDelete;
- CFX_WideString wsPrevText;)
-
-FWL_EVENT_DEF(CFWL_EvtEdtTextFull, CFWL_EventType::TextFull)
-
-FWL_EVENT_DEF(CFWL_EvtEdtValidate,
- CFWL_EventType::Validate,
- IFWL_Widget* pDstWidget;
- CFX_WideString wsInsert;
- bool bValidate;)
-
-FWL_EVENT_DEF(CFWL_EvtEdtCheckWord,
- CFWL_EventType::CheckWord,
- CFX_ByteString bsWord;
- bool bCheckWord;)
-
class IFDE_TxtEdtDoRecord;
class IFWL_Edit;
class CFWL_MsgMouse;