summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-10 15:53:30 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-10 15:53:30 -0800
commitd75b8537a1286af979b0d0fb19988a29af7c4a33 (patch)
tree4531fc400e8cc5841558b0869cbc25a91cd8a0fe
parentd2cfdd5c72be670aff556c44aaff53df66b23ea6 (diff)
downloadpdfium-d75b8537a1286af979b0d0fb19988a29af7c4a33.tar.xz
Convert last batch of casts in fwl.
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1512423003 .
-rw-r--r--xfa/include/fwl/core/fwl_note.h2
-rw-r--r--xfa/include/fwl/lightwidget/barcode.h2
-rw-r--r--xfa/src/fwl/src/core/fwl_noteimp.cpp2
-rw-r--r--xfa/src/fwl/src/core/include/fwl_noteimp.h4
-rw-r--r--xfa/src/fwl/src/lightwidget/picturebox.cpp8
-rw-r--r--xfa/src/fwl/src/lightwidget/scrollbar.cpp24
-rw-r--r--xfa/src/fwl/src/lightwidget/theme.cpp23
-rw-r--r--xfa/src/fwl/src/lightwidget/tooltipctrl.cpp6
-rw-r--r--xfa/src/fwl/src/lightwidget/widget.cpp16
-rw-r--r--xfa/src/fwl/src/theme/widgettp.cpp11
10 files changed, 46 insertions, 52 deletions
diff --git a/xfa/include/fwl/core/fwl_note.h b/xfa/include/fwl/core/fwl_note.h
index a838d8047f..bd230d28cc 100644
--- a/xfa/include/fwl/core/fwl_note.h
+++ b/xfa/include/fwl/core/fwl_note.h
@@ -340,7 +340,9 @@ class IFWL_NoteDriver {
virtual IFWL_NoteThread* GetOwnerThread() const = 0;
virtual FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop) = 0;
virtual IFWL_NoteLoop* PopNoteLoop() = 0;
+ virtual IFWL_Widget* GetFocus() = 0;
virtual FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE) = 0;
+ virtual void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) = 0;
virtual FWL_ERR Run() = 0;
};
IFWL_Widget* FWL_GetCurrentThreadModalWidget(IFWL_NoteThread* pNoteThread);
diff --git a/xfa/include/fwl/lightwidget/barcode.h b/xfa/include/fwl/lightwidget/barcode.h
index 447a403f2e..40c767dff8 100644
--- a/xfa/include/fwl/lightwidget/barcode.h
+++ b/xfa/include/fwl/lightwidget/barcode.h
@@ -35,7 +35,7 @@ class CFWL_Barcode : public CFWL_Edit {
void SetDataLength(int32_t dataLength) {
m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_DATALENGTH;
m_barcodeData.m_nDataLength = dataLength;
- ((IFWL_Barcode*)m_pIface)->SetLimit(dataLength);
+ static_cast<IFWL_Barcode*>(m_pIface)->SetLimit(dataLength);
}
void SetCalChecksum(int32_t calChecksum) {
m_barcodeData.m_dwAttributeMask |= FWL_BCDATTRIBUTE_CALCHECKSUM;
diff --git a/xfa/src/fwl/src/core/fwl_noteimp.cpp b/xfa/src/fwl/src/core/fwl_noteimp.cpp
index 68f7cdaf91..e4d68c72d8 100644
--- a/xfa/src/fwl/src/core/fwl_noteimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_noteimp.cpp
@@ -692,7 +692,7 @@ FX_BOOL CFWL_NoteDriver::DoDragFiles(CFWL_MsgDropFiles* pMsg,
}
FX_BOOL CFWL_NoteDriver::DoMouseEx(CFWL_MsgMouse* pMsg,
IFWL_Widget* pMessageForm) {
- CFWL_WidgetMgr* pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
if (!pWidgetMgr)
return FALSE;
IFWL_Widget* pTarget = NULL;
diff --git a/xfa/src/fwl/src/core/include/fwl_noteimp.h b/xfa/src/fwl/src/core/include/fwl_noteimp.h
index 63f8f998c5..42fdaddeb0 100644
--- a/xfa/src/fwl/src/core/include/fwl_noteimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_noteimp.h
@@ -57,13 +57,13 @@ class CFWL_NoteDriver : public IFWL_NoteDriver {
IFWL_NoteThread* GetOwnerThread() const override;
FWL_ERR PushNoteLoop(IFWL_NoteLoop* pNoteLoop) override;
IFWL_NoteLoop* PopNoteLoop() override;
+ IFWL_Widget* GetFocus() override;
FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE) override;
+ void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet) override;
FWL_ERR Run() override;
- IFWL_Widget* GetFocus();
IFWL_Widget* GetHover();
void SetHover(IFWL_Widget* pHover);
- void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet);
void NotifyTargetHide(IFWL_Widget* pNoteTarget);
void NotifyTargetDestroy(IFWL_Widget* pNoteTarget);
void NotifyFullScreenMode(IFWL_Widget* pNoteTarget, FX_BOOL bFullScreen);
diff --git a/xfa/src/fwl/src/lightwidget/picturebox.cpp b/xfa/src/fwl/src/lightwidget/picturebox.cpp
index 265baa1b11..6979966e38 100644
--- a/xfa/src/fwl/src/lightwidget/picturebox.cpp
+++ b/xfa/src/fwl/src/lightwidget/picturebox.cpp
@@ -39,14 +39,14 @@ FWL_ERR CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) {
return FWL_ERR_Succeeded;
}
int32_t CFWL_PictureBox::GetFlipMode() {
- return m_PictureBoxDP.GetFlipMode((IFWL_Widget*)this);
+ return m_PictureBoxDP.GetFlipMode(m_pIface);
}
FWL_ERR CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) {
m_PictureBoxDP.m_iFlipMode = iFlipMode;
return FWL_ERR_Succeeded;
}
int32_t CFWL_PictureBox::GetOpacity() {
- return m_PictureBoxDP.GetOpacity((IFWL_Widget*)this);
+ return m_PictureBoxDP.GetOpacity(m_pIface);
}
FWL_ERR CFWL_PictureBox::SetOpacity(int32_t iOpacity) {
m_PictureBoxDP.m_iOpacity = iOpacity;
@@ -54,7 +54,7 @@ FWL_ERR CFWL_PictureBox::SetOpacity(int32_t iOpacity) {
}
FWL_ERR CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) {
CFX_Matrix matrix;
- m_PictureBoxDP.GetMatrix((IFWL_Widget*)this, matrix);
+ m_PictureBoxDP.GetMatrix(m_pIface, matrix);
matrix.Scale(fScaleX, fScaleY);
return FWL_ERR_Succeeded;
}
@@ -65,7 +65,7 @@ FWL_ERR CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) {
}
FWL_ERR CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) {
CFX_Matrix matrix;
- m_PictureBoxDP.GetMatrix((IFWL_Widget*)this, matrix);
+ m_PictureBoxDP.GetMatrix(m_pIface, matrix);
fx = matrix.e;
fy = matrix.f;
return FWL_ERR_Succeeded;
diff --git a/xfa/src/fwl/src/lightwidget/scrollbar.cpp b/xfa/src/fwl/src/lightwidget/scrollbar.cpp
index a7a177d0ab..2b9fc8be1c 100644
--- a/xfa/src/fwl/src/lightwidget/scrollbar.cpp
+++ b/xfa/src/fwl/src/lightwidget/scrollbar.cpp
@@ -27,62 +27,62 @@ FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) {
FX_BOOL CFWL_ScrollBar::IsVertical() {
if (!m_pIface)
return FALSE;
- return ((IFWL_ScrollBar*)m_pIface)->IsVertical();
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->IsVertical();
}
FWL_ERR CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ScrollBar*)m_pIface)->GetRange(fMin, fMax);
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->GetRange(fMin, fMax);
}
FWL_ERR CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ScrollBar*)m_pIface)->SetRange(fMin, fMax);
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->SetRange(fMin, fMax);
}
FX_FLOAT CFWL_ScrollBar::GetPageSize() {
if (!m_pIface)
return 0;
- return ((IFWL_ScrollBar*)m_pIface)->GetPageSize();
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPageSize();
}
FWL_ERR CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ScrollBar*)m_pIface)->SetPageSize(fPageSize);
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPageSize(fPageSize);
}
FX_FLOAT CFWL_ScrollBar::GetStepSize() {
if (!m_pIface)
return 0;
- return ((IFWL_ScrollBar*)m_pIface)->GetStepSize();
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->GetStepSize();
}
FWL_ERR CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ScrollBar*)m_pIface)->SetStepSize(fStepSize);
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->SetStepSize(fStepSize);
}
FX_FLOAT CFWL_ScrollBar::GetPos() {
if (!m_pIface)
return -1;
- return ((IFWL_ScrollBar*)m_pIface)->GetPos();
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPos();
}
FWL_ERR CFWL_ScrollBar::SetPos(FX_FLOAT fPos) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ScrollBar*)m_pIface)->SetPos(fPos);
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPos(fPos);
}
FX_FLOAT CFWL_ScrollBar::GetTrackPos() {
if (!m_pIface)
return -1;
- return ((IFWL_ScrollBar*)m_pIface)->GetTrackPos();
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->GetTrackPos();
}
FWL_ERR CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) {
if (!m_pIface)
return FWL_ERR_Indefinite;
- return ((IFWL_ScrollBar*)m_pIface)->SetTrackPos(fTrackPos);
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->SetTrackPos(fTrackPos);
}
FX_BOOL CFWL_ScrollBar::DoScroll(FX_DWORD dwCode, FX_FLOAT fPos) {
if (!m_pIface)
return FALSE;
- return ((IFWL_ScrollBar*)m_pIface)->DoScroll(dwCode, fPos);
+ return static_cast<IFWL_ScrollBar*>(m_pIface)->DoScroll(dwCode, fPos);
}
CFWL_ScrollBar::CFWL_ScrollBar() {}
CFWL_ScrollBar::~CFWL_ScrollBar() {}
diff --git a/xfa/src/fwl/src/lightwidget/theme.cpp b/xfa/src/fwl/src/lightwidget/theme.cpp
index 99157f3b74..133062907b 100644
--- a/xfa/src/fwl/src/lightwidget/theme.cpp
+++ b/xfa/src/fwl/src/lightwidget/theme.cpp
@@ -6,13 +6,10 @@
#include "../../../foxitlib.h"
FX_BOOL CFWL_Theme::IsValidWidget(IFWL_Widget* pWidget) {
- CFWL_WidgetTP* pTheme = GetTheme(pWidget);
- return pTheme != NULL;
+ return !!GetTheme(pWidget);
}
FX_DWORD CFWL_Theme::GetThemeID(IFWL_Widget* pWidget) {
- CFWL_WidgetTP* pTheme = GetTheme(pWidget);
- FXSYS_assert(pTheme);
- return pTheme->GetThemeID(pWidget);
+ return GetTheme(pWidget)->GetThemeID(pWidget);
}
FX_DWORD CFWL_Theme::SetThemeID(IFWL_Widget* pWidget,
FX_DWORD dwThemeID,
@@ -20,7 +17,7 @@ FX_DWORD CFWL_Theme::SetThemeID(IFWL_Widget* pWidget,
int32_t iCount = m_arrThemes.GetSize();
FX_DWORD dwID;
for (int32_t i = 0; i < iCount; i++) {
- CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i];
+ CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
dwID = pTheme->GetThemeID(pWidget);
pTheme->SetThemeID(pWidget, dwThemeID, FALSE);
}
@@ -73,7 +70,7 @@ FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) {
FWL_ERR CFWL_Theme::Initialize() {
int32_t iCount = m_arrThemes.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i];
+ CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
pTheme->Initialize();
}
FWLTHEME_Init();
@@ -82,7 +79,7 @@ FWL_ERR CFWL_Theme::Initialize() {
FWL_ERR CFWL_Theme::Finalize() {
int32_t iCount = m_arrThemes.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i];
+ CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
pTheme->Finalize();
}
FWLTHEME_Release();
@@ -115,10 +112,8 @@ CFWL_Theme::CFWL_Theme() {
m_arrThemes.Add(pCaretTP);
}
CFWL_Theme::~CFWL_Theme() {
- int32_t iCount = m_arrThemes.GetSize();
- for (int32_t i = 0; i < iCount; i++) {
- CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i];
- delete pTheme;
+ for (int32_t i = 0; i < m_arrThemes.GetSize(); i++) {
+ delete static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
}
m_arrThemes.RemoveAll();
}
@@ -128,7 +123,7 @@ FWL_ERR CFWL_Theme::SetFont(IFWL_Widget* pWidget,
FX_ARGB rgbFont) {
int32_t iCount = m_arrThemes.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i];
+ CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont);
}
return FWL_ERR_Succeeded;
@@ -136,7 +131,7 @@ FWL_ERR CFWL_Theme::SetFont(IFWL_Widget* pWidget,
CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) {
int32_t iCount = m_arrThemes.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- CFWL_WidgetTP* pTheme = (CFWL_WidgetTP*)m_arrThemes[i];
+ CFWL_WidgetTP* pTheme = static_cast<CFWL_WidgetTP*>(m_arrThemes[i]);
if (pTheme->IsValidWidget(pWidget)) {
return pTheme;
}
diff --git a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
index de616acd35..c2ee5636ce 100644
--- a/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
+++ b/xfa/src/fwl/src/lightwidget/tooltipctrl.cpp
@@ -67,13 +67,13 @@ FWL_ERR CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) {
return FWL_ERR_Succeeded;
}
FWL_ERR CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) {
- return ((IFWL_ToolTip*)m_pIface)->SetAnchor(rtAnchor);
+ return static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor);
}
FWL_ERR CFWL_ToolTip::Show() {
- return ((IFWL_ToolTip*)m_pIface)->Show();
+ return static_cast<IFWL_ToolTip*>(m_pIface)->Show();
}
FWL_ERR CFWL_ToolTip::Hide() {
- return ((IFWL_ToolTip*)m_pIface)->Hide();
+ return static_cast<IFWL_ToolTip*>(m_pIface)->Hide();
}
CFWL_ToolTip::CFWL_ToolTip() {}
CFWL_ToolTip::~CFWL_ToolTip() {}
diff --git a/xfa/src/fwl/src/lightwidget/widget.cpp b/xfa/src/fwl/src/lightwidget/widget.cpp
index b3e5953a2c..6cb6fa77d9 100644
--- a/xfa/src/fwl/src/lightwidget/widget.cpp
+++ b/xfa/src/fwl/src/lightwidget/widget.cpp
@@ -75,7 +75,7 @@ CFWL_Widget* CFWL_Widget::GetParent() {
return NULL;
IFWL_Widget* parent = m_pIface->GetParent();
if (parent) {
- return (CFWL_Widget*)parent->GetPrivateData(gs_pFWLWidget);
+ return static_cast<CFWL_Widget*>(parent->GetPrivateData(gs_pFWLWidget));
}
return NULL;
}
@@ -193,7 +193,7 @@ IFWL_WidgetDelegate* CFWL_Widget::SetDelegate(IFWL_WidgetDelegate* pDelegate) {
CFWL_Widget::CFWL_Widget()
: m_pIface(NULL), m_pDelegate(NULL), m_pProperties(NULL) {
m_pProperties = new CFWL_WidgetProperties;
- m_pWidgetMgr = (CFWL_WidgetMgr*)FWL_GetWidgetMgr();
+ m_pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr());
FXSYS_assert(m_pWidgetMgr != NULL);
}
CFWL_Widget::~CFWL_Widget() {
@@ -219,15 +219,15 @@ FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) {
if (!m_pIface)
return FWL_ERR_Indefinite;
IFWL_NoteThread* pThread = m_pIface->GetOwnerThread();
- if (!m_pIface)
+ if (!pThread)
return FWL_ERR_Indefinite;
IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
- if (!m_pIface)
+ if (!pDriver)
return FWL_ERR_Indefinite;
if (bFocus) {
pDriver->SetFocus(m_pIface);
} else {
- if (((CFWL_NoteDriver*)pDriver)->GetFocus() == m_pIface) {
+ if (pDriver->GetFocus() == m_pIface) {
pDriver->SetFocus(NULL);
}
}
@@ -237,10 +237,10 @@ FWL_ERR CFWL_Widget::SetGrab(FX_BOOL bSet) {
if (!m_pIface)
return FWL_ERR_Indefinite;
IFWL_NoteThread* pThread = m_pIface->GetOwnerThread();
- if (!m_pIface)
+ if (!pThread)
return FWL_ERR_Indefinite;
- CFWL_NoteDriver* pDriver = (CFWL_NoteDriver*)pThread->GetNoteDriver();
- if (!m_pIface)
+ IFWL_NoteDriver* pDriver = pThread->GetNoteDriver();
+ if (!pDriver)
return FWL_ERR_Indefinite;
pDriver->SetGrab(m_pIface, bSet);
return FWL_ERR_Succeeded;
diff --git a/xfa/src/fwl/src/theme/widgettp.cpp b/xfa/src/fwl/src/theme/widgettp.cpp
index 7db0f7ea22..959746761e 100644
--- a/xfa/src/fwl/src/theme/widgettp.cpp
+++ b/xfa/src/fwl/src/theme/widgettp.cpp
@@ -742,19 +742,16 @@ FX_BOOL CFWL_FontData::LoadFont(const CFX_WideStringC& wsFontFamily,
}
CFWL_FontManager::CFWL_FontManager() {}
CFWL_FontManager::~CFWL_FontManager() {
- int32_t count = m_arrFonts.GetSize();
- for (int32_t i = 0; i < count; i++) {
- CFWL_FontData* data = (CFWL_FontData*)m_arrFonts[i];
- delete data;
+ for (int32_t i = 0; i < m_arrFonts.GetSize(); i++) {
+ delete static_cast<CFWL_FontData*>(m_arrFonts[i]);
}
m_arrFonts.RemoveAll();
}
IFX_Font* CFWL_FontManager::FindFont(const CFX_WideStringC& wsFontFamily,
FX_DWORD dwFontStyles,
FX_WORD wCodePage) {
- int32_t count = m_arrFonts.GetSize();
- for (int32_t i = 0; i < count; i++) {
- CFWL_FontData* data = (CFWL_FontData*)m_arrFonts[i];
+ for (int32_t i = 0; i < m_arrFonts.GetSize(); i++) {
+ CFWL_FontData* data = static_cast<CFWL_FontData*>(m_arrFonts[i]);
if (data->Equal(wsFontFamily, dwFontStyles, wCodePage)) {
return data->GetFont();
}