| Index: xfa/fxfa/app/xfa_ffchoicelist.cpp
|
| diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
|
| index 06bbc38eb96cbd8bae6e3ccf924ae9eb70da2623..07134641f333c62c376fcff0e38be5d0c74628c9 100644
|
| --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
|
| +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
|
| @@ -6,11 +6,14 @@
|
|
|
| #include "xfa/fxfa/app/xfa_ffchoicelist.h"
|
|
|
| +#include "third_party/base/ptr_util.h"
|
| #include "xfa/fwl/core/cfwl_combobox.h"
|
| #include "xfa/fwl/core/cfwl_listbox.h"
|
| #include "xfa/fwl/core/fwl_noteimp.h"
|
| #include "xfa/fwl/core/ifwl_app.h"
|
| #include "xfa/fwl/core/ifwl_edit.h"
|
| +#include "xfa/fxfa/app/cxfa_ffcomboboxdelegate.h"
|
| +#include "xfa/fxfa/app/cxfa_fflistboxdelegate.h"
|
| #include "xfa/fxfa/app/xfa_fffield.h"
|
| #include "xfa/fxfa/app/xfa_fwladapter.h"
|
| #include "xfa/fxfa/cxfa_eventparam.h"
|
| @@ -21,7 +24,7 @@
|
|
|
| CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView,
|
| CXFA_WidgetAcc* pDataAcc)
|
| - : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {}
|
| + : CXFA_FFField(pPageView, pDataAcc) {}
|
|
|
| CXFA_FFListBox::~CXFA_FFListBox() {
|
| if (m_pNormalWidget) {
|
| @@ -43,8 +46,8 @@ FX_BOOL CXFA_FFListBox::LoadWidget() {
|
| CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
|
| pNoteDriver->RegisterEventTarget(pWidget, pWidget);
|
|
|
| - m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
|
| - m_pNormalWidget->SetCurrentDelegate(this);
|
| + m_pNormalWidget->SetDelegate(pdfium::MakeUnique<CXFA_FFListBoxDelegate>(
|
| + m_pNormalWidget->ReleaseDelegate(), this));
|
| m_pNormalWidget->LockUpdate();
|
|
|
| CFX_WideStringArray wsLabelArray;
|
| @@ -185,31 +188,9 @@ void CXFA_FFListBox::DeleteItem(int32_t nIndex) {
|
| AddInvalidateRect();
|
| }
|
|
|
| -void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) {
|
| - m_pOldDelegate->OnProcessMessage(pMessage);
|
| -}
|
| -
|
| -void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) {
|
| - CXFA_FFField::OnProcessEvent(pEvent);
|
| - switch (pEvent->GetClassID()) {
|
| - case CFWL_EventType::SelectChanged: {
|
| - CFX_Int32Array arrSels;
|
| - OnSelectChanged(m_pNormalWidget->GetWidget(), arrSels);
|
| - break;
|
| - }
|
| - default:
|
| - break;
|
| - }
|
| - m_pOldDelegate->OnProcessEvent(pEvent);
|
| -}
|
| -void CXFA_FFListBox::OnDrawWidget(CFX_Graphics* pGraphics,
|
| - const CFX_Matrix* pMatrix) {
|
| - m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
|
| -}
|
| -
|
| CXFA_FFComboBox::CXFA_FFComboBox(CXFA_FFPageView* pPageView,
|
| CXFA_WidgetAcc* pDataAcc)
|
| - : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {}
|
| + : CXFA_FFField(pPageView, pDataAcc) {}
|
|
|
| CXFA_FFComboBox::~CXFA_FFComboBox() {}
|
|
|
| @@ -242,8 +223,8 @@ FX_BOOL CXFA_FFComboBox::LoadWidget() {
|
| CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
|
| pNoteDriver->RegisterEventTarget(pWidget, pWidget);
|
|
|
| - m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
|
| - m_pNormalWidget->SetCurrentDelegate(this);
|
| + m_pNormalWidget->SetDelegate(pdfium::MakeUnique<CXFA_FFComboBoxDelegate>(
|
| + m_pNormalWidget->ReleaseDelegate(), this));
|
| m_pNormalWidget->LockUpdate();
|
|
|
| CFX_WideStringArray wsLabelArray;
|
| @@ -504,40 +485,3 @@ void CXFA_FFComboBox::OnPostOpen(IFWL_Widget* pWidget) {
|
| eParam.m_pTarget = m_pDataAcc;
|
| m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_PostOpen, &eParam);
|
| }
|
| -
|
| -void CXFA_FFComboBox::OnProcessMessage(CFWL_Message* pMessage) {
|
| - m_pOldDelegate->OnProcessMessage(pMessage);
|
| -}
|
| -
|
| -void CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) {
|
| - CXFA_FFField::OnProcessEvent(pEvent);
|
| - switch (pEvent->GetClassID()) {
|
| - case CFWL_EventType::SelectChanged: {
|
| - CFWL_EvtCmbSelChanged* postEvent = (CFWL_EvtCmbSelChanged*)pEvent;
|
| - OnSelectChanged(m_pNormalWidget->GetWidget(), postEvent->iArraySels,
|
| - postEvent->bLButtonUp);
|
| - break;
|
| - }
|
| - case CFWL_EventType::EditChanged: {
|
| - CFX_WideString wsChanged;
|
| - OnTextChanged(m_pNormalWidget->GetWidget(), wsChanged);
|
| - break;
|
| - }
|
| - case CFWL_EventType::PreDropDown: {
|
| - OnPreOpen(m_pNormalWidget->GetWidget());
|
| - break;
|
| - }
|
| - case CFWL_EventType::PostDropDown: {
|
| - OnPostOpen(m_pNormalWidget->GetWidget());
|
| - break;
|
| - }
|
| - default:
|
| - break;
|
| - }
|
| - m_pOldDelegate->OnProcessEvent(pEvent);
|
| -}
|
| -
|
| -void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics,
|
| - const CFX_Matrix* pMatrix) {
|
| - m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
|
| -}
|
|
|