From a4754b4d4ebc5e518a1d1363648042a5c7add544 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 20 Nov 2015 10:35:07 -0800 Subject: Fix CFWL_WidgetImpDelegate hierarchy. Instead of casting to the unrelated IFWL_WidgetDelegate class and hoping that its vtables line up, make CFWL_WidgetImpDelegate inherit from it. We can then remove a lot of casting, even during delete given that it has a virtual dtor. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1458173002 . --- xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_caretimp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp | 25 +++++++----------- .../fwl/src/basewidget/fwl_datetimepickerimp.cpp | 29 ++++++++------------- xfa/src/fwl/src/basewidget/fwl_editimp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_listboximp.cpp | 8 +++--- .../fwl/src/basewidget/fwl_monthcalendarimp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp | 8 +++--- xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp | 8 +++--- .../fwl/src/basewidget/include/fwl_barcodeimp.h | 2 +- xfa/src/fwl/src/basewidget/include/fwl_caretimp.h | 6 ++--- .../fwl/src/basewidget/include/fwl_checkboximp.h | 6 ++--- .../fwl/src/basewidget/include/fwl_comboboximp.h | 18 ++++++------- .../src/basewidget/include/fwl_datetimepickerimp.h | 11 ++++---- xfa/src/fwl/src/basewidget/include/fwl_editimp.h | 8 +++--- .../fwl/src/basewidget/include/fwl_formproxyimp.h | 2 +- .../fwl/src/basewidget/include/fwl_listboximp.h | 8 +++--- .../src/basewidget/include/fwl_monthcalendarimp.h | 6 ++--- .../fwl/src/basewidget/include/fwl_pictureboximp.h | 4 +-- .../fwl/src/basewidget/include/fwl_pushbuttonimp.h | 8 +++--- .../fwl/src/basewidget/include/fwl_scrollbarimp.h | 6 ++--- .../fwl/src/basewidget/include/fwl_spinbuttonimp.h | 8 +++--- .../src/basewidget/include/fwl_tooltipctrlimp.h | 8 +++--- xfa/src/fwl/src/core/fwl_formimp.cpp | 8 +++--- xfa/src/fwl/src/core/fwl_gridimp.cpp | 14 ++++------ xfa/src/fwl/src/core/include/fwl_formimp.h | 8 +++--- xfa/src/fwl/src/core/include/fwl_gridimp.h | 6 ++--- xfa/src/fwl/src/core/include/fwl_widgetimp.h | 30 +++++++++++++--------- 33 files changed, 139 insertions(+), 178 deletions(-) (limited to 'xfa') diff --git a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp index c65a350645..5544162380 100644 --- a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp @@ -51,17 +51,15 @@ FX_DWORD CFWL_BarcodeImp::GetClassID() const { } FWL_ERR CFWL_BarcodeImp::Initialize() { if (!m_pDelegate) { - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_BarcodeImpDelegate(this); + m_pDelegate = new CFWL_BarcodeImpDelegate(this); } _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_EditImp::Initialize(), FWL_ERR_Indefinite); return FWL_ERR_Succeeded; } FWL_ERR CFWL_BarcodeImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_BarcodeImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; ReleaseBarcodeEngine(); return CFWL_EditImp::Finalize(); } diff --git a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp index 856ca02621..cb40648b60 100644 --- a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp @@ -69,7 +69,7 @@ FX_DWORD CFWL_CaretImp::GetClassID() const { FWL_ERR CFWL_CaretImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_CaretImpDelegate(this); + m_pDelegate = new CFWL_CaretImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_CaretImp::Finalize() { @@ -77,10 +77,8 @@ FWL_ERR CFWL_CaretImp::Finalize() { FWL_StopTimer(m_hTimer); m_hTimer = NULL; } - if (m_pDelegate) { - delete (CFWL_CaretImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp index 01fbb732cb..e490852ff0 100644 --- a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp @@ -77,14 +77,12 @@ FX_DWORD CFWL_CheckBoxImp::GetClassID() const { FWL_ERR CFWL_CheckBoxImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_CheckBoxImpDelegate(this); + m_pDelegate = new CFWL_CheckBoxImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_CheckBoxImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_CheckBoxImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp index 9ea1f4a557..379e75fa66 100644 --- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp @@ -206,18 +206,13 @@ CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, FWL_ERR CFWL_ComboListImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_ListBoxImp::Initialize(), FWL_ERR_Indefinite); - if (m_pDelegate) { - delete (CFWL_ComboListImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_ComboListImpDelegate(this); + delete m_pDelegate; + m_pDelegate = new CFWL_ComboListImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_ComboListImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_ComboListImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_ListBoxImp::Finalize(); } int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { @@ -519,7 +514,7 @@ FWL_ERR CFWL_ComboBoxImp::Initialize() { } _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_WGTSTATE_Invisible); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_ComboBoxImpDelegate(this); + m_pDelegate = new CFWL_ComboBoxImpDelegate(this); CFWL_WidgetImpProperties prop; prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; @@ -551,10 +546,8 @@ FWL_ERR CFWL_ComboBoxImp::Finalize() { m_pEdit->Finalize(); } m_pListBox->Finalize(); - if (m_pDelegate) { - delete (CFWL_ComboBoxImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { @@ -1151,12 +1144,12 @@ void CFWL_ComboBoxImp::InitProxyForm() { m_pProxy->Initialize(); m_pListBox->SetParent((IFWL_Widget*)m_pForm); m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this); - m_pProxy->SetDelegate((IFWL_WidgetDelegate*)m_pListProxyDelegate); + m_pProxy->SetDelegate(m_pListProxyDelegate); } FWL_ERR CFWL_ComboBoxImp::DisForm_Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_WGTSTATE_Invisible); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_ComboBoxImpDelegate(this); + m_pDelegate = new CFWL_ComboBoxImpDelegate(this); DisForm_InitComboList(); DisForm_InitComboEdit(); return FWL_ERR_Succeeded; diff --git a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp index 6abef37aa2..23d12ca920 100644 --- a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp @@ -142,16 +142,14 @@ CFWL_DateTimeEdit::CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_EditImp(properties, pOuter) {} FWL_ERR CFWL_DateTimeEdit::Initialize() { - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_DateTimeEditImpDelegate(this); + m_pDelegate = new CFWL_DateTimeEditImpDelegate(this); _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_EditImp::Initialize(), FWL_ERR_Indefinite); return FWL_ERR_Succeeded; } FWL_ERR CFWL_DateTimeEdit::Finalize() { - if (m_pDelegate) { - delete (CFWL_DateTimeEditImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_EditImp::Finalize(); } CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( @@ -205,18 +203,13 @@ CFWL_DateTimeCalendar::CFWL_DateTimeCalendar( FWL_ERR CFWL_DateTimeCalendar::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_MonthCalendarImp::Initialize(), FWL_ERR_Indefinite); - if (m_pDelegate) { - delete (CFWL_MonthCalendarImpDelegate*)m_pDelegate; - } - m_pDelegate = - (IFWL_WidgetDelegate*)new CFWL_DateTimeCalendarImpDelegate(this); + delete m_pDelegate; + m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_DateTimeCalendar::Finalize() { - if (m_pDelegate) { - delete (CFWL_DateTimeCalendarImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_MonthCalendarImp::Finalize(); } CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( @@ -455,7 +448,7 @@ FX_DWORD CFWL_DateTimePickerImp::GetClassID() const { FWL_ERR CFWL_DateTimePickerImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_DateTimePickerImpDelegate(this); + m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; CFWL_WidgetImpProperties propMonth; propMonth.m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border; @@ -489,10 +482,8 @@ FWL_ERR CFWL_DateTimePickerImp::Finalize() { m_pForm->Finalize(); } UnregisterEventTarget(); - if (m_pDelegate) { - delete (CFWL_DateTimePickerImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp index 9f0dfa058a..07fec7f032 100644 --- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp @@ -238,7 +238,7 @@ FWL_ERR CFWL_EditImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); if (!m_pDelegate) { - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_EditImpDelegate(this); + m_pDelegate = new CFWL_EditImpDelegate(this); } InitCaret(); if (!m_pEdtEngine) { @@ -256,10 +256,8 @@ FWL_ERR CFWL_EditImp::Finalize() { if (m_pVertScrollBar) { m_pVertScrollBar->Finalize(); } - if (m_pDelegate) { - delete (CFWL_EditImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp b/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp index 57c9490d71..87752afa6e 100644 --- a/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp @@ -33,14 +33,12 @@ FX_BOOL CFWL_FormProxyImp::IsInstance(const CFX_WideStringC& wsClass) const { FWL_ERR CFWL_FormProxyImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_FormProxyImpDelegate(this); + m_pDelegate = new CFWL_FormProxyImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_FormProxyImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_FormProxyImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_FormProxyImp::Update() { diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp index 10f09f97a7..9e207b37d3 100644 --- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp @@ -93,7 +93,7 @@ FX_DWORD CFWL_ListBoxImp::GetClassID() const { FWL_ERR CFWL_ListBoxImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_ListBoxImpDelegate(this); + m_pDelegate = new CFWL_ListBoxImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_ListBoxImp::Finalize() { @@ -103,10 +103,8 @@ FWL_ERR CFWL_ListBoxImp::Finalize() { if (m_pHorzScrollBar) { m_pHorzScrollBar->Finalize(); } - if (m_pDelegate) { - delete (CFWL_ListBoxImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp index 7829105cc5..999f3249b6 100644 --- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp @@ -122,14 +122,12 @@ FX_DWORD CFWL_MonthCalendarImp::GetClassID() const { FWL_ERR CFWL_MonthCalendarImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_MonthCalendarImpDelegate(this); + m_pDelegate = new CFWL_MonthCalendarImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_MonthCalendarImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_MonthCalendarImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect, diff --git a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp index 0eaeaa41c2..37b1ffe7fe 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp @@ -53,14 +53,12 @@ FX_DWORD CFWL_PictureBoxImp::GetClassID() const { FWL_ERR CFWL_PictureBoxImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_PictureBoxImpDelegate(this); + m_pDelegate = new CFWL_PictureBoxImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_PictureBoxImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_PictureBoxImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp index 49719a91ac..3c21040604 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp @@ -51,14 +51,12 @@ FX_DWORD CFWL_PushButtonImp::GetClassID() const { FWL_ERR CFWL_PushButtonImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_PushButtonImpDelegate(this); + m_pDelegate = new CFWL_PushButtonImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_PushButtonImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_PushButtonImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp index ec44d9c2de..a9d75d0fad 100644 --- a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp @@ -137,14 +137,12 @@ FX_DWORD CFWL_ScrollBarImp::GetClassID() const { FWL_ERR CFWL_ScrollBarImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_ScrollBarImpDelegate(this); + m_pDelegate = new CFWL_ScrollBarImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_ScrollBarImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_ScrollBarImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp index cc87f51111..2b00584dd9 100644 --- a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp @@ -68,14 +68,12 @@ FX_DWORD CFWL_SpinButtonImp::GetClassID() const { FWL_ERR CFWL_SpinButtonImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_SpinButtonImpDelegate(this); + m_pDelegate = new CFWL_SpinButtonImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_SpinButtonImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_SpinButtonImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp index cbc27caf85..f466764e39 100644 --- a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp @@ -79,14 +79,12 @@ FWL_ERR CFWL_ToolTipImp::Initialize() { m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_ToolTipImpDelegate(this); + m_pDelegate = new CFWL_ToolTipImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_ToolTipImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_ToolTipImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h b/xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h index b939885f75..d4dd1af7a4 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_barcodeimp.h @@ -47,6 +47,6 @@ class CFWL_BarcodeImp : public CFWL_EditImp { class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate { public: CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; }; #endif diff --git a/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h b/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h index a01d2efe5a..5b7d0642ef 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h @@ -55,9 +55,9 @@ class CFWL_CaretImp : public CFWL_WidgetImp { class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: CFWL_CaretImp* m_pOwner; diff --git a/xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h index 24d0b1989a..64ea6dcca0 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_checkboximp.h @@ -46,9 +46,9 @@ class CFWL_CheckBoxImp : public CFWL_WidgetImp { class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnActivate(CFWL_Message* pMsg); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h index e0c19118b5..f824fa1c2f 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_comboboximp.h @@ -41,7 +41,7 @@ class CFWL_ComboEditImp : public CFWL_EditImp { class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate { public: CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; protected: CFWL_ComboEditImp* m_pOwner; @@ -66,7 +66,7 @@ class CFWL_ComboListImp : public CFWL_ListBoxImp { class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate { public: CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; protected: void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); @@ -190,10 +190,10 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); @@ -218,9 +218,9 @@ class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; void Reset() { m_bLButtonUpSelf = FALSE; } protected: diff --git a/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h b/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h index 8730e55f43..5048601d0e 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_datetimepickerimp.h @@ -48,7 +48,7 @@ class CFWL_DateTimeEdit : public CFWL_EditImp { class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate { public: CFWL_DateTimeEditImpDelegate(CFWL_DateTimeEdit* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; private: int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); @@ -69,7 +69,8 @@ class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate { public: CFWL_DateTimeCalendarImpDelegate(CFWL_DateTimeCalendar* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnLButtonDownEx(CFWL_MsgMouse* pMsg); void OnLButtonUpEx(CFWL_MsgMouse* pMsg); void OnMouseMoveEx(CFWL_MsgMouse* pMsg); @@ -195,9 +196,9 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_DateTimePickerImpDelegate(CFWL_DateTimePickerImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_editimp.h b/xfa/src/fwl/src/basewidget/include/fwl_editimp.h index 79e5ac9ece..0000856963 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_editimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_editimp.h @@ -180,10 +180,10 @@ class CFWL_EditImp : public CFWL_WidgetImp, public IFDE_TxtEdtEventSink { class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_EditImpDelegate(CFWL_EditImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void DoActivate(CFWL_MsgActivate* pMsg); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h b/xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h index 0e5baf0b47..d196917ad6 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_formproxyimp.h @@ -33,7 +33,7 @@ class CFWL_FormProxyImp : public CFWL_FormImp { class CFWL_FormProxyImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; protected: CFWL_FormProxyImp* m_pOwner; diff --git a/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h index a2d6e65347..4695a2caec 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_listboximp.h @@ -98,10 +98,10 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h b/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h index 7cc1a19724..053384a041 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_monthcalendarimp.h @@ -233,9 +233,9 @@ typedef struct _DATEINFO { class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnActivate(CFWL_Message* pMsg); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h b/xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h index 2bd1d8ce58..2c12610ef6 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_pictureboximp.h @@ -43,8 +43,8 @@ class CFWL_PictureBoxImp : public CFWL_WidgetImp { class CFWL_PictureBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_PictureBoxImpDelegate(CFWL_PictureBoxImp* pOwner); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: CFWL_PictureBoxImp* m_pOwner; diff --git a/xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h b/xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h index b346e52f12..2985629854 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_pushbuttonimp.h @@ -47,10 +47,10 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp { class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_PushButtonImpDelegate(CFWL_PushButtonImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h b/xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h index 896c6edb7f..cc9d9c3d64 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_scrollbarimp.h @@ -102,9 +102,9 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnLButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h b/xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h index f196b37f51..6b42d2fc73 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_spinbuttonimp.h @@ -52,10 +52,10 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_SpinButtonImpDelegate(CFWL_SpinButtonImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h b/xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h index c652346e51..1764fc05c5 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_tooltipctrlimp.h @@ -67,10 +67,10 @@ class CFWL_ToolTipImp : public CFWL_FormImp { class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/src/fwl/src/core/fwl_formimp.cpp b/xfa/src/fwl/src/core/fwl_formimp.cpp index 21d810eeeb..b72afdf5c3 100644 --- a/xfa/src/fwl/src/core/fwl_formimp.cpp +++ b/xfa/src/fwl/src/core/fwl_formimp.cpp @@ -135,14 +135,12 @@ FWL_ERR CFWL_FormImp::Initialize() { FWL_ERR_Indefinite); RegisterForm(); RegisterEventTarget(); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_FormImpDelegate(this); + m_pDelegate = new CFWL_FormImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_FormImp::Finalize() { - if (m_pDelegate) { - delete (CFWL_FormImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; UnregisterEventTarget(); UnRegisterForm(); return CFWL_WidgetImp::Finalize(); diff --git a/xfa/src/fwl/src/core/fwl_gridimp.cpp b/xfa/src/fwl/src/core/fwl_gridimp.cpp index 4928288542..251464e80f 100644 --- a/xfa/src/fwl/src/core/fwl_gridimp.cpp +++ b/xfa/src/fwl/src/core/fwl_gridimp.cpp @@ -170,10 +170,8 @@ CFWL_GridImp::~CFWL_GridImp() { delete pInfo; } m_mapWidgetInfo.RemoveAll(); - if (m_pDelegate) { - delete (CFWL_GridImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; } FWL_ERR CFWL_GridImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Grid; @@ -185,16 +183,14 @@ FX_DWORD CFWL_GridImp::GetClassID() const { FWL_ERR CFWL_GridImp::Initialize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_ContentImp::Initialize(), FWL_ERR_Indefinite); - m_pDelegate = (IFWL_WidgetDelegate*)new CFWL_GridImpDelegate(this); + m_pDelegate = new CFWL_GridImpDelegate(this); return FWL_ERR_Succeeded; } FWL_ERR CFWL_GridImp::Finalize() { _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_ContentImp::Finalize(), FWL_ERR_Indefinite); - if (m_pDelegate) { - delete (CFWL_GridImpDelegate*)m_pDelegate; - m_pDelegate = NULL; - } + delete m_pDelegate; + m_pDelegate = nullptr; return FWL_ERR_Succeeded; } FWL_ERR CFWL_GridImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { diff --git a/xfa/src/fwl/src/core/include/fwl_formimp.h b/xfa/src/fwl/src/core/include/fwl_formimp.h index 186052d6e8..f0e986ecff 100644 --- a/xfa/src/fwl/src/core/include/fwl_formimp.h +++ b/xfa/src/fwl/src/core/include/fwl_formimp.h @@ -171,10 +171,10 @@ class CFWL_FormImp : public CFWL_PanelImp { class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_FormImpDelegate(CFWL_FormImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnLButtonDown(CFWL_MsgMouse* pMsg); diff --git a/xfa/src/fwl/src/core/include/fwl_gridimp.h b/xfa/src/fwl/src/core/include/fwl_gridimp.h index 56910c57e0..bce154ded3 100644 --- a/xfa/src/fwl/src/core/include/fwl_gridimp.h +++ b/xfa/src/fwl/src/core/include/fwl_gridimp.h @@ -183,9 +183,9 @@ class CFWL_GridImp : public CFWL_ContentImp { class CFWL_GridImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_GridImpDelegate(CFWL_GridImp* pOwner); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: CFWL_GridImp* m_pOwner; diff --git a/xfa/src/fwl/src/core/include/fwl_widgetimp.h b/xfa/src/fwl/src/core/include/fwl_widgetimp.h index 38a2e4a89a..efc7883eca 100644 --- a/xfa/src/fwl/src/core/include/fwl_widgetimp.h +++ b/xfa/src/fwl/src/core/include/fwl_widgetimp.h @@ -4,17 +4,21 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef _FWL_WIDGET_IMP_H -#define _FWL_WIDGET_IMP_H +#ifndef FWL_WIDGETIMP_H_ +#define FWL_WIDGETIMP_H_ + +#include "xfa/include/fwl/core/fwl_widget.h" +#include "xfa/src/fwl/src/core/include/fwl_targetimp.h" + class CFWL_NoteTarget; class CFWL_NoteThread; class CFWL_WidgetImpProperties; class CFWL_WidgetMgr; -class IFWL_Widget; -class IFWL_ThemeProvider; class IFWL_DataProvider; +class IFWL_ThemeProvider; +class IFWL_Widget; class IFWL_WidgetDelegate; -class CFWL_WidgetImp; + class CFWL_WidgetImp : public CFWL_TargetImp { public: virtual FWL_ERR Initialize(); @@ -152,13 +156,15 @@ class CFWL_WidgetImp : public CFWL_TargetImp { friend void FWL_SetWidgetStates(IFWL_Widget* widget, FX_DWORD dwStates); friend void FWL_SetWidgetStyles(IFWL_Widget* widget, FX_DWORD dwStyles); }; -class CFWL_WidgetImpDelegate { + +class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { public: CFWL_WidgetImpDelegate(); - virtual ~CFWL_WidgetImpDelegate() {} - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + ~CFWL_WidgetImpDelegate() override {} + int32_t OnProcessMessage(CFWL_Message* pMessage) override; + FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; }; -#endif + +#endif // FWL_WIDGETIMP_H_ -- cgit v1.2.3