diff options
52 files changed, 1091 insertions, 654 deletions
diff --git a/xfa/include/fwl/core/fwl_error.h b/xfa/include/fwl/core/fwl_error.h index 4f22dbbe57..5c92945289 100644 --- a/xfa/include/fwl/core/fwl_error.h +++ b/xfa/include/fwl/core/fwl_error.h @@ -19,69 +19,4 @@ typedef int32_t FWL_ERR; #define FWL_ERR_Method_Not_Supported -400
#define FWL_ERR_Out_Of_Memory -500
-#if defined(__WIN32__) || defined(_WIN32)
-#define _FWL_ALARM_IF_FAIL(arg, alarm) \
- { \
- if (!(arg)) \
- ::OutputDebugString(alarm); \
- }
-#elif defined(__linux) || defined(linux) || defined(__APPLE__) || \
- defined(__MACOSX__)
-#define _FWL_ALARM_IF_FAIL(arg, alarm) \
- { \
- if (!(arg)) \
- printf(alarm); \
- }
-#else
-#endif
-#define _FWL_RETURN_IF_FAIL(arg) \
- { \
- if (!(arg)) \
- return; \
- }
-#define _FWL_RETURN_VALUE_IF_FAIL(arg, val) \
- { \
- if (!(arg)) \
- return val; \
- }
-#define _FWL_GOTO_POSITION_IF_FAIL(arg, pos) \
- { \
- if (!(arg)) \
- goto pos; \
- }
-#if defined(__WIN32__) || defined(_WIN32)
-#define _FWL_ERR_CHECK_ALARM_IF_FAIL(arg) \
- { \
- if ((arg) != FWL_ERR_Succeeded) { \
- char buf[36]; \
- memset(buf, 0, sizeof(buf)); \
- FXSYS_snprintf(buf, sizeof(buf) - 1, "Error code is %d\n", arg); \
- ::OutputDebugString(buf); \
- } \
- }
-#elif defined(__linux) || defined(linux) || defined(__APPLE__) || \
- defined(__MACOSX__)
-#define _FWL_ERR_CHECK_ALARM_IF_FAIL(arg) \
- { \
- if ((arg) != FWL_ERR_Succeeded) \
- printf("%d\n", arg); \
- }
-#else
-#endif
-#define _FWL_ERR_CHECK_RETURN_IF_FAIL(arg) \
- { \
- if ((arg) != FWL_ERR_Succeeded) \
- return; \
- }
-#define _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(arg, val) \
- { \
- if ((arg) != FWL_ERR_Succeeded) \
- return val; \
- }
-#define _FWL_ERR_CHECK_GOTO_POSITION_IF_FAIL(arg, pos) \
- { \
- if ((arg) != FWL_ERR_Succeeded) \
- goto pos; \
- }
-
#endif // XFA_INCLUDE_FWL_CORE_FWL_ERROR_H_
diff --git a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp index 5544162380..18b7b4c39f 100644 --- a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp @@ -53,8 +53,8 @@ FWL_ERR CFWL_BarcodeImp::Initialize() { if (!m_pDelegate) {
m_pDelegate = new CFWL_BarcodeImpDelegate(this);
}
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_EditImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_BarcodeImp::Finalize() {
@@ -73,9 +73,10 @@ FWL_ERR CFWL_BarcodeImp::Update() { }
FWL_ERR CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
GenerateBarcodeImageCache();
if (!m_pBarcodeEngine || (m_dwStatus & XFA_BCS_EncodeSuccess) == 0) {
@@ -88,26 +89,27 @@ FWL_ERR CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics, mt.Concat(*pMatrix);
}
int32_t errorCode = 0;
- _FWL_RETURN_VALUE_IF_FAIL(
- m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix,
- errorCode),
- FWL_ERR_Indefinite);
+ if (!m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix,
+ errorCode)) {
+ return FWL_ERR_Indefinite;
+ }
return FWL_ERR_Succeeded;
}
return CFWL_EditImp::DrawWidget(pGraphics, pMatrix);
}
void CFWL_BarcodeImp::GenerateBarcodeImageCache() {
- if ((m_dwStatus & XFA_BCS_NeedUpdate) == 0) {
+ if ((m_dwStatus & XFA_BCS_NeedUpdate) == 0)
return;
- }
m_dwStatus = 0;
- ;
CreateBarcodeEngine();
IFWL_BarcodeDP* pData = (IFWL_BarcodeDP*)m_pProperties->m_pDataProvider;
- _FWL_RETURN_IF_FAIL(pData);
- _FWL_RETURN_IF_FAIL(m_pBarcodeEngine);
+ if (!pData)
+ return;
+ if (!m_pBarcodeEngine)
+ return;
CFX_WideString wsText;
- _FWL_RETURN_IF_FAIL(GetText(wsText) == FWL_ERR_Succeeded);
+ if (GetText(wsText) != FWL_ERR_Succeeded)
+ return;
CFWL_ThemePart part;
part.m_pWidget = m_pInterface;
IFWL_ThemeProvider* pTheme = GetAvailableTheme();
diff --git a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp index cb40648b60..87c0ce8c59 100644 --- a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp @@ -67,8 +67,8 @@ FX_DWORD CFWL_CaretImp::GetClassID() const { return FWL_CLASSHASH_Caret;
}
FWL_ERR CFWL_CaretImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_CaretImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -83,12 +83,12 @@ FWL_ERR CFWL_CaretImp::Finalize() { }
FWL_ERR CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- if (!m_pProperties->m_pThemeProvider) {
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
m_pProperties->m_pThemeProvider = GetAvailableTheme();
- }
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix);
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp index e490852ff0..497cf7a6ab 100644 --- a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp @@ -75,8 +75,8 @@ FX_DWORD CFWL_CheckBoxImp::GetClassID() const { : FWL_CLASSHASH_CheckBox;
}
FWL_ERR CFWL_CheckBoxImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_CheckBoxImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -88,13 +88,12 @@ FWL_ERR CFWL_CheckBoxImp::Finalize() { FWL_ERR CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
- if (!m_pProperties->m_pThemeProvider) {
+ if (!m_pProperties->m_pThemeProvider)
m_pProperties->m_pThemeProvider = GetAvailableTheme();
- }
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider,
- FWL_ERR_Indefinite);
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pDataProvider)
+ return FWL_ERR_Indefinite;
CFX_WideString wsCaption;
m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
if (wsCaption.GetLength() > 0) {
@@ -129,9 +128,10 @@ FWL_ERR CFWL_CheckBoxImp::Update() { }
FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (HasBorder()) {
DrawBorder(pGraphics, FWL_PART_CKB_Border, m_pProperties->m_pThemeProvider,
@@ -159,12 +159,14 @@ FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, param.m_rtPart = m_rtBox;
pTheme->DrawBackground(¶m);
}
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, FWL_ERR_Indefinite);
+ if (!m_pProperties->m_pDataProvider)
+ return FWL_ERR_Indefinite;
{
CFX_WideString wsCaption;
m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
int32_t iLen = wsCaption.GetLength();
- _FWL_RETURN_VALUE_IF_FAIL(iLen > 0, FWL_ERR_Indefinite);
+ if (iLen <= 0)
+ return FWL_ERR_Indefinite;
CFWL_ThemeText textParam;
textParam.m_pWidget = m_pInterface;
textParam.m_iPart = FWL_PART_CKB_Caption;
@@ -225,7 +227,8 @@ void CFWL_CheckBoxImp::Layout() { FX_FLOAT fTextLeft = 0.0, fTextRight = 0.0;
FX_FLOAT fClientRight = m_rtClient.right();
FX_FLOAT fClientBottom = m_rtClient.bottom();
- _FWL_RETURN_IF_FAIL(m_pProperties->m_pDataProvider);
+ if (!m_pProperties->m_pDataProvider)
+ return;
IFWL_CheckBoxDP* pData = (IFWL_CheckBoxDP*)m_pProperties->m_pDataProvider;
FX_FLOAT fCheckBox = pData->GetBoxSize(m_pInterface);
switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_VLayoutMask) {
@@ -422,7 +425,8 @@ void CFWL_CheckBoxImp::NextStates() { CFWL_CheckBoxImpDelegate::CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner)
: m_pOwner(pOwner) {}
int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
int32_t iRet = 1;
switch (dwMsgCode) {
diff --git a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp index 379e75fa66..9a0868dabc 100644 --- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp @@ -141,7 +141,8 @@ CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {
}
int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
FX_BOOL backDefault = TRUE;
switch (dwMsgCode) {
@@ -204,8 +205,8 @@ CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, FXSYS_assert(pOuter != NULL);
}
FWL_ERR CFWL_ComboListImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_ListBoxImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_ListBoxImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
delete m_pDelegate;
m_pDelegate = new CFWL_ComboListImpDelegate(this);
return FWL_ERR_Succeeded;
@@ -219,7 +220,8 @@ int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { if (wsMatch.IsEmpty()) {
return -1;
}
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, -1);
+ if (!m_pProperties->m_pDataProvider)
+ return -1;
IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
@@ -234,7 +236,8 @@ int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { return -1;
}
void CFWL_ComboListImp::ChangeSelected(int32_t iSel) {
- _FWL_RETURN_IF_FAIL(m_pProperties->m_pDataProvider);
+ if (!m_pProperties->m_pDataProvider)
+ return;
IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel);
CFX_RectF rtInvalidate;
@@ -259,7 +262,8 @@ void CFWL_ComboListImp::ChangeSelected(int32_t iSel) { }
}
int32_t CFWL_ComboListImp::CountItems() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, 0);
+ if (!m_pProperties->m_pDataProvider)
+ return 0;
IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
return pData->CountItems(m_pInterface);
}
@@ -271,7 +275,8 @@ void CFWL_ComboListImp::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) { void CFWL_ComboListImp::ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
fx += m_pProperties->m_rtWidget.left, fy += m_pProperties->m_rtWidget.top;
IFWL_Widget* pOwner = GetOwner();
- _FWL_RETURN_IF_FAIL(pOwner);
+ if (!pOwner)
+ return;
pOwner->TransformTo(m_pOuter, fx, fy);
}
void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) {
@@ -281,7 +286,8 @@ CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {
}
int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwHashCode = pMessage->GetClassID();
FX_BOOL backDefault = TRUE;
if (dwHashCode == FWL_MSGHASH_SetFocus ||
@@ -354,7 +360,8 @@ int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { }
FWL_HLISTITEM hItem = m_pOwner->GetItemAtPoint(pMsg->m_fx, pMsg->m_fy);
if (hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pOwner->m_pProperties->m_pDataProvider, 0);
+ if (!m_pOwner->m_pProperties->m_pDataProvider)
+ return 0;
IFWL_ListBoxDP* pData =
(IFWL_ListBoxDP*)m_pOwner->m_pProperties->m_pDataProvider;
int32_t iSel = pData->GetItemIndex(m_pOwner->m_pInterface, hItem);
@@ -512,8 +519,8 @@ FWL_ERR CFWL_ComboBoxImp::Initialize() { if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_Initialize();
}
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_WGTSTATE_Invisible);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_WGTSTATE_Invisible; // Probably a bug; not a FWL_ERR_ value.
m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
CFWL_WidgetImpProperties prop;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
@@ -565,7 +572,8 @@ FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { }
FX_FLOAT* pFWidth =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
- _FWL_RETURN_VALUE_IF_FAIL(pFWidth, FWL_ERR_Indefinite);
+ if (!pFWidth)
+ return FWL_ERR_Indefinite;
rect.Inflate(0, 0, *pFWidth, 0);
CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
} else {
@@ -627,9 +635,10 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_DrawWidget(pGraphics, pMatrix);
}
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
FX_BOOL bIsDropDown = IsDropDownStyle();
if (HasBorder()) {
@@ -669,7 +678,8 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, }
pTheme->DrawBackground(¶m);
if (m_iCurSel >= 0) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pListBox, FWL_ERR_Indefinite);
+ if (!m_pListBox)
+ return FWL_ERR_Indefinite;
CFX_WideString wsText;
IFWL_ComboBoxDP* pData = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel);
@@ -706,7 +716,8 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
- _FWL_RETURN_VALUE_IF_FAIL(pThemeProvider, FWL_ERR_Indefinite);
+ if (!pThemeProvider)
+ return FWL_ERR_Indefinite;
m_pProperties->m_pThemeProvider = pThemeProvider;
if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox)) {
m_pListBox->SetThemeProvider(pThemeProvider);
@@ -751,12 +762,14 @@ FWL_ERR CFWL_ComboBoxImp::SetStates(FX_DWORD dwStates, FX_BOOL bSet) { return CFWL_WidgetImp::SetStates(dwStates, bSet);
}
FWL_ERR CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, FWL_ERR_Indefinite);
+ if (!m_pEdit)
+ return FWL_ERR_Indefinite;
m_pEdit->SetText(wsText);
return m_pEdit->Update();
}
int32_t CFWL_ComboBoxImp::GetEditTextLength() const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, -1);
+ if (!m_pEdit)
+ return -1;
return m_pEdit->GetTextLength();
}
FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText,
@@ -772,37 +785,45 @@ FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, return FWL_ERR_Indefinite;
}
FWL_ERR CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, FWL_ERR_Indefinite);
+ if (!m_pEdit)
+ return FWL_ERR_Indefinite;
static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected();
m_pEdit->AddSelRange(nStart, nCount);
return FWL_ERR_Succeeded;
}
int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, -1);
+ if (!m_pEdit)
+ return -1;
return m_pEdit->GetSelRange(nIndex, nStart);
}
int32_t CFWL_ComboBoxImp::GetEditLimit() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, -1);
+ if (!m_pEdit)
+ return -1;
return m_pEdit->GetLimit();
}
FWL_ERR CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, FWL_ERR_Indefinite);
+ if (!m_pEdit)
+ return FWL_ERR_Indefinite;
return m_pEdit->SetLimit(nLimit);
}
FWL_ERR CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, FWL_ERR_Indefinite);
+ if (!m_pEdit)
+ return FWL_ERR_Indefinite;
return m_pEdit->DoClipboard(iCmd);
}
FX_BOOL CFWL_ComboBoxImp::EditRedo(const CFX_ByteStringC& bsRecord) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, FALSE);
+ if (!m_pEdit)
+ return FALSE;
return m_pEdit->Redo(bsRecord);
}
FX_BOOL CFWL_ComboBoxImp::EditUndo(const CFX_ByteStringC& bsRecord) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, FALSE);
+ if (!m_pEdit)
+ return FALSE;
return m_pEdit->Undo(bsRecord);
}
IFWL_ListBox* CFWL_ComboBoxImp::GetListBoxt() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pListBox, FALSE);
+ if (!m_pListBox)
+ return FALSE;
return m_pListBox;
}
FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() {
@@ -1014,7 +1035,8 @@ void CFWL_ComboBoxImp::Layout() { GetClientRect(m_rtClient);
FX_FLOAT* pFWidth =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
- _FWL_RETURN_IF_FAIL(pFWidth);
+ if (!pFWidth)
+ return;
FX_FLOAT fBtn = *pFWidth;
m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn,
m_rtClient.height);
@@ -1055,7 +1077,8 @@ void CFWL_ComboBoxImp::ReSetTheme() { }
}
void CFWL_ComboBoxImp::ReSetEditAlignment() {
- _FWL_RETURN_IF_FAIL(m_pEdit);
+ if (!m_pEdit)
+ return;
FX_DWORD dwStylExes = m_pProperties->m_dwStyleExes;
FX_DWORD dwAdd = 0;
switch (dwStylExes & FWL_STYLEEXT_CMB_EditHAlignMask) {
@@ -1091,7 +1114,8 @@ void CFWL_ComboBoxImp::ReSetEditAlignment() { FWL_STYLEEXT_EDT_VAlignMask);
}
void CFWL_ComboBoxImp::ReSetListItemAlignment() {
- _FWL_RETURN_IF_FAIL(m_pListBox);
+ if (!m_pListBox)
+ return;
FX_DWORD dwStylExes = m_pProperties->m_dwStyleExes;
FX_DWORD dwAdd = 0;
switch (dwStylExes & FWL_STYLEEXT_CMB_ListItemAlignMask) {
@@ -1131,8 +1155,10 @@ void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) { }
}
void CFWL_ComboBoxImp::InitProxyForm() {
- _FWL_RETURN_IF_FAIL(!m_pForm);
- _FWL_RETURN_IF_FAIL(m_pListBox);
+ if (m_pForm)
+ return;
+ if (!m_pListBox)
+ return;
CFWL_WidgetImpProperties propForm;
propForm.m_pOwner = m_pInterface;
propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
@@ -1147,8 +1173,8 @@ void CFWL_ComboBoxImp::InitProxyForm() { m_pProxy->SetDelegate(m_pListProxyDelegate);
}
FWL_ERR CFWL_ComboBoxImp::DisForm_Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_WGTSTATE_Invisible);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_WGTSTATE_Invisible; // Ditto.
m_pDelegate = new CFWL_ComboBoxImpDelegate(this);
DisForm_InitComboList();
DisForm_InitComboEdit();
@@ -1334,7 +1360,8 @@ void CFWL_ComboBoxImp::DisForm_Layout() { m_rtContent = m_rtClient;
FX_FLOAT* pFWidth =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
- _FWL_RETURN_IF_FAIL(pFWidth);
+ if (!pFWidth)
+ return;
FX_FLOAT borderWidth = 0;
{ borderWidth = FWL_PART_CMB_Border; }
FX_FLOAT fBtn = *pFWidth;
@@ -1372,7 +1399,8 @@ int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
return DisForm_OnProcessMessage(pMessage);
}
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
FX_BOOL iRet = 1;
switch (dwMsgCode) {
@@ -1453,7 +1481,8 @@ void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, if (bSet) {
m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
if (bDropDown && pSrcTarget != (IFWL_Widget*)m_pOwner->m_pListBox) {
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pEdit);
+ if (!m_pOwner->m_pEdit)
+ return;
static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
->SetSelected();
} else {
@@ -1462,7 +1491,8 @@ void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, } else {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
if (bDropDown && pDstTarget != (IFWL_Widget*)m_pOwner->m_pListBox) {
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pEdit);
+ if (!m_pOwner->m_pEdit)
+ return;
static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
->FlagFocus(FALSE);
static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
@@ -1590,7 +1620,8 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { }
int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage(
CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
FX_BOOL backDefault = TRUE;
switch (dwMsgCode) {
@@ -1739,7 +1770,8 @@ CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( m_pComboBox(pComboBox) {
}
int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
if (dwMsgCode == FWL_MSGHASH_Mouse) {
CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
@@ -1776,7 +1808,8 @@ FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, }
void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
IFWL_NoteThread* pThread = m_pForm->GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
CFX_RectF rtWidget;
m_pForm->GetWidgetRect(rtWidget);
@@ -1801,7 +1834,8 @@ void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
m_bLButtonDown = FALSE;
IFWL_NoteThread* pThread = m_pForm->GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
pDriver->SetGrab(m_pForm, FALSE);
if (m_bLButtonUpSelf) {
diff --git a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp index 23d12ca920..d116aa9c60 100644 --- a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp @@ -143,8 +143,8 @@ CFWL_DateTimeEdit::CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, : CFWL_EditImp(properties, pOuter) {}
FWL_ERR CFWL_DateTimeEdit::Initialize() {
m_pDelegate = new CFWL_DateTimeEditImpDelegate(this);
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_EditImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_DateTimeEdit::Finalize() {
@@ -201,8 +201,8 @@ CFWL_DateTimeCalendar::CFWL_DateTimeCalendar( IFWL_Widget* pOuter)
: CFWL_MonthCalendarImp(properties, pOuter) {}
FWL_ERR CFWL_DateTimeCalendar::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_MonthCalendarImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_MonthCalendarImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
delete m_pDelegate;
m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this);
return FWL_ERR_Succeeded;
@@ -299,7 +299,8 @@ void CFWL_DateTimeCalendarImpDelegate::OnLButtonUpEx(CFWL_MsgMouse* pMsg) { rtInvalidate.Union(lpDatesInfo->rect);
}
m_pOwner->AddSelDay(iCurSel);
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pOuter);
+ if (!m_pOwner->m_pOuter)
+ return;
pPicker->ProcessSelChanged(m_pOwner->m_iCurYear, m_pOwner->m_iCurMonth,
iCurSel);
pPicker->ShowMonthCalendar(FALSE);
@@ -446,8 +447,8 @@ FX_DWORD CFWL_DateTimePickerImp::GetClassID() const { return FWL_CLASSHASH_DateTimePicker;
}
FWL_ERR CFWL_DateTimePickerImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_DateTimePickerImpDelegate(this);
m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
CFWL_WidgetImpProperties propMonth;
@@ -513,7 +514,8 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { GetClientRect(m_rtClient);
FX_FLOAT* pFWidth =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
- _FWL_RETURN_VALUE_IF_FAIL(pFWidth, FWL_ERR_Indefinite);
+ if (!pFWidth)
+ return FWL_ERR_Indefinite;
FX_FLOAT fBtn = *pFWidth;
m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1,
m_rtClient.height - 1);
@@ -559,9 +561,10 @@ FX_DWORD CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { }
FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (HasBorder()) {
DrawBorder(pGraphics, FWL_PART_DTP_Border, pTheme, pMatrix);
@@ -593,9 +596,12 @@ FWL_ERR CFWL_DateTimePickerImp::GetCurSel(int32_t& iYear, FWL_ERR CFWL_DateTimePickerImp::SetCurSel(int32_t iYear,
int32_t iMonth,
int32_t iDay) {
- _FWL_RETURN_VALUE_IF_FAIL(iYear > 0 && iYear < 3000, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(iMonth > 0 && iMonth < 13, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(iDay > 0 && iDay < 32, FWL_ERR_Indefinite);
+ if (iYear <= 0 || iYear >= 3000)
+ return FWL_ERR_Indefinite;
+ if (iMonth <= 0 || iMonth >= 13)
+ return FWL_ERR_Indefinite;
+ if (iDay <= 0 || iDay >= 32)
+ return FWL_ERR_Indefinite;
m_iYear = iYear;
m_iMonth = iMonth;
m_iDay = iDay;
@@ -603,7 +609,8 @@ FWL_ERR CFWL_DateTimePickerImp::SetCurSel(int32_t iYear, return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdit, FWL_ERR_Indefinite);
+ if (!m_pEdit)
+ return FWL_ERR_Indefinite;
int32_t iRet = m_pEdit->SetText(wsText);
Repaint(&m_rtClient);
CFWL_Event_DtpEditChanged ev;
@@ -753,11 +760,13 @@ FX_BOOL CFWL_DateTimePickerImp::IsMonthCalendarShowed() { if (m_pWidgetMgr->IsFormDisabled()) {
return DisForm_IsMonthCalendarShowed();
}
- _FWL_RETURN_VALUE_IF_FAIL(m_pForm, FALSE);
+ if (!m_pForm)
+ return FALSE;
return !(m_pForm->GetStates() & FWL_WGTSTATE_Invisible);
}
void CFWL_DateTimePickerImp::ReSetEditAlignment() {
- _FWL_RETURN_IF_FAIL(m_pEdit);
+ if (!m_pEdit)
+ return;
FX_DWORD dwStylExes = m_pProperties->m_dwStyleExes;
FX_DWORD dwAdd = 0;
switch (dwStylExes & FWL_STYLEEXT_DTP_EditHAlignMask) {
@@ -811,8 +820,10 @@ void CFWL_DateTimePickerImp::ProcessSelChanged(int32_t iYear, DispatchEvent(&ev);
}
void CFWL_DateTimePickerImp::InitProxyForm() {
- _FWL_RETURN_IF_FAIL(!m_pForm);
- _FWL_RETURN_IF_FAIL(m_pMonthCal);
+ if (m_pForm)
+ return;
+ if (!m_pMonthCal)
+ return;
CFWL_WidgetImpProperties propForm;
propForm.m_dwStyles = FWL_WGTSTYLE_Popup;
propForm.m_dwStates = FWL_WGTSTATE_Invisible;
@@ -861,7 +872,8 @@ void CFWL_DateTimePickerImp::DisForm_InitDateTimeEdit() { m_pEdit->Initialize(propEdit, m_pInterface);
}
FX_BOOL CFWL_DateTimePickerImp::DisForm_IsMonthCalendarShowed() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pMonthCal, FALSE);
+ if (!m_pMonthCal)
+ return FALSE;
return !(m_pMonthCal->GetStates() & FWL_WGTSTATE_Invisible);
}
void CFWL_DateTimePickerImp::DisForm_ShowMonthCalendar(FX_BOOL bActivate) {
@@ -951,7 +963,8 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { }
FX_FLOAT* pWidth =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
- _FWL_RETURN_VALUE_IF_FAIL(pWidth, 0);
+ if (!pWidth)
+ return 0;
m_fBtn = *pWidth;
CFX_RectF rtMonthCal;
m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE);
@@ -986,7 +999,8 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { }
FWL_ERR CFWL_DateTimePickerImp::DisForm_DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
if (m_pEdit) {
CFX_RectF rtEdit;
m_pEdit->GetWidgetRect(rtEdit);
@@ -1014,7 +1028,8 @@ CFWL_DateTimePickerImpDelegate::CFWL_DateTimePickerImpDelegate( : m_pOwner(pOwner) {}
int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage(
CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
int32_t iRet = 1;
switch (dwMsgCode) {
@@ -1063,7 +1078,8 @@ FWL_ERR CFWL_DateTimePickerImpDelegate::OnDrawWidget( }
void CFWL_DateTimePickerImpDelegate::OnFocusChanged(CFWL_Message* pMsg,
FX_BOOL bSet) {
- _FWL_RETURN_IF_FAIL(pMsg);
+ if (!pMsg)
+ return;
if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
return DisForm_OnFocusChanged(pMsg, bSet);
}
@@ -1081,7 +1097,8 @@ void CFWL_DateTimePickerImpDelegate::OnFocusChanged(CFWL_Message* pMsg, m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
void CFWL_DateTimePickerImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) {
- _FWL_RETURN_IF_FAIL(pMsg);
+ if (!pMsg)
+ return;
if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
m_pOwner->SetFocus(TRUE);
}
@@ -1104,7 +1121,8 @@ void CFWL_DateTimePickerImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { }
}
void CFWL_DateTimePickerImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
- _FWL_RETURN_IF_FAIL(pMsg);
+ if (!pMsg)
+ return;
m_pOwner->m_bLBtnDown = FALSE;
if (m_pOwner->m_rtBtn.Contains(pMsg->m_fx, pMsg->m_fy)) {
m_pOwner->m_iBtnState = FWL_PARTSTATE_DTP_Hovered;
@@ -1121,7 +1139,8 @@ void CFWL_DateTimePickerImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
void CFWL_DateTimePickerImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
- _FWL_RETURN_IF_FAIL(pMsg);
+ if (!pMsg)
+ return;
m_pOwner->m_iBtnState = FWL_PARTSTATE_DTP_Normal;
m_pOwner->Repaint(&m_pOwner->m_rtBtn);
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp index 07fec7f032..dbd21ecd34 100644 --- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp @@ -235,8 +235,8 @@ FX_DWORD CFWL_EditImp::GetClassID() const { return FWL_CLASSHASH_Edit;
}
FWL_ERR CFWL_EditImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
if (!m_pDelegate) {
m_pDelegate = new CFWL_EditImpDelegate(this);
}
@@ -507,9 +507,10 @@ void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics, }
FWL_ERR CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
if (m_rtClient.IsEmpty()) {
return FWL_ERR_Indefinite;
}
@@ -533,7 +534,8 @@ FWL_ERR CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
- _FWL_RETURN_VALUE_IF_FAIL(pThemeProvider, FWL_ERR_Indefinite);
+ if (!pThemeProvider)
+ return FWL_ERR_Indefinite;
if (m_pHorzScrollBar) {
m_pHorzScrollBar->SetThemeProvider(pThemeProvider);
}
@@ -551,45 +553,54 @@ FWL_ERR CFWL_EditImp::SetText(const CFX_WideString& wsText) { return FWL_ERR_Succeeded;
}
int32_t CFWL_EditImp::GetTextLength() const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, -1);
+ if (!m_pEdtEngine)
+ return -1;
return m_pEdtEngine->GetTextLength();
}
FWL_ERR CFWL_EditImp::GetText(CFX_WideString& wsText,
int32_t nStart,
int32_t nCount) const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
m_pEdtEngine->GetText(wsText, nStart, nCount);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::ClearText() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
m_pEdtEngine->ClearText();
return FWL_ERR_Succeeded;
}
int32_t CFWL_EditImp::GetCaretPos() const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, -1);
+ if (!m_pEdtEngine)
+ return -1;
return m_pEdtEngine->GetCaretPos();
}
int32_t CFWL_EditImp::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, -1);
+ if (!m_pEdtEngine)
+ return -1;
return m_pEdtEngine->SetCaretPos(nIndex, bBefore);
}
FWL_ERR CFWL_EditImp::AddSelRange(int32_t nStart, int32_t nCount) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
m_pEdtEngine->AddSelRange(nStart, nCount);
return FWL_ERR_Succeeded;
}
int32_t CFWL_EditImp::CountSelRanges() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, 0);
+ if (!m_pEdtEngine)
+ return 0;
return m_pEdtEngine->CountSelRanges();
return FWL_ERR_Succeeded;
}
int32_t CFWL_EditImp::GetSelRange(int32_t nIndex, int32_t& nStart) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, -1);
+ if (!m_pEdtEngine)
+ return -1;
return m_pEdtEngine->GetSelRange(nIndex, nStart);
}
FWL_ERR CFWL_EditImp::ClearSelections() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
m_pEdtEngine->ClearSelection();
return FWL_ERR_Succeeded;
}
@@ -598,24 +609,28 @@ int32_t CFWL_EditImp::GetLimit() { }
FWL_ERR CFWL_EditImp::SetLimit(int32_t nLimit) {
m_nLimit = nLimit;
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
m_pEdtEngine->SetLimit(nLimit);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::SetAliasChar(FX_WCHAR wAlias) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Indefinite);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Indefinite;
m_pEdtEngine->SetAliasChar(wAlias);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::SetFormatString(const CFX_WideString& wsFormat) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
m_pEdtEngine->SetFormatBlock(0, wsFormat);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::Insert(int32_t nStart,
const FX_WCHAR* lpText,
int32_t nLen) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) ||
(m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
return FWL_ERR_Indefinite;
@@ -624,7 +639,8 @@ FWL_ERR CFWL_EditImp::Insert(int32_t nStart, return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::DeleteSelections() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
int32_t iCount = m_pEdtEngine->CountSelRanges();
if (iCount > 0) {
m_pEdtEngine->Delete(-1);
@@ -632,12 +648,14 @@ FWL_ERR CFWL_EditImp::DeleteSelections() { return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
m_pEdtEngine->DeleteRange(nStart, nCount);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::ReplaceSelections(const CFX_WideStringC& wsReplace) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
int32_t iCount = m_pEdtEngine->CountSelRanges();
for (int i = 0; i < iCount; i++) {
int32_t nStart;
@@ -649,20 +667,24 @@ FWL_ERR CFWL_EditImp::ReplaceSelections(const CFX_WideStringC& wsReplace) { FWL_ERR CFWL_EditImp::Replace(int32_t nStart,
int32_t nLen,
const CFX_WideStringC& wsReplace) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
m_pEdtEngine->Replace(nStart, nLen, wsReplace);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_EditImp::DoClipboard(int32_t iCmd) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) ||
(m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
return FWL_ERR_Succeeded;
}
IFWL_AdapterNative* pNative = FWL_GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(pNative, FWL_ERR_Indefinite);
+ if (!pNative)
+ return FWL_ERR_Indefinite;
IFWL_AdapterClipboardMgr* pClipBorder = pNative->GetClipboardMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pClipBorder, FWL_ERR_Indefinite);
+ if (!pClipBorder)
+ return FWL_ERR_Indefinite;
CFX_WideString wsText;
switch (iCmd) {
case 1: {
@@ -709,7 +731,8 @@ FWL_ERR CFWL_EditImp::DoClipboard(int32_t iCmd) { return FWL_ERR_Succeeded;
}
FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FALSE);
+ if (!m_pEdtEngine)
+ return FALSE;
int32_t nCount = m_pEdtEngine->CountSelRanges();
if (nCount == 0) {
return FALSE;
@@ -726,7 +749,8 @@ FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { return TRUE;
}
FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FALSE);
+ if (!m_pEdtEngine)
+ return FALSE;
int32_t nCount = m_pEdtEngine->CountSelRanges();
if (nCount == 0) {
return FALSE;
@@ -744,7 +768,8 @@ FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) { return TRUE;
}
FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FALSE);
+ if (!m_pEdtEngine)
+ return FALSE;
int32_t nCaret = m_pEdtEngine->GetCaretPos();
int32_t iError =
m_pEdtEngine->Insert(nCaret, wsPaste.c_str(), wsPaste.GetLength());
@@ -755,7 +780,8 @@ FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) { return TRUE;
}
FX_BOOL CFWL_EditImp::Delete() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FALSE);
+ if (!m_pEdtEngine)
+ return FALSE;
int32_t nCount = m_pEdtEngine->CountSelRanges();
if (nCount < 1) {
return FALSE;
@@ -764,14 +790,16 @@ FX_BOOL CFWL_EditImp::Delete() { return TRUE;
}
FX_BOOL CFWL_EditImp::Redo(const CFX_ByteStringC& bsRecord) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FALSE);
+ if (!m_pEdtEngine)
+ return FALSE;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) {
return TRUE;
}
return m_pEdtEngine->Redo(bsRecord);
}
FX_BOOL CFWL_EditImp::Undo(const CFX_ByteStringC& bsRecord) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FALSE);
+ if (!m_pEdtEngine)
+ return FALSE;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) {
return TRUE;
}
@@ -798,7 +826,8 @@ FX_BOOL CFWL_EditImp::CanRedo() { return m_iCurRecord < m_RecordArr.GetSize() - 1;
}
FWL_ERR CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FWL_ERR_Succeeded);
+ if (!m_pEdtEngine)
+ return FWL_ERR_Succeeded;
FDE_LPTXTEDTPARAMS pParams =
(FDE_LPTXTEDTPARAMS)m_pEdtEngine->GetEditParams();
pParams->fTabWidth = fTabWidth;
@@ -918,7 +947,8 @@ FX_BOOL CFWL_EditImp::On_PageLoad(IFDE_TxtEdtEngine* pEdit, int32_t nPurpose) {
IFDE_TxtEdtEngine* pEdtEngine = m_pEdtEngine;
IFDE_TxtEdtPage* pPage = pEdtEngine->GetPage(nPageIndex);
- _FWL_RETURN_VALUE_IF_FAIL(pPage, FALSE);
+ if (!pPage)
+ return FALSE;
pPage->LoadPage();
return TRUE;
}
@@ -927,7 +957,8 @@ FX_BOOL CFWL_EditImp::On_PageUnload(IFDE_TxtEdtEngine* pEdit, int32_t nPurpose) {
IFDE_TxtEdtEngine* pEdtEngine = m_pEdtEngine;
IFDE_TxtEdtPage* pPage = pEdtEngine->GetPage(nPageIndex);
- _FWL_RETURN_VALUE_IF_FAIL(pPage, FALSE);
+ if (!pPage)
+ return FALSE;
pPage->UnloadPage();
return TRUE;
}
@@ -1020,9 +1051,11 @@ void CFWL_EditImp::DrawTextBk(CFX_Graphics* pGraphics, void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(m_pEdtEngine);
+ if (!m_pEdtEngine)
+ return;
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
- _FWL_RETURN_IF_FAIL(pPage);
+ if (!pPage)
+ return;
pGraphics->SaveGraphState();
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText) {
pGraphics->SaveGraphState();
@@ -1086,11 +1119,14 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m);
}
CFX_RenderDevice* pRenderDev = pGraphics->GetRenderDevice();
- _FWL_RETURN_IF_FAIL(pRenderDev);
+ if (!pRenderDev)
+ return;
IFDE_RenderDevice* pRenderDevice = IFDE_RenderDevice::Create(pRenderDev);
- _FWL_RETURN_IF_FAIL(pRenderDevice);
+ if (!pRenderDevice)
+ return;
IFDE_RenderContext* pRenderContext = IFDE_RenderContext::Create();
- _FWL_RETURN_IF_FAIL(pRenderContext);
+ if (!pRenderContext)
+ return;
pRenderDevice->SetClipRect(rtClip);
pRenderContext->StartRender(pRenderDevice, (IFDE_CanvasSet*)pPage, mt);
pRenderContext->DoRender(NULL);
@@ -1208,17 +1244,21 @@ void CFWL_EditImp::UpdateEditParams() { params.dwMode |= FDE_TEXTEDITMODE_ReadOnly;
}
FX_FLOAT* pFontSize = (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_FontSize);
- _FWL_RETURN_IF_FAIL(pFontSize);
+ if (!pFontSize)
+ return;
m_fFontSize = *pFontSize;
FX_DWORD* pFontColor = (FX_DWORD*)GetThemeCapacity(FWL_WGTCAPACITY_TextColor);
- _FWL_RETURN_IF_FAIL(pFontColor);
+ if (!pFontColor)
+ return;
params.dwFontColor = *pFontColor;
FX_FLOAT* pLineHeight =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_LineHeight);
- _FWL_RETURN_IF_FAIL(pLineHeight);
+ if (!pLineHeight)
+ return;
params.fLineSpace = *pLineHeight;
IFX_Font* pFont = (IFX_Font*)GetThemeCapacity(FWL_WGTCAPACITY_Font);
- _FWL_RETURN_IF_FAIL(pFont);
+ if (!pFont)
+ return;
params.pFont = pFont;
params.fFontSize = m_fFontSize;
params.nLineCount = (int32_t)(params.fPlateHeight / params.fLineSpace);
@@ -1258,7 +1298,8 @@ FX_BOOL CFWL_EditImp::UpdateOffset() { const CFX_RectF& rtEidt = m_rtEngine;
if (rtEidt.Contains(rtCaret)) {
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
- _FWL_RETURN_VALUE_IF_FAIL(pPage, FALSE);
+ if (!pPage)
+ return FALSE;
CFX_RectF rtFDE = pPage->GetContentsBox();
rtFDE.Offset(fOffSetX, fOffSetY);
if (rtFDE.right() < rtEidt.right() && m_fScrollOffsetX > 0) {
@@ -1312,7 +1353,8 @@ FX_BOOL CFWL_EditImp::UpdateOffset(IFWL_ScrollBar* pScrollBar, }
void CFWL_EditImp::UpdateVAlignment() {
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
- _FWL_RETURN_IF_FAIL(pPage);
+ if (!pPage)
+ return;
const CFX_RectF& rtFDE = pPage->GetContentsBox();
FX_FLOAT fOffsetY = 0.0f;
FX_FLOAT fSpaceAbove = 0.0f;
@@ -1395,7 +1437,8 @@ IFWL_ScrollBar* CFWL_EditImp::UpdateScroll() { return NULL;
}
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
- _FWL_RETURN_VALUE_IF_FAIL(pPage, NULL);
+ if (!pPage)
+ return NULL;
const CFX_RectF& rtFDE = pPage->GetContentsBox();
IFWL_ScrollBar* pRepaint = NULL;
if (bShowHorz) {
@@ -1481,9 +1524,11 @@ FX_BOOL CFWL_EditImp::IsShowScrollBar(FX_BOOL bVert) { (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine);
}
FX_BOOL CFWL_EditImp::IsContentHeightOverflow() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pEdtEngine, FALSE);
+ if (!m_pEdtEngine)
+ return FALSE;
IFDE_TxtEdtPage* pPage = m_pEdtEngine->GetPage(0);
- _FWL_RETURN_VALUE_IF_FAIL(pPage, FALSE);
+ if (!pPage)
+ return FALSE;
return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f;
}
int32_t CFWL_EditImp::AddDoRecord(const CFX_ByteStringC& bsDoRecord) {
@@ -1506,7 +1551,8 @@ void CFWL_EditImp::Layout() { m_rtEngine = m_rtClient;
FX_FLOAT* pfWidth =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
- _FWL_RETURN_IF_FAIL(pfWidth);
+ if (!pfWidth)
+ return;
FX_FLOAT fWidth = *pfWidth;
if (!m_pOuter) {
CFX_RectF* pUIMargin =
@@ -1746,7 +1792,8 @@ void CFWL_EditImp::ProcessInsertError(int32_t iError) { CFWL_EditImpDelegate::CFWL_EditImpDelegate(CFWL_EditImp* pOwner)
: m_pOwner(pOwner) {}
int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
int32_t iRet = 1;
switch (dwMsgCode) {
@@ -1807,7 +1854,8 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { return iRet;
}
FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
- _FWL_RETURN_VALUE_IF_FAIL(pEvent, FWL_ERR_Indefinite);
+ if (!pEvent)
+ return FWL_ERR_Indefinite;
FX_DWORD dwHashCode = pEvent->GetClassID();
if (dwHashCode != FWL_EVTHASH_Scroll) {
return FWL_ERR_Succeeded;
@@ -1843,7 +1891,8 @@ void CFWL_EditImpDelegate::DoButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->UpdateEditEngine();
}
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
- _FWL_RETURN_IF_FAIL(pPage);
+ if (!pPage)
+ return;
CFX_PointF pt;
pt.Set(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
@@ -1922,10 +1971,12 @@ void CFWL_EditImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { m_pOwner->SetGrab(FALSE);
}
void CFWL_EditImpDelegate::OnButtonDblClk(CFWL_MsgMouse* pMsg) {
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pEdtEngine);
+ if (!m_pOwner->m_pEdtEngine)
+ return;
DoCursor(pMsg);
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
- _FWL_RETURN_IF_FAIL(pPage);
+ if (!pPage)
+ return;
CFX_PointF pt;
pt.Set(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
@@ -1939,13 +1990,15 @@ void CFWL_EditImpDelegate::OnButtonDblClk(CFWL_MsgMouse* pMsg) { m_pOwner->Repaint(&m_pOwner->m_rtEngine);
}
void CFWL_EditImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pEdtEngine);
+ if (!m_pOwner->m_pEdtEngine)
+ return;
DoCursor(pMsg);
if (m_pOwner->m_nSelStart == -1 || !m_pOwner->m_bLButtonDown) {
return;
}
IFDE_TxtEdtPage* pPage = m_pOwner->m_pEdtEngine->GetPage(0);
- _FWL_RETURN_IF_FAIL(pPage);
+ if (!pPage)
+ return;
CFX_PointF pt;
pt.Set(pMsg->m_fx, pMsg->m_fy);
m_pOwner->DeviceToEngine(pt);
@@ -1965,7 +2018,8 @@ void CFWL_EditImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { }
}
void CFWL_EditImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pEdtEngine);
+ if (!m_pOwner->m_pEdtEngine)
+ return;
FDE_TXTEDTMOVECARET MoveCaret = MC_MoveNone;
FX_BOOL bShift = pMsg->m_dwFlags & FWL_KEYFLAG_Shift;
FX_BOOL bCtrl = pMsg->m_dwFlags & FWL_KEYFLAG_Ctrl;
@@ -2058,7 +2112,8 @@ void CFWL_EditImpDelegate::OnChar(CFWL_MsgKey* pMsg) { (m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
return;
}
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pEdtEngine);
+ if (!m_pOwner->m_pEdtEngine)
+ return;
int32_t iError = 0;
FX_WCHAR c = (FX_WCHAR)pMsg->m_dwKeyCode;
int32_t nCaret = m_pOwner->m_pEdtEngine->GetCaretPos();
diff --git a/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp b/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp index 87752afa6e..d30e7e77eb 100644 --- a/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_formproxyimp.cpp @@ -31,8 +31,8 @@ FX_BOOL CFWL_FormProxyImp::IsInstance(const CFX_WideStringC& wsClass) const { return CFWL_FormImp::IsInstance(wsClass);
}
FWL_ERR CFWL_FormProxyImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_FormProxyImpDelegate(this);
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp index 9e207b37d3..589423c273 100644 --- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp @@ -91,8 +91,8 @@ FX_DWORD CFWL_ListBoxImp::GetClassID() const { return FWL_CLASSHASH_ListBox;
}
FWL_ERR CFWL_ListBoxImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_ListBoxImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -172,9 +172,10 @@ FX_DWORD CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { }
FWL_ERR CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
pGraphics->SaveGraphState();
if (HasBorder()) {
@@ -202,7 +203,8 @@ FWL_ERR CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
- _FWL_RETURN_VALUE_IF_FAIL(pThemeProvider, FWL_ERR_Indefinite);
+ if (!pThemeProvider)
+ return FWL_ERR_Indefinite;
if (!pThemeProvider->IsValidWidget(m_pInterface)) {
m_pScrollBarTP = pThemeProvider;
return FWL_ERR_Succeeded;
@@ -211,7 +213,8 @@ FWL_ERR CFWL_ListBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { return FWL_ERR_Succeeded;
}
int32_t CFWL_ListBoxImp::CountSelItems() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, 0);
+ if (!m_pProperties->m_pDataProvider)
+ return 0;
int32_t iRet = 0;
IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
int32_t iCount = pData->CountItems(m_pInterface);
@@ -228,7 +231,8 @@ int32_t CFWL_ListBoxImp::CountSelItems() { return iRet;
}
FWL_HLISTITEM CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, NULL);
+ if (!m_pProperties->m_pDataProvider)
+ return NULL;
int32_t index = 0;
IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
int32_t iCount = pData->CountItems(m_pInterface);
@@ -249,7 +253,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) { return NULL;
}
int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, -1);
+ if (!m_pProperties->m_pDataProvider)
+ return -1;
int32_t index = 0;
IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
int32_t iCount = pData->CountItems(m_pInterface);
@@ -270,7 +275,8 @@ int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) { return -1;
}
FWL_ERR CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, FWL_ERR_Indefinite);
+ if (!m_pProperties->m_pDataProvider)
+ return FWL_ERR_Indefinite;
if (!hItem) {
if (bSelect) {
SelectAll();
@@ -289,9 +295,11 @@ FWL_ERR CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { }
FWL_ERR CFWL_ListBoxImp::GetItemText(FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, FWL_ERR_Indefinite);
+ if (!m_pProperties->m_pDataProvider)
+ return FWL_ERR_Indefinite;
IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
pData->GetItemText(m_pInterface, hItem, wsText);
return FWL_ERR_Succeeded;
}
@@ -420,7 +428,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetFocusedItem() { int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
- _FWL_RETURN_VALUE_IF_FAIL(hItem, NULL);
+ if (!hItem)
+ return NULL;
if (pData->GetItemStyles(m_pInterface, hItem) & FWL_ITEMSTATE_LTB_Focused) {
return hItem;
}
@@ -471,7 +480,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { }
FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(FWL_HLISTITEM hItem,
CFX_RectF& rtCheck) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, FALSE);
+ if (!m_pProperties->m_pDataProvider)
+ return FALSE;
if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
return FALSE;
}
@@ -480,7 +490,8 @@ FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(FWL_HLISTITEM hItem, return TRUE;
}
FX_BOOL CFWL_ListBoxImp::GetItemChecked(FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, FALSE);
+ if (!m_pProperties->m_pDataProvider)
+ return FALSE;
if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
return FALSE;
}
@@ -489,7 +500,8 @@ FX_BOOL CFWL_ListBoxImp::GetItemChecked(FWL_HLISTITEM hItem) { FWL_ITEMSTATE_LTB_Checked);
}
FX_BOOL CFWL_ListBoxImp::SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider, FALSE);
+ if (!m_pProperties->m_pDataProvider)
+ return FALSE;
if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
return FALSE;
}
@@ -499,7 +511,8 @@ FX_BOOL CFWL_ListBoxImp::SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked) { return TRUE;
}
FX_BOOL CFWL_ListBoxImp::ScrollToVisible(FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pVertScrollBar, FALSE);
+ if (!m_pVertScrollBar)
+ return FALSE;
CFX_RectF rtItem;
IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
pData->GetItemRect(m_pInterface, hItem, rtItem);
@@ -524,8 +537,10 @@ FX_BOOL CFWL_ListBoxImp::ScrollToVisible(FWL_HLISTITEM hItem) { void CFWL_ListBoxImp::DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pTheme);
+ if (!pGraphics)
+ return;
+ if (!pTheme)
+ return;
CFWL_ThemeBackground param;
param.m_pWidget = m_pInterface;
param.m_iPart = FWL_PART_LTB_Background;
@@ -698,7 +713,8 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) {
CFX_SizeF fs;
fs.Set(0, 0);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider, fs);
+ if (!m_pProperties->m_pThemeProvider)
+ return fs;
GetClientRect(m_rtClient);
m_rtConent = m_rtClient;
CFX_RectF rtUIMargin;
@@ -898,12 +914,14 @@ FX_FLOAT CFWL_ListBoxImp::GetMaxTextWidth() { FX_FLOAT CFWL_ListBoxImp::GetScrollWidth() {
FX_FLOAT* pfWidth =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
- _FWL_RETURN_VALUE_IF_FAIL(pfWidth, 0);
+ if (!pfWidth)
+ return 0;
return *pfWidth;
}
FX_FLOAT CFWL_ListBoxImp::GetItemHeigt() {
FX_FLOAT* pfFont = (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_FontSize);
- _FWL_RETURN_VALUE_IF_FAIL(pfFont, 20);
+ if (!pfFont)
+ return 20;
return *pfFont + 2 * FWL_LISTBOX_ItemTextMargin;
}
void CFWL_ListBoxImp::InitScrollBar(FX_BOOL bVert) {
@@ -946,7 +964,8 @@ void CFWL_ListBoxImp::ProcessSelChanged() { CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner)
: m_pOwner(pOwner) {}
int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
if (!m_pOwner->IsEnabled()) {
return 1;
}
@@ -992,7 +1011,8 @@ int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { return iRet;
}
FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
- _FWL_RETURN_VALUE_IF_FAIL(pEvent, FWL_ERR_Indefinite);
+ if (!pEvent)
+ return FWL_ERR_Indefinite;
if (pEvent->GetClassID() != FWL_EVTHASH_Scroll) {
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp index 999f3249b6..656c820c75 100644 --- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp @@ -120,8 +120,8 @@ FX_DWORD CFWL_MonthCalendarImp::GetClassID() const { return FWL_CLASSHASH_MonthCalendar;
}
FWL_ERR CFWL_MonthCalendarImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_MonthCalendarImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -159,7 +159,8 @@ FWL_ERR CFWL_MonthCalendarImp::Update() { }
FWL_ERR CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
if (m_pProperties->m_pThemeProvider == NULL) {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
}
@@ -489,7 +490,8 @@ void CFWL_MonthCalendarImp::DrawDatesInCircle(CFX_Graphics* pGraphics, return;
}
LPDATEINFO pDate = (LPDATEINFO)m_arrDates[m_iDay - 1];
- _FWL_RETURN_IF_FAIL(pDate);
+ if (!pDate)
+ return;
CFWL_ThemeBackground params;
params.m_pWidget = m_pInterface;
params.m_iPart = FWL_PART_MCD_DateInCircle;
@@ -524,7 +526,8 @@ void CFWL_MonthCalendarImp::DrawTodayCircle(CFX_Graphics* pGraphics, CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) {
CFX_SizeF fs;
fs.Set(0, 0);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider, fs);
+ if (!m_pProperties->m_pThemeProvider)
+ return fs;
if (bAutoSize) {
CFWL_ThemePart params;
params.m_pWidget = m_pInterface;
@@ -939,7 +942,8 @@ FX_BOOL CFWL_MonthCalendarImp::GetDayRect(int32_t iDay, CFX_RectF& rtDay) { return FALSE;
}
LPDATEINFO pDateInfo = (LPDATEINFO)m_arrDates[iDay - 1];
- _FWL_RETURN_VALUE_IF_FAIL(pDateInfo, FALSE);
+ if (!pDateInfo)
+ return FALSE;
rtDay = pDateInfo->rect;
return TRUE;
}
@@ -948,7 +952,8 @@ CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( : m_pOwner(pOwner) {}
int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage(
CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
int32_t iRet = 1;
switch (dwMsgCode) {
diff --git a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp index 37b1ffe7fe..625080003b 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp @@ -51,8 +51,8 @@ FX_DWORD CFWL_PictureBoxImp::GetClassID() const { return FWL_CLASSHASH_PictureBox;
}
FWL_ERR CFWL_PictureBoxImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_PictureBoxImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -64,8 +64,8 @@ FWL_ERR CFWL_PictureBoxImp::Finalize() { FWL_ERR CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pDataProvider,
- FWL_ERR_Indefinite);
+ if (!m_pProperties->m_pDataProvider)
+ return FWL_ERR_Indefinite;
CFX_DIBitmap* pBitmap = ((IFWL_PictureBoxDP*)m_pProperties->m_pDataProvider)
->GetPicture(m_pInterface);
if (pBitmap) {
@@ -90,9 +90,10 @@ FWL_ERR CFWL_PictureBoxImp::Update() { }
FWL_ERR CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_ThemeProvider* pTheme = GetAvailableTheme();
if (HasBorder()) {
DrawBorder(pGraphics, FWL_PART_PTB_Border, pTheme, pMatrix);
@@ -106,7 +107,8 @@ FWL_ERR CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics, void CFWL_PictureBoxImp::DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(m_pProperties->m_pDataProvider);
+ if (!m_pProperties->m_pDataProvider)
+ return;
CFX_DIBitmap* pPicture = ((IFWL_PictureBoxDP*)m_pProperties->m_pDataProvider)
->GetPicture(m_pInterface);
CFX_Matrix matrix;
diff --git a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp index 3c21040604..3f730d9ee7 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp @@ -49,8 +49,8 @@ FX_DWORD CFWL_PushButtonImp::GetClassID() const { return FWL_CLASSHASH_PushButton;
}
FWL_ERR CFWL_PushButtonImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_PushButtonImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -108,9 +108,10 @@ FWL_ERR CFWL_PushButtonImp::Update() { }
FWL_ERR CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_PushButtonDP* pData = (IFWL_PushButtonDP*)m_pProperties->m_pDataProvider;
CFX_DIBitmap* pPicture = NULL;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
@@ -312,7 +313,8 @@ void CFWL_PushButtonImp::DrawBkground(CFX_Graphics* pGraphics, void CFWL_PushButtonImp::DrawText(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(m_pProperties->m_pDataProvider);
+ if (!m_pProperties->m_pDataProvider)
+ return;
CFX_WideString wsCaption;
m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
if (wsCaption.IsEmpty()) {
@@ -399,7 +401,8 @@ CFWL_PushButtonImpDelegate::CFWL_PushButtonImpDelegate( CFWL_PushButtonImp* pOwner)
: m_pOwner(pOwner) {}
int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
if (!m_pOwner->IsEnabled()) {
return 1;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp index a9d75d0fad..9ae21d2a5e 100644 --- a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp @@ -135,8 +135,8 @@ FX_DWORD CFWL_ScrollBarImp::GetClassID() const { return FWL_CLASSHASH_ScrollBar;
}
FWL_ERR CFWL_ScrollBarImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_ScrollBarImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -150,7 +150,8 @@ FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect.Set(0, 0, 0, 0);
FX_FLOAT* pfMinWidth =
(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
- _FWL_RETURN_VALUE_IF_FAIL(pfMinWidth, FWL_ERR_Indefinite);
+ if (!pfMinWidth)
+ return FWL_ERR_Indefinite;
if (IsVertical()) {
rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3);
} else {
@@ -174,9 +175,10 @@ FWL_ERR CFWL_ScrollBarImp::Update() { }
FWL_ERR CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (HasBorder()) {
DrawBorder(pGraphics, FWL_PART_SCB_Border, pTheme, pMatrix);
@@ -431,7 +433,8 @@ void CFWL_ScrollBarImp::CalcThumbButtonRect(CFX_RectF& rect) { if (fTrackPos < m_fRangeMin) {
fTrackPos = m_fRangeMin;
}
- _FWL_RETURN_IF_FAIL(fRange);
+ if (!fRange)
+ return;
if (m_bCustomLayout) {
FX_FLOAT iPos = fDiff * (fTrackPos - m_fRangeMin) / fRange;
rect.left = rtClient.left;
@@ -651,7 +654,8 @@ FX_BOOL CFWL_ScrollBarImp::OnScroll(FX_DWORD dwCode, FX_FLOAT fPos) { CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner)
: m_pOwner(pOwner) {}
int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
int32_t iRet = 1;
FX_DWORD dwMsgCode = pMessage->GetClassID();
if (dwMsgCode == FWL_MSGHASH_Mouse) {
diff --git a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp index 2b00584dd9..6ce662508a 100644 --- a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp @@ -66,8 +66,8 @@ FX_DWORD CFWL_SpinButtonImp::GetClassID() const { return FWL_CLASSHASH_SpinButton;
}
FWL_ERR CFWL_SpinButtonImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_SpinButtonImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -127,7 +127,8 @@ FX_DWORD CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { }
FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
CFX_RectF rtClip(m_rtClient);
if (pMatrix != NULL) {
pMatrix->TransformRect(rtClip);
@@ -206,7 +207,8 @@ CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate( CFWL_SpinButtonImp* pOwner)
: m_pOwner(pOwner) {}
int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
int32_t iRet = 1;
FX_DWORD dwMsgCode = pMessage->GetClassID();
switch (dwMsgCode) {
@@ -274,7 +276,8 @@ void CFWL_SpinButtonImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->m_bLButtonDwn = TRUE;
m_pOwner->SetGrab(TRUE);
m_pOwner->SetFocus(TRUE);
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pProperties->m_pDataProvider);
+ if (!m_pOwner->m_pProperties->m_pDataProvider)
+ return;
FX_BOOL bUpPress = (m_pOwner->m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy) &&
m_pOwner->IsButtonEnable(TRUE));
FX_BOOL bDnPress = (m_pOwner->m_rtDnButton.Contains(pMsg->m_fx, pMsg->m_fy) &&
@@ -327,7 +330,8 @@ void CFWL_SpinButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { }
}
void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pProperties->m_pDataProvider);
+ if (!m_pOwner->m_pProperties->m_pDataProvider)
+ return;
if (m_pOwner->m_bLButtonDwn) {
return;
}
@@ -395,7 +399,8 @@ void CFWL_SpinButtonImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { }
}
void CFWL_SpinButtonImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) {
- _FWL_RETURN_IF_FAIL(pMsg);
+ if (!pMsg)
+ return;
if (m_pOwner->m_dwUpState != FWL_PARTSTATE_SPB_Normal &&
m_pOwner->IsButtonEnable(TRUE)) {
m_pOwner->m_dwUpState = FWL_PARTSTATE_SPB_Normal;
@@ -407,7 +412,8 @@ void CFWL_SpinButtonImpDelegate::OnMouseLeave(CFWL_MsgMouse* pMsg) { m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
void CFWL_SpinButtonImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) {
- _FWL_RETURN_IF_FAIL(m_pOwner->m_pProperties->m_pDataProvider);
+ if (!m_pOwner->m_pProperties->m_pDataProvider)
+ return;
FX_BOOL bUp =
pMsg->m_dwKeyCode == FWL_VKEY_Up || pMsg->m_dwKeyCode == FWL_VKEY_Left;
FX_BOOL bDown =
diff --git a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp index f466764e39..ab9a163f15 100644 --- a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp @@ -77,8 +77,8 @@ FX_DWORD CFWL_ToolTipImp::GetClassID() const { FWL_ERR CFWL_ToolTipImp::Initialize() {
m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup;
m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child;
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
m_pDelegate = new CFWL_ToolTipImpDelegate(this);
return FWL_ERR_Succeeded;
}
@@ -149,9 +149,10 @@ FWL_ERR CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics, if (toolTipTarget && !toolTipTarget->UseDefaultTheme()) {
return toolTipTarget->DrawToolTip(pGraphics, pMatrix, m_pInterface);
}
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
DrawBkground(pGraphics, pTheme, pMatrix);
DrawText(pGraphics, pTheme, pMatrix);
@@ -177,7 +178,8 @@ void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics, void CFWL_ToolTipImp::DrawText(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(m_pProperties->m_pDataProvider);
+ if (!m_pProperties->m_pDataProvider)
+ return;
CFX_WideString wsCaption;
m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption);
if (wsCaption.IsEmpty()) {
diff --git a/xfa/src/fwl/src/core/fwl_appimp.cpp b/xfa/src/fwl/src/core/fwl_appimp.cpp index 948001c21d..5df995c9bb 100644 --- a/xfa/src/fwl/src/core/fwl_appimp.cpp +++ b/xfa/src/fwl/src/core/fwl_appimp.cpp @@ -68,7 +68,8 @@ IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() { }
IFWL_AdapterNative* FWL_GetAdapterNative() {
IFWL_App* pApp = FWL_GetApp();
- _FWL_RETURN_VALUE_IF_FAIL(pApp, NULL);
+ if (!pApp)
+ return NULL;
return pApp->GetAdapterNative();
}
IFWL_ThemeProvider* FWL_GetThemeProvider() {
@@ -82,11 +83,14 @@ void FWL_SetApp(IFWL_App* pApp) { _theApp = pApp;
}
FWL_ERR FWL_SetFullScreen(IFWL_Widget* pWidget, FX_BOOL bFullScreen) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FWL_ERR_Succeeded);
+ if (!pWidget)
+ return FWL_ERR_Succeeded;
IFWL_NoteThread* pNoteTread = pWidget->GetOwnerThread();
- _FWL_RETURN_VALUE_IF_FAIL(pNoteTread, FWL_ERR_Succeeded);
+ if (!pNoteTread)
+ return FWL_ERR_Succeeded;
CFWL_NoteDriver* pNoteDriver = (CFWL_NoteDriver*)pNoteTread->GetNoteDriver();
- _FWL_RETURN_VALUE_IF_FAIL(pNoteTread, FWL_ERR_Succeeded);
+ if (!pNoteTread)
+ return FWL_ERR_Succeeded;
pNoteDriver->NotifyFullScreenMode(pWidget, bFullScreen);
return FWL_GetAdapterWidgetMgr()->SetFullScreen(pWidget, bFullScreen);
}
diff --git a/xfa/src/fwl/src/core/fwl_contentimp.cpp b/xfa/src/fwl/src/core/fwl_contentimp.cpp index 986d7b0887..130b4cb1a1 100644 --- a/xfa/src/fwl/src/core/fwl_contentimp.cpp +++ b/xfa/src/fwl/src/core/fwl_contentimp.cpp @@ -52,24 +52,28 @@ CFWL_ContentImp::CFWL_ContentImp(const CFWL_WidgetImpProperties& properties) }
CFWL_ContentImp::~CFWL_ContentImp() {}
FWL_ERR CFWL_ContentImp::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) {
- _FWL_RETURN_VALUE_IF_FAIL(pChild, FWL_ERR_Indefinite);
+ if (!pChild)
+ return FWL_ERR_Indefinite;
pChild->SetParent(m_pInterface);
if (nIndex == -1) {
return FWL_ERR_Succeeded;
}
CFWL_WidgetMgr* pMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pMgr, FWL_ERR_Indefinite);
+ if (!pMgr)
+ return FWL_ERR_Indefinite;
pMgr->SetWidgetIndex(pChild, nIndex);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ContentImp::RemoveWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FWL_ERR_Indefinite);
+ if (!pWidget)
+ return FWL_ERR_Indefinite;
pWidget->SetParent(NULL);
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ContentImp::RemoveAllWidgets() {
CFWL_WidgetMgr* pMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pMgr, FWL_ERR_Indefinite);
+ if (!pMgr)
+ return FWL_ERR_Indefinite;
while (IFWL_Widget* widget =
pMgr->GetWidget(m_pInterface, FWL_WGTRELATION_FirstChild)) {
pMgr->SetParent(NULL, widget);
diff --git a/xfa/src/fwl/src/core/fwl_formimp.cpp b/xfa/src/fwl/src/core/fwl_formimp.cpp index b72afdf5c3..7a532ec887 100644 --- a/xfa/src/fwl/src/core/fwl_formimp.cpp +++ b/xfa/src/fwl/src/core/fwl_formimp.cpp @@ -131,8 +131,8 @@ FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { return CFWL_PanelImp::IsInstance(wsClass);
}
FWL_ERR CFWL_FormImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_WidgetImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
RegisterForm();
RegisterEventTarget();
m_pDelegate = new CFWL_FormImpDelegate(this);
@@ -171,7 +171,8 @@ FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { #ifdef FWL_UseMacSystemBorder
rect = m_rtRelative;
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, FWL_ERR_Indefinite);
+ if (!pWidgetMgr)
+ return FWL_ERR_Indefinite;
IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
FX_FLOAT l, t, r, b;
l = t = r = b = 0;
@@ -289,9 +290,10 @@ FX_DWORD CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { }
FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties->m_pThemeProvider,
- FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
+ if (!m_pProperties->m_pThemeProvider)
+ return FWL_ERR_Indefinite;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
FX_BOOL bInactive = !IsActive();
int32_t iState =
@@ -414,9 +416,11 @@ FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { }
IFWL_Widget* CFWL_FormImp::DoModal() {
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_VALUE_IF_FAIL(pThread, NULL);
+ if (!pThread)
+ return NULL;
IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
- _FWL_RETURN_VALUE_IF_FAIL(pDriver, NULL);
+ if (!pDriver)
+ return NULL;
m_pNoteLoop = new CFWL_NoteLoop(this);
pDriver->PushNoteLoop((IFWL_NoteLoop*)m_pNoteLoop);
m_bDoModalFlag = TRUE;
@@ -434,14 +438,17 @@ IFWL_Widget* CFWL_FormImp::DoModal(FX_DWORD& dwCommandID) { return DoModal();
}
FWL_ERR CFWL_FormImp::EndDoModal() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pNoteLoop, FWL_ERR_Indefinite);
+ if (!m_pNoteLoop)
+ return FWL_ERR_Indefinite;
m_bDoModalFlag = FALSE;
#if (_FX_OS_ == _FX_MACOSX_)
m_pNoteLoop->EndModalLoop();
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_VALUE_IF_FAIL(pThread, NULL);
+ if (!pThread)
+ return NULL;
CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
- _FWL_RETURN_VALUE_IF_FAIL(pDriver, NULL);
+ if (!pDriver)
+ return NULL;
pDriver->PopNoteLoop();
SetStates(FWL_WGTSTATE_Invisible, TRUE);
return FWL_ERR_Succeeded;
@@ -474,7 +481,8 @@ CFX_MapAccelerators& CFWL_FormImp::GetAccelerator() { return m_mapAccelerators;
}
void CFWL_FormImp::SetAccelerator(CFX_MapAccelerators* pAccelerators) {
- _FWL_RETURN_IF_FAIL(pAccelerators);
+ if (!pAccelerators)
+ return;
m_mapAccelerators.RemoveAll();
FX_DWORD vrKey, rValue;
FX_POSITION pos = pAccelerators->GetStartPosition();
@@ -485,9 +493,11 @@ void CFWL_FormImp::SetAccelerator(CFX_MapAccelerators* pAccelerators) { }
void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) {
IFWL_App* pApp = FWL_GetApp();
- _FWL_RETURN_IF_FAIL(pApp);
+ if (!pApp)
+ return;
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)pApp->GetWidgetMgr();
- _FWL_RETURN_IF_FAIL(pWidgetMgr);
+ if (!pWidgetMgr)
+ return;
IFWL_Widget* pChild =
pWidgetMgr->GetWidget(pParent, FWL_WGTRELATION_FirstChild);
while (pChild) {
@@ -594,7 +604,8 @@ FX_FLOAT CFWL_FormImp::GetCaptionHeight() { }
if (dwCapacity > 0) {
FX_FLOAT* pfCapHeight = (FX_FLOAT*)GetThemeCapacity(dwCapacity);
- _FWL_RETURN_VALUE_IF_FAIL(pfCapHeight, 0);
+ if (!pfCapHeight)
+ return 0;
return *pfCapHeight;
}
return 0;
@@ -659,7 +670,8 @@ void CFWL_FormImp::GetEdgeRect(CFX_RectF& rtEdge) { void CFWL_FormImp::SetWorkAreaRect() {
m_rtRestore = m_pProperties->m_rtWidget;
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_IF_FAIL(pWidgetMgr);
+ if (!pWidgetMgr)
+ return;
m_bSetMaximize = TRUE;
pWidgetMgr->SetMaximize_Native(m_pInterface);
Repaint(&m_rtRelative);
@@ -667,7 +679,8 @@ void CFWL_FormImp::SetWorkAreaRect() { void CFWL_FormImp::SetCursor(FX_FLOAT fx, FX_FLOAT fy) {
IFWL_AdapterNative* pNative = FWL_GetAdapterNative();
IFWL_AdapterCursorMgr* pCursorMgr = pNative->GetCursorMgr();
- _FWL_RETURN_IF_FAIL(pCursorMgr);
+ if (!pCursorMgr)
+ return;
FX_DWORD dwHitTest = HitTest(fx, fy);
switch (dwHitTest) {
case FWL_WGTHITTEST_Right: {
@@ -845,16 +858,20 @@ void CFWL_FormImp::ReSetSysBtn() { }
void CFWL_FormImp::RegisterForm() {
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pDriver);
+ if (!pDriver)
+ return;
pDriver->RegisterForm(this);
}
void CFWL_FormImp::UnRegisterForm() {
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pDriver);
+ if (!pDriver)
+ return;
pDriver->UnRegisterForm(this);
}
FX_BOOL CFWL_FormImp::IsDoModal() {
@@ -870,7 +887,8 @@ FX_BOOL CFWL_FormImp::HasIcon() { }
void CFWL_FormImp::UpdateIcon() {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_IF_FAIL(pWidgetMgr);
+ if (!pWidgetMgr)
+ return;
IFWL_FormDP* pData = (IFWL_FormDP*)m_pProperties->m_pDataProvider;
CFX_DIBitmap* pBigIcon = pData->GetIcon(m_pInterface, TRUE);
CFX_DIBitmap* pSmallIcon = pData->GetIcon(m_pInterface, FALSE);
@@ -885,9 +903,11 @@ void CFWL_FormImp::UpdateIcon() { }
void CFWL_FormImp::UpdateCaption() {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_IF_FAIL(pWidgetMgr);
+ if (!pWidgetMgr)
+ return;
IFWL_FormDP* pData = (IFWL_FormDP*)m_pProperties->m_pDataProvider;
- _FWL_RETURN_IF_FAIL(pData);
+ if (!pData)
+ return;
CFX_WideString text;
pData->GetCaption(m_pInterface, text);
pWidgetMgr->SetWidgetCaption_Native(m_pInterface, text);
@@ -946,7 +966,8 @@ CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) }
int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
#ifdef FWL_UseMacSystemBorder
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
int32_t iRet = 1;
switch (dwMsgCode) {
@@ -963,7 +984,8 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { }
return FWL_ERR_Succeeded;
#else
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
+ if (!pMessage)
+ return 0;
FX_DWORD dwMsgCode = pMessage->GetClassID();
int32_t iRet = 1;
switch (dwMsgCode) {
@@ -1033,7 +1055,8 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { }
case FWL_MSGHASH_Size: {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, 0);
+ if (!pWidgetMgr)
+ return 0;
pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface);
if (!m_pOwner->m_bSetMaximize) {
break;
@@ -1063,7 +1086,8 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { #endif
}
FWL_ERR CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
- _FWL_RETURN_VALUE_IF_FAIL(pEvent, FWL_ERR_Indefinite);
+ if (!pEvent)
+ return FWL_ERR_Indefinite;
if (pEvent->GetClassID() == FWL_EVTHASH_Close &&
pEvent->m_pSrcTarget == m_pOwner->m_pInterface) {
}
@@ -1125,7 +1149,8 @@ void CFWL_FormImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { m_pOwner->m_bMaximized = !m_pOwner->m_bMaximized;
} else if (pPressedBtn == m_pOwner->m_pMinBox) {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_IF_FAIL(pWidgetMgr);
+ if (!pWidgetMgr)
+ return;
pWidgetMgr->SetMinimize_Native(m_pOwner->m_pInterface);
} else {
CFWL_EvtClose eClose;
@@ -1138,7 +1163,8 @@ void CFWL_FormImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) { if (m_pOwner->m_bLButtonDown) {
IFWL_AdapterNative* pNative = FWL_GetAdapterNative();
IFWL_AdapterCursorMgr* pCursorMgr = pNative->GetCursorMgr();
- _FWL_RETURN_IF_FAIL(pCursorMgr);
+ if (!pCursorMgr)
+ return;
CFWL_SysBtn* pPressedBtn =
m_pOwner->GetSysBtnByIndex(m_pOwner->m_iCaptureBtn);
FX_FLOAT fTop, fLeft, fWidth, fHeight;
@@ -1421,6 +1447,7 @@ void CFWL_FormImpDelegate::OnClose(CFWL_MsgClose* pMsg) { FWL_ERR FWL_Accelerator_SetForm(IFWL_Form* pFrom,
CFX_MapAccelerators* pMapAccel) {
CFWL_FormImp* pImp = static_cast<CFWL_FormImp*>(pFrom->GetImpl());
- _FWL_RETURN_VALUE_IF_FAIL(pImp, FWL_ERR_Indefinite);
+ if (!pImp)
+ return FWL_ERR_Indefinite;
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/core/fwl_gridimp.cpp b/xfa/src/fwl/src/core/fwl_gridimp.cpp index 251464e80f..d647fe5a99 100644 --- a/xfa/src/fwl/src/core/fwl_gridimp.cpp +++ b/xfa/src/fwl/src/core/fwl_gridimp.cpp @@ -181,14 +181,14 @@ FX_DWORD CFWL_GridImp::GetClassID() const { return FWL_CLASSHASH_Grid;
}
FWL_ERR CFWL_GridImp::Initialize() {
- _FWL_ERR_CHECK_RETURN_VALUE_IF_FAIL(CFWL_ContentImp::Initialize(),
- FWL_ERR_Indefinite);
+ if (CFWL_ContentImp::Initialize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
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 (CFWL_ContentImp::Finalize() != FWL_ERR_Succeeded)
+ return FWL_ERR_Indefinite;
delete m_pDelegate;
m_pDelegate = nullptr;
return FWL_ERR_Succeeded;
@@ -219,7 +219,8 @@ FWL_ERR CFWL_GridImp::Update() { }
FWL_ERR CFWL_GridImp::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
if ((m_pProperties->m_dwStyleExes & FWL_GRIDSTYLEEXT_ShowGridLines) == 0) {
return FWL_ERR_Succeeded;
}
@@ -265,7 +266,8 @@ FWL_ERR CFWL_GridImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_GridImp::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) {
- _FWL_RETURN_VALUE_IF_FAIL(pChild, FWL_ERR_Indefinite);
+ if (!pChild)
+ return FWL_ERR_Indefinite;
CFWL_ContentImp::InsertWidget(pChild, nIndex);
if (!m_mapWidgetInfo.GetValueAt(pChild)) {
CFWL_GridWidgetInfo* pInfo = new CFWL_GridWidgetInfo;
@@ -275,7 +277,8 @@ FWL_ERR CFWL_GridImp::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) { return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_GridImp::RemoveWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FWL_ERR_Indefinite);
+ if (!pWidget)
+ return FWL_ERR_Indefinite;
CFWL_ContentImp::RemoveWidget(pWidget);
if (CFWL_GridWidgetInfo* pInfo =
(CFWL_GridWidgetInfo*)m_mapWidgetInfo.GetValueAt(pWidget)) {
@@ -327,7 +330,8 @@ int32_t CFWL_GridImp::GetIndex(FWL_HGRIDCOLROW hColRow) { return m_Rows.Find(hColRow);
}
FX_FLOAT CFWL_GridImp::GetSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit) {
- _FWL_RETURN_VALUE_IF_FAIL(hColRow, -1);
+ if (!hColRow)
+ return -1;
CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
eUnit = pColRow->m_Size.eUnit;
return pColRow->m_Size.fLength;
@@ -335,7 +339,8 @@ FX_FLOAT CFWL_GridImp::GetSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit) { FWL_ERR CFWL_GridImp::SetSize(FWL_HGRIDCOLROW hColRow,
FX_FLOAT fSize,
FWL_GRIDUNIT eUnit) {
- _FWL_RETURN_VALUE_IF_FAIL(hColRow, FWL_ERR_Indefinite);
+ if (!hColRow)
+ return FWL_ERR_Indefinite;
CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
pColRow->m_Size.eUnit = eUnit;
pColRow->m_Size.fLength = fSize;
@@ -343,7 +348,8 @@ FWL_ERR CFWL_GridImp::SetSize(FWL_HGRIDCOLROW hColRow, }
FX_FLOAT CFWL_GridImp::GetMinSize(FWL_HGRIDCOLROW hColRow,
FWL_GRIDUNIT& eUnit) {
- _FWL_RETURN_VALUE_IF_FAIL(hColRow, -1);
+ if (!hColRow)
+ return -1;
CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
eUnit = pColRow->m_MinSize.eUnit;
return pColRow->m_MinSize.fLength;
@@ -351,7 +357,8 @@ FX_FLOAT CFWL_GridImp::GetMinSize(FWL_HGRIDCOLROW hColRow, FWL_ERR CFWL_GridImp::SetMinSize(FWL_HGRIDCOLROW hColRow,
FX_FLOAT fSize,
FWL_GRIDUNIT eUnit) {
- _FWL_RETURN_VALUE_IF_FAIL(hColRow, FWL_ERR_Indefinite);
+ if (!hColRow)
+ return FWL_ERR_Indefinite;
CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
pColRow->m_MinSize.eUnit = eUnit;
pColRow->m_MinSize.fLength = fSize;
@@ -359,7 +366,8 @@ FWL_ERR CFWL_GridImp::SetMinSize(FWL_HGRIDCOLROW hColRow, }
FX_FLOAT CFWL_GridImp::GetMaxSize(FWL_HGRIDCOLROW hColRow,
FWL_GRIDUNIT& eUnit) {
- _FWL_RETURN_VALUE_IF_FAIL(hColRow, -1);
+ if (!hColRow)
+ return -1;
CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
eUnit = pColRow->m_MaxSize.eUnit;
return pColRow->m_MaxSize.fLength;
@@ -367,7 +375,8 @@ FX_FLOAT CFWL_GridImp::GetMaxSize(FWL_HGRIDCOLROW hColRow, FWL_ERR CFWL_GridImp::SetMaxSize(FWL_HGRIDCOLROW hColRow,
FX_FLOAT fSize,
FWL_GRIDUNIT eUnit) {
- _FWL_RETURN_VALUE_IF_FAIL(hColRow, FWL_ERR_Indefinite);
+ if (!hColRow)
+ return FWL_ERR_Indefinite;
CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
pColRow->m_MaxSize.eUnit = eUnit;
pColRow->m_MaxSize.fLength = fSize;
@@ -510,7 +519,8 @@ void CFWL_GridImp::ProcFixedColRow(CFWL_GridColRow* pColRow, void CFWL_GridImp::ProcAutoColRow(CFWL_GridColRow* pColRow,
int32_t nIndex,
FX_BOOL bColumn) {
- _FWL_RETURN_IF_FAIL(pColRow);
+ if (!pColRow)
+ return;
FX_FLOAT fMaxSize = 0, fWidgetSize = 0;
FX_POSITION ps = m_mapWidgetInfo.GetStartPosition();
while (ps) {
@@ -1226,7 +1236,8 @@ void CFWL_GridImp::SetAllWidgetsRect() { }
}
FX_BOOL CFWL_GridImp::IsGrid(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_Grid;
}
void CFWL_GridImp::SetSpanAutoColRowSize(const CFX_PtrArray& spanAutos,
diff --git a/xfa/src/fwl/src/core/fwl_noteimp.cpp b/xfa/src/fwl/src/core/fwl_noteimp.cpp index 0723b71231..149b80f26c 100644 --- a/xfa/src/fwl/src/core/fwl_noteimp.cpp +++ b/xfa/src/fwl/src/core/fwl_noteimp.cpp @@ -29,9 +29,11 @@ FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { {
CFWL_EvtIdle ev;
IFWL_App* pApp = FWL_GetApp();
- _FWL_RETURN_VALUE_IF_FAIL(pApp, FWL_ERR_Indefinite);
+ if (!pApp)
+ return FWL_ERR_Indefinite;
IFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
- _FWL_RETURN_VALUE_IF_FAIL(pDriver, FWL_ERR_Indefinite);
+ if (!pDriver)
+ return FWL_ERR_Indefinite;
pDriver->SendNote(&ev);
}
return FWL_ERR_Indefinite;
@@ -84,9 +86,11 @@ void CFWL_NoteLoop::GenerateCommondEvent(FX_DWORD dwCommand) { CFWL_EvtMenuCommand ev;
ev.m_iCommand = dwCommand;
IFWL_NoteThread* pThread = m_pForm->GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pDriver);
+ if (!pDriver)
+ return;
pDriver->SendNote(&ev);
}
CFWL_NoteDriver::CFWL_NoteDriver()
@@ -141,7 +145,8 @@ FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) { }
m_sendEventCalled--;
} else {
- _FWL_RETURN_VALUE_IF_FAIL(pNote->m_pDstTarget, FALSE);
+ if (!pNote->m_pDstTarget)
+ return FALSE;
IFWL_WidgetDelegate* pDelegate = pNote->m_pDstTarget->SetDelegate(NULL);
if (pDelegate) {
pDelegate->OnProcessMessage((CFWL_Message*)pNote);
@@ -206,7 +211,8 @@ FWL_ERR CFWL_NoteDriver::PushNoteLoop(IFWL_NoteLoop* pNoteLoop) { }
IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
int32_t pos = m_noteLoopQueue.GetSize();
- _FWL_RETURN_VALUE_IF_FAIL(pos > 0, NULL);
+ if (pos <= 0)
+ return NULL;
IFWL_NoteLoop* p = (IFWL_NoteLoop*)m_noteLoopQueue.GetAt(pos - 1);
m_noteLoopQueue.RemoveAt(pos - 1);
return p;
@@ -253,7 +259,8 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { }
FWL_ERR CFWL_NoteDriver::Run() {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, FWL_ERR_Indefinite);
+ if (!pWidgetMgr)
+ return FWL_ERR_Indefinite;
#if (_FX_OS_ == _FX_MACOSX_)
IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
CFWL_NoteLoop* pTopLoop = GetTopLoop();
@@ -349,7 +356,8 @@ void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) { continue;
}
CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
- _FWL_RETURN_IF_FAIL(pSubFocus);
+ if (!pSubFocus)
+ return;
if (pSubFocus && pSubFocus->GetInterface() == pNoteTarget) {
pForm->SetSubFocus(NULL);
}
@@ -360,20 +368,23 @@ void CFWL_NoteDriver::NotifyFullScreenMode(IFWL_Widget* pNoteTarget, m_bFullScreen = bFullScreen;
}
FWL_ERR CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) {
- _FWL_RETURN_VALUE_IF_FAIL(pForm, FWL_ERR_Indefinite);
+ if (!pForm)
+ return FWL_ERR_Indefinite;
if (m_forms.Find(pForm) >= 0) {
return FWL_ERR_Indefinite;
}
m_forms.Add(pForm);
if (m_forms.GetSize() == 1) {
CFWL_NoteLoop* pLoop = (CFWL_NoteLoop*)m_noteLoopQueue.GetAt(0);
- _FWL_RETURN_VALUE_IF_FAIL(pLoop, FWL_ERR_Indefinite);
+ if (!pLoop)
+ return FWL_ERR_Indefinite;
pLoop->SetMainForm(pForm);
}
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) {
- _FWL_RETURN_VALUE_IF_FAIL(pForm, FWL_ERR_Indefinite);
+ if (!pForm)
+ return FWL_ERR_Indefinite;
int32_t nIndex = m_forms.Find(pForm);
if (nIndex < 0) {
return FWL_ERR_Indefinite;
@@ -408,7 +419,8 @@ FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) { }
CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() {
int32_t size = m_noteLoopQueue.GetSize();
- _FWL_RETURN_VALUE_IF_FAIL(size > 0, NULL);
+ if (size <= 0)
+ return NULL;
return (CFWL_NoteLoop*)m_noteLoopQueue[size - 1];
}
int32_t CFWL_NoteDriver::CountLoop() {
@@ -423,7 +435,8 @@ FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) { IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled()
? pMessage->m_pDstTarget
: GetMessageForm(pMessage->m_pDstTarget);
- _FWL_RETURN_VALUE_IF_FAIL(pMessageForm, FALSE);
+ if (!pMessageForm)
+ return FALSE;
if (DispatchMessage(pMessage, pMessageForm)) {
if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) {
MouseSecondary((CFWL_MsgMouse*)pMessage);
@@ -515,7 +528,8 @@ FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, return FALSE;
}
int32_t iTrackLoop = m_noteLoopQueue.GetSize();
- _FWL_RETURN_VALUE_IF_FAIL(iTrackLoop > 0, FALSE);
+ if (iTrackLoop <= 0)
+ return FALSE;
if (iTrackLoop == 1) {
if (pMessageForm->IsInstance(FX_WSTRC(L"FWL_FORMPROXY"))) {
return FALSE;
@@ -530,7 +544,8 @@ FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg, return TRUE;
}
IFWL_Widget* pDst = pMsg->m_pDstTarget;
- _FWL_RETURN_VALUE_IF_FAIL(pDst, FALSE);
+ if (!pDst)
+ return FALSE;
#if (_FX_OS_ == _FX_MACOSX_)
if (pDst == pMessageForm && pDst->IsInstance(L"FWL_FORMPROXY")) {
return TRUE;
@@ -649,7 +664,8 @@ FX_BOOL CFWL_NoteDriver::DoMouse(CFWL_MsgMouse* pMsg, FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg,
IFWL_Widget* pMessageForm) {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, FALSE);
+ if (!pWidgetMgr)
+ return FALSE;
IFWL_Widget* pDst =
pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
if (!pDst) {
@@ -664,7 +680,8 @@ FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg, }
FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, FALSE);
+ if (!pWidgetMgr)
+ return FALSE;
pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth,
(FX_FLOAT)pMsg->m_iHeight);
return TRUE;
@@ -680,7 +697,8 @@ FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg, FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
IFWL_Widget* pMessageForm) {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, FALSE);
+ if (!pWidgetMgr)
+ return FALSE;
IFWL_Widget* pTarget = NULL;
if (m_pGrab) {
{ pTarget = m_pGrab; }
@@ -754,7 +772,8 @@ FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) { }
IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) {
int32_t iTrackLoop = m_noteLoopQueue.GetSize();
- _FWL_RETURN_VALUE_IF_FAIL(iTrackLoop > 0, NULL);
+ if (iTrackLoop <= 0)
+ return NULL;
IFWL_Widget* pMessageForm = NULL;
if (iTrackLoop > 1) {
CFWL_NoteLoop* pNootLoop = (CFWL_NoteLoop*)m_noteLoopQueue[iTrackLoop - 1];
@@ -764,7 +783,8 @@ IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) { }
if (!pMessageForm && pDstTarget) {
CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, NULL);
+ if (!pWidgetMgr)
+ return NULL;
pMessageForm =
pWidgetMgr->GetWidget(pDstTarget, FWL_WGTRELATION_SystemForm);
}
@@ -837,7 +857,8 @@ int32_t CFWL_EventTarget::SetEventSource(IFWL_Widget* pSource, }
FX_BOOL CFWL_EventTarget::ProcessEvent(CFWL_Event* pEvent) {
IFWL_WidgetDelegate* pDelegate = m_pListener->SetDelegate(NULL);
- _FWL_RETURN_VALUE_IF_FAIL(pDelegate, FALSE);
+ if (!pDelegate)
+ return FALSE;
if (m_eventSources.GetCount() == 0) {
pDelegate->OnProcessEvent(pEvent);
return TRUE;
@@ -1057,16 +1078,20 @@ FWL_ERR FWL_SetToolTipAutoPopDelay(int32_t nDelayTime) { nDelayTime);
}
IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread) {
- _FWL_RETURN_VALUE_IF_FAIL(pNoteThread, NULL);
+ if (!pNoteThread)
+ return NULL;
CFWL_NoteDriver* noteDriver = (CFWL_NoteDriver*)pNoteThread->GetNoteDriver();
- _FWL_RETURN_VALUE_IF_FAIL(noteDriver, NULL);
+ if (!noteDriver)
+ return NULL;
if (noteDriver->CountLoop() == 1) {
return NULL;
}
CFWL_NoteLoop* topLoop = noteDriver->GetTopLoop();
- _FWL_RETURN_VALUE_IF_FAIL(topLoop, NULL);
+ if (!topLoop)
+ return NULL;
CFWL_WidgetImp* widget = topLoop->GetForm();
- _FWL_RETURN_VALUE_IF_FAIL(widget, NULL);
+ if (!widget)
+ return NULL;
return widget->GetInterface();
}
FWL_ERR FWL_SetHook(IFWL_NoteDriver* driver,
diff --git a/xfa/src/fwl/src/core/fwl_panelimp.cpp b/xfa/src/fwl/src/core/fwl_panelimp.cpp index 591bfcb7d5..991ce226ab 100644 --- a/xfa/src/fwl/src/core/fwl_panelimp.cpp +++ b/xfa/src/fwl/src/core/fwl_panelimp.cpp @@ -56,7 +56,8 @@ FWL_ERR CFWL_PanelImp::Update() { GetClientRect(rtClient);
FWL_GRIDUNIT eWidth = FWL_GRIDUNIT_Fixed, eHeight = FWL_GRIDUNIT_Fixed;
IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, FWL_ERR_Indefinite);
+ if (!pWidgetMgr)
+ return FWL_ERR_Indefinite;
IFWL_Widget* pParent =
pWidgetMgr->GetWidget((IFWL_Widget*)this, FWL_WGTRELATION_Parent);
if (pParent && pParent->GetClassID() == FWL_CLASSHASH_Grid) {
@@ -75,7 +76,8 @@ IFWL_Content* CFWL_PanelImp::GetContent() { return m_pContent;
}
FWL_ERR CFWL_PanelImp::SetContent(IFWL_Content* pContent) {
- _FWL_RETURN_VALUE_IF_FAIL(pContent, FWL_ERR_Indefinite);
+ if (!pContent)
+ return FWL_ERR_Indefinite;
m_pContent = pContent;
return pContent->SetParent(m_pInterface);
}
@@ -119,7 +121,8 @@ IFWL_Content* CFWL_CustomPanelImp::GetContent() { return m_pContent;
}
FWL_ERR CFWL_CustomPanelImp::SetContent(IFWL_Content* pContent) {
- _FWL_RETURN_VALUE_IF_FAIL(pContent, FWL_ERR_Indefinite);
+ if (!pContent)
+ return FWL_ERR_Indefinite;
m_pContent = pContent;
return pContent->SetParent(m_pInterface);
}
diff --git a/xfa/src/fwl/src/core/fwl_threadimp.cpp b/xfa/src/fwl/src/core/fwl_threadimp.cpp index 331f336efd..9a298be394 100644 --- a/xfa/src/fwl/src/core/fwl_threadimp.cpp +++ b/xfa/src/fwl/src/core/fwl_threadimp.cpp @@ -41,7 +41,8 @@ CFWL_NoteThread::~CFWL_NoteThread() { }
}
FWL_ERR CFWL_NoteThread::Run(FWL_HTHREAD hThread) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pNoteDriver, FWL_ERR_Indefinite);
+ if (!m_pNoteDriver)
+ return FWL_ERR_Indefinite;
FWL_ERR result = m_pNoteDriver->Run();
return result;
}
@@ -51,39 +52,49 @@ IFWL_NoteDriver* CFWL_NoteThread::GetNoteDriver() { extern IFWL_AdapterNative* FWL_GetAdapterNative();
FWL_HTHREAD FWL_StartThread(IFWL_Thread* pThread, FX_BOOL bSuspended) {
IFWL_AdapterNative* pNative = FWL_GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(pNative, NULL);
+ if (!pNative)
+ return NULL;
IFWL_AdapterThreadMgr* pThreadMgr = pNative->GetThreadMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pThreadMgr, NULL);
+ if (!pThreadMgr)
+ return NULL;
FWL_HTHREAD hThread = NULL;
pThreadMgr->Start(pThread, hThread, bSuspended);
return hThread;
}
FWL_ERR FWL_ResumeThread(FWL_HTHREAD hThread) {
IFWL_AdapterNative* Native = FWL_GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(Native, FWL_ERR_Indefinite);
+ if (!Native)
+ return FWL_ERR_Indefinite;
IFWL_AdapterThreadMgr* ThreadMgr = Native->GetThreadMgr();
- _FWL_RETURN_VALUE_IF_FAIL(ThreadMgr, FWL_ERR_Indefinite);
+ if (!ThreadMgr)
+ return FWL_ERR_Indefinite;
return ThreadMgr->Resume(hThread);
}
FWL_ERR FWL_SuspendThread(FWL_HTHREAD hThread) {
IFWL_AdapterNative* Native = FWL_GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(Native, FWL_ERR_Indefinite);
+ if (!Native)
+ return FWL_ERR_Indefinite;
IFWL_AdapterThreadMgr* ThreadMgr = Native->GetThreadMgr();
- _FWL_RETURN_VALUE_IF_FAIL(ThreadMgr, FWL_ERR_Indefinite);
+ if (!ThreadMgr)
+ return FWL_ERR_Indefinite;
return ThreadMgr->Suspend(hThread);
}
FWL_ERR FWL_KillThread(FWL_HTHREAD hThread, int32_t iExitCode) {
IFWL_AdapterNative* Native = FWL_GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(Native, FWL_ERR_Indefinite);
+ if (!Native)
+ return FWL_ERR_Indefinite;
IFWL_AdapterThreadMgr* ThreadMgr = Native->GetThreadMgr();
- _FWL_RETURN_VALUE_IF_FAIL(ThreadMgr, FWL_ERR_Indefinite);
+ if (!ThreadMgr)
+ return FWL_ERR_Indefinite;
return ThreadMgr->Kill(hThread, iExitCode);
}
FWL_ERR FWL_StopThread(FWL_HTHREAD hThread, int32_t iExitCode) {
IFWL_AdapterNative* Native = FWL_GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(Native, FWL_ERR_Indefinite);
+ if (!Native)
+ return FWL_ERR_Indefinite;
IFWL_AdapterThreadMgr* ThreadMgr = Native->GetThreadMgr();
- _FWL_RETURN_VALUE_IF_FAIL(ThreadMgr, FWL_ERR_Indefinite);
+ if (!ThreadMgr)
+ return FWL_ERR_Indefinite;
return ThreadMgr->Stop(hThread, iExitCode);
}
FWL_HMUTEX FWL_CreateMutex() {
diff --git a/xfa/src/fwl/src/core/fwl_timerimp.cpp b/xfa/src/fwl/src/core/fwl_timerimp.cpp index 6430176526..8793e411ca 100644 --- a/xfa/src/fwl/src/core/fwl_timerimp.cpp +++ b/xfa/src/fwl/src/core/fwl_timerimp.cpp @@ -12,17 +12,21 @@ FWL_HTIMER FWL_StartTimer(IFWL_Timer* pTimer, FX_DWORD dwElapse,
FX_BOOL bImmediately) {
IFWL_AdapterNative* pAdapterNative = FWL_GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(pAdapterNative, NULL);
+ if (!pAdapterNative)
+ return NULL;
IFWL_AdapterTimerMgr* pAdapterTimerMgr = pAdapterNative->GetTimerMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pAdapterTimerMgr, NULL);
+ if (!pAdapterTimerMgr)
+ return NULL;
FWL_HTIMER hTimer = NULL;
pAdapterTimerMgr->Start(pTimer, dwElapse, hTimer, bImmediately);
return hTimer;
}
int32_t FWL_StopTimer(FWL_HTIMER hTimer) {
IFWL_AdapterNative* pAdapterNative = FWL_GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(pAdapterNative, FWL_ERR_Indefinite);
+ if (!pAdapterNative)
+ return FWL_ERR_Indefinite;
IFWL_AdapterTimerMgr* pAdapterTimerMgr = pAdapterNative->GetTimerMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pAdapterTimerMgr, FWL_ERR_Indefinite);
+ if (!pAdapterTimerMgr)
+ return FWL_ERR_Indefinite;
return pAdapterTimerMgr->Stop(hTimer);
}
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp index 4a8c0f8ba3..6d37e73689 100644 --- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp +++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp @@ -123,11 +123,14 @@ CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { }
FWL_ERR CFWL_WidgetImp::Initialize() {
IFWL_App* pApp = FWL_GetApp();
- _FWL_RETURN_VALUE_IF_FAIL(pApp, FWL_ERR_Indefinite);
+ if (!pApp)
+ return FWL_ERR_Indefinite;
IFWL_AdapterNative* pAdapter = pApp->GetAdapterNative();
- _FWL_RETURN_VALUE_IF_FAIL(pAdapter, FWL_ERR_Indefinite);
+ if (!pAdapter)
+ return FWL_ERR_Indefinite;
IFWL_AdapterThreadMgr* pAdapterThread = pAdapter->GetThreadMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pAdapterThread, FWL_ERR_Indefinite);
+ if (!pAdapterThread)
+ return FWL_ERR_Indefinite;
SetOwnerThread((CFWL_NoteThread*)pAdapterThread->GetCurrentThread());
IFWL_Widget* pParent = m_pProperties->m_pParent;
m_pWidgetMgr->InsertWidget(pParent, m_pInterface);
@@ -176,7 +179,8 @@ FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { FWL_ERR CFWL_WidgetImp::GetGlobalRect(CFX_RectF& rect) {
IFWL_Widget* pForm =
m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm);
- _FWL_RETURN_VALUE_IF_FAIL(pForm, FWL_ERR_Indefinite);
+ if (!pForm)
+ return FWL_ERR_Indefinite;
rect.Set(0, 0, m_pProperties->m_rtWidget.width,
m_pProperties->m_rtWidget.height);
if (pForm == m_pInterface) {
@@ -296,7 +300,8 @@ FWL_ERR CFWL_WidgetImp::SetPrivateData(void* module_id, return FWL_ERR_Succeeded;
}
void* CFWL_WidgetImp::GetPrivateData(void* module_id) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pPrivateData, NULL);
+ if (!m_pPrivateData)
+ return NULL;
return m_pPrivateData->GetPrivateData(module_id);
}
FWL_ERR CFWL_WidgetImp::Update() {
@@ -362,7 +367,8 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, }
IFWL_Widget* form1 =
m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm);
- _FWL_RETURN_VALUE_IF_FAIL(form1, FWL_ERR_Indefinite);
+ if (!form1)
+ return FWL_ERR_Indefinite;
if (!pWidget) {
form1->GetWidgetRect(r);
fx += r.left;
@@ -379,7 +385,8 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, }
IFWL_Widget* form2 =
m_pWidgetMgr->GetWidget(pWidget, FWL_WGTRELATION_SystemForm);
- _FWL_RETURN_VALUE_IF_FAIL(form2, FWL_ERR_Indefinite);
+ if (!form2)
+ return FWL_ERR_Indefinite;
if (form1 != form2) {
form1->GetWidgetRect(r);
fx += r.left;
@@ -414,7 +421,8 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { return TransformTo(pWidget, rt.left, rt.top);
}
FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties, FWL_ERR_Indefinite);
+ if (!m_pProperties)
+ return FWL_ERR_Indefinite;
if (bGlobal) {
IFWL_Widget* parent = GetParent();
CFX_PtrArray parents;
@@ -441,7 +449,8 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pProperties, FWL_ERR_Indefinite);
+ if (!m_pProperties)
+ return FWL_ERR_Indefinite;
IFWL_Widget* parent = GetParent();
if (!parent) {
return FWL_ERR_Indefinite;
@@ -579,7 +588,8 @@ void CFWL_WidgetImp::GetEdgeRect(CFX_RectF& rtEdge) { FX_FLOAT CFWL_WidgetImp::GetBorderSize(FX_BOOL bCX) {
FX_FLOAT* pfBorder = (FX_FLOAT*)GetThemeCapacity(
bCX ? FWL_WGTCAPACITY_CXBorder : FWL_WGTCAPACITY_CYBorder);
- _FWL_RETURN_VALUE_IF_FAIL(pfBorder, 0);
+ if (!pfBorder)
+ return 0;
return *pfBorder;
}
FX_FLOAT CFWL_WidgetImp::GetEdgeWidth() {
@@ -600,7 +610,8 @@ FX_FLOAT CFWL_WidgetImp::GetEdgeWidth() { }
if (dwCapacity > 0) {
FX_FLOAT* fRet = (FX_FLOAT*)GetThemeCapacity(dwCapacity);
- _FWL_RETURN_VALUE_IF_FAIL(fRet, 0);
+ if (!fRet)
+ return 0;
return *fRet;
}
return 0;
@@ -611,7 +622,8 @@ void CFWL_WidgetImp::GetRelativeRect(CFX_RectF& rect) { }
void* CFWL_WidgetImp::GetThemeCapacity(FX_DWORD dwCapacity) {
IFWL_ThemeProvider* pTheme = GetAvailableTheme();
- _FWL_RETURN_VALUE_IF_FAIL(pTheme, NULL);
+ if (!pTheme)
+ return NULL;
CFWL_ThemePart part;
part.m_pWidget = m_pInterface;
return pTheme->GetCapacity(&part, dwCapacity);
@@ -691,13 +703,15 @@ CFX_SizeF CFWL_WidgetImp::GetOffsetFromAncestor(CFWL_WidgetImp* pAncestor) { return szRet;
}
FX_BOOL CFWL_WidgetImp::TransformToOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pOuter, FALSE);
+ if (!m_pOuter)
+ return FALSE;
fx += m_pProperties->m_rtWidget.left;
fx += m_pProperties->m_rtWidget.top;
return TRUE;
}
FX_BOOL CFWL_WidgetImp::TransformFromOuter(FX_FLOAT& fx, FX_FLOAT& fy) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pOuter, FALSE);
+ if (!m_pOuter)
+ return FALSE;
CFX_RectF rect;
m_pOuter->GetWidgetRect(rect);
fx -= rect.left;
@@ -713,7 +727,8 @@ CFX_SizeF CFWL_WidgetImp::CalcTextSize(const CFX_WideString& wsText, int32_t iLineWidth) {
CFX_SizeF sz;
sz.Set(0, 0);
- _FWL_RETURN_VALUE_IF_FAIL(pTheme, sz);
+ if (!pTheme)
+ return sz;
CFWL_ThemeText calPart;
calPart.m_pWidget = m_pInterface;
calPart.m_wsText = wsText;
@@ -748,9 +763,11 @@ void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) { return;
}
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pDriver);
+ if (!pDriver)
+ return;
IFWL_Widget* curFocus = ((CFWL_NoteDriver*)pDriver)->GetFocus();
if (bFocus && curFocus != m_pInterface) {
pDriver->SetFocus(m_pInterface);
@@ -760,7 +777,8 @@ void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) { }
void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) {
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
pDriver->SetGrab(m_pInterface, bSet);
}
@@ -871,7 +889,8 @@ FX_BOOL CFWL_WidgetImp::GetPopupPosGeneral(FX_FLOAT fMinHeight, FX_BOOL CFWL_WidgetImp::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) {
IFWL_AdapterNative* pNative = FWL_GetAdapterNative();
IFWL_AdapterMonitorMgr* pMonitorMgr = pNative->GetMonitorMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pMonitorMgr, FALSE);
+ if (!pMonitorMgr)
+ return FALSE;
FWL_HMONITOR hMonitor = pMonitorMgr->GetMonitorByPoint(fx, fy);
pMonitorMgr->GetMonitorSize(hMonitor, fx, fy);
return TRUE;
@@ -879,20 +898,25 @@ FX_BOOL CFWL_WidgetImp::GetScreenSize(FX_FLOAT& fx, FX_FLOAT& fy) { void CFWL_WidgetImp::RegisterEventTarget(IFWL_Widget* pEventSource,
FX_DWORD dwFilter) {
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pNoteDriver);
+ if (!pNoteDriver)
+ return;
pNoteDriver->RegisterEventTarget(m_pInterface, pEventSource, dwFilter);
}
void CFWL_WidgetImp::UnregisterEventTarget() {
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pNoteDriver);
+ if (!pNoteDriver)
+ return;
pNoteDriver->UnregisterEventTarget(m_pInterface);
}
void CFWL_WidgetImp::DispatchKeyEvent(CFWL_MsgKey* pNote) {
- _FWL_RETURN_IF_FAIL(pNote);
+ if (!pNote)
+ return;
CFWL_MsgKey* pEvent = (CFWL_MsgKey*)pNote->CloneToEvent();
pEvent->m_pSrcTarget = m_pInterface;
pEvent->m_dwCmd = pNote->m_dwCmd;
@@ -908,9 +932,11 @@ void CFWL_WidgetImp::DispatchEvent(CFWL_Event* pEvent) { return;
}
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pNoteDriver);
+ if (!pNoteDriver)
+ return;
pNoteDriver->SendNote(pEvent);
}
void CFWL_WidgetImp::Repaint(const CFX_RectF* pRect) {
@@ -973,9 +999,11 @@ void CFWL_WidgetImp::DrawEdge(CFX_Graphics* pGraphics, }
void CFWL_WidgetImp::NotifyDriver() {
IFWL_NoteThread* pThread = GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pDriver);
+ if (!pDriver)
+ return;
pDriver->NotifyTargetDestroy(m_pInterface);
}
CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) {
@@ -985,7 +1013,8 @@ CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) { return szRet;
}
IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr();
- _FWL_RETURN_VALUE_IF_FAIL(pWidgetMgr, szRet);
+ if (!pWidgetMgr)
+ return szRet;
szRet.x += m_pProperties->m_rtWidget.left;
szRet.y += m_pProperties->m_rtWidget.top;
IFWL_Widget* pDstWidget = GetParent();
@@ -1013,7 +1042,8 @@ FX_BOOL CFWL_WidgetImp::IsParent(IFWL_Widget* pParent) { }
CFWL_WidgetImpDelegate::CFWL_WidgetImpDelegate() {}
int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage->m_pDstTarget, 0);
+ if (!pMessage->m_pDstTarget)
+ return 0;
CFWL_WidgetImp* pWidget =
static_cast<CFWL_WidgetImp*>(pMessage->m_pDstTarget->GetImpl());
FX_DWORD dwMsgCode = pMessage->GetClassID();
diff --git a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp index a986854b94..284498b5a3 100644 --- a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp +++ b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp @@ -20,7 +20,8 @@ FX_BOOL FWL_UseOffscreen(IFWL_Widget* pWidget) { }
IFWL_WidgetMgr* FWL_GetWidgetMgr() {
IFWL_App* pApp = FWL_GetApp();
- _FWL_RETURN_VALUE_IF_FAIL(pApp, NULL);
+ if (!pApp)
+ return NULL;
return pApp->GetWidgetMgr();
}
CFWL_WidgetMgr::CFWL_WidgetMgr(IFWL_AdapterNative* pAdapterNative)
@@ -133,13 +134,16 @@ IFWL_Widget* CFWL_WidgetMgr::GetWidget(IFWL_Widget* pWidget, }
int32_t CFWL_WidgetMgr::GetWidgetIndex(IFWL_Widget* pWidget) {
CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
- _FWL_RETURN_VALUE_IF_FAIL(pItem, -1);
+ if (!pItem)
+ return -1;
return TravelWidgetMgr(pItem->pParent, NULL, pItem);
}
FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) {
CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget);
- _FWL_RETURN_VALUE_IF_FAIL(pItem, FALSE);
- _FWL_RETURN_VALUE_IF_FAIL(pItem->pParent, FALSE);
+ if (!pItem)
+ return FALSE;
+ if (!pItem->pParent)
+ return FALSE;
CFWL_WidgetMgrItem* pChild = pItem->pParent->pChild;
int32_t i = 0;
while (pChild) {
@@ -205,12 +209,14 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { return TRUE;
}
FX_BOOL CFWL_WidgetMgr::IsWidget(void* pObj) {
- _FWL_RETURN_VALUE_IF_FAIL(pObj, FALSE);
+ if (!pObj)
+ return FALSE;
return GetWidgetMgrItem((IFWL_Widget*)pObj) != NULL;
}
FWL_ERR CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget,
const CFX_RectF* pRect) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pAdapter, FWL_ERR_Indefinite);
+ if (!m_pAdapter)
+ return FWL_ERR_Indefinite;
IFWL_Widget* pNative = pWidget;
CFX_RectF rect(*pRect);
if (IsFormDisabled()) {
@@ -225,7 +231,8 @@ FWL_ERR CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, }
} else if (!IsAbleNative(pWidget)) {
pNative = GetWidget(pWidget, FWL_WGTRELATION_SystemForm);
- _FWL_RETURN_VALUE_IF_FAIL(pNative, FWL_ERR_Indefinite);
+ if (!pNative)
+ return FWL_ERR_Indefinite;
pWidget->TransformTo(pNative, rect.left, rect.top);
}
AddRedrawCounts(pNative);
@@ -329,7 +336,8 @@ void CFWL_WidgetMgr::SetOwner(IFWL_Widget* pOwner, IFWL_Widget* pOwned) { void CFWL_WidgetMgr::SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild) {
CFWL_WidgetMgrItem* pParentItem = GetWidgetMgrItem(pParent);
CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pChild);
- _FWL_RETURN_IF_FAIL(pItem);
+ if (!pItem)
+ return;
if (pItem->pParent && pItem->pParent != pParentItem) {
if (pItem->pPrevious) {
pItem->pPrevious->pNext = pItem->pNext;
@@ -345,7 +353,8 @@ void CFWL_WidgetMgr::SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild) { }
pItem->pParent = pParentItem;
SetWidgetIndex(pChild, -1);
- _FWL_RETURN_IF_FAIL(m_pAdapter);
+ if (!m_pAdapter)
+ return;
m_pAdapter->SetParentWidget(pChild, pParent);
}
FX_BOOL CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) {
@@ -452,7 +461,8 @@ FWL_ERR CFWL_WidgetMgr::CreateWidgetWithNativeId_Native(IFWL_Widget* pWidget, IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent,
FX_FLOAT x,
FX_FLOAT y) {
- _FWL_RETURN_VALUE_IF_FAIL(parent, NULL);
+ if (!parent)
+ return NULL;
FX_FLOAT x1;
FX_FLOAT y1;
IFWL_Widget* child = GetWidget(parent, FWL_WGTRELATION_LastChild);
@@ -655,7 +665,8 @@ int32_t CFWL_WidgetMgr::TravelWidgetMgr(CFWL_WidgetMgrItem* pParent, return iCount - 1;
}
FX_BOOL CFWL_WidgetMgr::IsAbleNative(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
if (!pWidget->IsInstance(FX_WSTRC(FWL_CLASS_Form))) {
return FALSE;
}
@@ -686,13 +697,17 @@ FWL_ERR CFWL_WidgetMgrDelegate::OnSetCapability(FX_DWORD dwCapability) { return FWL_ERR_Succeeded;
}
int32_t CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) {
- _FWL_RETURN_VALUE_IF_FAIL(pMessage, 0);
- _FWL_RETURN_VALUE_IF_FAIL(pMessage->m_pDstTarget, 0);
+ if (!pMessage)
+ return 0;
+ if (!pMessage->m_pDstTarget)
+ return 0;
IFWL_Widget* pDstWidget = (IFWL_Widget*)pMessage->m_pDstTarget;
IFWL_NoteThread* pNoteThread = pDstWidget->GetOwnerThread();
- _FWL_RETURN_VALUE_IF_FAIL(pNoteThread, 0);
+ if (!pNoteThread)
+ return 0;
CFWL_NoteDriver* pNoteDriver = (CFWL_NoteDriver*)pNoteThread->GetNoteDriver();
- _FWL_RETURN_VALUE_IF_FAIL(pNoteDriver, 0);
+ if (!pNoteDriver)
+ return 0;
if (m_pWidgetMgr->IsThreadEnabled()) {
pMessage = (CFWL_Message*)pMessage->Clone();
}
@@ -715,8 +730,10 @@ int32_t CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) { FWL_ERR CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget,
CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FWL_ERR_Indefinite);
- _FWL_RETURN_VALUE_IF_FAIL(pGraphics, FWL_ERR_Indefinite);
+ if (!pWidget)
+ return FWL_ERR_Indefinite;
+ if (!pGraphics)
+ return FWL_ERR_Indefinite;
CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix);
CFX_RectF clipCopy;
pWidget->GetWidgetRect(clipCopy);
@@ -766,7 +783,8 @@ void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, const CFX_RectF& rtClip,
CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(parent);
+ if (!parent)
+ return;
FX_BOOL bFormDisable = m_pWidgetMgr->IsFormDisabled();
IFWL_Widget* pNextChild =
m_pWidgetMgr->GetWidget(parent, FWL_WGTRELATION_FirstChild);
diff --git a/xfa/src/fwl/src/lightwidget/app.cpp b/xfa/src/fwl/src/lightwidget/app.cpp index 58d41ca6c3..3d49fab015 100644 --- a/xfa/src/fwl/src/lightwidget/app.cpp +++ b/xfa/src/fwl/src/lightwidget/app.cpp @@ -26,7 +26,8 @@ CFWL_Theme* CFWL_App::GetTheme() { return m_pThemeProvider;
}
FWL_ERR CFWL_App::Exit(int32_t iExitCode) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pAppImp, FWL_ERR_Indefinite);
+ if (!m_pAppImp)
+ return FWL_ERR_Indefinite;
return m_pAppImp->Exit(iExitCode);
}
IFWL_App* CFWL_App::GetApp() {
diff --git a/xfa/src/fwl/src/lightwidget/barcode.cpp b/xfa/src/fwl/src/lightwidget/barcode.cpp index 7d7d5a483d..5426cb5eb6 100644 --- a/xfa/src/fwl/src/lightwidget/barcode.cpp +++ b/xfa/src/fwl/src/lightwidget/barcode.cpp @@ -9,7 +9,8 @@ CFWL_Barcode* CFWL_Barcode::Create() { return new CFWL_Barcode;
}
FWL_ERR CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
@@ -26,11 +27,13 @@ FWL_ERR CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) { CFWL_Barcode::CFWL_Barcode() {}
CFWL_Barcode::~CFWL_Barcode() {}
void CFWL_Barcode::SetType(BC_TYPE type) {
- _FWL_RETURN_IF_FAIL(m_pIface);
+ if (!m_pIface)
+ return;
((IFWL_Barcode*)m_pIface)->SetType(type);
}
FX_BOOL CFWL_Barcode::IsProtectedType() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_Barcode*)m_pIface)->IsProtectedType();
}
FWL_ERR CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget* pWidget,
diff --git a/xfa/src/fwl/src/lightwidget/caret.cpp b/xfa/src/fwl/src/lightwidget/caret.cpp index a9391966ca..48bc18a82d 100644 --- a/xfa/src/fwl/src/lightwidget/caret.cpp +++ b/xfa/src/fwl/src/lightwidget/caret.cpp @@ -9,7 +9,8 @@ CFWL_Caret* CFWL_Caret::Create() { return new CFWL_Caret;
}
FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
diff --git a/xfa/src/fwl/src/lightwidget/checkbox.cpp b/xfa/src/fwl/src/lightwidget/checkbox.cpp index ef3f5b3171..7ec0c515bd 100644 --- a/xfa/src/fwl/src/lightwidget/checkbox.cpp +++ b/xfa/src/fwl/src/lightwidget/checkbox.cpp @@ -9,7 +9,8 @@ CFWL_CheckBox* CFWL_CheckBox::Create() { return new CFWL_CheckBox;
}
FWL_ERR CFWL_CheckBox::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
diff --git a/xfa/src/fwl/src/lightwidget/combobox.cpp b/xfa/src/fwl/src/lightwidget/combobox.cpp index 024a5f9a2d..6335df58a3 100644 --- a/xfa/src/fwl/src/lightwidget/combobox.cpp +++ b/xfa/src/fwl/src/lightwidget/combobox.cpp @@ -9,7 +9,8 @@ CFWL_ComboBox* CFWL_ComboBox::Create() { return new CFWL_ComboBox;
}
FWL_ERR CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
@@ -50,58 +51,71 @@ int32_t CFWL_ComboBox::CountItems() { FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) {
CFWL_ComboBoxItem* pItem =
(CFWL_ComboBoxItem*)(m_comboBoxData.GetItem((IFWL_Widget*)this, iIndex));
- _FWL_RETURN_VALUE_IF_FAIL(pItem, FWL_ERR_Indefinite);
+ if (!pItem)
+ return FWL_ERR_Indefinite;
wsText = pItem->m_wsText;
return FWL_ERR_Succeeded;
}
int32_t CFWL_ComboBox::GetCurSel() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, -1);
+ if (!m_pIface)
+ return -1;
return ((IFWL_ComboBox*)m_pIface)->GetCurSel();
}
FWL_ERR CFWL_ComboBox::SetCurSel(int32_t iSel) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ComboBox*)m_pIface)->SetCurSel(iSel);
}
FWL_ERR CFWL_ComboBox::SetEditText(const CFX_WideStringC& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ComboBox*)m_pIface)->SetEditText(wsText);
}
int32_t CFWL_ComboBox::GetEditTextLength() const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_ComboBox*)m_pIface)->GetEditTextLength();
}
FWL_ERR CFWL_ComboBox::GetEditText(CFX_WideString& wsText,
int32_t nStart,
int32_t nCount) const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ComboBox*)m_pIface)->GetEditText(wsText, nStart, nCount);
}
FWL_ERR CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ComboBox*)m_pIface)->SetEditSelRange(nStart, nCount);
}
int32_t CFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_ComboBox*)m_pIface)->GetEditSelRange(nIndex, nStart);
}
int32_t CFWL_ComboBox::GetEditLimit() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_ComboBox*)m_pIface)->GetEditLimit();
}
FWL_ERR CFWL_ComboBox::SetEditLimit(int32_t nLimit) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ComboBox*)m_pIface)->SetEditLimit(nLimit);
}
FWL_ERR CFWL_ComboBox::EditDoClipboard(int32_t iCmd) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ComboBox*)m_pIface)->EditDoClipboard(iCmd);
}
FX_BOOL CFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditRedo(bsRecord);
}
FX_BOOL CFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditUndo(bsRecord);
}
FWL_ERR CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) {
@@ -111,14 +125,16 @@ FWL_ERR CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) { FWL_ERR CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) {
CFWL_ComboBoxItem* pItem =
(CFWL_ComboBoxItem*)(m_comboBoxData.GetItem((IFWL_Widget*)this, iIndex));
- _FWL_RETURN_VALUE_IF_FAIL(pItem, FWL_ERR_Indefinite);
+ if (!pItem)
+ return FWL_ERR_Indefinite;
pItem->m_pData = pData;
return FWL_ERR_Succeeded;
}
void* CFWL_ComboBox::GetItemData(int32_t iIndex) {
CFWL_ComboBoxItem* pItem =
(CFWL_ComboBoxItem*)(m_comboBoxData.GetItem((IFWL_Widget*)this, iIndex));
- _FWL_RETURN_VALUE_IF_FAIL(pItem, NULL);
+ if (!pItem)
+ return NULL;
return pItem->m_pData;
}
FWL_ERR CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) {
@@ -131,64 +147,79 @@ FWL_ERR CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { return ((IFWL_ComboBox*)m_pIface)->OpenDropDownList(bActivate);
}
FX_BOOL CFWL_ComboBox::EditCanUndo() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditCanUndo();
}
FX_BOOL CFWL_ComboBox::EditCanRedo() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditCanRedo();
}
FX_BOOL CFWL_ComboBox::EditUndo() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditUndo();
}
FX_BOOL CFWL_ComboBox::EditRedo() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditRedo();
}
FX_BOOL CFWL_ComboBox::EditCanCopy() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditCanCopy();
}
FX_BOOL CFWL_ComboBox::EditCanCut() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditCanCut();
}
FX_BOOL CFWL_ComboBox::EditCanSelectAll() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditCanSelectAll();
}
FX_BOOL CFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditCopy(wsCopy);
}
FX_BOOL CFWL_ComboBox::EditCut(CFX_WideString& wsCut) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditCut(wsCut);
}
FX_BOOL CFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditPaste(wsPaste);
}
FX_BOOL CFWL_ComboBox::EditSelectAll() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditSelectAll();
}
FX_BOOL CFWL_ComboBox::EditDelete() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditDelete();
}
FX_BOOL CFWL_ComboBox::EditDeSelect() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->EditDeSelect();
}
FWL_ERR CFWL_ComboBox::GetBBox(CFX_RectF& rect) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)->GetBBox(rect);
}
FWL_ERR CFWL_ComboBox::EditModifyStylesEx(FX_DWORD dwStylesExAdded,
FX_DWORD dwStylesExRemoved) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ComboBox*)m_pIface)
->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
@@ -230,20 +261,23 @@ FX_BOOL CFWL_ComboBox::CFWL_ComboBoxDP::SetItemIndex(IFWL_Widget* pWidget, }
FX_DWORD CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, 0);
+ if (!hItem)
+ return 0;
return ((CFWL_ComboBoxItem*)hItem)->m_dwStyles;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
wsText = ((CFWL_ComboBoxItem*)hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)hItem;
rtItem.Set(pItem->m_rtItem.left, pItem->m_rtItem.top, pItem->m_rtItem.width,
pItem->m_rtItem.height);
@@ -251,28 +285,32 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget, }
void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, NULL);
+ if (!hItem)
+ return NULL;
CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)hItem;
return pItem->m_pData;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
FX_DWORD dwStyle) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
((CFWL_ComboBoxItem*)hItem)->m_dwStyles = dwStyle;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const FX_WCHAR* pszText) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
((CFWL_ComboBoxItem*)hItem)->m_wsText = pszText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const CFX_RectF& rtItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
((CFWL_ComboBoxItem*)hItem)->m_rtItem = rtItem;
return FWL_ERR_Succeeded;
}
@@ -281,7 +319,8 @@ FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { }
CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, NULL);
+ if (!hItem)
+ return NULL;
return ((CFWL_ComboBoxItem*)hItem)->m_pDIB;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
diff --git a/xfa/src/fwl/src/lightwidget/datetimepicker.cpp b/xfa/src/fwl/src/lightwidget/datetimepicker.cpp index d762030b49..a1f5493049 100644 --- a/xfa/src/fwl/src/lightwidget/datetimepicker.cpp +++ b/xfa/src/fwl/src/lightwidget/datetimepicker.cpp @@ -10,7 +10,8 @@ CFWL_DateTimePicker* CFWL_DateTimePicker::Create() { }
FWL_ERR CFWL_DateTimePicker::Initialize(
const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
diff --git a/xfa/src/fwl/src/lightwidget/edit.cpp b/xfa/src/fwl/src/lightwidget/edit.cpp index be20a0b3a3..6fb3429725 100644 --- a/xfa/src/fwl/src/lightwidget/edit.cpp +++ b/xfa/src/fwl/src/lightwidget/edit.cpp @@ -9,7 +9,8 @@ CFWL_Edit* CFWL_Edit::Create() { return new CFWL_Edit;
}
FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
@@ -24,33 +25,40 @@ FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) { return ret;
}
FWL_ERR CFWL_Edit::SetText(const CFX_WideString& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->SetText(wsText);
}
int32_t CFWL_Edit::GetTextLength() const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_Edit*)m_pIface)->GetTextLength();
}
FWL_ERR CFWL_Edit::GetText(CFX_WideString& wsText,
int32_t nStart,
int32_t nCount) const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->GetText(wsText, nStart, nCount);
}
FWL_ERR CFWL_Edit::ClearText() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->ClearText();
}
int32_t CFWL_Edit::GetCaretPos() const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, -1);
+ if (!m_pIface)
+ return -1;
return ((IFWL_Edit*)m_pIface)->GetCaretPos();
}
int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, -1);
+ if (!m_pIface)
+ return -1;
return ((IFWL_Edit*)m_pIface)->SetCaretPos(nIndex, bBefore);
}
FWL_ERR CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
((IFWL_Edit*)m_pIface)->AddSelRange(nStart, nCount);
int32_t pos = 0;
int32_t sum = ((IFWL_Edit*)m_pIface)->GetTextLength();
@@ -62,71 +70,87 @@ FWL_ERR CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { return ((IFWL_Edit*)m_pIface)->SetCaretPos(pos);
}
int32_t CFWL_Edit::CountSelRanges() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_Edit*)m_pIface)->CountSelRanges();
}
int32_t CFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_Edit*)m_pIface)->GetSelRange(nIndex, nStart);
}
FWL_ERR CFWL_Edit::ClearSelections() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->ClearSelections();
}
int32_t CFWL_Edit::GetLimit() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, -1);
+ if (!m_pIface)
+ return -1;
return ((IFWL_Edit*)m_pIface)->GetLimit();
}
FWL_ERR CFWL_Edit::SetLimit(int32_t nLimit) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->SetLimit(nLimit);
}
FWL_ERR CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->SetAliasChar(wAlias);
}
FWL_ERR CFWL_Edit::SetFormatString(const CFX_WideString& wsFormat) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->SetFormatString(wsFormat);
}
FWL_ERR CFWL_Edit::Insert(int32_t nStart,
const FX_WCHAR* lpText,
int32_t nLen) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->Insert(nStart, lpText, nLen);
}
FWL_ERR CFWL_Edit::DeleteSelections() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->DeleteSelections();
}
FWL_ERR CFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->DeleteRange(nStart, nCount);
}
FWL_ERR CFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->ReplaceSelections(wsReplace);
}
FWL_ERR CFWL_Edit::Replace(int32_t nStart,
int32_t nLen,
const CFX_WideStringC& wsReplace) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->Replace(nStart, nLen, wsReplace);
}
FWL_ERR CFWL_Edit::DoClipboard(int32_t iCmd) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->DoClipboard(iCmd);
}
FX_BOOL CFWL_Edit::Redo(const CFX_ByteStringC& bsRecord) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_Edit*)m_pIface)->Redo(bsRecord);
}
FX_BOOL CFWL_Edit::Undo(const CFX_ByteStringC& bsRecord) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_Edit*)m_pIface)->Undo(bsRecord);
}
FWL_ERR CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->SetTabWidth(fTabWidth, bEquidistant);
}
FWL_ERR CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) {
@@ -136,11 +160,13 @@ FWL_ERR CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { return ((IFWL_Edit*)m_pIface)->SetNumberRange(iMin, iMax);
}
FWL_ERR CFWL_Edit::SetBackColor(FX_DWORD dwColor) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->SetBackColor(dwColor);
}
FWL_ERR CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_Edit*)m_pIface)->SetFont(wsFont, fSize);
}
FX_BOOL CFWL_Edit::CanUndo() {
diff --git a/xfa/src/fwl/src/lightwidget/listbox.cpp b/xfa/src/fwl/src/lightwidget/listbox.cpp index f67dd66012..1507d50ea2 100644 --- a/xfa/src/fwl/src/lightwidget/listbox.cpp +++ b/xfa/src/fwl/src/lightwidget/listbox.cpp @@ -9,7 +9,8 @@ CFWL_ListBox* CFWL_ListBox::Create() { return new CFWL_ListBox;
}
FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
@@ -71,27 +72,33 @@ FX_BOOL CFWL_ListBox::DeleteAll() { return TRUE;
}
int32_t CFWL_ListBox::CountSelItems() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_ListBox*)m_pIface)->CountSelItems();
}
FWL_HLISTITEM CFWL_ListBox::GetSelItem(int32_t nIndexSel) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, NULL);
+ if (!m_pIface)
+ return NULL;
return ((IFWL_ListBox*)m_pIface)->GetSelItem(nIndexSel);
}
int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_ListBox*)m_pIface)->GetSelIndex(nIndex);
}
FWL_ERR CFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ListBox*)m_pIface)->SetSelItem(hItem, bSelect);
}
FWL_ERR CFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ListBox*)m_pIface)->GetItemText(hItem, wsText);
}
FWL_ERR CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ListBox*)m_pIface)->GetScrollPos(fPos, bVert);
}
FWL_ERR CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
@@ -128,26 +135,30 @@ FWL_HLISTITEM CFWL_ListBox::GetItem(int32_t nIndex) { }
FWL_ERR CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem,
const CFX_WideStringC& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
pItem->m_wsText = wsText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
wsText = pItem->m_wsText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::SetItemData(FWL_HLISTITEM hItem, void* pData) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
pItem->m_pData = pData;
return FWL_ERR_Succeeded;
}
void* CFWL_ListBox::GetItemData(FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, NULL);
+ if (!hItem)
+ return NULL;
CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
return pItem->m_pData;
}
@@ -176,7 +187,8 @@ FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { return NULL;
}
FX_DWORD CFWL_ListBox::GetItemStates(FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, 0);
+ if (!hItem)
+ return 0;
CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
return pItem->m_dwStates | pItem->m_dwCheckState;
}
@@ -220,48 +232,55 @@ FX_BOOL CFWL_ListBox::CFWL_ListBoxDP::SetItemIndex(IFWL_Widget* pWidget, }
FX_DWORD CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, -1);
+ if (!hItem)
+ return -1;
return ((CFWL_ListItem*)hItem)->m_dwStates;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
wsText = ((CFWL_ListItem*)hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
rtItem = pItem->m_rtItem;
return FWL_ERR_Succeeded;
}
void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, NULL);
+ if (!hItem)
+ return NULL;
CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
return pItem->m_pData;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
FX_DWORD dwStyle) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
((CFWL_ListItem*)hItem)->m_dwStates = dwStyle;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const FX_WCHAR* pszText) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
((CFWL_ListItem*)hItem)->m_wsText = pszText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const CFX_RectF& rtItem) {
- _FWL_RETURN_VALUE_IF_FAIL(hItem, FWL_ERR_Indefinite);
+ if (!hItem)
+ return FWL_ERR_Indefinite;
((CFWL_ListItem*)hItem)->m_rtItem = rtItem;
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/lightwidget/picturebox.cpp b/xfa/src/fwl/src/lightwidget/picturebox.cpp index 4bc8a68d3b..5ccefa9076 100644 --- a/xfa/src/fwl/src/lightwidget/picturebox.cpp +++ b/xfa/src/fwl/src/lightwidget/picturebox.cpp @@ -9,7 +9,8 @@ CFWL_PictureBox* CFWL_PictureBox::Create() { return new CFWL_PictureBox;
}
FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
diff --git a/xfa/src/fwl/src/lightwidget/pushbutton.cpp b/xfa/src/fwl/src/lightwidget/pushbutton.cpp index e7c1a86115..28a7fa5d33 100644 --- a/xfa/src/fwl/src/lightwidget/pushbutton.cpp +++ b/xfa/src/fwl/src/lightwidget/pushbutton.cpp @@ -9,7 +9,8 @@ CFWL_PushButton* CFWL_PushButton::Create() { return new CFWL_PushButton;
}
FWL_ERR CFWL_PushButton::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
diff --git a/xfa/src/fwl/src/lightwidget/scrollbar.cpp b/xfa/src/fwl/src/lightwidget/scrollbar.cpp index 9614e9edf7..bb346a4728 100644 --- a/xfa/src/fwl/src/lightwidget/scrollbar.cpp +++ b/xfa/src/fwl/src/lightwidget/scrollbar.cpp @@ -9,7 +9,8 @@ CFWL_ScrollBar* CFWL_ScrollBar::Create() { return new CFWL_ScrollBar;
}
FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
@@ -24,51 +25,63 @@ FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) { return ret;
}
FX_BOOL CFWL_ScrollBar::IsVertical() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ScrollBar*)m_pIface)->IsVertical();
}
FWL_ERR CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ScrollBar*)m_pIface)->GetRange(fMin, fMax);
}
FWL_ERR CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ScrollBar*)m_pIface)->SetRange(fMin, fMax);
}
FX_FLOAT CFWL_ScrollBar::GetPageSize() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_ScrollBar*)m_pIface)->GetPageSize();
}
FWL_ERR CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ScrollBar*)m_pIface)->SetPageSize(fPageSize);
}
FX_FLOAT CFWL_ScrollBar::GetStepSize() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return ((IFWL_ScrollBar*)m_pIface)->GetStepSize();
}
FWL_ERR CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ScrollBar*)m_pIface)->SetStepSize(fStepSize);
}
FX_FLOAT CFWL_ScrollBar::GetPos() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, -1);
+ if (!m_pIface)
+ return -1;
return ((IFWL_ScrollBar*)m_pIface)->GetPos();
}
FWL_ERR CFWL_ScrollBar::SetPos(FX_FLOAT fPos) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ScrollBar*)m_pIface)->SetPos(fPos);
}
FX_FLOAT CFWL_ScrollBar::GetTrackPos() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, -1);
+ if (!m_pIface)
+ return -1;
return ((IFWL_ScrollBar*)m_pIface)->GetTrackPos();
}
FWL_ERR CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return ((IFWL_ScrollBar*)m_pIface)->SetTrackPos(fTrackPos);
}
FX_BOOL CFWL_ScrollBar::DoScroll(FX_DWORD dwCode, FX_FLOAT fPos) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return ((IFWL_ScrollBar*)m_pIface)->DoScroll(dwCode, fPos);
}
CFWL_ScrollBar::CFWL_ScrollBar() {}
diff --git a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp index 76944880df..f51ec221a0 100644 --- a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp +++ b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp @@ -15,7 +15,8 @@ CFWL_ToolTip* CFWL_ToolTip::Create() { return new CFWL_ToolTip;
}
FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(!m_pIface, FWL_ERR_Indefinite);
+ if (m_pIface)
+ return FWL_ERR_Indefinite;
if (pProperties) {
*m_pProperties = *pProperties;
}
diff --git a/xfa/src/fwl/src/lightwidget/widget.cpp b/xfa/src/fwl/src/lightwidget/widget.cpp index b9b889600f..0ca7f57c42 100644 --- a/xfa/src/fwl/src/lightwidget/widget.cpp +++ b/xfa/src/fwl/src/lightwidget/widget.cpp @@ -30,7 +30,8 @@ IFWL_Widget* CFWL_Widget::GetWidget() { return m_pIface;
}
FX_DWORD CFWL_Widget::Release() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
FX_DWORD dwRef = m_pIface->GetRefCount();
if (dwRef == 1) {
m_pIface->Finalize();
@@ -43,49 +44,60 @@ FX_DWORD CFWL_Widget::Release() { return dwRef - 1;
}
CFWL_Widget* CFWL_Widget::Retain() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, NULL);
+ if (!m_pIface)
+ return NULL;
m_pIface->Retain();
return this;
}
FX_DWORD CFWL_Widget::GetRefCount() const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 1);
+ if (!m_pIface)
+ return 1;
return m_pIface->GetRefCount();
}
FWL_ERR CFWL_Widget::GetClassName(CFX_WideString& wsClass) const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->GetClassName(wsClass);
}
FX_DWORD CFWL_Widget::GetClassID() const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return m_pIface->GetClassID();
}
FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FALSE);
+ if (!m_pIface)
+ return FALSE;
return m_pIface->IsInstance(wsClass);
}
static void* gs_pFWLWidget = (void*)FXBSTR_ID('l', 'i', 'g', 't');
FWL_ERR CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->SetPrivateData(gs_pFWLWidget, this, NULL);
}
FWL_ERR CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->GetWidgetRect(rect, bAutoSize);
}
FWL_ERR CFWL_Widget::GetGlobalRect(CFX_RectF& rect) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->GetGlobalRect(rect);
}
FWL_ERR CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->SetWidgetRect(rect);
}
FWL_ERR CFWL_Widget::GetClientRect(CFX_RectF& rect) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->GetClientRect(rect);
}
CFWL_Widget* CFWL_Widget::GetParent() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, NULL);
+ if (!m_pIface)
+ return NULL;
IFWL_Widget* parent = m_pIface->GetParent();
if (parent) {
return (CFWL_Widget*)parent->GetPrivateData(gs_pFWLWidget);
@@ -93,28 +105,34 @@ CFWL_Widget* CFWL_Widget::GetParent() { return NULL;
}
FWL_ERR CFWL_Widget::SetParent(CFWL_Widget* pParent) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->SetParent(pParent ? pParent->GetWidget() : NULL);
}
CFWL_Widget* CFWL_Widget::GetOwner() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, NULL);
+ if (!m_pIface)
+ return NULL;
return NULL;
}
FWL_ERR CFWL_Widget::SetOwner(CFWL_Widget* pOwner) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return FWL_ERR_Succeeded;
}
FX_DWORD CFWL_Widget::GetStyles() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return m_pIface->GetStyles();
}
FWL_ERR CFWL_Widget::ModifyStyles(FX_DWORD dwStylesAdded,
FX_DWORD dwStylesRemoved) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->ModifyStyles(dwStylesAdded, dwStylesRemoved);
}
FX_DWORD CFWL_Widget::GetStylesEx() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return m_pIface->GetStylesEx();
}
FWL_ERR CFWL_Widget::ModifyStylesEx(FX_DWORD dwStylesExAdded,
@@ -122,60 +140,73 @@ FWL_ERR CFWL_Widget::ModifyStylesEx(FX_DWORD dwStylesExAdded, return m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
FX_DWORD CFWL_Widget::GetStates() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->GetStates();
}
FWL_ERR CFWL_Widget::SetStates(FX_DWORD dwStates, FX_BOOL bSet) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->SetStates(dwStates, bSet);
}
FWL_ERR CFWL_Widget::SetPrivateData(void* module_id,
void* pData,
PD_CALLBACK_FREEDATA callback) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->SetPrivateData(module_id, pData, callback);
}
void* CFWL_Widget::GetPrivateData(void* module_id) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, NULL);
+ if (!m_pIface)
+ return NULL;
return m_pIface->GetPrivateData(module_id);
}
FWL_ERR CFWL_Widget::Update() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->Update();
}
FWL_ERR CFWL_Widget::LockUpdate() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->LockUpdate();
}
FWL_ERR CFWL_Widget::UnlockUpdate() {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->UnlockUpdate();
}
FX_DWORD CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, 0);
+ if (!m_pIface)
+ return 0;
return m_pIface->HitTest(fx, fy);
}
FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
FX_FLOAT& fx,
FX_FLOAT& fy) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : NULL, fx, fy);
}
FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : NULL, rt);
}
FWL_ERR CFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->GetMatrix(matrix, bGlobal);
}
FWL_ERR CFWL_Widget::SetMatrix(const CFX_Matrix& matrix) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->SetMatrix(matrix);
}
FWL_ERR CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
return m_pIface->DrawWidget(pGraphics, pMatrix);
}
FWL_ERR CFWL_Widget::GetProperties(CFWL_WidgetProperties& properties) {
@@ -201,7 +232,8 @@ FWL_ERR CFWL_Widget::SetProperties(const CFWL_WidgetProperties& properties) { return FWL_ERR_Succeeded;
}
IFWL_WidgetDelegate* CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, NULL);
+ if (!m_pIface)
+ return NULL;
m_pDelegate = m_pIface->SetDelegate(pDelegate);
return m_pDelegate;
}
@@ -223,7 +255,8 @@ CFWL_Widget::~CFWL_Widget() { }
}
FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
CFX_RectF rect;
if (pRect) {
rect = *pRect;
@@ -234,11 +267,14 @@ FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) { return m_pWidgetMgr->RepaintWidget(m_pIface, &rect);
}
FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
IFWL_NoteThread* pThread = m_pIface->GetOwnerThread();
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
if (bFocus) {
pDriver->SetFocus(m_pIface);
} else {
@@ -249,34 +285,43 @@ FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) { return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_Widget::SetGrab(FX_BOOL bSet) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
IFWL_NoteThread* pThread = m_pIface->GetOwnerThread();
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, FWL_ERR_Indefinite);
+ if (!m_pIface)
+ return FWL_ERR_Indefinite;
pDriver->SetGrab(m_pIface, bSet);
return FWL_ERR_Succeeded;
}
void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource,
FX_DWORD dwFilter) {
- _FWL_RETURN_IF_FAIL(m_pIface);
+ if (!m_pIface)
+ return;
IFWL_NoteThread* pThread = m_pIface->GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pNoteDriver);
+ if (!pNoteDriver)
+ return;
IFWL_Widget* pEventSourceImp =
!pEventSource ? NULL : pEventSource->GetWidget();
pNoteDriver->RegisterEventTarget(GetWidget(), pEventSourceImp, dwFilter);
}
void CFWL_Widget::DispatchEvent(CFWL_Event* pEvent) {
- _FWL_RETURN_IF_FAIL(m_pIface);
+ if (!m_pIface)
+ return;
if (m_pIface->GetOuter()) {
return;
}
IFWL_NoteThread* pThread = m_pIface->GetOwnerThread();
- _FWL_RETURN_IF_FAIL(pThread);
+ if (!pThread)
+ return;
IFWL_NoteDriver* pNoteDriver = pThread->GetNoteDriver();
- _FWL_RETURN_IF_FAIL(pNoteDriver);
+ if (!pNoteDriver)
+ return;
pNoteDriver->SendNote(pEvent);
}
#define FWL_WGT_CalcHeight 2048
@@ -287,9 +332,11 @@ CFX_SizeF CFWL_Widget::CalcTextSize(const CFX_WideString& wsText, int32_t iLineWidth) {
CFX_SizeF sz;
sz.Set(0, 0);
- _FWL_RETURN_VALUE_IF_FAIL(m_pIface, sz);
+ if (!m_pIface)
+ return sz;
IFWL_ThemeProvider* pTheme = m_pIface->GetThemeProvider();
- _FWL_RETURN_VALUE_IF_FAIL(pTheme, sz);
+ if (!pTheme)
+ return sz;
CFWL_ThemeText calPart;
calPart.m_pWidget = m_pIface;
calPart.m_wsText = wsText;
diff --git a/xfa/src/fwl/src/theme/barcodetp.cpp b/xfa/src/fwl/src/theme/barcodetp.cpp index fa9ced035f..3257226033 100644 --- a/xfa/src/fwl/src/theme/barcodetp.cpp +++ b/xfa/src/fwl/src/theme/barcodetp.cpp @@ -8,11 +8,13 @@ CFWL_BarcodeTP::CFWL_BarcodeTP() {}
CFWL_BarcodeTP::~CFWL_BarcodeTP() {}
FX_BOOL CFWL_BarcodeTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_Barcode;
}
FX_BOOL CFWL_BarcodeTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
switch (pParams->m_iPart) {
case FWL_PART_BCD_Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
diff --git a/xfa/src/fwl/src/theme/carettp.cpp b/xfa/src/fwl/src/theme/carettp.cpp index c7602b04ef..2271ee958b 100644 --- a/xfa/src/fwl/src/theme/carettp.cpp +++ b/xfa/src/fwl/src/theme/carettp.cpp @@ -8,11 +8,13 @@ CFWL_CaretTP::CFWL_CaretTP() {}
CFWL_CaretTP::~CFWL_CaretTP() {}
FX_BOOL CFWL_CaretTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_Caret;
}
FX_BOOL CFWL_CaretTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
switch (pParams->m_iPart) {
case FWL_PART_CAT_Background: {
if (!(pParams->m_dwStates & FWL_PARTSTATE_CAT_HightLight)) {
diff --git a/xfa/src/fwl/src/theme/checkboxtp.cpp b/xfa/src/fwl/src/theme/checkboxtp.cpp index c1856a9f80..4e01addc28 100644 --- a/xfa/src/fwl/src/theme/checkboxtp.cpp +++ b/xfa/src/fwl/src/theme/checkboxtp.cpp @@ -29,7 +29,8 @@ CFWL_CheckBoxTP::~CFWL_CheckBoxTP() { }
}
FX_BOOL CFWL_CheckBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
FX_DWORD dwHash = pWidget->GetClassID();
return dwHash == FWL_CLASSHASH_CheckBox ||
dwHash == FWL_CLASSHASH_RadioButton;
@@ -43,7 +44,8 @@ FX_DWORD CFWL_CheckBoxTP::SetThemeID(IFWL_Widget* pWidget, return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
}
FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pTextOut, FALSE);
+ if (!m_pTextOut)
+ return FALSE;
FX_BOOL bDisable = (pParams->m_dwStates & FWL_PARTSTATE_CKB_Mask1) ==
FWL_PARTSTATE_CKB_Disabled;
FX_ARGB argText =
@@ -52,7 +54,8 @@ FX_BOOL CFWL_CheckBoxTP::DrawText(CFWL_ThemeText* pParams) { return CFWL_WidgetTP::DrawText(pParams);
}
FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
switch (pParams->m_iPart) {
case FWL_PART_CKB_Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
diff --git a/xfa/src/fwl/src/theme/comboboxtp.cpp b/xfa/src/fwl/src/theme/comboboxtp.cpp index e60ab476a4..ab5947d3fa 100644 --- a/xfa/src/fwl/src/theme/comboboxtp.cpp +++ b/xfa/src/fwl/src/theme/comboboxtp.cpp @@ -11,11 +11,13 @@ CFWL_ComboBoxTP::CFWL_ComboBoxTP() { }
CFWL_ComboBoxTP::~CFWL_ComboBoxTP() {}
FX_BOOL CFWL_ComboBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_ComboBox;
}
FX_BOOL CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
switch (pParams->m_iPart) {
case FWL_PART_CMB_Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
diff --git a/xfa/src/fwl/src/theme/datetimepickertp.cpp b/xfa/src/fwl/src/theme/datetimepickertp.cpp index aac8cae71f..966fdd64d4 100644 --- a/xfa/src/fwl/src/theme/datetimepickertp.cpp +++ b/xfa/src/fwl/src/theme/datetimepickertp.cpp @@ -13,11 +13,13 @@ CFWL_DateTimePickerTP::~CFWL_DateTimePickerTP() { delete m_pThemeData;
}
FX_BOOL CFWL_DateTimePickerTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_DateTimePicker;
}
FX_BOOL CFWL_DateTimePickerTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
switch (pParams->m_iPart) {
case FWL_PART_DTP_Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
diff --git a/xfa/src/fwl/src/theme/edittp.cpp b/xfa/src/fwl/src/theme/edittp.cpp index 155cf57fc4..2aebc5dae0 100644 --- a/xfa/src/fwl/src/theme/edittp.cpp +++ b/xfa/src/fwl/src/theme/edittp.cpp @@ -8,7 +8,8 @@ CFWL_EditTP::CFWL_EditTP() {}
CFWL_EditTP::~CFWL_EditTP() {}
FX_BOOL CFWL_EditTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_Edit;
}
FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) {
diff --git a/xfa/src/fwl/src/theme/formtp.cpp b/xfa/src/fwl/src/theme/formtp.cpp index ba1ac68ffa..f7e3f4904c 100644 --- a/xfa/src/fwl/src/theme/formtp.cpp +++ b/xfa/src/fwl/src/theme/formtp.cpp @@ -48,7 +48,8 @@ FWL_ERR CFWL_FormTP::Finalize() { return CFWL_WidgetTP::Finalize();
}
FX_BOOL CFWL_FormTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
FX_DWORD dwHash = pWidget->GetClassID();
return dwHash == FWL_CLASSHASH_Form;
}
@@ -63,7 +64,8 @@ FX_DWORD CFWL_FormTP::SetThemeID(IFWL_Widget* pWidget, return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
}
FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
int32_t iActive = 0;
if (pParams->m_dwStates & FWL_PARTSTATE_FRM_Inactive) {
iActive = 1;
@@ -135,7 +137,8 @@ FX_BOOL CFWL_FormTP::DrawBackground(CFWL_ThemeBackground* pParams) { return TRUE;
}
FX_BOOL CFWL_FormTP::DrawText(CFWL_ThemeText* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pTextOut, FALSE);
+ if (!m_pTextOut)
+ return FALSE;
if (pParams->m_iPart == FWL_PART_FRM_Caption) {
m_pTextOut->SetTextColor(0xFFFFFFFF);
} else {
diff --git a/xfa/src/fwl/src/theme/listboxtp.cpp b/xfa/src/fwl/src/theme/listboxtp.cpp index 3542ae4278..3e19cf7697 100644 --- a/xfa/src/fwl/src/theme/listboxtp.cpp +++ b/xfa/src/fwl/src/theme/listboxtp.cpp @@ -8,11 +8,13 @@ CFWL_ListBoxTP::CFWL_ListBoxTP() {}
CFWL_ListBoxTP::~CFWL_ListBoxTP() {}
FX_BOOL CFWL_ListBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_ListBox;
}
FX_BOOL CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
switch (pParams->m_iPart) {
case FWL_PART_LTB_Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
diff --git a/xfa/src/fwl/src/theme/monthcalendartp.cpp b/xfa/src/fwl/src/theme/monthcalendartp.cpp index 13f9251820..b3897a2d63 100644 --- a/xfa/src/fwl/src/theme/monthcalendartp.cpp +++ b/xfa/src/fwl/src/theme/monthcalendartp.cpp @@ -56,7 +56,8 @@ CFWL_MonthCalendarTP::~CFWL_MonthCalendarTP() { delete m_pThemeData;
}
FX_BOOL CFWL_MonthCalendarTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar;
}
FX_DWORD CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget,
@@ -68,7 +69,8 @@ FX_DWORD CFWL_MonthCalendarTP::SetThemeID(IFWL_Widget* pWidget, return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
}
FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
switch (pParams->m_iPart) {
case FWL_PART_MCD_Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
@@ -132,7 +134,8 @@ FX_BOOL CFWL_MonthCalendarTP::DrawBackground(CFWL_ThemeBackground* pParams) { return TRUE;
}
FX_BOOL CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(m_pTextOut, FALSE);
+ if (!m_pTextOut)
+ return FALSE;
if ((pParams->m_iPart == FWL_PART_MCD_DatesIn) &&
!(pParams->m_dwStates & FWL_ITEMSTATE_MCD_Flag) &&
(pParams->m_dwStates &
diff --git a/xfa/src/fwl/src/theme/pictureboxtp.cpp b/xfa/src/fwl/src/theme/pictureboxtp.cpp index ef59bbf5c1..122cb3e5fa 100644 --- a/xfa/src/fwl/src/theme/pictureboxtp.cpp +++ b/xfa/src/fwl/src/theme/pictureboxtp.cpp @@ -8,11 +8,13 @@ CFWL_PictureBoxTP::CFWL_PictureBoxTP() {}
CFWL_PictureBoxTP::~CFWL_PictureBoxTP() {}
FX_BOOL CFWL_PictureBoxTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_PictureBox;
}
FX_BOOL CFWL_PictureBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
switch (pParams->m_iPart) {
case FWL_PART_PTB_Border: {
DrawBorder(pParams->m_pGraphics, &pParams->m_rtPart, &pParams->m_matrix);
diff --git a/xfa/src/fwl/src/theme/scrollbartp.cpp b/xfa/src/fwl/src/theme/scrollbartp.cpp index 50126f4edc..caf5562e28 100644 --- a/xfa/src/fwl/src/theme/scrollbartp.cpp +++ b/xfa/src/fwl/src/theme/scrollbartp.cpp @@ -17,7 +17,8 @@ CFWL_ScrollBarTP::~CFWL_ScrollBarTP() { }
}
FX_BOOL CFWL_ScrollBarTP::IsValidWidget(IFWL_Widget* pWidget) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FALSE);
+ if (!pWidget)
+ return FALSE;
return pWidget->GetClassID() == FWL_CLASSHASH_ScrollBar;
}
void* CFWL_ScrollBarTP::GetCapacity(CFWL_ThemePart* pThemePart,
@@ -37,7 +38,8 @@ FX_DWORD CFWL_ScrollBarTP::SetThemeID(IFWL_Widget* pWidget, return CFWL_WidgetTP::SetThemeID(pWidget, dwThemeID, bChildren);
}
FX_BOOL CFWL_ScrollBarTP::DrawBackground(CFWL_ThemeBackground* pParams) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
+ if (!pParams)
+ return FALSE;
IFWL_Widget* pWidget = pParams->m_pWidget;
FWLTHEME_STATE eState = FWLTHEME_STATE_Normal;
switch (pParams->m_dwStates & 0x03) {
diff --git a/xfa/src/fwl/src/theme/widgettp.cpp b/xfa/src/fwl/src/theme/widgettp.cpp index fb1803f85b..7db0f7ea22 100644 --- a/xfa/src/fwl/src/theme/widgettp.cpp +++ b/xfa/src/fwl/src/theme/widgettp.cpp @@ -55,7 +55,8 @@ FX_BOOL CFWL_WidgetTP::DrawText(CFWL_ThemeText* pParams) { InitTTO();
}
int32_t iLen = pParams->m_wsText.GetLength();
- _FWL_RETURN_VALUE_IF_FAIL(iLen > 0, FALSE)
+ if (iLen <= 0)
+ return FALSE;
CFX_Graphics* pGraphics = pParams->m_pGraphics;
m_pTextOut->SetRenderDevice(pGraphics->GetRenderDevice());
m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
@@ -134,8 +135,10 @@ FX_BOOL CFWL_WidgetTP::IsInPart(CFWL_ThemePart* pThemePart, return TRUE;
}
FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
- _FWL_RETURN_VALUE_IF_FAIL(m_pTextOut, FALSE);
+ if (!pParams)
+ return FALSE;
+ if (!m_pTextOut)
+ return FALSE;
m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
m_pTextOut->SetStyles(pParams->m_dwTTOStyles | FDE_TTOSTYLE_ArabicContext);
m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(),
@@ -208,8 +211,10 @@ void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, FX_DWORD dwStyles,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
pGraphics->SaveGraphState();
CFX_Color crStroke(FWL_GetThemeColor(m_dwThemeID) == 0
? ArgbEncode(255, 127, 157, 185)
@@ -233,8 +238,10 @@ void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, FX_DWORD dwStyles,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
FWLTHEME_EDGE eType;
FX_FLOAT fWidth;
switch (dwStyles & FWL_WGTSTYLE_EdgeMask) {
@@ -263,8 +270,10 @@ void CFWL_WidgetTP::Draw3DRect(CFX_Graphics* pGraphics, FX_ARGB cr3,
FX_ARGB cr4,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
pGraphics->SaveGraphState();
if (eType == FWLTHEME_EDGE_Flat) {
CFX_Path path;
@@ -347,8 +356,10 @@ void CFWL_WidgetTP::Draw3DCircle(CFX_Graphics* pGraphics, FX_ARGB cr3,
FX_ARGB cr4,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
pGraphics->SaveGraphState();
CFX_Path path;
path.Create();
@@ -381,8 +392,10 @@ void CFWL_WidgetTP::Draw3DCircle(CFX_Graphics* pGraphics, void CFWL_WidgetTP::DrawBorder(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
CFX_Path path;
path.Create();
path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height);
@@ -403,8 +416,10 @@ void CFWL_WidgetTP::FillSoildRect(CFX_Graphics* pGraphics, FX_ARGB fillColor,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
pGraphics->SaveGraphState();
CFX_Color crFill(fillColor);
pGraphics->SetFillColor(&crFill);
@@ -424,8 +439,10 @@ void CFWL_WidgetTP::DrawAxialShading(CFX_Graphics* pGraphics, CFX_Path* path,
int32_t fillMode,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(path);
+ if (!pGraphics)
+ return;
+ if (!path)
+ return;
CFX_PointF begPoint, endPoint;
begPoint.Set(fx1, fy1);
endPoint.Set(fx2, fy2);
@@ -442,8 +459,10 @@ void CFWL_WidgetTP::DrawAnnulusRect(CFX_Graphics* pGraphics, const CFX_RectF* pRect,
FX_FLOAT fRingWidth,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
pGraphics->SaveGraphState();
CFX_Color cr(fillColor);
pGraphics->SetFillColor(&cr);
@@ -461,8 +480,10 @@ void CFWL_WidgetTP::DrawAnnulusCircle(CFX_Graphics* pGraphics, const CFX_RectF* pRect,
FX_FLOAT fWidth,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
if (fWidth > pRect->width / 2) {
return;
}
@@ -481,8 +502,10 @@ void CFWL_WidgetTP::DrawAnnulusCircle(CFX_Graphics* pGraphics, void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics,
const CFX_RectF* pRect,
CFX_Matrix* pMatrix) {
- _FWL_RETURN_IF_FAIL(pGraphics);
- _FWL_RETURN_IF_FAIL(pRect);
+ if (!pGraphics)
+ return;
+ if (!pRect)
+ return;
pGraphics->SaveGraphState();
CFX_Color cr(0xFF000000);
pGraphics->SetStrokeColor(&cr);
diff --git a/xfa/src/fxfa/src/app/xfa_fwladapter.cpp b/xfa/src/fxfa/src/app/xfa_fwladapter.cpp index 94e10ab01d..3c9f1a1556 100644 --- a/xfa/src/fxfa/src/app/xfa_fwladapter.cpp +++ b/xfa/src/fxfa/src/app/xfa_fwladapter.cpp @@ -42,9 +42,11 @@ FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, }
FWL_ERR CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget,
const CFX_RectF* pRect) {
- _FWL_RETURN_VALUE_IF_FAIL(pWidget, FWL_ERR_Indefinite);
+ if (!pWidget)
+ return FWL_ERR_Indefinite;
CXFA_FFField* pField = (CXFA_FFField*)pWidget->GetPrivateData(pWidget);
- _FWL_RETURN_VALUE_IF_FAIL(pField, FWL_ERR_Indefinite);
+ if (!pField)
+ return FWL_ERR_Indefinite;
#ifdef _XFA_EMB
CFX_RectF rtInvalidate;
pWidget->GetWidgetRect(rtInvalidate);
diff --git a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp index 3b12058f88..0d2412858f 100644 --- a/xfa/src/fxfa/src/app/xfa_fwltheme.cpp +++ b/xfa/src/fxfa/src/app/xfa_fwltheme.cpp @@ -131,7 +131,8 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { }
CFX_Graphics* pGraphics = pParams->m_pGraphics;
CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice();
- _FWL_RETURN_VALUE_IF_FAIL(pRenderDevice, FALSE);
+ if (!pRenderDevice)
+ return FALSE;
m_pTextOut->SetRenderDevice(pRenderDevice);
CFX_Matrix mtPart = pParams->m_matrix;
CFX_Matrix* pMatrix = pGraphics->GetMatrix();
@@ -150,7 +151,8 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc();
CFX_Graphics* pGraphics = pParams->m_pGraphics;
CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice();
- _FWL_RETURN_VALUE_IF_FAIL(pRenderDevice, FALSE);
+ if (!pRenderDevice)
+ return FALSE;
m_pTextOut->SetRenderDevice(pRenderDevice);
m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
@@ -274,8 +276,10 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { if (!pWidget) {
return FWL_ERR_Indefinite;
}
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
- _FWL_RETURN_VALUE_IF_FAIL(m_pTextOut, FALSE);
+ if (!pParams)
+ return FALSE;
+ if (!m_pTextOut)
+ return FALSE;
m_pTextOut->SetFont(m_pCalendarFont);
m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize);
m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor);
@@ -293,8 +297,10 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { m_pTextOut->SetFont(pAcc->GetFDEFont());
m_pTextOut->SetFontSize(pAcc->GetFontSize());
m_pTextOut->SetTextColor(pAcc->GetTextColor());
- _FWL_RETURN_VALUE_IF_FAIL(pParams, FALSE);
- _FWL_RETURN_VALUE_IF_FAIL(m_pTextOut, FALSE);
+ if (!pParams)
+ return FALSE;
+ if (!m_pTextOut)
+ return FALSE;
m_pTextOut->SetAlignment(pParams->m_iTTOAlign);
m_pTextOut->SetStyles(pParams->m_dwTTOStyles);
m_pTextOut->CalcLogicSize(pParams->m_wsText, pParams->m_wsText.GetLength(),
|