summaryrefslogtreecommitdiff
path: root/xfa/fwl
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fwl')
-rw-r--r--xfa/fwl/basewidget/fwl_caretimp.cpp7
-rw-r--r--xfa/fwl/basewidget/fxmath_barcodeimp.cpp8
-rw-r--r--xfa/fwl/core/fwl_formimp.cpp26
-rw-r--r--xfa/fwl/core/fwl_noteimp.cpp12
-rw-r--r--xfa/fwl/core/fwl_widgetmgrimp.cpp19
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.cpp12
-rw-r--r--xfa/fwl/theme/cfwl_formtp.cpp31
-rw-r--r--xfa/fwl/theme/cfwl_pushbuttontp.cpp9
-rw-r--r--xfa/fwl/theme/cfwl_scrollbartp.cpp10
-rw-r--r--xfa/fwl/theme/cfwl_widgettp.cpp21
10 files changed, 66 insertions, 89 deletions
diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp
index 3cb2ed60f7..c61c459f2e 100644
--- a/xfa/fwl/basewidget/fwl_caretimp.cpp
+++ b/xfa/fwl/basewidget/fwl_caretimp.cpp
@@ -44,12 +44,11 @@ CFWL_CaretImp::CFWL_CaretImp(const CFWL_WidgetImpProperties& properties,
m_pTimer = new CFWL_CaretTimer(this);
SetStates(FWL_STATE_CAT_HightLight);
}
+
CFWL_CaretImp::~CFWL_CaretImp() {
- if (m_pTimer) {
- delete m_pTimer;
- m_pTimer = NULL;
- }
+ delete m_pTimer;
}
+
FWL_ERR CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const {
wsClass = FWL_CLASS_Caret;
return FWL_ERR_Succeeded;
diff --git a/xfa/fwl/basewidget/fxmath_barcodeimp.cpp b/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
index 5ca0927671..5efd1621c8 100644
--- a/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
+++ b/xfa/fwl/basewidget/fxmath_barcodeimp.cpp
@@ -46,13 +46,13 @@ static CBC_CodeBase* FX_Barcode_CreateBarCodeEngineObject(BC_TYPE type) {
return NULL;
}
}
+
CFX_Barcode::CFX_Barcode() {}
+
CFX_Barcode::~CFX_Barcode() {
- if (m_pBCEngine) {
- delete m_pBCEngine;
- m_pBCEngine = NULL;
- }
+ delete m_pBCEngine;
}
+
FX_BOOL CFX_Barcode::Create(BC_TYPE type) {
m_pBCEngine = FX_Barcode_CreateBarCodeEngineObject(type);
return m_pBCEngine != NULL;
diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp
index 815aca974c..2fd85a8d0e 100644
--- a/xfa/fwl/core/fwl_formimp.cpp
+++ b/xfa/fwl/core/fwl_formimp.cpp
@@ -471,25 +471,19 @@ void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) {
pChild = pWidgetMgr->GetWidget(pChild, FWL_WGTRELATION_NextSibling);
}
}
+
void CFWL_FormImp::RemoveSysButtons() {
m_rtCaption.Reset();
- if (m_pCloseBox) {
- delete m_pCloseBox;
- m_pCloseBox = NULL;
- }
- if (m_pMinBox) {
- delete m_pMinBox;
- m_pMinBox = NULL;
- }
- if (m_pMaxBox) {
- delete m_pMaxBox;
- m_pMaxBox = NULL;
- }
- if (m_pCaptionBox) {
- delete m_pCaptionBox;
- m_pCaptionBox = NULL;
- }
+ delete m_pCloseBox;
+ m_pCloseBox = nullptr;
+ delete m_pMinBox;
+ m_pMinBox = nullptr;
+ delete m_pMaxBox;
+ m_pMaxBox = nullptr;
+ delete m_pCaptionBox;
+ m_pCaptionBox = nullptr;
}
+
void CFWL_FormImp::CalcContentRect(CFX_RectF& rtContent) {
#ifdef FWL_UseMacSystemBorder
rtContent = m_rtRelative;
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index 267b2ca2ee..39afa783c0 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -870,20 +870,20 @@ CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {
}
delete m_ToolTipDp;
}
+
// static
CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() {
- if (!s_pInstance) {
+ if (!s_pInstance)
s_pInstance = new CFWL_ToolTipContainer;
- }
return s_pInstance;
}
+
// static
void CFWL_ToolTipContainer::DeleteInstance() {
- if (s_pInstance) {
- delete s_pInstance;
- s_pInstance = NULL;
- }
+ delete s_pInstance;
+ s_pInstance = NULL;
}
+
FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) {
if (m_arrWidget.Find(pTarget) < 0) {
m_arrWidget.Add(pTarget);
diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp
index b1e0ca822a..0ce452edb0 100644
--- a/xfa/fwl/core/fwl_widgetmgrimp.cpp
+++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp
@@ -39,6 +39,7 @@ CFWL_WidgetMgr::CFWL_WidgetMgr(IFWL_AdapterNative* pAdapterNative)
m_rtScreen.Reset();
#endif
}
+
CFWL_WidgetMgr::~CFWL_WidgetMgr() {
FX_POSITION ps = m_mapWidgetItem.GetStartPosition();
while (ps) {
@@ -48,11 +49,9 @@ CFWL_WidgetMgr::~CFWL_WidgetMgr() {
delete pItem;
}
m_mapWidgetItem.RemoveAll();
- if (m_pDelegate) {
- delete m_pDelegate;
- m_pDelegate = NULL;
- }
+ delete m_pDelegate;
}
+
int32_t CFWL_WidgetMgr::CountWidgets(IFWL_Widget* pParent) {
CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent);
return TravelWidgetMgr(pParentItem, NULL, NULL);
@@ -480,18 +479,18 @@ IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent,
}
return parent;
}
+
void CFWL_WidgetMgr::NotifySizeChanged(IFWL_Widget* pForm,
FX_FLOAT fx,
FX_FLOAT fy) {
- if (!FWL_UseOffscreen(pForm)) {
+ if (!FWL_UseOffscreen(pForm))
return;
- }
+
CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pForm);
- if (pItem->pOffscreen) {
- delete pItem->pOffscreen;
- pItem->pOffscreen = NULL;
- }
+ delete pItem->pOffscreen;
+ pItem->pOffscreen = nullptr;
}
+
IFWL_Widget* CFWL_WidgetMgr::nextTab(IFWL_Widget* parent,
IFWL_Widget* focus,
FX_BOOL& bFind) {
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index ccde660693..ac94c80d6d 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -22,21 +22,19 @@
#define CHECKBOX_COLOR_BOXRB1 (ArgbEncode(255, 241, 239, 226))
#define CHECKBOX_COLOR_BOXRB2 (ArgbEncode(255, 255, 255, 255))
-CFWL_CheckBoxTP::CFWL_CheckBoxTP() : m_pCheckPath(NULL) {
- m_pThemeData = new CKBThemeData;
+CFWL_CheckBoxTP::CFWL_CheckBoxTP()
+ : m_pThemeData(new CKBThemeData), m_pCheckPath(nullptr) {
SetThemeData(0);
}
+
CFWL_CheckBoxTP::~CFWL_CheckBoxTP() {
- if (m_pThemeData) {
- delete m_pThemeData;
- m_pThemeData = NULL;
- }
+ delete m_pThemeData;
if (m_pCheckPath) {
m_pCheckPath->Clear();
delete m_pCheckPath;
- m_pCheckPath = NULL;
}
}
+
FX_BOOL CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
return pWidget && pWidget->GetClassID() == FWL_CLASSHASH_CheckBox;
}
diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp
index ec06f4ad24..4a18ea0cc4 100644
--- a/xfa/fwl/theme/cfwl_formtp.cpp
+++ b/xfa/fwl/theme/cfwl_formtp.cpp
@@ -35,30 +35,27 @@ CFWL_FormTP::CFWL_FormTP() : m_pActiveBitmap(NULL), m_pDeactivebitmap(NULL) {
m_rtDisBBorder.Reset();
m_rtDisCaption.Reset();
}
+
CFWL_FormTP::~CFWL_FormTP() {
- if (m_pThemeData) {
- delete m_pThemeData;
- m_pThemeData = NULL;
- }
+ delete m_pThemeData;
}
+
FWL_ERR CFWL_FormTP::Initialize() {
InitTTO();
InitCaption(TRUE);
InitCaption(FALSE);
return CFWL_WidgetTP::Initialize();
}
+
FWL_ERR CFWL_FormTP::Finalize() {
FinalizeTTO();
- if (m_pActiveBitmap) {
- delete m_pActiveBitmap;
- m_pActiveBitmap = NULL;
- }
- if (m_pDeactivebitmap) {
- delete m_pDeactivebitmap;
- m_pDeactivebitmap = NULL;
- }
+ delete m_pActiveBitmap;
+ m_pActiveBitmap = nullptr;
+ delete m_pDeactivebitmap;
+ m_pDeactivebitmap = nullptr;
return CFWL_WidgetTP::Finalize();
}
+
FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) {
if (!pWidget)
return FALSE;
@@ -850,10 +847,7 @@ void CFWL_FormTP::InitCaption(FX_BOOL bActive) {
CFX_Graphics gs;
CFX_Path path;
path.Create();
- if (m_pActiveBitmap) {
- delete m_pActiveBitmap;
- m_pActiveBitmap = NULL;
- }
+ delete m_pActiveBitmap;
m_pActiveBitmap = new CFX_DIBitmap;
m_pActiveBitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb);
dev.Attach(m_pActiveBitmap);
@@ -875,10 +869,7 @@ void CFWL_FormTP::InitCaption(FX_BOOL bActive) {
CFX_Graphics gs;
CFX_Path path;
path.Create();
- if (m_pDeactivebitmap) {
- delete m_pDeactivebitmap;
- m_pDeactivebitmap = NULL;
- }
+ delete m_pDeactivebitmap;
m_pDeactivebitmap = new CFX_DIBitmap;
m_pDeactivebitmap->Create(1, FWLTHEME_CAPACITY_CYCaption, FXDIB_Argb);
dev.Attach(m_pDeactivebitmap);
diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
index 5662ac09c2..780c580369 100644
--- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp
+++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp
@@ -15,15 +15,14 @@
#define PUSHBUTTON_SIZE_Corner 2
-CFWL_PushButtonTP::CFWL_PushButtonTP() {
- m_pThemeData = new PBThemeData;
+CFWL_PushButtonTP::CFWL_PushButtonTP() : m_pThemeData(new PBThemeData) {
SetThemeData(0);
}
+
CFWL_PushButtonTP::~CFWL_PushButtonTP() {
- if (m_pThemeData) {
- delete m_pThemeData;
- }
+ delete m_pThemeData;
}
+
FX_BOOL CFWL_PushButtonTP::IsValidWidget(IFWL_Widget* pWidget) {
return pWidget->GetClassID() == FWL_CLASSHASH_PushButton;
}
diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp
index 11326edf59..0913a8daa2 100644
--- a/xfa/fwl/theme/cfwl_scrollbartp.cpp
+++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp
@@ -15,16 +15,14 @@
#define FWL_SCROLL_PawLen 12.5f
-CFWL_ScrollBarTP::CFWL_ScrollBarTP() {
- m_pThemeData = new SBThemeData;
+CFWL_ScrollBarTP::CFWL_ScrollBarTP() : m_pThemeData(new SBThemeData) {
SetThemeData(0);
}
+
CFWL_ScrollBarTP::~CFWL_ScrollBarTP() {
- if (m_pThemeData) {
- delete m_pThemeData;
- m_pThemeData = NULL;
- }
+ delete m_pThemeData;
}
+
FX_BOOL CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) {
if (!pWidget)
return FALSE;
diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp
index 7f4e547e24..1ff241636f 100644
--- a/xfa/fwl/theme/cfwl_widgettp.cpp
+++ b/xfa/fwl/theme/cfwl_widgettp.cpp
@@ -741,27 +741,26 @@ uint32_t FWL_GetThemeColor(uint32_t dwThemeID) {
}
CFWL_ArrowData* CFWL_ArrowData::m_pInstance = NULL;
+
CFWL_ArrowData* CFWL_ArrowData::GetInstance() {
- if (!m_pInstance) {
+ if (!m_pInstance)
m_pInstance = new CFWL_ArrowData;
- }
return m_pInstance;
}
+
FX_BOOL CFWL_ArrowData::IsInstance() {
- return (m_pInstance != NULL);
+ return !!m_pInstance;
}
+
void CFWL_ArrowData::DestroyInstance() {
- if (m_pInstance) {
- delete m_pInstance;
- m_pInstance = NULL;
- }
+ delete m_pInstance;
+ m_pInstance = nullptr;
}
+
CFWL_ArrowData::~CFWL_ArrowData() {
- if (m_pColorData) {
- delete m_pColorData;
- m_pColorData = NULL;
- }
+ delete m_pColorData;
}
+
void CFWL_ArrowData::SetColorData(uint32_t dwID) {
if (!m_pColorData) {
m_pColorData = new CColorData;