diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-12-07 09:07:09 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-12-07 09:07:09 -0800 |
commit | a52feb072872f42b76994c5b5b5ba467d1103b7b (patch) | |
tree | e0dadf2018083c2b2d641bc296b1b0216deba6be /xfa | |
parent | 63da7474adf5b585d5fd10729a99a2c50c20a626 (diff) | |
download | pdfium-a52feb072872f42b76994c5b5b5ba467d1103b7b.tar.xz |
Remove C-Style casts in severl other fwl_...imp.cpp files
Uncovered bad casts in a couple of places, replaced with
correct objects.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1503583003 .
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp | 26 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_editimp.cpp | 77 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_listboximp.cpp | 102 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp | 135 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp | 20 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp | 20 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp | 11 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp | 6 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp | 18 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fxmath_barcodeimp.cpp | 38 |
10 files changed, 249 insertions, 204 deletions
diff --git a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp index d116aa9c60..12b0f2d7e8 100644 --- a/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_datetimepickerimp.cpp @@ -174,7 +174,7 @@ int32_t CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( FX_DWORD dwHashCode = pMessage->GetClassID();
if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) {
if (dwHashCode == FWL_MSGHASH_Mouse) {
- CFWL_MsgMouse* pMouse = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage);
if (pMouse->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown ||
pMouse->m_dwCmd == FWL_MSGMOUSECMD_RButtonDown) {
if ((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) {
@@ -225,7 +225,7 @@ int32_t CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL);
return pDelegate->OnProcessMessage(pMessage);
} else if (dwCode == FWL_MSGHASH_Mouse) {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) {
OnLButtonDownEx(pMsg);
return 1;
@@ -355,7 +355,7 @@ void CFWL_DateTimeCalendarImpDelegate::OnMouseMoveEx(CFWL_MsgMouse* pMsg) { int32_t CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage(
CFWL_Message* pMessage) {
if (pMessage->GetClassID() == FWL_MSGHASH_Mouse) {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
if (pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonUp) {
DisForm_OnLButtonUpEx(pMsg);
return 1;
@@ -513,7 +513,7 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider);
GetClientRect(m_rtClient);
FX_FLOAT* pFWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
if (!pFWidth)
return FWL_ERR_Indefinite;
FX_FLOAT fBtn = *pFWidth;
@@ -530,7 +530,7 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { }
if (m_pProperties->m_pDataProvider) {
IFWL_DateTimePickerDP* pData =
- (IFWL_DateTimePickerDP*)m_pProperties->m_pDataProvider;
+ static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider);
pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear,
m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay);
}
@@ -830,7 +830,7 @@ void CFWL_DateTimePickerImp::InitProxyForm() { propForm.m_pOwner = m_pInterface;
m_pForm = new IFWL_DateTimeForm();
m_pForm->Initialize(propForm, m_pMonthCal);
- m_pMonthCal->SetParent((IFWL_Widget*)m_pForm);
+ m_pMonthCal->SetParent(m_pForm);
}
IFWL_DateTimeEdit* CFWL_DateTimePickerImp::GetDataTimeEdit() {
return m_pEdit;
@@ -851,7 +851,7 @@ void CFWL_DateTimePickerImp::DisForm_InitDateTimeCalendar() { propMonth.m_dwStyles =
FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border | FWL_WGTSTYLE_EdgeSunken;
propMonth.m_dwStates = FWL_WGTSTATE_Invisible;
- propMonth.m_pParent = (IFWL_Widget*)this;
+ propMonth.m_pParent = m_pInterface;
propMonth.m_pDataProvider = &m_MonthCalendarDP;
propMonth.m_pThemeProvider = m_pProperties->m_pThemeProvider;
m_pMonthCal = new IFWL_DateTimeCalender();
@@ -866,7 +866,7 @@ void CFWL_DateTimePickerImp::DisForm_InitDateTimeEdit() { return;
}
CFWL_WidgetImpProperties propEdit;
- propEdit.m_pParent = (IFWL_Widget*)this;
+ propEdit.m_pParent = m_pInterface;
propEdit.m_pThemeProvider = m_pProperties->m_pThemeProvider;
m_pEdit = new IFWL_DateTimeEdit();
m_pEdit->Initialize(propEdit, m_pInterface);
@@ -957,12 +957,12 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { }
if (m_pProperties->m_pDataProvider) {
IFWL_DateTimePickerDP* pData =
- (IFWL_DateTimePickerDP*)m_pProperties->m_pDataProvider;
- pData->GetToday((IFWL_Widget*)this, m_MonthCalendarDP.m_iCurYear,
+ static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider);
+ pData->GetToday(m_pInterface, m_MonthCalendarDP.m_iCurYear,
m_MonthCalendarDP.m_iCurMonth, m_MonthCalendarDP.m_iCurDay);
}
FX_FLOAT* pWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
if (!pWidth)
return 0;
m_fBtn = *pWidth;
@@ -1039,7 +1039,7 @@ int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( break;
}
case FWL_MSGHASH_Mouse: {
- CFWL_MsgMouse* pMouse = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage);
FX_DWORD dwCmd = pMouse->m_dwCmd;
switch (dwCmd) {
case FWL_MSGMOUSECMD_LButtonDown: {
@@ -1090,7 +1090,7 @@ void CFWL_DateTimePickerImpDelegate::OnFocusChanged(CFWL_Message* pMsg, m_pOwner->m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused);
m_pOwner->Repaint(&m_pOwner->m_rtClient);
}
- if (pMsg->m_pSrcTarget == (IFWL_Widget*)m_pOwner->m_pMonthCal &&
+ if (pMsg->m_pSrcTarget == m_pOwner->m_pMonthCal &&
m_pOwner->IsMonthCalendarShowed()) {
m_pOwner->ShowMonthCalendar(FALSE);
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp index dbd21ecd34..00a24dd9f5 100644 --- a/xfa/src/fwl/src/basewidget/fwl_editimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_editimp.cpp @@ -279,14 +279,14 @@ FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect = m_pProperties->m_rtWidget;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_OuterScrollbar) {
if (IsShowScrollBar(TRUE)) {
- FX_FLOAT* pfWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
+ GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
rect.width += *pfWidth;
rect.width += FWL_EDIT_Margin;
}
if (IsShowScrollBar(FALSE)) {
- FX_FLOAT* pfWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ FX_FLOAT* pfWidth = static_cast<FX_FLOAT*>(
+ GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
rect.height += *pfWidth;
rect.height += FWL_EDIT_Margin;
}
@@ -451,7 +451,7 @@ void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) {
pGraphics->SaveGraphState();
if (pMatrix) {
- pGraphics->ConcatMatrix((CFX_Matrix*)pMatrix);
+ pGraphics->ConcatMatrix(const_cast<CFX_Matrix*>(pMatrix));
}
FX_ARGB cr = 0xFFFF0000;
CFX_Color crLine(cr);
@@ -994,7 +994,7 @@ FX_BOOL CFWL_EditImp::On_Validate(IFDE_TxtEdtEngine* pEdit, CFX_WideString& wsText) {
IFWL_Widget* pDst = GetOuter();
if (!pDst) {
- pDst = (IFWL_Widget*)this;
+ pDst = m_pInterface;
}
CFWL_EvtEdtValidate event;
event.pDstWidget = pDst;
@@ -1128,7 +1128,7 @@ void CFWL_EditImp::DrawContent(CFX_Graphics* pGraphics, if (!pRenderContext)
return;
pRenderDevice->SetClipRect(rtClip);
- pRenderContext->StartRender(pRenderDevice, (IFDE_CanvasSet*)pPage, mt);
+ pRenderContext->StartRender(pRenderDevice, pPage, mt);
pRenderContext->DoRender(NULL);
pRenderContext->Release();
pRenderDevice->Release();
@@ -1243,20 +1243,23 @@ void CFWL_EditImp::UpdateEditParams() { (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) {
params.dwMode |= FDE_TEXTEDITMODE_ReadOnly;
}
- FX_FLOAT* pFontSize = (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_FontSize);
+ FX_FLOAT* pFontSize =
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_FontSize));
if (!pFontSize)
return;
m_fFontSize = *pFontSize;
- FX_DWORD* pFontColor = (FX_DWORD*)GetThemeCapacity(FWL_WGTCAPACITY_TextColor);
+ FX_DWORD* pFontColor =
+ static_cast<FX_DWORD*>(GetThemeCapacity(FWL_WGTCAPACITY_TextColor));
if (!pFontColor)
return;
params.dwFontColor = *pFontColor;
FX_FLOAT* pLineHeight =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_LineHeight);
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_LineHeight));
if (!pLineHeight)
return;
params.fLineSpace = *pLineHeight;
- IFX_Font* pFont = (IFX_Font*)GetThemeCapacity(FWL_WGTCAPACITY_Font);
+ IFX_Font* pFont =
+ static_cast<IFX_Font*>(GetThemeCapacity(FWL_WGTCAPACITY_Font));
if (!pFont)
return;
params.pFont = pFont;
@@ -1344,7 +1347,7 @@ FX_BOOL CFWL_EditImp::UpdateOffset() { }
FX_BOOL CFWL_EditImp::UpdateOffset(IFWL_ScrollBar* pScrollBar,
FX_FLOAT fPosChanged) {
- if (pScrollBar == (IFWL_ScrollBar*)m_pHorzScrollBar) {
+ if (pScrollBar == m_pHorzScrollBar) {
m_fScrollOffsetX += fPosChanged;
} else {
m_fScrollOffsetY += fPosChanged;
@@ -1359,8 +1362,8 @@ void CFWL_EditImp::UpdateVAlignment() { FX_FLOAT fOffsetY = 0.0f;
FX_FLOAT fSpaceAbove = 0.0f;
FX_FLOAT fSpaceBelow = 0.0f;
- CFX_SizeF* pSpace =
- (CFX_SizeF*)GetThemeCapacity(FWL_WGTCAPACITY_SpaceAboveBelow);
+ CFX_SizeF* pSpace = static_cast<CFX_SizeF*>(
+ GetThemeCapacity(FWL_WGTCAPACITY_SpaceAboveBelow));
if (pSpace) {
fSpaceAbove = pSpace->x;
fSpaceBelow = pSpace->y;
@@ -1462,14 +1465,14 @@ IFWL_ScrollBar* CFWL_EditImp::UpdateScroll() { m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, FALSE);
m_pHorzScrollBar->UnlockUpdate();
m_pHorzScrollBar->Update();
- pRepaint = (IFWL_ScrollBar*)m_pHorzScrollBar;
+ pRepaint = m_pHorzScrollBar;
} else if ((m_pHorzScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) {
m_pHorzScrollBar->LockUpdate();
m_pHorzScrollBar->SetRange(0, -1);
m_pHorzScrollBar->SetStates(FWL_WGTSTATE_Disabled, TRUE);
m_pHorzScrollBar->UnlockUpdate();
m_pHorzScrollBar->Update();
- pRepaint = (IFWL_ScrollBar*)m_pHorzScrollBar;
+ pRepaint = m_pHorzScrollBar;
}
}
if (bShowVert) {
@@ -1497,14 +1500,14 @@ IFWL_ScrollBar* CFWL_EditImp::UpdateScroll() { m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, FALSE);
m_pVertScrollBar->UnlockUpdate();
m_pVertScrollBar->Update();
- pRepaint = (IFWL_ScrollBar*)m_pVertScrollBar;
+ pRepaint = m_pVertScrollBar;
} else if ((m_pVertScrollBar->GetStates() & FWL_WGTSTATE_Disabled) == 0) {
m_pVertScrollBar->LockUpdate();
m_pVertScrollBar->SetRange(0, -1);
m_pVertScrollBar->SetStates(FWL_WGTSTATE_Disabled, TRUE);
m_pVertScrollBar->UnlockUpdate();
m_pVertScrollBar->Update();
- pRepaint = (IFWL_ScrollBar*)m_pVertScrollBar;
+ pRepaint = m_pVertScrollBar;
}
}
return pRepaint;
@@ -1550,13 +1553,13 @@ void CFWL_EditImp::Layout() { GetClientRect(m_rtClient);
m_rtEngine = m_rtClient;
FX_FLOAT* pfWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
if (!pfWidth)
return;
FX_FLOAT fWidth = *pfWidth;
if (!m_pOuter) {
CFX_RectF* pUIMargin =
- (CFX_RectF*)GetThemeCapacity(FWL_WGTCAPACITY_UIMargin);
+ static_cast<CFX_RectF*>(GetThemeCapacity(FWL_WGTCAPACITY_UIMargin));
if (pUIMargin) {
m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width,
pUIMargin->height);
@@ -1565,8 +1568,8 @@ void CFWL_EditImp::Layout() { CFWL_ThemePart part;
part.m_pWidget = m_pOuter;
CFX_RectF* pUIMargin =
- (CFX_RectF*)m_pOuter->GetThemeProvider()->GetCapacity(
- &part, FWL_WGTCAPACITY_UIMargin);
+ static_cast<CFX_RectF*>(m_pOuter->GetThemeProvider()->GetCapacity(
+ &part, FWL_WGTCAPACITY_UIMargin));
if (pUIMargin) {
m_rtEngine.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width,
pUIMargin->height);
@@ -1625,7 +1628,8 @@ void CFWL_EditImp::LayoutScrollBar() { FX_BOOL bShowHorzScrollbar = IsShowScrollBar(FALSE);
if (bShowVertScrollbar) {
if (!m_pVertScrollBar) {
- pfWidth = (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ pfWidth = static_cast<FX_FLOAT*>(
+ GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
FX_FLOAT fWidth = pfWidth ? *pfWidth : 0;
InitScrollBar();
CFX_RectF rtVertScr;
@@ -1648,9 +1652,10 @@ void CFWL_EditImp::LayoutScrollBar() { }
if (bShowHorzScrollbar) {
if (!m_pHorzScrollBar) {
- pfWidth =
- !pfWidth ? (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth)
- : pfWidth;
+ if (!pfWidth) {
+ pfWidth = static_cast<FX_FLOAT*>(
+ GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
+ }
FX_FLOAT fWidth = pfWidth ? *pfWidth : 0;
InitScrollBar(FALSE);
CFX_RectF rtHoriScr;
@@ -1709,7 +1714,7 @@ void CFWL_EditImp::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) { }
Repaint(&m_rtEngine);
} else {
- IFWL_Widget* pOuter = (IFWL_Widget*)m_pInterface;
+ IFWL_Widget* pOuter = m_pInterface;
if (bVisible) {
pRect->Offset(m_pProperties->m_rtWidget.left,
m_pProperties->m_rtWidget.top);
@@ -1798,11 +1803,11 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { int32_t iRet = 1;
switch (dwMsgCode) {
case FWL_MSGHASH_Activate: {
- DoActivate((CFWL_MsgActivate*)pMessage);
+ DoActivate(static_cast<CFWL_MsgActivate*>(pMessage));
break;
}
case FWL_MSGHASH_Deactivate: {
- DoDeactivate((CFWL_MsgDeactivate*)pMessage);
+ DoDeactivate(static_cast<CFWL_MsgDeactivate*>(pMessage));
break;
}
case FWL_MSGHASH_SetFocus:
@@ -1811,7 +1816,7 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Mouse: {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
FX_DWORD dwCmd = pMsg->m_dwCmd;
switch (dwCmd) {
case FWL_MSGMOUSECMD_LButtonDown: {
@@ -1839,7 +1844,7 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Key: {
- CFWL_MsgKey* pKey = (CFWL_MsgKey*)pMessage;
+ CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
FX_DWORD dwCmd = pKey->m_dwCmd;
if (dwCmd == FWL_MSGKEYCMD_KeyDown) {
OnKeyDown(pKey);
@@ -1861,13 +1866,13 @@ FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { return FWL_ERR_Succeeded;
}
IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget;
- if ((pSrcTarget == (IFWL_Widget*)m_pOwner->m_pVertScrollBar &&
+ if ((pSrcTarget == m_pOwner->m_pVertScrollBar &&
m_pOwner->m_pVertScrollBar) ||
- (pSrcTarget == (IFWL_Widget*)m_pOwner->m_pHorzScrollBar &&
+ (pSrcTarget == m_pOwner->m_pHorzScrollBar &&
m_pOwner->m_pHorzScrollBar)) {
- FX_DWORD dwScrollCode = ((CFWL_EvtScroll*)pEvent)->m_iScrollCode;
- FX_FLOAT fPos = ((CFWL_EvtScroll*)pEvent)->m_fPos;
- OnScroll((IFWL_ScrollBar*)pSrcTarget, dwScrollCode, fPos);
+ CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent);
+ OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget),
+ pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos);
}
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp index 589423c273..73c3a9ce44 100644 --- a/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_listboximp.cpp @@ -216,7 +216,8 @@ int32_t CFWL_ListBoxImp::CountSelItems() { if (!m_pProperties->m_pDataProvider)
return 0;
int32_t iRet = 0;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
@@ -234,7 +235,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetSelItem(int32_t nIndexSel) { if (!m_pProperties->m_pDataProvider)
return NULL;
int32_t index = 0;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
@@ -256,7 +258,8 @@ int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) { if (!m_pProperties->m_pDataProvider)
return -1;
int32_t index = 0;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
@@ -297,7 +300,8 @@ FWL_ERR CFWL_ListBoxImp::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) {
if (!m_pProperties->m_pDataProvider)
return FWL_ERR_Indefinite;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
if (!hItem)
return FWL_ERR_Indefinite;
pData->GetItemText(m_pInterface, hItem, wsText);
@@ -313,7 +317,8 @@ FWL_ERR CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { }
FWL_ERR* CFWL_ListBoxImp::Sort(IFWL_ListBoxCompare* pCom) {
FWL_HLISTITEM hTemp;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t sz = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < sz - 1; i++) {
for (int32_t j = i + 1; j < sz; j++) {
@@ -338,7 +343,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, FX_BOOL bUp = dwKeyCode == FWL_VKEY_Up;
FX_BOOL bDown = dwKeyCode == FWL_VKEY_Down;
FX_BOOL bHome = dwKeyCode == FWL_VKEY_Home;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iDstItem = -1;
if (bUp || bDown) {
int32_t index = pData->GetItemIndex(m_pInterface, hItem);
@@ -359,7 +365,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, void CFWL_ListBoxImp::SetSelection(FWL_HLISTITEM hStart,
FWL_HLISTITEM hEnd,
FX_BOOL bSelected) {
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iStart = pData->GetItemIndex(m_pInterface, hStart);
int32_t iEnd = pData->GetItemIndex(m_pInterface, hEnd);
if (iStart > iEnd) {
@@ -380,21 +387,24 @@ void CFWL_ListBoxImp::SetSelection(FWL_HLISTITEM hStart, }
}
void CFWL_ListBoxImp::SetSelectionDirect(FWL_HLISTITEM hItem, FX_BOOL bSelect) {
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
FX_DWORD dwOldStyle = pData->GetItemStyles(m_pInterface, hItem);
bSelect ? dwOldStyle |= FWL_ITEMSTATE_LTB_Selected
: dwOldStyle &= ~FWL_ITEMSTATE_LTB_Selected;
pData->SetItemStyles(m_pInterface, hItem, dwOldStyle);
}
FX_BOOL CFWL_ListBoxImp::IsItemSelected(FWL_HLISTITEM hItem) {
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
FX_DWORD dwState = pData->GetItemStyles(m_pInterface, hItem);
return (dwState & FWL_ITEMSTATE_LTB_Selected) != 0;
}
void CFWL_ListBoxImp::ClearSelection() {
FX_BOOL bMulti =
m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
@@ -415,7 +425,8 @@ void CFWL_ListBoxImp::SelectAll() { if (!bMulti) {
return;
}
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
if (iCount > 0) {
FWL_HLISTITEM hItemStart = pData->GetItem(m_pInterface, 0);
@@ -424,7 +435,8 @@ void CFWL_ListBoxImp::SelectAll() { }
}
FWL_HLISTITEM CFWL_ListBoxImp::GetFocusedItem() {
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
@@ -437,7 +449,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetFocusedItem() { return NULL;
}
void CFWL_ListBoxImp::SetFocusItem(FWL_HLISTITEM hItem) {
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hFocus = GetFocusedItem();
if (hItem != hFocus) {
if (hFocus) {
@@ -462,7 +475,8 @@ FWL_HLISTITEM CFWL_ListBoxImp::GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy) { if (m_pVertScrollBar) {
fPosY = m_pVertScrollBar->GetPos();
}
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t nCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < nCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
@@ -485,7 +499,8 @@ FX_BOOL CFWL_ListBoxImp::GetItemCheckRect(FWL_HLISTITEM hItem, if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
return FALSE;
}
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
pData->GetItemCheckRect(m_pInterface, hItem, rtCheck);
return TRUE;
}
@@ -495,7 +510,8 @@ FX_BOOL CFWL_ListBoxImp::GetItemChecked(FWL_HLISTITEM hItem) { if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
return FALSE;
}
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
return (pData->GetItemCheckState(m_pInterface, hItem) &
FWL_ITEMSTATE_LTB_Checked);
}
@@ -505,7 +521,8 @@ FX_BOOL CFWL_ListBoxImp::SetItemChecked(FWL_HLISTITEM hItem, FX_BOOL bChecked) { if (!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_Check)) {
return FALSE;
}
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
pData->SetItemCheckState(m_pInterface, hItem,
bChecked ? FWL_ITEMSTATE_LTB_Checked : 0);
return TRUE;
@@ -514,7 +531,8 @@ FX_BOOL CFWL_ListBoxImp::ScrollToVisible(FWL_HLISTITEM hItem) { if (!m_pVertScrollBar)
return FALSE;
CFX_RectF rtItem;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
pData->GetItemRect(m_pInterface, hItem, rtItem);
FX_BOOL bScroll = FALSE;
FX_FLOAT fPosY = m_pVertScrollBar->GetPos();
@@ -576,7 +594,8 @@ void CFWL_ListBoxImp::DrawItems(CFX_Graphics* pGraphics, }
FX_BOOL bMultiCol =
m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiColumn;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
@@ -614,7 +633,8 @@ void CFWL_ListBoxImp::DrawItem(CFX_Graphics* pGraphics, int32_t Index,
const CFX_RectF& rtItem,
const CFX_Matrix* pMatrix) {
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
FX_DWORD dwItemStyles = pData->GetItemStyles(m_pInterface, hItem);
FX_DWORD dwPartStates = FWL_PARTSTATE_LTB_Normal;
if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) {
@@ -721,7 +741,7 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { rtUIMargin.Set(0, 0, 0, 0);
if (!m_pOuter) {
CFX_RectF* pUIMargin =
- (CFX_RectF*)GetThemeCapacity(FWL_WGTCAPACITY_UIMargin);
+ static_cast<CFX_RectF*>(GetThemeCapacity(FWL_WGTCAPACITY_UIMargin));
if (pUIMargin) {
m_rtConent.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width,
pUIMargin->height);
@@ -729,7 +749,8 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { }
FX_FLOAT fWidth = 0;
if (m_pProperties->m_pThemeProvider->IsCustomizedLayout(m_pInterface)) {
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
if (!bAutoSize) {
}
int32_t iCount = pData->CountItems(m_pInterface);
@@ -745,7 +766,8 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { if (!bAutoSize) {
CFX_RectF rtItem;
rtItem.Set(m_rtClient.left, m_rtClient.top + fs.y, r.width, r.height);
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
pData->SetItemRect(m_pInterface, hItem, rtItem);
}
fs.y += r.height;
@@ -764,7 +786,8 @@ CFX_SizeF CFWL_ListBoxImp::CalcSize(FX_BOOL bAutoSize) { fWidth = fActualWidth;
}
}
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
m_fItemHeight = GetItemHeigt();
FX_BOOL bHasIcon;
bHasIcon = GetStylesEx() & FWL_STYLEEXT_LTB_Icon;
@@ -886,7 +909,8 @@ void CFWL_ListBoxImp::GetItemSize(CFX_SizeF& size, if (!bAutoSize) {
CFX_RectF rtItem;
rtItem.Set(0, size.y, fWidth, m_fItemHeight);
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
pData->SetItemRect(m_pInterface, hItem, rtItem);
}
size.x = fWidth;
@@ -895,7 +919,8 @@ void CFWL_ListBoxImp::GetItemSize(CFX_SizeF& size, }
FX_FLOAT CFWL_ListBoxImp::GetMaxTextWidth() {
FX_FLOAT fRet = 0.0f;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
int32_t iCount = pData->CountItems(m_pInterface);
for (int32_t i = 0; i < iCount; i++) {
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, i);
@@ -913,13 +938,14 @@ FX_FLOAT CFWL_ListBoxImp::GetMaxTextWidth() { }
FX_FLOAT CFWL_ListBoxImp::GetScrollWidth() {
FX_FLOAT* pfWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
if (!pfWidth)
return 0;
return *pfWidth;
}
FX_FLOAT CFWL_ListBoxImp::GetItemHeigt() {
- FX_FLOAT* pfFont = (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_FontSize);
+ FX_FLOAT* pfFont =
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_FontSize));
if (!pfFont)
return 20;
return *pfFont + 2 * FWL_LISTBOX_ItemTextMargin;
@@ -978,7 +1004,7 @@ int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Mouse: {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
FX_DWORD dwCmd = pMsg->m_dwCmd;
switch (dwCmd) {
case FWL_MSGMOUSECMD_LButtonDown: {
@@ -994,15 +1020,13 @@ int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_MouseWheel: {
- OnMouseWheel((CFWL_MsgMouseWheel*)pMessage);
+ OnMouseWheel(static_cast<CFWL_MsgMouseWheel*>(pMessage));
break;
}
case FWL_MSGHASH_Key: {
- CFWL_MsgKey* pMsg = (CFWL_MsgKey*)pMessage;
- FX_DWORD dwCmd = pMsg->m_dwCmd;
- if (dwCmd == FWL_MSGKEYCMD_KeyDown) {
+ CFWL_MsgKey* pMsg = static_cast<CFWL_MsgKey*>(pMessage);
+ if (pMsg->m_dwCmd == FWL_MSGKEYCMD_KeyDown)
OnKeyDown(pMsg);
- }
break;
}
default: { iRet = 0; }
@@ -1017,13 +1041,13 @@ FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { return FWL_ERR_Succeeded;
}
IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget;
- if ((pSrcTarget == (IFWL_Widget*)m_pOwner->m_pVertScrollBar &&
+ if ((pSrcTarget == m_pOwner->m_pVertScrollBar &&
m_pOwner->m_pVertScrollBar) ||
- (pSrcTarget == (IFWL_Widget*)m_pOwner->m_pHorzScrollBar &&
+ (pSrcTarget == m_pOwner->m_pHorzScrollBar &&
m_pOwner->m_pHorzScrollBar)) {
- FX_DWORD dwScrollCode = ((CFWL_EvtScroll*)pEvent)->m_iScrollCode;
- FX_FLOAT fPos = ((CFWL_EvtScroll*)pEvent)->m_fPos;
- OnScroll((IFWL_ScrollBar*)pSrcTarget, dwScrollCode, fPos);
+ CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent);
+ OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget),
+ pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos);
}
return FWL_ERR_Succeeded;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp index 656c820c75..e7f773e4ca 100644 --- a/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_monthcalendarimp.cpp @@ -357,9 +357,8 @@ void CFWL_MonthCalendarImp::DrawWeek(CFX_Graphics* pGraphics, for (int32_t i = 0; i < 7; i++) {
rtDayOfWeek.Set(m_rtWeek.left + i * (m_szCell.x + MONTHCAL_HMARGIN * 2),
m_rtWeek.top, m_szCell.x, m_szCell.y);
- CFX_WideString* wsWeekDay = NULL;
- wsWeekDay =
- (CFX_WideString*)pTheme->GetCapacity(¶ms, i + FWL_MCCAPACITY_Sun);
+ CFX_WideString* wsWeekDay = static_cast<CFX_WideString*>(
+ pTheme->GetCapacity(¶ms, i + FWL_MCCAPACITY_Sun));
params.m_rtPart = rtDayOfWeek;
params.m_wsText = *wsWeekDay;
params.m_dwTTOStyles = FDE_TTOSTYLE_SingleLine;
@@ -424,8 +423,8 @@ void CFWL_MonthCalendarImp::DrawToday(CFX_Graphics* pGraphics, params.m_pGraphics = pGraphics;
params.m_dwStates = FWL_PARTSTATE_MCD_Normal;
params.m_iTTOAlign = FDE_TTOALIGNMENT_CenterLeft;
- CFX_WideString* wsDay = NULL;
- wsDay = (CFX_WideString*)pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today);
+ CFX_WideString* wsDay = static_cast<CFX_WideString*>(
+ pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today));
CFX_WideString wsText;
GetTodayText(m_iYear, m_iMonth, m_iDay, wsText);
params.m_wsText = *wsDay + wsText;
@@ -537,7 +536,7 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) { FX_FLOAT fMaxWeekH = 0.0f;
for (FX_DWORD week = FWL_MCCAPACITY_Sun; week <= FWL_MCCAPACITY_Sat;
week++) {
- wsText = (CFX_WideString*)pTheme->GetCapacity(¶ms, week);
+ wsText = static_cast<CFX_WideString*>(pTheme->GetCapacity(¶ms, week));
CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
fMaxWeekW = (fMaxWeekW >= sz.x) ? fMaxWeekW : sz.x;
fMaxWeekH = (fMaxWeekH >= sz.y) ? fMaxWeekH : sz.y;
@@ -561,7 +560,8 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) { FX_FLOAT fMonthMaxH = 0.0f;
for (FX_DWORD month = FWL_MCCAPACITY_January;
month <= FWL_MCCAPACITY_December; month++) {
- wsText = (CFX_WideString*)pTheme->GetCapacity(¶ms, month);
+ wsText =
+ static_cast<CFX_WideString*>(pTheme->GetCapacity(¶ms, month));
CFX_SizeF sz = CalcTextSize(*wsText, m_pProperties->m_pThemeProvider);
fMonthMaxW = (fMonthMaxW >= sz.x) ? fMonthMaxW : sz.x;
fMonthMaxH = (fMonthMaxH >= sz.y) ? fMonthMaxH : sz.y;
@@ -575,8 +575,8 @@ CFX_SizeF CFWL_MonthCalendarImp::CalcSize(FX_BOOL bAutoSize) { fs.x = (fs.x >= fMonthMaxW) ? fs.x : fMonthMaxW;
CFX_WideString wsToday;
GetTodayText(m_iYear, m_iMonth, m_iDay, wsToday);
- wsText =
- (CFX_WideString*)pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today);
+ wsText = static_cast<CFX_WideString*>(
+ pTheme->GetCapacity(¶ms, FWL_MCCAPACITY_Today));
m_wsToday = *wsText + wsToday;
m_szToday = CalcTextSize(wsToday, m_pProperties->m_pThemeProvider);
m_szToday.y = (m_szToday.y >= m_szCell.y) ? m_szToday.y : m_szCell.y;
@@ -671,57 +671,61 @@ void CFWL_MonthCalendarImp::GetCapValue() { IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
CFWL_ThemePart part;
part.m_pWidget = m_pInterface;
- m_fHeadWid =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_WIDTH);
- m_fHeadHei =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_Height);
- m_fHeadBtnWid = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH);
- m_fHeadBtnHei = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT);
- m_fHeadBtnHMargin = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN);
- m_fHeadBtnVMargin = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN);
- m_fHeadTextWid = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT);
- m_fHeadTextHei = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT);
- m_fHeadTextHMargin = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN);
- m_fHeadTextVMargin = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN);
- m_fHSepWid =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_WIDTH);
- m_fHSepHei =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_HEIGHT);
- m_fWeekNumWid =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH);
- m_fSepDOffset =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_DOFFSET);
- m_fSepX = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_X);
- m_fSepY = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_Y);
- m_fWeekNumHeigh =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT);
- m_fWeekWid =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_WIDTH);
- m_fWeekHei =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_HEIGHT);
- m_fDateCellWid = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH);
- m_fDateCellHei = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT);
- m_fTodayWid =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_WIDHT);
- m_fTodayHei =
- *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_HEIGHT);
- m_fTodayFlagWid = *(FX_FLOAT*)pTheme->GetCapacity(
- &part, FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT);
- m_fMCWid = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WIDTH);
+ m_fHeadWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_WIDTH));
+ m_fHeadHei = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_Height));
+ m_fHeadBtnWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_WIDTH));
+ m_fHeadBtnHei = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_HEIGHT));
+ m_fHeadBtnHMargin = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_HMARGIN));
+ m_fHeadBtnVMargin = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_BTN_VMARGIN));
+ m_fHeadTextWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXTWIDHT));
+ m_fHeadTextHei = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXTHEIGHT));
+ m_fHeadTextHMargin = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXT_HMARGIN));
+ m_fHeadTextVMargin = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEADER_TEXT_VMARGIN));
+ m_fHSepWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_WIDTH));
+ m_fHSepHei = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HSEP_HEIGHT));
+ m_fWeekNumWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_WIDTH));
+ m_fSepDOffset = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_DOFFSET));
+ m_fSepX = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_X));
+ m_fSepY = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_SEP_Y));
+ m_fWeekNumHeigh = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEKNUM_HEIGHT));
+ m_fWeekWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_WIDTH));
+ m_fWeekHei = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WEEK_HEIGHT));
+ m_fDateCellWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_DATES_CELL_WIDTH));
+ m_fDateCellHei = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_DATES_CELL_HEIGHT));
+ m_fTodayWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_WIDHT));
+ m_fTodayHei = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_HEIGHT));
+ m_fTodayFlagWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_TODAY_FLAG_WIDHT));
+ m_fMCWid = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_WIDTH));
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_MCD_WeekNumbers) {
m_fMCWid += m_fWeekNumWid;
}
- m_fMCHei = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEIGHT);
+ m_fMCHei = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_MC_HEIGHT));
}
int32_t CFWL_MonthCalendarImp::CalWeekNumber(int32_t iYear,
int32_t iMonth,
@@ -759,7 +763,7 @@ FX_BOOL CFWL_MonthCalendarImp::SetMaxDate(int32_t iYear, FX_BOOL CFWL_MonthCalendarImp::InitDate() {
if (m_pProperties->m_pDataProvider) {
IFWL_MonthCalendarDP* pDateProv =
- (IFWL_MonthCalendarDP*)(m_pProperties->m_pDataProvider);
+ static_cast<IFWL_MonthCalendarDP*>(m_pProperties->m_pDataProvider);
m_iYear = pDateProv->GetCurYear(m_pInterface);
m_iMonth = pDateProv->GetCurMonth(m_pInterface);
m_iDay = pDateProv->GetCurDay(m_pInterface);
@@ -774,10 +778,8 @@ FX_BOOL CFWL_MonthCalendarImp::InitDate() { }
GetTodayText(m_iYear, m_iMonth, m_iDay, m_wsToday);
GetHeadText(m_iCurYear, m_iCurMonth, m_wsHead);
- {
- m_dtMin = DATE(1500, 12, 1);
- m_dtMax = DATE(2200, 1, 1);
- }
+ m_dtMin = DATE(1500, 12, 1);
+ m_dtMax = DATE(2200, 1, 1);
return TRUE;
}
void CFWL_MonthCalendarImp::ClearDateItem() {
@@ -966,7 +968,7 @@ int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( break;
}
case FWL_MSGHASH_Mouse: {
- CFWL_MsgMouse* pMouse = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMouse = static_cast<CFWL_MsgMouse*>(pMessage);
FX_DWORD dwCmd = pMouse->m_dwCmd;
switch (dwCmd) {
case FWL_MSGMOUSECMD_LButtonDown: {
@@ -978,11 +980,11 @@ int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( break;
}
case FWL_MSGMOUSECMD_MouseMove: {
- OnMouseMove((CFWL_MsgMouse*)pMouse);
+ OnMouseMove(pMouse);
break;
}
case FWL_MSGMOUSECMD_MouseLeave: {
- OnMouseLeave((CFWL_MsgMouse*)pMouse);
+ OnMouseLeave(pMouse);
break;
}
default: { break; }
@@ -1056,8 +1058,7 @@ void CFWL_MonthCalendarImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { wmDateSelected.m_iEndDay = iCurSel;
wmDateSelected.m_iOldMonth = m_pOwner->m_iCurMonth;
wmDateSelected.m_iOldYear = m_pOwner->m_iCurYear;
- wmDateSelected.m_pSrcTarget =
- (IFWL_MonthCalendar*)m_pOwner->m_pInterface;
+ wmDateSelected.m_pSrcTarget = m_pOwner->m_pInterface;
m_pOwner->DispatchEvent(&wmDateSelected);
m_pOwner->Repaint(&rtInvalidate);
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp index 625080003b..c0b2f67e49 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pictureboximp.cpp @@ -66,8 +66,9 @@ FWL_ERR CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect.Set(0, 0, 0, 0);
if (!m_pProperties->m_pDataProvider)
return FWL_ERR_Indefinite;
- CFX_DIBitmap* pBitmap = ((IFWL_PictureBoxDP*)m_pProperties->m_pDataProvider)
- ->GetPicture(m_pInterface);
+ CFX_DIBitmap* pBitmap =
+ static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider)
+ ->GetPicture(m_pInterface);
if (pBitmap) {
rect.Set(0, 0, (FX_FLOAT)pBitmap->GetWidth(),
(FX_FLOAT)pBitmap->GetHeight());
@@ -107,16 +108,17 @@ FWL_ERR CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics, void CFWL_PictureBoxImp::DrawBkground(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix) {
- if (!m_pProperties->m_pDataProvider)
+ IFWL_PictureBoxDP* pPictureDP =
+ static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider);
+ if (!pPictureDP)
return;
- CFX_DIBitmap* pPicture = ((IFWL_PictureBoxDP*)m_pProperties->m_pDataProvider)
- ->GetPicture(m_pInterface);
+
+ CFX_DIBitmap* pPicture = pPictureDP->GetPicture(m_pInterface);
CFX_Matrix matrix;
- ((IFWL_PictureBoxDP*)m_pProperties->m_pDataProvider)
- ->GetMatrix(m_pInterface, matrix);
- if (!pPicture) {
+ pPictureDP->GetMatrix(m_pInterface, matrix);
+ if (!pPicture)
return;
- }
+
matrix.Concat(*pMatrix);
FX_FLOAT fx = (FX_FLOAT)pPicture->GetWidth();
FX_FLOAT fy = (FX_FLOAT)pPicture->GetHeight();
diff --git a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp index 3f730d9ee7..6df34d9d61 100644 --- a/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_pushbuttonimp.cpp @@ -67,7 +67,7 @@ FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { }
CFX_WideString wsCaption;
IFWL_PushButtonDP* pData =
- (IFWL_PushButtonDP*)m_pProperties->m_pDataProvider;
+ static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider);
if (pData) {
pData->GetCaption(m_pInterface, wsCaption);
}
@@ -77,7 +77,7 @@ FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect.Set(0, 0, sz.x, sz.y);
}
FX_FLOAT* fcaption =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_PSB_Margin);
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_PSB_Margin));
rect.Inflate(*fcaption, *fcaption);
CFWL_WidgetImp::GetWidgetRect(rect, TRUE);
} else {
@@ -102,7 +102,8 @@ FWL_ERR CFWL_PushButtonImp::Update() { UpdateTextOutStyles();
GetClientRect(m_rtClient);
m_rtCaption = m_rtClient;
- FX_FLOAT* fcaption = (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_PSB_Margin);
+ FX_FLOAT* fcaption =
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_PSB_Margin));
m_rtCaption.Inflate(-*fcaption, -*fcaption);
return FWL_ERR_Succeeded;
}
@@ -112,7 +113,8 @@ FWL_ERR CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, return FWL_ERR_Indefinite;
if (!m_pProperties->m_pThemeProvider)
return FWL_ERR_Indefinite;
- IFWL_PushButtonDP* pData = (IFWL_PushButtonDP*)m_pProperties->m_pDataProvider;
+ IFWL_PushButtonDP* pData =
+ static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider);
CFX_DIBitmap* pPicture = NULL;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (HasBorder()) {
@@ -415,7 +417,7 @@ int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Mouse: {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
FX_DWORD dwCmd = pMsg->m_dwCmd;
switch (dwCmd) {
case FWL_MSGMOUSECMD_LButtonDown: {
@@ -439,9 +441,9 @@ int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Key: {
- CFWL_MsgKey* pKey = (CFWL_MsgKey*)pMessage;
+ CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) {
- OnKeyDown((CFWL_MsgKey*)pKey);
+ OnKeyDown(pKey);
}
break;
}
@@ -489,7 +491,7 @@ void CFWL_PushButtonImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { }
if (m_pOwner->m_rtClient.Contains(pMsg->m_fx, pMsg->m_fy)) {
CFWL_EvtClick wmClick;
- wmClick.m_pSrcTarget = (IFWL_PushButton*)m_pOwner->m_pInterface;
+ wmClick.m_pSrcTarget = m_pOwner->m_pInterface;
m_pOwner->DispatchEvent(&wmClick);
}
m_pOwner->Repaint(&m_pOwner->m_rtClient);
@@ -542,7 +544,7 @@ void CFWL_PushButtonImpDelegate::OnKeyDown(CFWL_MsgKey* pMsg) { wmMouse.m_dwCmd = FWL_MSGMOUSECMD_LButtonUp;
m_pOwner->DispatchEvent(&wmMouse);
CFWL_EvtClick wmClick;
- wmClick.m_pSrcTarget = (IFWL_PushButton*)m_pOwner->m_pInterface;
+ wmClick.m_pSrcTarget = m_pOwner->m_pInterface;
m_pOwner->DispatchEvent(&wmClick);
return;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp index 9ae21d2a5e..db84a56a9f 100644 --- a/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_scrollbarimp.cpp @@ -148,8 +148,8 @@ FWL_ERR CFWL_ScrollBarImp::Finalize() { FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) {
if (bAutoSize) {
rect.Set(0, 0, 0, 0);
- FX_FLOAT* pfMinWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>(
+ GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
if (!pfMinWidth)
return FWL_ERR_Indefinite;
if (IsVertical()) {
@@ -320,7 +320,8 @@ void CFWL_ScrollBarImp::Layout() { IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
CFWL_ThemePart part;
part.m_pWidget = m_pInterface;
- m_fMinThumb = *(FX_FLOAT*)pTheme->GetCapacity(&part, FWL_CAPACITY_SCB_Size);
+ m_fMinThumb = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_CAPACITY_SCB_Size));
m_bCustomLayout = pTheme->IsCustomizedLayout(m_pInterface);
GetClientRect(m_rtClient);
CalcButtonLen();
@@ -659,7 +660,7 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { int32_t iRet = 1;
FX_DWORD dwMsgCode = pMessage->GetClassID();
if (dwMsgCode == FWL_MSGHASH_Mouse) {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
FX_DWORD dwCmd = pMsg->m_dwCmd;
switch (dwCmd) {
case FWL_MSGMOUSECMD_LButtonDown: {
@@ -681,7 +682,7 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: { iRet = 0; }
}
} else if (dwMsgCode == FWL_MSGHASH_MouseWheel) {
- CFWL_MsgMouseWheel* pMsg = (CFWL_MsgMouseWheel*)pMessage;
+ CFWL_MsgMouseWheel* pMsg = static_cast<CFWL_MsgMouseWheel*>(pMessage);
OnMouseWheel(pMsg->m_fx, pMsg->m_fy, pMsg->m_dwFlags, pMsg->m_fDeltaX,
pMsg->m_fDeltaY);
} else {
diff --git a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp index 6ce662508a..25bb6a14b6 100644 --- a/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_spinbuttonimp.cpp @@ -218,7 +218,7 @@ int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Mouse: {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
FX_DWORD dwCmd = pMsg->m_dwCmd;
switch (dwCmd) {
case FWL_MSGMOUSECMD_LButtonDown: {
@@ -242,9 +242,9 @@ int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Key: {
- CFWL_MsgKey* pKey = (CFWL_MsgKey*)pMessage;
+ CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyDown) {
- OnKeyDown((CFWL_MsgKey*)pKey);
+ OnKeyDown(pKey);
}
break;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp index ab9a163f15..3c470a872d 100644 --- a/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_tooltipctrlimp.cpp @@ -94,7 +94,8 @@ FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { m_pProperties->m_pThemeProvider = GetAvailableTheme();
}
CFX_WideString wsCaption;
- IFWL_ToolTipDP* pData = (IFWL_ToolTipDP*)m_pProperties->m_pDataProvider;
+ IFWL_ToolTipDP* pData =
+ static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
if (pData) {
pData->GetCaption(m_pInterface, wsCaption);
}
@@ -131,11 +132,10 @@ FWL_ERR CFWL_ToolTipImp::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;
+ x = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CXBorder));
+ y = *static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_CYBorder));
}
rect = m_pProperties->m_rtWidget;
rect.Offset(-rect.left, -rect.top);
@@ -214,7 +214,8 @@ FWL_ERR CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) { return TRUE;
}
FWL_ERR CFWL_ToolTipImp::Show() {
- IFWL_ToolTipDP* pData = (IFWL_ToolTipDP*)m_pProperties->m_pDataProvider;
+ IFWL_ToolTipDP* pData =
+ static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
int32_t nInitDelay = pData->GetInitialDelay(m_pInterface);
if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) {
m_hTimerShow = FWL_StartTimer(&m_TimerShow, nInitDelay, FALSE);
@@ -235,7 +236,8 @@ FWL_ERR CFWL_ToolTipImp::Hide() { }
FWL_ERR CFWL_ToolTipImp::SetStates(FX_DWORD dwStates, FX_BOOL bSet) {
if ((dwStates & FWL_WGTSTATE_Invisible) && !bSet) {
- IFWL_ToolTipDP* pData = (IFWL_ToolTipDP*)m_pProperties->m_pDataProvider;
+ IFWL_ToolTipDP* pData =
+ static_cast<IFWL_ToolTipDP*>(m_pProperties->m_pDataProvider);
int32_t nAutoPopDelay = pData->GetAutoPopDelay(m_pInterface);
m_hTimerHide = FWL_StartTimer(&m_TimerHide, nAutoPopDelay, FALSE);
}
diff --git a/xfa/src/fwl/src/basewidget/fxmath_barcodeimp.cpp b/xfa/src/fwl/src/basewidget/fxmath_barcodeimp.cpp index 45efbe9823..3687f8df86 100644 --- a/xfa/src/fwl/src/basewidget/fxmath_barcodeimp.cpp +++ b/xfa/src/fwl/src/basewidget/fxmath_barcodeimp.cpp @@ -78,7 +78,8 @@ FX_BOOL CFX_Barcode::CheckContentValidity(const CFX_WideStringC& contents) { case BC_EAN13:
case BC_UPCA:
return m_pBCEngine
- ? ((CBC_OneCode*)m_pBCEngine)->CheckContentValidity(contents)
+ ? static_cast<CBC_OneCode*>(m_pBCEngine)
+ ->CheckContentValidity(contents)
: TRUE;
default:
return TRUE;
@@ -94,10 +95,10 @@ FX_BOOL CFX_Barcode::SetPrintChecksum(FX_BOOL checksum) { case BC_EAN8:
case BC_EAN13:
case BC_UPCA:
- return m_pBCEngine
- ? (((CBC_OneCode*)m_pBCEngine)->SetPrintChecksum(checksum),
- TRUE)
- : FALSE;
+ return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine)
+ ->SetPrintChecksum(checksum),
+ TRUE)
+ : FALSE;
default:
return FALSE;
}
@@ -112,9 +113,10 @@ FX_BOOL CFX_Barcode::SetDataLength(int32_t length) { case BC_EAN8:
case BC_EAN13:
case BC_UPCA:
- return m_pBCEngine
- ? (((CBC_OneCode*)m_pBCEngine)->SetDataLength(length), TRUE)
- : FALSE;
+ return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine)
+ ->SetDataLength(length),
+ TRUE)
+ : FALSE;
default:
return FALSE;
}
@@ -129,9 +131,10 @@ FX_BOOL CFX_Barcode::SetCalChecksum(int32_t state) { case BC_EAN8:
case BC_EAN13:
case BC_UPCA:
- return m_pBCEngine
- ? (((CBC_OneCode*)m_pBCEngine)->SetCalChecksum(state), TRUE)
- : FALSE;
+ return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine)
+ ->SetCalChecksum(state),
+ TRUE)
+ : FALSE;
default:
return FALSE;
}
@@ -146,7 +149,9 @@ FX_BOOL CFX_Barcode::SetFont(CFX_Font* pFont) { case BC_EAN8:
case BC_EAN13:
case BC_UPCA:
- return m_pBCEngine ? ((CBC_OneCode*)m_pBCEngine)->SetFont(pFont) : FALSE;
+ return m_pBCEngine
+ ? static_cast<CBC_OneCode*>(m_pBCEngine)->SetFont(pFont)
+ : FALSE;
default:
return FALSE;
}
@@ -162,7 +167,8 @@ FX_BOOL CFX_Barcode::SetFontSize(FX_FLOAT size) { case BC_EAN13:
case BC_UPCA:
return m_pBCEngine
- ? (((CBC_OneCode*)m_pBCEngine)->SetFontSize(size), TRUE)
+ ? (static_cast<CBC_OneCode*>(m_pBCEngine)->SetFontSize(size),
+ TRUE)
: FALSE;
default:
return FALSE;
@@ -179,7 +185,8 @@ FX_BOOL CFX_Barcode::SetFontStyle(int32_t style) { case BC_EAN13:
case BC_UPCA:
return m_pBCEngine
- ? (((CBC_OneCode*)m_pBCEngine)->SetFontStyle(style), TRUE)
+ ? (static_cast<CBC_OneCode*>(m_pBCEngine)->SetFontStyle(style),
+ TRUE)
: FALSE;
default:
return FALSE;
@@ -196,7 +203,8 @@ FX_BOOL CFX_Barcode::SetFontColor(FX_ARGB color) { case BC_EAN13:
case BC_UPCA:
return m_pBCEngine
- ? (((CBC_OneCode*)m_pBCEngine)->SetFontColor(color), TRUE)
+ ? (static_cast<CBC_OneCode*>(m_pBCEngine)->SetFontColor(color),
+ TRUE)
: FALSE;
default:
return FALSE;
|