summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-10 12:29:58 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-10 12:29:58 -0800
commit33c8c7602f8981c32d37a9b2e25496401e914391 (patch)
treedddaa54eefd8fe095a9e0174df88001c8435729b
parent7ed503d2dbe0b51550f85df1c47990d12eb68f59 (diff)
downloadpdfium-33c8c7602f8981c32d37a9b2e25496401e914391.tar.xz
Replace more static casts in FWL (part 3)
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1508883003 .
-rw-r--r--xfa/include/fwl/core/fwl_widgetmgr.h1
-rw-r--r--xfa/include/fxgraphics/fx_graphics.h7
-rw-r--r--xfa/src/fwl/src/core/fwl_appimp.cpp6
-rw-r--r--xfa/src/fwl/src/core/fwl_contentimp.cpp4
-rw-r--r--xfa/src/fwl/src/core/fwl_formimp.cpp94
-rw-r--r--xfa/src/fwl/src/core/fwl_gridimp.cpp160
-rw-r--r--xfa/src/fwl/src/core/fwl_noteimp.cpp144
-rw-r--r--xfa/src/fwl/src/core/fwl_panelimp.cpp10
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetimp.cpp79
-rw-r--r--xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp20
-rw-r--r--xfa/src/fwl/src/core/include/fwl_noteimp.h16
-rw-r--r--xfa/src/fwl/src/core/include/fwl_widgetmgrimp.h1
-rw-r--r--xfa/src/fwl/src/lightwidget/barcode.cpp4
-rw-r--r--xfa/src/fwl/src/lightwidget/caret.cpp8
-rw-r--r--xfa/src/fwl/src/lightwidget/checkbox.cpp4
-rw-r--r--xfa/src/fwl/src/lightwidget/combobox.cpp103
-rw-r--r--xfa/src/fwl/src/lightwidget/datetimepicker.cpp47
-rw-r--r--xfa/src/fwl/src/lightwidget/edit.cpp80
-rw-r--r--xfa/src/fwl/src/lightwidget/listbox.cpp82
-rw-r--r--xfa/src/fxgraphics/src/fx_graphics.cpp7
20 files changed, 451 insertions, 426 deletions
diff --git a/xfa/include/fwl/core/fwl_widgetmgr.h b/xfa/include/fwl/core/fwl_widgetmgr.h
index c191cae0c2..b4d03e0ca4 100644
--- a/xfa/include/fwl/core/fwl_widgetmgr.h
+++ b/xfa/include/fwl/core/fwl_widgetmgr.h
@@ -30,7 +30,6 @@ class IFWL_WidgetMgr {
FWL_WGTRELATION eRelation) = 0;
virtual int32_t GetWidgetIndex(IFWL_Widget* pWidget) = 0;
virtual FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) = 0;
- virtual FX_BOOL IsWidget(void* pObj) = 0;
virtual FWL_ERR RepaintWidget(IFWL_Widget* pWidget,
const CFX_RectF* pRect = NULL) = 0;
virtual FX_DWORD GetCapability() = 0;
diff --git a/xfa/include/fxgraphics/fx_graphics.h b/xfa/include/fxgraphics/fx_graphics.h
index fb18dcebe9..4131f45f86 100644
--- a/xfa/include/fxgraphics/fx_graphics.h
+++ b/xfa/include/fxgraphics/fx_graphics.h
@@ -212,7 +212,7 @@ class CFX_Graphics {
const CFX_RectF& rect,
CFX_Matrix* matrix = NULL);
- FX_ERR ConcatMatrix(CFX_Matrix* matrix);
+ FX_ERR ConcatMatrix(const CFX_Matrix* matrix);
CFX_Matrix* GetMatrix();
@@ -241,13 +241,12 @@ class CFX_Graphics {
FX_BOOL isMultiline = FALSE,
CFX_Matrix* matrix = NULL);
- FX_ERR Transfer(CFX_Graphics* graphics, CFX_Matrix* matrix = NULL);
-
+ FX_ERR Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix);
FX_ERR Transfer(CFX_Graphics* graphics,
FX_FLOAT srcLeft,
FX_FLOAT srcTop,
const CFX_RectF& dstRect,
- CFX_Matrix* matrix = NULL);
+ const CFX_Matrix* matrix);
CFX_RenderDevice* GetRenderDevice();
diff --git a/xfa/src/fwl/src/core/fwl_appimp.cpp b/xfa/src/fwl/src/core/fwl_appimp.cpp
index 983219a683..85d34e3690 100644
--- a/xfa/src/fwl/src/core/fwl_appimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_appimp.cpp
@@ -74,7 +74,8 @@ IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() {
return m_pAdapterNative;
}
IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr() {
- return ((CFWL_WidgetMgr*)FWL_GetWidgetMgr())->GetAdapterWidgetMgr();
+ return static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr())
+ ->GetAdapterWidgetMgr();
}
IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() {
return m_pWidgetMgr;
@@ -113,7 +114,8 @@ FWL_ERR FWL_SetFullScreen(IFWL_Widget* pWidget, FX_BOOL bFullScreen) {
IFWL_NoteThread* pNoteTread = pWidget->GetOwnerThread();
if (!pNoteTread)
return FWL_ERR_Succeeded;
- CFWL_NoteDriver* pNoteDriver = (CFWL_NoteDriver*)pNoteTread->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver =
+ static_cast<CFWL_NoteDriver*>(pNoteTread->GetNoteDriver());
if (!pNoteTread)
return FWL_ERR_Succeeded;
pNoteDriver->NotifyFullScreenMode(pWidget, bFullScreen);
diff --git a/xfa/src/fwl/src/core/fwl_contentimp.cpp b/xfa/src/fwl/src/core/fwl_contentimp.cpp
index 4d446d3498..753c59d843 100644
--- a/xfa/src/fwl/src/core/fwl_contentimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_contentimp.cpp
@@ -49,7 +49,7 @@ FWL_ERR CFWL_ContentImp::InsertWidget(IFWL_Widget* pChild, int32_t nIndex) {
if (nIndex == -1) {
return FWL_ERR_Succeeded;
}
- CFWL_WidgetMgr* pMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pMgr)
return FWL_ERR_Indefinite;
pMgr->SetWidgetIndex(pChild, nIndex);
@@ -62,7 +62,7 @@ FWL_ERR CFWL_ContentImp::RemoveWidget(IFWL_Widget* pWidget) {
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ContentImp::RemoveAllWidgets() {
- CFWL_WidgetMgr* pMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pMgr)
return FWL_ERR_Indefinite;
while (IFWL_Widget* widget =
diff --git a/xfa/src/fwl/src/core/fwl_formimp.cpp b/xfa/src/fwl/src/core/fwl_formimp.cpp
index 2ec7b8b468..bd2e5aa454 100644
--- a/xfa/src/fwl/src/core/fwl_formimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_formimp.cpp
@@ -141,7 +141,7 @@ FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) {
}
#ifdef FWL_UseMacSystemBorder
rect = m_rtRelative;
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FWL_ERR_Indefinite;
IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
@@ -159,14 +159,12 @@ FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) {
if (pTheme) {
CFWL_ThemePart part;
part.m_pWidget = m_pInterface;
- FX_FLOAT* value = NULL;
- value = (FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CXBorder);
- x = *value;
- value = (FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CYBorder);
- y = *value;
- value =
- (FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_FRM_CYCaption);
- t = *value;
+ x = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CXBorder));
+ y = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CYBorder));
+ t = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_FRM_CYCaption));
}
rect = m_pProperties->m_rtWidget;
rect.Offset(-rect.left, -rect.top);
@@ -393,7 +391,7 @@ IFWL_Widget* CFWL_FormImp::DoModal() {
if (!pDriver)
return NULL;
m_pNoteLoop = new CFWL_NoteLoop(this);
- pDriver->PushNoteLoop((IFWL_NoteLoop*)m_pNoteLoop);
+ pDriver->PushNoteLoop(m_pNoteLoop);
m_bDoModalFlag = TRUE;
SetStates(FWL_WGTSTATE_Invisible, FALSE);
pDriver->Run();
@@ -417,7 +415,8 @@ FWL_ERR CFWL_FormImp::EndDoModal() {
IFWL_NoteThread* pThread = GetOwnerThread();
if (!pThread)
return NULL;
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
if (!pDriver)
return NULL;
pDriver->PopNoteLoop();
@@ -466,7 +465,8 @@ void CFWL_FormImp::ShowChildWidget(IFWL_Widget* pParent) {
IFWL_App* pApp = FWL_GetApp();
if (!pApp)
return;
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)pApp->GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr =
+ static_cast<CFWL_WidgetMgr*>(pApp->GetWidgetMgr());
if (!pWidgetMgr)
return;
IFWL_Widget* pChild =
@@ -551,7 +551,7 @@ CFWL_SysBtn* CFWL_FormImp::GetSysBtnByIndex(int32_t nIndex) {
if (m_pCloseBox) {
arrBtn.Add(m_pCloseBox);
}
- return (CFWL_SysBtn*)arrBtn[nIndex];
+ return static_cast<CFWL_SysBtn*>(arrBtn[nIndex]);
}
int32_t CFWL_FormImp::GetSysBtnIndex(CFWL_SysBtn* pBtn) {
CFX_PtrArray arrBtn;
@@ -574,10 +574,9 @@ FX_FLOAT CFWL_FormImp::GetCaptionHeight() {
dwCapacity = FWL_WGTCAPACITY_FRM_CYNarrowCaption;
}
if (dwCapacity > 0) {
- FX_FLOAT* pfCapHeight = (FX_FLOAT*)GetThemeCapacity(dwCapacity);
- if (!pfCapHeight)
- return 0;
- return *pfCapHeight;
+ FX_FLOAT* pfCapHeight =
+ static_cast<FX_FLOAT*>(GetThemeCapacity(dwCapacity));
+ return pfCapHeight ? *pfCapHeight : 0;
}
return 0;
}
@@ -618,7 +617,8 @@ void CFWL_FormImp::DrawCaptionText(CFX_Graphics* pGs,
void CFWL_FormImp::DrawIconImage(CFX_Graphics* pGs,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- IFWL_FormDP* pData = (IFWL_FormDP*)m_pProperties->m_pDataProvider;
+ IFWL_FormDP* pData =
+ static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
CFWL_ThemeBackground param;
param.m_pWidget = m_pInterface;
param.m_iPart = FWL_PART_FRM_Icon;
@@ -640,7 +640,7 @@ void CFWL_FormImp::GetEdgeRect(CFX_RectF& rtEdge) {
}
void CFWL_FormImp::SetWorkAreaRect() {
m_rtRestore = m_pProperties->m_rtWidget;
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return;
m_bSetMaximize = TRUE;
@@ -734,8 +734,10 @@ void CFWL_FormImp::Layout() {
}
}
void CFWL_FormImp::ReSetSysBtn() {
- m_fCXBorder = *(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_CXBorder);
- m_fCYBorder = *(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_CYBorder);
+ m_fCXBorder =
+ *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_CXBorder));
+ m_fCYBorder =
+ *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_CYBorder));
RemoveSysButtons();
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
m_bCustomizeLayout = pTheme->IsCustomizedLayout(m_pInterface);
@@ -803,7 +805,8 @@ void CFWL_FormImp::ReSetSysBtn() {
}
m_iSysBox++;
}
- IFWL_FormDP* pData = (IFWL_FormDP*)m_pProperties->m_pDataProvider;
+ IFWL_FormDP* pData =
+ static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
if (m_pProperties->m_dwStyles & FWL_WGTSTYLE_Icon &&
pData->GetIcon(m_pInterface, FALSE)) {
if (m_bCustomizeLayout) {
@@ -831,7 +834,8 @@ void CFWL_FormImp::RegisterForm() {
IFWL_NoteThread* pThread = GetOwnerThread();
if (!pThread)
return;
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
if (!pDriver)
return;
pDriver->RegisterForm(this);
@@ -840,7 +844,8 @@ void CFWL_FormImp::UnRegisterForm() {
IFWL_NoteThread* pThread = GetOwnerThread();
if (!pThread)
return;
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
if (!pDriver)
return;
pDriver->UnRegisterForm(this);
@@ -849,18 +854,22 @@ FX_BOOL CFWL_FormImp::IsDoModal() {
return m_bDoModalFlag;
}
void CFWL_FormImp::SetThemeData() {
- m_fSmallIconSz = *(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_FRM_SmallIcon);
- m_fBigIconSz = *(FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_FRM_BigIcon);
+ m_fSmallIconSz =
+ *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_FRM_SmallIcon));
+ m_fBigIconSz =
+ *static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_FRM_BigIcon));
}
FX_BOOL CFWL_FormImp::HasIcon() {
- IFWL_FormDP* pData = (IFWL_FormDP*)m_pProperties->m_pDataProvider;
+ IFWL_FormDP* pData =
+ static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
return !!pData->GetIcon(m_pInterface, FALSE);
}
void CFWL_FormImp::UpdateIcon() {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return;
- IFWL_FormDP* pData = (IFWL_FormDP*)m_pProperties->m_pDataProvider;
+ IFWL_FormDP* pData =
+ static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
CFX_DIBitmap* pBigIcon = pData->GetIcon(m_pInterface, TRUE);
CFX_DIBitmap* pSmallIcon = pData->GetIcon(m_pInterface, FALSE);
if (pBigIcon && pBigIcon != m_pBigIcon) {
@@ -873,10 +882,11 @@ void CFWL_FormImp::UpdateIcon() {
}
}
void CFWL_FormImp::UpdateCaption() {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return;
- IFWL_FormDP* pData = (IFWL_FormDP*)m_pProperties->m_pDataProvider;
+ IFWL_FormDP* pData =
+ static_cast<IFWL_FormDP*>(m_pProperties->m_pDataProvider);
if (!pData)
return;
CFX_WideString text;
@@ -963,7 +973,8 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
case FWL_MSGHASH_Activate: {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated;
IFWL_NoteThread* pThread = m_pOwner->GetOwnerThread();
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
IFWL_Widget* pSubFocus =
pSubFocusImp ? pSubFocusImp->GetInterface() : NULL;
@@ -976,7 +987,8 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
case FWL_MSGHASH_Deactivate: {
m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Deactivated;
IFWL_NoteThread* pThread = m_pOwner->GetOwnerThread();
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
CFWL_WidgetImp* pSubFocusImp = m_pOwner->GetSubFocus();
IFWL_Widget* pSubFocus =
pSubFocusImp ? pSubFocusImp->GetInterface() : NULL;
@@ -995,7 +1007,7 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
break;
}
case FWL_MSGHASH_Mouse: {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
switch (pMsg->m_dwCmd) {
case FWL_MSGMOUSECMD_LButtonDown: {
OnLButtonDown(pMsg);
@@ -1025,7 +1037,8 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
break;
}
case FWL_MSGHASH_Size: {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr =
+ static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return 0;
pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface);
@@ -1033,7 +1046,7 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
break;
}
m_pOwner->m_bSetMaximize = FALSE;
- CFWL_MsgSize* pMsg = (CFWL_MsgSize*)pMessage;
+ CFWL_MsgSize* pMsg = static_cast<CFWL_MsgSize*>(pMessage);
CFX_RectF rt;
pWidgetMgr->GetWidgetRect_Native(m_pOwner->m_pInterface, rt);
m_pOwner->m_pProperties->m_rtWidget.left = rt.left;
@@ -1044,11 +1057,11 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
break;
}
case FWL_MSGHASH_WindowMove: {
- OnWindowMove((CFWL_MsgWindowMove*)pMessage);
+ OnWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage));
break;
}
case FWL_MSGHASH_Close: {
- OnClose((CFWL_MsgClose*)pMessage);
+ OnClose(static_cast<CFWL_MsgClose*>(pMessage));
break;
}
default: { iRet = 0; }
@@ -1119,7 +1132,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();
+ CFWL_WidgetMgr* pWidgetMgr =
+ static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return;
pWidgetMgr->SetMinimize_Native(m_pOwner->m_pInterface);
@@ -1130,7 +1144,7 @@ void CFWL_FormImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
}
void CFWL_FormImpDelegate::OnMouseMove(CFWL_MsgMouse* pMsg) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (m_pOwner->m_bLButtonDown) {
IFWL_AdapterNative* pNative = FWL_GetAdapterNative();
IFWL_AdapterCursorMgr* pCursorMgr = pNative->GetCursorMgr();
diff --git a/xfa/src/fwl/src/core/fwl_gridimp.cpp b/xfa/src/fwl/src/core/fwl_gridimp.cpp
index ca9c6c26fd..4524e9e423 100644
--- a/xfa/src/fwl/src/core/fwl_gridimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_gridimp.cpp
@@ -141,12 +141,12 @@ CFWL_GridImp::CFWL_GridImp(const CFWL_WidgetImpProperties& properties,
CFWL_GridImp::~CFWL_GridImp() {
int32_t iCount = m_Columns.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- delete (CFWL_GridColRow*)m_Columns[i];
+ delete static_cast<CFWL_GridColRow*>(m_Columns[i]);
}
m_Columns.RemoveAll();
iCount = m_Rows.GetSize();
for (int32_t j = 0; j < iCount; j++) {
- delete (CFWL_GridColRow*)m_Rows[j];
+ delete static_cast<CFWL_GridColRow*>(m_Rows[j]);
}
m_Rows.RemoveAll();
FX_POSITION ps = m_mapWidgetInfo.GetStartPosition();
@@ -213,7 +213,7 @@ FWL_ERR CFWL_GridImp::DrawWidget(CFX_Graphics* pGraphics,
}
pGraphics->SaveGraphState();
if (pMatrix) {
- pGraphics->ConcatMatrix((CFX_Matrix*)pMatrix);
+ pGraphics->ConcatMatrix(pMatrix);
}
{
FX_BOOL bDrawLine = FALSE;
@@ -221,25 +221,21 @@ FWL_ERR CFWL_GridImp::DrawWidget(CFX_Graphics* pGraphics,
path.Create();
int32_t iColumns = m_Columns.GetSize();
for (int32_t i = 1; i < iColumns; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)m_Columns[i];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Columns[i]);
if (!pColRow) {
continue;
}
- if (!bDrawLine) {
- bDrawLine = TRUE;
- }
+ bDrawLine = TRUE;
path.AddLine(pColRow->m_fActualPos, 0, pColRow->m_fActualPos,
m_pProperties->m_rtWidget.height);
}
int32_t iRows = m_Rows.GetSize();
for (int32_t j = 1; j < iRows; j++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)m_Rows[j];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Rows[j]);
if (!pColRow) {
continue;
}
- if (!bDrawLine) {
- bDrawLine = TRUE;
- }
+ bDrawLine = TRUE;
path.AddLine(0, pColRow->m_fActualPos, m_pProperties->m_rtWidget.width,
pColRow->m_fActualPos);
}
@@ -267,8 +263,8 @@ FWL_ERR CFWL_GridImp::RemoveWidget(IFWL_Widget* pWidget) {
if (!pWidget)
return FWL_ERR_Indefinite;
CFWL_ContentImp::RemoveWidget(pWidget);
- if (CFWL_GridWidgetInfo* pInfo =
- (CFWL_GridWidgetInfo*)m_mapWidgetInfo.GetValueAt(pWidget)) {
+ if (CFWL_GridWidgetInfo* pInfo = static_cast<CFWL_GridWidgetInfo*>(
+ m_mapWidgetInfo.GetValueAt(pWidget))) {
m_mapWidgetInfo.RemoveKey(pWidget);
delete pInfo;
int32_t nIndex = m_Widgets.Find(pWidget);
@@ -319,7 +315,7 @@ int32_t CFWL_GridImp::GetIndex(FWL_HGRIDCOLROW hColRow) {
FX_FLOAT CFWL_GridImp::GetSize(FWL_HGRIDCOLROW hColRow, FWL_GRIDUNIT& eUnit) {
if (!hColRow)
return -1;
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
+ CFWL_GridColRow* pColRow = reinterpret_cast<CFWL_GridColRow*>(hColRow);
eUnit = pColRow->m_Size.eUnit;
return pColRow->m_Size.fLength;
}
@@ -328,7 +324,7 @@ FWL_ERR CFWL_GridImp::SetSize(FWL_HGRIDCOLROW hColRow,
FWL_GRIDUNIT eUnit) {
if (!hColRow)
return FWL_ERR_Indefinite;
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
+ CFWL_GridColRow* pColRow = reinterpret_cast<CFWL_GridColRow*>(hColRow);
pColRow->m_Size.eUnit = eUnit;
pColRow->m_Size.fLength = fSize;
return FWL_ERR_Succeeded;
@@ -337,7 +333,7 @@ FX_FLOAT CFWL_GridImp::GetMinSize(FWL_HGRIDCOLROW hColRow,
FWL_GRIDUNIT& eUnit) {
if (!hColRow)
return -1;
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
+ CFWL_GridColRow* pColRow = reinterpret_cast<CFWL_GridColRow*>(hColRow);
eUnit = pColRow->m_MinSize.eUnit;
return pColRow->m_MinSize.fLength;
}
@@ -346,7 +342,7 @@ FWL_ERR CFWL_GridImp::SetMinSize(FWL_HGRIDCOLROW hColRow,
FWL_GRIDUNIT eUnit) {
if (!hColRow)
return FWL_ERR_Indefinite;
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
+ CFWL_GridColRow* pColRow = reinterpret_cast<CFWL_GridColRow*>(hColRow);
pColRow->m_MinSize.eUnit = eUnit;
pColRow->m_MinSize.fLength = fSize;
return FWL_ERR_Succeeded;
@@ -355,7 +351,7 @@ FX_FLOAT CFWL_GridImp::GetMaxSize(FWL_HGRIDCOLROW hColRow,
FWL_GRIDUNIT& eUnit) {
if (!hColRow)
return -1;
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
+ CFWL_GridColRow* pColRow = reinterpret_cast<CFWL_GridColRow*>(hColRow);
eUnit = pColRow->m_MaxSize.eUnit;
return pColRow->m_MaxSize.fLength;
}
@@ -364,7 +360,7 @@ FWL_ERR CFWL_GridImp::SetMaxSize(FWL_HGRIDCOLROW hColRow,
FWL_GRIDUNIT eUnit) {
if (!hColRow)
return FWL_ERR_Indefinite;
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)hColRow;
+ CFWL_GridColRow* pColRow = reinterpret_cast<CFWL_GridColRow*>(hColRow);
pColRow->m_MaxSize.eUnit = eUnit;
pColRow->m_MaxSize.fLength = fSize;
return FWL_ERR_Succeeded;
@@ -373,12 +369,12 @@ FX_BOOL CFWL_GridImp::DeleteColRow(FWL_HGRIDCOLROW hColRow) {
int32_t nIndex = m_Columns.Find(hColRow);
if (nIndex >= 0) {
m_Columns.RemoveAt(nIndex);
- delete (CFWL_GridColRow*)hColRow;
+ delete reinterpret_cast<CFWL_GridColRow*>(hColRow);
return TRUE;
}
nIndex = m_Rows.Find(hColRow);
if (nIndex >= 0) {
- delete (CFWL_GridColRow*)hColRow;
+ delete reinterpret_cast<CFWL_GridColRow*>(hColRow);
m_Rows.RemoveAt(nIndex);
return TRUE;
}
@@ -388,7 +384,8 @@ FX_BOOL CFWL_GridImp::IsColumn(FWL_HGRIDCOLROW hColRow) {
return m_Columns.Find(hColRow) != -1;
}
int32_t CFWL_GridImp::GetWidgetPos(IFWL_Widget* pWidget, FX_BOOL bColumn) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
return bColumn ? pInfo->m_iColumn : pInfo->m_iRow;
}
@@ -397,14 +394,16 @@ int32_t CFWL_GridImp::GetWidgetPos(IFWL_Widget* pWidget, FX_BOOL bColumn) {
FWL_ERR CFWL_GridImp::SetWidgetPos(IFWL_Widget* pWidget,
int32_t iPos,
FX_BOOL bColumn) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
bColumn ? pInfo->m_iColumn = iPos : pInfo->m_iRow = iPos;
}
return FWL_ERR_Succeeded;
}
int32_t CFWL_GridImp::GetWidgetSpan(IFWL_Widget* pWidget, FX_BOOL bColumn) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
return bColumn ? pInfo->m_iColumnSpan : pInfo->m_iRowSpan;
}
@@ -413,7 +412,8 @@ int32_t CFWL_GridImp::GetWidgetSpan(IFWL_Widget* pWidget, FX_BOOL bColumn) {
FWL_ERR CFWL_GridImp::SetWidgetSpan(IFWL_Widget* pWidget,
int32_t iSpan,
FX_BOOL bColumn) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
bColumn ? pInfo->m_iColumnSpan = iSpan : pInfo->m_iRowSpan = iSpan;
}
@@ -422,7 +422,8 @@ FWL_ERR CFWL_GridImp::SetWidgetSpan(IFWL_Widget* pWidget,
FX_FLOAT CFWL_GridImp::GetWidgetSize(IFWL_Widget* pWidget,
FWL_GRIDSIZE eSize,
FWL_GRIDUNIT& eUnit) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
eUnit = pInfo->m_Size[eSize].eUnit;
return pInfo->m_Size[eSize].fLength;
@@ -433,7 +434,8 @@ FWL_ERR CFWL_GridImp::SetWidgetSize(IFWL_Widget* pWidget,
FWL_GRIDSIZE eSize,
FX_FLOAT fSize,
FWL_GRIDUNIT eUit) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
pInfo->m_Size[eSize].fLength = fSize;
pInfo->m_Size[eSize].eUnit = eUit;
@@ -443,7 +445,8 @@ FWL_ERR CFWL_GridImp::SetWidgetSize(IFWL_Widget* pWidget,
FX_BOOL CFWL_GridImp::GetWidgetMargin(IFWL_Widget* pWidget,
FWL_GRIDMARGIN eMargin,
FX_FLOAT& fMargin) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
fMargin = pInfo->m_Margin[eMargin];
return (pInfo->m_dwMarginFlag & (1 << eMargin)) != 0;
@@ -453,7 +456,8 @@ FX_BOOL CFWL_GridImp::GetWidgetMargin(IFWL_Widget* pWidget,
FWL_ERR CFWL_GridImp::SetWidgetMargin(IFWL_Widget* pWidget,
FWL_GRIDMARGIN eMargin,
FX_FLOAT fMargin) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
pInfo->m_Margin[eMargin] = fMargin;
pInfo->m_dwMarginFlag |= (1 << eMargin);
@@ -462,7 +466,8 @@ FWL_ERR CFWL_GridImp::SetWidgetMargin(IFWL_Widget* pWidget,
}
FWL_ERR CFWL_GridImp::RemoveWidgetMargin(IFWL_Widget* pWidget,
FWL_GRIDMARGIN eMargin) {
- CFWL_GridWidgetInfo* pInfo = (CFWL_GridWidgetInfo*)GetWidgetInfo(pWidget);
+ CFWL_GridWidgetInfo* pInfo =
+ static_cast<CFWL_GridWidgetInfo*>(GetWidgetInfo(pWidget));
if (pInfo) {
pInfo->m_dwMarginFlag &= ~(1 << eMargin);
}
@@ -480,7 +485,7 @@ FWL_ERR CFWL_GridImp::SetGridSize(FWL_GRIDSIZE eSize,
return FWL_ERR_Succeeded;
}
CFWL_GridWidgetInfo* CFWL_GridImp::GetWidgetInfo(IFWL_Widget* pWidget) {
- return (CFWL_GridWidgetInfo*)m_mapWidgetInfo.GetValueAt(pWidget);
+ return static_cast<CFWL_GridWidgetInfo*>(m_mapWidgetInfo.GetValueAt(pWidget));
}
void CFWL_GridImp::ProcFixedColRow(CFWL_GridColRow* pColRow,
int32_t nIndex,
@@ -489,9 +494,11 @@ void CFWL_GridImp::ProcFixedColRow(CFWL_GridColRow* pColRow,
pColRow->m_fActualSize = fColRowSize;
FX_POSITION ps = m_mapWidgetInfo.GetStartPosition();
while (ps) {
- IFWL_Widget* pWidget = NULL;
- CFWL_GridWidgetInfo* pInfo = NULL;
- m_mapWidgetInfo.GetNextAssoc(ps, (void*&)pWidget, (void*&)pInfo);
+ void* key = nullptr;
+ void* value = nullptr;
+ m_mapWidgetInfo.GetNextAssoc(ps, key, value);
+ IFWL_Widget* pWidget = static_cast<IFWL_Widget*>(key);
+ CFWL_GridWidgetInfo* pInfo = static_cast<CFWL_GridWidgetInfo*>(value);
if (bColumn) {
if (pInfo->m_iColumn == nIndex && pInfo->m_iColumnSpan == 1) {
CalcWidgetWidth(pWidget, pInfo, pColRow->m_fActualSize);
@@ -650,7 +657,7 @@ FX_FLOAT CFWL_GridImp::ProcessColumns(FX_FLOAT fWidth) {
CFX_PtrArray scaledColumns;
FX_FLOAT fScaledColumnNum = 0;
for (int32_t i = 0; i < iColumns; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)m_Columns[i];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Columns[i]);
if (!pColRow) {
continue;
}
@@ -686,8 +693,8 @@ FX_FLOAT CFWL_GridImp::ProcessColumns(FX_FLOAT fWidth) {
int32_t iAutoColRows = 0;
int32_t iScaledColRows = 0;
for (int32_t i = 0; i < pInfo->m_iColumnSpan; i++) {
- CFWL_GridColRow* pColumn =
- (CFWL_GridColRow*)GetColRow(TRUE, pInfo->m_iColumn + i);
+ CFWL_GridColRow* pColumn = reinterpret_cast<CFWL_GridColRow*>(
+ GetColRow(TRUE, pInfo->m_iColumn + i));
if (!pColumn) {
break;
}
@@ -712,7 +719,7 @@ FX_FLOAT CFWL_GridImp::ProcessColumns(FX_FLOAT fWidth) {
}
int32_t iAutoCols = autoColumns.GetSize();
for (int32_t k = 0; k < iAutoCols; k++) {
- fAutoWidth += ((CFWL_GridColRow*)autoColumns[k])->m_fActualSize;
+ fAutoWidth += static_cast<CFWL_GridColRow*>(autoColumns[k])->m_fActualSize;
}
FX_FLOAT fScaledWidth = fWidth - fFixedWidth - fAutoWidth;
if (fScaledWidth > 0 && fScaledColumnNum > 0) {
@@ -734,7 +741,7 @@ FX_FLOAT CFWL_GridImp::ProcessRows(FX_FLOAT fHeight) {
CFX_PtrArray scaledRows;
FX_FLOAT fScaledRowNum = 0;
for (int32_t i = 0; i < iRows; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)m_Rows[i];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Rows[i]);
if (!pColRow) {
continue;
}
@@ -771,8 +778,8 @@ FX_FLOAT CFWL_GridImp::ProcessRows(FX_FLOAT fHeight) {
int32_t iAutoColRows = 0;
int32_t iScaledColRows = 0;
for (int32_t i = 0; i < pInfo->m_iRowSpan; i++) {
- CFWL_GridColRow* pRow =
- (CFWL_GridColRow*)GetColRow(FALSE, pInfo->m_iRow + i);
+ CFWL_GridColRow* pRow = reinterpret_cast<CFWL_GridColRow*>(
+ GetColRow(FALSE, pInfo->m_iRow + i));
if (!pRow) {
break;
}
@@ -797,7 +804,8 @@ FX_FLOAT CFWL_GridImp::ProcessRows(FX_FLOAT fHeight) {
}
int32_t iAutoRows = autoRows.GetSize();
for (int32_t k = 0; k < iAutoRows; k++) {
- fAutoHeigt += ((CFWL_GridColRow*)autoRows[k])->m_fActualSize;
+ fAutoHeigt +=
+ reinterpret_cast<CFWL_GridColRow*>(autoRows[k])->m_fActualSize;
}
FX_FLOAT fScaledHeight = fHeight - fFixedHeight - fAutoHeigt;
if (fScaledHeight > 0 && fScaledRowNum > 0) {
@@ -821,7 +829,7 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainColumns() {
FX_FLOAT fScaledColumnNum = 0;
FX_FLOAT fScaledMaxPerWidth = 0;
for (int32_t i = 0; i < iColumns; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)m_Columns[i];
+ CFWL_GridColRow* pColRow = reinterpret_cast<CFWL_GridColRow*>(m_Columns[i]);
if (!pColRow) {
continue;
}
@@ -853,7 +861,7 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainColumns() {
}
iColumns = scaledColumns.GetSize();
for (int32_t j = 0; j < iColumns; j++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)scaledColumns[j];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(scaledColumns[j]);
if (!pColRow) {
continue;
}
@@ -874,8 +882,8 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainColumns() {
int32_t iAutoColRows = 0;
int32_t iScaledColRows = 0;
for (int32_t i = 0; i < pInfo->m_iColumnSpan; i++) {
- CFWL_GridColRow* pColumn =
- (CFWL_GridColRow*)GetColRow(TRUE, pInfo->m_iColumn + i);
+ CFWL_GridColRow* pColumn = reinterpret_cast<CFWL_GridColRow*>(
+ GetColRow(TRUE, pInfo->m_iColumn + i));
if (!pColumn) {
break;
}
@@ -908,12 +916,13 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainColumns() {
FX_FLOAT fAutoWidth = 0;
int32_t iAutoCols = autoColumns.GetSize();
for (int32_t m = 0; m < iAutoCols; m++) {
- fAutoWidth += ((CFWL_GridColRow*)autoColumns[m])->m_fActualSize;
+ fAutoWidth += static_cast<CFWL_GridColRow*>(autoColumns[m])->m_fActualSize;
}
FX_FLOAT fScaledWidth = 0;
iColumns = scaledColumns.GetSize();
for (int32_t n = 0; n < iColumns; n++) {
- fScaledWidth += ((CFWL_GridColRow*)scaledColumns[n])->m_fActualSize;
+ fScaledWidth +=
+ static_cast<CFWL_GridColRow*>(scaledColumns[n])->m_fActualSize;
}
return fFixedWidth + fAutoWidth + fScaledWidth;
}
@@ -933,7 +942,7 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainRows() {
FX_FLOAT fScaledRowNum = 0;
FX_FLOAT fScaledMaxPerHeight = 0;
for (int32_t i = 0; i < iRows; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)m_Rows[i];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Rows[i]);
if (!pColRow) {
continue;
}
@@ -966,7 +975,7 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainRows() {
}
iRows = scaledRows.GetSize();
for (int32_t j = 0; j < iRows; j++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)scaledRows[j];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(scaledRows[j]);
if (!pColRow) {
continue;
}
@@ -974,9 +983,11 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainRows() {
}
FX_POSITION ps = m_mapWidgetInfo.GetStartPosition();
while (ps) {
- IFWL_Widget* pWidget = NULL;
- CFWL_GridWidgetInfo* pInfo = NULL;
- m_mapWidgetInfo.GetNextAssoc(ps, (void*&)pWidget, (void*&)pInfo);
+ void* key = nullptr;
+ void* value = nullptr;
+ m_mapWidgetInfo.GetNextAssoc(ps, key, value);
+ IFWL_Widget* pWidget = static_cast<IFWL_Widget*>(key);
+ CFWL_GridWidgetInfo* pInfo = static_cast<CFWL_GridWidgetInfo*>(value);
if (pInfo->m_iRowSpan < 2) {
continue;
}
@@ -987,8 +998,8 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainRows() {
int32_t iAutoColRows = 0;
int32_t iScaledColRows = 0;
for (int32_t i = 0; i < pInfo->m_iRowSpan; i++) {
- CFWL_GridColRow* pRow =
- (CFWL_GridColRow*)GetColRow(FALSE, pInfo->m_iRow + i);
+ CFWL_GridColRow* pRow = reinterpret_cast<CFWL_GridColRow*>(
+ GetColRow(FALSE, pInfo->m_iRow + i));
if (!pRow) {
break;
}
@@ -1021,12 +1032,13 @@ FX_FLOAT CFWL_GridImp::ProcessUnCertainRows() {
FX_FLOAT fAutoHeigt = 0;
int32_t iAutoRows = autoRows.GetSize();
for (int32_t m = 0; m < iAutoRows; m++) {
- fAutoHeigt += ((CFWL_GridColRow*)autoRows[m])->m_fActualSize;
+ fAutoHeigt += static_cast<CFWL_GridColRow*>(autoRows[m])->m_fActualSize;
}
FX_FLOAT fScaledHeight = 0;
iRows = scaledRows.GetSize();
for (int32_t n = 0; n < iRows; n++) {
- fScaledHeight += ((CFWL_GridColRow*)scaledRows[n])->m_fActualSize;
+ fScaledHeight +=
+ static_cast<CFWL_GridColRow*>(scaledRows[n])->m_fActualSize;
}
return fFixedHeight + fAutoHeigt + fScaledHeight;
}
@@ -1079,7 +1091,7 @@ void CFWL_GridImp::SetAllWidgetsRect() {
FX_FLOAT fStartLeft = 0;
int32_t iColumns = m_Columns.GetSize();
for (int32_t i = 0; i < iColumns; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)m_Columns[i];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Columns[i]);
if (!pColRow) {
continue;
}
@@ -1089,7 +1101,7 @@ void CFWL_GridImp::SetAllWidgetsRect() {
FX_FLOAT fStartTop = 0;
int32_t iRows = m_Rows.GetSize();
for (int32_t j = 0; j < iRows; j++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)m_Rows[j];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(m_Rows[j]);
if (!pColRow) {
continue;
}
@@ -1106,20 +1118,21 @@ void CFWL_GridImp::SetAllWidgetsRect() {
}
FX_FLOAT fColumnStart = 0;
CFWL_GridColRow* pColumn =
- (CFWL_GridColRow*)GetColRow(TRUE, pInfo->m_iColumn);
+ reinterpret_cast<CFWL_GridColRow*>(GetColRow(TRUE, pInfo->m_iColumn));
if (pColumn) {
fColumnStart = pColumn->m_fActualPos;
}
FX_FLOAT fRowStart = 0;
- CFWL_GridColRow* pRow = (CFWL_GridColRow*)GetColRow(FALSE, pInfo->m_iRow);
+ CFWL_GridColRow* pRow =
+ reinterpret_cast<CFWL_GridColRow*>(GetColRow(FALSE, pInfo->m_iRow));
if (pRow) {
fRowStart = pRow->m_fActualPos;
}
FX_FLOAT fColumnWidth = 0;
if (iColumns > 0) {
for (int32_t j = 0; j < pInfo->m_iColumnSpan; j++) {
- CFWL_GridColRow* pCol =
- (CFWL_GridColRow*)GetColRow(TRUE, pInfo->m_iColumn + j);
+ CFWL_GridColRow* pCol = reinterpret_cast<CFWL_GridColRow*>(
+ GetColRow(TRUE, pInfo->m_iColumn + j));
if (!pCol) {
break;
}
@@ -1131,8 +1144,8 @@ void CFWL_GridImp::SetAllWidgetsRect() {
FX_FLOAT fRowHeight = 0;
if (iRows > 0) {
for (int32_t k = 0; k < pInfo->m_iRowSpan; k++) {
- CFWL_GridColRow* pR =
- (CFWL_GridColRow*)GetColRow(FALSE, pInfo->m_iRow + k);
+ CFWL_GridColRow* pR = reinterpret_cast<CFWL_GridColRow*>(
+ GetColRow(FALSE, pInfo->m_iRow + k));
if (!pR) {
break;
}
@@ -1236,7 +1249,7 @@ void CFWL_GridImp::SetSpanAutoColRowSize(const CFX_PtrArray& spanAutos,
CFX_PtrArray autoNoMinMaxs;
FX_FLOAT fAutoPer = fTotalSize / iAutoColRows;
for (int32_t j = 0; j < iAutoColRows; j++) {
- CFWL_GridColRow* pColumn = (CFWL_GridColRow*)spanAutos[j];
+ CFWL_GridColRow* pColumn = static_cast<CFWL_GridColRow*>(spanAutos[j]);
FX_FLOAT fOrgSize = pColumn->m_fActualSize;
if (SetColRowActualSize(pColumn, pColumn->m_fActualSize + fAutoPer, TRUE)) {
autoNoMinMaxs.Add(pColumn);
@@ -1255,7 +1268,8 @@ void CFWL_GridImp::SetSpanAutoColRowSize(const CFX_PtrArray& spanAutos,
if (iNormals == iAutoColRows) {
fAutoPer = fTotalSize / iNormals;
for (int32_t k = 0; k < iNormals; k++) {
- CFWL_GridColRow* pColumn = (CFWL_GridColRow*)autoNoMinMaxs[k];
+ CFWL_GridColRow* pColumn =
+ static_cast<CFWL_GridColRow*>(autoNoMinMaxs[k]);
pColumn->m_fActualSize += fAutoPer;
}
} else {
@@ -1274,7 +1288,7 @@ void CFWL_GridImp::SetSpanScaledColRowSize(const CFX_PtrArray& spanScaleds,
CFX_PtrArray autoNoMinMaxs;
FX_FLOAT fPerSize = fTotalSize / fTotalScaledNum;
for (int32_t i = 0; i < iScaledColRows; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)spanScaleds[i];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(spanScaleds[i]);
if (SetColRowActualSize(pColRow, pColRow->m_fActualSize +
fPerSize * pColRow->m_Size.fLength,
TRUE)) {
@@ -1295,7 +1309,8 @@ void CFWL_GridImp::SetSpanScaledColRowSize(const CFX_PtrArray& spanScaleds,
if (iNormals == iScaledColRows) {
fPerSize = fTotalSize / fTotalScaledNum;
for (int32_t j = 0; j < iNormals; j++) {
- CFWL_GridColRow* pColumn = (CFWL_GridColRow*)autoNoMinMaxs[j];
+ CFWL_GridColRow* pColumn =
+ static_cast<CFWL_GridColRow*>(autoNoMinMaxs[j]);
pColumn->m_fActualSize += fPerSize * pColumn->m_Size.fLength;
}
} else {
@@ -1314,7 +1329,7 @@ void CFWL_GridImp::SetScaledColRowsSize(const CFX_PtrArray& spanScaleds,
CFX_PtrArray autoNoMinMaxs;
FX_FLOAT fPerSize = fTotalSize / fTotalScaledNum;
for (int32_t i = 0; i < iScaledColRows; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)spanScaleds[i];
+ CFWL_GridColRow* pColRow = static_cast<CFWL_GridColRow*>(spanScaleds[i]);
if (!pColRow) {
continue;
}
@@ -1338,7 +1353,8 @@ void CFWL_GridImp::SetScaledColRowsSize(const CFX_PtrArray& spanScaleds,
if (iNormals == iScaledColRows) {
fPerSize = fTotalSize / fTotalScaledNum;
for (int32_t i = 0; i < iNormals; i++) {
- CFWL_GridColRow* pColRow = (CFWL_GridColRow*)autoNoMinMaxs[i];
+ CFWL_GridColRow* pColRow =
+ static_cast<CFWL_GridColRow*>(autoNoMinMaxs[i]);
if (!pColRow) {
continue;
}
@@ -1358,7 +1374,7 @@ int32_t CFWL_GridImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
if (pMessage->GetClassID() != FWL_MSGHASH_Mouse) {
return 0;
}
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
if (pMsg->m_dwCmd != FWL_MSGMOUSECMD_LButtonDown) {
return 0;
}
diff --git a/xfa/src/fwl/src/core/fwl_noteimp.cpp b/xfa/src/fwl/src/core/fwl_noteimp.cpp
index 015b5aaf84..68f7cdaf91 100644
--- a/xfa/src/fwl/src/core/fwl_noteimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_noteimp.cpp
@@ -47,7 +47,7 @@ FX_BOOL CFWL_NoteLoop::ContinueModal() {
FWL_ERR CFWL_NoteLoop::EndModalLoop() {
m_bContinueModal = FALSE;
#if (_FX_OS_ == _FX_MACOSX_)
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
IFWL_AdapterWidgetMgr* adapterWidgetMgr = pWidgetMgr->GetAdapterWidgetMgr();
adapterWidgetMgr->EndLoop();
#endif
@@ -57,11 +57,12 @@ FX_BOOL CFWL_NoteLoop::TranslateAccelerator(CFWL_Message* pMessage) {
if (pMessage->GetClassID() != FWL_MSGHASH_Key) {
return FALSE;
}
- if (((CFWL_MsgKey*)pMessage)->m_dwCmd != FWL_MSGKEYCMD_KeyDown) {
+ CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage);
+ if (pMsgKey->m_dwCmd != FWL_MSGKEYCMD_KeyDown) {
return FALSE;
}
- CFWL_MsgKey* pMsgKey = (CFWL_MsgKey*)pMessage;
- CFX_MapAccelerators& accel = ((CFWL_FormImp*)m_pForm)->GetAccelerator();
+ CFX_MapAccelerators& accel =
+ static_cast<CFWL_FormImp*>(m_pForm)->GetAccelerator();
FX_POSITION pos = accel.GetStartPosition();
if (!pos) {
return FALSE;
@@ -102,13 +103,10 @@ CFWL_NoteDriver::CFWL_NoteDriver()
m_pGrab(nullptr),
m_hook(nullptr) {
m_pNoteLoop = new CFWL_NoteLoop;
- PushNoteLoop((IFWL_NoteLoop*)m_pNoteLoop);
+ PushNoteLoop(m_pNoteLoop);
}
CFWL_NoteDriver::~CFWL_NoteDriver() {
- if (m_pNoteLoop) {
- delete m_pNoteLoop;
- m_pNoteLoop = NULL;
- }
+ delete m_pNoteLoop;
ClearInvalidEventTargets(TRUE);
}
FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) {
@@ -117,8 +115,8 @@ FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) {
if (iCount < 1) {
return TRUE;
}
- if (FWL_EVTHASH_Mouse == ((CFWL_Event*)pNote)->GetClassID()) {
- CFWL_EvtMouse* pMouse = (CFWL_EvtMouse*)pNote;
+ if (FWL_EVTHASH_Mouse == static_cast<CFWL_Event*>(pNote)->GetClassID()) {
+ CFWL_EvtMouse* pMouse = static_cast<CFWL_EvtMouse*>(pNote);
if (FWL_MSGMOUSECMD_MouseHover == pMouse->m_dwCmd) {
if (m_pNoteLoop->GetForm() &&
CFWL_ToolTipContainer::getInstance()->ProcessEnter(
@@ -140,7 +138,7 @@ FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) {
CFWL_EventTarget* pEventTarget;
m_eventTargets.GetNextAssoc(pos, key, (void*&)pEventTarget);
if (pEventTarget && !pEventTarget->IsInvalid()) {
- pEventTarget->ProcessEvent((CFWL_Event*)pNote);
+ pEventTarget->ProcessEvent(static_cast<CFWL_Event*>(pNote));
}
}
m_sendEventCalled--;
@@ -149,7 +147,7 @@ FX_BOOL CFWL_NoteDriver::SendNote(CFWL_Note* pNote) {
return FALSE;
IFWL_WidgetDelegate* pDelegate = pNote->m_pDstTarget->SetDelegate(NULL);
if (pDelegate) {
- pDelegate->OnProcessMessage((CFWL_Message*)pNote);
+ pDelegate->OnProcessMessage(static_cast<CFWL_Message*>(pNote));
}
}
return TRUE;
@@ -213,7 +211,8 @@ IFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
int32_t pos = m_noteLoopQueue.GetSize();
if (pos <= 0)
return NULL;
- IFWL_NoteLoop* p = (IFWL_NoteLoop*)m_noteLoopQueue.GetAt(pos - 1);
+ IFWL_NoteLoop* p =
+ static_cast<IFWL_NoteLoop*>(m_noteLoopQueue.GetAt(pos - 1));
m_noteLoopQueue.RemoveAt(pos - 1);
return p;
}
@@ -258,7 +257,7 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) {
return TRUE;
}
FWL_ERR CFWL_NoteDriver::Run() {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FWL_ERR_Indefinite;
#if (_FX_OS_ == _FX_MACOSX_)
@@ -351,7 +350,7 @@ void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) {
UnregisterEventTarget(pNoteTarget);
int32_t count = m_forms.GetSize();
for (int32_t nIndex = 0; nIndex < count; nIndex++) {
- CFWL_FormImp* pForm = (CFWL_FormImp*)m_forms[nIndex];
+ CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[nIndex]);
if (!pForm) {
continue;
}
@@ -375,7 +374,8 @@ FWL_ERR CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) {
}
m_forms.Add(pForm);
if (m_forms.GetSize() == 1) {
- CFWL_NoteLoop* pLoop = (CFWL_NoteLoop*)m_noteLoopQueue.GetAt(0);
+ CFWL_NoteLoop* pLoop =
+ static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0));
if (!pLoop)
return FWL_ERR_Indefinite;
pLoop->SetMainForm(pForm);
@@ -401,7 +401,7 @@ FX_BOOL CFWL_NoteDriver::UnqueueMessage(CFWL_NoteLoop* pNoteLoop) {
if (m_noteQueue.GetSize() < 1) {
return FALSE;
}
- CFWL_Message* pMessage = (CFWL_Message*)m_noteQueue[0];
+ CFWL_Message* pMessage = static_cast<CFWL_Message*>(m_noteQueue[0]);
m_noteQueue.RemoveAt(0);
if (!IsValidMessage(pMessage)) {
pMessage->Release();
@@ -421,7 +421,7 @@ CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() {
int32_t size = m_noteLoopQueue.GetSize();
if (size <= 0)
return NULL;
- return (CFWL_NoteLoop*)m_noteLoopQueue[size - 1];
+ return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]);
}
int32_t CFWL_NoteDriver::CountLoop() {
return m_noteLoopQueue.GetSize();
@@ -431,7 +431,7 @@ void CFWL_NoteDriver::SetHook(FWLMessageHookCallback callback, void* info) {
m_hookInfo = info;
}
FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
IFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled()
? pMessage->m_pDstTarget
: GetMessageForm(pMessage->m_pDstTarget);
@@ -439,7 +439,7 @@ FX_BOOL CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
return FALSE;
if (DispatchMessage(pMessage, pMessageForm)) {
if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) {
- MouseSecondary((CFWL_MsgMouse*)pMessage);
+ MouseSecondary(static_cast<CFWL_MsgMouse*>(pMessage));
}
return TRUE;
}
@@ -450,35 +450,37 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage,
FX_BOOL bRet = FALSE;
switch (pMessage->GetClassID()) {
case FWL_MSGHASH_Activate: {
- bRet = DoActivate((CFWL_MsgActivate*)pMessage, pMessageForm);
+ bRet = DoActivate(static_cast<CFWL_MsgActivate*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_Deactivate: {
- bRet = DoDeactivate((CFWL_MsgDeactivate*)pMessage, pMessageForm);
+ bRet = DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage),
+ pMessageForm);
break;
}
case FWL_MSGHASH_SetFocus: {
- bRet = DoSetFocus((CFWL_MsgSetFocus*)pMessage, pMessageForm);
+ bRet = DoSetFocus(static_cast<CFWL_MsgSetFocus*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_KillFocus: {
- bRet = DoKillFocus((CFWL_MsgKillFocus*)pMessage, pMessageForm);
+ bRet =
+ DoKillFocus(static_cast<CFWL_MsgKillFocus*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_Key: {
- bRet = DoKey((CFWL_MsgKey*)pMessage, pMessageForm);
+ bRet = DoKey(static_cast<CFWL_MsgKey*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_Mouse: {
- bRet = DoMouse((CFWL_MsgMouse*)pMessage, pMessageForm);
+ bRet = DoMouse(static_cast<CFWL_MsgMouse*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_MouseWheel: {
- bRet = DoWheel((CFWL_MsgMouseWheel*)pMessage, pMessageForm);
+ bRet = DoWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage), pMessageForm);
break;
}
case FWL_MSGHASH_Size: {
- bRet = DoSize((CFWL_MsgSize*)pMessage);
+ bRet = DoSize(static_cast<CFWL_MsgSize*>(pMessage));
break;
}
case FWL_MSGHASH_Cursor: {
@@ -486,19 +488,13 @@ FX_BOOL CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage,
break;
}
case FWL_MSGHASH_WindowMove: {
- bRet = DoWindowMove((CFWL_MsgWindowMove*)pMessage, pMessageForm);
+ bRet = DoWindowMove(static_cast<CFWL_MsgWindowMove*>(pMessage),
+ pMessageForm);
break;
}
case FWL_MSGHASH_DropFiles: {
- bRet = DoDragFiles((CFWL_MsgDropFiles*)pMessage, pMessageForm);
- break;
- }
- case FWL_MSGHASH_TaskClicked: {
- bRet = TRUE;
- break;
- }
- case FWL_MSGHASH_Close: {
- bRet = TRUE;
+ bRet =
+ DoDragFiles(static_cast<CFWL_MsgDropFiles*>(pMessage), pMessageForm);
break;
}
default: {
@@ -557,9 +553,9 @@ FX_BOOL CFWL_NoteDriver::DoDeactivate(CFWL_MsgDeactivate* pMsg,
}
FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg,
IFWL_Widget* pMessageForm) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (pWidgetMgr->IsFormDisabled()) {
- m_pFocus = (IFWL_Widget*)pMsg->m_pDstTarget;
+ m_pFocus = pMsg->m_pDstTarget;
return TRUE;
} else {
IFWL_Widget* pWidget = pMsg->m_pDstTarget;
@@ -580,24 +576,23 @@ FX_BOOL CFWL_NoteDriver::DoSetFocus(CFWL_MsgSetFocus* pMsg,
}
FX_BOOL CFWL_NoteDriver::DoKillFocus(CFWL_MsgKillFocus* pMsg,
IFWL_Widget* pMessageForm) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (pWidgetMgr->IsFormDisabled()) {
if (m_pFocus == pMsg->m_pDstTarget) {
m_pFocus = NULL;
}
return TRUE;
- } else {
- IFWL_Widget* pWidget = pMsg->m_pDstTarget;
- CFWL_FormImp* pForm =
- pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
- if (pForm) {
- CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
- if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
- pMsg->m_pDstTarget = pSubFocus->GetInterface();
- if (m_pFocus == pMsg->m_pDstTarget) {
- m_pFocus = NULL;
- return TRUE;
- }
+ }
+ IFWL_Widget* pWidget = pMsg->m_pDstTarget;
+ CFWL_FormImp* pForm =
+ pWidget ? static_cast<CFWL_FormImp*>(pWidget->GetImpl()) : nullptr;
+ if (pForm) {
+ CFWL_WidgetImp* pSubFocus = pForm->GetSubFocus();
+ if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
+ pMsg->m_pDstTarget = pSubFocus->GetInterface();
+ if (m_pFocus == pMsg->m_pDstTarget) {
+ m_pFocus = NULL;
+ return TRUE;
}
}
}
@@ -607,7 +602,8 @@ FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) {
#if (_FX_OS_ != _FX_MACOSX_)
if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown &&
pMsg->m_dwKeyCode == FWL_VKEY_Tab) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr =
+ static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
IFWL_Widget* pForm = GetMessageForm(pMsg->m_pDstTarget);
IFWL_Widget* pFocus = m_pFocus;
if (m_pFocus) {
@@ -634,7 +630,8 @@ FX_BOOL CFWL_NoteDriver::DoKey(CFWL_MsgKey* pMsg, IFWL_Widget* pMessageForm) {
if (!m_pFocus) {
if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown &&
pMsg->m_dwKeyCode == FWL_VKEY_Return) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr =
+ static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
IFWL_Widget* defButton = pWidgetMgr->GetDefaultButton(pMessageForm);
if (defButton) {
pMsg->m_pDstTarget = defButton;
@@ -663,14 +660,13 @@ 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();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FALSE;
IFWL_Widget* pDst =
pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
- if (!pDst) {
+ if (!pDst)
return FALSE;
- }
while (pDst && pDst->GetClassID() == FWL_CLASSHASH_Grid) {
pDst = pDst->GetParent();
}
@@ -679,7 +675,7 @@ FX_BOOL CFWL_NoteDriver::DoWheel(CFWL_MsgMouseWheel* pMsg,
return TRUE;
}
FX_BOOL CFWL_NoteDriver::DoSize(CFWL_MsgSize* pMsg) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FALSE;
pWidgetMgr->NotifySizeChanged(pMsg->m_pDstTarget, (FX_FLOAT)pMsg->m_iWidth,
@@ -700,9 +696,8 @@ FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
if (!pWidgetMgr)
return FALSE;
IFWL_Widget* pTarget = NULL;
- if (m_pGrab) {
- { pTarget = m_pGrab; }
- }
+ if (m_pGrab)
+ pTarget = m_pGrab;
if (!pTarget) {
pTarget =
pWidgetMgr->GetWidgetAtPoint(pMessageForm, pMsg->m_fx, pMsg->m_fy);
@@ -715,9 +710,8 @@ FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
pMessageForm->TransformTo(pTarget, pMsg->m_fx, pMsg->m_fy);
}
}
- if (!pTarget) {
+ if (!pTarget)
return FALSE;
- }
pMsg->m_pDstTarget = pTarget;
return TRUE;
}
@@ -755,7 +749,7 @@ FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) {
}
int32_t iCount = m_noteLoopQueue.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- CFWL_NoteLoop* pNoteLoop = (CFWL_NoteLoop*)m_noteLoopQueue[i];
+ CFWL_NoteLoop* pNoteLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[i]);
CFWL_WidgetImp* pForm = pNoteLoop->GetForm();
if (pForm && (pForm->GetInterface() == pMessage->m_pDstTarget)) {
return TRUE;
@@ -763,7 +757,7 @@ FX_BOOL CFWL_NoteDriver::IsValidMessage(CFWL_Message* pMessage) {
}
iCount = m_forms.GetSize();
for (int32_t j = 0; j < iCount; j++) {
- CFWL_FormImp* pForm = (CFWL_FormImp*)m_forms[j];
+ CFWL_FormImp* pForm = static_cast<CFWL_FormImp*>(m_forms[j]);
if (pForm->GetInterface() == pMessage->m_pDstTarget) {
return TRUE;
}
@@ -776,13 +770,15 @@ IFWL_Widget* CFWL_NoteDriver::GetMessageForm(IFWL_Widget* pDstTarget) {
return NULL;
IFWL_Widget* pMessageForm = NULL;
if (iTrackLoop > 1) {
- CFWL_NoteLoop* pNootLoop = (CFWL_NoteLoop*)m_noteLoopQueue[iTrackLoop - 1];
+ CFWL_NoteLoop* pNootLoop =
+ static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[iTrackLoop - 1]);
pMessageForm = pNootLoop->GetForm()->GetInterface();
} else {
pMessageForm = (m_forms.Find(pDstTarget) < 0) ? NULL : pDstTarget;
}
if (!pMessageForm && pDstTarget) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr =
+ static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return NULL;
pMessageForm =
@@ -935,7 +931,8 @@ CFWL_ToolTipContainer::CFWL_ToolTipContainer()
}
CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {
if (m_pToolTipImp) {
- IFWL_ToolTip* pToolTip = (IFWL_ToolTip*)m_pToolTipImp->GetInterface();
+ IFWL_ToolTip* pToolTip =
+ static_cast<IFWL_ToolTip*>(m_pToolTipImp->GetInterface());
pToolTip->Finalize();
delete pToolTip;
}
@@ -973,7 +970,7 @@ FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) {
FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) {
int32_t iCount = m_arrWidget.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- IFWL_ToolTipTarget* p = (IFWL_ToolTipTarget*)m_arrWidget[i];
+ IFWL_ToolTipTarget* p = static_cast<IFWL_ToolTipTarget*>(m_arrWidget[i]);
if (p->GetWidget() == pWedget) {
pCurTarget = p;
return TRUE;
@@ -1074,7 +1071,8 @@ FWL_ERR FWL_SetToolTipAutoPopDelay(int32_t nDelayTime) {
IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread) {
if (!pNoteThread)
return NULL;
- CFWL_NoteDriver* noteDriver = (CFWL_NoteDriver*)pNoteThread->GetNoteDriver();
+ CFWL_NoteDriver* noteDriver =
+ static_cast<CFWL_NoteDriver*>(pNoteThread->GetNoteDriver());
if (!noteDriver)
return NULL;
if (noteDriver->CountLoop() == 1) {
@@ -1091,7 +1089,7 @@ IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread) {
FWL_ERR FWL_SetHook(IFWL_NoteDriver* driver,
FWLMessageHookCallback callback,
void* info) {
- CFWL_NoteDriver* noteDriver = (CFWL_NoteDriver*)driver;
+ CFWL_NoteDriver* noteDriver = static_cast<CFWL_NoteDriver*>(driver);
noteDriver->SetHook(callback, info);
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/core/fwl_panelimp.cpp b/xfa/src/fwl/src/core/fwl_panelimp.cpp
index fcae28c99e..cdae399195 100644
--- a/xfa/src/fwl/src/core/fwl_panelimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_panelimp.cpp
@@ -57,13 +57,11 @@ FWL_ERR CFWL_PanelImp::Update() {
if (!pWidgetMgr)
return FWL_ERR_Indefinite;
IFWL_Widget* pParent =
- pWidgetMgr->GetWidget((IFWL_Widget*)this, FWL_WGTRELATION_Parent);
+ pWidgetMgr->GetWidget(GetInterface(), FWL_WGTRELATION_Parent);
if (pParent && pParent->GetClassID() == FWL_CLASSHASH_Grid) {
- IFWL_Grid* pGrid = (IFWL_Grid*)pParent;
- pGrid->GetWidgetSize((IFWL_Widget*)this, FWL_GRIDSIZE_Width, eWidth);
- pGrid->GetWidgetSize((IFWL_Widget*)this, FWL_GRIDSIZE_Height, eHeight);
- }
- if (eWidth != FWL_GRIDUNIT_Auto || eHeight != FWL_GRIDUNIT_Auto) {
+ IFWL_Grid* pGrid = static_cast<IFWL_Grid*>(pParent);
+ pGrid->GetWidgetSize(GetInterface(), FWL_GRIDSIZE_Width, eWidth);
+ pGrid->GetWidgetSize(GetInterface(), FWL_GRIDSIZE_Height, eHeight);
}
m_pContent->SetWidgetRect(rtClient);
m_pContent->Update();
diff --git a/xfa/src/fwl/src/core/fwl_widgetimp.cpp b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
index c48bfb9ca9..c3c6e18744 100644
--- a/xfa/src/fwl/src/core/fwl_widgetimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetimp.cpp
@@ -148,8 +148,8 @@ FWL_ERR CFWL_WidgetImp::Initialize() {
}
FWL_ERR CFWL_WidgetImp::Finalize() {
NotifyDriver();
- IFWL_Form* pForm = (IFWL_Form*)FWL_GetWidgetMgr()->GetWidget(
- m_pInterface, FWL_WGTRELATION_SystemForm);
+ IFWL_Form* pForm = static_cast<IFWL_Form*>(
+ FWL_GetWidgetMgr()->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm));
if (pForm && pForm != m_pInterface) {
IFWL_Content* pContent = pForm->GetContent();
if (pContent) {
@@ -275,7 +275,7 @@ FWL_ERR CFWL_WidgetImp::SetStates(FX_DWORD dwStates, FX_BOOL bSet) {
if (bSet) {
ret = m_pWidgetMgr->HideWidget_Native(m_pInterface);
CFWL_NoteDriver* noteDriver =
- (CFWL_NoteDriver*)GetOwnerThread()->GetNoteDriver();
+ static_cast<CFWL_NoteDriver*>(GetOwnerThread()->GetNoteDriver());
IFWL_WidgetMgr* widgetMgr = FWL_GetWidgetMgr();
noteDriver->NotifyTargetHide(m_pInterface);
IFWL_Widget* child =
@@ -348,7 +348,7 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget,
if (IsParent(pWidget)) {
szOffset = GetOffsetFromParent(pWidget);
} else {
- szOffset = ((IFWL_Widget*)pWidget)->GetOffsetFromParent(m_pInterface);
+ szOffset = pWidget->GetOffsetFromParent(m_pInterface);
szOffset.x = -szOffset.x;
szOffset.y = -szOffset.y;
}
@@ -436,7 +436,7 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) {
CFX_RectF rect;
int32_t count = parents.GetSize();
for (int32_t i = count - 2; i >= 0; i--) {
- parent = (IFWL_Widget*)parents.GetAt(i);
+ parent = static_cast<IFWL_Widget*>(parents.GetAt(i));
parent->GetMatrix(ctmOnParent, FALSE);
parent->GetWidgetRect(rect);
matrix.Concat(ctmOnParent, TRUE);
@@ -509,7 +509,7 @@ CFWL_WidgetImp::CFWL_WidgetImp(const CFWL_WidgetImpProperties& properties,
m_pInterface(NULL),
m_iLock(0) {
*m_pProperties = properties;
- m_pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ m_pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
FXSYS_assert(m_pWidgetMgr != NULL);
}
CFWL_WidgetImp::~CFWL_WidgetImp() {
@@ -563,8 +563,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);
+ FX_FLOAT* pfBorder = static_cast<FX_FLOAT*>(GetThemeCapacity(
+ bCX ? FWL_WGTCAPACITY_CXBorder : FWL_WGTCAPACITY_CYBorder));
if (!pfBorder)
return 0;
return *pfBorder;
@@ -586,10 +586,8 @@ FX_FLOAT CFWL_WidgetImp::GetEdgeWidth() {
}
}
if (dwCapacity > 0) {
- FX_FLOAT* fRet = (FX_FLOAT*)GetThemeCapacity(dwCapacity);
- if (!fRet)
- return 0;
- return *fRet;
+ FX_FLOAT* fRet = static_cast<FX_FLOAT*>(GetThemeCapacity(dwCapacity));
+ return fRet ? *fRet : 0;
}
return 0;
}
@@ -674,16 +672,16 @@ void CFWL_WidgetImp::CalcTextRect(const CFX_WideString& wsText,
pTheme->CalcTextRect(&calPart, rect);
}
void CFWL_WidgetImp::SetFocus(FX_BOOL bFocus) {
- if (m_pWidgetMgr->IsFormDisabled()) {
+ if (m_pWidgetMgr->IsFormDisabled())
return;
- }
IFWL_NoteThread* pThread = GetOwnerThread();
if (!pThread)
return;
- IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
if (!pDriver)
return;
- IFWL_Widget* curFocus = ((CFWL_NoteDriver*)pDriver)->GetFocus();
+ IFWL_Widget* curFocus = pDriver->GetFocus();
if (bFocus && curFocus != m_pInterface) {
pDriver->SetFocus(m_pInterface);
} else if (!bFocus && curFocus == m_pInterface) {
@@ -694,7 +692,8 @@ void CFWL_WidgetImp::SetGrab(FX_BOOL bSet) {
IFWL_NoteThread* pThread = GetOwnerThread();
if (!pThread)
return;
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
pDriver->SetGrab(m_pInterface, bSet);
}
FX_BOOL CFWL_WidgetImp::GetPopupPos(FX_FLOAT fMinHeight,
@@ -916,7 +915,8 @@ void CFWL_WidgetImp::NotifyDriver() {
IFWL_NoteThread* pThread = GetOwnerThread();
if (!pThread)
return;
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
if (!pDriver)
return;
pDriver->NotifyTargetDestroy(m_pInterface);
@@ -924,7 +924,7 @@ void CFWL_WidgetImp::NotifyDriver() {
CFX_SizeF CFWL_WidgetImp::GetOffsetFromParent(IFWL_Widget* pParent) {
CFX_SizeF szRet;
szRet.Set(0, 0);
- if (pParent == (IFWL_Widget*)this) {
+ if (pParent == GetInterface()) {
return szRet;
}
IFWL_WidgetMgr* pWidgetMgr = FWL_GetWidgetMgr();
@@ -960,52 +960,57 @@ int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {
FX_DWORD dwMsgCode = pMessage->GetClassID();
switch (dwMsgCode) {
case FWL_MSGHASH_Mouse: {
+ CFWL_MsgMouse* pMsgMouse = static_cast<CFWL_MsgMouse*>(pMessage);
CFWL_EvtMouse evt;
evt.m_pSrcTarget = pWidget->m_pInterface;
evt.m_pDstTarget = pWidget->m_pInterface;
- evt.m_dwCmd = ((CFWL_MsgMouse*)pMessage)->m_dwCmd;
- evt.m_dwFlags = ((CFWL_MsgMouse*)pMessage)->m_dwFlags;
- evt.m_fx = ((CFWL_MsgMouse*)pMessage)->m_fx;
- evt.m_fy = ((CFWL_MsgMouse*)pMessage)->m_fy;
+ evt.m_dwCmd = pMsgMouse->m_dwCmd;
+ evt.m_dwFlags = pMsgMouse->m_dwFlags;
+ evt.m_fx = pMsgMouse->m_fx;
+ evt.m_fy = pMsgMouse->m_fy;
pWidget->DispatchEvent(&evt);
break;
}
case FWL_MSGHASH_MouseWheel: {
+ CFWL_MsgMouseWheel* pMsgMouseWheel =
+ static_cast<CFWL_MsgMouseWheel*>(pMessage);
CFWL_EvtMouseWheel evt;
evt.m_pSrcTarget = pWidget->m_pInterface;
evt.m_pDstTarget = pWidget->m_pInterface;
- evt.m_dwFlags = ((CFWL_MsgMouseWheel*)pMessage)->m_dwFlags;
- evt.m_fDeltaX = ((CFWL_MsgMouseWheel*)pMessage)->m_fDeltaX;
- evt.m_fDeltaY = ((CFWL_MsgMouseWheel*)pMessage)->m_fDeltaY;
- evt.m_fx = ((CFWL_MsgMouseWheel*)pMessage)->m_fx;
- evt.m_fy = ((CFWL_MsgMouseWheel*)pMessage)->m_fy;
+ evt.m_dwFlags = pMsgMouseWheel->m_dwFlags;
+ evt.m_fDeltaX = pMsgMouseWheel->m_fDeltaX;
+ evt.m_fDeltaY = pMsgMouseWheel->m_fDeltaY;
+ evt.m_fx = pMsgMouseWheel->m_fx;
+ evt.m_fy = pMsgMouseWheel->m_fy;
pWidget->DispatchEvent(&evt);
break;
}
case FWL_MSGHASH_Key: {
+ CFWL_MsgKey* pMsgKey = static_cast<CFWL_MsgKey*>(pMessage);
CFWL_EvtKey evt;
evt.m_pSrcTarget = pWidget->m_pInterface;
- ;
evt.m_pDstTarget = pWidget->m_pInterface;
- ;
- evt.m_dwKeyCode = ((CFWL_MsgKey*)pMessage)->m_dwKeyCode;
- evt.m_dwFlags = ((CFWL_MsgKey*)pMessage)->m_dwFlags;
- evt.m_dwCmd = ((CFWL_MsgKey*)pMessage)->m_dwCmd;
+ evt.m_dwKeyCode = pMsgKey->m_dwKeyCode;
+ evt.m_dwFlags = pMsgKey->m_dwFlags;
+ evt.m_dwCmd = pMsgKey->m_dwCmd;
pWidget->DispatchEvent(&evt);
break;
}
case FWL_MSGHASH_SetFocus: {
+ CFWL_MsgSetFocus* pMsgSetFocus = static_cast<CFWL_MsgSetFocus*>(pMessage);
CFWL_EvtSetFocus evt;
- evt.m_pSrcTarget = ((CFWL_MsgSetFocus*)pMessage)->m_pDstTarget;
- evt.m_pDstTarget = ((CFWL_MsgSetFocus*)pMessage)->m_pDstTarget;
+ evt.m_pSrcTarget = pMsgSetFocus->m_pDstTarget;
+ evt.m_pDstTarget = pMsgSetFocus->m_pDstTarget;
evt.m_pSetFocus = pWidget->m_pInterface;
pWidget->DispatchEvent(&evt);
break;
}
case FWL_MSGHASH_KillFocus: {
+ CFWL_MsgKillFocus* pMsgKillFocus =
+ static_cast<CFWL_MsgKillFocus*>(pMessage);
CFWL_EvtKillFocus evt;
- evt.m_pSrcTarget = ((CFWL_MsgKillFocus*)pMessage)->m_pDstTarget;
- evt.m_pDstTarget = ((CFWL_MsgKillFocus*)pMessage)->m_pDstTarget;
+ evt.m_pSrcTarget = pMsgKillFocus->m_pDstTarget;
+ evt.m_pDstTarget = pMsgKillFocus->m_pDstTarget;
evt.m_pKillFocus = pWidget->m_pInterface;
pWidget->DispatchEvent(&evt);
break;
diff --git a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp
index 284498b5a3..2f3aa2aa2a 100644
--- a/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_widgetmgrimp.cpp
@@ -208,11 +208,6 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) {
}
return TRUE;
}
-FX_BOOL CFWL_WidgetMgr::IsWidget(void* pObj) {
- if (!pObj)
- return FALSE;
- return GetWidgetMgrItem((IFWL_Widget*)pObj) != NULL;
-}
FWL_ERR CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget,
const CFX_RectF* pRect) {
if (!m_pAdapter)
@@ -632,7 +627,7 @@ void CFWL_WidgetMgr::ResetRedrawCounts(IFWL_Widget* pWidget) {
pItem->iRedrawCounter = 0;
}
CFWL_WidgetMgrItem* CFWL_WidgetMgr::GetWidgetMgrItem(IFWL_Widget* pWidget) {
- return (CFWL_WidgetMgrItem*)m_mapWidgetItem.GetValueAt(pWidget);
+ return static_cast<CFWL_WidgetMgrItem*>(m_mapWidgetItem.GetValueAt(pWidget));
}
int32_t CFWL_WidgetMgr::TravelWidgetMgr(CFWL_WidgetMgrItem* pParent,
int32_t* pIndex,
@@ -701,15 +696,16 @@ int32_t CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) {
return 0;
if (!pMessage->m_pDstTarget)
return 0;
- IFWL_Widget* pDstWidget = (IFWL_Widget*)pMessage->m_pDstTarget;
+ IFWL_Widget* pDstWidget = pMessage->m_pDstTarget;
IFWL_NoteThread* pNoteThread = pDstWidget->GetOwnerThread();
if (!pNoteThread)
return 0;
- CFWL_NoteDriver* pNoteDriver = (CFWL_NoteDriver*)pNoteThread->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver =
+ static_cast<CFWL_NoteDriver*>(pNoteThread->GetNoteDriver());
if (!pNoteDriver)
return 0;
if (m_pWidgetMgr->IsThreadEnabled()) {
- pMessage = (CFWL_Message*)pMessage->Clone();
+ pMessage = static_cast<CFWL_Message*>(pMessage->Clone());
}
if (m_pWidgetMgr->IsFormDisabled()) {
pNoteDriver->ProcessMessage(pMessage);
@@ -757,7 +753,7 @@ FWL_ERR CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget,
clipCopy = clipBounds;
} else {
clipBounds.Set(pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d);
- ((CFX_Matrix*)pMatrix)->SetIdentity(); // FIXME: const cast.
+ const_cast<CFX_Matrix*>(pMatrix)->SetIdentity(); // FIXME: const cast.
#ifdef FWL_UseMacSystemBorder
#else
#endif
@@ -859,7 +855,7 @@ void CFWL_WidgetMgrDelegate::DrawWidgetAfter(IFWL_Widget* pWidget,
if (FWL_UseOffscreen(pWidget)) {
CFWL_WidgetMgrItem* pItem = m_pWidgetMgr->GetWidgetMgrItem(pWidget);
pGraphics->Transfer(pItem->pOffscreen, rtClip.left, rtClip.top, rtClip,
- (CFX_Matrix*)pMatrix);
+ pMatrix);
#ifdef _WIN32
pItem->pOffscreen->ClearClip();
#endif
@@ -1053,7 +1049,7 @@ FWL_ERR FWL_WidgetMgrSnapshot(IFWL_Widget* pWidget,
pWidget->GetWidgetRect(r);
CFX_Graphics gs;
gs.Create((int32_t)r.width, (int32_t)r.height, FXDIB_Argb);
- CFWL_WidgetMgr* widgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* widgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
CFWL_WidgetMgrDelegate* delegate = widgetMgr->GetDelegate();
delegate->OnDrawWidget(pWidget, &gs, pMatrix);
CFX_DIBitmap* dib = gs.GetRenderDevice()->GetBitmap();
diff --git a/xfa/src/fwl/src/core/include/fwl_noteimp.h b/xfa/src/fwl/src/core/include/fwl_noteimp.h
index b846d20263..63f8f998c5 100644
--- a/xfa/src/fwl/src/core/include/fwl_noteimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_noteimp.h
@@ -6,23 +6,27 @@
#ifndef _FWL_NOTE_IMP_H
#define _FWL_NOTE_IMP_H
+
+#include "xfa/include/fwl/core/fwl_note.h"
+
class CFWL_TargetImp;
class CFWL_WidgetImp;
class CFWL_NoteThreadImp;
class CFWL_ToolTipImp;
-class IFWL_ToolTipTarget;
class CFWL_CoreToopTipDP;
-class CFWL_NoteLoop;
class CFWL_NoteDriver;
class CFWL_EventTarget;
class CFWL_ToolTipContainer;
-class CFWL_NoteLoop {
+class CFWL_NoteLoop : public IFWL_NoteLoop {
public:
CFWL_NoteLoop(CFWL_WidgetImp* pForm = NULL);
- virtual ~CFWL_NoteLoop() {}
- virtual FX_BOOL PreProcessMessage(CFWL_Message* pMessage);
- virtual FWL_ERR Idle(int32_t count);
+
+ // IFWL_NoteLoop:
+ ~CFWL_NoteLoop() override {}
+ FX_BOOL PreProcessMessage(CFWL_Message* pMessage) override;
+ FWL_ERR Idle(int32_t count) override;
+
CFWL_WidgetImp* GetForm();
FX_BOOL ContinueModal();
FWL_ERR EndModalLoop();
diff --git a/xfa/src/fwl/src/core/include/fwl_widgetmgrimp.h b/xfa/src/fwl/src/core/include/fwl_widgetmgrimp.h
index 4511d77ad8..021f24b8e3 100644
--- a/xfa/src/fwl/src/core/include/fwl_widgetmgrimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_widgetmgrimp.h
@@ -61,7 +61,6 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr {
FWL_WGTRELATION eRelation) override;
int32_t GetWidgetIndex(IFWL_Widget* pWidget) override;
FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) override;
- FX_BOOL IsWidget(void* pObj) override;
FWL_ERR RepaintWidget(IFWL_Widget* pWidget,
const CFX_RectF* pRect = NULL) override;
FX_DWORD GetCapability() override { return m_dwCapability; }
diff --git a/xfa/src/fwl/src/lightwidget/barcode.cpp b/xfa/src/fwl/src/lightwidget/barcode.cpp
index 15b0a40d91..a0704c4bd9 100644
--- a/xfa/src/fwl/src/lightwidget/barcode.cpp
+++ b/xfa/src/fwl/src/lightwidget/barcode.cpp
@@ -29,12 +29,12 @@ CFWL_Barcode::~CFWL_Barcode() {}
void CFWL_Barcode::SetType(BC_TYPE type) {
if (!m_pIface)
return;
- ((IFWL_Barcode*)m_pIface)->SetType(type);
+ static_cast<IFWL_Barcode*>(m_pIface)->SetType(type);
}
FX_BOOL CFWL_Barcode::IsProtectedType() {
if (!m_pIface)
return 0;
- return ((IFWL_Barcode*)m_pIface)->IsProtectedType();
+ return static_cast<IFWL_Barcode*>(m_pIface)->IsProtectedType();
}
FWL_ERR CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {
diff --git a/xfa/src/fwl/src/lightwidget/caret.cpp b/xfa/src/fwl/src/lightwidget/caret.cpp
index 96be7dabbf..f0ee8a5166 100644
--- a/xfa/src/fwl/src/lightwidget/caret.cpp
+++ b/xfa/src/fwl/src/lightwidget/caret.cpp
@@ -25,16 +25,16 @@ FWL_ERR CFWL_Caret::Initialize(const CFWL_WidgetProperties* pProperties) {
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_Caret::ShowCaret(FX_BOOL bFlag) {
- return ((IFWL_Caret*)m_pIface)->ShowCaret(bFlag);
+ return static_cast<IFWL_Caret*>(m_pIface)->ShowCaret(bFlag);
}
FWL_ERR CFWL_Caret::GetFrequency(FX_DWORD& elapse) {
- return ((IFWL_Caret*)m_pIface)->GetFrequency(elapse);
+ return static_cast<IFWL_Caret*>(m_pIface)->GetFrequency(elapse);
}
FWL_ERR CFWL_Caret::SetFrequency(FX_DWORD elapse) {
- return ((IFWL_Caret*)m_pIface)->SetFrequency(elapse);
+ return static_cast<IFWL_Caret*>(m_pIface)->SetFrequency(elapse);
}
FWL_ERR CFWL_Caret::SetColor(CFX_Color crFill) {
- return ((IFWL_Caret*)m_pIface)->SetColor(crFill);
+ return static_cast<IFWL_Caret*>(m_pIface)->SetColor(crFill);
}
CFWL_Caret::CFWL_Caret() {}
CFWL_Caret::~CFWL_Caret() {}
diff --git a/xfa/src/fwl/src/lightwidget/checkbox.cpp b/xfa/src/fwl/src/lightwidget/checkbox.cpp
index a9ae80f533..37aeb087f1 100644
--- a/xfa/src/fwl/src/lightwidget/checkbox.cpp
+++ b/xfa/src/fwl/src/lightwidget/checkbox.cpp
@@ -37,10 +37,10 @@ FWL_ERR CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) {
return FWL_ERR_Succeeded;
}
int32_t CFWL_CheckBox::GetCheckState() {
- return ((IFWL_CheckBox*)m_pIface)->GetCheckState();
+ return static_cast<IFWL_CheckBox*>(m_pIface)->GetCheckState();
}
FWL_ERR CFWL_CheckBox::SetCheckState(int32_t iCheck) {
- return ((IFWL_CheckBox*)m_pIface)->SetCheckState(iCheck);
+ return static_cast<IFWL_CheckBox*>(m_pIface)->SetCheckState(iCheck);
}
CFWL_CheckBox::CFWL_CheckBox() {}
CFWL_CheckBox::~CFWL_CheckBox() {}
diff --git a/xfa/src/fwl/src/lightwidget/combobox.cpp b/xfa/src/fwl/src/lightwidget/combobox.cpp
index bff783ea49..556601f32f 100644
--- a/xfa/src/fwl/src/lightwidget/combobox.cpp
+++ b/xfa/src/fwl/src/lightwidget/combobox.cpp
@@ -49,8 +49,8 @@ int32_t CFWL_ComboBox::CountItems() {
return m_comboBoxData.CountItems(GetWidget());
}
FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) {
- CFWL_ComboBoxItem* pItem =
- (CFWL_ComboBoxItem*)(m_comboBoxData.GetItem((IFWL_Widget*)this, iIndex));
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(
+ m_comboBoxData.GetItem(m_pIface, iIndex));
if (!pItem)
return FWL_ERR_Indefinite;
wsText = pItem->m_wsText;
@@ -59,168 +59,170 @@ FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) {
int32_t CFWL_ComboBox::GetCurSel() {
if (!m_pIface)
return -1;
- return ((IFWL_ComboBox*)m_pIface)->GetCurSel();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->GetCurSel();
}
FWL_ERR CFWL_ComboBox::SetCurSel(int32_t iSel) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ComboBox*)m_pIface)->SetCurSel(iSel);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->SetCurSel(iSel);
}
FWL_ERR CFWL_ComboBox::SetEditText(const CFX_WideStringC& wsText) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ComboBox*)m_pIface)->SetEditText(wsText);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditText(wsText);
}
int32_t CFWL_ComboBox::GetEditTextLength() const {
if (!m_pIface)
return 0;
- return ((IFWL_ComboBox*)m_pIface)->GetEditTextLength();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditTextLength();
}
FWL_ERR CFWL_ComboBox::GetEditText(CFX_WideString& wsText,
int32_t nStart,
int32_t nCount) const {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ComboBox*)m_pIface)->GetEditText(wsText, nStart, nCount);
+ return static_cast<IFWL_ComboBox*>(m_pIface)
+ ->GetEditText(wsText, nStart, nCount);
}
FWL_ERR CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ComboBox*)m_pIface)->SetEditSelRange(nStart, nCount);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditSelRange(nStart, nCount);
}
int32_t CFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
if (!m_pIface)
return 0;
- return ((IFWL_ComboBox*)m_pIface)->GetEditSelRange(nIndex, nStart);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditSelRange(nIndex, nStart);
}
int32_t CFWL_ComboBox::GetEditLimit() {
if (!m_pIface)
return 0;
- return ((IFWL_ComboBox*)m_pIface)->GetEditLimit();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditLimit();
}
FWL_ERR CFWL_ComboBox::SetEditLimit(int32_t nLimit) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ComboBox*)m_pIface)->SetEditLimit(nLimit);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditLimit(nLimit);
}
FWL_ERR CFWL_ComboBox::EditDoClipboard(int32_t iCmd) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ComboBox*)m_pIface)->EditDoClipboard(iCmd);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditDoClipboard(iCmd);
}
FX_BOOL CFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditRedo(bsRecord);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditRedo(bsRecord);
}
FX_BOOL CFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditUndo(bsRecord);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditUndo(bsRecord);
}
FWL_ERR CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) {
m_comboBoxData.m_fMaxListHeight = fMaxHeight;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) {
- CFWL_ComboBoxItem* pItem =
- (CFWL_ComboBoxItem*)(m_comboBoxData.GetItem((IFWL_Widget*)this, iIndex));
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(
+ m_comboBoxData.GetItem(m_pIface, iIndex));
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));
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(
+ m_comboBoxData.GetItem(m_pIface, iIndex));
if (!pItem)
return NULL;
return pItem->m_pData;
}
FWL_ERR CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) {
- return ((IFWL_ComboBox*)m_pIface)->GetListBoxt()->SetThemeProvider(pTheme);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider(
+ pTheme);
}
FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() {
- return ((IFWL_ComboBox*)m_pIface)->AfterFocusShowDropList();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList();
}
FWL_ERR CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) {
- return ((IFWL_ComboBox*)m_pIface)->OpenDropDownList(bActivate);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->OpenDropDownList(bActivate);
}
FX_BOOL CFWL_ComboBox::EditCanUndo() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditCanUndo();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanUndo();
}
FX_BOOL CFWL_ComboBox::EditCanRedo() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditCanRedo();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanRedo();
}
FX_BOOL CFWL_ComboBox::EditUndo() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditUndo();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditUndo();
}
FX_BOOL CFWL_ComboBox::EditRedo() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditRedo();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditRedo();
}
FX_BOOL CFWL_ComboBox::EditCanCopy() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditCanCopy();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanCopy();
}
FX_BOOL CFWL_ComboBox::EditCanCut() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditCanCut();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanCut();
}
FX_BOOL CFWL_ComboBox::EditCanSelectAll() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditCanSelectAll();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditCanSelectAll();
}
FX_BOOL CFWL_ComboBox::EditCopy(CFX_WideString& wsCopy) {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditCopy(wsCopy);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditCopy(wsCopy);
}
FX_BOOL CFWL_ComboBox::EditCut(CFX_WideString& wsCut) {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditCut(wsCut);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditCut(wsCut);
}
FX_BOOL CFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditPaste(wsPaste);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditPaste(wsPaste);
}
FX_BOOL CFWL_ComboBox::EditSelectAll() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditSelectAll();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditSelectAll();
}
FX_BOOL CFWL_ComboBox::EditDelete() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditDelete();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditDelete();
}
FX_BOOL CFWL_ComboBox::EditDeSelect() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->EditDeSelect();
+ return static_cast<IFWL_ComboBox*>(m_pIface)->EditDeSelect();
}
FWL_ERR CFWL_ComboBox::GetBBox(CFX_RectF& rect) {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)->GetBBox(rect);
+ return static_cast<IFWL_ComboBox*>(m_pIface)->GetBBox(rect);
}
FWL_ERR CFWL_ComboBox::EditModifyStylesEx(FX_DWORD dwStylesExAdded,
FX_DWORD dwStylesExRemoved) {
if (!m_pIface)
return FALSE;
- return ((IFWL_ComboBox*)m_pIface)
+ return static_cast<IFWL_ComboBox*>(m_pIface)
->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
CFWL_ComboBox::CFWL_ComboBox() {}
@@ -232,10 +234,7 @@ CFWL_ComboBox::CFWL_ComboBoxDP::CFWL_ComboBoxDP() {
CFWL_ComboBox::CFWL_ComboBoxDP::~CFWL_ComboBoxDP() {
int32_t nCount = m_arrItem.GetSize();
for (int32_t i = 0; i < nCount; i++) {
- CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)m_arrItem[i];
- if (pItem) {
- delete pItem;
- }
+ delete static_cast<CFWL_ComboBoxItem*>(m_arrItem[i]);
}
m_arrItem.RemoveAll();
}
@@ -263,14 +262,14 @@ FX_DWORD CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return 0;
- return ((CFWL_ComboBoxItem*)hItem)->m_dwStyles;
+ return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
if (!hItem)
return FWL_ERR_Indefinite;
- wsText = ((CFWL_ComboBoxItem*)hItem)->m_wsText;
+ wsText = reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget,
@@ -278,7 +277,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget,
CFX_RectF& rtItem) {
if (!hItem)
return FWL_ERR_Indefinite;
- CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)hItem;
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
rtItem.Set(pItem->m_rtItem.left, pItem->m_rtItem.top, pItem->m_rtItem.width,
pItem->m_rtItem.height);
return FWL_ERR_Succeeded;
@@ -287,7 +286,7 @@ void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return NULL;
- CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)hItem;
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
return pItem->m_pData;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget,
@@ -295,7 +294,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget,
FX_DWORD dwStyle) {
if (!hItem)
return FWL_ERR_Indefinite;
- ((CFWL_ComboBoxItem*)hItem)->m_dwStyles = dwStyle;
+ reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles = dwStyle;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget,
@@ -303,7 +302,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget,
const FX_WCHAR* pszText) {
if (!hItem)
return FWL_ERR_Indefinite;
- ((CFWL_ComboBoxItem*)hItem)->m_wsText = pszText;
+ reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText = pszText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget,
@@ -311,7 +310,7 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget,
const CFX_RectF& rtItem) {
if (!hItem)
return FWL_ERR_Indefinite;
- ((CFWL_ComboBoxItem*)hItem)->m_rtItem = rtItem;
+ reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_rtItem = rtItem;
return FWL_ERR_Succeeded;
}
FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
@@ -321,12 +320,12 @@ CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return NULL;
- return ((CFWL_ComboBoxItem*)hItem)->m_pDIB;
+ return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_pDIB;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtCheck) {
- CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)hItem;
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
rtCheck = pItem->m_rtCheckBox;
return FWL_ERR_Succeeded;
}
@@ -334,21 +333,21 @@ FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const CFX_RectF& rtCheck) {
- CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)hItem;
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
pItem->m_rtCheckBox = rtCheck;
return FWL_ERR_Succeeded;
}
FX_DWORD CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckState(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
- CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)hItem;
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
return pItem->m_dwCheckState;
}
FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
FX_DWORD dwCheckState) {
- CFWL_ComboBoxItem* pItem = (CFWL_ComboBoxItem*)hItem;
+ CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem);
pItem->m_dwCheckState = dwCheckState;
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/lightwidget/datetimepicker.cpp b/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
index 3138e38518..2b897943f1 100644
--- a/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
+++ b/xfa/src/fwl/src/lightwidget/datetimepicker.cpp
@@ -37,26 +37,29 @@ FWL_ERR CFWL_DateTimePicker::SetToday(int32_t iYear,
return FWL_ERR_Succeeded;
}
int32_t CFWL_DateTimePicker::CountSelRanges() {
- return ((IFWL_DateTimePicker*)m_pIface)->CountSelRanges();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->CountSelRanges();
}
int32_t CFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) {
- return ((IFWL_DateTimePicker*)m_pIface)->GetSelRange(nIndex, nStart);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)
+ ->GetSelRange(nIndex, nStart);
}
FWL_ERR CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) {
- return ((IFWL_DateTimePicker*)m_pIface)->GetEditText(wsText);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->GetEditText(wsText);
}
FWL_ERR CFWL_DateTimePicker::SetEditText(const CFX_WideStringC& wsText) {
- return ((IFWL_DateTimePicker*)m_pIface)->SetEditText(wsText);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->SetEditText(wsText);
}
FWL_ERR CFWL_DateTimePicker::GetCurSel(int32_t& iYear,
int32_t& iMonth,
int32_t& iDay) {
- return ((IFWL_DateTimePicker*)m_pIface)->GetCurSel(iYear, iMonth, iDay);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)
+ ->GetCurSel(iYear, iMonth, iDay);
}
FWL_ERR CFWL_DateTimePicker::SetCurSel(int32_t iYear,
int32_t iMonth,
int32_t iDay) {
- return ((IFWL_DateTimePicker*)m_pIface)->SetCurSel(iYear, iMonth, iDay);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)
+ ->SetCurSel(iYear, iMonth, iDay);
}
CFWL_DateTimePicker::CFWL_DateTimePicker() {}
CFWL_DateTimePicker::~CFWL_DateTimePicker() {}
@@ -82,52 +85,52 @@ FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday(
return FWL_ERR_Succeeded;
}
FX_BOOL CFWL_DateTimePicker::CanUndo() {
- return ((IFWL_DateTimePicker*)m_pIface)->CanUndo();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanUndo();
}
FX_BOOL CFWL_DateTimePicker::CanRedo() {
- return ((IFWL_DateTimePicker*)m_pIface)->CanRedo();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanRedo();
}
FX_BOOL CFWL_DateTimePicker::Undo() {
- return ((IFWL_DateTimePicker*)m_pIface)->Undo();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->Undo();
}
FX_BOOL CFWL_DateTimePicker::Redo() {
- return ((IFWL_DateTimePicker*)m_pIface)->Redo();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->Redo();
}
FX_BOOL CFWL_DateTimePicker::CanCopy() {
- return ((IFWL_DateTimePicker*)m_pIface)->CanCopy();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanCopy();
}
FX_BOOL CFWL_DateTimePicker::CanCut() {
- return ((IFWL_DateTimePicker*)m_pIface)->CanCut();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanCut();
}
FX_BOOL CFWL_DateTimePicker::CanSelectAll() {
- return ((IFWL_DateTimePicker*)m_pIface)->CanSelectAll();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->CanSelectAll();
}
FX_BOOL CFWL_DateTimePicker::Copy(CFX_WideString& wsCopy) {
- return ((IFWL_DateTimePicker*)m_pIface)->Copy(wsCopy);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->Copy(wsCopy);
}
FX_BOOL CFWL_DateTimePicker::Cut(CFX_WideString& wsCut) {
- return ((IFWL_DateTimePicker*)m_pIface)->Copy(wsCut);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->Copy(wsCut);
}
FX_BOOL CFWL_DateTimePicker::Paste(const CFX_WideString& wsPaste) {
- return ((IFWL_DateTimePicker*)m_pIface)->Paste(wsPaste);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->Paste(wsPaste);
}
FX_BOOL CFWL_DateTimePicker::SelectAll() {
- return ((IFWL_DateTimePicker*)m_pIface)->SelectAll();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->SelectAll();
}
FX_BOOL CFWL_DateTimePicker::Delete() {
- return ((IFWL_DateTimePicker*)m_pIface)->Delete();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->Delete();
}
FX_BOOL CFWL_DateTimePicker::DeSelect() {
- return ((IFWL_DateTimePicker*)m_pIface)->DeSelect();
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->DeSelect();
}
FWL_ERR CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) {
- return ((IFWL_DateTimePicker*)m_pIface)->GetBBox(rect);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->GetBBox(rect);
}
FWL_ERR CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) {
- return ((IFWL_DateTimePicker*)m_pIface)->SetEditLimit(nLimit);
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)->SetEditLimit(nLimit);
}
FWL_ERR CFWL_DateTimePicker::ModifyEditStylesEx(FX_DWORD dwStylesExAdded,
FX_DWORD dwStylesExRemoved) {
- return ((IFWL_DateTimePicker*)m_pIface)
+ return static_cast<IFWL_DateTimePicker*>(m_pIface)
->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
diff --git a/xfa/src/fwl/src/lightwidget/edit.cpp b/xfa/src/fwl/src/lightwidget/edit.cpp
index 92e8f8138c..a8a16850bf 100644
--- a/xfa/src/fwl/src/lightwidget/edit.cpp
+++ b/xfa/src/fwl/src/lightwidget/edit.cpp
@@ -27,182 +27,184 @@ FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) {
FWL_ERR CFWL_Edit::SetText(const CFX_WideString& wsText) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->SetText(wsText);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetText(wsText);
}
int32_t CFWL_Edit::GetTextLength() const {
if (!m_pIface)
return 0;
- return ((IFWL_Edit*)m_pIface)->GetTextLength();
+ return static_cast<IFWL_Edit*>(m_pIface)->GetTextLength();
}
FWL_ERR CFWL_Edit::GetText(CFX_WideString& wsText,
int32_t nStart,
int32_t nCount) const {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->GetText(wsText, nStart, nCount);
+ return static_cast<IFWL_Edit*>(m_pIface)->GetText(wsText, nStart, nCount);
}
FWL_ERR CFWL_Edit::ClearText() {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->ClearText();
+ return static_cast<IFWL_Edit*>(m_pIface)->ClearText();
}
int32_t CFWL_Edit::GetCaretPos() const {
if (!m_pIface)
return -1;
- return ((IFWL_Edit*)m_pIface)->GetCaretPos();
+ return static_cast<IFWL_Edit*>(m_pIface)->GetCaretPos();
}
int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
if (!m_pIface)
return -1;
- return ((IFWL_Edit*)m_pIface)->SetCaretPos(nIndex, bBefore);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetCaretPos(nIndex, bBefore);
}
FWL_ERR CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- ((IFWL_Edit*)m_pIface)->AddSelRange(nStart, nCount);
+ static_cast<IFWL_Edit*>(m_pIface)->AddSelRange(nStart, nCount);
int32_t pos = 0;
- int32_t sum = ((IFWL_Edit*)m_pIface)->GetTextLength();
+ int32_t sum = static_cast<IFWL_Edit*>(m_pIface)->GetTextLength();
if (nCount == -1) {
pos = sum;
} else {
pos = nStart + nCount;
}
- return ((IFWL_Edit*)m_pIface)->SetCaretPos(pos);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetCaretPos(pos);
}
int32_t CFWL_Edit::CountSelRanges() {
if (!m_pIface)
return 0;
- return ((IFWL_Edit*)m_pIface)->CountSelRanges();
+ return static_cast<IFWL_Edit*>(m_pIface)->CountSelRanges();
}
int32_t CFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) {
if (!m_pIface)
return 0;
- return ((IFWL_Edit*)m_pIface)->GetSelRange(nIndex, nStart);
+ return static_cast<IFWL_Edit*>(m_pIface)->GetSelRange(nIndex, nStart);
}
FWL_ERR CFWL_Edit::ClearSelections() {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->ClearSelections();
+ return static_cast<IFWL_Edit*>(m_pIface)->ClearSelections();
}
int32_t CFWL_Edit::GetLimit() {
if (!m_pIface)
return -1;
- return ((IFWL_Edit*)m_pIface)->GetLimit();
+ return static_cast<IFWL_Edit*>(m_pIface)->GetLimit();
}
FWL_ERR CFWL_Edit::SetLimit(int32_t nLimit) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->SetLimit(nLimit);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetLimit(nLimit);
}
FWL_ERR CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->SetAliasChar(wAlias);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetAliasChar(wAlias);
}
FWL_ERR CFWL_Edit::SetFormatString(const CFX_WideString& wsFormat) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->SetFormatString(wsFormat);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetFormatString(wsFormat);
}
FWL_ERR CFWL_Edit::Insert(int32_t nStart,
const FX_WCHAR* lpText,
int32_t nLen) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->Insert(nStart, lpText, nLen);
+ return static_cast<IFWL_Edit*>(m_pIface)->Insert(nStart, lpText, nLen);
}
FWL_ERR CFWL_Edit::DeleteSelections() {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->DeleteSelections();
+ return static_cast<IFWL_Edit*>(m_pIface)->DeleteSelections();
}
FWL_ERR CFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->DeleteRange(nStart, nCount);
+ return static_cast<IFWL_Edit*>(m_pIface)->DeleteRange(nStart, nCount);
}
FWL_ERR CFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->ReplaceSelections(wsReplace);
+ return static_cast<IFWL_Edit*>(m_pIface)->ReplaceSelections(wsReplace);
}
FWL_ERR CFWL_Edit::Replace(int32_t nStart,
int32_t nLen,
const CFX_WideStringC& wsReplace) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->Replace(nStart, nLen, wsReplace);
+ return static_cast<IFWL_Edit*>(m_pIface)->Replace(nStart, nLen, wsReplace);
}
FWL_ERR CFWL_Edit::DoClipboard(int32_t iCmd) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->DoClipboard(iCmd);
+ return static_cast<IFWL_Edit*>(m_pIface)->DoClipboard(iCmd);
}
FX_BOOL CFWL_Edit::Redo(const CFX_ByteStringC& bsRecord) {
if (!m_pIface)
return FALSE;
- return ((IFWL_Edit*)m_pIface)->Redo(bsRecord);
+ return static_cast<IFWL_Edit*>(m_pIface)->Redo(bsRecord);
}
FX_BOOL CFWL_Edit::Undo(const CFX_ByteStringC& bsRecord) {
if (!m_pIface)
return FALSE;
- return ((IFWL_Edit*)m_pIface)->Undo(bsRecord);
+ return static_cast<IFWL_Edit*>(m_pIface)->Undo(bsRecord);
}
FWL_ERR CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->SetTabWidth(fTabWidth, bEquidistant);
+ return static_cast<IFWL_Edit*>(m_pIface)
+ ->SetTabWidth(fTabWidth, bEquidistant);
}
FWL_ERR CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) {
if (iMin > iMax) {
return FWL_ERR_Parameter_Invalid;
}
- return ((IFWL_Edit*)m_pIface)->SetNumberRange(iMin, iMax);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetNumberRange(iMin, iMax);
}
FWL_ERR CFWL_Edit::SetBackColor(FX_DWORD dwColor) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->SetBackColor(dwColor);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetBackColor(dwColor);
}
FWL_ERR CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_Edit*)m_pIface)->SetFont(wsFont, fSize);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetFont(wsFont, fSize);
}
FX_BOOL CFWL_Edit::CanUndo() {
- return ((IFWL_Edit*)m_pIface)->CanUndo();
+ return static_cast<IFWL_Edit*>(m_pIface)->CanUndo();
}
FX_BOOL CFWL_Edit::CanRedo() {
- return ((IFWL_Edit*)m_pIface)->CanRedo();
+ return static_cast<IFWL_Edit*>(m_pIface)->CanRedo();
}
FX_BOOL CFWL_Edit::Undo() {
- return ((IFWL_Edit*)m_pIface)->Undo();
+ return static_cast<IFWL_Edit*>(m_pIface)->Undo();
}
FX_BOOL CFWL_Edit::Redo() {
- return ((IFWL_Edit*)m_pIface)->Undo();
+ return static_cast<IFWL_Edit*>(m_pIface)->Undo();
}
FX_BOOL CFWL_Edit::Copy(CFX_WideString& wsCopy) {
- return ((IFWL_Edit*)m_pIface)->Copy(wsCopy);
+ return static_cast<IFWL_Edit*>(m_pIface)->Copy(wsCopy);
}
FX_BOOL CFWL_Edit::Cut(CFX_WideString& wsCut) {
- return ((IFWL_Edit*)m_pIface)->Cut(wsCut);
+ return static_cast<IFWL_Edit*>(m_pIface)->Cut(wsCut);
}
FX_BOOL CFWL_Edit::Paste(const CFX_WideString& wsPaste) {
- return ((IFWL_Edit*)m_pIface)->Paste(wsPaste);
+ return static_cast<IFWL_Edit*>(m_pIface)->Paste(wsPaste);
}
FX_BOOL CFWL_Edit::Delete() {
- return ((IFWL_Edit*)m_pIface)->Delete();
+ return static_cast<IFWL_Edit*>(m_pIface)->Delete();
}
void CFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) {
- return ((IFWL_Edit*)m_pIface)->SetScrollOffset(fScrollOffset);
+ return static_cast<IFWL_Edit*>(m_pIface)->SetScrollOffset(fScrollOffset);
}
FX_BOOL CFWL_Edit::GetSuggestWords(CFX_PointF pointf,
CFX_ByteStringArray& sSuggest) {
- return ((IFWL_Edit*)m_pIface)->GetSuggestWords(pointf, sSuggest);
+ return static_cast<IFWL_Edit*>(m_pIface)->GetSuggestWords(pointf, sSuggest);
}
FX_BOOL CFWL_Edit::ReplaceSpellCheckWord(CFX_PointF pointf,
const CFX_ByteStringC& bsReplace) {
- return ((IFWL_Edit*)m_pIface)->ReplaceSpellCheckWord(pointf, bsReplace);
+ return static_cast<IFWL_Edit*>(m_pIface)
+ ->ReplaceSpellCheckWord(pointf, bsReplace);
}
CFWL_Edit::CFWL_Edit() {}
CFWL_Edit::~CFWL_Edit() {}
diff --git a/xfa/src/fwl/src/lightwidget/listbox.cpp b/xfa/src/fwl/src/lightwidget/listbox.cpp
index 448fd7254b..ae8b6b944e 100644
--- a/xfa/src/fwl/src/lightwidget/listbox.cpp
+++ b/xfa/src/fwl/src/lightwidget/listbox.cpp
@@ -25,7 +25,7 @@ FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) {
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem) {
- ((CFWL_ListItem*)hItem)->m_pDIB = pDIB;
+ reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB = pDIB;
return FWL_ERR_Succeeded;
}
FWL_HLISTITEM CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd,
@@ -43,8 +43,8 @@ FX_BOOL CFWL_ListBox::DeleteString(FWL_HLISTITEM hItem) {
return FALSE;
}
CFWL_ListItem* pDelItem =
- (CFWL_ListItem*)m_ListBoxDP.GetItem((IFWL_ListBox*)this, nIndex);
- int32_t iCount = m_ListBoxDP.CountItems((IFWL_ListBox*)this);
+ reinterpret_cast<CFWL_ListItem*>(m_ListBoxDP.GetItem(m_pIface, nIndex));
+ int32_t iCount = m_ListBoxDP.CountItems(m_pIface);
int32_t iSel = nIndex + 1;
if (iSel >= iCount) {
iSel = nIndex - 1;
@@ -54,7 +54,7 @@ FX_BOOL CFWL_ListBox::DeleteString(FWL_HLISTITEM hItem) {
}
if (iSel >= 0) {
CFWL_ListItem* pSel =
- (CFWL_ListItem*)m_ListBoxDP.GetItem((IFWL_ListBox*)this, iSel);
+ reinterpret_cast<CFWL_ListItem*>(m_ListBoxDP.GetItem(m_pIface, iSel));
pSel->m_dwStates |= FWL_ITEMSTATE_LTB_Selected;
}
m_ListBoxDP.m_arrItem.RemoveAt(nIndex);
@@ -62,10 +62,10 @@ FX_BOOL CFWL_ListBox::DeleteString(FWL_HLISTITEM hItem) {
return TRUE;
}
FX_BOOL CFWL_ListBox::DeleteAll() {
- int32_t iCount = m_ListBoxDP.CountItems((IFWL_ListBox*)this);
+ int32_t iCount = m_ListBoxDP.CountItems(m_pIface);
for (int32_t i = 0; i < iCount; i++) {
CFWL_ListItem* pItem =
- (CFWL_ListItem*)m_ListBoxDP.GetItem((IFWL_ListBox*)this, i);
+ reinterpret_cast<CFWL_ListItem*>(m_ListBoxDP.GetItem(m_pIface, i));
delete pItem;
}
m_ListBoxDP.m_arrItem.RemoveAll();
@@ -74,32 +74,32 @@ FX_BOOL CFWL_ListBox::DeleteAll() {
int32_t CFWL_ListBox::CountSelItems() {
if (!m_pIface)
return 0;
- return ((IFWL_ListBox*)m_pIface)->CountSelItems();
+ return static_cast<IFWL_ListBox*>(m_pIface)->CountSelItems();
}
FWL_HLISTITEM CFWL_ListBox::GetSelItem(int32_t nIndexSel) {
if (!m_pIface)
return NULL;
- return ((IFWL_ListBox*)m_pIface)->GetSelItem(nIndexSel);
+ return static_cast<IFWL_ListBox*>(m_pIface)->GetSelItem(nIndexSel);
}
int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) {
if (!m_pIface)
return 0;
- return ((IFWL_ListBox*)m_pIface)->GetSelIndex(nIndex);
+ return static_cast<IFWL_ListBox*>(m_pIface)->GetSelIndex(nIndex);
}
FWL_ERR CFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ListBox*)m_pIface)->SetSelItem(hItem, bSelect);
+ return static_cast<IFWL_ListBox*>(m_pIface)->SetSelItem(hItem, bSelect);
}
FWL_ERR CFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ListBox*)m_pIface)->GetItemText(hItem, wsText);
+ return static_cast<IFWL_ListBox*>(m_pIface)->GetItemText(hItem, wsText);
}
FWL_ERR CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ListBox*)m_pIface)->GetScrollPos(fPos, bVert);
+ return static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fPos, bVert);
}
FWL_ERR CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
m_ListBoxDP.m_fItemHeight = fItemHeight;
@@ -107,7 +107,8 @@ FWL_ERR CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) {
}
FWL_HLISTITEM CFWL_ListBox::GetFocusItem() {
for (int32_t i = 0; i < m_ListBoxDP.m_arrItem.GetSize(); i++) {
- CFWL_ListItem* hItem = (CFWL_ListItem*)(m_ListBoxDP.m_arrItem[i]);
+ CFWL_ListItem* hItem =
+ static_cast<CFWL_ListItem*>(m_ListBoxDP.m_arrItem[i]);
if (hItem->m_dwStates & FWL_ITEMSTATE_LTB_Focused) {
return (FWL_HLISTITEM)hItem;
}
@@ -116,12 +117,12 @@ FWL_HLISTITEM CFWL_ListBox::GetFocusItem() {
}
FWL_ERR CFWL_ListBox::SetFocusItem(FWL_HLISTITEM hItem) {
int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem);
- ((CFWL_ListItem*)(m_ListBoxDP.m_arrItem[nIndex]))->m_dwStates |=
+ static_cast<CFWL_ListItem*>(m_ListBoxDP.m_arrItem[nIndex])->m_dwStates |=
FWL_ITEMSTATE_LTB_Focused;
return FWL_ERR_Succeeded;
}
FWL_ERR* CFWL_ListBox::Sort(IFWL_ListBoxCompare* pCom) {
- return ((IFWL_ListBox*)m_pIface)->Sort(pCom);
+ return static_cast<IFWL_ListBox*>(m_pIface)->Sort(pCom);
}
int32_t CFWL_ListBox::CountItems() {
return m_ListBoxDP.m_arrItem.GetSize();
@@ -137,30 +138,26 @@ FWL_ERR CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem,
const CFX_WideStringC& wsText) {
if (!hItem)
return FWL_ERR_Indefinite;
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
- pItem->m_wsText = wsText;
+ reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = wsText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
if (!hItem)
return FWL_ERR_Indefinite;
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
- wsText = pItem->m_wsText;
+ wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::SetItemData(FWL_HLISTITEM hItem, void* pData) {
if (!hItem)
return FWL_ERR_Indefinite;
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
- pItem->m_pData = pData;
+ reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData = pData;
return FWL_ERR_Succeeded;
}
void* CFWL_ListBox::GetItemData(FWL_HLISTITEM hItem) {
if (!hItem)
return NULL;
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
- return pItem->m_pData;
+ return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData;
}
FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
CFX_RectF rtClient;
@@ -169,8 +166,8 @@ FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
fy -= rtClient.top;
FX_FLOAT fPosX = 0;
FX_FLOAT fPosY = 0;
- ((IFWL_ListBox*)m_pIface)->GetScrollPos(fx);
- ((IFWL_ListBox*)m_pIface)->GetScrollPos(fy, FALSE);
+ static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fx);
+ static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fy, FALSE);
int32_t nCount = m_ListBoxDP.CountItems(NULL);
for (int32_t i = 0; i < nCount; i++) {
FWL_HLISTITEM hItem = m_ListBoxDP.GetItem(NULL, i);
@@ -189,7 +186,7 @@ FWL_HLISTITEM CFWL_ListBox::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) {
FX_DWORD CFWL_ListBox::GetItemStates(FWL_HLISTITEM hItem) {
if (!hItem)
return 0;
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
+ CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem);
return pItem->m_dwStates | pItem->m_dwCheckState;
}
CFWL_ListBox::CFWL_ListBox() {}
@@ -198,10 +195,7 @@ CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {}
CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {
int32_t nCount = m_arrItem.GetSize();
for (int32_t i = 0; i < nCount; i++) {
- CFWL_ListItem* pItem = (CFWL_ListItem*)m_arrItem[i];
- if (pItem != NULL) {
- delete pItem;
- }
+ delete static_cast<CFWL_ListItem*>(m_arrItem[i]);
}
m_arrItem.RemoveAll();
}
@@ -234,14 +228,14 @@ FX_DWORD CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return -1;
- return ((CFWL_ListItem*)hItem)->m_dwStates;
+ return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_WideString& wsText) {
if (!hItem)
return FWL_ERR_Indefinite;
- wsText = ((CFWL_ListItem*)hItem)->m_wsText;
+ wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
@@ -249,7 +243,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget,
CFX_RectF& rtItem) {
if (!hItem)
return FWL_ERR_Indefinite;
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
+ CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem);
rtItem = pItem->m_rtItem;
return FWL_ERR_Succeeded;
}
@@ -257,7 +251,7 @@ void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
if (!hItem)
return NULL;
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
+ CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem);
return pItem->m_pData;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
@@ -265,7 +259,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget,
FX_DWORD dwStyle) {
if (!hItem)
return FWL_ERR_Indefinite;
- ((CFWL_ListItem*)hItem)->m_dwStates = dwStyle;
+ reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates = dwStyle;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
@@ -273,7 +267,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget,
const FX_WCHAR* pszText) {
if (!hItem)
return FWL_ERR_Indefinite;
- ((CFWL_ListItem*)hItem)->m_wsText = pszText;
+ reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = pszText;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
@@ -281,7 +275,7 @@ FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget,
const CFX_RectF& rtItem) {
if (!hItem)
return FWL_ERR_Indefinite;
- ((CFWL_ListItem*)hItem)->m_rtItem = rtItem;
+ reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtItem = rtItem;
return FWL_ERR_Succeeded;
}
FX_FLOAT CFWL_ListBox::CFWL_ListBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
@@ -289,32 +283,28 @@ FX_FLOAT CFWL_ListBox::CFWL_ListBoxDP::GetItemHeight(IFWL_Widget* pWidget) {
}
CFX_DIBitmap* CFWL_ListBox::CFWL_ListBoxDP::GetItemIcon(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
- return ((CFWL_ListItem*)hItem)->m_pDIB;
+ return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckRect(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
CFX_RectF& rtCheck) {
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
- rtCheck = pItem->m_rtCheckBox;
+ rtCheck = reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox;
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect(
IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
const CFX_RectF& rtCheck) {
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
- pItem->m_rtCheckBox = rtCheck;
+ reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox = rtCheck;
return FWL_ERR_Succeeded;
}
FX_DWORD CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem) {
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
- return pItem->m_dwCheckState;
+ return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState;
}
FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState(IFWL_Widget* pWidget,
FWL_HLISTITEM hItem,
FX_DWORD dwCheckState) {
- CFWL_ListItem* pItem = (CFWL_ListItem*)hItem;
- pItem->m_dwCheckState = dwCheckState;
+ reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState = dwCheckState;
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fxgraphics/src/fx_graphics.cpp b/xfa/src/fxgraphics/src/fx_graphics.cpp
index 990e7f47e8..69b0c2ad9b 100644
--- a/xfa/src/fxgraphics/src/fx_graphics.cpp
+++ b/xfa/src/fxgraphics/src/fx_graphics.cpp
@@ -403,7 +403,7 @@ FX_ERR CFX_Graphics::StretchImage(CFX_DIBSource* source,
default: { return FX_ERR_Property_Invalid; }
}
}
-FX_ERR CFX_Graphics::ConcatMatrix(CFX_Matrix* matrix) {
+FX_ERR CFX_Graphics::ConcatMatrix(const CFX_Matrix* matrix) {
_FX_RETURN_VALUE_IF_FAIL(matrix, FX_ERR_Parameter_Invalid);
switch (_type) {
case FX_CONTEXT_Device: {
@@ -544,7 +544,8 @@ FX_ERR CFX_Graphics::CalcTextRect(CFX_RectF& rect,
default: { return FX_ERR_Property_Invalid; }
}
}
-FX_ERR CFX_Graphics::Transfer(CFX_Graphics* graphics, CFX_Matrix* matrix) {
+FX_ERR CFX_Graphics::Transfer(CFX_Graphics* graphics,
+ const CFX_Matrix* matrix) {
_FX_RETURN_VALUE_IF_FAIL(graphics, FX_ERR_Parameter_Invalid);
CFX_Matrix m;
m.Set(_info._CTM.a, _info._CTM.b, _info._CTM.c, _info._CTM.d, _info._CTM.e,
@@ -570,7 +571,7 @@ FX_ERR CFX_Graphics::Transfer(CFX_Graphics* graphics,
FX_FLOAT srcLeft,
FX_FLOAT srcTop,
const CFX_RectF& dstRect,
- CFX_Matrix* matrix) {
+ const CFX_Matrix* matrix) {
_FX_RETURN_VALUE_IF_FAIL(graphics, FX_ERR_Parameter_Invalid);
CFX_Matrix m;
m.Set(_info._CTM.a, _info._CTM.b, _info._CTM.c, _info._CTM.d, _info._CTM.e,