| Index: xfa/fxfa/app/xfa_fftextedit.cpp
|
| diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
|
| index e268f1c4ec44cf4e2def269c0206b249d0ccb9d6..f4d82e774ee2e753b3da29a5e286582dc7e9c92a 100644
|
| --- a/xfa/fxfa/app/xfa_fftextedit.cpp
|
| +++ b/xfa/fxfa/app/xfa_fftextedit.cpp
|
| @@ -8,11 +8,15 @@
|
|
|
| #include <vector>
|
|
|
| +#include "third_party/base/ptr_util.h"
|
| #include "xfa/fwl/core/cfwl_datetimepicker.h"
|
| #include "xfa/fwl/core/cfwl_edit.h"
|
| #include "xfa/fwl/core/cfwl_message.h"
|
| #include "xfa/fwl/core/fwl_noteimp.h"
|
| #include "xfa/fwl/core/ifwl_edit.h"
|
| +#include "xfa/fxfa/app/cxfa_ffdatetimeeditdelegate.h"
|
| +#include "xfa/fxfa/app/cxfa_ffnumericeditdelegate.h"
|
| +#include "xfa/fxfa/app/cxfa_fftexteditdelegate.h"
|
| #include "xfa/fxfa/app/xfa_fffield.h"
|
| #include "xfa/fxfa/app/xfa_fwladapter.h"
|
| #include "xfa/fxfa/app/xfa_textlayout.h"
|
| @@ -26,7 +30,7 @@
|
|
|
| CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView,
|
| CXFA_WidgetAcc* pDataAcc)
|
| - : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {}
|
| + : CXFA_FFField(pPageView, pDataAcc) {}
|
|
|
| CXFA_FFTextEdit::~CXFA_FFTextEdit() {
|
| if (m_pNormalWidget) {
|
| @@ -46,8 +50,8 @@ FX_BOOL CXFA_FFTextEdit::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_FFTextEditDelegate>(
|
| + m_pNormalWidget->ReleaseDelegate(), this));
|
| m_pNormalWidget->LockUpdate();
|
|
|
| UpdateWidgetProperty();
|
| @@ -398,49 +402,12 @@ FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) {
|
| return FALSE;
|
| }
|
|
|
| -void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) {
|
| - m_pOldDelegate->OnProcessMessage(pMessage);
|
| -}
|
| -
|
| -void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) {
|
| - CXFA_FFField::OnProcessEvent(pEvent);
|
| - switch (pEvent->GetClassID()) {
|
| - case CFWL_EventType::TextChanged: {
|
| - CFWL_EvtEdtTextChanged* event = (CFWL_EvtEdtTextChanged*)pEvent;
|
| - CFX_WideString wsChange;
|
| - OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText);
|
| - break;
|
| - }
|
| - case CFWL_EventType::TextFull: {
|
| - OnTextFull(m_pNormalWidget->GetWidget());
|
| - break;
|
| - }
|
| - case CFWL_EventType::CheckWord: {
|
| - CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
|
| - CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent;
|
| - event->bCheckWord = CheckWord(event->bsWord.AsStringC());
|
| - break;
|
| - }
|
| - case CFWL_EventType::GetSuggestedWords: {
|
| - CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent;
|
| - event->bSuggestWords = FALSE;
|
| - break;
|
| - }
|
| - default:
|
| - break;
|
| - }
|
| - m_pOldDelegate->OnProcessEvent(pEvent);
|
| -}
|
| -
|
| -void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics,
|
| - const CFX_Matrix* pMatrix) {
|
| - m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
|
| -}
|
| -
|
| CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView,
|
| CXFA_WidgetAcc* pDataAcc)
|
| : CXFA_FFTextEdit(pPageView, pDataAcc) {}
|
| +
|
| CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {}
|
| +
|
| FX_BOOL CXFA_FFNumericEdit::LoadWidget() {
|
| CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp());
|
| pWidget->Initialize();
|
| @@ -451,8 +418,8 @@ FX_BOOL CXFA_FFNumericEdit::LoadWidget() {
|
| CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
|
| pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
|
|
|
| - m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
|
| - m_pNormalWidget->SetCurrentDelegate(this);
|
| + m_pNormalWidget->SetDelegate(pdfium::MakeUnique<CXFA_FFNumericEditDelegate>(
|
| + m_pNormalWidget->ReleaseDelegate(), this));
|
| m_pNormalWidget->LockUpdate();
|
|
|
| CFX_WideString wsText;
|
| @@ -488,16 +455,6 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() {
|
| m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
|
| }
|
|
|
| -void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) {
|
| - if (pEvent->GetClassID() == CFWL_EventType::Validate) {
|
| - CFWL_EvtEdtValidate* event = (CFWL_EvtEdtValidate*)pEvent;
|
| - CFX_WideString wsChange = event->wsInsert;
|
| - event->bValidate = OnValidate(m_pNormalWidget->GetWidget(), wsChange);
|
| - return;
|
| - }
|
| - CXFA_FFTextEdit::OnProcessEvent(pEvent);
|
| -}
|
| -
|
| FX_BOOL CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget,
|
| CFX_WideString& wsText) {
|
| CFX_WideString wsPattern;
|
| @@ -531,8 +488,8 @@ FX_BOOL CXFA_FFPasswordEdit::LoadWidget() {
|
| CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
|
| pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
|
|
|
| - m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
|
| - m_pNormalWidget->SetCurrentDelegate(this);
|
| + m_pNormalWidget->SetDelegate(pdfium::MakeUnique<CXFA_FFTextEditDelegate>(
|
| + m_pNormalWidget->ReleaseDelegate(), this));
|
| m_pNormalWidget->LockUpdate();
|
|
|
| CFX_WideString wsText;
|
| @@ -600,8 +557,8 @@ FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() {
|
| CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
|
| pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
|
|
|
| - m_pOldDelegate = m_pNormalWidget->GetCurrentDelegate();
|
| - m_pNormalWidget->SetCurrentDelegate(this);
|
| + m_pNormalWidget->SetDelegate(pdfium::MakeUnique<CXFA_FFDateTimeEditDelegate>(
|
| + m_pNormalWidget->ReleaseDelegate(), this));
|
| m_pNormalWidget->LockUpdate();
|
|
|
| CFX_WideString wsText;
|
| @@ -798,13 +755,3 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget,
|
| m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw);
|
| m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
|
| }
|
| -
|
| -void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
|
| - if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) {
|
| - CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent;
|
| - OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth,
|
| - event->iDay);
|
| - return;
|
| - }
|
| - CXFA_FFTextEdit::OnProcessEvent(pEvent);
|
| -}
|
|
|