From 3fc8c688374fc8f34f4b02debc5888e2775df91b Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 18 Nov 2015 15:55:21 -0800 Subject: Make IFWL_Target::m_pImpl a private member. Remove pointless subclass dtors since CFWL_TargetImpl has a virtual dtor, and can be deleted by the base class. Kept pointless subclass ctors for the moment to hopefully combine with Initialize someday, though they need not do anything since the base class ctor nulls out m_pImpl. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1460883002 . --- xfa/include/fwl/basewidget/fwl_barcode.h | 1 - xfa/include/fwl/basewidget/fwl_caret.h | 1 - xfa/include/fwl/basewidget/fwl_checkbox.h | 2 - xfa/include/fwl/basewidget/fwl_combobox.h | 1 - xfa/include/fwl/basewidget/fwl_datetimepicker.h | 1 - xfa/include/fwl/basewidget/fwl_edit.h | 1 - xfa/include/fwl/basewidget/fwl_listbox.h | 1 - xfa/include/fwl/basewidget/fwl_monthcalendar.h | 1 - xfa/include/fwl/basewidget/fwl_picturebox.h | 1 - xfa/include/fwl/basewidget/fwl_pushbutton.h | 1 - xfa/include/fwl/basewidget/fwl_scrollbar.h | 1 - xfa/include/fwl/basewidget/fwl_spinbutton.h | 1 - xfa/include/fwl/basewidget/fwl_tooltipctrl.h | 1 - xfa/include/fwl/core/fwl_content.h | 1 - xfa/include/fwl/core/fwl_form.h | 1 - xfa/include/fwl/core/fwl_grid.h | 1 - xfa/include/fwl/core/fwl_panel.h | 2 - xfa/include/fwl/core/fwl_target.h | 2 + xfa/include/fwl/core/fwl_widget.h | 1 - xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp | 25 ++--- xfa/src/fwl/src/basewidget/fwl_caretimp.cpp | 29 +++--- xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp | 46 ++++------ xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp | 84 +++++++++-------- .../fwl/src/basewidget/fwl_datetimepickerimp.cpp | 92 ++++++++++--------- xfa/src/fwl/src/basewidget/fwl_editimp.cpp | 101 ++++++++++----------- xfa/src/fwl/src/basewidget/fwl_listboximp.cpp | 35 +++---- .../fwl/src/basewidget/fwl_monthcalendarimp.cpp | 29 +++--- xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp | 22 ++--- xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp | 22 ++--- xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp | 45 ++++----- xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp | 26 +++--- xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp | 27 +++--- xfa/src/fwl/src/core/fwl_contentimp.cpp | 28 +++--- xfa/src/fwl/src/core/fwl_formimp.cpp | 42 ++++----- xfa/src/fwl/src/core/fwl_gridimp.cpp | 76 ++++++++-------- xfa/src/fwl/src/core/fwl_panelimp.cpp | 53 +++++------ xfa/src/fwl/src/core/fwl_targetimp.cpp | 22 +++-- xfa/src/fwl/src/core/fwl_widgetimp.cpp | 92 +++++++++---------- xfa/src/fwl/src/core/include/fwl_targetimp.h | 3 +- 39 files changed, 421 insertions(+), 500 deletions(-) diff --git a/xfa/include/fwl/basewidget/fwl_barcode.h b/xfa/include/fwl/basewidget/fwl_barcode.h index 25aa310e5c..f2b0b2a11a 100644 --- a/xfa/include/fwl/basewidget/fwl_barcode.h +++ b/xfa/include/fwl/basewidget/fwl_barcode.h @@ -58,6 +58,5 @@ class IFWL_Barcode : public IFWL_Edit { protected: IFWL_Barcode(); - virtual ~IFWL_Barcode(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_caret.h b/xfa/include/fwl/basewidget/fwl_caret.h index a73e8b0661..3b8fccbc33 100644 --- a/xfa/include/fwl/basewidget/fwl_caret.h +++ b/xfa/include/fwl/basewidget/fwl_caret.h @@ -28,6 +28,5 @@ class IFWL_Caret : public IFWL_Widget { protected: IFWL_Caret(); - virtual ~IFWL_Caret(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_checkbox.h b/xfa/include/fwl/basewidget/fwl_checkbox.h index 94ee9e7274..63cc75896a 100644 --- a/xfa/include/fwl/basewidget/fwl_checkbox.h +++ b/xfa/include/fwl/basewidget/fwl_checkbox.h @@ -79,7 +79,6 @@ class IFWL_CheckBox : public IFWL_Widget { protected: IFWL_CheckBox(); - virtual ~IFWL_CheckBox(); }; class IFWL_RadioButton : public IFWL_Widget { public: @@ -92,6 +91,5 @@ class IFWL_RadioButton : public IFWL_Widget { protected: IFWL_RadioButton(); - virtual ~IFWL_RadioButton(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_combobox.h b/xfa/include/fwl/basewidget/fwl_combobox.h index 9faf224625..cd7da3d5c8 100644 --- a/xfa/include/fwl/basewidget/fwl_combobox.h +++ b/xfa/include/fwl/basewidget/fwl_combobox.h @@ -137,6 +137,5 @@ class IFWL_ComboBox : public IFWL_Widget { protected: IFWL_ComboBox(); - virtual ~IFWL_ComboBox(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_datetimepicker.h b/xfa/include/fwl/basewidget/fwl_datetimepicker.h index 754445dcbb..04ae8d9bba 100644 --- a/xfa/include/fwl/basewidget/fwl_datetimepicker.h +++ b/xfa/include/fwl/basewidget/fwl_datetimepicker.h @@ -102,6 +102,5 @@ class IFWL_DateTimePicker : public IFWL_Widget { protected: IFWL_DateTimePicker(); - virtual ~IFWL_DateTimePicker(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_edit.h b/xfa/include/fwl/basewidget/fwl_edit.h index 2019d8be4f..2be101e840 100644 --- a/xfa/include/fwl/basewidget/fwl_edit.h +++ b/xfa/include/fwl/basewidget/fwl_edit.h @@ -162,6 +162,5 @@ class IFWL_Edit : public IFWL_Widget { protected: IFWL_Edit(); - virtual ~IFWL_Edit(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_listbox.h b/xfa/include/fwl/basewidget/fwl_listbox.h index fcdd8f7a11..ba59af82dd 100644 --- a/xfa/include/fwl/basewidget/fwl_listbox.h +++ b/xfa/include/fwl/basewidget/fwl_listbox.h @@ -123,6 +123,5 @@ class IFWL_ListBox : public IFWL_Widget { protected: IFWL_ListBox(); - virtual ~IFWL_ListBox(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_monthcalendar.h b/xfa/include/fwl/basewidget/fwl_monthcalendar.h index a7497f01c2..084b7bb270 100644 --- a/xfa/include/fwl/basewidget/fwl_monthcalendar.h +++ b/xfa/include/fwl/basewidget/fwl_monthcalendar.h @@ -128,6 +128,5 @@ class IFWL_MonthCalendar : public IFWL_Widget { protected: IFWL_MonthCalendar(); - virtual ~IFWL_MonthCalendar(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_picturebox.h b/xfa/include/fwl/basewidget/fwl_picturebox.h index caa7fce335..76389f65d2 100644 --- a/xfa/include/fwl/basewidget/fwl_picturebox.h +++ b/xfa/include/fwl/basewidget/fwl_picturebox.h @@ -50,6 +50,5 @@ class IFWL_PictureBox : public IFWL_Widget { protected: IFWL_PictureBox(); - virtual ~IFWL_PictureBox(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_pushbutton.h b/xfa/include/fwl/basewidget/fwl_pushbutton.h index ae4ce8820c..223dc5a311 100644 --- a/xfa/include/fwl/basewidget/fwl_pushbutton.h +++ b/xfa/include/fwl/basewidget/fwl_pushbutton.h @@ -52,6 +52,5 @@ class IFWL_PushButton : public IFWL_Widget { protected: IFWL_PushButton(); - virtual ~IFWL_PushButton(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_scrollbar.h b/xfa/include/fwl/basewidget/fwl_scrollbar.h index 13d70a1e83..f81dfc6907 100644 --- a/xfa/include/fwl/basewidget/fwl_scrollbar.h +++ b/xfa/include/fwl/basewidget/fwl_scrollbar.h @@ -67,6 +67,5 @@ class IFWL_ScrollBar : public IFWL_Widget { protected: IFWL_ScrollBar(); - virtual ~IFWL_ScrollBar(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_spinbutton.h b/xfa/include/fwl/basewidget/fwl_spinbutton.h index 31f06c5e8d..dad93a34c2 100644 --- a/xfa/include/fwl/basewidget/fwl_spinbutton.h +++ b/xfa/include/fwl/basewidget/fwl_spinbutton.h @@ -39,6 +39,5 @@ class IFWL_SpinButton : public IFWL_Widget { protected: IFWL_SpinButton(); - virtual ~IFWL_SpinButton(); }; #endif diff --git a/xfa/include/fwl/basewidget/fwl_tooltipctrl.h b/xfa/include/fwl/basewidget/fwl_tooltipctrl.h index a64d6814a5..835f9abf11 100644 --- a/xfa/include/fwl/basewidget/fwl_tooltipctrl.h +++ b/xfa/include/fwl/basewidget/fwl_tooltipctrl.h @@ -41,6 +41,5 @@ class IFWL_ToolTip : public IFWL_Form { protected: IFWL_ToolTip(); - virtual ~IFWL_ToolTip(); }; #endif diff --git a/xfa/include/fwl/core/fwl_content.h b/xfa/include/fwl/core/fwl_content.h index 41b1af93b5..8669340343 100644 --- a/xfa/include/fwl/core/fwl_content.h +++ b/xfa/include/fwl/core/fwl_content.h @@ -22,6 +22,5 @@ class IFWL_Content : public IFWL_Widget { protected: IFWL_Content(); - virtual ~IFWL_Content(); }; #endif diff --git a/xfa/include/fwl/core/fwl_form.h b/xfa/include/fwl/core/fwl_form.h index 81c06c0591..b06d5742e9 100644 --- a/xfa/include/fwl/core/fwl_form.h +++ b/xfa/include/fwl/core/fwl_form.h @@ -81,6 +81,5 @@ class IFWL_Form : public IFWL_Panel { protected: IFWL_Form(); - virtual ~IFWL_Form(); }; #endif diff --git a/xfa/include/fwl/core/fwl_grid.h b/xfa/include/fwl/core/fwl_grid.h index fc97c9a841..7126024ba7 100644 --- a/xfa/include/fwl/core/fwl_grid.h +++ b/xfa/include/fwl/core/fwl_grid.h @@ -82,6 +82,5 @@ class IFWL_Grid : public IFWL_Content { protected: IFWL_Grid(); - virtual ~IFWL_Grid(); }; #endif diff --git a/xfa/include/fwl/core/fwl_panel.h b/xfa/include/fwl/core/fwl_panel.h index b2aa6f4799..51d1249d56 100644 --- a/xfa/include/fwl/core/fwl_panel.h +++ b/xfa/include/fwl/core/fwl_panel.h @@ -23,7 +23,6 @@ class IFWL_Panel : public IFWL_Widget { protected: IFWL_Panel(); - virtual ~IFWL_Panel(); }; class IFWL_CustomPanel : public IFWL_Widget { public: @@ -37,6 +36,5 @@ class IFWL_CustomPanel : public IFWL_Widget { protected: IFWL_CustomPanel(); - virtual ~IFWL_CustomPanel(); }; #endif diff --git a/xfa/include/fwl/core/fwl_target.h b/xfa/include/fwl/core/fwl_target.h index 363ce30562..bf5cf83f3a 100644 --- a/xfa/include/fwl/core/fwl_target.h +++ b/xfa/include/fwl/core/fwl_target.h @@ -44,6 +44,8 @@ class IFWL_Target { protected: virtual ~IFWL_Target(); + + private: CFWL_TargetImp* m_pImpl; }; diff --git a/xfa/include/fwl/core/fwl_widget.h b/xfa/include/fwl/core/fwl_widget.h index 10808bcac5..4a9c794d28 100644 --- a/xfa/include/fwl/core/fwl_widget.h +++ b/xfa/include/fwl/core/fwl_widget.h @@ -101,7 +101,6 @@ class IFWL_Custom : public IFWL_Widget { protected: IFWL_Custom(); - virtual ~IFWL_Custom(); }; class IFWL_Proxy { public: diff --git a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp index 342118e0a1..b0addafe13 100644 --- a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp @@ -14,30 +14,25 @@ IFWL_Barcode* IFWL_Barcode::Create() { return new IFWL_Barcode; } IFWL_Barcode::IFWL_Barcode() { - m_pImpl = NULL; -} -IFWL_Barcode::~IFWL_Barcode() { - if (m_pImpl) { - delete (CFWL_BarcodeImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_Barcode::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_BarcodeImp(pOuter); - ((CFWL_BarcodeImp*)m_pImpl)->SetInterface(this); - return ((CFWL_BarcodeImp*)m_pImpl)->Initialize(); + CFWL_BarcodeImp* pBarcodeImpl = new CFWL_BarcodeImp(pOuter); + SetImpl(pBarcodeImpl); + pBarcodeImpl->SetInterface(this); + return pBarcodeImpl->Initialize(); } FWL_ERR IFWL_Barcode::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_BarcodeImp(properties, pOuter); - ((CFWL_BarcodeImp*)m_pImpl)->SetInterface(this); - return ((CFWL_BarcodeImp*)m_pImpl)->Initialize(); + CFWL_BarcodeImp* pBarcodeImpl = new CFWL_BarcodeImp(properties, pOuter); + SetImpl(pBarcodeImpl); + pBarcodeImpl->SetInterface(this); + return pBarcodeImpl->Initialize(); } void IFWL_Barcode::SetType(BC_TYPE type) { - ((CFWL_BarcodeImp*)m_pImpl)->SetType(type); + static_cast(GetImpl())->SetType(type); } FX_BOOL IFWL_Barcode::IsProtectedType() { - return ((CFWL_BarcodeImp*)m_pImpl)->IsProtectedType(); + return static_cast(GetImpl())->IsProtectedType(); } CFWL_BarcodeImp::CFWL_BarcodeImp(IFWL_Widget* pOuter) : CFWL_EditImp(pOuter), diff --git a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp index c0cc74b1bc..856ca02621 100644 --- a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp @@ -13,36 +13,31 @@ IFWL_Caret* IFWL_Caret::Create() { return new IFWL_Caret; } IFWL_Caret::IFWL_Caret() { - m_pImpl = NULL; -} -IFWL_Caret::~IFWL_Caret() { - if (m_pImpl) { - delete (CFWL_CaretImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_Caret::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_CaretImp(pOuter); - ((CFWL_CaretImp*)m_pImpl)->SetInterface(this); - return ((CFWL_CaretImp*)m_pImpl)->Initialize(); + CFWL_CaretImp* pCaretImpl = new CFWL_CaretImp(pOuter); + SetImpl(pCaretImpl); + pCaretImpl->SetInterface(this); + return pCaretImpl->Initialize(); } FWL_ERR IFWL_Caret::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_CaretImp(properties, pOuter); - ((CFWL_CaretImp*)m_pImpl)->SetInterface(this); - return ((CFWL_CaretImp*)m_pImpl)->Initialize(); + CFWL_CaretImp* pCaretImpl = new CFWL_CaretImp(properties, pOuter); + SetImpl(pCaretImpl); + pCaretImpl->SetInterface(this); + return pCaretImpl->Initialize(); } FWL_ERR IFWL_Caret::ShowCaret(FX_BOOL bFlag) { - return ((CFWL_CaretImp*)m_pImpl)->ShowCaret(bFlag); + return static_cast(GetImpl())->ShowCaret(bFlag); } FWL_ERR IFWL_Caret::GetFrequency(FX_DWORD& elapse) { - return ((CFWL_CaretImp*)m_pImpl)->GetFrequency(elapse); + return static_cast(GetImpl())->GetFrequency(elapse); } FWL_ERR IFWL_Caret::SetFrequency(FX_DWORD elapse) { - return ((CFWL_CaretImp*)m_pImpl)->SetFrequency(elapse); + return static_cast(GetImpl())->SetFrequency(elapse); } FWL_ERR IFWL_Caret::SetColor(CFX_Color crFill) { - return ((CFWL_CaretImp*)m_pImpl)->SetColor(crFill); + return static_cast(GetImpl())->SetColor(crFill); } CFWL_CaretImp::CFWL_CaretImp(IFWL_Widget* pOuter) : m_hTimer(NULL) { m_dwElapse = 400; diff --git a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp index e63d87c97c..b18df4e13f 100644 --- a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp @@ -15,53 +15,43 @@ IFWL_CheckBox* IFWL_CheckBox::Create() { return new IFWL_CheckBox; } IFWL_CheckBox::IFWL_CheckBox() { - m_pImpl = NULL; -} -IFWL_CheckBox::~IFWL_CheckBox() { - if (m_pImpl) { - delete (CFWL_CheckBoxImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_CheckBox::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_CheckBoxImp(pOuter); - ((CFWL_CheckBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_CheckBoxImp*)m_pImpl)->Initialize(); + CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(pOuter); + SetImpl(pCheckBoxImpl); + pCheckBoxImpl->SetInterface(this); + return pCheckBoxImpl->Initialize(); } FWL_ERR IFWL_CheckBox::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_CheckBoxImp(properties, pOuter); - ((CFWL_CheckBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_CheckBoxImp*)m_pImpl)->Initialize(); + CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(properties, pOuter); + SetImpl(pCheckBoxImpl); + pCheckBoxImpl->SetInterface(this); + return pCheckBoxImpl->Initialize(); } int32_t IFWL_CheckBox::GetCheckState() { - return ((CFWL_CheckBoxImp*)m_pImpl)->GetCheckState(); + return static_cast(GetImpl())->GetCheckState(); } FWL_ERR IFWL_CheckBox::SetCheckState(int32_t iCheck) { - return ((CFWL_CheckBoxImp*)m_pImpl)->SetCheckState(iCheck); + return static_cast(GetImpl())->SetCheckState(iCheck); } IFWL_RadioButton* IFWL_RadioButton::Create() { return new IFWL_RadioButton; } IFWL_RadioButton::IFWL_RadioButton() { - m_pImpl = NULL; -} -IFWL_RadioButton::~IFWL_RadioButton() { - if (m_pImpl) { - delete (CFWL_CheckBoxImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_RadioButton::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_CheckBoxImp(pOuter); - ((CFWL_CheckBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_CheckBoxImp*)m_pImpl)->Initialize(); + CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(pOuter); + SetImpl(pCheckBoxImpl); + pCheckBoxImpl->SetInterface(this); + return pCheckBoxImpl->Initialize(); } FWL_ERR IFWL_RadioButton::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_CheckBoxImp(properties, pOuter); - ((CFWL_CheckBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_CheckBoxImp*)m_pImpl)->Initialize(); + CFWL_CheckBoxImp* pCheckBoxImpl = new CFWL_CheckBoxImp(properties, pOuter); + SetImpl(pCheckBoxImpl); + pCheckBoxImpl->SetInterface(this); + return pCheckBoxImpl->Initialize(); } CFWL_CheckBoxImp::CFWL_CheckBoxImp(IFWL_Widget* pOuter) : CFWL_WidgetImp(pOuter), diff --git a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp index 74a9da43e4..75a240b104 100644 --- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp @@ -22,117 +22,115 @@ IFWL_ComboBox* IFWL_ComboBox::Create() { return new IFWL_ComboBox; } IFWL_ComboBox::IFWL_ComboBox() { - m_pImpl = NULL; -} -IFWL_ComboBox::~IFWL_ComboBox() { - if (m_pImpl) { - delete (CFWL_ComboBoxImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_ComboBox::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_ComboBoxImp(pOuter); - ((CFWL_ComboBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ComboBoxImp*)m_pImpl)->Initialize(); + CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(pOuter); + SetImpl(pComboBoxImpl); + pComboBoxImpl->SetInterface(this); + return pComboBoxImpl->Initialize(); } FWL_ERR IFWL_ComboBox::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_ComboBoxImp(properties, pOuter); - ((CFWL_ComboBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ComboBoxImp*)m_pImpl)->Initialize(); + CFWL_ComboBoxImp* pComboBoxImpl = new CFWL_ComboBoxImp(properties, pOuter); + SetImpl(pComboBoxImpl); + pComboBoxImpl->SetInterface(this); + return pComboBoxImpl->Initialize(); } int32_t IFWL_ComboBox::GetCurSel() { - return ((CFWL_ComboBoxImp*)m_pImpl)->GetCurSel(); + return static_cast(GetImpl())->GetCurSel(); } FWL_ERR IFWL_ComboBox::SetCurSel(int32_t iSel) { - return ((CFWL_ComboBoxImp*)m_pImpl)->SetCurSel(iSel); + return static_cast(GetImpl())->SetCurSel(iSel); } FWL_ERR IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { - return ((CFWL_ComboBoxImp*)m_pImpl)->SetEditText(wsText); + return static_cast(GetImpl())->SetEditText(wsText); } int32_t IFWL_ComboBox::GetEditTextLength() const { - return ((CFWL_ComboBoxImp*)m_pImpl)->GetEditTextLength(); + return static_cast(GetImpl())->GetEditTextLength(); } FWL_ERR IFWL_ComboBox::GetEditText(CFX_WideString& wsText, int32_t nStart, int32_t nCount) const { - return ((CFWL_ComboBoxImp*)m_pImpl)->GetEditText(wsText, nStart, nCount); + return static_cast(GetImpl()) + ->GetEditText(wsText, nStart, nCount); } FWL_ERR IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { - return ((CFWL_ComboBoxImp*)m_pImpl)->SetEditSelRange(nStart, nCount); + return static_cast(GetImpl()) + ->SetEditSelRange(nStart, nCount); } int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) { - return ((CFWL_ComboBoxImp*)m_pImpl)->GetEditSelRange(nIndex, nStart); + return static_cast(GetImpl()) + ->GetEditSelRange(nIndex, nStart); } int32_t IFWL_ComboBox::GetEditLimit() { - return ((CFWL_ComboBoxImp*)m_pImpl)->GetEditLimit(); + return static_cast(GetImpl())->GetEditLimit(); } FWL_ERR IFWL_ComboBox::SetEditLimit(int32_t nLimit) { - return ((CFWL_ComboBoxImp*)m_pImpl)->SetEditLimit(nLimit); + return static_cast(GetImpl())->SetEditLimit(nLimit); } FWL_ERR IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditDoClipboard(iCmd); + return static_cast(GetImpl())->EditDoClipboard(iCmd); } FX_BOOL IFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditRedo(bsRecord); + return static_cast(GetImpl())->EditRedo(bsRecord); } FX_BOOL IFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditUndo(bsRecord); + return static_cast(GetImpl())->EditUndo(bsRecord); } IFWL_ListBox* IFWL_ComboBox::GetListBoxt() { - return ((CFWL_ComboBoxImp*)m_pImpl)->GetListBoxt(); + return static_cast(GetImpl())->GetListBoxt(); } FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() { - return ((CFWL_ComboBoxImp*)m_pImpl)->AfterFocusShowDropList(); + return static_cast(GetImpl())->AfterFocusShowDropList(); } FX_ERR IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { - return ((CFWL_ComboBoxImp*)m_pImpl)->OpenDropDownList(bActivate); + return static_cast(GetImpl())->OpenDropDownList(bActivate); } FX_BOOL IFWL_ComboBox::EditCanUndo() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditCanUndo(); + return static_cast(GetImpl())->EditCanUndo(); } FX_BOOL IFWL_ComboBox::EditCanRedo() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditCanRedo(); + return static_cast(GetImpl())->EditCanRedo(); } FX_BOOL IFWL_ComboBox::EditUndo() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditUndo(); + return static_cast(GetImpl())->EditUndo(); } FX_BOOL IFWL_ComboBox::EditRedo() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditRedo(); + return static_cast(GetImpl())->EditRedo(); } FX_BOOL IFWL_ComboBox::EditCanCopy() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditCanCopy(); + return static_cast(GetImpl())->EditCanCopy(); } FX_BOOL IFWL_ComboBox::EditCanCut() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditCanCut(); + return static_cast(GetImpl())->EditCanCut(); } FX_BOOL IFWL_ComboBox::EditCanSelectAll() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditCanSelectAll(); + return static_cast(GetImpl())->EditCanSelectAll(); } FX_BOOL IFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditCopy(wsCopy); + return static_cast(GetImpl())->EditCopy(wsCopy); } FX_BOOL IFWL_ComboBox::EditCut(CFX_WideString& wsCut) { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditCut(wsCut); + return static_cast(GetImpl())->EditCut(wsCut); } FX_BOOL IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditPaste(wsPaste); + return static_cast(GetImpl())->EditPaste(wsPaste); } FX_BOOL IFWL_ComboBox::EditSelectAll() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditSelectAll(); + return static_cast(GetImpl())->EditSelectAll(); } FX_BOOL IFWL_ComboBox::EditDelete() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditDelete(); + return static_cast(GetImpl())->EditDelete(); } FX_BOOL IFWL_ComboBox::EditDeSelect() { - return ((CFWL_ComboBoxImp*)m_pImpl)->EditDeSelect(); + return static_cast(GetImpl())->EditDeSelect(); } FWL_ERR IFWL_ComboBox::GetBBox(CFX_RectF& rect) { - return ((CFWL_ComboBoxImp*)m_pImpl)->GetBBox(rect); + return static_cast(GetImpl())->GetBBox(rect); } FWL_ERR IFWL_ComboBox::EditModifyStylesEx(FX_DWORD dwStylesExAdded, FX_DWORD dwStylesExRemoved) { - return ((CFWL_ComboBoxImp*)m_pImpl) + return static_cast(GetImpl()) ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } CFWL_ComboEditImp::CFWL_ComboEditImp(IFWL_Widget* pOuter) diff --git a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp index 27c370dd88..55f86cf770 100644 --- a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp @@ -23,122 +23,126 @@ IFWL_DateTimePicker* IFWL_DateTimePicker::Create() { FWL_ERR IFWL_DateTimeForm::Initialize( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_FormProxyImp(properties, pOuter); - ((CFWL_FormProxyImp*)m_pImpl)->SetInterface(this); - return ((CFWL_FormProxyImp*)m_pImpl)->Initialize(); + CFWL_FormProxyImp* pFormProxyImpl = new CFWL_FormProxyImp(properties, pOuter); + SetImpl(pFormProxyImpl); + pFormProxyImpl->SetInterface(this); + return pFormProxyImpl->Initialize(); } FWL_ERR IFWL_DateTimeCalender::Initialize( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_DateTimeCalendar(properties, pOuter); - ((CFWL_DateTimeCalendar*)m_pImpl)->SetInterface(this); - return ((CFWL_DateTimeCalendar*)m_pImpl)->Initialize(); + CFWL_DateTimeCalendar* pDateTimeCalendarImpl = + new CFWL_DateTimeCalendar(properties, pOuter); + SetImpl(pDateTimeCalendarImpl); + pDateTimeCalendarImpl->SetInterface(this); + return pDateTimeCalendarImpl->Initialize(); } FWL_ERR IFWL_DateTimeEdit::Initialize( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_DateTimeEdit(properties, pOuter); - ((CFWL_DateTimeEdit*)m_pImpl)->SetInterface(this); - return ((CFWL_DateTimeEdit*)m_pImpl)->Initialize(); + CFWL_DateTimeEdit* pDateTimeEditImpl = + new CFWL_DateTimeEdit(properties, pOuter); + SetImpl(pDateTimeEditImpl); + pDateTimeEditImpl->SetInterface(this); + return pDateTimeEditImpl->Initialize(); } IFWL_DateTimePicker::IFWL_DateTimePicker() { - m_pImpl = NULL; -} -IFWL_DateTimePicker::~IFWL_DateTimePicker() { - if (m_pImpl) { - delete (CFWL_DateTimePickerImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_DateTimePicker::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_DateTimePickerImp(pOuter); - ((CFWL_DateTimePickerImp*)m_pImpl)->SetInterface(this); - return ((CFWL_DateTimePickerImp*)m_pImpl)->Initialize(); + CFWL_DateTimePickerImp* pDateTimePickerImpl = + new CFWL_DateTimePickerImp(pOuter); + SetImpl(pDateTimePickerImpl); + pDateTimePickerImpl->SetInterface(this); + return pDateTimePickerImpl->Initialize(); } FWL_ERR IFWL_DateTimePicker::Initialize( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_DateTimePickerImp(properties, pOuter); - ((CFWL_DateTimePickerImp*)m_pImpl)->SetInterface(this); - return ((CFWL_DateTimePickerImp*)m_pImpl)->Initialize(); + CFWL_DateTimePickerImp* pDateTimePickerImpl = + new CFWL_DateTimePickerImp(properties, pOuter); + SetImpl(pDateTimePickerImpl); + pDateTimePickerImpl->SetInterface(this); + return pDateTimePickerImpl->Initialize(); } int32_t IFWL_DateTimePicker::CountSelRanges() { - return ((CFWL_DateTimePickerImp*)m_pImpl) + return static_cast(GetImpl()) ->GetDataTimeEdit() ->CountSelRanges(); } int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { - return ((CFWL_DateTimePickerImp*)m_pImpl) + return static_cast(GetImpl()) ->GetDataTimeEdit() ->GetSelRange(nIndex, nStart); } FWL_ERR IFWL_DateTimePicker::GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay) { - return ((CFWL_DateTimePickerImp*)m_pImpl)->GetCurSel(iYear, iMonth, iDay); + return static_cast(GetImpl()) + ->GetCurSel(iYear, iMonth, iDay); } FWL_ERR IFWL_DateTimePicker::SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay) { - return ((CFWL_DateTimePickerImp*)m_pImpl)->SetCurSel(iYear, iMonth, iDay); + return static_cast(GetImpl()) + ->SetCurSel(iYear, iMonth, iDay); } FWL_ERR IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { - return ((CFWL_DateTimePickerImp*)m_pImpl)->SetEditText(wsText); + return static_cast(GetImpl())->SetEditText(wsText); } FWL_ERR IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, int32_t nStart, int32_t nCount) const { - return ((CFWL_DateTimePickerImp*)m_pImpl) + return static_cast(GetImpl()) ->GetEditText(wsText, nStart, nCount); } FX_BOOL IFWL_DateTimePicker::CanUndo() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->CanUndo(); + return static_cast(GetImpl())->CanUndo(); } FX_BOOL IFWL_DateTimePicker::CanRedo() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->CanRedo(); + return static_cast(GetImpl())->CanRedo(); } FX_BOOL IFWL_DateTimePicker::Undo() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->Undo(); + return static_cast(GetImpl())->Undo(); } FX_BOOL IFWL_DateTimePicker::Redo() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->Redo(); + return static_cast(GetImpl())->Redo(); } FX_BOOL IFWL_DateTimePicker::CanCopy() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->CanCopy(); + return static_cast(GetImpl())->CanCopy(); } FX_BOOL IFWL_DateTimePicker::CanCut() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->CanCut(); + return static_cast(GetImpl())->CanCut(); } FX_BOOL IFWL_DateTimePicker::CanSelectAll() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->CanSelectAll(); + return static_cast(GetImpl())->CanSelectAll(); } FX_BOOL IFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) { - return ((CFWL_DateTimePickerImp*)m_pImpl)->Copy(wsCopy); + return static_cast(GetImpl())->Copy(wsCopy); } FX_BOOL IFWL_DateTimePicker::Cut(CFX_WideString& wsCut) { - return ((CFWL_DateTimePickerImp*)m_pImpl)->Cut(wsCut); + return static_cast(GetImpl())->Cut(wsCut); } FX_BOOL IFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) { - return ((CFWL_DateTimePickerImp*)m_pImpl)->Paste(wsPaste); + return static_cast(GetImpl())->Paste(wsPaste); } FX_BOOL IFWL_DateTimePicker::SelectAll() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->SelectAll(); + return static_cast(GetImpl())->SelectAll(); } FX_BOOL IFWL_DateTimePicker::Delete() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->Delete(); + return static_cast(GetImpl())->Delete(); } FX_BOOL IFWL_DateTimePicker::DeSelect() { - return ((CFWL_DateTimePickerImp*)m_pImpl)->DeSelect(); + return static_cast(GetImpl())->DeSelect(); } FWL_ERR IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { - return ((CFWL_DateTimePickerImp*)m_pImpl)->GetBBox(rect); + return static_cast(GetImpl())->GetBBox(rect); } FWL_ERR IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { - return ((CFWL_DateTimePickerImp*)m_pImpl)->SetEditLimit(nLimit); + return static_cast(GetImpl())->SetEditLimit(nLimit); } FWL_ERR IFWL_DateTimePicker::ModifyEditStylesEx(FX_DWORD dwStylesExAdded, FX_DWORD dwStylesExRemoved) { - return ((CFWL_DateTimePickerImp*)m_pImpl) + return static_cast(GetImpl()) ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); } CFWL_DateTimeEdit::CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp index d70a85aca6..f8f1f59039 100644 --- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp @@ -18,146 +18,145 @@ IFWL_Edit* IFWL_Edit::Create() { return new IFWL_Edit; } IFWL_Edit::IFWL_Edit() { - m_pImpl = NULL; -} -IFWL_Edit::~IFWL_Edit() { - if (m_pImpl) { - delete (CFWL_EditImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_Edit::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_EditImp(pOuter); - ((CFWL_EditImp*)m_pImpl)->SetInterface(this); - return ((CFWL_EditImp*)m_pImpl)->Initialize(); + CFWL_EditImp* pEditImpl = new CFWL_EditImp(pOuter); + SetImpl(pEditImpl); + pEditImpl->SetInterface(this); + return pEditImpl->Initialize(); } FWL_ERR IFWL_Edit::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_EditImp(properties, pOuter); - ((CFWL_EditImp*)m_pImpl)->SetInterface(this); - return ((CFWL_EditImp*)m_pImpl)->Initialize(); + CFWL_EditImp* pEditImpl = new CFWL_EditImp(properties, pOuter); + SetImpl(pEditImpl); + pEditImpl->SetInterface(this); + return pEditImpl->Initialize(); } FWL_ERR IFWL_Edit::SetText(const CFX_WideString& wsText) { - return ((CFWL_EditImp*)m_pImpl)->SetText(wsText); + return static_cast(GetImpl())->SetText(wsText); } int32_t IFWL_Edit::GetTextLength() const { - return ((CFWL_EditImp*)m_pImpl)->GetTextLength(); + return static_cast(GetImpl())->GetTextLength(); } FWL_ERR IFWL_Edit::GetText(CFX_WideString& wsText, int32_t nStart, int32_t nCount) const { - return ((CFWL_EditImp*)m_pImpl)->GetText(wsText, nStart, nCount); + return static_cast(GetImpl())->GetText(wsText, nStart, nCount); } FWL_ERR IFWL_Edit::ClearText() { - return ((CFWL_EditImp*)m_pImpl)->ClearText(); + return static_cast(GetImpl())->ClearText(); } int32_t IFWL_Edit::GetCaretPos() const { - return ((CFWL_EditImp*)m_pImpl)->GetCaretPos(); + return static_cast(GetImpl())->GetCaretPos(); } int32_t IFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { - return ((CFWL_EditImp*)m_pImpl)->SetCaretPos(nIndex, bBefore); + return static_cast(GetImpl())->SetCaretPos(nIndex, bBefore); } FWL_ERR IFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { - return ((CFWL_EditImp*)m_pImpl)->AddSelRange(nStart, nCount); + return static_cast(GetImpl())->AddSelRange(nStart, nCount); } int32_t IFWL_Edit::CountSelRanges() { - return ((CFWL_EditImp*)m_pImpl)->CountSelRanges(); + return static_cast(GetImpl())->CountSelRanges(); } int32_t IFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) { - return ((CFWL_EditImp*)m_pImpl)->GetSelRange(nIndex, nStart); + return static_cast(GetImpl())->GetSelRange(nIndex, nStart); } FWL_ERR IFWL_Edit::ClearSelections() { - return ((CFWL_EditImp*)m_pImpl)->ClearSelections(); + return static_cast(GetImpl())->ClearSelections(); } int32_t IFWL_Edit::GetLimit() { - return ((CFWL_EditImp*)m_pImpl)->GetLimit(); + return static_cast(GetImpl())->GetLimit(); } FWL_ERR IFWL_Edit::SetLimit(int32_t nLimit) { - return ((CFWL_EditImp*)m_pImpl)->SetLimit(nLimit); + return static_cast(GetImpl())->SetLimit(nLimit); } FWL_ERR IFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { - return ((CFWL_EditImp*)m_pImpl)->SetAliasChar(wAlias); + return static_cast(GetImpl())->SetAliasChar(wAlias); } FWL_ERR IFWL_Edit::SetFormatString(const CFX_WideString& wsFormat) { - return ((CFWL_EditImp*)m_pImpl)->SetFormatString(wsFormat); + return static_cast(GetImpl())->SetFormatString(wsFormat); } FWL_ERR IFWL_Edit::Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen) { - return ((CFWL_EditImp*)m_pImpl)->Insert(nStart, lpText, nLen); + return static_cast(GetImpl())->Insert(nStart, lpText, nLen); } FWL_ERR IFWL_Edit::DeleteSelections() { - return ((CFWL_EditImp*)m_pImpl)->DeleteSelections(); + return static_cast(GetImpl())->DeleteSelections(); } FWL_ERR IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { - return ((CFWL_EditImp*)m_pImpl)->DeleteRange(nStart, nCount); + return static_cast(GetImpl())->DeleteRange(nStart, nCount); } FWL_ERR IFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) { - return ((CFWL_EditImp*)m_pImpl)->ReplaceSelections(wsReplace); + return static_cast(GetImpl())->ReplaceSelections(wsReplace); } FWL_ERR IFWL_Edit::Replace(int32_t nStart, int32_t nLen, const CFX_WideStringC& wsReplace) { - return ((CFWL_EditImp*)m_pImpl)->Replace(nStart, nLen, wsReplace); + return static_cast(GetImpl()) + ->Replace(nStart, nLen, wsReplace); } FWL_ERR IFWL_Edit::DoClipboard(int32_t iCmd) { - return ((CFWL_EditImp*)m_pImpl)->DoClipboard(iCmd); + return static_cast(GetImpl())->DoClipboard(iCmd); } FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) { - return ((CFWL_EditImp*)m_pImpl)->Copy(wsCopy); + return static_cast(GetImpl())->Copy(wsCopy); } FX_BOOL IFWL_Edit::Cut(CFX_WideString& wsCut) { - return ((CFWL_EditImp*)m_pImpl)->Cut(wsCut); + return static_cast(GetImpl())->Cut(wsCut); } FX_BOOL IFWL_Edit::Paste(const CFX_WideString& wsPaste) { - return ((CFWL_EditImp*)m_pImpl)->Paste(wsPaste); + return static_cast(GetImpl())->Paste(wsPaste); } FX_BOOL IFWL_Edit::Delete() { - return ((CFWL_EditImp*)m_pImpl)->Delete(); + return static_cast(GetImpl())->Delete(); } FX_BOOL IFWL_Edit::Redo(const CFX_ByteStringC& bsRecord) { - return ((CFWL_EditImp*)m_pImpl)->Redo(bsRecord); + return static_cast(GetImpl())->Redo(bsRecord); } FX_BOOL IFWL_Edit::Undo(const CFX_ByteStringC& bsRecord) { - return ((CFWL_EditImp*)m_pImpl)->Undo(bsRecord); + return static_cast(GetImpl())->Undo(bsRecord); } FX_BOOL IFWL_Edit::Undo() { - return ((CFWL_EditImp*)m_pImpl)->Undo(); + return static_cast(GetImpl())->Undo(); } FX_BOOL IFWL_Edit::Redo() { - return ((CFWL_EditImp*)m_pImpl)->Redo(); + return static_cast(GetImpl())->Redo(); } FX_BOOL IFWL_Edit::CanUndo() { - return ((CFWL_EditImp*)m_pImpl)->CanUndo(); + return static_cast(GetImpl())->CanUndo(); } FX_BOOL IFWL_Edit::CanRedo() { - return ((CFWL_EditImp*)m_pImpl)->CanRedo(); + return static_cast(GetImpl())->CanRedo(); } FWL_ERR IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { - return ((CFWL_EditImp*)m_pImpl)->SetTabWidth(fTabWidth, bEquidistant); + return static_cast(GetImpl()) + ->SetTabWidth(fTabWidth, bEquidistant); } FWL_ERR IFWL_Edit::SetOuter(IFWL_Widget* pOuter) { - return ((CFWL_EditImp*)m_pImpl)->SetOuter(pOuter); + return static_cast(GetImpl())->SetOuter(pOuter); } FWL_ERR IFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { - return ((CFWL_EditImp*)m_pImpl)->SetNumberRange(iMin, iMax); + return static_cast(GetImpl())->SetNumberRange(iMin, iMax); } FWL_ERR IFWL_Edit::SetBackColor(FX_DWORD dwColor) { - return ((CFWL_EditImp*)m_pImpl)->SetBackgroundColor(dwColor); + return static_cast(GetImpl())->SetBackgroundColor(dwColor); } FWL_ERR IFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { - return ((CFWL_EditImp*)m_pImpl)->SetFont(wsFont, fSize); + return static_cast(GetImpl())->SetFont(wsFont, fSize); } void IFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { - return ((CFWL_EditImp*)m_pImpl)->SetScrollOffset(fScrollOffset); + return static_cast(GetImpl())->SetScrollOffset(fScrollOffset); } FX_BOOL IFWL_Edit::GetSuggestWords(CFX_PointF pointf, CFX_ByteStringArray& sSuggest) { - return ((CFWL_EditImp*)m_pImpl)->GetSuggestWords(pointf, sSuggest); + return static_cast(GetImpl()) + ->GetSuggestWords(pointf, sSuggest); } FX_BOOL IFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf, const CFX_ByteStringC& bsReplace) { - return ((CFWL_EditImp*)m_pImpl)->ReplaceSpellCheckWord(pointf, bsReplace); + return static_cast(GetImpl()) + ->ReplaceSpellCheckWord(pointf, bsReplace); } #define FWL_EDIT_Margin 3 CFWL_EditImp::CFWL_EditImp(IFWL_Widget* pOuter) diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp index 09ef4cd0ae..0b96555b03 100644 --- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp @@ -15,45 +15,40 @@ IFWL_ListBox* IFWL_ListBox::Create() { return new IFWL_ListBox; } IFWL_ListBox::IFWL_ListBox() { - m_pImpl = NULL; -} -IFWL_ListBox::~IFWL_ListBox() { - if (m_pImpl) { - delete (CFWL_ListBoxImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_ListBox::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_ListBoxImp(pOuter); - ((CFWL_ListBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ListBoxImp*)m_pImpl)->Initialize(); + CFWL_ListBoxImp* pListBoxImpl = new CFWL_ListBoxImp(pOuter); + SetImpl(pListBoxImpl); + pListBoxImpl->SetInterface(this); + return pListBoxImpl->Initialize(); } FWL_ERR IFWL_ListBox::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_ListBoxImp(properties, pOuter); - ((CFWL_ListBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ListBoxImp*)m_pImpl)->Initialize(); + CFWL_ListBoxImp* pListBoxImpl = new CFWL_ListBoxImp(properties, pOuter); + SetImpl(pListBoxImpl); + pListBoxImpl->SetInterface(this); + return pListBoxImpl->Initialize(); } int32_t IFWL_ListBox::CountSelItems() { - return ((CFWL_ListBoxImp*)m_pImpl)->CountSelItems(); + return static_cast(GetImpl())->CountSelItems(); } FWL_HLISTITEM IFWL_ListBox::GetSelItem(int32_t nIndexSel) { - return ((CFWL_ListBoxImp*)m_pImpl)->GetSelItem(nIndexSel); + return static_cast(GetImpl())->GetSelItem(nIndexSel); } int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) { - return ((CFWL_ListBoxImp*)m_pImpl)->GetSelIndex(nIndex); + return static_cast(GetImpl())->GetSelIndex(nIndex); } FWL_ERR IFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { - return ((CFWL_ListBoxImp*)m_pImpl)->SetSelItem(hItem, bSelect); + return static_cast(GetImpl())->SetSelItem(hItem, bSelect); } FWL_ERR IFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) { - return ((CFWL_ListBoxImp*)m_pImpl)->GetItemText(hItem, wsText); + return static_cast(GetImpl())->GetItemText(hItem, wsText); } FWL_ERR IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { - return ((CFWL_ListBoxImp*)m_pImpl)->GetScrollPos(fPos, bVert); + return static_cast(GetImpl())->GetScrollPos(fPos, bVert); } FWL_ERR* IFWL_ListBox::Sort(IFWL_ListBoxCompare* pCom) { - return ((CFWL_ListBoxImp*)m_pImpl)->Sort(pCom); + return static_cast(GetImpl())->Sort(pCom); } CFWL_ListBoxImp::CFWL_ListBoxImp(IFWL_Widget* pOuter) : CFWL_WidgetImp(pOuter), diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp index 6928349106..730c244fe1 100644 --- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp @@ -21,40 +21,37 @@ IFWL_MonthCalendar* IFWL_MonthCalendar::Create() { return new IFWL_MonthCalendar; } IFWL_MonthCalendar::IFWL_MonthCalendar() { - m_pImpl = NULL; -} -IFWL_MonthCalendar::~IFWL_MonthCalendar() { - if (m_pImpl) { - delete (CFWL_MonthCalendarImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_MonthCalendar::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_MonthCalendarImp(pOuter); - ((CFWL_MonthCalendarImp*)m_pImpl)->SetInterface(this); - return ((CFWL_MonthCalendarImp*)m_pImpl)->Initialize(); + CFWL_MonthCalendarImp* pMonthCalendarImpl = new CFWL_MonthCalendarImp(pOuter); + SetImpl(pMonthCalendarImpl); + pMonthCalendarImpl->SetInterface(this); + return pMonthCalendarImpl->Initialize(); } FWL_ERR IFWL_MonthCalendar::Initialize( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_MonthCalendarImp(properties, pOuter); - ((CFWL_MonthCalendarImp*)m_pImpl)->SetInterface(this); - return ((CFWL_MonthCalendarImp*)m_pImpl)->Initialize(); + CFWL_MonthCalendarImp* pMonthCalendarImpl = + new CFWL_MonthCalendarImp(properties, pOuter); + SetImpl(pMonthCalendarImpl); + pMonthCalendarImpl->SetInterface(this); + return pMonthCalendarImpl->Initialize(); } int32_t IFWL_MonthCalendar::CountSelect() { - return ((CFWL_MonthCalendarImp*)m_pImpl)->CountSelect(); + return static_cast(GetImpl())->CountSelect(); } FX_BOOL IFWL_MonthCalendar::GetSelect(int32_t& iYear, int32_t& iMonth, int32_t& iDay, int32_t nIndex) { - return ((CFWL_MonthCalendarImp*)m_pImpl) + return static_cast(GetImpl()) ->GetSelect(iYear, iMonth, iDay, nIndex); } FX_BOOL IFWL_MonthCalendar::SetSelect(int32_t iYear, int32_t iMonth, int32_t iDay) { - return ((CFWL_MonthCalendarImp*)m_pImpl)->SetSelect(iYear, iMonth, iDay); + return static_cast(GetImpl()) + ->SetSelect(iYear, iMonth, iDay); } CFWL_MonthCalendarImp::CFWL_MonthCalendarImp(IFWL_Widget* pOuter) : CFWL_WidgetImp(pOuter), diff --git a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp index f8cfa107ea..c1b8d3e07d 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp @@ -13,24 +13,20 @@ IFWL_PictureBox* IFWL_PictureBox::Create() { return new IFWL_PictureBox; } IFWL_PictureBox::IFWL_PictureBox() { - m_pImpl = NULL; -} -IFWL_PictureBox::~IFWL_PictureBox() { - if (m_pImpl) { - delete (CFWL_PictureBoxImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_PictureBox::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_PictureBoxImp(pOuter); - ((CFWL_PictureBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_PictureBoxImp*)m_pImpl)->Initialize(); + CFWL_PictureBoxImp* pPictureBoxImpl = new CFWL_PictureBoxImp(pOuter); + SetImpl(pPictureBoxImpl); + pPictureBoxImpl->SetInterface(this); + return pPictureBoxImpl->Initialize(); } FWL_ERR IFWL_PictureBox::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_PictureBoxImp(properties, pOuter); - ((CFWL_PictureBoxImp*)m_pImpl)->SetInterface(this); - return ((CFWL_PictureBoxImp*)m_pImpl)->Initialize(); + CFWL_PictureBoxImp* pPictureBoxImpl = + new CFWL_PictureBoxImp(properties, pOuter); + SetImpl(pPictureBoxImpl); + pPictureBoxImpl->SetInterface(this); + return pPictureBoxImpl->Initialize(); } CFWL_PictureBoxImp::CFWL_PictureBoxImp(IFWL_Widget* pOuter) : CFWL_WidgetImp(pOuter), diff --git a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp index 6ae0a334c3..c8f986d4f8 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp @@ -13,24 +13,20 @@ IFWL_PushButton* IFWL_PushButton::Create() { return new IFWL_PushButton; } FWL_ERR IFWL_PushButton::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_PushButtonImp(pOuter); - ((CFWL_PushButtonImp*)m_pImpl)->SetInterface(this); - return ((CFWL_PushButtonImp*)m_pImpl)->Initialize(); + CFWL_PushButtonImp* pPushButtonImpl = new CFWL_PushButtonImp(pOuter); + SetImpl(pPushButtonImpl); + pPushButtonImpl->SetInterface(this); + return pPushButtonImpl->Initialize(); } FWL_ERR IFWL_PushButton::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_PushButtonImp(properties, pOuter); - ((CFWL_PushButtonImp*)m_pImpl)->SetInterface(this); - return ((CFWL_PushButtonImp*)m_pImpl)->Initialize(); + CFWL_PushButtonImp* pPushButtonImpl = + new CFWL_PushButtonImp(properties, pOuter); + SetImpl(pPushButtonImpl); + pPushButtonImpl->SetInterface(this); + return pPushButtonImpl->Initialize(); } IFWL_PushButton::IFWL_PushButton() { - m_pImpl = NULL; -} -IFWL_PushButton::~IFWL_PushButton() { - if (m_pImpl) { - delete (CFWL_PushButtonImp*)m_pImpl; - m_pImpl = NULL; - } } CFWL_PushButtonImp::CFWL_PushButtonImp(IFWL_Widget* pOuter) : CFWL_WidgetImp(pOuter), diff --git a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp index 02eae32fc0..a3fc2b17e0 100644 --- a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp @@ -15,60 +15,55 @@ IFWL_ScrollBar* IFWL_ScrollBar::Create() { return new IFWL_ScrollBar; } IFWL_ScrollBar::IFWL_ScrollBar() { - m_pImpl = NULL; -} -IFWL_ScrollBar::~IFWL_ScrollBar() { - if (m_pImpl) { - delete (CFWL_ScrollBarImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_ScrollBar::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_ScrollBarImp(pOuter); - ((CFWL_ScrollBarImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ScrollBarImp*)m_pImpl)->Initialize(); + CFWL_ScrollBarImp* pScrollBarImpl = new CFWL_ScrollBarImp(pOuter); + SetImpl(pScrollBarImpl); + pScrollBarImpl->SetInterface(this); + return pScrollBarImpl->Initialize(); } FWL_ERR IFWL_ScrollBar::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_ScrollBarImp(properties, pOuter); - ((CFWL_ScrollBarImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ScrollBarImp*)m_pImpl)->Initialize(); + CFWL_ScrollBarImp* pScrollBarImpl = new CFWL_ScrollBarImp(properties, pOuter); + SetImpl(pScrollBarImpl); + pScrollBarImpl->SetInterface(this); + return pScrollBarImpl->Initialize(); } FX_BOOL IFWL_ScrollBar::IsVertical() { - return ((CFWL_ScrollBarImp*)m_pImpl)->IsVertical(); + return static_cast(GetImpl())->IsVertical(); } FWL_ERR IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { - return ((CFWL_ScrollBarImp*)m_pImpl)->GetRange(fMin, fMax); + return static_cast(GetImpl())->GetRange(fMin, fMax); } FWL_ERR IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { - return ((CFWL_ScrollBarImp*)m_pImpl)->SetRange(fMin, fMax); + return static_cast(GetImpl())->SetRange(fMin, fMax); } FX_FLOAT IFWL_ScrollBar::GetPageSize() { - return ((CFWL_ScrollBarImp*)m_pImpl)->GetPageSize(); + return static_cast(GetImpl())->GetPageSize(); } FWL_ERR IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { - return ((CFWL_ScrollBarImp*)m_pImpl)->SetPageSize(fPageSize); + return static_cast(GetImpl())->SetPageSize(fPageSize); } FX_FLOAT IFWL_ScrollBar::GetStepSize() { - return ((CFWL_ScrollBarImp*)m_pImpl)->GetStepSize(); + return static_cast(GetImpl())->GetStepSize(); } FWL_ERR IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { - return ((CFWL_ScrollBarImp*)m_pImpl)->SetStepSize(fStepSize); + return static_cast(GetImpl())->SetStepSize(fStepSize); } FX_FLOAT IFWL_ScrollBar::GetPos() { - return ((CFWL_ScrollBarImp*)m_pImpl)->GetPos(); + return static_cast(GetImpl())->GetPos(); } FWL_ERR IFWL_ScrollBar::SetPos(FX_FLOAT fPos) { - return ((CFWL_ScrollBarImp*)m_pImpl)->SetPos(fPos); + return static_cast(GetImpl())->SetPos(fPos); } FX_FLOAT IFWL_ScrollBar::GetTrackPos() { - return ((CFWL_ScrollBarImp*)m_pImpl)->GetTrackPos(); + return static_cast(GetImpl())->GetTrackPos(); } FWL_ERR IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { - return ((CFWL_ScrollBarImp*)m_pImpl)->SetTrackPos(fTrackPos); + return static_cast(GetImpl())->SetTrackPos(fTrackPos); } FX_BOOL IFWL_ScrollBar::DoScroll(FX_DWORD dwCode, FX_FLOAT fPos) { - return ((CFWL_ScrollBarImp*)m_pImpl)->DoScroll(dwCode, fPos); + return static_cast(GetImpl())->DoScroll(dwCode, fPos); } CFWL_ScrollBarImp::CFWL_ScrollBarImp(IFWL_Widget* pOuter) : CFWL_WidgetImp(pOuter), diff --git a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp index 60614e79f9..382118fd43 100644 --- a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp @@ -16,30 +16,26 @@ IFWL_SpinButton* IFWL_SpinButton::Create() { return new IFWL_SpinButton; } IFWL_SpinButton::IFWL_SpinButton() { - m_pImpl = NULL; -} -IFWL_SpinButton::~IFWL_SpinButton() { - if (m_pImpl) { - delete (CFWL_SpinButtonImp*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_SpinButton::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_SpinButtonImp; - ((CFWL_SpinButtonImp*)m_pImpl)->SetInterface(this); - return ((CFWL_SpinButtonImp*)m_pImpl)->Initialize(); + CFWL_SpinButtonImp* pSpinButtonImpl = new CFWL_SpinButtonImp; + SetImpl(pSpinButtonImpl); + pSpinButtonImpl->SetInterface(this); + return pSpinButtonImpl->Initialize(); } FWL_ERR IFWL_SpinButton::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_SpinButtonImp(properties); - ((CFWL_SpinButtonImp*)m_pImpl)->SetInterface(this); - return ((CFWL_SpinButtonImp*)m_pImpl)->Initialize(); + CFWL_SpinButtonImp* pSpinButtonImpl = new CFWL_SpinButtonImp(properties); + SetImpl(pSpinButtonImpl); + pSpinButtonImpl->SetInterface(this); + return pSpinButtonImpl->Initialize(); } FWL_ERR IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { - return ((CFWL_SpinButtonImp*)m_pImpl)->EnableButton(bEnable, bUp); + return static_cast(GetImpl()) + ->EnableButton(bEnable, bUp); } FX_BOOL IFWL_SpinButton::IsButtonEnable(FX_BOOL bUp) { - return ((CFWL_SpinButtonImp*)m_pImpl)->IsButtonEnable(bUp); + return static_cast(GetImpl())->IsButtonEnable(bUp); } CFWL_SpinButtonImp::CFWL_SpinButtonImp(IFWL_Widget* pOuter) : CFWL_WidgetImp(pOuter), diff --git a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp index 6c680f9059..f9ae30fe7d 100644 --- a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp @@ -15,33 +15,28 @@ IFWL_ToolTip* IFWL_ToolTip::Create() { return new IFWL_ToolTip; } FWL_ERR IFWL_ToolTip::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_ToolTipImp(pOuter); - ((CFWL_ToolTipImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ToolTipImp*)m_pImpl)->Initialize(); + CFWL_ToolTipImp* pToolTipImpl = new CFWL_ToolTipImp(pOuter); + SetImpl(pToolTipImpl); + pToolTipImpl->SetInterface(this); + return pToolTipImpl->Initialize(); } FWL_ERR IFWL_ToolTip::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_ToolTipImp(properties, pOuter); - ((CFWL_ToolTipImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ToolTipImp*)m_pImpl)->Initialize(); + CFWL_ToolTipImp* pToolTipImpl = new CFWL_ToolTipImp(properties, pOuter); + SetImpl(pToolTipImpl); + pToolTipImpl->SetInterface(this); + return pToolTipImpl->Initialize(); } FWL_ERR IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { - return ((CFWL_ToolTipImp*)m_pImpl)->SetAnchor(rtAnchor); + return static_cast(GetImpl())->SetAnchor(rtAnchor); } FWL_ERR IFWL_ToolTip::Show() { - return ((CFWL_ToolTipImp*)m_pImpl)->Show(); + return static_cast(GetImpl())->Show(); } FWL_ERR IFWL_ToolTip::Hide() { - return ((CFWL_ToolTipImp*)m_pImpl)->Hide(); + return static_cast(GetImpl())->Hide(); } IFWL_ToolTip::IFWL_ToolTip() { - m_pImpl = NULL; -} -IFWL_ToolTip::~IFWL_ToolTip() { - if (m_pImpl) { - delete (CFWL_ToolTipImp*)m_pImpl; - m_pImpl = NULL; - } } CFWL_ToolTipImp::CFWL_ToolTipImp(IFWL_Widget* pOuter) : CFWL_FormImp(pOuter), diff --git a/xfa/src/fwl/src/core/fwl_contentimp.cpp b/xfa/src/fwl/src/core/fwl_contentimp.cpp index 2fcfbb89de..97d736e087 100644 --- a/xfa/src/fwl/src/core/fwl_contentimp.cpp +++ b/xfa/src/fwl/src/core/fwl_contentimp.cpp @@ -15,39 +15,33 @@ IFWL_Content* IFWL_Content::Create() { return new IFWL_Content; } FWL_ERR IFWL_Content::Initialize() { - m_pImpl = new CFWL_ContentImp; - ((CFWL_ContentImp*)m_pImpl)->SetInterface(this); - return ((CFWL_ContentImp*)m_pImpl)->Initialize(); + CFWL_ContentImp* pContentImpl = new CFWL_ContentImp; + SetImpl(pContentImpl); + pContentImpl->SetInterface(this); + return pContentImpl->Initialize(); } FWL_ERR IFWL_Content::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) { - return ((CFWL_ContentImp*)m_pImpl)->InsertWidget(pChild, nIndex); + return static_cast(GetImpl())->InsertWidget(pChild, nIndex); } FWL_ERR IFWL_Content::RemoveWidget(IFWL_Widget* pWidget) { - return ((CFWL_ContentImp*)m_pImpl)->RemoveWidget(pWidget); + return static_cast(GetImpl())->RemoveWidget(pWidget); } FWL_ERR IFWL_Content::RemoveAllWidgets() { - return ((CFWL_ContentImp*)m_pImpl)->RemoveAllWidgets(); + return static_cast(GetImpl())->RemoveAllWidgets(); } FWL_ERR IFWL_Content::GetMinSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { - return ((CFWL_ContentImp*)m_pImpl)->GetMinSize(fWidth, fHeight); + return static_cast(GetImpl())->GetMinSize(fWidth, fHeight); } FWL_ERR IFWL_Content::SetMinSize(FX_FLOAT fWidth, FX_FLOAT fHeight) { - return ((CFWL_ContentImp*)m_pImpl)->SetMinSize(fWidth, fHeight); + return static_cast(GetImpl())->SetMinSize(fWidth, fHeight); } FWL_ERR IFWL_Content::GetMaxSize(FX_FLOAT& fWidth, FX_FLOAT& fHeight) { - return ((CFWL_ContentImp*)m_pImpl)->GetMaxSize(fWidth, fHeight); + return static_cast(GetImpl())->GetMaxSize(fWidth, fHeight); } FWL_ERR IFWL_Content::SetMaxSize(FX_FLOAT fWidth, FX_FLOAT fHeight) { - return ((CFWL_ContentImp*)m_pImpl)->SetMaxSize(fWidth, fHeight); + return static_cast(GetImpl())->SetMaxSize(fWidth, fHeight); } IFWL_Content::IFWL_Content() { - m_pImpl = NULL; -} -IFWL_Content::~IFWL_Content() { - if (m_pImpl) { - delete (CFWL_ContentImp*)m_pImpl; - m_pImpl = NULL; - } } CFWL_ContentImp::CFWL_ContentImp() { m_fWidthMin = 0; diff --git a/xfa/src/fwl/src/core/fwl_formimp.cpp b/xfa/src/fwl/src/core/fwl_formimp.cpp index 6dbd03dab3..2e215c4080 100644 --- a/xfa/src/fwl/src/core/fwl_formimp.cpp +++ b/xfa/src/fwl/src/core/fwl_formimp.cpp @@ -21,50 +21,46 @@ IFWL_Form* IFWL_Form::Create() { return new IFWL_Form; } FWL_ERR IFWL_Form::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_FormImp(pOuter); - ((CFWL_FormImp*)m_pImpl)->SetInterface(this); - return ((CFWL_FormImp*)m_pImpl)->Initialize(); + CFWL_FormImp* pFormImpl = new CFWL_FormImp(pOuter); + SetImpl(pFormImpl); + pFormImpl->SetInterface(this); + return pFormImpl->Initialize(); } FWL_ERR IFWL_Form::Initialize(CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_FormImp(properties, pOuter); - ((CFWL_FormImp*)m_pImpl)->SetInterface(this); - return ((CFWL_FormImp*)m_pImpl)->Initialize(); + CFWL_FormImp* pFormImpl = new CFWL_FormImp(properties, pOuter); + SetImpl(pFormImpl); + pFormImpl->SetInterface(this); + return pFormImpl->Initialize(); } FWL_ERR IFWL_Form::Initialize(CFWL_WidgetImpProperties& properties, CFX_WideString* classname, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_FormImp(properties, pOuter); - ((CFWL_FormImp*)m_pImpl)->SetInterface(this); - ((CFWL_FormImp*)m_pImpl)->SetPrivateData(this, classname, NULL); - return ((CFWL_FormImp*)m_pImpl)->Initialize(); + CFWL_FormImp* pFormImpl = new CFWL_FormImp(properties, pOuter); + SetImpl(pFormImpl); + pFormImpl->SetInterface(this); + pFormImpl->SetPrivateData(this, classname, NULL); + return pFormImpl->Initialize(); } FWL_FORMSIZE IFWL_Form::GetFormSize() { - return ((CFWL_FormImp*)m_pImpl)->GetFormSize(); + return static_cast(GetImpl())->GetFormSize(); } FWL_ERR IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { - return ((CFWL_FormImp*)m_pImpl)->SetFormSize(eFormSize); + return static_cast(GetImpl())->SetFormSize(eFormSize); } IFWL_Widget* IFWL_Form::DoModal() { - return ((CFWL_FormImp*)m_pImpl)->DoModal(); + return static_cast(GetImpl())->DoModal(); } IFWL_Widget* IFWL_Form::DoModal(FX_DWORD& dwCommandID) { - return ((CFWL_FormImp*)m_pImpl)->DoModal(dwCommandID); + return static_cast(GetImpl())->DoModal(dwCommandID); } FWL_ERR IFWL_Form::EndDoModal() { - return ((CFWL_FormImp*)m_pImpl)->EndDoModal(); + return static_cast(GetImpl())->EndDoModal(); } FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { - return ((CFWL_FormImp*)m_pImpl)->SetBorderRegion(pPath); + return static_cast(GetImpl())->SetBorderRegion(pPath); } IFWL_Form::IFWL_Form() { - m_pImpl = NULL; -} -IFWL_Form::~IFWL_Form() { - if (m_pImpl) { - delete (CFWL_FormImp*)m_pImpl; - m_pImpl = NULL; - } } CFWL_FormImp::CFWL_FormImp(IFWL_Widget* pOuter) : CFWL_PanelImp(pOuter), diff --git a/xfa/src/fwl/src/core/fwl_gridimp.cpp b/xfa/src/fwl/src/core/fwl_gridimp.cpp index 95dbfe5219..433deabbb1 100644 --- a/xfa/src/fwl/src/core/fwl_gridimp.cpp +++ b/xfa/src/fwl/src/core/fwl_gridimp.cpp @@ -15,114 +15,118 @@ IFWL_Grid* IFWL_Grid::Create() { return new IFWL_Grid; } FWL_ERR IFWL_Grid::Initialize() { - m_pImpl = new CFWL_GridImp; - ((CFWL_GridImp*)m_pImpl)->SetInterface(this); - return ((CFWL_GridImp*)m_pImpl)->Initialize(); + CFWL_GridImp* pGridImpl = new CFWL_GridImp; + SetImpl(pGridImpl); + pGridImpl->SetInterface(this); + return pGridImpl->Initialize(); } FWL_ERR IFWL_Grid::Initialize(CFWL_WidgetImpProperties& properties) { - m_pImpl = new CFWL_GridImp(properties); - ((CFWL_GridImp*)m_pImpl)->SetInterface(this); - return ((CFWL_GridImp*)m_pImpl)->Initialize(); + CFWL_GridImp* pGridImpl = new CFWL_GridImp(properties); + SetImpl(pGridImpl); + pGridImpl->SetInterface(this); + return pGridImpl->Initialize(); } FWL_HGRIDCOLROW IFWL_Grid::InsertColRow(FX_BOOL bColumn, int32_t nIndex) { - return ((CFWL_GridImp*)m_pImpl)->InsertColRow(bColumn, nIndex); + return static_cast(GetImpl())->InsertColRow(bColumn, nIndex); } int32_t IFWL_Grid::CountColRows(FX_BOOL bColumn) { - return ((CFWL_GridImp*)m_pImpl)->CountColRows(bColumn); + return static_cast(GetImpl())->CountColRows(bColumn); } FWL_HGRIDCOLROW IFWL_Grid::GetColRow(FX_BOOL bColumn, int32_t nIndex) { - return ((CFWL_GridImp*)m_pImpl)->GetColRow(bColumn, nIndex); + return static_cast(GetImpl())->GetColRow(bColumn, nIndex); } int32_t IFWL_Grid::GetIndex(FWL_HGRIDCOLROW hColRow) { - return ((CFWL_GridImp*)m_pImpl)->GetIndex(hColRow); + return static_cast(GetImpl())->GetIndex(hColRow); } FX_FLOAT IFWL_Grid::GetSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit) { - return ((CFWL_GridImp*)m_pImpl)->GetSize(hColRow, eUnit); + return static_cast(GetImpl())->GetSize(hColRow, eUnit); } FWL_ERR IFWL_Grid::SetSize(FWL_HGRIDCOLROW hColRow, FX_FLOAT fSize, FWL_GRIDUNIT eUnit) { - return ((CFWL_GridImp*)m_pImpl)->SetSize(hColRow, fSize, eUnit); + return static_cast(GetImpl())->SetSize(hColRow, fSize, eUnit); } FX_FLOAT IFWL_Grid::GetMinSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit) { - return ((CFWL_GridImp*)m_pImpl)->GetMinSize(hColRow, eUnit); + return static_cast(GetImpl())->GetMinSize(hColRow, eUnit); } FWL_ERR IFWL_Grid::SetMinSize(FWL_HGRIDCOLROW hColRow, FX_FLOAT fSize, FWL_GRIDUNIT eUnit) { - return ((CFWL_GridImp*)m_pImpl)->SetMinSize(hColRow, fSize, eUnit); + return static_cast(GetImpl()) + ->SetMinSize(hColRow, fSize, eUnit); } FX_FLOAT IFWL_Grid::GetMaxSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit) { - return ((CFWL_GridImp*)m_pImpl)->GetMaxSize(hColRow, eUnit); + return static_cast(GetImpl())->GetMaxSize(hColRow, eUnit); } FWL_ERR IFWL_Grid::SetMaxSize(FWL_HGRIDCOLROW hColRow, FX_FLOAT fSize, FWL_GRIDUNIT eUnit) { - return ((CFWL_GridImp*)m_pImpl)->SetMaxSize(hColRow, fSize, eUnit); + return static_cast(GetImpl()) + ->SetMaxSize(hColRow, fSize, eUnit); } FX_BOOL IFWL_Grid::DeleteColRow(FWL_HGRIDCOLROW hColRow) { - return ((CFWL_GridImp*)m_pImpl)->DeleteColRow(hColRow); + return static_cast(GetImpl())->DeleteColRow(hColRow); } FX_BOOL IFWL_Grid::IsColumn(FWL_HGRIDCOLROW hColRow) { - return ((CFWL_GridImp*)m_pImpl)->IsColumn(hColRow); + return static_cast(GetImpl())->IsColumn(hColRow); } int32_t IFWL_Grid::GetWidgetPos(IFWL_Widget* pWidget, FX_BOOL bColumn) { - return ((CFWL_GridImp*)m_pImpl)->GetWidgetPos(pWidget, bColumn); + return static_cast(GetImpl())->GetWidgetPos(pWidget, bColumn); } FWL_ERR IFWL_Grid::SetWidgetPos(IFWL_Widget* pWidget, int32_t iPos, FX_BOOL bColumn) { - return ((CFWL_GridImp*)m_pImpl)->SetWidgetPos(pWidget, iPos, bColumn); + return static_cast(GetImpl()) + ->SetWidgetPos(pWidget, iPos, bColumn); } int32_t IFWL_Grid::GetWidgetSpan(IFWL_Widget* pWidget, FX_BOOL bColumn) { - return ((CFWL_GridImp*)m_pImpl)->GetWidgetSpan(pWidget, bColumn); + return static_cast(GetImpl())->GetWidgetSpan(pWidget, bColumn); } FWL_ERR IFWL_Grid::SetWidgetSpan(IFWL_Widget* pWidget, int32_t iSpan, FX_BOOL bColumn) { - return ((CFWL_GridImp*)m_pImpl)->SetWidgetSpan(pWidget, iSpan, bColumn); + return static_cast(GetImpl()) + ->SetWidgetSpan(pWidget, iSpan, bColumn); } FX_FLOAT IFWL_Grid::GetWidgetSize(IFWL_Widget* pWidget, FWL_GRIDSIZE eSize, FWL_GRIDUNIT& eUnit) { - return ((CFWL_GridImp*)m_pImpl)->GetWidgetSize(pWidget, eSize, eUnit); + return static_cast(GetImpl()) + ->GetWidgetSize(pWidget, eSize, eUnit); } FWL_ERR IFWL_Grid::SetWidgetSize(IFWL_Widget* pWidget, FWL_GRIDSIZE eSize, FX_FLOAT fSize, FWL_GRIDUNIT eUit) { - return ((CFWL_GridImp*)m_pImpl)->SetWidgetSize(pWidget, eSize, fSize, eUit); + return static_cast(GetImpl()) + ->SetWidgetSize(pWidget, eSize, fSize, eUit); } FX_BOOL IFWL_Grid::GetWidgetMargin(IFWL_Widget* pWidget, FWL_GRIDMARGIN eMargin, FX_FLOAT& fMargin) { - return ((CFWL_GridImp*)m_pImpl)->GetWidgetMargin(pWidget, eMargin, fMargin); + return static_cast(GetImpl()) + ->GetWidgetMargin(pWidget, eMargin, fMargin); } FWL_ERR IFWL_Grid::SetWidgetMargin(IFWL_Widget* pWidget, FWL_GRIDMARGIN eMargin, FX_FLOAT fMargin) { - return ((CFWL_GridImp*)m_pImpl)->SetWidgetMargin(pWidget, eMargin, fMargin); + return static_cast(GetImpl()) + ->SetWidgetMargin(pWidget, eMargin, fMargin); } FWL_ERR IFWL_Grid::RemoveWidgetMargin(IFWL_Widget* pWidget, FWL_GRIDMARGIN eMargin) { - return ((CFWL_GridImp*)m_pImpl)->RemoveWidgetMargin(pWidget, eMargin); + return static_cast(GetImpl()) + ->RemoveWidgetMargin(pWidget, eMargin); } FX_FLOAT IFWL_Grid::GetGridSize(FWL_GRIDSIZE eSize, FWL_GRIDUNIT& eUnit) { - return ((CFWL_GridImp*)m_pImpl)->GetGridSize(eSize, eUnit); + return static_cast(GetImpl())->GetGridSize(eSize, eUnit); } FWL_ERR IFWL_Grid::SetGridSize(FWL_GRIDSIZE eSize, FX_FLOAT fSize, FWL_GRIDUNIT eUit) { - return ((CFWL_GridImp*)m_pImpl)->SetGridSize(eSize, fSize, eUit); + return static_cast(GetImpl())->SetGridSize(eSize, fSize, eUit); } IFWL_Grid::IFWL_Grid() { - m_pImpl = NULL; -} -IFWL_Grid::~IFWL_Grid() { - if (m_pImpl) { - delete (CFWL_GridImp*)m_pImpl; - m_pImpl = NULL; - } } CFWL_GridImp::CFWL_GridImp() { m_Size[FWL_GRIDSIZE_Width].eUnit = FWL_GRIDUNIT_Auto; diff --git a/xfa/src/fwl/src/core/fwl_panelimp.cpp b/xfa/src/fwl/src/core/fwl_panelimp.cpp index aef3521c5f..e127ff6096 100644 --- a/xfa/src/fwl/src/core/fwl_panelimp.cpp +++ b/xfa/src/fwl/src/core/fwl_panelimp.cpp @@ -13,30 +13,25 @@ IFWL_Panel* IFWL_Panel::Create() { return new IFWL_Panel; } FWL_ERR IFWL_Panel::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_PanelImp(pOuter); - ((CFWL_PanelImp*)m_pImpl)->SetInterface(this); - return ((CFWL_PanelImp*)m_pImpl)->Initialize(); + CFWL_PanelImp* pPanelImpl = new CFWL_PanelImp(pOuter); + SetImpl(pPanelImpl); + pPanelImpl->SetInterface(this); + return pPanelImpl->Initialize(); } FWL_ERR IFWL_Panel::Initialize(CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_PanelImp(properties, pOuter); - ((CFWL_PanelImp*)m_pImpl)->SetInterface(this); - return ((CFWL_PanelImp*)m_pImpl)->Initialize(); + CFWL_PanelImp* pPanelImpl = new CFWL_PanelImp(properties, pOuter); + SetImpl(pPanelImpl); + pPanelImpl->SetInterface(this); + return pPanelImpl->Initialize(); } IFWL_Content* IFWL_Panel::GetContent() { - return ((CFWL_PanelImp*)m_pImpl)->GetContent(); + return static_cast(GetImpl())->GetContent(); } FWL_ERR IFWL_Panel::SetContent(IFWL_Content* pContent) { - return ((CFWL_PanelImp*)m_pImpl)->SetContent(pContent); + return static_cast(GetImpl())->SetContent(pContent); } IFWL_Panel::IFWL_Panel() { - m_pImpl = NULL; -} -IFWL_Panel::~IFWL_Panel() { - if (m_pImpl) { - delete (CFWL_PanelImp*)m_pImpl; - m_pImpl = NULL; - } } CFWL_PanelImp::CFWL_PanelImp(IFWL_Widget* pOuter) : CFWL_WidgetImp(pOuter), m_pContent(NULL) {} @@ -142,31 +137,27 @@ IFWL_CustomPanel* IFWL_CustomPanel::Create() { return new IFWL_CustomPanel; } FWL_ERR IFWL_CustomPanel::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_CustomPanelImp(pOuter); - ((CFWL_CustomPanelImp*)m_pImpl)->SetInterface(this); - return ((CFWL_CustomPanelImp*)m_pImpl)->Initialize(); + CFWL_CustomPanelImp* pCustomPanelImpl = new CFWL_CustomPanelImp(pOuter); + SetImpl(pCustomPanelImpl); + pCustomPanelImpl->SetInterface(this); + return pCustomPanelImpl->Initialize(); } FWL_ERR IFWL_CustomPanel::Initialize(CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_CustomPanelImp(properties, pOuter); - ((CFWL_CustomPanelImp*)m_pImpl)->SetInterface(this); - return ((CFWL_CustomPanelImp*)m_pImpl)->Initialize(); + CFWL_CustomPanelImp* pCustomPanelImpl = + new CFWL_CustomPanelImp(properties, pOuter); + SetImpl(pCustomPanelImpl); + pCustomPanelImpl->SetInterface(this); + return pCustomPanelImpl->Initialize(); } IFWL_Content* IFWL_CustomPanel::GetContent() { - return ((CFWL_CustomPanelImp*)m_pImpl)->GetContent(); + return static_cast(GetImpl())->GetContent(); } FWL_ERR IFWL_CustomPanel::SetContent(IFWL_Content* pContent) { - return ((CFWL_CustomPanelImp*)m_pImpl)->SetContent(pContent); + return static_cast(GetImpl())->SetContent(pContent); } FWL_ERR IFWL_CustomPanel::SetProxy(IFWL_Proxy* pProxy) { - return ((CFWL_CustomPanelImp*)m_pImpl)->SetProxy(pProxy); + return static_cast(GetImpl())->SetProxy(pProxy); } IFWL_CustomPanel::IFWL_CustomPanel() { - m_pImpl = NULL; -} -IFWL_CustomPanel::~IFWL_CustomPanel() { - if (m_pImpl) { - delete (CFWL_CustomPanelImp*)m_pImpl; - m_pImpl = NULL; - } } diff --git a/xfa/src/fwl/src/core/fwl_targetimp.cpp b/xfa/src/fwl/src/core/fwl_targetimp.cpp index 1acc56a018..0ae40d11f4 100644 --- a/xfa/src/fwl/src/core/fwl_targetimp.cpp +++ b/xfa/src/fwl/src/core/fwl_targetimp.cpp @@ -7,35 +7,37 @@ #include "../../../foxitlib.h" #include "include/fwl_targetimp.h" FX_DWORD IFWL_Target::Release() { - FX_DWORD dwRef = ((CFWL_TargetImp*)m_pImpl)->Release(); + FX_DWORD dwRef = m_pImpl->Release(); if (!dwRef) { - m_pImpl = NULL; + m_pImpl = nullptr; delete this; } return dwRef; } IFWL_Target* IFWL_Target::Retain() { - return ((CFWL_TargetImp*)m_pImpl)->Retain(); + return m_pImpl->Retain(); } FX_DWORD IFWL_Target::GetRefCount() const { - return ((CFWL_TargetImp*)m_pImpl)->GetRefCount(); + return m_pImpl->GetRefCount(); } FWL_ERR IFWL_Target::GetClassName(CFX_WideString& wsClass) const { - return ((CFWL_TargetImp*)m_pImpl)->GetClassName(wsClass); + return m_pImpl->GetClassName(wsClass); } FX_DWORD IFWL_Target::GetClassID() const { - return ((CFWL_TargetImp*)m_pImpl)->GetClassID(); + return m_pImpl->GetClassID(); } FX_BOOL IFWL_Target::IsInstance(const CFX_WideStringC& wsClass) const { - return ((CFWL_TargetImp*)m_pImpl)->IsInstance(wsClass); + return m_pImpl->IsInstance(wsClass); } FWL_ERR IFWL_Target::Initialize() { - return ((CFWL_TargetImp*)m_pImpl)->Initialize(); + return m_pImpl->Initialize(); } FWL_ERR IFWL_Target::Finalize() { - return ((CFWL_TargetImp*)m_pImpl)->Finalize(); + return m_pImpl->Finalize(); +} +IFWL_Target::~IFWL_Target() { + delete m_pImpl; } -IFWL_Target::~IFWL_Target() {} CFWL_TargetImp::CFWL_TargetImp() : m_dwRefCount(1) { } CFWL_TargetImp::~CFWL_TargetImp() { diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp index 923e09c678..78daae08a7 100644 --- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp +++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp @@ -12,109 +12,114 @@ #include "include/fwl_widgetmgrimp.h" #include "include/fwl_widgetimp.h" FWL_ERR IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { - return ((CFWL_WidgetImp*)m_pImpl)->GetWidgetRect(rect, bAutoSize); + return static_cast(GetImpl()) + ->GetWidgetRect(rect, bAutoSize); } FWL_ERR IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { - return ((CFWL_WidgetImp*)m_pImpl)->GetGlobalRect(rect); + return static_cast(GetImpl())->GetGlobalRect(rect); } FWL_ERR IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { - return ((CFWL_WidgetImp*)m_pImpl)->SetWidgetRect(rect); + return static_cast(GetImpl())->SetWidgetRect(rect); } FWL_ERR IFWL_Widget::GetClientRect(CFX_RectF& rect) { - return ((CFWL_WidgetImp*)m_pImpl)->GetClientRect(rect); + return static_cast(GetImpl())->GetClientRect(rect); } IFWL_Widget* IFWL_Widget::GetParent() { - return ((CFWL_WidgetImp*)m_pImpl)->GetParent(); + return static_cast(GetImpl())->GetParent(); } FWL_ERR IFWL_Widget::SetParent(IFWL_Widget* pParent) { - return ((CFWL_WidgetImp*)m_pImpl)->SetParent(pParent); + return static_cast(GetImpl())->SetParent(pParent); } IFWL_Widget* IFWL_Widget::GetOwner() { - return ((CFWL_WidgetImp*)m_pImpl)->GetOwner(); + return static_cast(GetImpl())->GetOwner(); } FWL_ERR IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { - return ((CFWL_WidgetImp*)m_pImpl)->SetOwner(pOwner); + return static_cast(GetImpl())->SetOwner(pOwner); } IFWL_Widget* IFWL_Widget::GetOuter() { - return ((CFWL_WidgetImp*)m_pImpl)->GetOuter(); + return static_cast(GetImpl())->GetOuter(); } FX_DWORD IFWL_Widget::GetStyles() { - return ((CFWL_WidgetImp*)m_pImpl)->GetStyles(); + return static_cast(GetImpl())->GetStyles(); } FWL_ERR IFWL_Widget::ModifyStyles(FX_DWORD dwStylesAdded, FX_DWORD dwStylesRemoved) { - return ((CFWL_WidgetImp*)m_pImpl) + return static_cast(GetImpl()) ->ModifyStyles(dwStylesAdded, dwStylesRemoved); } FX_DWORD IFWL_Widget::GetStylesEx() { - return ((CFWL_WidgetImp*)m_pImpl)->GetStylesEx(); + return static_cast(GetImpl())->GetStylesEx(); } FWL_ERR IFWL_Widget::ModifyStylesEx(FX_DWORD dwStylesExAdded, FX_DWORD dwStylesExRemoved) { - return ((CFWL_WidgetImp*)m_pImpl) + return static_cast(GetImpl()) ->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } FX_DWORD IFWL_Widget::GetStates() { - return ((CFWL_WidgetImp*)m_pImpl)->GetStates(); + return static_cast(GetImpl())->GetStates(); } FWL_ERR IFWL_Widget::SetStates(FX_DWORD dwStates, FX_BOOL bSet) { - return ((CFWL_WidgetImp*)m_pImpl)->SetStates(dwStates, bSet); + return static_cast(GetImpl())->SetStates(dwStates, bSet); } FWL_ERR IFWL_Widget::SetPrivateData(void* module_id, void* pData, PD_CALLBACK_FREEDATA callback) { - return ((CFWL_WidgetImp*)m_pImpl)->SetPrivateData(module_id, pData, callback); + return static_cast(GetImpl()) + ->SetPrivateData(module_id, pData, callback); } void* IFWL_Widget::GetPrivateData(void* module_id) { - return ((CFWL_WidgetImp*)m_pImpl)->GetPrivateData(module_id); + return static_cast(GetImpl())->GetPrivateData(module_id); } FWL_ERR IFWL_Widget::Update() { - return ((CFWL_WidgetImp*)m_pImpl)->Update(); + return static_cast(GetImpl())->Update(); } FWL_ERR IFWL_Widget::LockUpdate() { - return ((CFWL_WidgetImp*)m_pImpl)->LockUpdate(); + return static_cast(GetImpl())->LockUpdate(); } FWL_ERR IFWL_Widget::UnlockUpdate() { - return ((CFWL_WidgetImp*)m_pImpl)->UnlockUpdate(); + return static_cast(GetImpl())->UnlockUpdate(); } FX_DWORD IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { - return ((CFWL_WidgetImp*)m_pImpl)->HitTest(fx, fy); + return static_cast(GetImpl())->HitTest(fx, fy); } FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy) { - return ((CFWL_WidgetImp*)m_pImpl)->TransformTo(pWidget, fx, fy); + return static_cast(GetImpl())->TransformTo(pWidget, fx, fy); } FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { - return ((CFWL_WidgetImp*)m_pImpl)->TransformTo(pWidget, rt); + return static_cast(GetImpl())->TransformTo(pWidget, rt); } FWL_ERR IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { - return ((CFWL_WidgetImp*)m_pImpl)->GetMatrix(matrix, bGlobal); + return static_cast(GetImpl())->GetMatrix(matrix, bGlobal); } FWL_ERR IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { - return ((CFWL_WidgetImp*)m_pImpl)->SetMatrix(matrix); + return static_cast(GetImpl())->SetMatrix(matrix); } FWL_ERR IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) { - return ((CFWL_WidgetImp*)m_pImpl)->DrawWidget(pGraphics, pMatrix); + return static_cast(GetImpl()) + ->DrawWidget(pGraphics, pMatrix); } IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { - return ((CFWL_WidgetImp*)m_pImpl)->GetThemeProvider(); + return static_cast(GetImpl())->GetThemeProvider(); } FWL_ERR IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { - return ((CFWL_WidgetImp*)m_pImpl)->SetThemeProvider(pThemeProvider); + return static_cast(GetImpl()) + ->SetThemeProvider(pThemeProvider); } FWL_ERR IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { - return ((CFWL_WidgetImp*)m_pImpl)->SetDataProvider(pDataProvider); + return static_cast(GetImpl()) + ->SetDataProvider(pDataProvider); } IFWL_WidgetDelegate* IFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) { - return ((CFWL_WidgetImp*)m_pImpl)->SetDelegate(pDelegate); + return static_cast(GetImpl())->SetDelegate(pDelegate); } IFWL_NoteThread* IFWL_Widget::GetOwnerThread() const { - return ((CFWL_WidgetImp*)m_pImpl)->GetOwnerThread(); + return static_cast(GetImpl())->GetOwnerThread(); } CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { - return ((CFWL_WidgetImp*)m_pImpl)->GetOffsetFromParent(pParent); + return static_cast(GetImpl())->GetOffsetFromParent(pParent); } FWL_ERR CFWL_WidgetImp::Initialize() { IFWL_App* pApp = FWL_GetApp(); @@ -1115,27 +1120,22 @@ IFWL_Custom* IFWL_Custom::Create() { return new IFWL_Custom; } IFWL_Custom::IFWL_Custom() { - m_pImpl = NULL; -} -IFWL_Custom::~IFWL_Custom() { - if (m_pImpl) { - delete (CFWL_Custom*)m_pImpl; - m_pImpl = NULL; - } } FWL_ERR IFWL_Custom::Initialize(IFWL_Widget* pOuter) { - m_pImpl = new CFWL_Custom(pOuter); - ((CFWL_Custom*)m_pImpl)->SetInterface(this); - return ((CFWL_Custom*)m_pImpl)->Initialize(); + CFWL_Custom* pCustomImpl = new CFWL_Custom(pOuter); + SetImpl(pCustomImpl); + pCustomImpl->SetInterface(this); + return pCustomImpl->Initialize(); } FWL_ERR IFWL_Custom::Initialize(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) { - m_pImpl = new CFWL_Custom(properties, pOuter); - ((CFWL_Custom*)m_pImpl)->SetInterface(this); - return ((CFWL_Custom*)m_pImpl)->Initialize(); + CFWL_Custom* pCustomImpl = new CFWL_Custom(properties, pOuter); + SetImpl(pCustomImpl); + pCustomImpl->SetInterface(this); + return pCustomImpl->Initialize(); } FWL_ERR IFWL_Custom::SetProxy(IFWL_Proxy* pProxy) { - return ((CFWL_Custom*)m_pImpl)->SetProxy(pProxy); + return static_cast(GetImpl())->SetProxy(pProxy); } void FWL_SetWidgetRect(IFWL_Widget* widget, const CFX_RectF& rect) { static_cast(widget->GetImpl())->m_pProperties->m_rtWidget = diff --git a/xfa/src/fwl/src/core/include/fwl_targetimp.h b/xfa/src/fwl/src/core/include/fwl_targetimp.h index 87ae8ea390..5f494a78e2 100644 --- a/xfa/src/fwl/src/core/include/fwl_targetimp.h +++ b/xfa/src/fwl/src/core/include/fwl_targetimp.h @@ -12,6 +12,8 @@ class CFWL_TargetImp { public: + virtual ~CFWL_TargetImp(); + virtual FX_DWORD Release(); virtual IFWL_Target* Retain(); virtual FX_DWORD GetRefCount() const; @@ -23,7 +25,6 @@ class CFWL_TargetImp { protected: CFWL_TargetImp(); - virtual ~CFWL_TargetImp(); FX_DWORD m_dwRefCount; }; -- cgit v1.2.3