diff options
author | dsinclair <dsinclair@chromium.org> | 2016-11-14 09:01:37 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-14 09:01:37 -0800 |
commit | c64b76c97c7f469ebd4126f314badceeb8a78b8b (patch) | |
tree | b2a77865503271247156447e30c9ab2a9db2f6f4 /xfa | |
parent | 27e66753c8bd6e664f26d05c1a468dc68be01913 (diff) | |
download | pdfium-c64b76c97c7f469ebd4126f314badceeb8a78b8b.tar.xz |
Cleanup remaining IFWL files for visiblity and usage.
This CL cleans up the remaining ifwl_* files to fixup visibility, remove
unused methods and remove unused FWL_Error return codes.
Review-Url: https://codereview.chromium.org/2502653002
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fwl/core/cfwl_barcode.cpp | 11 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_barcode.h | 35 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_checkbox.cpp | 24 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_checkbox.h | 7 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_picturebox.cpp | 3 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_picturebox.h | 21 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_adaptertimermgr.h | 11 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_barcode.h | 6 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_caret.cpp | 30 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_caret.h | 8 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_checkbox.cpp | 31 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_checkbox.h | 26 | ||||
-rw-r--r-- | xfa/fwl/core/ifwl_picturebox.h | 2 |
13 files changed, 67 insertions, 148 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp index 053826d6b7..ef3ae4036d 100644 --- a/xfa/fwl/core/cfwl_barcode.cpp +++ b/xfa/fwl/core/cfwl_barcode.cpp @@ -83,11 +83,6 @@ void CFWL_Barcode::SetEndChar(FX_CHAR endChar) { m_cEndChar = endChar; } -void CFWL_Barcode::SetVersion(int32_t version) { - m_dwAttributeMask |= FWL_BCDATTRIBUTE_VERSION; - m_nVersion = version; -} - void CFWL_Barcode::SetErrorCorrectionLevel(int32_t ecLevel) { m_dwAttributeMask |= FWL_BCDATTRIBUTE_ECLEVEL; m_nECLevel = ecLevel; @@ -98,10 +93,6 @@ void CFWL_Barcode::SetTruncated(bool truncated) { m_bTruncated = truncated; } -void CFWL_Barcode::ResetBarcodeAttributes() { - m_dwAttributeMask = FWL_BCDATTRIBUTE_NONE; -} - void CFWL_Barcode::SetType(BC_TYPE type) { if (GetWidget()) ToBarcode(GetWidget())->SetType(type); @@ -155,7 +146,7 @@ FX_CHAR CFWL_Barcode::GetEndChar() const { } int32_t CFWL_Barcode::GetVersion() const { - return m_nVersion; + return 0; } int32_t CFWL_Barcode::GetErrorCorrectionLevel() const { diff --git a/xfa/fwl/core/cfwl_barcode.h b/xfa/fwl/core/cfwl_barcode.h index 78e5e68c0b..30d158c2e8 100644 --- a/xfa/fwl/core/cfwl_barcode.h +++ b/xfa/fwl/core/cfwl_barcode.h @@ -18,24 +18,6 @@ class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP { void Initialize(); - void SetType(BC_TYPE type); - bool IsProtectedType(); - - void SetCharEncoding(BC_CHAR_ENCODING encoding); - void SetModuleHeight(int32_t height); - void SetModuleWidth(int32_t width); - void SetDataLength(int32_t dataLength); - void SetCalChecksum(bool calChecksum); - void SetPrintChecksum(bool printChecksum); - void SetTextLocation(BC_TEXT_LOC location); - void SetWideNarrowRatio(int32_t ratio); - void SetStartChar(FX_CHAR startChar); - void SetEndChar(FX_CHAR endChar); - void SetVersion(int32_t version); - void SetErrorCorrectionLevel(int32_t ecLevel); - void SetTruncated(bool truncated); - void ResetBarcodeAttributes(); - // IFWL_DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; @@ -55,6 +37,22 @@ class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP { bool GetTruncated() const override; uint32_t GetBarcodeAttributeMask() const override; + void SetType(BC_TYPE type); + bool IsProtectedType(); + + void SetCharEncoding(BC_CHAR_ENCODING encoding); + void SetModuleHeight(int32_t height); + void SetModuleWidth(int32_t width); + void SetDataLength(int32_t dataLength); + void SetCalChecksum(bool calChecksum); + void SetPrintChecksum(bool printChecksum); + void SetTextLocation(BC_TEXT_LOC location); + void SetWideNarrowRatio(int32_t ratio); + void SetStartChar(FX_CHAR startChar); + void SetEndChar(FX_CHAR endChar); + void SetErrorCorrectionLevel(int32_t ecLevel); + void SetTruncated(bool truncated); + private: BC_CHAR_ENCODING m_eCharEncoding; int32_t m_nModuleHeight; @@ -66,7 +64,6 @@ class CFWL_Barcode : public CFWL_Edit, public IFWL_BarcodeDP { int32_t m_nWideNarrowRatio; FX_CHAR m_cStartChar; FX_CHAR m_cEndChar; - int32_t m_nVersion; int32_t m_nECLevel; bool m_bTruncated; uint32_t m_dwAttributeMask; diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp index 75e85fcabb..08371fca4a 100644 --- a/xfa/fwl/core/cfwl_checkbox.cpp +++ b/xfa/fwl/core/cfwl_checkbox.cpp @@ -11,14 +11,6 @@ #include "third_party/base/ptr_util.h" #include "xfa/fwl/core/fwl_error.h" -namespace { - -IFWL_CheckBox* ToCheckBox(IFWL_Widget* widget) { - return static_cast<IFWL_CheckBox*>(widget); -} - -} // namespace - CFWL_CheckBox::CFWL_CheckBox(const IFWL_App* app) : CFWL_Widget(app), m_fBoxHeight(16.0f), m_wsCaption(L"Check box") {} @@ -33,22 +25,8 @@ void CFWL_CheckBox::Initialize() { CFWL_Widget::Initialize(); } -FWL_Error CFWL_CheckBox::SetCaption(const CFX_WideStringC& wsCaption) { - m_wsCaption = wsCaption; - return FWL_Error::Succeeded; -} - -FWL_Error CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) { +void CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) { m_fBoxHeight = fHeight; - return FWL_Error::Succeeded; -} - -int32_t CFWL_CheckBox::GetCheckState() { - return ToCheckBox(GetWidget())->GetCheckState(); -} - -FWL_Error CFWL_CheckBox::SetCheckState(int32_t iCheck) { - return ToCheckBox(GetWidget())->SetCheckState(iCheck); } void CFWL_CheckBox::GetCaption(IFWL_Widget* pWidget, diff --git a/xfa/fwl/core/cfwl_checkbox.h b/xfa/fwl/core/cfwl_checkbox.h index 730b906ba4..fb7a9ae1bf 100644 --- a/xfa/fwl/core/cfwl_checkbox.h +++ b/xfa/fwl/core/cfwl_checkbox.h @@ -17,17 +17,14 @@ class CFWL_CheckBox : public CFWL_Widget, public IFWL_CheckBoxDP { void Initialize(); - FWL_Error SetCaption(const CFX_WideStringC& wsCaption); - FWL_Error SetBoxSize(FX_FLOAT fHeight); - int32_t GetCheckState(); - FWL_Error SetCheckState(int32_t iCheck); - // IFWL_DataProvider void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; // IFWL_CheckBoxDP FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) override; + void SetBoxSize(FX_FLOAT fHeight); + private: FX_FLOAT m_fBoxHeight; CFX_WideString m_wsCaption; diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp index 8badc999ea..b701ae7eba 100644 --- a/xfa/fwl/core/cfwl_picturebox.cpp +++ b/xfa/fwl/core/cfwl_picturebox.cpp @@ -114,7 +114,7 @@ int32_t CFWL_PictureBox::GetOpacity(IFWL_Widget* pWidget) { return m_iOpacity; } -FWL_Error CFWL_PictureBox::GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { +void CFWL_PictureBox::GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { CFX_RectF rect; pWidget->GetClientRect(rect); FX_FLOAT fLen = rect.width / 2; @@ -125,7 +125,6 @@ FWL_Error CFWL_PictureBox::GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { matrix.Translate(fLen, fWid); matrix.Scale(m_fScaleX, m_fScaleY); matrix.Translate(m_fOffSetX, m_fOffSetY); - return FWL_Error::Succeeded; } int32_t CFWL_PictureBox::GetFlipMode(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h index 1efa0ad151..861372149e 100644 --- a/xfa/fwl/core/cfwl_picturebox.h +++ b/xfa/fwl/core/cfwl_picturebox.h @@ -18,6 +18,17 @@ class CFWL_PictureBox : public CFWL_Widget, public IFWL_PictureBoxDP { void Initialize(); + // IFWL_DataProvider + void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; + + // IFWL_PictureBoxDP + CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override; + CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget) override; + CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget) override; + int32_t GetOpacity(IFWL_Widget* pWidget) override; + int32_t GetFlipMode(IFWL_Widget* pWidget) override; + void GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; + CFX_DIBitmap* GetPicture(); FWL_Error SetPicture(CFX_DIBitmap* pBitmap); FX_FLOAT GetRotation(); @@ -31,16 +42,6 @@ class CFWL_PictureBox : public CFWL_Widget, public IFWL_PictureBoxDP { FWL_Error GetOffset(FX_FLOAT& fx, FX_FLOAT& fy); FWL_Error SetOffset(FX_FLOAT fx, FX_FLOAT fy); - // IFWL_DataProvider - void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override; - - // IFWL_PictureBoxDP - CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget) override; - CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget) override; - CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget) override; - int32_t GetOpacity(IFWL_Widget* pWidget) override; - int32_t GetFlipMode(IFWL_Widget* pWidget) override; - FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; private: CFX_DIBitmap* m_pBitmap; diff --git a/xfa/fwl/core/ifwl_adaptertimermgr.h b/xfa/fwl/core/ifwl_adaptertimermgr.h index ef5ebba59b..156c0cf6f9 100644 --- a/xfa/fwl/core/ifwl_adaptertimermgr.h +++ b/xfa/fwl/core/ifwl_adaptertimermgr.h @@ -7,17 +7,16 @@ #ifndef XFA_FWL_CORE_IFWL_ADAPTERTIMERMGR_H_ #define XFA_FWL_CORE_IFWL_ADAPTERTIMERMGR_H_ -#include "xfa/fwl/core/fwl_error.h" #include "xfa/fwl/core/ifwl_timer.h" class IFWL_AdapterTimerMgr { public: virtual ~IFWL_AdapterTimerMgr() {} - virtual FWL_Error Start(IFWL_Timer* pTimer, - uint32_t dwElapse, - bool bImmediately, - IFWL_TimerInfo** pTimerInfo) = 0; - virtual FWL_Error Stop(IFWL_TimerInfo* pTimerInfo) = 0; + virtual void Start(IFWL_Timer* pTimer, + uint32_t dwElapse, + bool bImmediately, + IFWL_TimerInfo** pTimerInfo) = 0; + virtual void Stop(IFWL_TimerInfo* pTimerInfo) = 0; }; #endif // XFA_FWL_CORE_IFWL_ADAPTERTIMERMGR_H_ diff --git a/xfa/fwl/core/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h index 1d88c32259..d69cd23fcb 100644 --- a/xfa/fwl/core/ifwl_barcode.h +++ b/xfa/fwl/core/ifwl_barcode.h @@ -58,8 +58,8 @@ class IFWL_BarcodeDP : public IFWL_DataProvider { class IFWL_Barcode : public IFWL_Edit { public: - explicit IFWL_Barcode(const IFWL_App* app, - std::unique_ptr<CFWL_WidgetProperties> properties); + IFWL_Barcode(const IFWL_App* app, + std::unique_ptr<CFWL_WidgetProperties> properties); ~IFWL_Barcode() override; // IFWL_Widget @@ -75,7 +75,7 @@ class IFWL_Barcode : public IFWL_Edit { void SetType(BC_TYPE type); bool IsProtectedType(); - protected: + private: void GenerateBarcodeImageCache(); void CreateBarcodeEngine(); diff --git a/xfa/fwl/core/ifwl_caret.cpp b/xfa/fwl/core/ifwl_caret.cpp index 78ac4e5727..f333fdd94c 100644 --- a/xfa/fwl/core/ifwl_caret.cpp +++ b/xfa/fwl/core/ifwl_caret.cpp @@ -13,14 +13,18 @@ #include "xfa/fwl/core/ifwl_caret.h" #include "xfa/fwl/core/ifwl_themeprovider.h" +namespace { + +const uint32_t kFrequency = 400; + +} // namespace + IFWL_Caret::IFWL_Caret(const IFWL_App* app, std::unique_ptr<CFWL_WidgetProperties> properties, IFWL_Widget* pOuter) : IFWL_Widget(app, std::move(properties), pOuter), m_pTimer(new IFWL_Caret::Timer(this)), - m_pTimerInfo(nullptr), - m_dwElapse(400), - m_bSetColor(false) { + m_pTimerInfo(nullptr) { SetStates(FWL_STATE_CAT_HightLight); } @@ -53,27 +57,11 @@ void IFWL_Caret::ShowCaret(bool bFlag) { m_pTimerInfo = nullptr; } if (bFlag) - m_pTimerInfo = m_pTimer->StartTimer(m_dwElapse, true); + m_pTimerInfo = m_pTimer->StartTimer(kFrequency, true); SetStates(FWL_WGTSTATE_Invisible, !bFlag); } -FWL_Error IFWL_Caret::GetFrequency(uint32_t& elapse) { - elapse = m_dwElapse; - return FWL_Error::Succeeded; -} - -FWL_Error IFWL_Caret::SetFrequency(uint32_t elapse) { - m_dwElapse = elapse; - return FWL_Error::Succeeded; -} - -FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) { - m_bSetColor = true; - m_crFill = crFill; - return FWL_Error::Succeeded; -} - void IFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, const CFX_Matrix* pMatrix) { @@ -84,8 +72,6 @@ void IFWL_Caret::DrawCaretBK(CFX_Graphics* pGraphics, param.m_pWidget = this; param.m_pGraphics = pGraphics; param.m_rtPart = rect; - if (m_bSetColor) - param.m_pData = &m_crFill; if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) return; diff --git a/xfa/fwl/core/ifwl_caret.h b/xfa/fwl/core/ifwl_caret.h index dc1d5806ad..d75a662175 100644 --- a/xfa/fwl/core/ifwl_caret.h +++ b/xfa/fwl/core/ifwl_caret.h @@ -34,11 +34,8 @@ class IFWL_Caret : public IFWL_Widget { const CFX_Matrix* pMatrix) override; void ShowCaret(bool bFlag = true); - FWL_Error GetFrequency(uint32_t& elapse); - FWL_Error SetFrequency(uint32_t elapse); - FWL_Error SetColor(CFX_Color crFill); - protected: + private: class Timer : public IFWL_Timer { public: explicit Timer(IFWL_Caret* pCaret); @@ -54,9 +51,6 @@ class IFWL_Caret : public IFWL_Widget { std::unique_ptr<IFWL_Caret::Timer> m_pTimer; IFWL_TimerInfo* m_pTimerInfo; // not owned. - uint32_t m_dwElapse; - CFX_Color m_crFill; - bool m_bSetColor; }; #endif // XFA_FWL_CORE_IFWL_CARET_H_ diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp index 3aac3598c2..76a377acbf 100644 --- a/xfa/fwl/core/ifwl_checkbox.cpp +++ b/xfa/fwl/core/ifwl_checkbox.cpp @@ -143,39 +143,20 @@ void IFWL_CheckBox::DrawWidget(CFX_Graphics* pGraphics, } } -int32_t IFWL_CheckBox::GetCheckState() { - if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) && - ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) == - FWL_STATE_CKB_Neutral)) { - return 2; - } - if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) == - FWL_STATE_CKB_Checked) { - return 1; - } - return 0; -} - -FWL_Error IFWL_CheckBox::SetCheckState(int32_t iCheck) { +void IFWL_CheckBox::SetCheckState(int32_t iCheck) { m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask; switch (iCheck) { - case 0: { - break; - } - case 1: { + case 1: m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked; break; - } - case 2: { - if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) { + case 2: + if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) m_pProperties->m_dwStates |= FWL_STATE_CKB_Neutral; - } break; - } - default: {} + default: + break; } Repaint(&m_rtClient); - return FWL_Error::Succeeded; } void IFWL_CheckBox::Layout() { diff --git a/xfa/fwl/core/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h index d3dfd2680d..cda02b5168 100644 --- a/xfa/fwl/core/ifwl_checkbox.h +++ b/xfa/fwl/core/ifwl_checkbox.h @@ -56,8 +56,8 @@ class IFWL_CheckBoxDP : public IFWL_DataProvider { class IFWL_CheckBox : public IFWL_Widget { public: - explicit IFWL_CheckBox(const IFWL_App* app, - std::unique_ptr<CFWL_WidgetProperties> properties); + IFWL_CheckBox(const IFWL_App* app, + std::unique_ptr<CFWL_WidgetProperties> properties); ~IFWL_CheckBox() override; // IFWL_Widget @@ -71,14 +71,19 @@ class IFWL_CheckBox : public IFWL_Widget { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - int32_t GetCheckState(); - FWL_Error SetCheckState(int32_t iCheck); - - protected: + private: + void SetCheckState(int32_t iCheck); void Layout(); uint32_t GetPartStates(); void UpdateTextOutStyles(); void NextStates(); + void OnActivate(CFWL_Message* pMsg); + void OnFocusChanged(CFWL_Message* pMsg, bool bSet); + void OnLButtonDown(CFWL_MsgMouse* pMsg); + void OnLButtonUp(CFWL_MsgMouse* pMsg); + void OnMouseMove(CFWL_MsgMouse* pMsg); + void OnMouseLeave(CFWL_MsgMouse* pMsg); + void OnKeyDown(CFWL_MsgKey* pMsg); CFX_RectF m_rtClient; CFX_RectF m_rtBox; @@ -87,15 +92,6 @@ class IFWL_CheckBox : public IFWL_Widget { uint32_t m_dwTTOStyles; int32_t m_iTTOAlign; bool m_bBtnDown; - - private: - void OnActivate(CFWL_Message* pMsg); - void OnFocusChanged(CFWL_Message* pMsg, bool bSet); - void OnLButtonDown(CFWL_MsgMouse* pMsg); - void OnLButtonUp(CFWL_MsgMouse* pMsg); - void OnMouseMove(CFWL_MsgMouse* pMsg); - void OnMouseLeave(CFWL_MsgMouse* pMsg); - void OnKeyDown(CFWL_MsgKey* pMsg); }; #endif // XFA_FWL_CORE_IFWL_CHECKBOX_H_ diff --git a/xfa/fwl/core/ifwl_picturebox.h b/xfa/fwl/core/ifwl_picturebox.h index 55eabcb523..41b09f4f03 100644 --- a/xfa/fwl/core/ifwl_picturebox.h +++ b/xfa/fwl/core/ifwl_picturebox.h @@ -36,7 +36,7 @@ class IFWL_PictureBoxDP : public IFWL_DataProvider { virtual CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget) = 0; virtual int32_t GetOpacity(IFWL_Widget* pWidget) = 0; virtual int32_t GetFlipMode(IFWL_Widget* pWidget) = 0; - virtual FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; + virtual void GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; }; class IFWL_PictureBox : public IFWL_Widget { |