summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-12-07 17:01:58 -0800
committerCommit bot <commit-bot@chromium.org>2016-12-07 17:01:58 -0800
commit4614b45a6592530c4cd930f139c366ce20d359f4 (patch)
tree72a6098a19945cfbdf0877e6e2ba02323ebde33f /xfa/fxfa
parent248cb27e64b3a25230f53fc2f4ab9d483facc5f9 (diff)
downloadpdfium-4614b45a6592530c4cd930f139c366ce20d359f4.tar.xz
Cleanup FWL Event and Message code.
This CL removes any CFWL_Evt classes for which nothing was listening to the events. For events with no parameters the override class was removed and the event type passed into CFWL_Event which is used instead. Any event or message parameters which are un-read have been removed. Review-Url: https://codereview.chromium.org/2530993002
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp7
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp14
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp58
-rw-r--r--xfa/fxfa/app/xfa_ffimageedit.cpp4
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp25
5 files changed, 41 insertions, 67 deletions
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index 06e3b2c8b8..dab6b2cde0 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -246,13 +246,12 @@ bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags,
return false;
SetButtonDown(false);
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -300,8 +299,8 @@ void CXFA_FFCheckButton::OnProcessMessage(CFWL_Message* pMessage) {
void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) {
CXFA_FFField::OnProcessEvent(pEvent);
- switch (pEvent->GetClassID()) {
- case CFWL_EventType::CheckStateChanged: {
+ switch (pEvent->GetType()) {
+ case CFWL_Event::Type::CheckStateChanged: {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Change;
m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw);
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index c9a513607e..d4cfe07202 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -196,8 +196,8 @@ void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) {
void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) {
CXFA_FFField::OnProcessEvent(pEvent);
- switch (pEvent->GetClassID()) {
- case CFWL_EventType::SelectChanged: {
+ switch (pEvent->GetType()) {
+ case CFWL_Event::Type::SelectChanged: {
CFX_Int32Array arrSels;
OnSelectChanged(m_pNormalWidget, arrSels);
break;
@@ -510,23 +510,23 @@ void CXFA_FFComboBox::OnProcessMessage(CFWL_Message* pMessage) {
void CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) {
CXFA_FFField::OnProcessEvent(pEvent);
- switch (pEvent->GetClassID()) {
- case CFWL_EventType::SelectChanged: {
+ switch (pEvent->GetType()) {
+ case CFWL_Event::Type::SelectChanged: {
CFWL_EvtSelectChanged* postEvent =
static_cast<CFWL_EvtSelectChanged*>(pEvent);
OnSelectChanged(m_pNormalWidget, postEvent->bLButtonUp);
break;
}
- case CFWL_EventType::EditChanged: {
+ case CFWL_Event::Type::EditChanged: {
CFX_WideString wsChanged;
OnTextChanged(m_pNormalWidget, wsChanged);
break;
}
- case CFWL_EventType::PreDropDown: {
+ case CFWL_Event::Type::PreDropDown: {
OnPreOpen(m_pNormalWidget);
break;
}
- case CFWL_EventType::PostDropDown: {
+ case CFWL_Event::Type::PostDropDown: {
OnPostOpen(m_pNormalWidget);
break;
}
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index 43efb5ee90..689a0b5469 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -349,10 +349,8 @@ bool CXFA_FFField::OnMouseEnter() {
if (!m_pNormalWidget) {
return false;
}
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::Enter;
- ms.m_pDstTarget = m_pNormalWidget;
- ms.m_pSrcTarget = nullptr;
TranslateFWLMessage(&ms);
return true;
}
@@ -360,9 +358,8 @@ bool CXFA_FFField::OnMouseExit() {
if (!m_pNormalWidget) {
return false;
}
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::Leave;
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -387,13 +384,12 @@ bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
return false;
}
SetButtonDown(true);
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -405,13 +401,12 @@ bool CXFA_FFField::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
return false;
}
SetButtonDown(false);
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -419,13 +414,12 @@ bool CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
if (!m_pNormalWidget) {
return false;
}
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonDblClk;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -433,13 +427,12 @@ bool CXFA_FFField::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
if (!m_pNormalWidget) {
return false;
}
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::Move;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -450,14 +443,13 @@ bool CXFA_FFField::OnMouseWheel(uint32_t dwFlags,
if (!m_pNormalWidget) {
return false;
}
- CFWL_MsgMouseWheel ms;
+ CFWL_MsgMouseWheel ms(nullptr, m_pNormalWidget);
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
ms.m_fDeltaX = zDelta;
ms.m_fDeltaY = 0;
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -473,13 +465,13 @@ bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
return false;
}
SetButtonDown(true);
- CFWL_MsgMouse ms;
+
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::RightButtonDown;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -491,13 +483,12 @@ bool CXFA_FFField::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
return false;
}
SetButtonDown(false);
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::RightButtonUp;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -505,13 +496,12 @@ bool CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) {
if (!m_pNormalWidget) {
return false;
}
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::RightButtonDblClk;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
FWLToClient(ms.m_fx, ms.m_fy);
- ms.m_pDstTarget = m_pNormalWidget;
TranslateFWLMessage(&ms);
return true;
}
@@ -521,9 +511,7 @@ bool CXFA_FFField::OnSetFocus(CXFA_FFWidget* pOldWidget) {
if (!m_pNormalWidget) {
return false;
}
- CFWL_MsgSetFocus ms;
- ms.m_pDstTarget = m_pNormalWidget;
- ms.m_pSrcTarget = nullptr;
+ CFWL_MsgSetFocus ms(nullptr, m_pNormalWidget);
TranslateFWLMessage(&ms);
m_dwStatus |= XFA_WidgetStatus_Focused;
AddInvalidateRect();
@@ -533,9 +521,7 @@ bool CXFA_FFField::OnKillFocus(CXFA_FFWidget* pNewWidget) {
if (!m_pNormalWidget) {
return CXFA_FFWidget::OnKillFocus(pNewWidget);
}
- CFWL_MsgKillFocus ms;
- ms.m_pDstTarget = m_pNormalWidget;
- ms.m_pSrcTarget = nullptr;
+ CFWL_MsgKillFocus ms(nullptr, m_pNormalWidget);
TranslateFWLMessage(&ms);
m_dwStatus &= ~XFA_WidgetStatus_Focused;
AddInvalidateRect();
@@ -546,12 +532,10 @@ bool CXFA_FFField::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) {
if (!m_pNormalWidget || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
return false;
}
- CFWL_MsgKey ms;
+ CFWL_MsgKey ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_KeyCommand::KeyDown;
ms.m_dwFlags = dwFlags;
ms.m_dwKeyCode = dwKeyCode;
- ms.m_pDstTarget = m_pNormalWidget;
- ms.m_pSrcTarget = nullptr;
TranslateFWLMessage(&ms);
return true;
}
@@ -559,12 +543,10 @@ bool CXFA_FFField::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) {
if (!m_pNormalWidget || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
return false;
}
- CFWL_MsgKey ms;
+ CFWL_MsgKey ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_KeyCommand::KeyUp;
ms.m_dwFlags = dwFlags;
ms.m_dwKeyCode = dwKeyCode;
- ms.m_pDstTarget = m_pNormalWidget;
- ms.m_pSrcTarget = nullptr;
TranslateFWLMessage(&ms);
return true;
}
@@ -581,12 +563,10 @@ bool CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) {
if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) {
return false;
}
- CFWL_MsgKey ms;
+ CFWL_MsgKey ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_KeyCommand::Char;
ms.m_dwFlags = dwFlags;
ms.m_dwKeyCode = dwChar;
- ms.m_pDstTarget = m_pNormalWidget;
- ms.m_pSrcTarget = nullptr;
TranslateFWLMessage(&ms);
return true;
}
@@ -779,8 +759,8 @@ void CXFA_FFField::TranslateFWLMessage(CFWL_Message* pMessage) {
void CXFA_FFField::OnProcessMessage(CFWL_Message* pMessage) {}
void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) {
- switch (pEvent->GetClassID()) {
- case CFWL_EventType::Mouse: {
+ switch (pEvent->GetType()) {
+ case CFWL_Event::Type::Mouse: {
CFWL_EvtMouse* event = (CFWL_EvtMouse*)pEvent;
if (event->m_dwCmd == FWL_MouseCommand::Enter) {
CXFA_EventParam eParam;
@@ -805,7 +785,7 @@ void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) {
}
break;
}
- case CFWL_EventType::Click: {
+ case CFWL_Event::Type::Click: {
CXFA_EventParam eParam;
eParam.m_eType = XFA_EVENT_Click;
eParam.m_pTarget = m_pDataAcc;
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index 318a772855..3506cc9703 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -93,12 +93,12 @@ bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags,
return false;
SetButtonDown(true);
- CFWL_MsgMouse ms;
+
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
- ms.m_pDstTarget = m_pNormalWidget;
FWLToClient(ms.m_fx, ms.m_fy);
TranslateFWLMessage(&ms);
return true;
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index a070f90b99..89c323c23b 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -117,12 +117,11 @@ bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags,
AddInvalidateRect();
}
SetButtonDown(true);
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, m_pNormalWidget);
ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
ms.m_fy = fy;
- ms.m_pDstTarget = m_pNormalWidget;
FWLToClient(ms.m_fx, ms.m_fy);
TranslateFWLMessage(&ms);
return true;
@@ -142,7 +141,7 @@ bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags,
AddInvalidateRect();
}
SetButtonDown(true);
- CFWL_MsgMouse ms;
+ CFWL_MsgMouse ms(nullptr, nullptr);
ms.m_dwCmd = FWL_MouseCommand::RightButtonDown;
ms.m_dwFlags = dwFlags;
ms.m_fx = fx;
@@ -166,16 +165,12 @@ bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) {
AddInvalidateRect();
}
CXFA_FFWidget::OnSetFocus(pOldWidget);
- CFWL_MsgSetFocus ms;
- ms.m_pDstTarget = m_pNormalWidget;
- ms.m_pSrcTarget = nullptr;
+ CFWL_MsgSetFocus ms(nullptr, m_pNormalWidget);
TranslateFWLMessage(&ms);
return true;
}
bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) {
- CFWL_MsgKillFocus ms;
- ms.m_pDstTarget = m_pNormalWidget;
- ms.m_pSrcTarget = nullptr;
+ CFWL_MsgKillFocus ms(nullptr, m_pNormalWidget);
TranslateFWLMessage(&ms);
m_dwStatus &= ~XFA_WidgetStatus_Focused;
SetEditScrollOffset();
@@ -338,18 +333,18 @@ void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) {
void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) {
CXFA_FFField::OnProcessEvent(pEvent);
- switch (pEvent->GetClassID()) {
- case CFWL_EventType::TextChanged: {
+ switch (pEvent->GetType()) {
+ case CFWL_Event::Type::TextChanged: {
CFWL_EvtTextChanged* event = static_cast<CFWL_EvtTextChanged*>(pEvent);
CFX_WideString wsChange;
OnTextChanged(m_pNormalWidget, wsChange, event->wsPrevText);
break;
}
- case CFWL_EventType::TextFull: {
+ case CFWL_Event::Type::TextFull: {
OnTextFull(m_pNormalWidget);
break;
}
- case CFWL_EventType::CheckWord: {
+ case CFWL_Event::Type::CheckWord: {
CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
CFWL_EvtCheckWord* event = static_cast<CFWL_EvtCheckWord*>(pEvent);
event->bCheckWord = CheckWord(event->bsWord.AsStringC());
@@ -418,7 +413,7 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() {
}
void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) {
- if (pEvent->GetClassID() == CFWL_EventType::Validate) {
+ if (pEvent->GetType() == CFWL_Event::Type::Validate) {
CFWL_EvtValidate* event = static_cast<CFWL_EvtValidate*>(pEvent);
event->bValidate = OnValidate(m_pNormalWidget, event->wsInsert);
return;
@@ -683,7 +678,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget,
}
void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
- if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) {
+ if (pEvent->GetType() == CFWL_Event::Type::SelectChanged) {
CFWL_EvtSelectChanged* event = static_cast<CFWL_EvtSelectChanged*>(pEvent);
OnSelectChanged(m_pNormalWidget, event->iYear, event->iMonth, event->iDay);
return;