diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-12-04 16:21:15 -0800 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-12-04 16:21:15 -0800 |
commit | 59d09dfd276aa262d6fb95c4a78784fdc1824a26 (patch) | |
tree | 71f6a91795f8611fa5608521e49d5cf58bc9c012 /xfa/src/fwl | |
parent | 1965083545e7223237f2c0b5671983f537bbf201 (diff) | |
download | pdfium-59d09dfd276aa262d6fb95c4a78784fdc1824a26.tar.xz |
Remove C-Style casts in fwl_{barcode,caret,checkbox,combobox}imp.cpp
In the process, found two CFWL_ classes that didn't inherit
from the virtual inteface they were allegedly supporting.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1499853003 .
Diffstat (limited to 'xfa/src/fwl')
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp | 19 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_caretimp.cpp | 2 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp | 18 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp | 149 | ||||
-rw-r--r-- | xfa/src/fwl/src/basewidget/include/fwl_caretimp.h | 9 | ||||
-rw-r--r-- | xfa/src/fwl/src/core/include/fwl_noteimp.h | 35 |
6 files changed, 129 insertions, 103 deletions
diff --git a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp index 18b7b4c39f..e6d8d164b8 100644 --- a/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_barcodeimp.cpp @@ -102,7 +102,8 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() { return;
m_dwStatus = 0;
CreateBarcodeEngine();
- IFWL_BarcodeDP* pData = (IFWL_BarcodeDP*)m_pProperties->m_pDataProvider;
+ IFWL_BarcodeDP* pData =
+ static_cast<IFWL_BarcodeDP*>(m_pProperties->m_pDataProvider);
if (!pData)
return;
if (!m_pBarcodeEngine)
@@ -113,18 +114,20 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() { CFWL_ThemePart part;
part.m_pWidget = m_pInterface;
IFWL_ThemeProvider* pTheme = GetAvailableTheme();
- IFX_Font* pFont = (IFX_Font*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_Font);
- CFX_Font* pCXFont = (CFX_Font*)(pFont ? pFont->GetDevFont() : NULL);
+ IFX_Font* pFont =
+ static_cast<IFX_Font*>(pTheme->GetCapacity(&part, FWL_WGTCAPACITY_Font));
+ CFX_Font* pCXFont =
+ pFont ? static_cast<CFX_Font*>(pFont->GetDevFont()) : nullptr;
if (pCXFont) {
m_pBarcodeEngine->SetFont(pCXFont);
}
- FX_FLOAT* pFontSize =
- (FX_FLOAT*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_FontSize);
+ FX_FLOAT* pFontSize = static_cast<FX_FLOAT*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_FontSize));
if (pFontSize) {
m_pBarcodeEngine->SetFontSize(*pFontSize);
}
- FX_ARGB* pFontColor =
- (FX_ARGB*)pTheme->GetCapacity(&part, FWL_WGTCAPACITY_TextColor);
+ FX_ARGB* pFontColor = static_cast<FX_ARGB*>(
+ pTheme->GetCapacity(&part, FWL_WGTCAPACITY_TextColor));
if (pFontColor) {
m_pBarcodeEngine->SetFontColor(*pFontColor);
}
@@ -215,7 +218,7 @@ CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner) FWL_ERR CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
FX_DWORD dwFlag = pEvent->GetClassID();
if (dwFlag == FWL_EVTHASH_EDT_TextChanged) {
- CFWL_BarcodeImp* pOwner = (CFWL_BarcodeImp*)m_pOwner;
+ CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner);
pOwner->ReleaseBarcodeEngine();
pOwner->m_dwStatus = XFA_BCS_NeedUpdate;
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp index 87c0ce8c59..98bcbb59e2 100644 --- a/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_caretimp.cpp @@ -98,7 +98,7 @@ FWL_ERR CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) { m_hTimer = NULL;
}
if (bFlag) {
- m_hTimer = FWL_StartTimer((IFWL_Timer*)m_pTimer, m_dwElapse);
+ m_hTimer = FWL_StartTimer(m_pTimer, m_dwElapse);
}
return SetStates(FWL_WGTSTATE_Invisible, !bFlag);
}
diff --git a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp index 497cf7a6ab..4fe0c0a149 100644 --- a/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_checkboximp.cpp @@ -103,7 +103,8 @@ FWL_ERR CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { rect.Set(0, 0, sz.x, sz.y);
}
rect.Inflate(FWL_CKB_CaptionMargin, FWL_CKB_CaptionMargin);
- IFWL_CheckBoxDP* pData = (IFWL_CheckBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_CheckBoxDP* pData =
+ static_cast<IFWL_CheckBoxDP*>(m_pProperties->m_pDataProvider);
FX_FLOAT fCheckBox = pData->GetBoxSize(m_pInterface);
rect.width += fCheckBox;
if (rect.height < fCheckBox) {
@@ -229,7 +230,8 @@ void CFWL_CheckBoxImp::Layout() { FX_FLOAT fClientBottom = m_rtClient.bottom();
if (!m_pProperties->m_pDataProvider)
return;
- IFWL_CheckBoxDP* pData = (IFWL_CheckBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_CheckBoxDP* pData =
+ static_cast<IFWL_CheckBoxDP*>(m_pProperties->m_pDataProvider);
FX_FLOAT fCheckBox = pData->GetBoxSize(m_pInterface);
switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_VLayoutMask) {
case FWL_STYLEEXT_CKB_Top: {
@@ -374,15 +376,15 @@ void CFWL_CheckBoxImp::NextStates() { if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Unchecked) {
- IFWL_WidgetMgr* pWMgr = FWL_GetWidgetMgr();
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)pWMgr;
+ CFWL_WidgetMgr* pWidgetMgr =
+ static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr->IsFormDisabled()) {
CFX_PtrArray radioarr;
pWidgetMgr->GetSameGroupRadioButton(m_pInterface, radioarr);
IFWL_CheckBox* pCheckBox = NULL;
int32_t iCount = radioarr.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- pCheckBox = (IFWL_CheckBox*)radioarr[i];
+ pCheckBox = static_cast<IFWL_CheckBox*>(radioarr[i]);
if (pCheckBox != m_pInterface &&
pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
pCheckBox->SetCheckState(0);
@@ -440,7 +442,7 @@ int32_t CFWL_CheckBoxImpDelegate::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: {
@@ -464,9 +466,9 @@ int32_t CFWL_CheckBoxImpDelegate::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_comboboximp.cpp b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp index 9a0868dabc..c35ae75de6 100644 --- a/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp +++ b/xfa/src/fwl/src/basewidget/fwl_comboboximp.cpp @@ -157,7 +157,7 @@ int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Mouse: {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
if ((pMsg->m_dwCmd == FWL_MSGMOUSECMD_LButtonDown) &&
((m_pOwner->m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
m_pOwner->SetSelected();
@@ -222,13 +222,14 @@ int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { }
if (!m_pProperties->m_pDataProvider)
return -1;
- 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);
CFX_WideString wsText;
pData->GetItemText(m_pInterface, hItem, wsText);
- FX_STRSIZE pos = wsText.Find((const FX_WCHAR*)wsMatch);
+ FX_STRSIZE pos = wsText.Find(wsMatch.c_str());
if (!pos) {
return i;
}
@@ -238,7 +239,8 @@ int32_t CFWL_ComboListImp::MatchItem(const CFX_WideString& wsMatch) { void CFWL_ComboListImp::ChangeSelected(int32_t iSel) {
if (!m_pProperties->m_pDataProvider)
return;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel);
CFX_RectF rtInvalidate;
rtInvalidate.Reset();
@@ -262,13 +264,13 @@ void CFWL_ComboListImp::ChangeSelected(int32_t iSel) { }
}
int32_t CFWL_ComboListImp::CountItems() {
- if (!m_pProperties->m_pDataProvider)
- return 0;
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
- return pData->CountItems(m_pInterface);
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
+ return pData ? pData->CountItems(m_pInterface) : 0;
}
void CFWL_ComboListImp::GetItemRect(int32_t nIndex, CFX_RectF& rtItem) {
- IFWL_ListBoxDP* pData = (IFWL_ListBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, nIndex);
pData->GetItemRect(m_pInterface, hItem, rtItem);
}
@@ -294,7 +296,7 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { dwHashCode == FWL_MSGHASH_KillFocus) {
OnDropListFocusChanged(pMessage, dwHashCode == FWL_MSGHASH_SetFocus);
} else if (dwHashCode == FWL_MSGHASH_Mouse) {
- CFWL_MsgMouse* pMsg = (CFWL_MsgMouse*)pMessage;
+ CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage);
if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
CFX_RectF rect;
m_pOwner->m_pVertScrollBar->GetWidgetRect(rect);
@@ -326,8 +328,7 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: {}
}
} else if (dwHashCode == FWL_MSGHASH_Key) {
- CFWL_MsgKey* pMsg = (CFWL_MsgKey*)pMessage;
- backDefault = !OnDropListKey(pMsg);
+ backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage));
}
if (!backDefault) {
return 1;
@@ -337,11 +338,11 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg,
FX_BOOL bSet) {
if (!bSet) {
- CFWL_MsgKillFocus* pKill = (CFWL_MsgKillFocus*)pMsg;
+ CFWL_MsgKillFocus* pKill = static_cast<CFWL_MsgKillFocus*>(pMsg);
CFWL_ComboBoxImp* pOuter =
static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- if (pKill->m_pSetFocus == (IFWL_Widget*)m_pOwner->m_pOuter ||
- (IFWL_Widget*)pKill->m_pSetFocus == (IFWL_Widget*)pOuter->m_pEdit) {
+ if (pKill->m_pSetFocus == m_pOwner->m_pOuter ||
+ pKill->m_pSetFocus == pOuter->m_pEdit) {
pOuter->ShowDropList(FALSE);
}
}
@@ -362,8 +363,8 @@ int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) { if (hItem) {
if (!m_pOwner->m_pProperties->m_pDataProvider)
return 0;
- IFWL_ListBoxDP* pData =
- (IFWL_ListBoxDP*)m_pOwner->m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
+ m_pOwner->m_pProperties->m_pDataProvider);
int32_t iSel = pData->GetItemIndex(m_pOwner->m_pInterface, hItem);
CFWL_EvtCmbHoverChanged event;
event.m_pSrcTarget = m_pOwner->m_pOuter;
@@ -435,7 +436,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) { bPropagate = TRUE;
}
if (bPropagate) {
- pKey->m_pDstTarget = (IFWL_Widget*)m_pOwner->m_pOuter;
+ pKey->m_pDstTarget = m_pOwner->m_pOuter;
pOuter->m_pDelegate->OnProcessMessage(pKey);
return 1;
}
@@ -450,8 +451,8 @@ void CFWL_ComboListImpDelegate::OnDropListKeyDown(CFWL_MsgKey* pKey) { case FWL_VKEY_End: {
CFWL_ComboBoxImp* pOuter =
static_cast<CFWL_ComboBoxImp*>(m_pOwner->m_pOuter->GetImpl());
- IFWL_ListBoxDP* pData =
- (IFWL_ListBoxDP*)m_pOwner->m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
+ m_pOwner->m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem =
pData->GetItem(m_pOwner->m_pInterface, pOuter->m_iCurSel);
hItem = m_pOwner->GetItem(hItem, dwKeyCode);
@@ -570,8 +571,8 @@ FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (!m_pProperties->m_pThemeProvider) {
ReSetTheme();
}
- FX_FLOAT* pFWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
+ GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
if (!pFWidth)
return FWL_ERR_Indefinite;
rect.Inflate(0, 0, *pFWidth, 0);
@@ -620,8 +621,8 @@ FWL_ERR CFWL_ComboBoxImp::Update() { CFWL_ThemePart part;
part.m_pWidget = m_pInterface;
m_fComboFormHandler =
- *(FX_FLOAT*)m_pProperties->m_pThemeProvider->GetCapacity(
- &part, FWL_WGTCAPACITY_CMB_ComboFormHandler);
+ *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity(
+ &part, FWL_WGTCAPACITY_CMB_ComboFormHandler));
return FWL_ERR_Succeeded;
}
FX_DWORD CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) {
@@ -659,9 +660,9 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, }
param.m_rtPart = rtTextBk;
if (m_iCurSel >= 0) {
- IFWL_ListBoxDP* pData =
- (IFWL_ListBoxDP*)static_cast<CFWL_ComboListImp*>(
- m_pListBox->GetImpl())->m_pProperties->m_pDataProvider;
+ IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
+ static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
+ ->m_pProperties->m_pDataProvider);
void* p =
pData->GetItemData(m_pListBox, pData->GetItem(m_pListBox, m_iCurSel));
if (p != NULL) {
@@ -681,7 +682,8 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, if (!m_pListBox)
return FWL_ERR_Indefinite;
CFX_WideString wsText;
- IFWL_ComboBoxDP* pData = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pData =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel);
static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
->GetItemText(hItem, wsText);
@@ -740,7 +742,8 @@ FWL_ERR CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { m_pEdit->SetText(CFX_WideString());
} else {
CFX_WideString wsText;
- IFWL_ComboBoxDP* pData = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pData =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iSel);
static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
->GetItemText(hItem, wsText);
@@ -778,7 +781,8 @@ FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, if (m_pEdit) {
return m_pEdit->GetText(wsText, nStart, nCount);
} else if (m_pListBox) {
- IFWL_ComboBoxDP* pData = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pData =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel);
return m_pListBox->GetItemText(hItem, wsText);
}
@@ -905,7 +909,7 @@ FWL_ERR CFWL_ComboBoxImp::EditModifyStylesEx(FX_DWORD dwStylesExAdded, }
}
FX_FLOAT CFWL_ComboBoxImp::GetListHeight() {
- return ((IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider)
+ return static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider)
->GetListHeight(m_pInterface);
}
void CFWL_ComboBoxImp::DrawStretchHandler(CFX_Graphics* pGraphics,
@@ -1020,7 +1024,8 @@ void CFWL_ComboBoxImp::MatchEditText() { }
void CFWL_ComboBoxImp::SynchrEditText(int32_t iListItem) {
CFX_WideString wsText;
- IFWL_ComboBoxDP* pData = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pData =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, iListItem);
static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
->GetItemText(hItem, wsText);
@@ -1034,7 +1039,7 @@ void CFWL_ComboBoxImp::Layout() { }
GetClientRect(m_rtClient);
FX_FLOAT* pFWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
if (!pFWidth)
return;
FX_FLOAT fBtn = *pFWidth;
@@ -1048,7 +1053,8 @@ void CFWL_ComboBoxImp::Layout() { m_pEdit->SetWidgetRect(rtEdit);
if (m_iCurSel >= 0) {
CFX_WideString wsText;
- IFWL_ComboBoxDP* pData = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pData =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel);
static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
->GetItemText(hItem, wsText);
@@ -1130,11 +1136,13 @@ void CFWL_ComboBoxImp::ReSetListItemAlignment() { m_pListBox->ModifyStylesEx(dwAdd, FWL_STYLEEXT_CMB_ListItemAlignMask);
}
void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) {
- IFWL_ComboBoxDP* pDatas = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pDatas =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
m_iCurSel = pDatas->GetItemIndex(m_pInterface, m_pListBox->GetSelItem(0));
FX_BOOL bDropDown = IsDropDownStyle();
if (bDropDown) {
- IFWL_ComboBoxDP* pData = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pData =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel);
if (hItem) {
CFX_WideString wsText;
@@ -1168,7 +1176,7 @@ void CFWL_ComboBoxImp::InitProxyForm() { m_pProxy->SetInterface(m_pForm);
m_pForm->SetImpl(m_pProxy);
m_pProxy->Initialize();
- m_pListBox->SetParent((IFWL_Widget*)m_pForm);
+ m_pListBox->SetParent(m_pForm);
m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this);
m_pProxy->SetDelegate(m_pListProxyDelegate);
}
@@ -1185,7 +1193,7 @@ void CFWL_ComboBoxImp::DisForm_InitComboList() { return;
}
CFWL_WidgetImpProperties prop;
- prop.m_pParent = (IFWL_Widget*)this->m_pInterface;
+ prop.m_pParent = m_pInterface;
prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
prop.m_dwStates = FWL_WGTSTATE_Invisible;
prop.m_pDataProvider = m_pProperties->m_pDataProvider;
@@ -1201,7 +1209,7 @@ void CFWL_ComboBoxImp::DisForm_InitComboEdit() { return;
}
CFWL_WidgetImpProperties prop;
- prop.m_pParent = (IFWL_Widget*)this->m_pInterface;
+ prop.m_pParent = m_pInterface;
prop.m_pThemeProvider = m_pProperties->m_pThemeProvider;
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) == 0) {
}
@@ -1319,7 +1327,7 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, pGraphics->ConcatMatrix(&mtOrg);
if (!m_rtBtn.IsEmpty(0.1f)) {
CFWL_ThemeBackground param;
- param.m_pWidget = (IFWL_Widget*)this->m_pInterface;
+ param.m_pWidget = m_pInterface;
param.m_iPart = FWL_PART_CMB_DropDownButton;
param.m_dwStates = m_iBtnState;
param.m_pGraphics = pGraphics;
@@ -1359,7 +1367,7 @@ void CFWL_ComboBoxImp::DisForm_Layout() { GetClientRect(m_rtClient);
m_rtContent = m_rtClient;
FX_FLOAT* pFWidth =
- (FX_FLOAT*)GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth);
+ static_cast<FX_FLOAT*>(GetThemeCapacity(FWL_WGTCAPACITY_ScrollBarWidth));
if (!pFWidth)
return;
FX_FLOAT borderWidth = 0;
@@ -1369,7 +1377,8 @@ void CFWL_ComboBoxImp::DisForm_Layout() { m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top + borderWidth,
fBtn - borderWidth, m_rtClient.height - 2 * borderWidth);
}
- CFX_RectF* pUIMargin = (CFX_RectF*)GetThemeCapacity(FWL_WGTCAPACITY_UIMargin);
+ CFX_RectF* pUIMargin =
+ static_cast<CFX_RectF*>(GetThemeCapacity(FWL_WGTCAPACITY_UIMargin));
if (pUIMargin) {
m_rtContent.Deflate(pUIMargin->left, pUIMargin->top, pUIMargin->width,
pUIMargin->height);
@@ -1382,7 +1391,8 @@ void CFWL_ComboBoxImp::DisForm_Layout() { m_pEdit->SetWidgetRect(rtEdit);
if (m_iCurSel >= 0) {
CFX_WideString wsText;
- IFWL_ComboBoxDP* pData = (IFWL_ComboBoxDP*)m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pData =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel);
static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())
->GetItemText(hItem, wsText);
@@ -1410,7 +1420,7 @@ int32_t CFWL_ComboBoxImpDelegate::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: {
@@ -1434,7 +1444,7 @@ int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break;
}
case FWL_MSGHASH_Key: {
- OnKey((CFWL_MsgKey*)pMessage);
+ OnKey(static_cast<CFWL_MsgKey*>(pMessage));
break;
}
default: { iRet = 0; }
@@ -1445,26 +1455,29 @@ int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {
FX_DWORD dwFlag = pEvent->GetClassID();
if (dwFlag == FWL_EVTHASH_LTB_DrawItem) {
+ CFWL_EvtLtbDrawItem* pDrawItemEvent =
+ static_cast<CFWL_EvtLtbDrawItem*>(pEvent);
CFWL_EvtCmbDrawItem pTemp;
pTemp.m_pSrcTarget = m_pOwner->m_pInterface;
- pTemp.m_pGraphics = ((CFWL_EvtLtbDrawItem*)pEvent)->m_pGraphics;
- pTemp.m_index = ((CFWL_EvtLtbDrawItem*)pEvent)->m_index;
- pTemp.m_rtItem = ((CFWL_EvtLtbDrawItem*)pEvent)->m_rect;
+ pTemp.m_pGraphics = pDrawItemEvent->m_pGraphics;
+ pTemp.m_index = pDrawItemEvent->m_index;
+ pTemp.m_rtItem = pDrawItemEvent->m_rect;
m_pOwner->DispatchEvent(&pTemp);
} else if (dwFlag == FWL_EVTHASH_Scroll) {
- FX_DWORD dwScrollCode = ((CFWL_EvtScroll*)pEvent)->m_iScrollCode;
- FX_FLOAT fPos = ((CFWL_EvtScroll*)pEvent)->m_fPos;
+ CFWL_EvtScroll* pScrollEvent = static_cast<CFWL_EvtScroll*>(pEvent);
CFWL_EvtScroll pScrollEv;
pScrollEv.m_pSrcTarget = m_pOwner->m_pInterface;
- pScrollEv.m_iScrollCode = dwScrollCode;
- pScrollEv.m_fPos = fPos;
+ pScrollEv.m_iScrollCode = pScrollEvent->m_iScrollCode;
+ pScrollEv.m_fPos = pScrollEvent->m_fPos;
m_pOwner->DispatchEvent(&pScrollEv);
} else if (dwFlag == FWL_EVTHASH_EDT_TextChanged) {
+ CFWL_EvtEdtTextChanged* pTextChangedEvent =
+ static_cast<CFWL_EvtEdtTextChanged*>(pEvent);
CFWL_EvtCmbEditChanged pTemp;
pTemp.m_pSrcTarget = m_pOwner->m_pInterface;
- pTemp.wsInsert = ((CFWL_EvtEdtTextChanged*)pEvent)->wsInsert;
- pTemp.wsDelete = ((CFWL_EvtEdtTextChanged*)pEvent)->wsDelete;
- pTemp.nChangeType = ((CFWL_EvtEdtTextChanged*)pEvent)->nChangeType;
+ pTemp.wsInsert = pTextChangedEvent->wsInsert;
+ pTemp.wsDelete = pTextChangedEvent->wsDelete;
+ pTemp.nChangeType = pTextChangedEvent->nChangeType;
m_pOwner->DispatchEvent(&pTemp);
}
return FWL_ERR_Succeeded;
@@ -1480,7 +1493,7 @@ void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bDropDown = m_pOwner->IsDropDownStyle();
if (bSet) {
m_pOwner->m_pProperties->m_dwStates |= FWL_WGTSTATE_Focused;
- if (bDropDown && pSrcTarget != (IFWL_Widget*)m_pOwner->m_pListBox) {
+ if (bDropDown && pSrcTarget != m_pOwner->m_pListBox) {
if (!m_pOwner->m_pEdit)
return;
static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
@@ -1490,7 +1503,7 @@ void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, }
} else {
m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Focused;
- if (bDropDown && pDstTarget != (IFWL_Widget*)m_pOwner->m_pListBox) {
+ if (bDropDown && pDstTarget != m_pOwner->m_pListBox) {
if (!m_pOwner->m_pEdit)
return;
static_cast<CFWL_ComboEditImp*>(m_pOwner->m_pEdit->GetImpl())
@@ -1584,8 +1597,8 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { ->MatchItem(wsText);
if (iCurSel >= 0) {
CFX_WideString wsTemp;
- IFWL_ComboBoxDP* pData =
- (IFWL_ComboBoxDP*)m_pOwner->m_pProperties->m_pDataProvider;
+ IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(
+ m_pOwner->m_pProperties->m_pDataProvider);
FWL_HLISTITEM hItem = pData->GetItem(m_pOwner->m_pInterface, iCurSel);
static_cast<CFWL_ComboListImp*>(m_pOwner->m_pListBox->GetImpl())
->GetItemText(hItem, wsTemp);
@@ -1633,7 +1646,7 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( }
case FWL_MSGHASH_Mouse: {
backDefault = FALSE;
- 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: {
@@ -1650,7 +1663,7 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( }
case FWL_MSGHASH_Key: {
backDefault = FALSE;
- CFWL_MsgKey* pKey = (CFWL_MsgKey*)pMessage;
+ CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
if (pKey->m_dwCmd == FWL_MSGKEYCMD_KeyUp) {
break;
}
@@ -1667,7 +1680,7 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( break;
}
}
- DisForm_OnKey((CFWL_MsgKey*)pMessage);
+ DisForm_OnKey(pKey);
break;
}
default: {}
@@ -1774,7 +1787,7 @@ int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { return 0;
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: {
@@ -1793,10 +1806,10 @@ int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { }
}
if (dwMsgCode == FWL_MSGHASH_Deactivate) {
- OnDeactive((CFWL_MsgDeactivate*)pMessage);
+ OnDeactive(static_cast<CFWL_MsgDeactivate*>(pMessage));
}
if (dwMsgCode == FWL_MSGHASH_KillFocus || dwMsgCode == FWL_MSGHASH_SetFocus) {
- OnFocusChanged((CFWL_MsgKillFocus*)pMessage,
+ OnFocusChanged(static_cast<CFWL_MsgKillFocus*>(pMessage),
dwMsgCode == FWL_MSGHASH_SetFocus);
}
return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage);
@@ -1810,7 +1823,8 @@ void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { IFWL_NoteThread* pThread = m_pForm->GetOwnerThread();
if (!pThread)
return;
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
CFX_RectF rtWidget;
m_pForm->GetWidgetRect(rtWidget);
rtWidget.left = rtWidget.top = 0;
@@ -1836,7 +1850,8 @@ void CFWL_ComboProxyImpDelegate::OnLButtonUp(CFWL_MsgMouse* pMsg) { IFWL_NoteThread* pThread = m_pForm->GetOwnerThread();
if (!pThread)
return;
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
+ CFWL_NoteDriver* pDriver =
+ static_cast<CFWL_NoteDriver*>(pThread->GetNoteDriver());
pDriver->SetGrab(m_pForm, FALSE);
if (m_bLButtonUpSelf) {
CFX_RectF rect;
diff --git a/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h b/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h index 5b7d0642ef..b8e47b6b5a 100644 --- a/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h +++ b/xfa/src/fwl/src/basewidget/include/fwl_caretimp.h @@ -6,6 +6,9 @@ #ifndef _FWL_CARET_IMP_H
#define _FWL_CARET_IMP_H
+
+#include "xfa/include/fwl/core/fwl_timer.h"
+
class CFWL_WidgetImp;
class CFWL_WidgetImpProperties;
class CFWL_WidgetImpDelegate;
@@ -37,11 +40,11 @@ class CFWL_CaretImp : public CFWL_WidgetImp { FX_BOOL DrawCaretBK(CFX_Graphics* pGraphics,
IFWL_ThemeProvider* pTheme,
const CFX_Matrix* pMatrix);
- class CFWL_CaretTimer {
+ class CFWL_CaretTimer : public IFWL_Timer {
public:
CFWL_CaretTimer(CFWL_CaretImp* m_pCaret);
- virtual ~CFWL_CaretTimer() {}
- virtual int32_t Run(FWL_HTIMER hTimer);
+ ~CFWL_CaretTimer() override {}
+ int32_t Run(FWL_HTIMER hTimer) override;
CFWL_CaretImp* m_pCaret;
};
CFWL_CaretTimer* m_pTimer;
diff --git a/xfa/src/fwl/src/core/include/fwl_noteimp.h b/xfa/src/fwl/src/core/include/fwl_noteimp.h index bd1f2da7ea..413b0fd034 100644 --- a/xfa/src/fwl/src/core/include/fwl_noteimp.h +++ b/xfa/src/fwl/src/core/include/fwl_noteimp.h @@ -35,24 +35,27 @@ class CFWL_NoteLoop { CFWL_WidgetImp* m_pForm;
FX_BOOL m_bContinueModal;
};
-class CFWL_NoteDriver {
+class CFWL_NoteDriver : public IFWL_NoteDriver {
public:
CFWL_NoteDriver();
- virtual ~CFWL_NoteDriver();
- virtual FX_BOOL SendNote(CFWL_Note* pNote);
- virtual FX_BOOL PostMessage(CFWL_Message* pMessage);
- virtual FWL_ERR RegisterEventTarget(IFWL_Widget* pListener,
- IFWL_Widget* pEventSource = NULL,
- FX_DWORD dwFilter = FWL_EVENT_ALL_MASK);
- virtual FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener);
- virtual void ClearEventTargets(FX_BOOL bRemoveAll);
- virtual int32_t GetQueueMaxSize() const;
- virtual FWL_ERR SetQueueMaxSize(const int32_t size);
- virtual IFWL_NoteThread* GetOwnerThread() const;
- virtual FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop);
- virtual IFWL_NoteLoop* PopNoteLoop();
- virtual FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE);
- virtual FWL_ERR Run();
+ ~CFWL_NoteDriver() override;
+
+ // IFWL_NoteDriver:
+ FX_BOOL SendNote(CFWL_Note* pNote) override;
+ FX_BOOL PostMessage(CFWL_Message* pMessage) override;
+ FWL_ERR RegisterEventTarget(IFWL_Widget* pListener,
+ IFWL_Widget* pEventSource = NULL,
+ FX_DWORD dwFilter = FWL_EVENT_ALL_MASK) override;
+ FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener) override;
+ void ClearEventTargets(FX_BOOL bRemoveAll) override;
+ int32_t GetQueueMaxSize() const override;
+ FWL_ERR SetQueueMaxSize(const int32_t size) override;
+ IFWL_NoteThread* GetOwnerThread() const override;
+ FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop) override;
+ IFWL_NoteLoop* PopNoteLoop() override;
+ FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE) override;
+ FWL_ERR Run() override;
+
IFWL_Widget* GetFocus();
IFWL_Widget* GetHover();
void SetHover(IFWL_Widget* pHover);
|