From 2c489cc41023a40648dfde988d11b8ec2b66c7d0 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 23 Nov 2016 16:17:20 -0800 Subject: Merge IFWL and CFWL classes. This CL merges the IFWL hierarchy into the CFWL hierachy. All CFWL proxy methods have been replaced by the IFWL implementations. Review-Url: https://codereview.chromium.org/2524173002 --- xfa/fxfa/app/xfa_ffapp.cpp | 2 +- xfa/fxfa/app/xfa_ffbarcode.cpp | 7 ++-- xfa/fxfa/app/xfa_ffcheckbutton.cpp | 12 +++---- xfa/fxfa/app/xfa_ffchoicelist.cpp | 50 ++++++++++++++-------------- xfa/fxfa/app/xfa_ffchoicelist.h | 11 +++---- xfa/fxfa/app/xfa_fffield.cpp | 39 ++++++++++------------ xfa/fxfa/app/xfa_ffimageedit.cpp | 9 +++-- xfa/fxfa/app/xfa_ffpushbutton.cpp | 12 +++---- xfa/fxfa/app/xfa_fftextedit.cpp | 67 ++++++++++++++++++-------------------- xfa/fxfa/app/xfa_fftextedit.h | 8 ++--- xfa/fxfa/app/xfa_fwladapter.cpp | 4 +-- xfa/fxfa/app/xfa_fwladapter.h | 6 ++-- xfa/fxfa/app/xfa_fwltheme.cpp | 22 ++++++------- xfa/fxfa/app/xfa_fwltheme.h | 4 +-- xfa/fxfa/xfa_ffapp.h | 8 ++--- 15 files changed, 123 insertions(+), 138 deletions(-) (limited to 'xfa/fxfa') diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp index b6b90ab07c..797c3e72f0 100644 --- a/xfa/fxfa/app/xfa_ffapp.cpp +++ b/xfa/fxfa/app/xfa_ffapp.cpp @@ -132,7 +132,7 @@ CXFA_FWLTheme* CXFA_FFApp::GetFWLTheme() { } CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetWidgetMgr( - IFWL_WidgetMgrDelegate* pDelegate) { + CFWL_WidgetMgrDelegate* pDelegate) { if (!m_pAdapterWidgetMgr) { m_pAdapterWidgetMgr.reset(new CXFA_FWLAdapterWidgetMgr); pDelegate->OnSetCapability(FWL_WGTMGR_DisableForm); diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 355ab0f0cc..f89f846a01 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -124,13 +124,12 @@ CXFA_FFBarcode::~CXFA_FFBarcode() {} bool CXFA_FFBarcode::LoadWidget() { CFWL_Barcode* pFWLBarcode = new CFWL_Barcode(GetFWLApp()); - pFWLBarcode->Initialize(); m_pNormalWidget = pFWLBarcode; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pWidget, pWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index a99b7b1cb4..06e3b2c8b8 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -28,13 +28,12 @@ CXFA_FFCheckButton::~CXFA_FFCheckButton() {} bool CXFA_FFCheckButton::LoadWidget() { CFWL_CheckBox* pCheckBox = new CFWL_CheckBox(GetFWLApp()); - pCheckBox->Initialize(); m_pNormalWidget = pCheckBox; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pWidget, pWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); @@ -238,8 +237,7 @@ void CXFA_FFCheckButton::RenderWidget(CFX_Graphics* pGS, CFX_Matrix mt; mt.Set(1, 0, 0, 1, m_rtCheckBox.left, m_rtCheckBox.top); mt.Concat(mtRotate); - GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), - pGS, &mt); + GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt); } bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, @@ -254,7 +252,7 @@ bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index eec4947425..b289a39eb3 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -6,14 +6,14 @@ #include "xfa/fxfa/app/xfa_ffchoicelist.h" +#include "third_party/base/ptr_util.h" #include "xfa/fwl/core/cfwl_app.h" #include "xfa/fwl/core/cfwl_combobox.h" +#include "xfa/fwl/core/cfwl_edit.h" #include "xfa/fwl/core/cfwl_evtselectchanged.h" #include "xfa/fwl/core/cfwl_listbox.h" #include "xfa/fwl/core/cfwl_notedriver.h" -#include "xfa/fwl/core/ifwl_combobox.h" -#include "xfa/fwl/core/ifwl_edit.h" -#include "xfa/fwl/core/ifwl_listbox.h" +#include "xfa/fwl/core/cfwl_widgetproperties.h" #include "xfa/fxfa/app/xfa_fffield.h" #include "xfa/fxfa/app/xfa_fwladapter.h" #include "xfa/fxfa/cxfa_eventparam.h" @@ -28,23 +28,23 @@ CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView, CXFA_FFListBox::~CXFA_FFListBox() { if (m_pNormalWidget) { - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->UnregisterEventTarget(pWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->UnregisterEventTarget(m_pNormalWidget); } } bool CXFA_FFListBox::LoadWidget() { - CFWL_ListBox* pListBox = new CFWL_ListBox(GetFWLApp()); - pListBox->Initialize(); + CFWL_ListBox* pListBox = new CFWL_ListBox( + GetFWLApp(), pdfium::MakeUnique(), nullptr); pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground, 0xFFFFFFFF); m_pNormalWidget = (CFWL_Widget*)pListBox; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pWidget, pWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); @@ -151,7 +151,7 @@ bool CXFA_FFListBox::UpdateFWLData() { m_pNormalWidget->Update(); return true; } -void CXFA_FFListBox::OnSelectChanged(IFWL_Widget* pWidget, +void CXFA_FFListBox::OnSelectChanged(CFWL_Widget* pWidget, const CFX_Int32Array& arrSels) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Change; @@ -197,7 +197,7 @@ void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) { switch (pEvent->GetClassID()) { case CFWL_EventType::SelectChanged: { CFX_Int32Array arrSels; - OnSelectChanged(m_pNormalWidget->GetWidget(), arrSels); + OnSelectChanged(m_pNormalWidget, arrSels); break; } default: @@ -237,13 +237,12 @@ bool CXFA_FFComboBox::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { } bool CXFA_FFComboBox::LoadWidget() { CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp()); - pComboBox->Initialize(); m_pNormalWidget = (CFWL_Widget*)pComboBox; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pWidget, pWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); @@ -475,15 +474,14 @@ void CXFA_FFComboBox::DeleteItem(int32_t nIndex) { m_pNormalWidget->Update(); AddInvalidateRect(); } -void CXFA_FFComboBox::OnTextChanged(IFWL_Widget* pWidget, +void CXFA_FFComboBox::OnTextChanged(CFWL_Widget* pWidget, const CFX_WideString& wsChanged) { CXFA_EventParam eParam; m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw); eParam.m_wsChange = wsChanged; FWLEventSelChange(&eParam); } -void CXFA_FFComboBox::OnSelectChanged(IFWL_Widget* pWidget, - bool bLButtonUp) { +void CXFA_FFComboBox::OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp) { CXFA_EventParam eParam; m_pDataAcc->GetValue(eParam.m_wsPrevText, XFA_VALUEPICTURE_Raw); FWLEventSelChange(&eParam); @@ -492,13 +490,13 @@ void CXFA_FFComboBox::OnSelectChanged(IFWL_Widget* pWidget, m_pDocView->SetFocusWidgetAcc(nullptr); } } -void CXFA_FFComboBox::OnPreOpen(IFWL_Widget* pWidget) { +void CXFA_FFComboBox::OnPreOpen(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_PreOpen; eParam.m_pTarget = m_pDataAcc; m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_PreOpen, &eParam); } -void CXFA_FFComboBox::OnPostOpen(IFWL_Widget* pWidget) { +void CXFA_FFComboBox::OnPostOpen(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_PostOpen; eParam.m_pTarget = m_pDataAcc; @@ -515,20 +513,20 @@ void CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) { case CFWL_EventType::SelectChanged: { CFWL_EvtSelectChanged* postEvent = static_cast(pEvent); - OnSelectChanged(m_pNormalWidget->GetWidget(), postEvent->bLButtonUp); + OnSelectChanged(m_pNormalWidget, postEvent->bLButtonUp); break; } case CFWL_EventType::EditChanged: { CFX_WideString wsChanged; - OnTextChanged(m_pNormalWidget->GetWidget(), wsChanged); + OnTextChanged(m_pNormalWidget, wsChanged); break; } case CFWL_EventType::PreDropDown: { - OnPreOpen(m_pNormalWidget->GetWidget()); + OnPreOpen(m_pNormalWidget); break; } case CFWL_EventType::PostDropDown: { - OnPostOpen(m_pNormalWidget->GetWidget()); + OnPostOpen(m_pNormalWidget); break; } default: diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h index 1855d193aa..e9bee6f715 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.h +++ b/xfa/fxfa/app/xfa_ffchoicelist.h @@ -23,7 +23,7 @@ class CXFA_FFListBox : public CXFA_FFField { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; - void OnSelectChanged(IFWL_Widget* pWidget, const CFX_Int32Array& arrSels); + void OnSelectChanged(CFWL_Widget* pWidget, const CFX_Int32Array& arrSels); void SetItemState(int32_t nIndex, bool bSelected); void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1); void DeleteItem(int32_t nIndex); @@ -75,11 +75,10 @@ class CXFA_FFComboBox : public CXFA_FFField { virtual void OpenDropDownList(); - void OnTextChanged(IFWL_Widget* pWidget, const CFX_WideString& wsChanged); - void OnSelectChanged(IFWL_Widget* pWidget, - bool bLButtonUp); - void OnPreOpen(IFWL_Widget* pWidget); - void OnPostOpen(IFWL_Widget* pWidget); + void OnTextChanged(CFWL_Widget* pWidget, const CFX_WideString& wsChanged); + void OnSelectChanged(CFWL_Widget* pWidget, bool bLButtonUp); + void OnPreOpen(CFWL_Widget* pWidget); + void OnPostOpen(CFWL_Widget* pWidget); void SetItemState(int32_t nIndex, bool bSelected); void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1); void DeleteItem(int32_t nIndex); diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index ac9317ec0a..43efb5ee90 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -15,7 +15,6 @@ #include "xfa/fwl/core/cfwl_msgsetfocus.h" #include "xfa/fwl/core/cfwl_picturebox.h" #include "xfa/fwl/core/cfwl_widgetmgr.h" -#include "xfa/fwl/core/ifwl_edit.h" #include "xfa/fxfa/app/xfa_fwltheme.h" #include "xfa/fxfa/app/xfa_textlayout.h" #include "xfa/fxfa/xfa_ffapp.h" @@ -75,8 +74,7 @@ void CXFA_FFField::RenderWidget(CFX_Graphics* pGS, CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); mt.Concat(mtRotate); - GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), - pGS, &mt); + GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt); } void CXFA_FFField::DrawHighlight(CFX_Graphics* pGS, CFX_Matrix* pMatrix, @@ -114,9 +112,8 @@ void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { } } void CXFA_FFField::SetFWLThemeProvider() { - if (m_pNormalWidget) { - m_pNormalWidget->GetWidget()->SetThemeProvider(GetApp()->GetFWLTheme()); - } + if (m_pNormalWidget) + m_pNormalWidget->SetThemeProvider(GetApp()->GetFWLTheme()); } bool CXFA_FFField::IsLoaded() { return m_pNormalWidget && CXFA_FFWidget::IsLoaded(); @@ -354,7 +351,7 @@ bool CXFA_FFField::OnMouseEnter() { } CFWL_MsgMouse ms; ms.m_dwCmd = FWL_MouseCommand::Enter; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; @@ -365,7 +362,7 @@ bool CXFA_FFField::OnMouseExit() { } CFWL_MsgMouse ms; ms.m_dwCmd = FWL_MouseCommand::Leave; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -396,7 +393,7 @@ bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -414,7 +411,7 @@ bool CXFA_FFField::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -428,7 +425,7 @@ bool CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -442,7 +439,7 @@ bool CXFA_FFField::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -460,7 +457,7 @@ bool CXFA_FFField::OnMouseWheel(uint32_t dwFlags, FWLToClient(ms.m_fx, ms.m_fy); ms.m_fDeltaX = zDelta; ms.m_fDeltaY = 0; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -482,7 +479,7 @@ bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -500,7 +497,7 @@ bool CXFA_FFField::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -514,7 +511,7 @@ bool CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { ms.m_fx = fx; ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; TranslateFWLMessage(&ms); return true; } @@ -525,7 +522,7 @@ bool CXFA_FFField::OnSetFocus(CXFA_FFWidget* pOldWidget) { return false; } CFWL_MsgSetFocus ms; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); m_dwStatus |= XFA_WidgetStatus_Focused; @@ -537,7 +534,7 @@ bool CXFA_FFField::OnKillFocus(CXFA_FFWidget* pNewWidget) { return CXFA_FFWidget::OnKillFocus(pNewWidget); } CFWL_MsgKillFocus ms; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); m_dwStatus &= ~XFA_WidgetStatus_Focused; @@ -553,7 +550,7 @@ bool CXFA_FFField::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { ms.m_dwCmd = FWL_KeyCommand::KeyDown; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwKeyCode; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; @@ -566,7 +563,7 @@ bool CXFA_FFField::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { ms.m_dwCmd = FWL_KeyCommand::KeyUp; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwKeyCode; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; @@ -588,7 +585,7 @@ bool CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { ms.m_dwCmd = FWL_KeyCommand::Char; ms.m_dwFlags = dwFlags; ms.m_dwKeyCode = dwChar; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index 89188b2847..318a772855 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -24,13 +24,12 @@ CXFA_FFImageEdit::~CXFA_FFImageEdit() { } bool CXFA_FFImageEdit::LoadWidget() { CFWL_PictureBox* pPictureBox = new CFWL_PictureBox(GetFWLApp()); - pPictureBox->Initialize(); m_pNormalWidget = pPictureBox; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pWidget, pWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = pPictureBox->GetDelegate(); pPictureBox->SetDelegate(this); @@ -99,7 +98,7 @@ bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; FWLToClient(ms.m_fx, ms.m_fy); TranslateFWLMessage(&ms); return true; diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index ba0bdcf85a..df093a0b30 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -47,22 +47,20 @@ void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS, CFX_Matrix mt; mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); mt.Concat(mtRotate); - GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), - pGS, &mt); + GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt); } bool CXFA_FFPushButton::LoadWidget() { ASSERT(!m_pNormalWidget); CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp()); - pPushButton->Initialize(); - m_pOldDelegate = pPushButton->GetDelegate(); pPushButton->SetDelegate(this); m_pNormalWidget = pPushButton; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pWidget, pWidget); + + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pNormalWidget->LockUpdate(); UpdateWidgetProperty(); LoadHighlightCaption(); diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index d13e946374..77ca7a6d91 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -35,21 +35,21 @@ CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView, CXFA_FFTextEdit::~CXFA_FFTextEdit() { if (m_pNormalWidget) { - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->UnregisterEventTarget(pWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->UnregisterEventTarget(m_pNormalWidget); } } bool CXFA_FFTextEdit::LoadWidget() { - CFWL_Edit* pFWLEdit = new CFWL_Edit(GetFWLApp()); - pFWLEdit->Initialize(); + CFWL_Edit* pFWLEdit = new CFWL_Edit( + GetFWLApp(), pdfium::MakeUnique(), nullptr); m_pNormalWidget = pFWLEdit; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pWidget, pWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); @@ -122,7 +122,7 @@ bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, ms.m_dwFlags = dwFlags; ms.m_fx = fx; ms.m_fy = fy; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; FWLToClient(ms.m_fx, ms.m_fy); TranslateFWLMessage(&ms); return true; @@ -167,14 +167,14 @@ bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { } CXFA_FFWidget::OnSetFocus(pOldWidget); CFWL_MsgSetFocus ms; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); return true; } bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { CFWL_MsgKillFocus ms; - ms.m_pDstTarget = m_pNormalWidget->GetWidget(); + ms.m_pDstTarget = m_pNormalWidget; ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); m_dwStatus &= ~XFA_WidgetStatus_Focused; @@ -294,7 +294,7 @@ bool CXFA_FFTextEdit::UpdateFWLData() { } return true; } -void CXFA_FFTextEdit::OnTextChanged(IFWL_Widget* pWidget, +void CXFA_FFTextEdit::OnTextChanged(CFWL_Widget* pWidget, const CFX_WideString& wsChanged, const CFX_WideString& wsPrevText) { m_dwStatus |= XFA_WidgetStatus_TextEditValueChanged; @@ -320,7 +320,7 @@ void CXFA_FFTextEdit::OnTextChanged(IFWL_Widget* pWidget, } m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); } -void CXFA_FFTextEdit::OnTextFull(IFWL_Widget* pWidget) { +void CXFA_FFTextEdit::OnTextFull(CFWL_Widget* pWidget) { CXFA_EventParam eParam; eParam.m_eType = XFA_EVENT_Full; eParam.m_pTarget = m_pDataAcc; @@ -343,11 +343,11 @@ void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { case CFWL_EventType::TextChanged: { CFWL_EvtTextChanged* event = static_cast(pEvent); CFX_WideString wsChange; - OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText); + OnTextChanged(m_pNormalWidget, wsChange, event->wsPrevText); break; } case CFWL_EventType::TextFull: { - OnTextFull(m_pNormalWidget->GetWidget()); + OnTextFull(m_pNormalWidget); break; } case CFWL_EventType::CheckWord: { @@ -372,14 +372,14 @@ CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, : CXFA_FFTextEdit(pPageView, pDataAcc) {} CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {} bool CXFA_FFNumericEdit::LoadWidget() { - CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); - pWidget->Initialize(); + CFWL_Edit* pWidget = new CFWL_Edit( + GetFWLApp(), pdfium::MakeUnique(), nullptr); m_pNormalWidget = pWidget; - IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); m_pNormalWidget->SetLayoutItem(this); - CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); @@ -421,14 +421,13 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() { void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { if (pEvent->GetClassID() == CFWL_EventType::Validate) { CFWL_EvtValidate* event = static_cast(pEvent); - event->bValidate = - OnValidate(m_pNormalWidget->GetWidget(), event->wsInsert); + event->bValidate = OnValidate(m_pNormalWidget, event->wsInsert); return; } CXFA_FFTextEdit::OnProcessEvent(pEvent); } -bool CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget, +bool CXFA_FFNumericEdit::OnValidate(CFWL_Widget* pWidget, CFX_WideString& wsText) { CFX_WideString wsPattern; m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit); @@ -452,14 +451,14 @@ CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {} bool CXFA_FFPasswordEdit::LoadWidget() { - CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); - pWidget->Initialize(); + CFWL_Edit* pWidget = new CFWL_Edit( + GetFWLApp(), pdfium::MakeUnique(), nullptr); m_pNormalWidget = pWidget; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); @@ -523,12 +522,11 @@ bool CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { } bool CXFA_FFDateTimeEdit::LoadWidget() { CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp()); - pWidget->Initialize(); m_pNormalWidget = pWidget; m_pNormalWidget->SetLayoutItem(this); - IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); - CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver(); - pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget); m_pOldDelegate = m_pNormalWidget->GetDelegate(); m_pNormalWidget->SetDelegate(this); @@ -661,7 +659,7 @@ bool CXFA_FFDateTimeEdit::IsDataChanged() { return wsOldValue != wsText; } -void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, +void CXFA_FFDateTimeEdit::OnSelectChanged(CFWL_Widget* pWidget, int32_t iYear, int32_t iMonth, int32_t iDay) { @@ -688,8 +686,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { CFWL_EvtSelectChanged* event = static_cast(pEvent); - OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, - event->iDay); + OnSelectChanged(m_pNormalWidget, event->iYear, event->iMonth, event->iDay); return; } CXFA_FFTextEdit::OnProcessEvent(pEvent); diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h index 115b3706a2..88622e3c50 100644 --- a/xfa/fxfa/app/xfa_fftextedit.h +++ b/xfa/fxfa/app/xfa_fftextedit.h @@ -29,10 +29,10 @@ class CXFA_FFTextEdit : public CXFA_FFField { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = nullptr) override; - void OnTextChanged(IFWL_Widget* pWidget, + void OnTextChanged(CFWL_Widget* pWidget, const CFX_WideString& wsChanged, const CFX_WideString& wsPrevText); - void OnTextFull(IFWL_Widget* pWidget); + void OnTextFull(CFWL_Widget* pWidget); bool CheckWord(const CFX_ByteStringC& sWord); protected: @@ -57,7 +57,7 @@ class CXFA_FFNumericEdit : public CXFA_FFTextEdit { void OnProcessEvent(CFWL_Event* pEvent) override; public: - bool OnValidate(IFWL_Widget* pWidget, CFX_WideString& wsText); + bool OnValidate(CFWL_Widget* pWidget, CFX_WideString& wsText); }; class CXFA_FFPasswordEdit : public CXFA_FFTextEdit { @@ -91,7 +91,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { void UpdateWidgetProperty() override; void OnProcessEvent(CFWL_Event* pEvent) override; - void OnSelectChanged(IFWL_Widget* pWidget, + void OnSelectChanged(CFWL_Widget* pWidget, int32_t iYear, int32_t iMonth, int32_t iDay); diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp index ba38f853a6..63a4a92e24 100644 --- a/xfa/fxfa/app/xfa_fwladapter.cpp +++ b/xfa/fxfa/app/xfa_fwladapter.cpp @@ -13,7 +13,7 @@ CXFA_FWLAdapterWidgetMgr::CXFA_FWLAdapterWidgetMgr() {} CXFA_FWLAdapterWidgetMgr::~CXFA_FWLAdapterWidgetMgr() {} -void CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget, +void CXFA_FWLAdapterWidgetMgr::RepaintWidget(CFWL_Widget* pWidget, const CFX_RectF* pRect) { if (!pWidget) return; @@ -26,7 +26,7 @@ void CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget, pFFWidget->AddInvalidateRect(nullptr); } -bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(IFWL_Widget* pWidget, +bool CXFA_FWLAdapterWidgetMgr::GetPopupPos(CFWL_Widget* pWidget, FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, diff --git a/xfa/fxfa/app/xfa_fwladapter.h b/xfa/fxfa/app/xfa_fwladapter.h index 489d8709ac..3aaa04e513 100644 --- a/xfa/fxfa/app/xfa_fwladapter.h +++ b/xfa/fxfa/app/xfa_fwladapter.h @@ -11,15 +11,15 @@ #include "core/fxcrt/fx_system.h" #include "xfa/fwl/core/fwl_error.h" -class IFWL_Widget; +class CFWL_Widget; class CXFA_FWLAdapterWidgetMgr { public: CXFA_FWLAdapterWidgetMgr(); ~CXFA_FWLAdapterWidgetMgr(); - void RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect); - bool GetPopupPos(IFWL_Widget* pWidget, + void RepaintWidget(CFWL_Widget* pWidget, const CFX_RectF* pRect); + bool GetPopupPos(CFWL_Widget* pWidget, FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, const CFX_RectF& rtAnchor, diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 782038a741..0222ddd7f7 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -9,19 +9,19 @@ #include "xfa/fde/tto/fde_textout.h" #include "xfa/fgas/crt/fgas_codepage.h" #include "xfa/fgas/font/cfgas_gefont.h" +#include "xfa/fwl/core/cfwl_barcode.h" #include "xfa/fwl/core/cfwl_caret.h" +#include "xfa/fwl/core/cfwl_checkbox.h" +#include "xfa/fwl/core/cfwl_combobox.h" +#include "xfa/fwl/core/cfwl_datetimepicker.h" +#include "xfa/fwl/core/cfwl_edit.h" +#include "xfa/fwl/core/cfwl_listbox.h" #include "xfa/fwl/core/cfwl_monthcalendar.h" +#include "xfa/fwl/core/cfwl_picturebox.h" +#include "xfa/fwl/core/cfwl_pushbutton.h" #include "xfa/fwl/core/cfwl_scrollbar.h" #include "xfa/fwl/core/cfwl_themebackground.h" #include "xfa/fwl/core/cfwl_themetext.h" -#include "xfa/fwl/core/ifwl_barcode.h" -#include "xfa/fwl/core/ifwl_checkbox.h" -#include "xfa/fwl/core/ifwl_combobox.h" -#include "xfa/fwl/core/ifwl_datetimepicker.h" -#include "xfa/fwl/core/ifwl_edit.h" -#include "xfa/fwl/core/ifwl_listbox.h" -#include "xfa/fwl/core/ifwl_picturebox.h" -#include "xfa/fwl/core/ifwl_pushbutton.h" #include "xfa/fxfa/xfa_ffapp.h" #include "xfa/fxfa/xfa_ffwidget.h" #include "xfa/fxgraphics/cfx_color.h" @@ -34,8 +34,8 @@ const FX_WCHAR* const g_FWLTheme_CalFonts[] = { } // namespace -CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget) { - IFWL_Widget* pOuter = pWidget; +CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget) { + CFWL_Widget* pOuter = pWidget; while (pOuter && pOuter->GetOuter()) pOuter = pOuter->GetOuter(); @@ -342,7 +342,7 @@ void CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { pParams->m_wsText.GetLength(), rect); } -CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(IFWL_Widget* pWidget) { +CFWL_WidgetTP* CXFA_FWLTheme::GetTheme(CFWL_Widget* pWidget) { switch (pWidget->GetClassID()) { case FWL_Type::CheckBox: return m_pCheckBoxTP.get(); diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index 4ba3ffb242..257995094a 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -37,7 +37,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { void CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) override; private: - CFWL_WidgetTP* GetTheme(IFWL_Widget* pWidget); + CFWL_WidgetTP* GetTheme(CFWL_Widget* pWidget); std::unique_ptr m_pCheckBoxTP; std::unique_ptr m_pListBoxTP; std::unique_ptr m_pPictureBoxTP; @@ -59,6 +59,6 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { CFX_SizeF m_SizeAboveBelow; }; -CXFA_FFWidget* XFA_ThemeGetOuterWidget(IFWL_Widget* pWidget); +CXFA_FFWidget* XFA_ThemeGetOuterWidget(CFWL_Widget* pWidget); #endif // XFA_FXFA_APP_XFA_FWLTHEME_H_ diff --git a/xfa/fxfa/xfa_ffapp.h b/xfa/fxfa/xfa_ffapp.h index 4b40ba76c8..6dbdb72197 100644 --- a/xfa/fxfa/xfa_ffapp.h +++ b/xfa/fxfa/xfa_ffapp.h @@ -22,7 +22,7 @@ class CXFA_FWLTheme; class CXFA_FFDocHandler; class CXFA_FontMgr; class IFWL_AdapterTimerMgr; -class IFWL_WidgetMgrDelegate; +class CFWL_WidgetMgrDelegate; class CXFA_FileRead : public IFX_SeekableReadStream { public: @@ -51,7 +51,7 @@ class CXFA_FFApp { void SetDefaultFontMgr(std::unique_ptr pFontMgr); CXFA_FFDocHandler* GetDocHandler(); - CXFA_FWLAdapterWidgetMgr* GetWidgetMgr(IFWL_WidgetMgrDelegate* pDelegate); + CXFA_FWLAdapterWidgetMgr* GetWidgetMgr(CFWL_WidgetMgrDelegate* pDelegate); CFGAS_FontMgr* GetFDEFontMgr(); CXFA_FWLTheme* GetFWLTheme(); @@ -59,7 +59,7 @@ class CXFA_FFApp { const CFWL_App* GetFWLApp() const { return m_pFWLApp.get(); } IFWL_AdapterTimerMgr* GetTimerMgr() const; CXFA_FontMgr* GetXFAFontMgr() const; - IFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const { + CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const { return m_pWidgetMgrDelegate; } @@ -86,7 +86,7 @@ class CXFA_FFApp { std::unique_ptr m_pFontSource; #endif std::unique_ptr m_pAdapterWidgetMgr; - IFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned. + CFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned. // |m_pFWLApp| has to be released first, then |m_pFWLTheme| since the former // may refers to theme manager and the latter refers to font manager. -- cgit v1.2.3