diff options
author | dsinclair <dsinclair@chromium.org> | 2016-05-04 17:57:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-04 17:57:03 -0700 |
commit | c777f486f84611d2fdd2d03af661b14955f9efb6 (patch) | |
tree | 679012454d82e885f749d17f75fd12735efec29a | |
parent | 41aad19ba366540bd4efa20a9009ac1c70a81403 (diff) | |
download | pdfium-c777f486f84611d2fdd2d03af661b14955f9efb6.tar.xz |
Convert FWL_ERR into an enum class.
This Cl updates FWL_ERR to be an FWL_Error enum class. It removes FX_ERR and
replaces it with FWL_Error as well as the values were the same.
There were many places where we either returned other values for FWL_ERR
results.
This Cl is the same as: https://codereview.chromium.org/1943413002/ but I seem
to have messed up the base URL in that one.
TBR=tsepez@chromium.org
Review-Url: https://codereview.chromium.org/1952693003
128 files changed, 2846 insertions, 2795 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp index 4fb92e76ae..b6deaef17b 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_util.cpp @@ -13,24 +13,24 @@ std::vector<CFWL_TimerInfo*>* CXFA_FWLAdapterTimerMgr::s_TimerArray = nullptr; -FWL_ERR CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer* pTimer, - uint32_t dwElapse, - FWL_HTIMER& hTimer, - FX_BOOL bImmediately) { +FWL_Error CXFA_FWLAdapterTimerMgr::Start(IFWL_Timer* pTimer, + uint32_t dwElapse, + FWL_HTIMER& hTimer, + FX_BOOL bImmediately) { if (!m_pEnv) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; int32_t id_event = m_pEnv->FFI_SetTimer(dwElapse, TimerProc); if (!s_TimerArray) s_TimerArray = new std::vector<CFWL_TimerInfo*>; s_TimerArray->push_back(new CFWL_TimerInfo(id_event, pTimer)); hTimer = reinterpret_cast<FWL_HTIMER>(s_TimerArray->back()); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CXFA_FWLAdapterTimerMgr::Stop(FWL_HTIMER hTimer) { +FWL_Error CXFA_FWLAdapterTimerMgr::Stop(FWL_HTIMER hTimer) { if (!hTimer || !m_pEnv) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_TimerInfo* pInfo = reinterpret_cast<CFWL_TimerInfo*>(hTimer); m_pEnv->FFI_KillTimer(pInfo->idEvent); @@ -41,7 +41,7 @@ FWL_ERR CXFA_FWLAdapterTimerMgr::Stop(FWL_HTIMER hTimer) { delete pInfo; } } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } // static diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h index 3f17662976..dce9a74229 100644 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h +++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_util.h @@ -22,11 +22,11 @@ struct CFWL_TimerInfo; class CXFA_FWLAdapterTimerMgr : public IFWL_AdapterTimerMgr { public: CXFA_FWLAdapterTimerMgr(CPDFDoc_Environment* pEnv) : m_pEnv(pEnv) {} - virtual FWL_ERR Start(IFWL_Timer* pTimer, - uint32_t dwElapse, - FWL_HTIMER& hTimer, - FX_BOOL bImmediately = TRUE); - virtual FWL_ERR Stop(FWL_HTIMER hTimer); + virtual FWL_Error Start(IFWL_Timer* pTimer, + uint32_t dwElapse, + FWL_HTIMER& hTimer, + FX_BOOL bImmediately = TRUE); + virtual FWL_Error Stop(FWL_HTIMER hTimer); protected: static void TimerProc(int32_t idEvent); diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.cpp b/xfa/fwl/basewidget/fwl_barcodeimp.cpp index d4589e39c1..ce9d083d83 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.cpp +++ b/xfa/fwl/basewidget/fwl_barcodeimp.cpp @@ -38,45 +38,45 @@ CFWL_BarcodeImp::CFWL_BarcodeImp(const CFWL_WidgetImpProperties& properties, CFWL_BarcodeImp::~CFWL_BarcodeImp() { ReleaseBarcodeEngine(); } -FWL_ERR CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_BarcodeImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Barcode; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_BarcodeImp::GetClassID() const { return FWL_CLASSHASH_Barcode; } -FWL_ERR CFWL_BarcodeImp::Initialize() { +FWL_Error CFWL_BarcodeImp::Initialize() { if (!m_pDelegate) { m_pDelegate = new CFWL_BarcodeImpDelegate(this); } - if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; - return FWL_ERR_Succeeded; + if (CFWL_EditImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_BarcodeImp::Finalize() { +FWL_Error CFWL_BarcodeImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; ReleaseBarcodeEngine(); return CFWL_EditImp::Finalize(); } -FWL_ERR CFWL_BarcodeImp::Update() { +FWL_Error CFWL_BarcodeImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } - FWL_ERR ret = CFWL_EditImp::Update(); + FWL_Error ret = CFWL_EditImp::Update(); GenerateBarcodeImageCache(); return ret; } -FWL_ERR CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { GenerateBarcodeImageCache(); if (!m_pBarcodeEngine || (m_dwStatus & XFA_BCS_EncodeSuccess) == 0) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_Matrix mt; mt.e = m_rtClient.left; @@ -87,9 +87,9 @@ FWL_ERR CFWL_BarcodeImp::DrawWidget(CFX_Graphics* pGraphics, int32_t errorCode = 0; if (!m_pBarcodeEngine->RenderDevice(pGraphics->GetRenderDevice(), pMatrix, errorCode)) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } return CFWL_EditImp::DrawWidget(pGraphics, pMatrix); } @@ -105,7 +105,7 @@ void CFWL_BarcodeImp::GenerateBarcodeImageCache() { if (!m_pBarcodeEngine) return; CFX_WideString wsText; - if (GetText(wsText) != FWL_ERR_Succeeded) + if (GetText(wsText) != FWL_Error::Succeeded) return; CFWL_ThemePart part; part.m_pWidget = m_pInterface; @@ -200,7 +200,7 @@ void CFWL_BarcodeImp::SetType(BC_TYPE type) { m_type = type; m_dwStatus = XFA_BCS_NeedUpdate; } -FWL_ERR CFWL_BarcodeImp::SetText(const CFX_WideString& wsText) { +FWL_Error CFWL_BarcodeImp::SetText(const CFX_WideString& wsText) { ReleaseBarcodeEngine(); m_dwStatus = XFA_BCS_NeedUpdate; return CFWL_EditImp::SetText(wsText); @@ -220,11 +220,11 @@ FX_BOOL CFWL_BarcodeImp::IsProtectedType() { CFWL_BarcodeImpDelegate::CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner) : CFWL_EditImpDelegate(pOwner) {} -FWL_ERR CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { +void CFWL_BarcodeImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { if (pEvent->GetClassID() == CFWL_EventType::TextChanged) { CFWL_BarcodeImp* pOwner = static_cast<CFWL_BarcodeImp*>(m_pOwner); pOwner->ReleaseBarcodeEngine(); pOwner->m_dwStatus = XFA_BCS_NeedUpdate; } - return CFWL_EditImpDelegate::OnProcessEvent(pEvent); + CFWL_EditImpDelegate::OnProcessEvent(pEvent); } diff --git a/xfa/fwl/basewidget/fwl_barcodeimp.h b/xfa/fwl/basewidget/fwl_barcodeimp.h index eacecc3c4e..68c017e63e 100644 --- a/xfa/fwl/basewidget/fwl_barcodeimp.h +++ b/xfa/fwl/basewidget/fwl_barcodeimp.h @@ -25,14 +25,14 @@ class CFWL_BarcodeImp : public CFWL_EditImp { IFWL_Widget* pOuter); ~CFWL_BarcodeImp() override; - FWL_ERR GetClassName(CFX_WideString& wsClass) const override; + FWL_Error GetClassName(CFX_WideString& wsClass) const override; uint32_t GetClassID() const override; - FWL_ERR Initialize() override; - FWL_ERR Finalize() override; - FWL_ERR Update() override; - FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; - FWL_ERR SetText(const CFX_WideString& wsText) override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error Update() override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; + FWL_Error SetText(const CFX_WideString& wsText) override; void SetType(BC_TYPE type); FX_BOOL IsProtectedType(); @@ -51,7 +51,7 @@ class CFWL_BarcodeImp : public CFWL_EditImp { class CFWL_BarcodeImpDelegate : public CFWL_EditImpDelegate { public: CFWL_BarcodeImpDelegate(CFWL_BarcodeImp* pOwner); - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; + void OnProcessEvent(CFWL_Event* pEvent) override; }; #endif // XFA_FWL_BASEWIDGET_FWL_BARCODEIMP_H_ diff --git a/xfa/fwl/basewidget/fwl_caretimp.cpp b/xfa/fwl/basewidget/fwl_caretimp.cpp index 23a5213a4d..2b4a67cb1a 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.cpp +++ b/xfa/fwl/basewidget/fwl_caretimp.cpp @@ -25,13 +25,13 @@ IFWL_Caret::IFWL_Caret() {} void IFWL_Caret::ShowCaret(FX_BOOL bFlag) { static_cast<CFWL_CaretImp*>(GetImpl())->ShowCaret(bFlag); } -FWL_ERR IFWL_Caret::GetFrequency(uint32_t& elapse) { +FWL_Error IFWL_Caret::GetFrequency(uint32_t& elapse) { return static_cast<CFWL_CaretImp*>(GetImpl())->GetFrequency(elapse); } -FWL_ERR IFWL_Caret::SetFrequency(uint32_t elapse) { +FWL_Error IFWL_Caret::SetFrequency(uint32_t elapse) { return static_cast<CFWL_CaretImp*>(GetImpl())->SetFrequency(elapse); } -FWL_ERR IFWL_Caret::SetColor(CFX_Color crFill) { +FWL_Error IFWL_Caret::SetColor(CFX_Color crFill) { return static_cast<CFWL_CaretImp*>(GetImpl())->SetColor(crFill); } @@ -49,20 +49,20 @@ CFWL_CaretImp::~CFWL_CaretImp() { delete m_pTimer; } -FWL_ERR CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_CaretImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Caret; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_CaretImp::GetClassID() const { return FWL_CLASSHASH_Caret; } -FWL_ERR CFWL_CaretImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_CaretImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_CaretImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CaretImp::Finalize() { +FWL_Error CFWL_CaretImp::Finalize() { if (m_hTimer) { FWL_StopTimer(m_hTimer); m_hTimer = NULL; @@ -71,16 +71,17 @@ FWL_ERR CFWL_CaretImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_CaretImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + DrawCaretBK(pGraphics, m_pProperties->m_pThemeProvider, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) { @@ -93,22 +94,23 @@ void CFWL_CaretImp::ShowCaret(FX_BOOL bFlag) { SetStates(FWL_WGTSTATE_Invisible, !bFlag); } -FWL_ERR CFWL_CaretImp::GetFrequency(uint32_t& elapse) { +FWL_Error CFWL_CaretImp::GetFrequency(uint32_t& elapse) { elapse = m_dwElapse; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CaretImp::SetFrequency(uint32_t elapse) { +FWL_Error CFWL_CaretImp::SetFrequency(uint32_t elapse) { m_dwElapse = elapse; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CaretImp::SetColor(CFX_Color crFill) { +FWL_Error CFWL_CaretImp::SetColor(CFX_Color crFill) { m_bSetColor = TRUE; m_crFill = crFill; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_BOOL CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix) { + +void CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix) { CFX_RectF rect; GetWidgetRect(rect); rect.Set(0, 0, rect.width, rect.height); @@ -116,19 +118,17 @@ FX_BOOL CFWL_CaretImp::DrawCaretBK(CFX_Graphics* pGraphics, param.m_pWidget = m_pInterface; param.m_pGraphics = pGraphics; param.m_rtPart = rect; - if (m_bSetColor) { + if (m_bSetColor) param.m_pData = &m_crFill; - } - if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) { - return FWL_ERR_Succeeded; - } + if (!(m_pProperties->m_dwStates & FWL_STATE_CAT_HightLight)) + return; + param.m_iPart = CFWL_Part::Background; param.m_dwStates = CFWL_PartState_HightLight; - if (pMatrix) { + if (pMatrix) param.m_matrix.Concat(*pMatrix); - } + pTheme->DrawBackground(¶m); - return FWL_ERR_Succeeded; } CFWL_CaretImp::CFWL_CaretTimer::CFWL_CaretTimer(CFWL_CaretImp* pCaret) @@ -146,12 +146,13 @@ int32_t CFWL_CaretImp::CFWL_CaretTimer::Run(FWL_HTIMER hTimer) { m_pCaret->Repaint(&rt); return 1; } + CFWL_CaretImpDelegate::CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - return 1; -} -FWL_ERR CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); + +void CFWL_CaretImpDelegate::OnProcessMessage(CFWL_Message* pMessage) {} + +void CFWL_CaretImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fwl/basewidget/fwl_caretimp.h b/xfa/fwl/basewidget/fwl_caretimp.h index 81d6e45449..c579beeed3 100644 --- a/xfa/fwl/basewidget/fwl_caretimp.h +++ b/xfa/fwl/basewidget/fwl_caretimp.h @@ -21,24 +21,24 @@ class CFWL_CaretImp : public CFWL_WidgetImp { IFWL_Widget* pOuter); virtual ~CFWL_CaretImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual void ShowCaret(FX_BOOL bFlag = TRUE); - virtual FWL_ERR GetFrequency(uint32_t& elapse); - virtual FWL_ERR SetFrequency(uint32_t elapse); - virtual FWL_ERR SetColor(CFX_Color crFill); + virtual FWL_Error GetFrequency(uint32_t& elapse); + virtual FWL_Error SetFrequency(uint32_t elapse); + virtual FWL_Error SetColor(CFX_Color crFill); protected: - FX_BOOL DrawCaretBK(CFX_Graphics* pGraphics, - IFWL_ThemeProvider* pTheme, - const CFX_Matrix* pMatrix); + void DrawCaretBK(CFX_Graphics* pGraphics, + IFWL_ThemeProvider* pTheme, + const CFX_Matrix* pMatrix); class CFWL_CaretTimer : public IFWL_Timer { public: explicit CFWL_CaretTimer(CFWL_CaretImp* pCaret); @@ -57,9 +57,9 @@ class CFWL_CaretImp : public CFWL_WidgetImp { class CFWL_CaretImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_CaretImpDelegate(CFWL_CaretImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: CFWL_CaretImp* m_pOwner; diff --git a/xfa/fwl/basewidget/fwl_checkboximp.cpp b/xfa/fwl/basewidget/fwl_checkboximp.cpp index ba63e2f663..a45c639450 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.cpp +++ b/xfa/fwl/basewidget/fwl_checkboximp.cpp @@ -37,7 +37,7 @@ IFWL_CheckBox::IFWL_CheckBox() {} int32_t IFWL_CheckBox::GetCheckState() { return static_cast<CFWL_CheckBoxImp*>(GetImpl())->GetCheckState(); } -FWL_ERR IFWL_CheckBox::SetCheckState(int32_t iCheck) { +FWL_Error IFWL_CheckBox::SetCheckState(int32_t iCheck) { return static_cast<CFWL_CheckBoxImp*>(GetImpl())->SetCheckState(iCheck); } @@ -53,33 +53,33 @@ CFWL_CheckBoxImp::CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, m_rtFocus.Reset(); } CFWL_CheckBoxImp::~CFWL_CheckBoxImp() {} -FWL_ERR CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_CheckBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_CheckBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_CheckBoxImp::GetClassID() const { return FWL_CLASSHASH_CheckBox; } -FWL_ERR CFWL_CheckBoxImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_CheckBoxImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_CheckBoxImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CheckBoxImp::Finalize() { +FWL_Error CFWL_CheckBoxImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_WideString wsCaption; m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption); if (wsCaption.GetLength() > 0) { @@ -100,25 +100,25 @@ FWL_ERR CFWL_CheckBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CheckBoxImp::Update() { +FWL_Error CFWL_CheckBoxImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } UpdateTextOutStyles(); Layout(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, m_pProperties->m_pThemeProvider, @@ -147,13 +147,13 @@ FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); } if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; { CFX_WideString wsCaption; m_pProperties->m_pDataProvider->GetCaption(m_pInterface, wsCaption); int32_t iLen = wsCaption.GetLength(); if (iLen <= 0) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_ThemeText textParam; textParam.m_pWidget = m_pInterface; textParam.m_iPart = CFWL_Part::Caption; @@ -168,7 +168,7 @@ FWL_ERR CFWL_CheckBoxImp::DrawWidget(CFX_Graphics* pGraphics, textParam.m_iTTOAlign = m_iTTOAlign; pTheme->DrawText(&textParam); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_CheckBoxImp::GetCheckState() { if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_3State) && @@ -182,7 +182,7 @@ int32_t CFWL_CheckBoxImp::GetCheckState() { } return 0; } -FWL_ERR CFWL_CheckBoxImp::SetCheckState(int32_t iCheck) { +FWL_Error CFWL_CheckBoxImp::SetCheckState(int32_t iCheck) { m_pProperties->m_dwStates &= ~FWL_STATE_CKB_CheckMask; switch (iCheck) { case 0: { @@ -201,7 +201,7 @@ FWL_ERR CFWL_CheckBoxImp::SetCheckState(int32_t iCheck) { default: {} } Repaint(&m_rtClient); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_CheckBoxImp::Layout() { int32_t width = int32_t(m_pProperties->m_rtWidget.width + 0.5f); @@ -413,11 +413,10 @@ void CFWL_CheckBoxImp::NextStates() { CFWL_CheckBoxImpDelegate::CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; - int32_t iRet = 1; switch (pMessage->GetClassID()) { case CFWL_MessageType::Activate: { OnActivate(pMessage); @@ -462,18 +461,18 @@ int32_t CFWL_CheckBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_CheckBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); + +void CFWL_CheckBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_CheckBoxImpDelegate::OnActivate(CFWL_Message* pMsg) { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; m_pOwner->Repaint(&(m_pOwner->m_rtClient)); diff --git a/xfa/fwl/basewidget/fwl_checkboximp.h b/xfa/fwl/basewidget/fwl_checkboximp.h index fe0ebb05cb..cc5474db9a 100644 --- a/xfa/fwl/basewidget/fwl_checkboximp.h +++ b/xfa/fwl/basewidget/fwl_checkboximp.h @@ -19,16 +19,16 @@ class CFWL_CheckBoxImp : public CFWL_WidgetImp { CFWL_CheckBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_CheckBoxImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual int32_t GetCheckState(); - virtual FWL_ERR SetCheckState(int32_t iCheck); + virtual FWL_Error SetCheckState(int32_t iCheck); protected: void Layout(); @@ -47,9 +47,9 @@ class CFWL_CheckBoxImp : public CFWL_WidgetImp { class CFWL_CheckBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_CheckBoxImpDelegate(CFWL_CheckBoxImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnActivate(CFWL_Message* pMsg); diff --git a/xfa/fwl/basewidget/fwl_comboboximp.cpp b/xfa/fwl/basewidget/fwl_comboboximp.cpp index 5b3e7c7c35..7368f7bbbd 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.cpp +++ b/xfa/fwl/basewidget/fwl_comboboximp.cpp @@ -37,22 +37,22 @@ IFWL_ComboBox::IFWL_ComboBox() {} int32_t IFWL_ComboBox::GetCurSel() { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetCurSel(); } -FWL_ERR IFWL_ComboBox::SetCurSel(int32_t iSel) { +FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetCurSel(iSel); } -FWL_ERR IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { +FWL_Error IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditText(wsText); } int32_t IFWL_ComboBox::GetEditTextLength() const { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditTextLength(); } -FWL_ERR IFWL_ComboBox::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { return static_cast<CFWL_ComboBoxImp*>(GetImpl()) ->GetEditText(wsText, nStart, nCount); } -FWL_ERR IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { +FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { return static_cast<CFWL_ComboBoxImp*>(GetImpl()) ->SetEditSelRange(nStart, nCount); } @@ -63,10 +63,10 @@ int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) { int32_t IFWL_ComboBox::GetEditLimit() { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetEditLimit(); } -FWL_ERR IFWL_ComboBox::SetEditLimit(int32_t nLimit) { +FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->SetEditLimit(nLimit); } -FWL_ERR IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { +FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDoClipboard(iCmd); } FX_BOOL IFWL_ComboBox::EditRedo(const CFX_ByteStringC& bsRecord) { @@ -81,7 +81,7 @@ IFWL_ListBox* IFWL_ComboBox::GetListBoxt() { FX_BOOL IFWL_ComboBox::AfterFocusShowDropList() { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->AfterFocusShowDropList(); } -FX_ERR IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { +FWL_Error IFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->OpenDropDownList(bActivate); } FX_BOOL IFWL_ComboBox::EditCanUndo() { @@ -123,11 +123,11 @@ FX_BOOL IFWL_ComboBox::EditDelete() { FX_BOOL IFWL_ComboBox::EditDeSelect() { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->EditDeSelect(); } -FWL_ERR IFWL_ComboBox::GetBBox(CFX_RectF& rect) { +FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) { return static_cast<CFWL_ComboBoxImp*>(GetImpl())->GetBBox(rect); } -FWL_ERR IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return static_cast<CFWL_ComboBoxImp*>(GetImpl()) ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -141,9 +141,9 @@ CFWL_ComboEditImp::CFWL_ComboEditImp(const CFWL_WidgetImpProperties& properties, CFWL_ComboEditImpDelegate::CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner) : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} -int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; FX_BOOL backDefault = TRUE; switch (pMessage->GetClassID()) { @@ -169,9 +169,8 @@ int32_t CFWL_ComboEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - if (!backDefault) - return 1; - return CFWL_EditImpDelegate::OnProcessMessage(pMessage); + if (backDefault) + CFWL_EditImpDelegate::OnProcessMessage(pMessage); } void CFWL_ComboEditImp::ClearSelected() { @@ -202,14 +201,14 @@ CFWL_ComboListImp::CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, : CFWL_ListBoxImp(properties, pOuter), m_bNotifyOwner(TRUE) { ASSERT(pOuter != NULL); } -FWL_ERR CFWL_ComboListImp::Initialize() { - if (CFWL_ListBoxImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_ComboListImp::Initialize() { + if (CFWL_ListBoxImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; delete m_pDelegate; m_pDelegate = new CFWL_ComboListImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboListImp::Finalize() { +FWL_Error CFWL_ComboListImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_ListBoxImp::Finalize(); @@ -286,9 +285,9 @@ void CFWL_ComboListImp::SetFocus(FX_BOOL bSet) { CFWL_ComboListImpDelegate::CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner) : CFWL_ListBoxImpDelegate(pOwner), m_pOwner(pOwner) {} -int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; CFWL_MessageType dwHashCode = pMessage->GetClassID(); FX_BOOL backDefault = TRUE; @@ -305,7 +304,8 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { pMsg->m_fy -= rect.top; IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pVertScrollBar->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMsg); + pDelegate->OnProcessMessage(pMsg); + return; } } switch (pMsg->m_dwCmd) { @@ -330,9 +330,8 @@ int32_t CFWL_ComboListImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { } else if (dwHashCode == CFWL_MessageType::Key) { backDefault = !OnDropListKey(static_cast<CFWL_MsgKey*>(pMessage)); } - if (!backDefault) - return 1; - return CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); + if (backDefault) + CFWL_ListBoxImpDelegate::OnProcessMessage(pMessage); } void CFWL_ComboListImpDelegate::OnDropListFocusChanged(CFWL_Message* pMsg, @@ -483,27 +482,31 @@ CFWL_ComboBoxImp::CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, m_rtBtn.Reset(); m_rtHandler.Reset(); } + CFWL_ComboBoxImp::~CFWL_ComboBoxImp() {} -FWL_ERR CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { + +FWL_Error CFWL_ComboBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ComboBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + uint32_t CFWL_ComboBoxImp::GetClassID() const { return FWL_CLASSHASH_ComboBox; } -FWL_ERR CFWL_ComboBoxImp::Initialize() { - if (m_pWidgetMgr->IsFormDisabled()) { + +FWL_Error CFWL_ComboBoxImp::Initialize() { + if (m_pWidgetMgr->IsFormDisabled()) return DisForm_Initialize(); - } - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_WGTSTATE_Invisible; // Probably a bug; not a FWL_ERR_ value. + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; + m_pDelegate = new CFWL_ComboBoxImpDelegate(this); CFWL_WidgetImpProperties prop; prop.m_pThemeProvider = m_pProperties->m_pThemeProvider; prop.m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; - if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) { + if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText) prop.m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon; - } + prop.m_pDataProvider = m_pProperties->m_pDataProvider; m_pListBox.reset(IFWL_ListBox::CreateComboList(prop, m_pInterface)); m_pListBox->Initialize(); @@ -513,13 +516,14 @@ FWL_ERR CFWL_ComboBoxImp::Initialize() { m_pEdit->Initialize(); static_cast<CFWL_EditImp*>(m_pEdit->GetImpl())->SetOuter(m_pInterface); } - if (m_pEdit) { + if (m_pEdit) m_pEdit->SetParent(m_pInterface); - } + SetStates(m_pProperties->m_dwStates); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::Finalize() { + +FWL_Error CFWL_ComboBoxImp::Finalize() { if (m_pEdit) { m_pEdit->Finalize(); } @@ -528,7 +532,7 @@ FWL_ERR CFWL_ComboBoxImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Reset(); FX_BOOL bIsDropDown = IsDropDownStyle(); @@ -544,16 +548,16 @@ FWL_ERR CFWL_ComboBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; rect.Inflate(0, 0, *pFWidth, 0); CFWL_WidgetImp::GetWidgetRect(rect, TRUE); } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -570,12 +574,12 @@ FWL_ERR CFWL_ComboBoxImp::ModifyStylesEx(uint32_t dwStylesExAdded, } return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } -FWL_ERR CFWL_ComboBoxImp::Update() { +FWL_Error CFWL_ComboBoxImp::Update() { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_Update(); } if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } ReSetTheme(); FX_BOOL bDropDown = IsDropDownStyle(); @@ -591,7 +595,7 @@ FWL_ERR CFWL_ComboBoxImp::Update() { m_fComboFormHandler = *static_cast<FX_FLOAT*>(m_pProperties->m_pThemeProvider->GetCapacity( &part, CFWL_WidgetCapacity::ComboFormHandler)); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pWidgetMgr->IsFormDisabled()) { @@ -599,15 +603,15 @@ FWL_WidgetHit CFWL_ComboBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return CFWL_WidgetImp::HitTest(fx, fy); } -FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_DrawWidget(pGraphics, pMatrix); } if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; FX_BOOL bIsDropDown = IsDropDownStyle(); if (HasBorder()) { @@ -648,7 +652,7 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, pTheme->DrawBackground(¶m); if (m_iCurSel >= 0) { if (!m_pListBox) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_WideString wsText; IFWL_ComboBoxDP* pData = static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); @@ -683,11 +687,12 @@ FWL_ERR CFWL_ComboBoxImp::DrawWidget(CFX_Graphics* pGraphics, param.m_rtPart = m_rtBtn; pTheme->DrawBackground(¶m); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error CFWL_ComboBoxImp::SetThemeProvider( + IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; m_pProperties->m_pThemeProvider = pThemeProvider; if (m_pListBox && pThemeProvider->IsValidWidget(m_pListBox.get())) { m_pListBox->SetThemeProvider(pThemeProvider); @@ -695,12 +700,12 @@ FWL_ERR CFWL_ComboBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { if (m_pEdit && pThemeProvider->IsValidWidget(m_pEdit.get())) { m_pEdit->SetThemeProvider(pThemeProvider); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ComboBoxImp::GetCurSel() { return m_iCurSel; } -FWL_ERR CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { +FWL_Error CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { int32_t iCount = static_cast<CFWL_ComboListImp*>(m_pListBox->GetImpl())->CountItems(); FX_BOOL bClearSel = iSel < 0 || iSel >= iCount; @@ -720,7 +725,7 @@ FWL_ERR CFWL_ComboBoxImp::SetCurSel(int32_t iSel) { m_pEdit->Update(); } m_iCurSel = bClearSel ? -1 : iSel; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { @@ -732,9 +737,9 @@ void CFWL_ComboBoxImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { CFWL_WidgetImp::SetStates(dwStates, bSet); } -FWL_ERR CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { +FWL_Error CFWL_ComboBoxImp::SetEditText(const CFX_WideString& wsText) { if (!m_pEdit) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; m_pEdit->SetText(wsText); return m_pEdit->Update(); } @@ -743,9 +748,9 @@ int32_t CFWL_ComboBoxImp::GetEditTextLength() const { return -1; return m_pEdit->GetTextLength(); } -FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { if (m_pEdit) { return m_pEdit->GetText(wsText, nStart, nCount); } else if (m_pListBox) { @@ -754,14 +759,14 @@ FWL_ERR CFWL_ComboBoxImp::GetEditText(CFX_WideString& wsText, FWL_HLISTITEM hItem = pData->GetItem(m_pInterface, m_iCurSel); return m_pListBox->GetItemText(hItem, wsText); } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } -FWL_ERR CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { +FWL_Error CFWL_ComboBoxImp::SetEditSelRange(int32_t nStart, int32_t nCount) { if (!m_pEdit) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; static_cast<CFWL_ComboEditImp*>(m_pEdit->GetImpl())->ClearSelected(); m_pEdit->AddSelRange(nStart, nCount); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ComboBoxImp::GetEditSelRange(int32_t nIndex, int32_t& nStart) { if (!m_pEdit) @@ -773,14 +778,14 @@ int32_t CFWL_ComboBoxImp::GetEditLimit() { return -1; return m_pEdit->GetLimit(); } -FWL_ERR CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) { +FWL_Error CFWL_ComboBoxImp::SetEditLimit(int32_t nLimit) { if (!m_pEdit) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pEdit->SetLimit(nLimit); } -FWL_ERR CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) { +FWL_Error CFWL_ComboBoxImp::EditDoClipboard(int32_t iCmd) { if (!m_pEdit) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pEdit->DoClipboard(iCmd); } FX_BOOL CFWL_ComboBoxImp::EditRedo(const CFX_ByteStringC& bsRecord) { @@ -807,9 +812,9 @@ FX_BOOL CFWL_ComboBoxImp::AfterFocusShowDropList() { m_bNeedShowList = FALSE; return TRUE; } -FX_ERR CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) { +FWL_Error CFWL_ComboBoxImp::OpenDropDownList(FX_BOOL bActivate) { ShowDropList(bActivate); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_ComboBoxImp::EditCanUndo() { return m_pEdit->CanUndo(); @@ -845,15 +850,15 @@ FX_BOOL CFWL_ComboBoxImp::EditPaste(const CFX_WideString& wsPaste) { return m_pEdit->Paste(wsPaste); } FX_BOOL CFWL_ComboBoxImp::EditSelectAll() { - return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded; + return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; } FX_BOOL CFWL_ComboBoxImp::EditDelete() { - return m_pEdit->ClearText() == FWL_ERR_Succeeded; + return m_pEdit->ClearText() == FWL_Error::Succeeded; } FX_BOOL CFWL_ComboBoxImp::EditDeSelect() { - return m_pEdit->ClearSelections() == FWL_ERR_Succeeded; + return m_pEdit->ClearSelections() == FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_GetBBox(rect); } @@ -864,14 +869,14 @@ FWL_ERR CFWL_ComboBoxImp::GetBBox(CFX_RectF& rect) { rtList.Offset(rect.left, rect.top); rect.Union(rtList); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_ComboBoxImp::EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (m_pEdit != NULL) { return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } else { - return FWL_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; } } FX_FLOAT CFWL_ComboBoxImp::GetListHeight() { @@ -1129,11 +1134,13 @@ void CFWL_ComboBoxImp::ProcessSelChanged(FX_BOOL bLButtonUp) { Repaint(&m_rtClient); } } + void CFWL_ComboBoxImp::InitProxyForm() { if (m_pForm) return; if (!m_pListBox) return; + CFWL_WidgetImpProperties propForm; propForm.m_pOwner = m_pInterface; propForm.m_dwStyles = FWL_WGTSTYLE_Popup; @@ -1146,18 +1153,21 @@ void CFWL_ComboBoxImp::InitProxyForm() { m_pListProxyDelegate = new CFWL_ComboProxyImpDelegate(m_pForm, this); m_pProxy->SetDelegate(m_pListProxyDelegate); } -FWL_ERR CFWL_ComboBoxImp::DisForm_Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_WGTSTATE_Invisible; // Ditto. + +FWL_Error CFWL_ComboBoxImp::DisForm_Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; + m_pDelegate = new CFWL_ComboBoxImpDelegate(this); DisForm_InitComboList(); DisForm_InitComboEdit(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + void CFWL_ComboBoxImp::DisForm_InitComboList() { - if (m_pListBox) { + if (m_pListBox) return; - } + CFWL_WidgetImpProperties prop; prop.m_pParent = m_pInterface; prop.m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll; @@ -1227,8 +1237,8 @@ void CFWL_ComboBoxImp::DisForm_ShowDropList(FX_BOOL bActivate) { FX_BOOL CFWL_ComboBoxImp::DisForm_IsDropListShowed() { return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible); } -FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (!m_pEdit) { DisForm_InitComboEdit(); } @@ -1243,16 +1253,16 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, } return CFWL_WidgetImp::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } -FWL_ERR CFWL_ComboBoxImp::DisForm_Update() { +FWL_Error CFWL_ComboBoxImp::DisForm_Update() { if (m_iLock) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (m_pEdit) { ReSetEditAlignment(); } ReSetTheme(); Layout(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rect; @@ -1269,8 +1279,8 @@ FWL_WidgetHit CFWL_ComboBoxImp::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; CFX_Matrix mtOrg; mtOrg.Set(1, 0, 0, 1, 0, 0); @@ -1306,9 +1316,9 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, mt.Concat(mtOrg); m_pListBox->DrawWidget(pGraphics, &mt); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; if (m_pListBox && DisForm_IsDropListShowed()) { CFX_RectF rtList; @@ -1316,7 +1326,7 @@ FWL_ERR CFWL_ComboBoxImp::DisForm_GetBBox(CFX_RectF& rect) { rtList.Offset(rect.left, rect.top); rect.Union(rtList); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_ComboBoxImp::DisForm_Layout() { GetClientRect(m_rtClient); @@ -1361,14 +1371,14 @@ void CFWL_ComboBoxImp::DisForm_Layout() { CFWL_ComboBoxImpDelegate::CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) - return DisForm_OnProcessMessage(pMessage); - +void CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { + if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { + DisForm_OnProcessMessage(pMessage); + return; + } if (!pMessage) - return 0; + return; - FX_BOOL iRet = 1; switch (pMessage->GetClassID()) { case CFWL_MessageType::SetFocus: { OnFocusChanged(pMessage, TRUE); @@ -1407,16 +1417,14 @@ int32_t CFWL_ComboBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { +void CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { CFWL_EventType dwFlag = pEvent->GetClassID(); if (dwFlag == CFWL_EventType::DrawItem) { CFWL_EvtLtbDrawItem* pDrawItemEvent = @@ -1444,13 +1452,13 @@ FWL_ERR CFWL_ComboBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { pTemp.nChangeType = pTextChangedEvent->nChangeType; m_pOwner->DispatchEvent(&pTemp); } - return FWL_ERR_Succeeded; } -FWL_ERR CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_ComboBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_ComboBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { IFWL_Widget* pDstTarget = pMsg->m_pDstTarget; @@ -1594,10 +1602,10 @@ void CFWL_ComboBoxImpDelegate::DoSubCtrlKey(CFWL_MsgKey* pMsg) { pDelegate->OnProcessMessage(pMsg); } } -int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( +void CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; FX_BOOL backDefault = TRUE; switch (pMessage->GetClassID()) { @@ -1652,9 +1660,8 @@ int32_t CFWL_ComboBoxImpDelegate::DisForm_OnProcessMessage( default: break; } - if (!backDefault) - return 1; - return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); + if (backDefault) + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } void CFWL_ComboBoxImpDelegate::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) { @@ -1750,9 +1757,9 @@ CFWL_ComboProxyImpDelegate::CFWL_ComboProxyImpDelegate( m_pForm(pForm), m_pComboBox(pComboBox) {} -int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; switch (pMessage->GetClassID()) { case CFWL_MessageType::Mouse: { @@ -1790,14 +1797,14 @@ int32_t CFWL_ComboProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } -FWL_ERR CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void CFWL_ComboProxyImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { m_pComboBox->DrawStretchHandler(pGraphics, pMatrix); - return FWL_ERR_Succeeded; } + void CFWL_ComboProxyImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { IFWL_App* pApp = m_pForm->GetOwnerApp(); if (!pApp) diff --git a/xfa/fwl/basewidget/fwl_comboboximp.h b/xfa/fwl/basewidget/fwl_comboboximp.h index 202ba7cae2..6fa097a4c0 100644 --- a/xfa/fwl/basewidget/fwl_comboboximp.h +++ b/xfa/fwl/basewidget/fwl_comboboximp.h @@ -44,7 +44,7 @@ class CFWL_ComboEditImp : public CFWL_EditImp { class CFWL_ComboEditImpDelegate : public CFWL_EditImpDelegate { public: CFWL_ComboEditImpDelegate(CFWL_ComboEditImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; protected: CFWL_ComboEditImp* m_pOwner; @@ -53,8 +53,8 @@ class CFWL_ComboListImp : public CFWL_ListBoxImp { public: CFWL_ComboListImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); int32_t MatchItem(const CFX_WideString& wsMatch); void ChangeSelected(int32_t iSel); int32_t CountItems(); @@ -68,7 +68,7 @@ class CFWL_ComboListImp : public CFWL_ListBoxImp { class CFWL_ComboListImpDelegate : public CFWL_ListBoxImpDelegate { public: CFWL_ComboListImpDelegate(CFWL_ComboListImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; protected: void OnDropListFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); @@ -84,36 +84,36 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { CFWL_ComboBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_ComboBoxImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - virtual FWL_ERR Update(); + virtual FWL_Error Update(); virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); virtual int32_t GetCurSel(); - virtual FWL_ERR SetCurSel(int32_t iSel); - virtual FWL_ERR SetEditText(const CFX_WideString& wsText); + virtual FWL_Error SetCurSel(int32_t iSel); + virtual FWL_Error SetEditText(const CFX_WideString& wsText); virtual int32_t GetEditTextLength() const; - virtual FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - virtual FWL_ERR SetEditSelRange(int32_t nStart, int32_t nCount = -1); + virtual FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + virtual FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); virtual int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); virtual int32_t GetEditLimit(); - virtual FWL_ERR SetEditLimit(int32_t nLimit); - virtual FWL_ERR EditDoClipboard(int32_t iCmd); + virtual FWL_Error SetEditLimit(int32_t nLimit); + virtual FWL_Error EditDoClipboard(int32_t iCmd); virtual FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); virtual FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); virtual IFWL_ListBox* GetListBoxt(); virtual FX_BOOL AfterFocusShowDropList(); - virtual FX_ERR OpenDropDownList(FX_BOOL bActivate); + virtual FWL_Error OpenDropDownList(FX_BOOL bActivate); virtual FX_BOOL EditCanUndo(); virtual FX_BOOL EditCanRedo(); virtual FX_BOOL EditUndo(); @@ -127,9 +127,9 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { virtual FX_BOOL EditSelectAll(); virtual FX_BOOL EditDelete(); virtual FX_BOOL EditDeSelect(); - virtual FWL_ERR GetBBox(CFX_RectF& rect); - virtual FWL_ERR EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + virtual FWL_Error GetBBox(CFX_RectF& rect); + virtual FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); protected: void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); @@ -145,18 +145,18 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { void ReSetListItemAlignment(); void ProcessSelChanged(FX_BOOL bLButtonUp); void InitProxyForm(); - FWL_ERR DisForm_Initialize(); + FWL_Error DisForm_Initialize(); void DisForm_InitComboList(); void DisForm_InitComboEdit(); void DisForm_ShowDropList(FX_BOOL bActivate); FX_BOOL DisForm_IsDropListShowed(); - FWL_ERR DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); - FWL_ERR DisForm_Update(); + FWL_Error DisForm_ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); + FWL_Error DisForm_Update(); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); - FWL_ERR DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - FWL_ERR DisForm_GetBBox(CFX_RectF& rect); + FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); + FWL_Error DisForm_GetBBox(CFX_RectF& rect); void DisForm_Layout(); CFX_RectF m_rtClient; @@ -188,10 +188,10 @@ class CFWL_ComboBoxImp : public CFWL_WidgetImp { class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ComboBoxImpDelegate(CFWL_ComboBoxImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); @@ -203,7 +203,7 @@ class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { void DoSubCtrlKey(CFWL_MsgKey* pMsg); protected: - int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); + void DisForm_OnProcessMessage(CFWL_Message* pMessage); void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); void DisForm_OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); void DisForm_OnKey(CFWL_MsgKey* pMsg); @@ -216,9 +216,9 @@ class CFWL_ComboBoxImpDelegate : public CFWL_WidgetImpDelegate { class CFWL_ComboProxyImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ComboProxyImpDelegate(IFWL_Form* pForm, CFWL_ComboBoxImp* pComboBox); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; void Reset() { m_bLButtonUpSelf = FALSE; } protected: diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp index 7cefdc3477..e65b5bfb3d 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.cpp @@ -83,24 +83,24 @@ int32_t IFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { ->GetDataTimeEdit() ->GetSelRange(nIndex, nStart); } -FWL_ERR IFWL_DateTimePicker::GetCurSel(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +FWL_Error IFWL_DateTimePicker::GetCurSel(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) ->GetCurSel(iYear, iMonth, iDay); } -FWL_ERR IFWL_DateTimePicker::SetCurSel(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +FWL_Error IFWL_DateTimePicker::SetCurSel(int32_t iYear, + int32_t iMonth, + int32_t iDay) { return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) ->SetCurSel(iYear, iMonth, iDay); } -FWL_ERR IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { +FWL_Error IFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SetEditText(wsText); } -FWL_ERR IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error IFWL_DateTimePicker::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) ->GetEditText(wsText, nStart, nCount); } @@ -143,27 +143,27 @@ FX_BOOL IFWL_DateTimePicker::Delete() { FX_BOOL IFWL_DateTimePicker::DeSelect() { return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->DeSelect(); } -FWL_ERR IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { +FWL_Error IFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->GetBBox(rect); } -FWL_ERR IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { +FWL_Error IFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { return static_cast<CFWL_DateTimePickerImp*>(GetImpl())->SetEditLimit(nLimit); } -FWL_ERR IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error IFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return static_cast<CFWL_DateTimePickerImp*>(GetImpl()) ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); } CFWL_DateTimeEdit::CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_EditImp(properties, pOuter) {} -FWL_ERR CFWL_DateTimeEdit::Initialize() { +FWL_Error CFWL_DateTimeEdit::Initialize() { m_pDelegate = new CFWL_DateTimeEditImpDelegate(this); - if (CFWL_EditImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; - return FWL_ERR_Succeeded; + if (CFWL_EditImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimeEdit::Finalize() { +FWL_Error CFWL_DateTimeEdit::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_EditImp::Finalize(); @@ -173,9 +173,11 @@ CFWL_DateTimeEditImpDelegate::CFWL_DateTimeEditImpDelegate( CFWL_DateTimeEdit* pOwner) : CFWL_EditImpDelegate(pOwner), m_pOwner(pOwner) {} -int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) - return DisForm_OnProcessMessage(pMessage); +void CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { + if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { + DisForm_OnProcessMessage(pMessage); + return; + } CFWL_MessageType dwHashCode = pMessage->GetClassID(); if (dwHashCode == CFWL_MessageType::SetFocus || @@ -184,10 +186,9 @@ int32_t CFWL_DateTimeEditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); pDelegate->OnProcessMessage(pMessage); } - return 1; } -int32_t CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( +void CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { CFWL_MessageType dwHashCode = pMessage->GetClassID(); if (m_pOwner->m_pWidgetMgr->IsFormDisabled()) { @@ -208,25 +209,23 @@ int32_t CFWL_DateTimeEditImpDelegate::DisForm_OnProcessMessage( pDateTime->Repaint(&rtInvalidate); } } - } else if (dwHashCode == CFWL_MessageType::Key) { - return CFWL_EditImpDelegate::OnProcessMessage(pMessage); } } - return CFWL_EditImpDelegate::OnProcessMessage(pMessage); + CFWL_EditImpDelegate::OnProcessMessage(pMessage); } CFWL_DateTimeCalendar::CFWL_DateTimeCalendar( const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_MonthCalendarImp(properties, pOuter) {} -FWL_ERR CFWL_DateTimeCalendar::Initialize() { - if (CFWL_MonthCalendarImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_DateTimeCalendar::Initialize() { + if (CFWL_MonthCalendarImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; delete m_pDelegate; m_pDelegate = new CFWL_DateTimeCalendarImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimeCalendar::Finalize() { +FWL_Error CFWL_DateTimeCalendar::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_MonthCalendarImp::Finalize(); @@ -238,25 +237,25 @@ CFWL_DateTimeCalendarImpDelegate::CFWL_DateTimeCalendarImpDelegate( m_bFlag = FALSE; } -int32_t CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( +void CFWL_DateTimeCalendarImpDelegate::OnProcessMessage( CFWL_Message* pMessage) { CFWL_MessageType dwCode = pMessage->GetClassID(); if (dwCode == CFWL_MessageType::SetFocus || dwCode == CFWL_MessageType::KillFocus) { IFWL_Widget* pOuter = m_pOwner->GetOuter(); IFWL_WidgetDelegate* pDelegate = pOuter->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMessage); - } else if (dwCode == CFWL_MessageType::Mouse) { + pDelegate->OnProcessMessage(pMessage); + return; + } + if (dwCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); - if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) { + if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) OnLButtonDownEx(pMsg); - return 1; - } else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { + else if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) OnLButtonUpEx(pMsg); - return 1; - } + return; } - return CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); + CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); } void CFWL_DateTimeCalendarImpDelegate::OnLButtonDownEx(CFWL_MsgMouse* pMsg) { @@ -375,16 +374,16 @@ void CFWL_DateTimeCalendarImpDelegate::OnMouseMoveEx(CFWL_MsgMouse* pMsg) { } } -int32_t CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage( +void CFWL_DateTimeCalendarImpDelegate::DisForm_OnProcessMessage( CFWL_Message* pMessage) { if (pMessage->GetClassID() == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); if (pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { DisForm_OnLButtonUpEx(pMsg); - return 1; + return; } } - return CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); + CFWL_MonthCalendarImpDelegate::OnProcessMessage(pMessage); } void CFWL_DateTimeCalendarImpDelegate::DisForm_OnLButtonUpEx( @@ -437,16 +436,16 @@ CFWL_DateTimePickerImp::CFWL_DateTimePickerImp( m_rtBtn.Set(0, 0, 0, 0); } CFWL_DateTimePickerImp::~CFWL_DateTimePickerImp() {} -FWL_ERR CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_DateTimePickerImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_DateTimePicker; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_DateTimePickerImp::GetClassID() const { return FWL_CLASSHASH_DateTimePicker; } -FWL_ERR CFWL_DateTimePickerImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_DateTimePickerImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_DateTimePickerImpDelegate(this); m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; CFWL_WidgetImpProperties propMonth; @@ -468,9 +467,9 @@ FWL_ERR CFWL_DateTimePickerImp::Initialize() { m_pEdit->Initialize(); RegisterEventTarget(m_pMonthCal.get()); RegisterEventTarget(m_pEdit.get()); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::Finalize() { +FWL_Error CFWL_DateTimePickerImp::Finalize() { if (m_pEdit) { m_pEdit->Finalize(); } @@ -485,8 +484,8 @@ FWL_ERR CFWL_DateTimePickerImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { +FWL_Error CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_GetWidgetRect(rect, bAutoSize); } @@ -496,14 +495,14 @@ FWL_ERR CFWL_DateTimePickerImp::GetWidgetRect(CFX_RectF& rect, } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::Update() { +FWL_Error CFWL_DateTimePickerImp::Update() { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_Update(); } if (m_iLock) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -513,7 +512,7 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pFWidth) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; FX_FLOAT fBtn = *pFWidth; m_rtBtn.Set(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1, m_rtClient.height - 1); @@ -539,7 +538,7 @@ FWL_ERR CFWL_DateTimePickerImp::Update() { rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_pWidgetMgr->IsFormDisabled()) @@ -554,12 +553,12 @@ FWL_WidgetHit CFWL_DateTimePickerImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -573,53 +572,56 @@ FWL_ERR CFWL_DateTimePickerImp::DrawWidget(CFX_Graphics* pGraphics, if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_DrawWidget(pGraphics, pMatrix); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::SetThemeProvider(IFWL_ThemeProvider* pTP) { +FWL_Error CFWL_DateTimePickerImp::SetThemeProvider(IFWL_ThemeProvider* pTP) { m_pProperties->m_pThemeProvider = pTP; m_pMonthCal->SetThemeProvider(pTP); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::GetCurSel(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +FWL_Error CFWL_DateTimePickerImp::GetCurSel(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { iYear = m_iYear; iMonth = m_iMonth; iDay = m_iDay; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::SetCurSel(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +FWL_Error CFWL_DateTimePickerImp::SetCurSel(int32_t iYear, + int32_t iMonth, + int32_t iDay) { if (iYear <= 0 || iYear >= 3000) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (iMonth <= 0 || iMonth >= 13) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (iDay <= 0 || iDay >= 32) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; m_iYear = iYear; m_iMonth = iMonth; m_iDay = iDay; m_pMonthCal->SetSelect(iYear, iMonth, iDay); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) { + +FWL_Error CFWL_DateTimePickerImp::SetEditText(const CFX_WideString& wsText) { if (!m_pEdit) - return FWL_ERR_Indefinite; - int32_t iRet = m_pEdit->SetText(wsText); + return FWL_Error::Indefinite; + + FWL_Error iRet = m_pEdit->SetText(wsText); Repaint(&m_rtClient); CFWL_Event_DtpEditChanged ev; ev.m_wsText = wsText; DispatchEvent(&ev); return iRet; } -FWL_ERR CFWL_DateTimePickerImp::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { + +FWL_Error CFWL_DateTimePickerImp::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { if (m_pEdit) { return m_pEdit->GetText(wsText, nStart, nCount); } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } FX_BOOL CFWL_DateTimePickerImp::CanUndo() { return m_pEdit->CanUndo(); @@ -657,15 +659,15 @@ FX_BOOL CFWL_DateTimePickerImp::Paste(const CFX_WideString& wsPaste) { return m_pEdit->Paste(wsPaste); } FX_BOOL CFWL_DateTimePickerImp::SelectAll() { - return m_pEdit->AddSelRange(0) == FWL_ERR_Succeeded; + return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; } FX_BOOL CFWL_DateTimePickerImp::Delete() { - return m_pEdit->ClearText() == FWL_ERR_Succeeded; + return m_pEdit->ClearText() == FWL_Error::Succeeded; } FX_BOOL CFWL_DateTimePickerImp::DeSelect() { - return m_pEdit->ClearSelections() == FWL_ERR_Succeeded; + return m_pEdit->ClearSelections() == FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) { if (m_pWidgetMgr->IsFormDisabled()) { return DisForm_GetBBox(rect); } @@ -677,13 +679,14 @@ FWL_ERR CFWL_DateTimePickerImp::GetBBox(CFX_RectF& rect) { m_pProperties->m_rtWidget.top); rect.Union(rtMonth); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::SetEditLimit(int32_t nLimit) { +FWL_Error CFWL_DateTimePickerImp::SetEditLimit(int32_t nLimit) { return m_pEdit->SetLimit(nLimit); } -FWL_ERR CFWL_DateTimePickerImp::ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_DateTimePickerImp::ModifyEditStylesEx( + uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return m_pEdit->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } void CFWL_DateTimePickerImp::DrawDropDownButton(CFX_Graphics* pGraphics, @@ -830,13 +833,13 @@ void CFWL_DateTimePickerImp::InitProxyForm() { IFWL_DateTimeEdit* CFWL_DateTimePickerImp::GetDataTimeEdit() { return m_pEdit.get(); } -FWL_ERR CFWL_DateTimePickerImp::DisForm_Initialize() { +FWL_Error CFWL_DateTimePickerImp::DisForm_Initialize() { m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat; DisForm_InitDateTimeCalendar(); DisForm_InitDateTimeEdit(); RegisterEventTarget(m_pMonthCal.get()); RegisterEventTarget(m_pEdit.get()); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_DateTimePickerImp::DisForm_InitDateTimeCalendar() { if (m_pMonthCal) { @@ -932,21 +935,21 @@ FX_BOOL CFWL_DateTimePickerImp::DisForm_IsNeedShowButton() { m_pEdit->GetStates() & FWL_WGTSTATE_Focused; return bFocus; } -FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { - if (m_iLock) { - return FWL_ERR_Indefinite; - } - if (!m_pProperties->m_pThemeProvider) { + +FWL_Error CFWL_DateTimePickerImp::DisForm_Update() { + if (m_iLock) + return FWL_Error::Indefinite; + if (!m_pProperties->m_pThemeProvider) m_pProperties->m_pThemeProvider = GetAvailableTheme(); - } + m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider); GetClientRect(m_rtClient); m_pEdit->SetWidgetRect(m_rtClient); ReSetEditAlignment(); m_pEdit->Update(); - if (m_pMonthCal->GetThemeProvider() == NULL) { + if (!m_pMonthCal->GetThemeProvider()) m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider); - } + if (m_pProperties->m_pDataProvider) { IFWL_DateTimePickerDP* pData = static_cast<IFWL_DateTimePickerDP*>(m_pProperties->m_pDataProvider); @@ -956,7 +959,8 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { FX_FLOAT* pWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pWidth) - return 0; + return FWL_Error::Succeeded; + m_fBtn = *pWidth; CFX_RectF rtMonthCal; m_pMonthCal->GetWidgetRect(rtMonthCal, TRUE); @@ -965,17 +969,18 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_Update() { rtMonthCal.width, rtMonthCal.height); m_pMonthCal->SetWidgetRect(rtPopUp); m_pMonthCal->Update(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::DisForm_GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { + +FWL_Error CFWL_DateTimePickerImp::DisForm_GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { rect = m_pProperties->m_rtWidget; if (DisForm_IsNeedShowButton()) { rect.width += m_fBtn; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; if (DisForm_IsNeedShowButton()) { rect.width += m_fBtn; @@ -987,12 +992,13 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_GetBBox(CFX_RectF& rect) { m_pProperties->m_rtWidget.top); rect.Union(rtMonth); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePickerImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_DateTimePickerImp::DisForm_DrawWidget( + CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_pEdit) { CFX_RectF rtEdit; m_pEdit->GetWidgetRect(rtEdit); @@ -1013,17 +1019,16 @@ FWL_ERR CFWL_DateTimePickerImp::DisForm_DrawWidget(CFX_Graphics* pGraphics, } m_pMonthCal->DrawWidget(pGraphics, &mt); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_DateTimePickerImpDelegate::CFWL_DateTimePickerImpDelegate( CFWL_DateTimePickerImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( - CFWL_Message* pMessage) { +void CFWL_DateTimePickerImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; switch (pMessage->GetClassID()) { case CFWL_MessageType::SetFocus: { @@ -1061,7 +1066,8 @@ int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( case CFWL_MessageType::Key: { if (m_pOwner->m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pEdit->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMessage); + pDelegate->OnProcessMessage(pMessage); + return; } break; } @@ -1069,14 +1075,14 @@ int32_t CFWL_DateTimePickerImpDelegate::OnProcessMessage( break; } - return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } -FWL_ERR CFWL_DateTimePickerImpDelegate::OnDrawWidget( - CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_DateTimePickerImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_DateTimePickerImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (!pMsg) diff --git a/xfa/fwl/basewidget/fwl_datetimepickerimp.h b/xfa/fwl/basewidget/fwl_datetimepickerimp.h index 7276928332..3fd86bed05 100644 --- a/xfa/fwl/basewidget/fwl_datetimepickerimp.h +++ b/xfa/fwl/basewidget/fwl_datetimepickerimp.h @@ -58,8 +58,8 @@ class CFWL_DateTimeEdit : public CFWL_EditImp { public: CFWL_DateTimeEdit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); protected: friend class CFWL_DateTimeEditImpDelegate; @@ -67,10 +67,10 @@ class CFWL_DateTimeEdit : public CFWL_EditImp { class CFWL_DateTimeEditImpDelegate : public CFWL_EditImpDelegate { public: CFWL_DateTimeEditImpDelegate(CFWL_DateTimeEdit* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; private: - int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); + void DisForm_OnProcessMessage(CFWL_Message* pMessage); protected: CFWL_DateTimeEdit* m_pOwner; @@ -79,8 +79,8 @@ class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { public: CFWL_DateTimeCalendar(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); protected: friend class CFWL_DateTimeCalendarImpDelegate; @@ -88,14 +88,14 @@ class CFWL_DateTimeCalendar : public CFWL_MonthCalendarImp { class CFWL_DateTimeCalendarImpDelegate : public CFWL_MonthCalendarImpDelegate { public: CFWL_DateTimeCalendarImpDelegate(CFWL_DateTimeCalendar* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; void OnLButtonDownEx(CFWL_MsgMouse* pMsg); void OnLButtonUpEx(CFWL_MsgMouse* pMsg); void OnMouseMoveEx(CFWL_MsgMouse* pMsg); private: - int32_t DisForm_OnProcessMessage(CFWL_Message* pMessage); + void DisForm_OnProcessMessage(CFWL_Message* pMessage); void DisForm_OnLButtonUpEx(CFWL_MsgMouse* pMsg); protected: @@ -107,22 +107,22 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { CFWL_DateTimePickerImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_DateTimePickerImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pTP); - virtual FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - virtual FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); - virtual FWL_ERR SetEditText(const CFX_WideString& wsText); - virtual FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pTP); + virtual FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); + virtual FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); + virtual FWL_Error SetEditText(const CFX_WideString& wsText); + virtual FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; public: virtual FX_BOOL CanUndo(); @@ -138,10 +138,10 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { virtual FX_BOOL SelectAll(); virtual FX_BOOL Delete(); virtual FX_BOOL DeSelect(); - virtual FWL_ERR GetBBox(CFX_RectF& rect); - virtual FWL_ERR SetEditLimit(int32_t nLimit); - virtual FWL_ERR ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + virtual FWL_Error GetBBox(CFX_RectF& rect); + virtual FWL_Error SetEditLimit(int32_t nLimit); + virtual FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); public: IFWL_DateTimeEdit* GetDataTimeEdit(); @@ -161,18 +161,18 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { void ProcessSelChanged(int32_t iYear, int32_t iMonth, int32_t iDay); private: - FWL_ERR DisForm_Initialize(); + FWL_Error DisForm_Initialize(); void DisForm_InitDateTimeCalendar(); void DisForm_InitDateTimeEdit(); FX_BOOL DisForm_IsMonthCalendarShowed(); void DisForm_ShowMonthCalendar(FX_BOOL bActivate); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); FX_BOOL DisForm_IsNeedShowButton(); - FWL_ERR DisForm_Update(); - FWL_ERR DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - FWL_ERR DisForm_GetBBox(CFX_RectF& rect); - FWL_ERR DisForm_DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + FWL_Error DisForm_Update(); + FWL_Error DisForm_GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + FWL_Error DisForm_GetBBox(CFX_RectF& rect); + FWL_Error DisForm_DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: CFX_RectF m_rtBtn; @@ -193,9 +193,9 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { m_iCurMonth = 3; m_iCurDay = 29; } - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_ERR_Succeeded; + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { + return FWL_Error::Succeeded; } virtual int32_t GetCurDay(IFWL_Widget* pWidget) { return m_iCurDay; } virtual int32_t GetCurMonth(IFWL_Widget* pWidget) { return m_iCurMonth; } @@ -214,9 +214,9 @@ class CFWL_DateTimePickerImp : public CFWL_WidgetImp { class CFWL_DateTimePickerImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_DateTimePickerImpDelegate(CFWL_DateTimePickerImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp index bf4f911ea8..563519a475 100644 --- a/xfa/fwl/basewidget/fwl_editimp.cpp +++ b/xfa/fwl/basewidget/fwl_editimp.cpp @@ -74,18 +74,18 @@ IFWL_Edit* IFWL_Edit::CreateComboEdit( return pEdit; } IFWL_Edit::IFWL_Edit() {} -FWL_ERR IFWL_Edit::SetText(const CFX_WideString& wsText) { +FWL_Error IFWL_Edit::SetText(const CFX_WideString& wsText) { return static_cast<CFWL_EditImp*>(GetImpl())->SetText(wsText); } int32_t IFWL_Edit::GetTextLength() const { return static_cast<CFWL_EditImp*>(GetImpl())->GetTextLength(); } -FWL_ERR IFWL_Edit::GetText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error IFWL_Edit::GetText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { return static_cast<CFWL_EditImp*>(GetImpl())->GetText(wsText, nStart, nCount); } -FWL_ERR IFWL_Edit::ClearText() { +FWL_Error IFWL_Edit::ClearText() { return static_cast<CFWL_EditImp*>(GetImpl())->ClearText(); } int32_t IFWL_Edit::GetCaretPos() const { @@ -94,7 +94,7 @@ int32_t IFWL_Edit::GetCaretPos() const { int32_t IFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { return static_cast<CFWL_EditImp*>(GetImpl())->SetCaretPos(nIndex, bBefore); } -FWL_ERR IFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { +FWL_Error IFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { return static_cast<CFWL_EditImp*>(GetImpl())->AddSelRange(nStart, nCount); } int32_t IFWL_Edit::CountSelRanges() { @@ -103,39 +103,39 @@ int32_t IFWL_Edit::CountSelRanges() { int32_t IFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) { return static_cast<CFWL_EditImp*>(GetImpl())->GetSelRange(nIndex, nStart); } -FWL_ERR IFWL_Edit::ClearSelections() { +FWL_Error IFWL_Edit::ClearSelections() { return static_cast<CFWL_EditImp*>(GetImpl())->ClearSelections(); } int32_t IFWL_Edit::GetLimit() { return static_cast<CFWL_EditImp*>(GetImpl())->GetLimit(); } -FWL_ERR IFWL_Edit::SetLimit(int32_t nLimit) { +FWL_Error IFWL_Edit::SetLimit(int32_t nLimit) { return static_cast<CFWL_EditImp*>(GetImpl())->SetLimit(nLimit); } -FWL_ERR IFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { +FWL_Error IFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { return static_cast<CFWL_EditImp*>(GetImpl())->SetAliasChar(wAlias); } -FWL_ERR IFWL_Edit::Insert(int32_t nStart, - const FX_WCHAR* lpText, - int32_t nLen) { +FWL_Error IFWL_Edit::Insert(int32_t nStart, + const FX_WCHAR* lpText, + int32_t nLen) { return static_cast<CFWL_EditImp*>(GetImpl())->Insert(nStart, lpText, nLen); } -FWL_ERR IFWL_Edit::DeleteSelections() { +FWL_Error IFWL_Edit::DeleteSelections() { return static_cast<CFWL_EditImp*>(GetImpl())->DeleteSelections(); } -FWL_ERR IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { +FWL_Error IFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { return static_cast<CFWL_EditImp*>(GetImpl())->DeleteRange(nStart, nCount); } -FWL_ERR IFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) { +FWL_Error IFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) { return static_cast<CFWL_EditImp*>(GetImpl())->ReplaceSelections(wsReplace); } -FWL_ERR IFWL_Edit::Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace) { +FWL_Error IFWL_Edit::Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace) { return static_cast<CFWL_EditImp*>(GetImpl()) ->Replace(nStart, nLen, wsReplace); } -FWL_ERR IFWL_Edit::DoClipboard(int32_t iCmd) { +FWL_Error IFWL_Edit::DoClipboard(int32_t iCmd) { return static_cast<CFWL_EditImp*>(GetImpl())->DoClipboard(iCmd); } FX_BOOL IFWL_Edit::Copy(CFX_WideString& wsCopy) { @@ -168,20 +168,20 @@ FX_BOOL IFWL_Edit::CanUndo() { FX_BOOL IFWL_Edit::CanRedo() { return static_cast<CFWL_EditImp*>(GetImpl())->CanRedo(); } -FWL_ERR IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { +FWL_Error IFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { return static_cast<CFWL_EditImp*>(GetImpl()) ->SetTabWidth(fTabWidth, bEquidistant); } -FWL_ERR IFWL_Edit::SetOuter(IFWL_Widget* pOuter) { +FWL_Error IFWL_Edit::SetOuter(IFWL_Widget* pOuter) { return static_cast<CFWL_EditImp*>(GetImpl())->SetOuter(pOuter); } -FWL_ERR IFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { +FWL_Error IFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { return static_cast<CFWL_EditImp*>(GetImpl())->SetNumberRange(iMin, iMax); } -FWL_ERR IFWL_Edit::SetBackColor(uint32_t dwColor) { +FWL_Error IFWL_Edit::SetBackColor(uint32_t dwColor) { return static_cast<CFWL_EditImp*>(GetImpl())->SetBackgroundColor(dwColor); } -FWL_ERR IFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { +FWL_Error IFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { return static_cast<CFWL_EditImp*>(GetImpl())->SetFont(wsFont, fSize); } void IFWL_Edit::SetScrollOffset(FX_FLOAT fScrollOffset) { @@ -229,16 +229,16 @@ CFWL_EditImp::~CFWL_EditImp() { } ClearRecord(); } -FWL_ERR CFWL_EditImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_EditImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Edit; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_EditImp::GetClassID() const { return FWL_CLASSHASH_Edit; } -FWL_ERR CFWL_EditImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_EditImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; if (!m_pDelegate) { m_pDelegate = new CFWL_EditImpDelegate(this); } @@ -246,9 +246,9 @@ FWL_ERR CFWL_EditImp::Initialize() { if (!m_pEdtEngine) { InitEngine(); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::Finalize() { +FWL_Error CFWL_EditImp::Finalize() { if (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) { ShowCaret(FALSE); } @@ -262,7 +262,7 @@ FWL_ERR CFWL_EditImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (m_pEdtEngine) { @@ -294,7 +294,7 @@ FWL_ERR CFWL_EditImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } } } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_EditImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { @@ -305,25 +305,25 @@ void CFWL_EditImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { CFWL_WidgetImp::SetStates(dwStates, bSet); } -FWL_ERR CFWL_EditImp::SetWidgetRect(const CFX_RectF& rect) { +FWL_Error CFWL_EditImp::SetWidgetRect(const CFX_RectF& rect) { return CFWL_WidgetImp::SetWidgetRect(rect); } -FWL_ERR CFWL_EditImp::Update() { +FWL_Error CFWL_EditImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } Layout(); if (m_rtClient.IsEmpty()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } UpdateEditEngine(); UpdateVAlignment(); UpdateScroll(); InitCaret(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_EditImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { @@ -492,14 +492,14 @@ void CFWL_EditImp::DrawSpellCheck(CFX_Graphics* pGraphics, } pGraphics->RestoreGraphState(); } -FWL_ERR CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_rtClient.IsEmpty()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (!m_pWidgetMgr->IsFormDisabled()) { @@ -518,11 +518,11 @@ FWL_ERR CFWL_EditImp::DrawWidget(CFX_Graphics* pGraphics, if (HasEdge()) { DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_pHorzScrollBar) { m_pHorzScrollBar->SetThemeProvider(pThemeProvider); } @@ -533,142 +533,173 @@ FWL_ERR CFWL_EditImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pCaret->SetThemeProvider(pThemeProvider); } m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetText(const CFX_WideString& wsText) { + +FWL_Error CFWL_EditImp::SetText(const CFX_WideString& wsText) { m_pEdtEngine->SetText(wsText); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + int32_t CFWL_EditImp::GetTextLength() const { if (!m_pEdtEngine) return -1; return m_pEdtEngine->GetTextLength(); } -FWL_ERR CFWL_EditImp::GetText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { + +FWL_Error CFWL_EditImp::GetText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->GetText(wsText, nStart, nCount); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::ClearText() { + +FWL_Error CFWL_EditImp::ClearText() { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->ClearText(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + int32_t CFWL_EditImp::GetCaretPos() const { if (!m_pEdtEngine) return -1; return m_pEdtEngine->GetCaretPos(); } + int32_t CFWL_EditImp::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { if (!m_pEdtEngine) return -1; return m_pEdtEngine->SetCaretPos(nIndex, bBefore); } -FWL_ERR CFWL_EditImp::AddSelRange(int32_t nStart, int32_t nCount) { + +FWL_Error CFWL_EditImp::AddSelRange(int32_t nStart, int32_t nCount) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->AddSelRange(nStart, nCount); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + int32_t CFWL_EditImp::CountSelRanges() { if (!m_pEdtEngine) return 0; return m_pEdtEngine->CountSelRanges(); - return FWL_ERR_Succeeded; } + int32_t CFWL_EditImp::GetSelRange(int32_t nIndex, int32_t& nStart) { if (!m_pEdtEngine) return -1; return m_pEdtEngine->GetSelRange(nIndex, nStart); } -FWL_ERR CFWL_EditImp::ClearSelections() { + +FWL_Error CFWL_EditImp::ClearSelections() { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->ClearSelection(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + int32_t CFWL_EditImp::GetLimit() { return m_nLimit; } -FWL_ERR CFWL_EditImp::SetLimit(int32_t nLimit) { + +FWL_Error CFWL_EditImp::SetLimit(int32_t nLimit) { m_nLimit = nLimit; if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->SetLimit(nLimit); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetAliasChar(FX_WCHAR wAlias) { + +FWL_Error CFWL_EditImp::SetAliasChar(FX_WCHAR wAlias) { if (!m_pEdtEngine) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + m_pEdtEngine->SetAliasChar(wAlias); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::Insert(int32_t nStart, - const FX_WCHAR* lpText, - int32_t nLen) { + +FWL_Error CFWL_EditImp::Insert(int32_t nStart, + const FX_WCHAR* lpText, + int32_t nLen) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) || (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } m_pEdtEngine->Insert(nStart, lpText, nLen); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::DeleteSelections() { + +FWL_Error CFWL_EditImp::DeleteSelections() { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + int32_t iCount = m_pEdtEngine->CountSelRanges(); - if (iCount > 0) { + if (iCount > 0) m_pEdtEngine->Delete(-1); - } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) { + +FWL_Error CFWL_EditImp::DeleteRange(int32_t nStart, int32_t nCount) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->DeleteRange(nStart, nCount); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::ReplaceSelections(const CFX_WideStringC& wsReplace) { + +FWL_Error CFWL_EditImp::ReplaceSelections(const CFX_WideStringC& wsReplace) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + int32_t iCount = m_pEdtEngine->CountSelRanges(); for (int i = 0; i < iCount; i++) { int32_t nStart; int32_t nCount = m_pEdtEngine->GetSelRange(i, nStart); m_pEdtEngine->Replace(nStart, nCount, wsReplace); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace) { + +FWL_Error CFWL_EditImp::Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + m_pEdtEngine->Replace(nStart, nLen, wsReplace); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::DoClipboard(int32_t iCmd) { + +FWL_Error CFWL_EditImp::DoClipboard(int32_t iCmd) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ReadOnly) || (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } + FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { if (!m_pEdtEngine) return FALSE; + int32_t nCount = m_pEdtEngine->CountSelRanges(); - if (nCount == 0) { + if (nCount == 0) return FALSE; - } + wsCopy.clear(); CFX_WideString wsTemp; int32_t nStart, nLength; @@ -680,13 +711,15 @@ FX_BOOL CFWL_EditImp::Copy(CFX_WideString& wsCopy) { } return TRUE; } + FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) { if (!m_pEdtEngine) return FALSE; + int32_t nCount = m_pEdtEngine->CountSelRanges(); - if (nCount == 0) { + if (nCount == 0) return FALSE; - } + wsCut.clear(); CFX_WideString wsTemp; int32_t nStart, nLength; @@ -699,9 +732,11 @@ FX_BOOL CFWL_EditImp::Cut(CFX_WideString& wsCut) { m_pEdtEngine->Delete(0); return TRUE; } + FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) { if (!m_pEdtEngine) return FALSE; + int32_t nCaret = m_pEdtEngine->GetCaretPos(); int32_t iError = m_pEdtEngine->Insert(nCaret, wsPaste.c_str(), wsPaste.GetLength()); @@ -711,79 +746,89 @@ FX_BOOL CFWL_EditImp::Paste(const CFX_WideString& wsPaste) { } return TRUE; } + FX_BOOL CFWL_EditImp::Delete() { if (!m_pEdtEngine) return FALSE; + int32_t nCount = m_pEdtEngine->CountSelRanges(); - if (nCount < 1) { + if (nCount < 1) return FALSE; - } + m_pEdtEngine->Delete(0); return TRUE; } + FX_BOOL CFWL_EditImp::Redo(const CFX_ByteStringC& bsRecord) { if (!m_pEdtEngine) return FALSE; - if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) { + if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) return TRUE; - } return m_pEdtEngine->Redo(bsRecord); } + FX_BOOL CFWL_EditImp::Undo(const CFX_ByteStringC& bsRecord) { if (!m_pEdtEngine) return FALSE; - if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) { + if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_NoRedoUndo) return TRUE; - } return m_pEdtEngine->Undo(bsRecord); } + FX_BOOL CFWL_EditImp::Undo() { - if (!CanUndo()) { + if (!CanUndo()) return FALSE; - } + CFX_ByteString bsRecord = m_RecordArr[m_iCurRecord--]; return Undo(bsRecord.AsStringC()); } + FX_BOOL CFWL_EditImp::Redo() { - if (!CanRedo()) { + if (!CanRedo()) return FALSE; - } + CFX_ByteString bsRecord = m_RecordArr[++m_iCurRecord]; return Redo(bsRecord.AsStringC()); } + FX_BOOL CFWL_EditImp::CanUndo() { return m_iCurRecord >= 0; } + FX_BOOL CFWL_EditImp::CanRedo() { return m_iCurRecord < m_RecordArr.GetSize() - 1; } -FWL_ERR CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { + +FWL_Error CFWL_EditImp::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { if (!m_pEdtEngine) - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + FDE_TXTEDTPARAMS* pParams = m_pEdtEngine->GetEditParams(); pParams->fTabWidth = fTabWidth; pParams->bTabEquidistant = bEquidistant; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetOuter(IFWL_Widget* pOuter) { + +FWL_Error CFWL_EditImp::SetOuter(IFWL_Widget* pOuter) { m_pOuter = pOuter; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetNumberRange(int32_t iMin, int32_t iMax) { + +FWL_Error CFWL_EditImp::SetNumberRange(int32_t iMin, int32_t iMax) { m_iMin = iMin; m_iMax = iMax; m_bSetRange = TRUE; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + void CFWL_EditImp::On_CaretChanged(CFDE_TxtEdtEngine* pEdit, int32_t nPage, FX_BOOL bVisible) { - if (m_rtEngine.IsEmpty()) { + if (m_rtEngine.IsEmpty()) return; - } - if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) { + if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0) return; - } + FX_BOOL bRepaintContent = UpdateOffset(); UpdateCaret(); CFX_RectF rtInvalid; @@ -803,12 +848,13 @@ void CFWL_EditImp::On_CaretChanged(CFDE_TxtEdtEngine* pEdit, Repaint(&rtInvalid); } } + void CFWL_EditImp::On_TextChanged(CFDE_TxtEdtEngine* pEdit, FDE_TXTEDT_TEXTCHANGE_INFO& ChangeInfo) { uint32_t dwStyleEx = m_pProperties->m_dwStyleExes; - if (dwStyleEx & FWL_STYLEEXT_EDT_VAlignMask) { + if (dwStyleEx & FWL_STYLEEXT_EDT_VAlignMask) UpdateVAlignment(); - } + IFDE_TxtEdtPage* page = m_pEdtEngine->GetPage(0); FX_FLOAT fContentWidth = page->GetContentsBox().width; FX_FLOAT fContentHeight = page->GetContentsBox().height; @@ -913,15 +959,15 @@ FX_BOOL CFWL_EditImp::On_Validate(CFDE_TxtEdtEngine* pEdit, DispatchEvent(&event); return event.bValidate; } -FWL_ERR CFWL_EditImp::SetBackgroundColor(uint32_t color) { +FWL_Error CFWL_EditImp::SetBackgroundColor(uint32_t color) { m_backColor = color; m_updateBackColor = TRUE; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_EditImp::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { +FWL_Error CFWL_EditImp::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { m_wsFont = wsFont; m_fFontSize = fSize; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_EditImp::SetScrollOffset(FX_FLOAT fScrollOffset) { m_fScrollOffsetY = fScrollOffset; @@ -1718,12 +1764,11 @@ void CFWL_EditImp::ProcessInsertError(int32_t iError) { CFWL_EditImpDelegate::CFWL_EditImpDelegate(CFWL_EditImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - int32_t iRet = 1; switch (dwMsgCode) { case CFWL_MessageType::Activate: { DoActivate(static_cast<CFWL_MsgActivate*>(pMessage)); @@ -1775,19 +1820,17 @@ int32_t CFWL_EditImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { +void CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) - return FWL_ERR_Indefinite; + return; if (pEvent->GetClassID() != CFWL_EventType::Scroll) - return FWL_ERR_Succeeded; + return; IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && @@ -1798,13 +1841,13 @@ FWL_ERR CFWL_EditImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); } - return FWL_ERR_Succeeded; } -FWL_ERR CFWL_EditImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_EditImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_EditImpDelegate::DoActivate(CFWL_MsgActivate* pMsg) { m_pOwner->m_pProperties->m_dwStates |= ~FWL_WGTSTATE_Deactivated; m_pOwner->Repaint(&m_pOwner->m_rtClient); diff --git a/xfa/fwl/basewidget/fwl_editimp.h b/xfa/fwl/basewidget/fwl_editimp.h index 72f2ad03e4..96e56d0c33 100644 --- a/xfa/fwl/basewidget/fwl_editimp.h +++ b/xfa/fwl/basewidget/fwl_editimp.h @@ -30,42 +30,44 @@ class CFWL_EditImp : public CFWL_WidgetImp { ~CFWL_EditImp() override; // CFWL_WidgetImp: - FWL_ERR GetClassName(CFX_WideString& wsClass) const override; + FWL_Error GetClassName(CFX_WideString& wsClass) const override; uint32_t GetClassID() const override; - FWL_ERR Initialize() override; - FWL_ERR Finalize() override; - FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; - FWL_ERR SetWidgetRect(const CFX_RectF& rect) override; - FWL_ERR Update() override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE) override; + FWL_Error SetWidgetRect(const CFX_RectF& rect) override; + FWL_Error Update() override; FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy) override; void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE) override; - FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; - FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; + FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) override; - virtual FWL_ERR SetText(const CFX_WideString& wsText); + virtual FWL_Error SetText(const CFX_WideString& wsText); virtual int32_t GetTextLength() const; - virtual FWL_ERR GetText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - virtual FWL_ERR ClearText(); + virtual FWL_Error GetText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + virtual FWL_Error ClearText(); virtual int32_t GetCaretPos() const; virtual int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); - virtual FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1); + virtual FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1); virtual int32_t CountSelRanges(); virtual int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - virtual FWL_ERR ClearSelections(); + virtual FWL_Error ClearSelections(); virtual int32_t GetLimit(); - virtual FWL_ERR SetLimit(int32_t nLimit); - virtual FWL_ERR SetAliasChar(FX_WCHAR wAlias); - virtual FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); - virtual FWL_ERR DeleteSelections(); - virtual FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1); - virtual FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace); - virtual FWL_ERR Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace); - virtual FWL_ERR DoClipboard(int32_t iCmd); + virtual FWL_Error SetLimit(int32_t nLimit); + virtual FWL_Error SetAliasChar(FX_WCHAR wAlias); + virtual FWL_Error Insert(int32_t nStart, + const FX_WCHAR* lpText, + int32_t nLen); + virtual FWL_Error DeleteSelections(); + virtual FWL_Error DeleteRange(int32_t nStart, int32_t nCount = -1); + virtual FWL_Error ReplaceSelections(const CFX_WideStringC& wsReplace); + virtual FWL_Error Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace); + virtual FWL_Error DoClipboard(int32_t iCmd); virtual FX_BOOL Copy(CFX_WideString& wsCopy); virtual FX_BOOL Cut(CFX_WideString& wsCut); virtual FX_BOOL Paste(const CFX_WideString& wsPaste); @@ -76,11 +78,11 @@ class CFWL_EditImp : public CFWL_WidgetImp { virtual FX_BOOL Redo(); virtual FX_BOOL CanUndo(); virtual FX_BOOL CanRedo(); - virtual FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); - virtual FWL_ERR SetOuter(IFWL_Widget* pOuter); - virtual FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); - virtual FWL_ERR SetBackgroundColor(uint32_t color); - virtual FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); + virtual FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); + virtual FWL_Error SetOuter(IFWL_Widget* pOuter); + virtual FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); + virtual FWL_Error SetBackgroundColor(uint32_t color); + virtual FWL_Error SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); void On_CaretChanged(CFDE_TxtEdtEngine* pEdit, int32_t nPage, @@ -174,10 +176,10 @@ class CFWL_EditImp : public CFWL_WidgetImp { class CFWL_EditImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_EditImpDelegate(CFWL_EditImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void DoActivate(CFWL_MsgActivate* pMsg); diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.cpp b/xfa/fwl/basewidget/fwl_formproxyimp.cpp index 0a5bb67aec..1e70da64ad 100644 --- a/xfa/fwl/basewidget/fwl_formproxyimp.cpp +++ b/xfa/fwl/basewidget/fwl_formproxyimp.cpp @@ -14,9 +14,9 @@ CFWL_FormProxyImp::CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_FormImp(properties, pOuter) {} CFWL_FormProxyImp::~CFWL_FormProxyImp() {} -FWL_ERR CFWL_FormProxyImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_FormProxyImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_FormProxy; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_FormProxyImp::GetClassID() const { return FWL_CLASSHASH_FormProxy; @@ -27,27 +27,29 @@ FX_BOOL CFWL_FormProxyImp::IsInstance(const CFX_WideStringC& wsClass) const { } return CFWL_FormImp::IsInstance(wsClass); } -FWL_ERR CFWL_FormProxyImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_FormProxyImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_FormProxyImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_FormProxyImp::Finalize() { +FWL_Error CFWL_FormProxyImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_FormProxyImp::Update() { - return FWL_ERR_Succeeded; +FWL_Error CFWL_FormProxyImp::Update() { + return FWL_Error::Succeeded; } -FWL_ERR CFWL_FormProxyImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return FWL_ERR_Succeeded; +FWL_Error CFWL_FormProxyImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + return FWL_Error::Succeeded; } + CFWL_FormProxyImpDelegate::CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { + +void CFWL_FormProxyImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { IFWL_WidgetDelegate* pDelegate = m_pOwner->m_pOuter->SetDelegate(NULL); - return pDelegate->OnProcessMessage(pMessage); + pDelegate->OnProcessMessage(pMessage); } diff --git a/xfa/fwl/basewidget/fwl_formproxyimp.h b/xfa/fwl/basewidget/fwl_formproxyimp.h index 4e5e807507..1fbff200ba 100644 --- a/xfa/fwl/basewidget/fwl_formproxyimp.h +++ b/xfa/fwl/basewidget/fwl_formproxyimp.h @@ -18,14 +18,14 @@ class CFWL_FormProxyImp : public CFWL_FormImp { CFWL_FormProxyImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_FormProxyImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: friend class CFWL_FormProxyImpDelegate; @@ -33,7 +33,7 @@ class CFWL_FormProxyImp : public CFWL_FormImp { class CFWL_FormProxyImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_FormProxyImpDelegate(CFWL_FormProxyImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessMessage(CFWL_Message* pMessage) override; protected: CFWL_FormProxyImp* m_pOwner; diff --git a/xfa/fwl/basewidget/fwl_listboximp.cpp b/xfa/fwl/basewidget/fwl_listboximp.cpp index 3a0df152c2..e585a17d7d 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.cpp +++ b/xfa/fwl/basewidget/fwl_listboximp.cpp @@ -52,18 +52,16 @@ FWL_HLISTITEM IFWL_ListBox::GetSelItem(int32_t nIndexSel) { int32_t IFWL_ListBox::GetSelIndex(int32_t nIndex) { return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetSelIndex(nIndex); } -FWL_ERR IFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { +FWL_Error IFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { return static_cast<CFWL_ListBoxImp*>(GetImpl())->SetSelItem(hItem, bSelect); } -FWL_ERR IFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) { +FWL_Error IFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, + CFX_WideString& wsText) { return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetItemText(hItem, wsText); } -FWL_ERR IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { +FWL_Error IFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { return static_cast<CFWL_ListBoxImp*>(GetImpl())->GetScrollPos(fPos, bVert); } -FWL_ERR* IFWL_ListBox::Sort(IFWL_ListBoxCompare* pCom) { - return static_cast<CFWL_ListBoxImp*>(GetImpl())->Sort(pCom); -} CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) @@ -79,20 +77,20 @@ CFWL_ListBoxImp::CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, m_rtStatic.Reset(); } CFWL_ListBoxImp::~CFWL_ListBoxImp() {} -FWL_ERR CFWL_ListBoxImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_ListBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ListBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_ListBoxImp::GetClassID() const { return FWL_CLASSHASH_ListBox; } -FWL_ERR CFWL_ListBoxImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_ListBoxImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_ListBoxImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::Finalize() { +FWL_Error CFWL_ListBoxImp::Finalize() { if (m_pVertScrollBar) { m_pVertScrollBar->Finalize(); } @@ -103,7 +101,7 @@ FWL_ERR CFWL_ListBoxImp::Finalize() { m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pThemeProvider) { @@ -115,11 +113,11 @@ FWL_ERR CFWL_ListBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::Update() { +FWL_Error CFWL_ListBoxImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -142,9 +140,8 @@ FWL_ERR CFWL_ListBoxImp::Update() { } m_dwTTOStyles |= FDE_TTOSTYLE_SingleLine; m_fScorllBarWidth = GetScrollWidth(); - SortItem(); CalcSize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (IsShowScrollBar(FALSE)) { @@ -163,12 +160,12 @@ FWL_WidgetHit CFWL_ListBoxImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::Client; return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; pGraphics->SaveGraphState(); if (HasBorder()) { @@ -193,17 +190,18 @@ FWL_ERR CFWL_ListBoxImp::DrawWidget(CFX_Graphics* pGraphics, } DrawItems(pGraphics, pTheme, pMatrix); pGraphics->RestoreGraphState(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error CFWL_ListBoxImp::SetThemeProvider( + IFWL_ThemeProvider* pThemeProvider) { if (!pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!pThemeProvider->IsValidWidget(m_pInterface)) { m_pScrollBarTP = pThemeProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ListBoxImp::CountSelItems() { if (!m_pProperties->m_pDataProvider) @@ -270,9 +268,9 @@ int32_t CFWL_ListBoxImp::GetSelIndex(int32_t nIndex) { } return -1; } -FWL_ERR CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { +FWL_Error CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!hItem) { if (bSelect) { SelectAll(); @@ -280,52 +278,37 @@ FWL_ERR CFWL_ListBoxImp::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { ClearSelection(); SetFocusItem(NULL); } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_LTB_MultiSelection) { SetSelectionDirect(hItem, bSelect); } else { SetSelection(hItem, hItem, bSelect); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::GetItemText(FWL_HLISTITEM hItem, - CFX_WideString& wsText) { +FWL_Error CFWL_ListBoxImp::GetItemText(FWL_HLISTITEM hItem, + CFX_WideString& wsText) { if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(m_pProperties->m_pDataProvider); if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pData->GetItemText(m_pInterface, hItem, wsText); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { + +FWL_Error CFWL_ListBoxImp::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { if ((bVert && IsShowScrollBar(TRUE)) || (!bVert && IsShowScrollBar(FALSE))) { IFWL_ScrollBar* pScrollBar = bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); fPos = pScrollBar->GetPos(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FWL_ERR_Indefinite; -} -FWL_ERR* CFWL_ListBoxImp::Sort(IFWL_ListBoxCompare* pCom) { - FWL_HLISTITEM hTemp; - 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++) { - if (pCom->Compare(pData->GetItem(m_pInterface, i), - pData->GetItem(m_pInterface, j)) > 0) { - hTemp = pData->GetItem(m_pInterface, i); - pData->SetItemIndex(m_pInterface, pData->GetItem(m_pInterface, j), i); - pData->SetItemIndex(m_pInterface, hTemp, j); - } - } - } - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; } + FWL_HLISTITEM CFWL_ListBoxImp::GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode) { FWL_HLISTITEM hRet = NULL; @@ -951,7 +934,7 @@ void CFWL_ListBoxImp::InitScrollBar(FX_BOOL bVert) { pScrollBar->Initialize(); (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar); } -void CFWL_ListBoxImp::SortItem() {} + FX_BOOL CFWL_ListBoxImp::IsShowScrollBar(FX_BOOL bVert) { IFWL_ScrollBar* pScrollbar = bVert ? m_pVertScrollBar.get() : m_pHorzScrollBar.get(); @@ -980,14 +963,13 @@ void CFWL_ListBoxImp::ProcessSelChanged() { CFWL_ListBoxImpDelegate::CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; if (!m_pOwner->IsEnabled()) - return 1; + return; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - int32_t iRet = 1; switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { OnFocusChanged(pMessage, TRUE); @@ -1024,19 +1006,17 @@ int32_t CFWL_ListBoxImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { +void CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { if (!pEvent) - return FWL_ERR_Indefinite; + return; if (pEvent->GetClassID() != CFWL_EventType::Scroll) - return FWL_ERR_Succeeded; + return; IFWL_Widget* pSrcTarget = pEvent->m_pSrcTarget; if ((pSrcTarget == m_pOwner->m_pVertScrollBar.get() && @@ -1047,13 +1027,13 @@ FWL_ERR CFWL_ListBoxImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { OnScroll(static_cast<IFWL_ScrollBar*>(pSrcTarget), pScrollEvent->m_iScrollCode, pScrollEvent->m_fPos); } - return FWL_ERR_Succeeded; } -FWL_ERR CFWL_ListBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_ListBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_ListBoxImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (m_pOwner->GetStylesEx() & FWL_STYLEEXT_LTB_ShowScrollBarFocus) { if (m_pOwner->m_pVertScrollBar) { diff --git a/xfa/fwl/basewidget/fwl_listboximp.h b/xfa/fwl/basewidget/fwl_listboximp.h index 65fbf6a45a..0d938fe778 100644 --- a/xfa/fwl/basewidget/fwl_listboximp.h +++ b/xfa/fwl/basewidget/fwl_listboximp.h @@ -25,23 +25,22 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { CFWL_ListBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_ListBoxImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); - virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); virtual int32_t CountSelItems(); virtual FWL_HLISTITEM GetSelItem(int32_t nIndexSel); virtual int32_t GetSelIndex(int32_t nIndex); - virtual FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); - virtual FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); - virtual FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); - virtual FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); + virtual FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); + virtual FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); + virtual FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); protected: FWL_HLISTITEM GetItem(FWL_HLISTITEM hItem, uint32_t dwKeyCode); @@ -82,7 +81,6 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { FX_FLOAT GetScrollWidth(); FX_FLOAT GetItemHeigt(); void InitScrollBar(FX_BOOL bVert = TRUE); - void SortItem(); FX_BOOL IsShowScrollBar(FX_BOOL bVert); void ProcessSelChanged(); @@ -104,10 +102,10 @@ class CFWL_ListBoxImp : public CFWL_WidgetImp { class CFWL_ListBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ListBoxImpDelegate(CFWL_ListBoxImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp index 3feb1122a7..2d495d1fd5 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.cpp @@ -180,26 +180,26 @@ CFWL_MonthCalendarImp::~CFWL_MonthCalendarImp() { delete m_pDateTime; m_arrSelDays.RemoveAll(); } -FWL_ERR CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_MonthCalendarImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_MonthCalendar; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_MonthCalendarImp::GetClassID() const { return FWL_CLASSHASH_MonthCalendar; } -FWL_ERR CFWL_MonthCalendarImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_MonthCalendarImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_MonthCalendarImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_MonthCalendarImp::Finalize() { +FWL_Error CFWL_MonthCalendarImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect, - FX_BOOL bAutoSize) { +FWL_Error CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (bAutoSize) { CFX_SizeF fs = CalcSize(TRUE); rect.Set(0, 0, fs.x, fs.y); @@ -207,11 +207,11 @@ FWL_ERR CFWL_MonthCalendarImp::GetWidgetRect(CFX_RectF& rect, } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_MonthCalendarImp::Update() { +FWL_Error CFWL_MonthCalendarImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -223,12 +223,12 @@ FWL_ERR CFWL_MonthCalendarImp::Update() { ClearDateItem(); ReSetDateItem(); LayOut(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_pProperties->m_pThemeProvider == NULL) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } @@ -255,7 +255,7 @@ FWL_ERR CFWL_MonthCalendarImp::DrawWidget(CFX_Graphics* pGraphics, DrawWeekNumberSep(pGraphics, pTheme, pMatrix); DrawWeekNumber(pGraphics, pTheme, pMatrix); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_MonthCalendarImp::CountSelect() { return m_arrSelDays.GetSize(); @@ -1017,13 +1017,11 @@ CFWL_MonthCalendarImpDelegate::CFWL_MonthCalendarImpDelegate( CFWL_MonthCalendarImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( - CFWL_Message* pMessage) { +void CFWL_MonthCalendarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); - int32_t iRet = 1; switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { OnFocusChanged(pMessage, TRUE); @@ -1061,17 +1059,15 @@ int32_t CFWL_MonthCalendarImpDelegate::OnProcessMessage( break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_MonthCalendarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } void CFWL_MonthCalendarImpDelegate::OnActivate(CFWL_Message* pMsg) {} diff --git a/xfa/fwl/basewidget/fwl_monthcalendarimp.h b/xfa/fwl/basewidget/fwl_monthcalendarimp.h index a7deb9a098..d1096b40ce 100644 --- a/xfa/fwl/basewidget/fwl_monthcalendarimp.h +++ b/xfa/fwl/basewidget/fwl_monthcalendarimp.h @@ -24,14 +24,14 @@ class CFWL_MonthCalendarImp : public CFWL_WidgetImp { CFWL_MonthCalendarImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_MonthCalendarImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual int32_t CountSelect(); virtual FX_BOOL GetSelect(int32_t& iYear, int32_t& iMonth, @@ -229,9 +229,9 @@ struct FWL_DATEINFO { class CFWL_MonthCalendarImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_MonthCalendarImpDelegate(CFWL_MonthCalendarImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnActivate(CFWL_Message* pMsg); diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.cpp b/xfa/fwl/basewidget/fwl_pictureboximp.cpp index 4495a495ba..c2cd09d342 100644 --- a/xfa/fwl/basewidget/fwl_pictureboximp.cpp +++ b/xfa/fwl/basewidget/fwl_pictureboximp.cpp @@ -35,29 +35,30 @@ CFWL_PictureBoxImp::CFWL_PictureBoxImp( m_matrix.SetIdentity(); } CFWL_PictureBoxImp::~CFWL_PictureBoxImp() {} -FWL_ERR CFWL_PictureBoxImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_PictureBoxImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_PictureBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_PictureBoxImp::GetClassID() const { return FWL_CLASSHASH_PictureBox; } -FWL_ERR CFWL_PictureBoxImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_PictureBoxImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_PictureBoxImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBoxImp::Finalize() { +FWL_Error CFWL_PictureBoxImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (!m_pProperties->m_pDataProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_DIBitmap* pBitmap = static_cast<IFWL_PictureBoxDP*>(m_pProperties->m_pDataProvider) ->GetPicture(m_pInterface); @@ -69,24 +70,24 @@ FWL_ERR CFWL_PictureBoxImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBoxImp::Update() { +FWL_Error CFWL_PictureBoxImp::Update() { if (IsLocked()) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } GetClientRect(m_rtClient); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = GetAvailableTheme(); if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -95,7 +96,7 @@ FWL_ERR CFWL_PictureBoxImp::DrawWidget(CFX_Graphics* pGraphics, DrawEdge(pGraphics, CFWL_Part::Edge, pTheme, pMatrix); } DrawBkground(pGraphics, pTheme, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_PictureBoxImp::DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -141,10 +142,12 @@ FX_BOOL CFWL_PictureBoxImp::VStyle(FX_BOOL dwStyle) { } return FALSE; } + CFWL_PictureBoxImpDelegate::CFWL_PictureBoxImpDelegate( CFWL_PictureBoxImp* pOwner) : m_pOwner(pOwner) {} -FWL_ERR CFWL_PictureBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); + +void CFWL_PictureBoxImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fwl/basewidget/fwl_pictureboximp.h b/xfa/fwl/basewidget/fwl_pictureboximp.h index f2e67124f6..d6f0ccc935 100644 --- a/xfa/fwl/basewidget/fwl_pictureboximp.h +++ b/xfa/fwl/basewidget/fwl_pictureboximp.h @@ -18,14 +18,14 @@ class CFWL_PictureBoxImp : public CFWL_WidgetImp { CFWL_PictureBoxImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_PictureBoxImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: void DrawBkground(CFX_Graphics* pGraphics, @@ -40,11 +40,12 @@ class CFWL_PictureBoxImp : public CFWL_WidgetImp { FX_BOOL m_bButton; friend class CFWL_PictureBoxImpDelegate; }; + class CFWL_PictureBoxImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_PictureBoxImpDelegate(CFWL_PictureBoxImp* pOwner); - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: CFWL_PictureBoxImp* m_pOwner; diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp index 6fab925c91..3b18ad0fa0 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.cpp @@ -39,25 +39,26 @@ CFWL_PushButtonImp::CFWL_PushButtonImp( m_rtCaption.Set(0, 0, 0, 0); } CFWL_PushButtonImp::~CFWL_PushButtonImp() {} -FWL_ERR CFWL_PushButtonImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_PushButtonImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_PushButton; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_PushButtonImp::GetClassID() const { return FWL_CLASSHASH_PushButton; } -FWL_ERR CFWL_PushButtonImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_PushButtonImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_PushButtonImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PushButtonImp::Finalize() { +FWL_Error CFWL_PushButtonImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (m_pProperties->m_pThemeProvider == NULL) { @@ -81,7 +82,7 @@ FWL_ERR CFWL_PushButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_PushButtonImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { @@ -92,9 +93,9 @@ void CFWL_PushButtonImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { CFWL_WidgetImp::SetStates(dwStates, bSet); } -FWL_ERR CFWL_PushButtonImp::Update() { +FWL_Error CFWL_PushButtonImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -105,14 +106,14 @@ FWL_ERR CFWL_PushButtonImp::Update() { FX_FLOAT* fcaption = static_cast<FX_FLOAT*>(GetThemeCapacity(CFWL_WidgetCapacity::Margin)); m_rtCaption.Inflate(-*fcaption, -*fcaption); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_PushButtonDP* pData = static_cast<IFWL_PushButtonDP*>(m_pProperties->m_pDataProvider); CFX_DIBitmap* pPicture = NULL; @@ -293,7 +294,7 @@ FWL_ERR CFWL_PushButtonImp::DrawWidget(CFX_Graphics* pGraphics, DrawText(pGraphics, m_pProperties->m_pThemeProvider, &matrix); break; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_PushButtonImp::DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -404,13 +405,12 @@ CFWL_PushButtonImpDelegate::CFWL_PushButtonImpDelegate( CFWL_PushButtonImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; if (!m_pOwner->IsEnabled()) - return 1; + return; - int32_t iRet = 1; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { @@ -452,21 +452,19 @@ int32_t CFWL_PushButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_PushButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_PushButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} + +void CFWL_PushButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_PushButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (bSet) { diff --git a/xfa/fwl/basewidget/fwl_pushbuttonimp.h b/xfa/fwl/basewidget/fwl_pushbuttonimp.h index 50a984f5c1..89913be6c1 100644 --- a/xfa/fwl/basewidget/fwl_pushbuttonimp.h +++ b/xfa/fwl/basewidget/fwl_pushbuttonimp.h @@ -19,15 +19,15 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp { CFWL_PushButtonImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_PushButtonImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: void DrawBkground(CFX_Graphics* pGraphics, @@ -49,10 +49,10 @@ class CFWL_PushButtonImp : public CFWL_WidgetImp { class CFWL_PushButtonImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_PushButtonImpDelegate(CFWL_PushButtonImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp index 0db7c29e9d..b03846da91 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.cpp +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.cpp @@ -31,34 +31,34 @@ IFWL_ScrollBar::IFWL_ScrollBar() {} FX_BOOL IFWL_ScrollBar::IsVertical() { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->IsVertical(); } -FWL_ERR IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { +FWL_Error IFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetRange(fMin, fMax); } -FWL_ERR IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { +FWL_Error IFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetRange(fMin, fMax); } FX_FLOAT IFWL_ScrollBar::GetPageSize() { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetPageSize(); } -FWL_ERR IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { +FWL_Error IFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetPageSize(fPageSize); } FX_FLOAT IFWL_ScrollBar::GetStepSize() { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetStepSize(); } -FWL_ERR IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { +FWL_Error IFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetStepSize(fStepSize); } FX_FLOAT IFWL_ScrollBar::GetPos() { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetPos(); } -FWL_ERR IFWL_ScrollBar::SetPos(FX_FLOAT fPos) { +FWL_Error IFWL_ScrollBar::SetPos(FX_FLOAT fPos) { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetPos(fPos); } FX_FLOAT IFWL_ScrollBar::GetTrackPos() { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->GetTrackPos(); } -FWL_ERR IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { +FWL_Error IFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { return static_cast<CFWL_ScrollBarImp*>(GetImpl())->SetTrackPos(fTrackPos); } FX_BOOL IFWL_ScrollBar::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { @@ -99,31 +99,31 @@ CFWL_ScrollBarImp::CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, m_rtMaxTrack.Reset(); } CFWL_ScrollBarImp::~CFWL_ScrollBarImp() {} -FWL_ERR CFWL_ScrollBarImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_ScrollBarImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ScrollBar; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_ScrollBarImp::GetClassID() const { return FWL_CLASSHASH_ScrollBar; } -FWL_ERR CFWL_ScrollBarImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_ScrollBarImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_ScrollBarImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ScrollBarImp::Finalize() { +FWL_Error CFWL_ScrollBarImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); FX_FLOAT* pfMinWidth = static_cast<FX_FLOAT*>( GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth)); if (!pfMinWidth) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (IsVertical()) { rect.Set(0, 0, (*pfMinWidth), (*pfMinWidth) * 3); } else { @@ -133,24 +133,24 @@ FWL_ERR CFWL_ScrollBarImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ScrollBarImp::Update() { +FWL_Error CFWL_ScrollBarImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); } Layout(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; if (HasBorder()) { DrawBorder(pGraphics, CFWL_Part::Border, pTheme, pMatrix); @@ -163,51 +163,51 @@ FWL_ERR CFWL_ScrollBarImp::DrawWidget(CFX_Graphics* pGraphics, DrawArrowBtn(pGraphics, pTheme, TRUE, pMatrix); DrawArrowBtn(pGraphics, pTheme, FALSE, pMatrix); DrawThumb(pGraphics, pTheme, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } inline FX_BOOL CFWL_ScrollBarImp::IsVertical() { return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_SCB_Vert; } -FWL_ERR CFWL_ScrollBarImp::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { +FWL_Error CFWL_ScrollBarImp::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { fMin = m_fRangeMin; fMax = m_fRangeMax; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ScrollBarImp::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { +FWL_Error CFWL_ScrollBarImp::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { m_fRangeMin = fMin; m_fRangeMax = fMax; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ScrollBarImp::GetPageSize() { return m_fPageSize; } -FWL_ERR CFWL_ScrollBarImp::SetPageSize(FX_FLOAT fPageSize) { +FWL_Error CFWL_ScrollBarImp::SetPageSize(FX_FLOAT fPageSize) { m_fPageSize = fPageSize; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ScrollBarImp::GetStepSize() { return m_fStepSize; } -FWL_ERR CFWL_ScrollBarImp::SetStepSize(FX_FLOAT fStepSize) { +FWL_Error CFWL_ScrollBarImp::SetStepSize(FX_FLOAT fStepSize) { m_fStepSize = fStepSize; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ScrollBarImp::GetPos() { return m_fPos; } -FWL_ERR CFWL_ScrollBarImp::SetPos(FX_FLOAT fPos) { +FWL_Error CFWL_ScrollBarImp::SetPos(FX_FLOAT fPos) { m_fPos = fPos; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ScrollBarImp::GetTrackPos() { return m_fTrackPos; } -FWL_ERR CFWL_ScrollBarImp::SetTrackPos(FX_FLOAT fTrackPos) { +FWL_Error CFWL_ScrollBarImp::SetTrackPos(FX_FLOAT fTrackPos) { m_fTrackPos = fTrackPos; CalcThumbButtonRect(m_rtThumb); CalcMinTrackRect(m_rtMinTrack); CalcMaxTrackRect(m_rtMaxTrack); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_ScrollBarImp::DoScroll(uint32_t dwCode, FX_FLOAT fPos) { switch (dwCode) { @@ -236,9 +236,9 @@ int32_t CFWL_ScrollBarImp::Run(FWL_HTIMER hTimer) { } return 1; } -FWL_ERR CFWL_ScrollBarImp::SetOuter(IFWL_Widget* pOuter) { +FWL_Error CFWL_ScrollBarImp::SetOuter(IFWL_Widget* pOuter) { m_pOuter = pOuter; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_ScrollBarImp::DrawTrack(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -628,11 +628,10 @@ FX_BOOL CFWL_ScrollBarImp::OnScroll(uint32_t dwCode, FX_FLOAT fPos) { CFWL_ScrollBarImpDelegate::CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; - int32_t iRet = 1; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); if (dwMsgCode == CFWL_MessageType::Mouse) { CFWL_MsgMouse* pMsg = static_cast<CFWL_MsgMouse*>(pMessage); @@ -654,7 +653,6 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } @@ -662,16 +660,14 @@ int32_t CFWL_ScrollBarImpDelegate::OnProcessMessage(CFWL_Message* 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 { - iRet = 0; } - return iRet; } -FWL_ERR CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_ScrollBarImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_ScrollBarImpDelegate::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { diff --git a/xfa/fwl/basewidget/fwl_scrollbarimp.h b/xfa/fwl/basewidget/fwl_scrollbarimp.h index 08f7c69bf7..6cee702f5c 100644 --- a/xfa/fwl/basewidget/fwl_scrollbarimp.h +++ b/xfa/fwl/basewidget/fwl_scrollbarimp.h @@ -19,27 +19,27 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { CFWL_ScrollBarImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_ScrollBarImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual FX_BOOL IsVertical(); - virtual FWL_ERR GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); - virtual FWL_ERR SetRange(FX_FLOAT fMin, FX_FLOAT fMax); + virtual FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); + virtual FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); virtual FX_FLOAT GetPageSize(); - virtual FWL_ERR SetPageSize(FX_FLOAT fPageSize); + virtual FWL_Error SetPageSize(FX_FLOAT fPageSize); virtual FX_FLOAT GetStepSize(); - virtual FWL_ERR SetStepSize(FX_FLOAT fStepSize); + virtual FWL_Error SetStepSize(FX_FLOAT fStepSize); virtual FX_FLOAT GetPos(); - virtual FWL_ERR SetPos(FX_FLOAT fPos); + virtual FWL_Error SetPos(FX_FLOAT fPos); virtual FX_FLOAT GetTrackPos(); - virtual FWL_ERR SetTrackPos(FX_FLOAT fTrackPos); + virtual FWL_Error SetTrackPos(FX_FLOAT fTrackPos); virtual FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); - virtual FWL_ERR SetOuter(IFWL_Widget* pOuter); + virtual FWL_Error SetOuter(IFWL_Widget* pOuter); virtual int32_t Run(FWL_HTIMER hTimer); protected: @@ -101,9 +101,9 @@ class CFWL_ScrollBarImp : public CFWL_WidgetImp, public IFWL_Timer { class CFWL_ScrollBarImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ScrollBarImpDelegate(CFWL_ScrollBarImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp index 9a70d7187d..27b84bae92 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.cpp @@ -36,7 +36,7 @@ IFWL_SpinButton* IFWL_SpinButton::Create( return pSpinButton; } IFWL_SpinButton::IFWL_SpinButton() {} -FWL_ERR IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { +FWL_Error IFWL_SpinButton::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { return static_cast<CFWL_SpinButtonImp*>(GetImpl()) ->EnableButton(bEnable, bUp); } @@ -59,36 +59,37 @@ CFWL_SpinButtonImp::CFWL_SpinButtonImp( m_pProperties->m_dwStyleExes |= FWL_STYLEEXE_SPB_Vert; } CFWL_SpinButtonImp::~CFWL_SpinButtonImp() {} -FWL_ERR CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_SpinButtonImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_SpinButton; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_SpinButtonImp::GetClassID() const { return FWL_CLASSHASH_SpinButton; } -FWL_ERR CFWL_SpinButtonImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_SpinButtonImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_SpinButtonImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_SpinButtonImp::Finalize() { +FWL_Error CFWL_SpinButtonImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_SpinButtonImp::GetWidgetRect(CFX_RectF& rect, + FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, kMinWidth, kMinHeight); CFWL_WidgetImp::GetWidgetRect(rect, TRUE); } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_SpinButtonImp::Update() { +FWL_Error CFWL_SpinButtonImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } GetClientRect(m_rtClient); if (m_pProperties->m_dwStyleExes & FWL_STYLEEXE_SPB_Vert) { @@ -102,7 +103,7 @@ FWL_ERR CFWL_SpinButtonImp::Update() { m_rtDnButton.Set(m_rtClient.left + m_rtClient.width / 2, m_rtClient.top, m_rtClient.width / 2, m_rtClient.height); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { if (m_rtClient.Contains(fx, fy)) @@ -121,10 +122,10 @@ FWL_WidgetHit CFWL_SpinButtonImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return FWL_WidgetHit::DownButton; return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_RectF rtClip(m_rtClient); if (pMatrix != NULL) { pMatrix->TransformRect(rtClip); @@ -138,7 +139,7 @@ FWL_ERR CFWL_SpinButtonImp::DrawWidget(CFX_Graphics* pGraphics, } DrawUpButton(pGraphics, pTheme, pMatrix); DrawDownButton(pGraphics, pTheme, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_SpinButtonImp::Run(FWL_HTIMER hTimer) { if (m_hTimer) { @@ -149,7 +150,7 @@ int32_t CFWL_SpinButtonImp::Run(FWL_HTIMER hTimer) { } return 1; } -FWL_ERR CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { +FWL_Error CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { if (bUp) { if (bEnable) { m_dwUpState = CFWL_PartState_Normal; @@ -163,7 +164,7 @@ FWL_ERR CFWL_SpinButtonImp::EnableButton(FX_BOOL bEnable, FX_BOOL bUp) { m_dwDnState = CFWL_PartState_Disabled; } } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_SpinButtonImp::IsButtonEnable(FX_BOOL bUp) { if (bUp) { @@ -204,11 +205,10 @@ CFWL_SpinButtonImpDelegate::CFWL_SpinButtonImpDelegate( CFWL_SpinButtonImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; - int32_t iRet = 1; CFWL_MessageType dwMsgCode = pMessage->GetClassID(); switch (dwMsgCode) { case CFWL_MessageType::SetFocus: { @@ -250,21 +250,19 @@ int32_t CFWL_SpinButtonImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); - return iRet; } -FWL_ERR CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; -} -FWL_ERR CFWL_SpinButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_SpinButtonImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} + +void CFWL_SpinButtonImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_SpinButtonImpDelegate::OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet) { if (bSet) { diff --git a/xfa/fwl/basewidget/fwl_spinbuttonimp.h b/xfa/fwl/basewidget/fwl_spinbuttonimp.h index 3f9dc77c4e..aa963c9da4 100644 --- a/xfa/fwl/basewidget/fwl_spinbuttonimp.h +++ b/xfa/fwl/basewidget/fwl_spinbuttonimp.h @@ -20,17 +20,17 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { CFWL_SpinButtonImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); ~CFWL_SpinButtonImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual int32_t Run(FWL_HTIMER hTimer); - FWL_ERR EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); + FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); protected: @@ -53,10 +53,10 @@ class CFWL_SpinButtonImp : public CFWL_WidgetImp, public IFWL_Timer { class CFWL_SpinButtonImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_SpinButtonImpDelegate(CFWL_SpinButtonImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp index 0a8d343cef..f1878edee8 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.cpp @@ -27,16 +27,21 @@ IFWL_ToolTip* IFWL_ToolTip::Create(const CFWL_WidgetImpProperties& properties, pToolTipImpl->SetInterface(pToolTip); return pToolTip; } -FWL_ERR IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { - return static_cast<CFWL_ToolTipImp*>(GetImpl())->SetAnchor(rtAnchor); + +void IFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { + static_cast<CFWL_ToolTipImp*>(GetImpl())->SetAnchor(rtAnchor); } -FWL_ERR IFWL_ToolTip::Show() { - return static_cast<CFWL_ToolTipImp*>(GetImpl())->Show(); + +void IFWL_ToolTip::Show() { + static_cast<CFWL_ToolTipImp*>(GetImpl())->Show(); } -FWL_ERR IFWL_ToolTip::Hide() { - return static_cast<CFWL_ToolTipImp*>(GetImpl())->Hide(); + +void IFWL_ToolTip::Hide() { + static_cast<CFWL_ToolTipImp*>(GetImpl())->Hide(); } + IFWL_ToolTip::IFWL_ToolTip() {} + CFWL_ToolTipImp::CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter) : CFWL_FormImp(properties, pOuter), @@ -58,27 +63,27 @@ CFWL_ToolTipImp::~CFWL_ToolTipImp() { m_pTimer = NULL; } } -FWL_ERR CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_ToolTipImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_ToolTip; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_ToolTipImp::GetClassID() const { return FWL_CLASSHASH_ToolTip; } -FWL_ERR CFWL_ToolTipImp::Initialize() { +FWL_Error CFWL_ToolTipImp::Initialize() { m_pProperties->m_dwStyles |= FWL_WGTSTYLE_Popup; m_pProperties->m_dwStyles &= ~FWL_WGTSTYLE_Child; - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; m_pDelegate = new CFWL_ToolTipImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ToolTipImp::Finalize() { +FWL_Error CFWL_ToolTipImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Set(0, 0, 0, 0); if (m_pProperties->m_pThemeProvider == NULL) { @@ -101,11 +106,11 @@ FWL_ERR CFWL_ToolTipImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ToolTipImp::Update() { +FWL_Error CFWL_ToolTipImp::Update() { if (IsLocked()) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -113,9 +118,9 @@ FWL_ERR CFWL_ToolTipImp::Update() { UpdateTextOutStyles(); GetClientRect(m_rtClient); m_rtCaption = m_rtClient; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) { +FWL_Error CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) { FX_FLOAT x = 0; FX_FLOAT y = 0; FX_FLOAT t = 0; @@ -131,23 +136,23 @@ FWL_ERR CFWL_ToolTipImp::GetClientRect(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); rect.Deflate(x, t, x, y); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_ToolTipImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { IFWL_ToolTipTarget* toolTipTarget = CFWL_ToolTipContainer::getInstance()->GetCurrentToolTipTarget(); if (toolTipTarget && !toolTipTarget->UseDefaultTheme()) { return toolTipTarget->DrawToolTip(pGraphics, pMatrix, m_pInterface); } if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; DrawBkground(pGraphics, pTheme, pMatrix); DrawText(pGraphics, pTheme, pMatrix); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_ToolTipImp::DrawBkground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme, @@ -200,30 +205,29 @@ void CFWL_ToolTipImp::UpdateTextOutStyles() { m_dwTTOStyles &= ~FDE_TTOSTYLE_SingleLine; } } -FWL_ERR CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) { + +void CFWL_ToolTipImp::SetAnchor(const CFX_RectF& rtAnchor) { m_rtAnchor = rtAnchor; - return TRUE; } -FWL_ERR CFWL_ToolTipImp::Show() { + +void CFWL_ToolTipImp::Show() { 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)) { + if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Invisible)) m_hTimerShow = FWL_StartTimer(&m_TimerShow, nInitDelay, FALSE); - } - return TRUE; } -FWL_ERR CFWL_ToolTipImp::Hide() { + +void CFWL_ToolTipImp::Hide() { SetStates(FWL_WGTSTATE_Invisible, TRUE); if (m_hTimerHide) { FWL_StopTimer(m_hTimerHide); - m_hTimerHide = NULL; + m_hTimerHide = nullptr; } if (m_hTimerShow) { FWL_StopTimer(m_hTimerShow); - m_hTimerShow = NULL; + m_hTimerShow = nullptr; } - return TRUE; } void CFWL_ToolTipImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { @@ -284,15 +288,17 @@ int32_t CFWL_ToolTipImp::CFWL_ToolTipTimer::Run(FWL_HTIMER hTimer) { } return TRUE; } + CFWL_ToolTipImpDelegate::CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner) : m_pOwner(pOwner) {} -int32_t CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { - return CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); -} -FWL_ERR CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; + +void CFWL_ToolTipImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { + CFWL_WidgetImpDelegate::OnProcessMessage(pMessage); } -FWL_ERR CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); + +void CFWL_ToolTipImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} + +void CFWL_ToolTipImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h index 0c053869ed..16ff424c7c 100644 --- a/xfa/fwl/basewidget/fwl_tooltipctrlimp.h +++ b/xfa/fwl/basewidget/fwl_tooltipctrlimp.h @@ -20,19 +20,19 @@ class CFWL_ToolTipImp : public CFWL_FormImp { CFWL_ToolTipImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_ToolTipImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR Update(); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error Update(); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual void SetStates(uint32_t dwStates, FX_BOOL bSet); - virtual FWL_ERR GetClientRect(CFX_RectF& rect); - FWL_ERR SetAnchor(const CFX_RectF& rtAnchor); - FWL_ERR Show(); - FWL_ERR Hide(); + virtual FWL_Error GetClientRect(CFX_RectF& rect); + void SetAnchor(const CFX_RectF& rtAnchor); + void Show(); + void Hide(); protected: void DrawBkground(CFX_Graphics* pGraphics, @@ -68,10 +68,10 @@ class CFWL_ToolTipImp : public CFWL_FormImp { class CFWL_ToolTipImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_ToolTipImpDelegate(CFWL_ToolTipImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnFocusChanged(CFWL_Message* pMsg, FX_BOOL bSet = TRUE); diff --git a/xfa/fwl/basewidget/ifwl_caret.h b/xfa/fwl/basewidget/ifwl_caret.h index 9d0c8a70f9..c7481bdb3c 100644 --- a/xfa/fwl/basewidget/ifwl_caret.h +++ b/xfa/fwl/basewidget/ifwl_caret.h @@ -20,9 +20,9 @@ class IFWL_Caret : public IFWL_Widget { IFWL_Widget* pOuter); void ShowCaret(FX_BOOL bFlag = TRUE); - FWL_ERR GetFrequency(uint32_t& elapse); - FWL_ERR SetFrequency(uint32_t elapse); - FWL_ERR SetColor(CFX_Color crFill); + FWL_Error GetFrequency(uint32_t& elapse); + FWL_Error SetFrequency(uint32_t elapse); + FWL_Error SetColor(CFX_Color crFill); protected: IFWL_Caret(); diff --git a/xfa/fwl/basewidget/ifwl_checkbox.h b/xfa/fwl/basewidget/ifwl_checkbox.h index 0f4b42c2c8..83c0dd4724 100644 --- a/xfa/fwl/basewidget/ifwl_checkbox.h +++ b/xfa/fwl/basewidget/ifwl_checkbox.h @@ -59,7 +59,7 @@ class IFWL_CheckBox : public IFWL_Widget { static IFWL_CheckBox* Create(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); int32_t GetCheckState(); - FWL_ERR SetCheckState(int32_t iCheck); + FWL_Error SetCheckState(int32_t iCheck); protected: IFWL_CheckBox(); diff --git a/xfa/fwl/basewidget/ifwl_combobox.h b/xfa/fwl/basewidget/ifwl_combobox.h index b76724811b..92e213f9d0 100644 --- a/xfa/fwl/basewidget/ifwl_combobox.h +++ b/xfa/fwl/basewidget/ifwl_combobox.h @@ -80,22 +80,22 @@ class IFWL_ComboBox : public IFWL_Widget { static IFWL_ComboBox* Create(const CFWL_WidgetImpProperties& properties); int32_t GetCurSel(); - FWL_ERR SetCurSel(int32_t iSel); - FWL_ERR SetEditText(const CFX_WideString& wsText); + FWL_Error SetCurSel(int32_t iSel); + FWL_Error SetEditText(const CFX_WideString& wsText); int32_t GetEditTextLength() const; - FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - FWL_ERR SetEditSelRange(int32_t nStart, int32_t nCount = -1); + FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); int32_t GetEditLimit(); - FWL_ERR SetEditLimit(int32_t nLimit); - FWL_ERR EditDoClipboard(int32_t iCmd); + FWL_Error SetEditLimit(int32_t nLimit); + FWL_Error EditDoClipboard(int32_t iCmd); FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); IFWL_ListBox* GetListBoxt(); FX_BOOL AfterFocusShowDropList(); - FX_ERR OpenDropDownList(FX_BOOL bActivate); + FWL_Error OpenDropDownList(FX_BOOL bActivate); FX_BOOL EditCanUndo(); FX_BOOL EditCanRedo(); FX_BOOL EditUndo(); @@ -109,9 +109,9 @@ class IFWL_ComboBox : public IFWL_Widget { FX_BOOL EditSelectAll(); FX_BOOL EditDelete(); FX_BOOL EditDeSelect(); - FWL_ERR GetBBox(CFX_RectF& rect); - FWL_ERR EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + FWL_Error GetBBox(CFX_RectF& rect); + FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); protected: IFWL_ComboBox(); diff --git a/xfa/fwl/basewidget/ifwl_datetimepicker.h b/xfa/fwl/basewidget/ifwl_datetimepicker.h index 3d1188eead..446f988fd3 100644 --- a/xfa/fwl/basewidget/ifwl_datetimepicker.h +++ b/xfa/fwl/basewidget/ifwl_datetimepicker.h @@ -53,10 +53,10 @@ END_FWL_EVENT_DEF class IFWL_DateTimePickerDP : public IFWL_DataProvider { public: - virtual FWL_ERR GetToday(IFWL_Widget* pWidget, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) = 0; + virtual FWL_Error GetToday(IFWL_Widget* pWidget, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) = 0; }; class IFWL_DateTimePicker : public IFWL_Widget { @@ -64,12 +64,12 @@ class IFWL_DateTimePicker : public IFWL_Widget { static IFWL_DateTimePicker* Create(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); - FWL_ERR SetEditText(const CFX_WideString& wsText); - FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; + FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); + FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); + FWL_Error SetEditText(const CFX_WideString& wsText); + FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); FX_BOOL CanUndo(); @@ -85,10 +85,10 @@ class IFWL_DateTimePicker : public IFWL_Widget { FX_BOOL SelectAll(); FX_BOOL Delete(); FX_BOOL DeSelect(); - FWL_ERR GetBBox(CFX_RectF& rect); - FWL_ERR SetEditLimit(int32_t nLimit); - FWL_ERR ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + FWL_Error GetBBox(CFX_RectF& rect); + FWL_Error SetEditLimit(int32_t nLimit); + FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); protected: IFWL_DateTimePicker(); diff --git a/xfa/fwl/basewidget/ifwl_edit.h b/xfa/fwl/basewidget/ifwl_edit.h index 3b25eaf548..87f55d7d1e 100644 --- a/xfa/fwl/basewidget/ifwl_edit.h +++ b/xfa/fwl/basewidget/ifwl_edit.h @@ -102,30 +102,30 @@ class IFWL_Edit : public IFWL_Widget { static IFWL_Edit* CreateComboEdit(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FWL_ERR SetText(const CFX_WideString& wsText); + FWL_Error SetText(const CFX_WideString& wsText); int32_t GetTextLength() const; - FWL_ERR GetText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - FWL_ERR ClearText(); + FWL_Error GetText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + FWL_Error ClearText(); int32_t GetCaretPos() const; int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); - FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1); + FWL_Error AddSelRange(int32_t nStart, int32_t nCount = -1); int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - FWL_ERR ClearSelections(); + FWL_Error ClearSelections(); int32_t GetLimit(); - FWL_ERR SetLimit(int32_t nLimit); - FWL_ERR SetAliasChar(FX_WCHAR wAlias); - FWL_ERR SetFormatString(const CFX_WideString& wsFormat); - FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); - FWL_ERR DeleteSelections(); - FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1); - FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace); - FWL_ERR Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace); - FWL_ERR DoClipboard(int32_t iCmd); + FWL_Error SetLimit(int32_t nLimit); + FWL_Error SetAliasChar(FX_WCHAR wAlias); + FWL_Error SetFormatString(const CFX_WideString& wsFormat); + FWL_Error Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); + FWL_Error DeleteSelections(); + FWL_Error DeleteRange(int32_t nStart, int32_t nCount = -1); + FWL_Error ReplaceSelections(const CFX_WideStringC& wsReplace); + FWL_Error Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace); + FWL_Error DoClipboard(int32_t iCmd); FX_BOOL Copy(CFX_WideString& wsCopy); FX_BOOL Cut(CFX_WideString& wsCut); FX_BOOL Paste(const CFX_WideString& wsPaste); @@ -136,11 +136,11 @@ class IFWL_Edit : public IFWL_Widget { FX_BOOL Redo(); FX_BOOL CanUndo(); FX_BOOL CanRedo(); - FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); - FWL_ERR SetOuter(IFWL_Widget* pOuter); - FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); - FWL_ERR SetBackColor(uint32_t dwColor); - FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); + FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); + FWL_Error SetOuter(IFWL_Widget* pOuter); + FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); + FWL_Error SetBackColor(uint32_t dwColor); + FWL_Error SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); void SetScrollOffset(FX_FLOAT fScrollOffset); FX_BOOL GetSuggestWords(CFX_PointF pointf, std::vector<CFX_ByteString>& sSuggest); diff --git a/xfa/fwl/basewidget/ifwl_listbox.h b/xfa/fwl/basewidget/ifwl_listbox.h index d32b020810..8b1e20b28f 100644 --- a/xfa/fwl/basewidget/ifwl_listbox.h +++ b/xfa/fwl/basewidget/ifwl_listbox.h @@ -15,7 +15,6 @@ #define FWL_CLASS_ListBox L"FWL_LISTBOX" #define FWL_CLASSHASH_ListBox 1777358317 #define FWL_STYLEEXT_LTB_MultiSelection (1L << 0) -#define FWL_STYLEEXT_LTB_Sort (1L << 1) #define FWL_STYLEEXT_LTB_ShowScrollBarAlaways (1L << 2) #define FWL_STYLEEXT_LTB_MultiColumn (1L << 3) #define FWL_STYLEEXT_LTB_LeftAlign (0L << 4) @@ -55,36 +54,36 @@ class IFWL_ListBoxDP : public IFWL_DataProvider { FWL_HLISTITEM hItem, int32_t nIndex) = 0; virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; - virtual FWL_ERR GetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_WideString& wsText) = 0; - virtual FWL_ERR GetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtItem) = 0; + virtual FWL_Error GetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_WideString& wsText) = 0; + virtual FWL_Error GetItemRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtItem) = 0; virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; - virtual FWL_ERR SetItemStyles(IFWL_Widget* pWidget, + virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwStyle) = 0; + virtual FWL_Error SetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const FX_WCHAR* pszText) = 0; + virtual FWL_Error SetItemRect(IFWL_Widget* pWidget, FWL_HLISTITEM hItem, - uint32_t dwStyle) = 0; - virtual FWL_ERR SetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const FX_WCHAR* pszText) = 0; - virtual FWL_ERR SetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtItem) = 0; + const CFX_RectF& rtItem) = 0; virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) = 0; virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; - virtual FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtCheck) = 0; - virtual FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtCheck) = 0; + virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtCheck) = 0; + virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const CFX_RectF& rtCheck) = 0; virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) = 0; - virtual FWL_ERR SetItemCheckState(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - uint32_t dwCheckState) = 0; + virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwCheckState) = 0; }; class IFWL_ListBoxCompare { @@ -104,10 +103,9 @@ class IFWL_ListBox : public IFWL_Widget { int32_t CountSelItems(); FWL_HLISTITEM GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); - FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); - FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); - FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); - FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); + FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); + FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); + FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); protected: IFWL_ListBox(); diff --git a/xfa/fwl/basewidget/ifwl_picturebox.h b/xfa/fwl/basewidget/ifwl_picturebox.h index e663f23432..d039a8a1b2 100644 --- a/xfa/fwl/basewidget/ifwl_picturebox.h +++ b/xfa/fwl/basewidget/ifwl_picturebox.h @@ -39,7 +39,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_ERR GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; + virtual FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; }; class IFWL_PictureBox : public IFWL_Widget { diff --git a/xfa/fwl/basewidget/ifwl_scrollbar.h b/xfa/fwl/basewidget/ifwl_scrollbar.h index e199713686..176b997a3d 100644 --- a/xfa/fwl/basewidget/ifwl_scrollbar.h +++ b/xfa/fwl/basewidget/ifwl_scrollbar.h @@ -40,16 +40,16 @@ class IFWL_ScrollBar : public IFWL_Widget { IFWL_Widget* pOuter); FX_BOOL IsVertical(); - FWL_ERR GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); - FWL_ERR SetRange(FX_FLOAT fMin, FX_FLOAT fMax); + FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); + FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); FX_FLOAT GetPageSize(); - FWL_ERR SetPageSize(FX_FLOAT fPageSize); + FWL_Error SetPageSize(FX_FLOAT fPageSize); FX_FLOAT GetStepSize(); - FWL_ERR SetStepSize(FX_FLOAT fStepSize); + FWL_Error SetStepSize(FX_FLOAT fStepSize); FX_FLOAT GetPos(); - FWL_ERR SetPos(FX_FLOAT fPos); + FWL_Error SetPos(FX_FLOAT fPos); FX_FLOAT GetTrackPos(); - FWL_ERR SetTrackPos(FX_FLOAT fTrackPos); + FWL_Error SetTrackPos(FX_FLOAT fTrackPos); FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); protected: diff --git a/xfa/fwl/basewidget/ifwl_spinbutton.h b/xfa/fwl/basewidget/ifwl_spinbutton.h index 2894d08197..5f032d9e7e 100644 --- a/xfa/fwl/basewidget/ifwl_spinbutton.h +++ b/xfa/fwl/basewidget/ifwl_spinbutton.h @@ -22,7 +22,7 @@ class IFWL_SpinButton : public IFWL_Widget { static IFWL_SpinButton* Create(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FWL_ERR EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); + FWL_Error EnableButton(FX_BOOL bEnable, FX_BOOL bUp = TRUE); FX_BOOL IsButtonEnable(FX_BOOL bUp = TRUE); protected: diff --git a/xfa/fwl/basewidget/ifwl_tooltip.h b/xfa/fwl/basewidget/ifwl_tooltip.h index b9a07613a8..1a4280fccf 100644 --- a/xfa/fwl/basewidget/ifwl_tooltip.h +++ b/xfa/fwl/basewidget/ifwl_tooltip.h @@ -22,8 +22,8 @@ class IFWL_ToolTip; class IFWL_ToolTipDP : public IFWL_DataProvider { public: - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) = 0; + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) = 0; virtual int32_t GetInitialDelay(IFWL_Widget* pWidget) = 0; virtual int32_t GetAutoPopDelay(IFWL_Widget* pWidget) = 0; virtual CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) = 0; @@ -35,9 +35,9 @@ class IFWL_ToolTip : public IFWL_Form { static IFWL_ToolTip* Create(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); - FWL_ERR SetAnchor(const CFX_RectF& rtAnchor); - FWL_ERR Show(); - FWL_ERR Hide(); + void SetAnchor(const CFX_RectF& rtAnchor); + void Show(); + void Hide(); protected: IFWL_ToolTip(); diff --git a/xfa/fwl/core/cfwl_event.h b/xfa/fwl/core/cfwl_event.h index 7af8cabbb2..d9decac334 100644 --- a/xfa/fwl/core/cfwl_event.h +++ b/xfa/fwl/core/cfwl_event.h @@ -70,8 +70,8 @@ class CFWL_Event { : m_pSrcTarget(nullptr), m_pDstTarget(nullptr), m_dwRefCount(1) {} virtual ~CFWL_Event() {} - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { - return FWL_ERR_Succeeded; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { + return FWL_Error::Succeeded; } virtual CFWL_EventType GetClassID() const { return CFWL_EventType::None; } @@ -90,14 +90,14 @@ class CFWL_Event { uint32_t m_dwRefCount; }; -#define BEGIN_FWL_EVENT_DEF(classname, eventType) \ - class classname : public CFWL_Event { \ - public: \ - classname() : CFWL_Event() {} \ - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { \ - wsClass = L## #classname; \ - return FWL_ERR_Succeeded; \ - } \ +#define BEGIN_FWL_EVENT_DEF(classname, eventType) \ + class classname : public CFWL_Event { \ + public: \ + classname() : CFWL_Event() {} \ + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { \ + wsClass = L## #classname; \ + return FWL_Error::Succeeded; \ + } \ virtual CFWL_EventType GetClassID() const { return eventType; } #define END_FWL_EVENT_DEF \ diff --git a/xfa/fwl/core/cfwl_message.h b/xfa/fwl/core/cfwl_message.h index 3a30c8fffd..74401c3e34 100644 --- a/xfa/fwl/core/cfwl_message.h +++ b/xfa/fwl/core/cfwl_message.h @@ -61,8 +61,8 @@ class CFWL_Message { virtual ~CFWL_Message() {} virtual CFWL_Message* Clone() { return nullptr; } - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { - return FWL_ERR_Succeeded; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { + return FWL_Error::Succeeded; } virtual CFWL_MessageType GetClassID() const { return CFWL_MessageType::None; } @@ -87,15 +87,15 @@ class CFWL_Message { uint32_t m_dwRefCount; }; -#define BEGIN_FWL_MESSAGE_DEF(classname, msgType) \ - class classname : public CFWL_Message { \ - public: \ - classname() : CFWL_Message() {} \ - CFWL_Message* Clone() override { return new classname(*this); } \ - FWL_ERR GetClassName(CFX_WideString& wsClass) const override { \ - wsClass = L## #classname; \ - return FWL_ERR_Succeeded; \ - } \ +#define BEGIN_FWL_MESSAGE_DEF(classname, msgType) \ + class classname : public CFWL_Message { \ + public: \ + classname() : CFWL_Message() {} \ + CFWL_Message* Clone() override { return new classname(*this); } \ + FWL_Error GetClassName(CFX_WideString& wsClass) const override { \ + wsClass = L## #classname; \ + return FWL_Error::Succeeded; \ + } \ CFWL_MessageType GetClassID() const override { return msgType; } #define END_FWL_MESSAGE_DEF \ diff --git a/xfa/fwl/core/fwl_appimp.cpp b/xfa/fwl/core/fwl_appimp.cpp index ac00cca144..d7fa8bc1c0 100644 --- a/xfa/fwl/core/fwl_appimp.cpp +++ b/xfa/fwl/core/fwl_appimp.cpp @@ -20,11 +20,11 @@ IFWL_App* IFWL_App::Create(CXFA_FFApp* pAdapter) { void IFWL_App::Release() {} -FWL_ERR IFWL_App::Initialize() { +FWL_Error IFWL_App::Initialize() { return static_cast<CFWL_AppImp*>(GetImpl())->Initialize(); } -FWL_ERR IFWL_App::Finalize() { +FWL_Error IFWL_App::Finalize() { return static_cast<CFWL_AppImp*>(GetImpl())->Finalize(); } @@ -62,15 +62,15 @@ CFWL_AppImp::~CFWL_AppImp() { CFWL_ToolTipContainer::DeleteInstance(); } -FWL_ERR CFWL_AppImp::Initialize() { +FWL_Error CFWL_AppImp::Initialize() { if (!m_pWidgetMgr) { m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative)); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_AppImp::Finalize() { +FWL_Error CFWL_AppImp::Finalize() { m_pWidgetMgr.reset(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CXFA_FFApp* CFWL_AppImp::GetAdapterNative() const { return m_pAdapterNative; @@ -82,6 +82,7 @@ CXFA_FWLAdapterWidgetMgr* FWL_GetAdapterWidgetMgr() { IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const { return m_pWidgetMgr.get(); } + void CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pThemeProvider = pThemeProvider; } diff --git a/xfa/fwl/core/fwl_appimp.h b/xfa/fwl/core/fwl_appimp.h index 64b7922a15..b138ccb5be 100644 --- a/xfa/fwl/core/fwl_appimp.h +++ b/xfa/fwl/core/fwl_appimp.h @@ -26,8 +26,8 @@ class CFWL_AppImp { IFWL_App* GetInterface() const { return m_pIface; } CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver.get(); } - FWL_ERR Initialize(); - FWL_ERR Finalize(); + FWL_Error Initialize(); + FWL_Error Finalize(); CXFA_FFApp* GetAdapterNative() const; IFWL_WidgetMgr* GetWidgetMgr() const; IFWL_ThemeProvider* GetThemeProvider() const; diff --git a/xfa/fwl/core/fwl_error.h b/xfa/fwl/core/fwl_error.h index 92a483f4e8..e29f89e012 100644 --- a/xfa/fwl/core/fwl_error.h +++ b/xfa/fwl/core/fwl_error.h @@ -7,16 +7,14 @@ #ifndef XFA_FWL_CORE_FWL_ERROR_H_ #define XFA_FWL_CORE_FWL_ERROR_H_ -#include <stdint.h> - -typedef int32_t FWL_ERR; - -#define FWL_ERR_Succeeded 0 -#define FWL_ERR_Indefinite -1 -#define FWL_ERR_Parameter_Invalid -100 -#define FWL_ERR_Property_Invalid -200 -#define FWL_ERR_Intermediate_Value__Invalid -300 -#define FWL_ERR_Method_Not_Supported -400 -#define FWL_ERR_Out_Of_Memory -500 +enum class FWL_Error { + Succeeded = 0, + Indefinite, + ParameterInvalid, + PropertyInvalid, + IntermediateValueInvalid, + MethodNotSupported, + OutOfMemory +}; #endif // XFA_FWL_CORE_FWL_ERROR_H_ diff --git a/xfa/fwl/core/fwl_formimp.cpp b/xfa/fwl/core/fwl_formimp.cpp index 78dc8b56a2..202a092395 100644 --- a/xfa/fwl/core/fwl_formimp.cpp +++ b/xfa/fwl/core/fwl_formimp.cpp @@ -48,7 +48,7 @@ IFWL_Form::IFWL_Form() {} FWL_FORMSIZE IFWL_Form::GetFormSize() { return static_cast<CFWL_FormImp*>(GetImpl())->GetFormSize(); } -FWL_ERR IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { +FWL_Error IFWL_Form::SetFormSize(FWL_FORMSIZE eFormSize) { return static_cast<CFWL_FormImp*>(GetImpl())->SetFormSize(eFormSize); } IFWL_Widget* IFWL_Form::DoModal() { @@ -57,10 +57,10 @@ IFWL_Widget* IFWL_Form::DoModal() { IFWL_Widget* IFWL_Form::DoModal(uint32_t& dwCommandID) { return static_cast<CFWL_FormImp*>(GetImpl())->DoModal(dwCommandID); } -FWL_ERR IFWL_Form::EndDoModal() { +FWL_Error IFWL_Form::EndDoModal() { return static_cast<CFWL_FormImp*>(GetImpl())->EndDoModal(); } -FWL_ERR IFWL_Form::SetBorderRegion(CFX_Path* pPath) { +FWL_Error IFWL_Form::SetBorderRegion(CFX_Path* pPath) { return static_cast<CFWL_FormImp*>(GetImpl())->SetBorderRegion(pPath); } @@ -99,9 +99,9 @@ CFWL_FormImp::~CFWL_FormImp() { delete m_pNoteLoop; } -FWL_ERR CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_FormImp::GetClassName(CFX_WideString& wsClass) const { wsClass = FWL_CLASS_Form; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_FormImp::GetClassID() const { @@ -114,22 +114,22 @@ FX_BOOL CFWL_FormImp::IsInstance(const CFX_WideStringC& wsClass) const { return CFWL_WidgetImp::IsInstance(wsClass); } -FWL_ERR CFWL_FormImp::Initialize() { - if (CFWL_WidgetImp::Initialize() != FWL_ERR_Succeeded) - return FWL_ERR_Indefinite; +FWL_Error CFWL_FormImp::Initialize() { + if (CFWL_WidgetImp::Initialize() != FWL_Error::Succeeded) + return FWL_Error::Indefinite; RegisterForm(); RegisterEventTarget(); m_pDelegate = new CFWL_FormImpDelegate(this); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_FormImp::Finalize() { +FWL_Error CFWL_FormImp::Finalize() { delete m_pDelegate; m_pDelegate = nullptr; UnregisterEventTarget(); UnRegisterForm(); return CFWL_WidgetImp::Finalize(); } -FWL_ERR CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { rect.Reset(); FX_FLOAT fCapHeight = GetCaptionHeight(); @@ -141,23 +141,23 @@ FWL_ERR CFWL_FormImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { +FWL_Error CFWL_FormImp::GetClientRect(CFX_RectF& rect) { if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_Caption) == 0) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } #ifdef FWL_UseMacSystemBorder rect = m_rtRelative; CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); if (!pWidgetMgr) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; rect.left = 0; rect.top = 0; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; #else FX_FLOAT x = 0; FX_FLOAT y = 0; @@ -176,12 +176,12 @@ FWL_ERR CFWL_FormImp::GetClientRect(CFX_RectF& rect) { rect = m_pProperties->m_rtWidget; rect.Offset(-rect.left, -rect.top); rect.Deflate(x, t, x, y); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; #endif } -FWL_ERR CFWL_FormImp::Update() { +FWL_Error CFWL_FormImp::Update() { if (m_iLock > 0) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } if (!m_pProperties->m_pThemeProvider) { m_pProperties->m_pThemeProvider = GetAvailableTheme(); @@ -195,7 +195,7 @@ FWL_ERR CFWL_FormImp::Update() { #endif UpdateCaption(); Layout(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { GetAvailableTheme(); @@ -249,12 +249,12 @@ FWL_WidgetHit CFWL_FormImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Client; } -FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!pGraphics) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!m_pProperties->m_pThemeProvider) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider; FX_BOOL bInactive = !IsActive(); int32_t iState = bInactive ? CFWL_PartState_Inactive : CFWL_PartState_Normal; @@ -262,7 +262,7 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, DrawBackground(pGraphics, pTheme); } #ifdef FWL_UseMacSystemBorder - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; #endif CFWL_ThemeBackground param; param.m_pWidget = m_pInterface; @@ -365,14 +365,14 @@ FWL_ERR CFWL_FormImp::DrawWidget(CFX_Graphics* pGraphics, } } #endif - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_FORMSIZE CFWL_FormImp::GetFormSize() { return m_eFormSize; } -FWL_ERR CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { +FWL_Error CFWL_FormImp::SetFormSize(FWL_FORMSIZE eFormSize) { m_eFormSize = eFormSize; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_FormImp::DoModal() { IFWL_App* pApp = GetOwnerApp(); @@ -399,31 +399,31 @@ IFWL_Widget* CFWL_FormImp::DoModal() { IFWL_Widget* CFWL_FormImp::DoModal(uint32_t& dwCommandID) { return DoModal(); } -FWL_ERR CFWL_FormImp::EndDoModal() { +FWL_Error CFWL_FormImp::EndDoModal() { if (!m_pNoteLoop) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; m_bDoModalFlag = FALSE; #if (_FX_OS_ == _FX_MACOSX_) m_pNoteLoop->EndModalLoop(); IFWL_App* pApp = GetOwnerApp(); if (!pApp) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_NoteDriver* pDriver = static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); if (!pDriver) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pDriver->PopNoteLoop(); SetStates(FWL_WGTSTATE_Invisible, TRUE); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; #else SetStates(FWL_WGTSTATE_Invisible, TRUE); return m_pNoteLoop->EndModalLoop(); #endif } -FWL_ERR CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { - return FWL_ERR_Succeeded; +FWL_Error CFWL_FormImp::SetBorderRegion(CFX_Path* pPath) { + return FWL_Error::Succeeded; } void CFWL_FormImp::DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme) { @@ -842,9 +842,10 @@ CFWL_FormImpDelegate::CFWL_FormImpDelegate(CFWL_FormImp* pOwner) : m_pOwner(pOwner) {} #ifdef FWL_UseMacSystemBorder -int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; + switch (pMessage->GetClassID()) { case CFWL_MessageType::Activate: { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; @@ -859,13 +860,12 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - return FWL_ERR_Succeeded; } #else -int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage) - return 0; - int32_t iRet = 1; + return; + switch (pMessage->GetClassID()) { case CFWL_MessageType::Activate: { m_pOwner->m_pProperties->m_dwStates &= ~FWL_WGTSTATE_Deactivated; @@ -938,7 +938,7 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); if (!pWidgetMgr) - return 0; + return; pWidgetMgr->AddRedrawCounts(m_pOwner->m_pInterface); if (!m_pOwner->m_bSetMaximize) @@ -962,24 +962,19 @@ int32_t CFWL_FormImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { break; } default: { - iRet = 0; break; } } - return iRet; } #endif // FWL_UseMacSystemBorder -FWL_ERR CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - if (!pEvent) - return FWL_ERR_Indefinite; - return FWL_ERR_Succeeded; -} +void CFWL_FormImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} -FWL_ERR CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOwner->DrawWidget(pGraphics, pMatrix); +void CFWL_FormImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOwner->DrawWidget(pGraphics, pMatrix); } + void CFWL_FormImpDelegate::OnLButtonDown(CFWL_MsgMouse* pMsg) { m_pOwner->SetGrab(TRUE); m_pOwner->m_bLButtonDown = TRUE; diff --git a/xfa/fwl/core/fwl_formimp.h b/xfa/fwl/core/fwl_formimp.h index d8bc80522e..f1bc51df37 100644 --- a/xfa/fwl/core/fwl_formimp.h +++ b/xfa/fwl/core/fwl_formimp.h @@ -69,24 +69,24 @@ class CFWL_FormImp : public CFWL_WidgetImp { public: CFWL_FormImp(const CFWL_WidgetImpProperties& properties, IFWL_Widget* pOuter); virtual ~CFWL_FormImp(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR GetClientRect(CFX_RectF& rect); - virtual FWL_ERR Update(); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error GetClientRect(CFX_RectF& rect); + virtual FWL_Error Update(); virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual FWL_FORMSIZE GetFormSize(); - virtual FWL_ERR SetFormSize(FWL_FORMSIZE eFormSize); + virtual FWL_Error SetFormSize(FWL_FORMSIZE eFormSize); virtual IFWL_Widget* DoModal(); virtual IFWL_Widget* DoModal(uint32_t& dwCommandID); - virtual FWL_ERR EndDoModal(); - virtual FWL_ERR SetBorderRegion(CFX_Path* pPath); + virtual FWL_Error EndDoModal(); + virtual FWL_Error SetBorderRegion(CFX_Path* pPath); virtual void DrawBackground(CFX_Graphics* pGraphics, IFWL_ThemeProvider* pTheme); CFWL_WidgetImp* GetSubFocus(); @@ -168,10 +168,10 @@ class CFWL_FormImp : public CFWL_WidgetImp { class CFWL_FormImpDelegate : public CFWL_WidgetImpDelegate { public: CFWL_FormImpDelegate(CFWL_FormImp* pOwner); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; protected: void OnLButtonDown(CFWL_MsgMouse* pMsg); diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp index 5d439d7f0c..560dc3c535 100644 --- a/xfa/fwl/core/fwl_noteimp.cpp +++ b/xfa/fwl/core/fwl_noteimp.cpp @@ -20,22 +20,22 @@ CFWL_NoteLoop::CFWL_NoteLoop(CFWL_WidgetImp* pForm) : m_pForm(pForm), m_bContinueModal(TRUE) {} -FWL_ERR CFWL_NoteLoop::Idle(int32_t count) { +FWL_Error CFWL_NoteLoop::Idle(int32_t count) { #if (_FX_OS_ == _FX_WIN32_DESKTOP_) if (count <= 0) { #endif CFWL_EvtIdle ev; IFWL_App* pApp = FWL_GetApp(); if (!pApp) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); if (!pDriver) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pDriver->SendEvent(&ev); #if (_FX_OS_ == _FX_WIN32_DESKTOP_) } #endif - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { return m_pForm; @@ -43,14 +43,14 @@ CFWL_WidgetImp* CFWL_NoteLoop::GetForm() { FX_BOOL CFWL_NoteLoop::ContinueModal() { return m_bContinueModal; } -FWL_ERR CFWL_NoteLoop::EndModalLoop() { +FWL_Error CFWL_NoteLoop::EndModalLoop() { m_bContinueModal = FALSE; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { +FWL_Error CFWL_NoteLoop::SetMainForm(CFWL_WidgetImp* pForm) { m_pForm = pForm; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) { CFWL_EvtMenuCommand ev; @@ -112,9 +112,9 @@ FX_BOOL CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) { } #define FWL_NoteDriver_EventKey 1100 -FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, - IFWL_Widget* pEventSource, - uint32_t dwFilter) { +FWL_Error CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, + IFWL_Widget* pEventSource, + uint32_t dwFilter) { uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( (void*)(uintptr_t)FWL_NoteDriver_EventKey); if (dwkey == 0) { @@ -130,19 +130,19 @@ FWL_ERR CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener, m_eventTargets.SetAt((void*)(uintptr_t)dwkey, value); } value->SetEventSource(pEventSource, dwFilter); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { +FWL_Error CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) { uint32_t dwkey = (uint32_t)(uintptr_t)pListener->GetPrivateData( (void*)(uintptr_t)FWL_NoteDriver_EventKey); if (dwkey == 0) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } CFWL_EventTarget* value = NULL; if (m_eventTargets.Lookup((void*)(uintptr_t)dwkey, (void*&)value)) { value->FlagInvalid(); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { ClearInvalidEventTargets(bRemoveAll); @@ -150,9 +150,9 @@ void CFWL_NoteDriver::ClearEventTargets(FX_BOOL bRemoveAll) { IFWL_App* CFWL_NoteDriver::GetOwnerApp() const { return FWL_GetApp(); } -FWL_ERR CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { +FWL_Error CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) { m_noteLoopQueue.Add(pNoteLoop); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() { int32_t pos = m_noteLoopQueue.GetSize(); @@ -203,10 +203,10 @@ FX_BOOL CFWL_NoteDriver::SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify) { } return TRUE; } -FWL_ERR CFWL_NoteDriver::Run() { +FWL_Error CFWL_NoteDriver::Run() { CFWL_WidgetMgr* pWidgetMgr = static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()); if (!pWidgetMgr) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \ _FX_OS_ == _FX_WIN64_) @@ -220,7 +220,7 @@ FWL_ERR CFWL_NoteDriver::Run() { } #endif - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_NoteDriver::GetFocus() { @@ -272,31 +272,31 @@ void CFWL_NoteDriver::NotifyTargetDestroy(IFWL_Widget* pNoteTarget) { } } -FWL_ERR CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) { +FWL_Error CFWL_NoteDriver::RegisterForm(CFWL_WidgetImp* pForm) { if (!pForm) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (m_forms.Find(pForm) >= 0) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } m_forms.Add(pForm); if (m_forms.GetSize() == 1) { CFWL_NoteLoop* pLoop = static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0)); if (!pLoop) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pLoop->SetMainForm(pForm); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) { +FWL_Error CFWL_NoteDriver::UnRegisterForm(CFWL_WidgetImp* pForm) { if (!pForm) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; int32_t nIndex = m_forms.Find(pForm); if (nIndex < 0) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } m_forms.RemoveAt(nIndex); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) { pMessage->Retain(); @@ -688,7 +688,7 @@ void CFWL_NoteDriver::ClearInvalidEventTargets(FX_BOOL bRemoveAll) { } class CFWL_CoreToolTipDP : public IFWL_ToolTipDP { public: - FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); + FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); int32_t GetInitialDelay(IFWL_Widget* pWidget); int32_t GetAutoPopDelay(IFWL_Widget* pWidget); CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget); @@ -706,10 +706,10 @@ CFWL_CoreToolTipDP::CFWL_CoreToolTipDP() { m_nAutoPopDelayTime = 50000; m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); } -FWL_ERR CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +FWL_Error CFWL_CoreToolTipDP::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsCaption; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_CoreToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { return m_nInitDelayTime; @@ -820,20 +820,21 @@ void CFWL_ToolTipContainer::DeleteInstance() { s_pInstance = NULL; } -FX_ERR CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { +FWL_Error CFWL_ToolTipContainer::AddToolTipTarget(IFWL_ToolTipTarget* pTarget) { if (m_arrWidget.Find(pTarget) < 0) { m_arrWidget.Add(pTarget); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } -FX_ERR CFWL_ToolTipContainer::RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget) { +FWL_Error CFWL_ToolTipContainer::RemoveToolTipTarget( + IFWL_ToolTipTarget* pTarget) { int index = m_arrWidget.Find(pTarget); if (index >= 0) { m_arrWidget.RemoveAt(index); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } FX_BOOL CFWL_ToolTipContainer::HasToolTip(IFWL_Widget* pWedget) { int32_t iCount = m_arrWidget.GetSize(); @@ -881,7 +882,7 @@ FX_BOOL CFWL_ToolTipContainer::ProcessEnter(CFWL_EvtMouse* pEvt, rt.height = r.height; } CFX_PointF pt(pEvt->m_fx, pEvt->m_fy); - if (pCurTarget->GetToolTipPos(pt) == FWL_ERR_Succeeded) { + if (pCurTarget->GetToolTipPos(pt) == FWL_Error::Succeeded) { rt.left = pt.x; rt.top = pt.y; m_pToolTipImp->ModifyStylesEx(FWL_STYLEEXT_TTP_NoAnchor, 0); diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h index 723d2e5742..778eae6045 100644 --- a/xfa/fwl/core/fwl_noteimp.h +++ b/xfa/fwl/core/fwl_noteimp.h @@ -44,11 +44,11 @@ class CFWL_NoteLoop { CFWL_NoteLoop(CFWL_WidgetImp* pForm = nullptr); ~CFWL_NoteLoop() {} - FWL_ERR Idle(int32_t count); + FWL_Error Idle(int32_t count); CFWL_WidgetImp* GetForm(); FX_BOOL ContinueModal(); - FWL_ERR EndModalLoop(); - FWL_ERR SetMainForm(CFWL_WidgetImp* pForm); + FWL_Error EndModalLoop(); + FWL_Error SetMainForm(CFWL_WidgetImp* pForm); protected: void GenerateCommondEvent(uint32_t dwCommand); @@ -63,25 +63,25 @@ class CFWL_NoteDriver { ~CFWL_NoteDriver(); FX_BOOL SendEvent(CFWL_Event* pNote); - FWL_ERR RegisterEventTarget(IFWL_Widget* pListener, - IFWL_Widget* pEventSource = nullptr, - uint32_t dwFilter = FWL_EVENT_ALL_MASK); - FWL_ERR UnregisterEventTarget(IFWL_Widget* pListener); + FWL_Error RegisterEventTarget(IFWL_Widget* pListener, + IFWL_Widget* pEventSource = nullptr, + uint32_t dwFilter = FWL_EVENT_ALL_MASK); + FWL_Error UnregisterEventTarget(IFWL_Widget* pListener); void ClearEventTargets(FX_BOOL bRemoveAll); IFWL_App* GetOwnerApp() const; - FWL_ERR PushNoteLoop(CFWL_NoteLoop* pNoteLoop); + FWL_Error PushNoteLoop(CFWL_NoteLoop* pNoteLoop); CFWL_NoteLoop* PopNoteLoop(); IFWL_Widget* GetFocus(); FX_BOOL SetFocus(IFWL_Widget* pFocus, FX_BOOL bNotify = FALSE); void SetGrab(IFWL_Widget* pGrab, FX_BOOL bSet); - FWL_ERR Run(); + FWL_Error Run(); IFWL_Widget* GetHover(); void SetHover(IFWL_Widget* pHover); void NotifyTargetHide(IFWL_Widget* pNoteTarget); void NotifyTargetDestroy(IFWL_Widget* pNoteTarget); - FWL_ERR RegisterForm(CFWL_WidgetImp* pForm); - FWL_ERR UnRegisterForm(CFWL_WidgetImp* pForm); + FWL_Error RegisterForm(CFWL_WidgetImp* pForm); + FWL_Error UnRegisterForm(CFWL_WidgetImp* pForm); FX_BOOL QueueMessage(CFWL_Message* pMessage); FX_BOOL UnqueueMessage(CFWL_NoteLoop* pNoteLoop); CFWL_NoteLoop* GetTopLoop(); @@ -141,8 +141,8 @@ class CFWL_ToolTipContainer { static CFWL_ToolTipContainer* getInstance(); static void DeleteInstance(); - FX_ERR AddToolTipTarget(IFWL_ToolTipTarget* pTarget); - FX_ERR RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget); + FWL_Error AddToolTipTarget(IFWL_ToolTipTarget* pTarget); + FWL_Error RemoveToolTipTarget(IFWL_ToolTipTarget* pTarget); IFWL_ToolTipTarget* GetCurrentToolTipTarget(); FX_BOOL HasToolTip(IFWL_Widget* pWidget); diff --git a/xfa/fwl/core/fwl_timerimp.cpp b/xfa/fwl/core/fwl_timerimp.cpp index 5adf8e158c..ced5adeb9d 100644 --- a/xfa/fwl/core/fwl_timerimp.cpp +++ b/xfa/fwl/core/fwl_timerimp.cpp @@ -23,12 +23,14 @@ FWL_HTIMER FWL_StartTimer(IFWL_Timer* pTimer, pAdapterTimerMgr->Start(pTimer, dwElapse, hTimer, bImmediately); return hTimer; } -int32_t FWL_StopTimer(FWL_HTIMER hTimer) { + +FWL_Error FWL_StopTimer(FWL_HTIMER hTimer) { CXFA_FFApp* pAdapterNative = FWL_GetAdapterNative(); if (!pAdapterNative) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + IFWL_AdapterTimerMgr* pAdapterTimerMgr = pAdapterNative->GetTimerMgr(); if (!pAdapterTimerMgr) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return pAdapterTimerMgr->Stop(hTimer); } diff --git a/xfa/fwl/core/fwl_widgetimp.cpp b/xfa/fwl/core/fwl_widgetimp.cpp index 8863cef0f3..f45a66cc2d 100644 --- a/xfa/fwl/core/fwl_widgetimp.cpp +++ b/xfa/fwl/core/fwl_widgetimp.cpp @@ -28,7 +28,7 @@ IFWL_Widget::~IFWL_Widget() {} -FWL_ERR IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { +FWL_Error IFWL_Widget::GetClassName(CFX_WideString& wsClass) const { return m_pImpl->GetClassName(wsClass); } @@ -40,37 +40,37 @@ FX_BOOL IFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { return m_pImpl->IsInstance(wsClass); } -FWL_ERR IFWL_Widget::Initialize() { +FWL_Error IFWL_Widget::Initialize() { return m_pImpl->Initialize(); } -FWL_ERR IFWL_Widget::Finalize() { +FWL_Error IFWL_Widget::Finalize() { return m_pImpl->Finalize(); } -FWL_ERR IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error IFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->GetWidgetRect(rect, bAutoSize); } -FWL_ERR IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { +FWL_Error IFWL_Widget::GetGlobalRect(CFX_RectF& rect) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetGlobalRect(rect); } -FWL_ERR IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { +FWL_Error IFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { return static_cast<CFWL_WidgetImp*>(GetImpl())->SetWidgetRect(rect); } -FWL_ERR IFWL_Widget::GetClientRect(CFX_RectF& rect) { +FWL_Error IFWL_Widget::GetClientRect(CFX_RectF& rect) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetClientRect(rect); } IFWL_Widget* IFWL_Widget::GetParent() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetParent(); } -FWL_ERR IFWL_Widget::SetParent(IFWL_Widget* pParent) { +FWL_Error IFWL_Widget::SetParent(IFWL_Widget* pParent) { return static_cast<CFWL_WidgetImp*>(GetImpl())->SetParent(pParent); } IFWL_Widget* IFWL_Widget::GetOwner() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOwner(); } -FWL_ERR IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { +FWL_Error IFWL_Widget::SetOwner(IFWL_Widget* pOwner) { return static_cast<CFWL_WidgetImp*>(GetImpl())->SetOwner(pOwner); } IFWL_Widget* IFWL_Widget::GetOuter() { @@ -79,16 +79,16 @@ IFWL_Widget* IFWL_Widget::GetOuter() { uint32_t IFWL_Widget::GetStyles() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStyles(); } -FWL_ERR IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved) { +FWL_Error IFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->ModifyStyles(dwStylesAdded, dwStylesRemoved); } uint32_t IFWL_Widget::GetStylesEx() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetStylesEx(); } -FWL_ERR IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error IFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -98,54 +98,54 @@ uint32_t IFWL_Widget::GetStates() { void IFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { static_cast<CFWL_WidgetImp*>(GetImpl())->SetStates(dwStates, bSet); } -FWL_ERR IFWL_Widget::SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback) { +FWL_Error IFWL_Widget::SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->SetPrivateData(module_id, pData, callback); } void* IFWL_Widget::GetPrivateData(void* module_id) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetPrivateData(module_id); } -FWL_ERR IFWL_Widget::Update() { +FWL_Error IFWL_Widget::Update() { return static_cast<CFWL_WidgetImp*>(GetImpl())->Update(); } -FWL_ERR IFWL_Widget::LockUpdate() { +FWL_Error IFWL_Widget::LockUpdate() { return static_cast<CFWL_WidgetImp*>(GetImpl())->LockUpdate(); } -FWL_ERR IFWL_Widget::UnlockUpdate() { +FWL_Error IFWL_Widget::UnlockUpdate() { return static_cast<CFWL_WidgetImp*>(GetImpl())->UnlockUpdate(); } FWL_WidgetHit IFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return static_cast<CFWL_WidgetImp*>(GetImpl())->HitTest(fx, fy); } -FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy) { +FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, + FX_FLOAT& fx, + FX_FLOAT& fy) { return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, fx, fy); } -FWL_ERR IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { +FWL_Error IFWL_Widget::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { return static_cast<CFWL_WidgetImp*>(GetImpl())->TransformTo(pWidget, rt); } -FWL_ERR IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { +FWL_Error IFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetMatrix(matrix, bGlobal); } -FWL_ERR IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { +FWL_Error IFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { return static_cast<CFWL_WidgetImp*>(GetImpl())->SetMatrix(matrix); } -FWL_ERR IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error IFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->DrawWidget(pGraphics, pMatrix); } IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetThemeProvider(); } -FWL_ERR IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->SetThemeProvider(pThemeProvider); } -FWL_ERR IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { +FWL_Error IFWL_Widget::SetDataProvider(IFWL_DataProvider* pDataProvider) { return static_cast<CFWL_WidgetImp*>(GetImpl()) ->SetDataProvider(pDataProvider); } @@ -159,15 +159,17 @@ CFX_SizeF IFWL_Widget::GetOffsetFromParent(IFWL_Widget* pParent) { return static_cast<CFWL_WidgetImp*>(GetImpl())->GetOffsetFromParent(pParent); } -FWL_ERR CFWL_WidgetImp::Initialize() { +FWL_Error CFWL_WidgetImp::Initialize() { IFWL_App* pApp = FWL_GetApp(); if (!pApp) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + CXFA_FFApp* pAdapter = pApp->GetAdapterNative(); if (!pAdapter) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; SetOwnerApp(static_cast<CFWL_AppImp*>(FWL_GetApp()->GetImpl())); + IFWL_Widget* pParent = m_pProperties->m_pParent; m_pWidgetMgr->InsertWidget(pParent, m_pInterface); if (!IsChild()) { @@ -175,18 +177,18 @@ FWL_ERR CFWL_WidgetImp::Initialize() { if (pOwner) m_pWidgetMgr->SetOwner(pOwner, m_pInterface); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::Finalize() { +FWL_Error CFWL_WidgetImp::Finalize() { NotifyDriver(); m_pWidgetMgr->RemoveWidget(m_pInterface); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_WidgetImp::GetClassName(CFX_WideString& wsClass) const { wsClass.clear(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_WidgetImp::GetClassID() const { @@ -197,7 +199,7 @@ FX_BOOL CFWL_WidgetImp::IsInstance(const CFX_WideStringC& wsClass) const { return FALSE; } -FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (bAutoSize) { if (HasEdge()) { FX_FLOAT fEdge = GetEdgeWidth(); @@ -210,21 +212,21 @@ FWL_ERR CFWL_WidgetImp::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { } else { rect = m_pProperties->m_rtWidget; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::GetGlobalRect(CFX_RectF& rect) { +FWL_Error CFWL_WidgetImp::GetGlobalRect(CFX_RectF& rect) { IFWL_Widget* pForm = m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); if (!pForm) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; rect.Set(0, 0, m_pProperties->m_rtWidget.width, m_pProperties->m_rtWidget.height); if (pForm == m_pInterface) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } return TransformTo(pForm, rect); } -FWL_ERR CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { +FWL_Error CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { CFX_RectF rtOld = m_pProperties->m_rtWidget; m_pProperties->m_rtWidget = rect; if (IsChild()) { @@ -239,34 +241,34 @@ FWL_ERR CFWL_WidgetImp::SetWidgetRect(const CFX_RectF& rect) { pDelegate->OnProcessEvent(&ev); } } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } m_pWidgetMgr->SetWidgetRect_Native(m_pInterface, rect); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::GetClientRect(CFX_RectF& rect) { +FWL_Error CFWL_WidgetImp::GetClientRect(CFX_RectF& rect) { GetEdgeRect(rect); if (HasEdge()) { FX_FLOAT fEdge = GetEdgeWidth(); rect.Deflate(fEdge, fEdge); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_WidgetImp::GetParent() { return m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_Parent); } -FWL_ERR CFWL_WidgetImp::SetParent(IFWL_Widget* pParent) { +FWL_Error CFWL_WidgetImp::SetParent(IFWL_Widget* pParent) { m_pProperties->m_pParent = pParent; m_pWidgetMgr->SetParent(pParent, m_pInterface); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_WidgetImp::GetOwner() { return m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_Owner); } -FWL_ERR CFWL_WidgetImp::SetOwner(IFWL_Widget* pOwner) { +FWL_Error CFWL_WidgetImp::SetOwner(IFWL_Widget* pOwner) { m_pProperties->m_pOwner = pOwner; m_pWidgetMgr->SetOwner(pOwner, m_pInterface); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_WidgetImp::GetOuter() { return m_pOuter; @@ -274,20 +276,20 @@ IFWL_Widget* CFWL_WidgetImp::GetOuter() { uint32_t CFWL_WidgetImp::GetStyles() { return m_pProperties->m_dwStyles; } -FWL_ERR CFWL_WidgetImp::ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved) { +FWL_Error CFWL_WidgetImp::ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved) { m_pProperties->m_dwStyles = (m_pProperties->m_dwStyles & ~dwStylesRemoved) | dwStylesAdded; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_WidgetImp::GetStylesEx() { return m_pProperties->m_dwStyleExes; } -FWL_ERR CFWL_WidgetImp::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_WidgetImp::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { m_pProperties->m_dwStyleExes = (m_pProperties->m_dwStyleExes & ~dwStylesExRemoved) | dwStylesExAdded; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_WidgetImp::GetStates() { return m_pProperties->m_dwStates; @@ -302,6 +304,7 @@ static void NotifyHideChildWidget(IFWL_WidgetMgr* widgetMgr, child = widgetMgr->GetWidget(child, FWL_WGTRELATION_NextSibling); } } + void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { bSet ? (m_pProperties->m_dwStates |= dwStates) : (m_pProperties->m_dwStates &= ~dwStates); @@ -321,32 +324,32 @@ void CFWL_WidgetImp::SetStates(uint32_t dwStates, FX_BOOL bSet) { } return; } -FWL_ERR CFWL_WidgetImp::SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback) { +FWL_Error CFWL_WidgetImp::SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback) { if (!m_pPrivateData) { m_pPrivateData = new CFX_PrivateData; } m_pPrivateData->SetPrivateData(module_id, pData, callback); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void* CFWL_WidgetImp::GetPrivateData(void* module_id) { if (!m_pPrivateData) return NULL; return m_pPrivateData->GetPrivateData(module_id); } -FWL_ERR CFWL_WidgetImp::Update() { - return FWL_ERR_Succeeded; +FWL_Error CFWL_WidgetImp::Update() { + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::LockUpdate() { +FWL_Error CFWL_WidgetImp::LockUpdate() { m_iLock++; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::UnlockUpdate() { +FWL_Error CFWL_WidgetImp::UnlockUpdate() { if (IsLocked()) { m_iLock--; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { CFX_RectF rtClient; @@ -367,9 +370,9 @@ FWL_WidgetHit CFWL_WidgetImp::HitTest(FX_FLOAT fx, FX_FLOAT fy) { } return FWL_WidgetHit::Unknown; } -FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy) { +FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, + FX_FLOAT& fx, + FX_FLOAT& fy) { if (m_pWidgetMgr->IsFormDisabled()) { CFX_SizeF szOffset; if (IsParent(pWidget)) { @@ -381,7 +384,7 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, } fx += szOffset.x; fy += szOffset.y; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_RectF r; CFX_Matrix m; @@ -396,17 +399,17 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, IFWL_Widget* form1 = m_pWidgetMgr->GetWidget(m_pInterface, FWL_WGTRELATION_SystemForm); if (!form1) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (!pWidget) { form1->GetWidgetRect(r); fx += r.left; fy += r.top; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* form2 = m_pWidgetMgr->GetWidget(pWidget, FWL_WGTRELATION_SystemForm); if (!form2) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (form1 != form2) { form1->GetWidgetRect(r); fx += r.left; @@ -426,14 +429,14 @@ FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, fx -= r.left; fy -= r.top; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { +FWL_Error CFWL_WidgetImp::TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt) { return TransformTo(pWidget, rt.left, rt.top); } -FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { +FWL_Error CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { if (!m_pProperties) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (bGlobal) { IFWL_Widget* parent = GetParent(); CFX_ArrayTemplate<IFWL_Widget*> parents; @@ -457,32 +460,32 @@ FWL_ERR CFWL_WidgetImp::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { } else { matrix = m_pProperties->m_ctmOnParent; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) { +FWL_Error CFWL_WidgetImp::SetMatrix(const CFX_Matrix& matrix) { if (!m_pProperties) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_Widget* parent = GetParent(); if (!parent) { - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; } m_pProperties->m_ctmOnParent = matrix; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return FWL_ERR_Indefinite; +FWL_Error CFWL_WidgetImp::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + return FWL_Error::Indefinite; } IFWL_ThemeProvider* CFWL_WidgetImp::GetThemeProvider() { return m_pProperties->m_pThemeProvider; } -FWL_ERR CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { +FWL_Error CFWL_WidgetImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pProperties->m_pThemeProvider = pThemeProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetImp::SetDataProvider(IFWL_DataProvider* pDataProvider) { +FWL_Error CFWL_WidgetImp::SetDataProvider(IFWL_DataProvider* pDataProvider) { m_pProperties->m_pDataProvider = pDataProvider; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate( IFWL_WidgetDelegate* pDelegate) { @@ -499,9 +502,9 @@ IFWL_WidgetDelegate* CFWL_WidgetImp::SetDelegate( IFWL_App* CFWL_WidgetImp::GetOwnerApp() const { return static_cast<IFWL_App*>(m_pOwnerApp->GetInterface()); } -FWL_ERR CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { +FWL_Error CFWL_WidgetImp::SetOwnerApp(CFWL_AppImp* pOwnerApp) { m_pOwnerApp = pOwnerApp; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFWL_Widget* CFWL_WidgetImp::GetInterface() const { return m_pInterface; @@ -963,9 +966,9 @@ FX_BOOL CFWL_WidgetImp::IsParent(IFWL_Widget* pParent) { CFWL_WidgetImpDelegate::CFWL_WidgetImpDelegate() {} -int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { +void CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { if (!pMessage->m_pDstTarget) - return 0; + return; CFWL_WidgetImp* pWidget = static_cast<CFWL_WidgetImp*>(pMessage->m_pDstTarget->GetImpl()); @@ -1030,16 +1033,12 @@ int32_t CFWL_WidgetImpDelegate::OnProcessMessage(CFWL_Message* pMessage) { default: break; } - return 1; } -FWL_ERR CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; -} +void CFWL_WidgetImpDelegate::OnProcessEvent(CFWL_Event* pEvent) {} -FWL_ERR CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +void CFWL_WidgetImpDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { CFWL_EvtDraw evt; evt.m_pGraphics = pGraphics; - return FWL_ERR_Succeeded; } diff --git a/xfa/fwl/core/fwl_widgetimp.h b/xfa/fwl/core/fwl_widgetimp.h index d20fe0d75e..4af2872f41 100644 --- a/xfa/fwl/core/fwl_widgetimp.h +++ b/xfa/fwl/core/fwl_widgetimp.h @@ -28,49 +28,51 @@ class CFWL_WidgetImp { public: virtual ~CFWL_WidgetImp(); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const; + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const; virtual uint32_t GetClassID() const; virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - virtual FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - virtual FWL_ERR GetGlobalRect(CFX_RectF& rect); - virtual FWL_ERR SetWidgetRect(const CFX_RectF& rect); - virtual FWL_ERR GetClientRect(CFX_RectF& rect); + virtual FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + virtual FWL_Error GetGlobalRect(CFX_RectF& rect); + virtual FWL_Error SetWidgetRect(const CFX_RectF& rect); + virtual FWL_Error GetClientRect(CFX_RectF& rect); virtual IFWL_Widget* GetParent(); - virtual FWL_ERR SetParent(IFWL_Widget* pParent); + virtual FWL_Error SetParent(IFWL_Widget* pParent); virtual IFWL_Widget* GetOwner(); - virtual FWL_ERR SetOwner(IFWL_Widget* pOwner); + virtual FWL_Error SetOwner(IFWL_Widget* pOwner); virtual IFWL_Widget* GetOuter(); virtual uint32_t GetStyles(); - virtual FWL_ERR ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved); + virtual FWL_Error ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved); virtual uint32_t GetStylesEx(); - virtual FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + virtual FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); virtual uint32_t GetStates(); virtual void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - virtual FWL_ERR SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); + virtual FWL_Error SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback); virtual void* GetPrivateData(void* module_id); - virtual FWL_ERR Update(); - virtual FWL_ERR LockUpdate(); - virtual FWL_ERR UnlockUpdate(); + virtual FWL_Error Update(); + virtual FWL_Error LockUpdate(); + virtual FWL_Error UnlockUpdate(); virtual FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - virtual FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); - virtual FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); - virtual FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); - virtual FWL_ERR SetMatrix(const CFX_Matrix& matrix); - virtual FWL_ERR DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual FWL_Error TransformTo(IFWL_Widget* pWidget, + FX_FLOAT& fx, + FX_FLOAT& fy); + virtual FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); + virtual FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); + virtual FWL_Error SetMatrix(const CFX_Matrix& matrix); + virtual FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); virtual IFWL_ThemeProvider* GetThemeProvider(); - virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); - virtual FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); + virtual FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + virtual FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); virtual IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); virtual IFWL_App* GetOwnerApp() const; - FWL_ERR SetOwnerApp(CFWL_AppImp* pOwnerApp); + FWL_Error SetOwnerApp(CFWL_AppImp* pOwnerApp); IFWL_Widget* GetInterface() const; void SetInterface(IFWL_Widget* pInterface); CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); @@ -163,10 +165,10 @@ class CFWL_WidgetImpDelegate : public IFWL_WidgetDelegate { public: CFWL_WidgetImpDelegate(); ~CFWL_WidgetImpDelegate() override {} - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; }; #endif // XFA_FWL_CORE_FWL_WIDGETIMP_H_ diff --git a/xfa/fwl/core/fwl_widgetmgrimp.cpp b/xfa/fwl/core/fwl_widgetmgrimp.cpp index e56c308be9..28500c2cb2 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.cpp +++ b/xfa/fwl/core/fwl_widgetmgrimp.cpp @@ -219,10 +219,10 @@ FX_BOOL CFWL_WidgetMgr::SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) { } return TRUE; } -FWL_ERR CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, - const CFX_RectF* pRect) { +FWL_Error CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, + const CFX_RectF* pRect) { if (!m_pAdapter) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_Widget* pNative = pWidget; CFX_RectF rect(*pRect); if (IsFormDisabled()) { @@ -238,7 +238,7 @@ FWL_ERR CFWL_WidgetMgr::RepaintWidget(IFWL_Widget* pWidget, } else if (!IsAbleNative(pWidget)) { pNative = GetWidget(pWidget, FWL_WGTRELATION_SystemForm); if (!pNative) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pWidget->TransformTo(pNative, rect.left, rect.top); } AddRedrawCounts(pNative); @@ -371,8 +371,9 @@ FX_BOOL CFWL_WidgetMgr::IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent) { } while (pTemp); return FALSE; } -FWL_ERR CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, - const CFX_RectF& rect) { + +FWL_Error CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, + const CFX_RectF& rect) { if (FWL_UseOffscreen(pWidget)) { CFWL_WidgetMgrItem* pItem = GetWidgetMgrItem(pWidget); pItem->iRedrawCounter++; @@ -391,8 +392,9 @@ FWL_ERR CFWL_WidgetMgr::SetWidgetRect_Native(IFWL_Widget* pWidget, pItem->bOutsideChanged = !m_rtScreen.Contains(rect); #endif } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } + IFWL_Widget* CFWL_WidgetMgr::GetWidgetAtPoint(IFWL_Widget* parent, FX_FLOAT x, FX_FLOAT y) { @@ -631,25 +633,26 @@ FX_BOOL CFWL_WidgetMgr::GetAdapterPopupPos(IFWL_Widget* pWidget, } CFWL_WidgetMgrDelegate::CFWL_WidgetMgrDelegate(CFWL_WidgetMgr* pWidgetMgr) : m_pWidgetMgr(pWidgetMgr) {} -FWL_ERR CFWL_WidgetMgrDelegate::OnSetCapability(uint32_t dwCapability) { +FWL_Error CFWL_WidgetMgrDelegate::OnSetCapability(uint32_t dwCapability) { m_pWidgetMgr->m_dwCapability = dwCapability; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -int32_t CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) { + +void CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) { if (!pMessage) - return 0; + return; if (!pMessage->m_pDstTarget) - return 0; + return; IFWL_Widget* pDstWidget = pMessage->m_pDstTarget; IFWL_App* pApp = pDstWidget->GetOwnerApp(); if (!pApp) - return 0; + return; CFWL_NoteDriver* pNoteDriver = static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver()); if (!pNoteDriver) - return 0; + return; if (m_pWidgetMgr->IsThreadEnabled()) pMessage = static_cast<CFWL_Message*>(pMessage->Clone()); @@ -660,23 +663,21 @@ int32_t CFWL_WidgetMgrDelegate::OnProcessMessageToForm(CFWL_Message* pMessage) { #if (_FX_OS_ == _FX_MACOSX_) CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop(); - if (pTopLoop) { + if (pTopLoop) pNoteDriver->UnqueueMessage(pTopLoop); - } #endif - if (m_pWidgetMgr->IsThreadEnabled()) { + + if (m_pWidgetMgr->IsThreadEnabled()) pMessage->Release(); - } - return FWL_ERR_Succeeded; + + return; } -FWL_ERR CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - if (!pWidget) - return FWL_ERR_Indefinite; - if (!pGraphics) - return FWL_ERR_Indefinite; +void CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, + CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + if (!pWidget || !pGraphics) + return; CFX_Graphics* pTemp = DrawWidgetBefore(pWidget, pGraphics, pMatrix); CFX_RectF clipCopy; @@ -684,7 +685,7 @@ FWL_ERR CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, clipCopy.left = clipCopy.top = 0; if (bUseOffscreenDirect(pWidget)) { DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); - return FWL_ERR_Succeeded; + return; } CFX_RectF clipBounds; @@ -718,7 +719,6 @@ FWL_ERR CFWL_WidgetMgrDelegate::OnDrawWidget(IFWL_Widget* pWidget, DrawWidgetAfter(pWidget, pGraphics, clipCopy, pMatrix); m_pWidgetMgr->ResetRedrawCounts(pWidget); - return FWL_ERR_Succeeded; } void CFWL_WidgetMgrDelegate::DrawChild(IFWL_Widget* parent, diff --git a/xfa/fwl/core/fwl_widgetmgrimp.h b/xfa/fwl/core/fwl_widgetmgrimp.h index ff732e5cc0..fe17613364 100644 --- a/xfa/fwl/core/fwl_widgetmgrimp.h +++ b/xfa/fwl/core/fwl_widgetmgrimp.h @@ -71,8 +71,8 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr { FWL_WGTRELATION eRelation) override; int32_t GetWidgetIndex(IFWL_Widget* pWidget) override; FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) override; - FWL_ERR RepaintWidget(IFWL_Widget* pWidget, - const CFX_RectF* pRect = NULL) override; + FWL_Error RepaintWidget(IFWL_Widget* pWidget, + const CFX_RectF* pRect = NULL) override; uint32_t GetCapability() override { return m_dwCapability; } void AddWidget(IFWL_Widget* pWidget); @@ -83,7 +83,7 @@ class CFWL_WidgetMgr : public IFWL_WidgetMgr { void SetOwner(IFWL_Widget* pOwner, IFWL_Widget* pOwned); void SetParent(IFWL_Widget* pParent, IFWL_Widget* pChild); FX_BOOL IsChild(IFWL_Widget* pChild, IFWL_Widget* pParent); - FWL_ERR SetWidgetRect_Native(IFWL_Widget* pWidget, const CFX_RectF& rect); + FWL_Error SetWidgetRect_Native(IFWL_Widget* pWidget, const CFX_RectF& rect); IFWL_Widget* GetWidgetAtPoint(IFWL_Widget* pParent, FX_FLOAT fx, FX_FLOAT fy); void NotifySizeChanged(IFWL_Widget* pForm, FX_FLOAT fx, FX_FLOAT fy); IFWL_Widget* nextTab(IFWL_Widget* parent, IFWL_Widget* focus, FX_BOOL& bFind); @@ -127,11 +127,11 @@ class CFWL_WidgetMgrDelegate { CFWL_WidgetMgrDelegate(CFWL_WidgetMgr* pWidgetMgr); ~CFWL_WidgetMgrDelegate() {} - FWL_ERR OnSetCapability(uint32_t dwCapability = FWL_WGTMGR_DisableThread); - int32_t OnProcessMessageToForm(CFWL_Message* pMessage); - FWL_ERR OnDrawWidget(IFWL_Widget* pWidget, - CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix); + FWL_Error OnSetCapability(uint32_t dwCapability = FWL_WGTMGR_DisableThread); + void OnProcessMessageToForm(CFWL_Message* pMessage); + void OnDrawWidget(IFWL_Widget* pWidget, + CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix); protected: void DrawChild(IFWL_Widget* pParent, diff --git a/xfa/fwl/core/ifwl_app.h b/xfa/fwl/core/ifwl_app.h index af5fafe0ad..41983ef8f5 100644 --- a/xfa/fwl/core/ifwl_app.h +++ b/xfa/fwl/core/ifwl_app.h @@ -34,8 +34,8 @@ class IFWL_App { virtual ~IFWL_App() {} - FWL_ERR Initialize(); - FWL_ERR Finalize(); + FWL_Error Initialize(); + FWL_Error Finalize(); CXFA_FFApp* GetAdapterNative(); IFWL_WidgetMgr* GetWidgetMgr(); IFWL_ThemeProvider* GetThemeProvider(); diff --git a/xfa/fwl/core/ifwl_dataprovider.h b/xfa/fwl/core/ifwl_dataprovider.h index 271edb7ac8..5643a3d079 100644 --- a/xfa/fwl/core/ifwl_dataprovider.h +++ b/xfa/fwl/core/ifwl_dataprovider.h @@ -15,8 +15,8 @@ class IFWL_Widget; class IFWL_DataProvider { public: virtual ~IFWL_DataProvider() {} - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) = 0; + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) = 0; }; #endif // XFA_FWL_CORE_IFWL_DATAPROVIDER_H_ diff --git a/xfa/fwl/core/ifwl_form.h b/xfa/fwl/core/ifwl_form.h index 185e059826..22d6ecea12 100644 --- a/xfa/fwl/core/ifwl_form.h +++ b/xfa/fwl/core/ifwl_form.h @@ -53,11 +53,11 @@ class IFWL_Form : public IFWL_Widget { IFWL_Widget* pOuter); FWL_FORMSIZE GetFormSize(); - FWL_ERR SetFormSize(FWL_FORMSIZE eFormSize); + FWL_Error SetFormSize(FWL_FORMSIZE eFormSize); IFWL_Widget* DoModal(); IFWL_Widget* DoModal(uint32_t& dwCommandID); - FWL_ERR EndDoModal(); - FWL_ERR SetBorderRegion(CFX_Path* pPath); + FWL_Error EndDoModal(); + FWL_Error SetBorderRegion(CFX_Path* pPath); protected: IFWL_Form(); diff --git a/xfa/fwl/core/ifwl_themeprovider.h b/xfa/fwl/core/ifwl_themeprovider.h index c790da5f4e..66e7e0c4fd 100644 --- a/xfa/fwl/core/ifwl_themeprovider.h +++ b/xfa/fwl/core/ifwl_themeprovider.h @@ -25,16 +25,17 @@ class IFWL_ThemeProvider { virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren = TRUE) = 0; - virtual FWL_ERR GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) = 0; - virtual FWL_ERR SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) = 0; + virtual FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, + CFX_Matrix& matrix) = 0; + virtual FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix) = 0; virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) = 0; virtual FX_BOOL DrawText(CFWL_ThemeText* pParams) = 0; virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) = 0; virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) = 0; - virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) = 0; + virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, + CFX_RectF& rtPart) = 0; virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, FX_FLOAT fx, FX_FLOAT fy) = 0; diff --git a/xfa/fwl/core/ifwl_timer.h b/xfa/fwl/core/ifwl_timer.h index 5f113bc021..0143560410 100644 --- a/xfa/fwl/core/ifwl_timer.h +++ b/xfa/fwl/core/ifwl_timer.h @@ -19,6 +19,6 @@ class IFWL_Timer { FWL_HTIMER FWL_StartTimer(IFWL_Timer* pTimer, uint32_t dwElapse, FX_BOOL bImmediately = TRUE); -int32_t FWL_StopTimer(FWL_HTIMER hTimer); +FWL_Error FWL_StopTimer(FWL_HTIMER hTimer); #endif // XFA_FWL_CORE_IFWL_TIMER_H_ diff --git a/xfa/fwl/core/ifwl_tooltiptarget.h b/xfa/fwl/core/ifwl_tooltiptarget.h index 0b364f2754..7489e73efd 100644 --- a/xfa/fwl/core/ifwl_tooltiptarget.h +++ b/xfa/fwl/core/ifwl_tooltiptarget.h @@ -20,13 +20,15 @@ class IFWL_ToolTipTarget { virtual ~IFWL_ToolTipTarget() {} virtual IFWL_Widget* GetWidget() = 0; virtual FX_BOOL IsShowed() = 0; - virtual FWL_ERR DrawToolTip(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix, - IFWL_Widget* pToolTip) = 0; + virtual FWL_Error DrawToolTip(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix, + IFWL_Widget* pToolTip) = 0; virtual FX_BOOL UseDefaultTheme() = 0; - virtual FWL_ERR GetCaption(CFX_WideString& wsCaption) = 0; - virtual FWL_ERR GetToolTipSize(CFX_SizeF& sz) = 0; - virtual FWL_ERR GetToolTipPos(CFX_PointF& pt) { return FWL_ERR_Indefinite; } + virtual FWL_Error GetCaption(CFX_WideString& wsCaption) = 0; + virtual FWL_Error GetToolTipSize(CFX_SizeF& sz) = 0; + virtual FWL_Error GetToolTipPos(CFX_PointF& pt) { + return FWL_Error::Indefinite; + } }; #endif // XFA_FWL_CORE_IFWL_TOOLTIPTARGET_H_ diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h index 8ec758a566..691e4606c5 100644 --- a/xfa/fwl/core/ifwl_widget.h +++ b/xfa/fwl/core/ifwl_widget.h @@ -39,48 +39,50 @@ class IFWL_Widget { IFWL_Widget() : m_pImpl(nullptr) {} virtual ~IFWL_Widget(); - FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - FWL_ERR GetGlobalRect(CFX_RectF& rect); - FWL_ERR SetWidgetRect(const CFX_RectF& rect); - FWL_ERR GetClientRect(CFX_RectF& rect); + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + FWL_Error GetGlobalRect(CFX_RectF& rect); + FWL_Error SetWidgetRect(const CFX_RectF& rect); + FWL_Error GetClientRect(CFX_RectF& rect); IFWL_Widget* GetParent(); - FWL_ERR SetParent(IFWL_Widget* pParent); + FWL_Error SetParent(IFWL_Widget* pParent); IFWL_Widget* GetOwner(); - FWL_ERR SetOwner(IFWL_Widget* pOwner); + FWL_Error SetOwner(IFWL_Widget* pOwner); IFWL_Widget* GetOuter(); uint32_t GetStyles(); - FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); + FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); uint32_t GetStylesEx(); - FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); + FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); uint32_t GetStates(); void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - FWL_ERR SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); + FWL_Error SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback); void* GetPrivateData(void* module_id); - FWL_ERR Update(); - FWL_ERR LockUpdate(); - FWL_ERR UnlockUpdate(); + FWL_Error Update(); + FWL_Error LockUpdate(); + FWL_Error UnlockUpdate(); FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - FWL_ERR TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); - FWL_ERR TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); - FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); - FWL_ERR SetMatrix(const CFX_Matrix& matrix); - FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); + FWL_Error TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); + FWL_Error TransformTo(IFWL_Widget* pWidget, CFX_RectF& rt); + FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); + FWL_Error SetMatrix(const CFX_Matrix& matrix); + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); IFWL_ThemeProvider* GetThemeProvider(); - FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); - FWL_ERR SetDataProvider(IFWL_DataProvider* pDataProvider); + FWL_Error SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); + FWL_Error SetDataProvider(IFWL_DataProvider* pDataProvider); IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); IFWL_App* GetOwnerApp() const; CFX_SizeF GetOffsetFromParent(IFWL_Widget* pParent); // These call into equivalent polymorphic methods of m_pImpl. There // should be no need to override these in subclasses. - FWL_ERR GetClassName(CFX_WideString& wsClass) const; + FWL_Error GetClassName(CFX_WideString& wsClass) const; uint32_t GetClassID() const; FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - FWL_ERR Initialize(); - FWL_ERR Finalize(); + FWL_Error Initialize(); + FWL_Error Finalize(); CFWL_WidgetImp* GetImpl() const { return m_pImpl.get(); } diff --git a/xfa/fwl/core/ifwl_widgetdelegate.h b/xfa/fwl/core/ifwl_widgetdelegate.h index 7fb56d3ba1..820fb6b1c4 100644 --- a/xfa/fwl/core/ifwl_widgetdelegate.h +++ b/xfa/fwl/core/ifwl_widgetdelegate.h @@ -7,6 +7,8 @@ #ifndef XFA_FWL_CORE_IFWL_WIDGETDELEGATE_H_ #define XFA_FWL_CORE_IFWL_WIDGETDELEGATE_H_ +#include <stdint.h> + #include "xfa/fwl/core/fwl_error.h" class CFWL_Event; @@ -17,10 +19,10 @@ class CFX_Matrix; class IFWL_WidgetDelegate { public: virtual ~IFWL_WidgetDelegate() {} - virtual int32_t OnProcessMessage(CFWL_Message* pMessage) = 0; - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent) = 0; - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) = 0; + virtual void OnProcessMessage(CFWL_Message* pMessage) = 0; + virtual void OnProcessEvent(CFWL_Event* pEvent) = 0; + virtual void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) = 0; }; #endif // XFA_FWL_CORE_IFWL_WIDGETDELEGATE_H_ diff --git a/xfa/fwl/core/ifwl_widgetmgr.h b/xfa/fwl/core/ifwl_widgetmgr.h index 3924ba8a29..6e25b72290 100644 --- a/xfa/fwl/core/ifwl_widgetmgr.h +++ b/xfa/fwl/core/ifwl_widgetmgr.h @@ -37,8 +37,8 @@ class IFWL_WidgetMgr { FWL_WGTRELATION eRelation) = 0; virtual int32_t GetWidgetIndex(IFWL_Widget* pWidget) = 0; virtual FX_BOOL SetWidgetIndex(IFWL_Widget* pWidget, int32_t nIndex) = 0; - virtual FWL_ERR RepaintWidget(IFWL_Widget* pWidget, - const CFX_RectF* pRect = NULL) = 0; + virtual FWL_Error RepaintWidget(IFWL_Widget* pWidget, + const CFX_RectF* pRect = NULL) = 0; virtual uint32_t GetCapability() = 0; }; diff --git a/xfa/fwl/core/include/ifwl_adaptertimermgr.h b/xfa/fwl/core/include/ifwl_adaptertimermgr.h index 64fc260ce5..7859e31fd8 100644 --- a/xfa/fwl/core/include/ifwl_adaptertimermgr.h +++ b/xfa/fwl/core/include/ifwl_adaptertimermgr.h @@ -15,11 +15,11 @@ class IFWL_Timer; class IFWL_AdapterTimerMgr { public: virtual ~IFWL_AdapterTimerMgr() {} - virtual FWL_ERR Start(IFWL_Timer* pTimer, - uint32_t dwElapse, - FWL_HTIMER& hTimer, - FX_BOOL bImmediately = TRUE) = 0; - virtual FWL_ERR Stop(FWL_HTIMER hTimer) = 0; + virtual FWL_Error Start(IFWL_Timer* pTimer, + uint32_t dwElapse, + FWL_HTIMER& hTimer, + FX_BOOL bImmediately = TRUE) = 0; + virtual FWL_Error Stop(FWL_HTIMER hTimer) = 0; }; #endif // XFA_FWL_CORE_INCLUDE_IFWL_ADAPTERTIMERMGR_H_ diff --git a/xfa/fwl/lightwidget/cfwl_barcode.cpp b/xfa/fwl/lightwidget/cfwl_barcode.cpp index 4ac358ce54..4b998d04d7 100644 --- a/xfa/fwl/lightwidget/cfwl_barcode.cpp +++ b/xfa/fwl/lightwidget/cfwl_barcode.cpp @@ -12,21 +12,21 @@ CFWL_Barcode* CFWL_Barcode::Create() { return new CFWL_Barcode; } -FWL_ERR CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_Barcode> pBarcode(IFWL_Barcode::Create( m_pProperties->MakeWidgetImpProperties(&m_barcodeData))); - FWL_ERR ret = pBarcode->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pBarcode->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pBarcode.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_Barcode::CFWL_Barcode() {} @@ -44,7 +44,7 @@ FX_BOOL CFWL_Barcode::IsProtectedType() { return 0; return static_cast<IFWL_Barcode*>(m_pIface)->IsProtectedType(); } -FWL_ERR CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_ERR_Succeeded; +FWL_Error CFWL_Barcode::CFWL_BarcodeDP::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { + return FWL_Error::Succeeded; } diff --git a/xfa/fwl/lightwidget/cfwl_barcode.h b/xfa/fwl/lightwidget/cfwl_barcode.h index f52b0eef9d..565ebb884e 100644 --- a/xfa/fwl/lightwidget/cfwl_barcode.h +++ b/xfa/fwl/lightwidget/cfwl_barcode.h @@ -17,7 +17,7 @@ class CFWL_WidgetProperties; class CFWL_Barcode : public CFWL_Edit { public: static CFWL_Barcode* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); void SetType(BC_TYPE type); FX_BOOL IsProtectedType(); @@ -86,8 +86,8 @@ class CFWL_Barcode : public CFWL_Edit { public: CFWL_BarcodeDP() : m_dwAttributeMask(FWL_BCDATTRIBUTE_NONE) {} - FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; BC_CHAR_ENCODING GetCharEncoding() override { return m_eCharEncoding; } int32_t GetModuleHeight() override { return m_nModuleHeight; } int32_t GetModuleWidth() override { return m_nModuleWidth; } diff --git a/xfa/fwl/lightwidget/cfwl_checkbox.cpp b/xfa/fwl/lightwidget/cfwl_checkbox.cpp index b5e2a87d67..a93bc4674a 100644 --- a/xfa/fwl/lightwidget/cfwl_checkbox.cpp +++ b/xfa/fwl/lightwidget/cfwl_checkbox.cpp @@ -14,38 +14,38 @@ CFWL_CheckBox* CFWL_CheckBox::Create() { return new CFWL_CheckBox; } -FWL_ERR CFWL_CheckBox::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_CheckBox::Initialize(const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_CheckBox> pCheckBox(IFWL_CheckBox::Create( m_pProperties->MakeWidgetImpProperties(&m_checkboxData), nullptr)); - FWL_ERR ret = pCheckBox->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pCheckBox->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pCheckBox.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CheckBox::SetCaption(const CFX_WideStringC& wsCaption) { +FWL_Error CFWL_CheckBox::SetCaption(const CFX_WideStringC& wsCaption) { m_checkboxData.m_wsCaption = wsCaption; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) { +FWL_Error CFWL_CheckBox::SetBoxSize(FX_FLOAT fHeight) { m_checkboxData.m_fBoxHeight = fHeight; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_CheckBox::GetCheckState() { return static_cast<IFWL_CheckBox*>(m_pIface)->GetCheckState(); } -FWL_ERR CFWL_CheckBox::SetCheckState(int32_t iCheck) { +FWL_Error CFWL_CheckBox::SetCheckState(int32_t iCheck) { return static_cast<IFWL_CheckBox*>(m_pIface)->SetCheckState(iCheck); } @@ -56,10 +56,11 @@ CFWL_CheckBox::~CFWL_CheckBox() {} CFWL_CheckBox::CFWL_CheckBoxDP::CFWL_CheckBoxDP() : m_fBoxHeight(16.0f), m_wsCaption(L"Check box") {} -FWL_ERR CFWL_CheckBox::CFWL_CheckBoxDP::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +FWL_Error CFWL_CheckBox::CFWL_CheckBoxDP::GetCaption( + IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsCaption; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_CheckBox::CFWL_CheckBoxDP::GetBoxSize(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/lightwidget/cfwl_checkbox.h b/xfa/fwl/lightwidget/cfwl_checkbox.h index 7b7e4004bd..061e46f777 100644 --- a/xfa/fwl/lightwidget/cfwl_checkbox.h +++ b/xfa/fwl/lightwidget/cfwl_checkbox.h @@ -14,12 +14,12 @@ class CFWL_CheckBox : public CFWL_Widget { public: static CFWL_CheckBox* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FWL_ERR GetCaption(CFX_WideString& wsCaption); - FWL_ERR SetCaption(const CFX_WideStringC& wsCaption); - FWL_ERR SetBoxSize(FX_FLOAT fHeight); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error GetCaption(CFX_WideString& wsCaption); + FWL_Error SetCaption(const CFX_WideStringC& wsCaption); + FWL_Error SetBoxSize(FX_FLOAT fHeight); int32_t GetCheckState(); - FWL_ERR SetCheckState(int32_t iCheck); + FWL_Error SetCheckState(int32_t iCheck); CFWL_CheckBox(); virtual ~CFWL_CheckBox(); @@ -27,7 +27,8 @@ class CFWL_CheckBox : public CFWL_Widget { class CFWL_CheckBoxDP : public IFWL_CheckBoxDP { public: CFWL_CheckBoxDP(); - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption); virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget); FX_FLOAT m_fBoxHeight; CFX_WideString m_wsCaption; diff --git a/xfa/fwl/lightwidget/cfwl_combobox.cpp b/xfa/fwl/lightwidget/cfwl_combobox.cpp index f2cd1f5d6b..ca88a23429 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.cpp +++ b/xfa/fwl/lightwidget/cfwl_combobox.cpp @@ -15,21 +15,21 @@ CFWL_ComboBox* CFWL_ComboBox::Create() { return new CFWL_ComboBox; } -FWL_ERR CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_ComboBox::Initialize(const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_ComboBox> pComboBox(IFWL_ComboBox::Create( m_pProperties->MakeWidgetImpProperties(&m_comboBoxData))); - FWL_ERR ret = pComboBox->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pComboBox->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pComboBox.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) { @@ -67,13 +67,14 @@ int32_t CFWL_ComboBox::CountItems() { return m_comboBoxData.CountItems(GetWidget()); } -FWL_ERR CFWL_ComboBox::GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) { +FWL_Error CFWL_ComboBox::GetTextByIndex(int32_t iIndex, + CFX_WideString& wsText) { CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>( m_comboBoxData.GetItem(m_pIface, iIndex)); if (!pItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; wsText = pItem->m_wsText; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ComboBox::GetCurSel() { @@ -82,15 +83,15 @@ int32_t CFWL_ComboBox::GetCurSel() { return static_cast<IFWL_ComboBox*>(m_pIface)->GetCurSel(); } -FWL_ERR CFWL_ComboBox::SetCurSel(int32_t iSel) { +FWL_Error CFWL_ComboBox::SetCurSel(int32_t iSel) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ComboBox*>(m_pIface)->SetCurSel(iSel); } -FWL_ERR CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { +FWL_Error CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditText(wsText); } @@ -100,18 +101,18 @@ int32_t CFWL_ComboBox::GetEditTextLength() const { return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditTextLength(); } -FWL_ERR CFWL_ComboBox::GetEditText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error CFWL_ComboBox::GetEditText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ComboBox*>(m_pIface) ->GetEditText(wsText, nStart, nCount); } -FWL_ERR CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { +FWL_Error CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditSelRange(nStart, nCount); } @@ -127,15 +128,15 @@ int32_t CFWL_ComboBox::GetEditLimit() { return static_cast<IFWL_ComboBox*>(m_pIface)->GetEditLimit(); } -FWL_ERR CFWL_ComboBox::SetEditLimit(int32_t nLimit) { +FWL_Error CFWL_ComboBox::SetEditLimit(int32_t nLimit) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ComboBox*>(m_pIface)->SetEditLimit(nLimit); } -FWL_ERR CFWL_ComboBox::EditDoClipboard(int32_t iCmd) { +FWL_Error CFWL_ComboBox::EditDoClipboard(int32_t iCmd) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ComboBox*>(m_pIface)->EditDoClipboard(iCmd); } @@ -151,18 +152,18 @@ FX_BOOL CFWL_ComboBox::EditUndo(const CFX_ByteStringC& bsRecord) { return static_cast<IFWL_ComboBox*>(m_pIface)->EditUndo(bsRecord); } -FWL_ERR CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) { +FWL_Error CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) { m_comboBoxData.m_fMaxListHeight = fMaxHeight; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) { +FWL_Error CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) { CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>( m_comboBoxData.GetItem(m_pIface, iIndex)); if (!pItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pItem->m_pData = pData; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void* CFWL_ComboBox::GetItemData(int32_t iIndex) { @@ -173,7 +174,7 @@ void* CFWL_ComboBox::GetItemData(int32_t iIndex) { return pItem->m_pData; } -FWL_ERR CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { +FWL_Error CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) { return static_cast<IFWL_ComboBox*>(m_pIface)->GetListBoxt()->SetThemeProvider( pTheme); } @@ -182,7 +183,7 @@ FX_BOOL CFWL_ComboBox::AfterFocusShowDropList() { return static_cast<IFWL_ComboBox*>(m_pIface)->AfterFocusShowDropList(); } -FWL_ERR CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { +FWL_Error CFWL_ComboBox::OpenDropDownList(FX_BOOL bActivate) { return static_cast<IFWL_ComboBox*>(m_pIface)->OpenDropDownList(bActivate); } @@ -264,16 +265,16 @@ FX_BOOL CFWL_ComboBox::EditDeSelect() { return static_cast<IFWL_ComboBox*>(m_pIface)->EditDeSelect(); } -FWL_ERR CFWL_ComboBox::GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_ComboBox::GetBBox(CFX_RectF& rect) { if (!m_pIface) - return FALSE; + return FWL_Error::Indefinite; return static_cast<IFWL_ComboBox*>(m_pIface)->GetBBox(rect); } -FWL_ERR CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { if (!m_pIface) - return FALSE; + return FWL_Error::Indefinite; return static_cast<IFWL_ComboBox*>(m_pIface) ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } @@ -328,24 +329,24 @@ uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemStyles(IFWL_Widget* pWidget, return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles; } -FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_WideString& wsText) { +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_WideString& wsText) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; wsText = reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtItem) { +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtItem) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); rtItem.Set(pItem->m_rtItem.left, pItem->m_rtItem.top, pItem->m_rtItem.width, pItem->m_rtItem.height); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, @@ -356,31 +357,31 @@ void* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemData(IFWL_Widget* pWidget, return pItem->m_pData; } -FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - uint32_t dwStyle) { +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemStyles(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwStyle) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_dwStyles = dwStyle; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const FX_WCHAR* pszText) { +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const FX_WCHAR* pszText) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_wsText = pszText; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtItem) { +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const CFX_RectF& rtItem) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_rtItem = rtItem; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetItemHeight(IFWL_Widget* pWidget) { @@ -394,21 +395,21 @@ CFX_DIBitmap* CFWL_ComboBox::CFWL_ComboBoxDP::GetItemIcon(IFWL_Widget* pWidget, return reinterpret_cast<CFWL_ComboBoxItem*>(hItem)->m_pDIB; } -FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtCheck) { +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtCheck) { CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); rtCheck = pItem->m_rtCheckBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect( +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckRect( IFWL_Widget* pWidget, FWL_HLISTITEM hItem, const CFX_RectF& rtCheck) { CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); pItem->m_rtCheckBox = rtCheck; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckState( @@ -418,13 +419,13 @@ uint32_t CFWL_ComboBox::CFWL_ComboBoxDP::GetItemCheckState( return pItem->m_dwCheckState; } -FWL_ERR CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState( +FWL_Error CFWL_ComboBox::CFWL_ComboBoxDP::SetItemCheckState( IFWL_Widget* pWidget, FWL_HLISTITEM hItem, uint32_t dwCheckState) { CFWL_ComboBoxItem* pItem = reinterpret_cast<CFWL_ComboBoxItem*>(hItem); pItem->m_dwCheckState = dwCheckState; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ComboBox::CFWL_ComboBoxDP::GetListHeight(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/lightwidget/cfwl_combobox.h b/xfa/fwl/lightwidget/cfwl_combobox.h index c92a063cdf..5a639e33d9 100644 --- a/xfa/fwl/lightwidget/cfwl_combobox.h +++ b/xfa/fwl/lightwidget/cfwl_combobox.h @@ -21,33 +21,33 @@ class CFWL_ComboBoxItem; class CFWL_ComboBox : public CFWL_Widget { public: static CFWL_ComboBox* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); int32_t AddString(const CFX_WideStringC& wsText); int32_t AddString(const CFX_WideStringC& wsText, CFX_DIBitmap* pIcon); bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range. void RemoveAll(); int32_t CountItems(); - FWL_ERR GetTextByIndex(int32_t iIndex, CFX_WideString& wsText); + FWL_Error GetTextByIndex(int32_t iIndex, CFX_WideString& wsText); int32_t GetCurSel(); - FWL_ERR SetCurSel(int32_t iSel); - FWL_ERR SetEditText(const CFX_WideString& wsText); + FWL_Error SetCurSel(int32_t iSel); + FWL_Error SetEditText(const CFX_WideString& wsText); int32_t GetEditTextLength() const; - FWL_ERR GetEditText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - FWL_ERR SetEditSelRange(int32_t nStart, int32_t nCount = -1); + FWL_Error GetEditText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1); int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart); int32_t GetEditLimit(); - FWL_ERR SetEditLimit(int32_t nLimit); - FWL_ERR EditDoClipboard(int32_t iCmd); + FWL_Error SetEditLimit(int32_t nLimit); + FWL_Error EditDoClipboard(int32_t iCmd); FX_BOOL EditRedo(const CFX_ByteStringC& bsRecord); FX_BOOL EditUndo(const CFX_ByteStringC& bsRecord); - FWL_ERR SetMaxListHeight(FX_FLOAT fMaxHeight); - FWL_ERR SetItemData(int32_t iIndex, void* pData); + FWL_Error SetMaxListHeight(FX_FLOAT fMaxHeight); + FWL_Error SetItemData(int32_t iIndex, void* pData); void* GetItemData(int32_t iIndex); - FWL_ERR SetListTheme(IFWL_ThemeProvider* pTheme); + FWL_Error SetListTheme(IFWL_ThemeProvider* pTheme); FX_BOOL AfterFocusShowDropList(); - FWL_ERR OpenDropDownList(FX_BOOL bActivate); + FWL_Error OpenDropDownList(FX_BOOL bActivate); FX_BOOL EditCanUndo(); FX_BOOL EditCanRedo(); @@ -62,9 +62,9 @@ class CFWL_ComboBox : public CFWL_Widget { FX_BOOL EditSelectAll(); FX_BOOL EditDelete(); FX_BOOL EditDeSelect(); - FWL_ERR GetBBox(CFX_RectF& rect); - FWL_ERR EditModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + FWL_Error GetBBox(CFX_RectF& rect); + FWL_Error EditModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); CFWL_ComboBox(); virtual ~CFWL_ComboBox(); @@ -73,9 +73,9 @@ class CFWL_ComboBox : public CFWL_Widget { public: CFWL_ComboBoxDP(); ~CFWL_ComboBoxDP(); - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { - return FWL_ERR_Succeeded; + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { + return FWL_Error::Succeeded; } virtual int32_t CountItems(IFWL_Widget* pWidget); @@ -86,36 +86,36 @@ class CFWL_ComboBox : public CFWL_Widget { int32_t nIndex); virtual uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem); - virtual FWL_ERR GetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_WideString& wsText); - virtual FWL_ERR GetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtItem); + virtual FWL_Error GetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_WideString& wsText); + virtual FWL_Error GetItemRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtItem); virtual void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem); - virtual FWL_ERR SetItemStyles(IFWL_Widget* pWidget, + virtual FWL_Error SetItemStyles(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwStyle); + virtual FWL_Error SetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const FX_WCHAR* pszText); + virtual FWL_Error SetItemRect(IFWL_Widget* pWidget, FWL_HLISTITEM hItem, - uint32_t dwStyle); - virtual FWL_ERR SetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const FX_WCHAR* pszText); - virtual FWL_ERR SetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtItem); + const CFX_RectF& rtItem); virtual FX_FLOAT GetItemHeight(IFWL_Widget* pWidget); virtual CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, FWL_HLISTITEM hItem); - virtual FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtCheck); - virtual FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtCheck); + virtual FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtCheck); + virtual FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const CFX_RectF& rtCheck); virtual uint32_t GetItemCheckState(IFWL_Widget* pWidget, FWL_HLISTITEM hItem); - virtual FWL_ERR SetItemCheckState(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - uint32_t dwCheckState); + virtual FWL_Error SetItemCheckState(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwCheckState); virtual FX_FLOAT GetListHeight(IFWL_Widget* pWidget); std::vector<std::unique_ptr<CFWL_ComboBoxItem>> m_ItemArray; diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp b/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp index ba99ad8551..dba1a527b4 100644 --- a/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp +++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.cpp @@ -16,10 +16,10 @@ CFWL_DateTimePicker* CFWL_DateTimePicker::Create() { return new CFWL_DateTimePicker; } -FWL_ERR CFWL_DateTimePicker::Initialize( +FWL_Error CFWL_DateTimePicker::Initialize( const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } @@ -27,22 +27,22 @@ FWL_ERR CFWL_DateTimePicker::Initialize( IFWL_DateTimePicker::Create( m_pProperties->MakeWidgetImpProperties(&m_DateTimePickerDP), nullptr)); - FWL_ERR ret = pDateTimePicker->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pDateTimePicker->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pDateTimePicker.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePicker::SetToday(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +FWL_Error CFWL_DateTimePicker::SetToday(int32_t iYear, + int32_t iMonth, + int32_t iDay) { m_DateTimePickerDP.m_iYear = iYear; m_DateTimePickerDP.m_iMonth = iMonth; m_DateTimePickerDP.m_iDay = iDay; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_DateTimePicker::CountSelRanges() { @@ -54,24 +54,24 @@ int32_t CFWL_DateTimePicker::GetSelRange(int32_t nIndex, int32_t& nStart) { ->GetSelRange(nIndex, nStart); } -FWL_ERR CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) { +FWL_Error CFWL_DateTimePicker::GetEditText(CFX_WideString& wsText) { return static_cast<IFWL_DateTimePicker*>(m_pIface)->GetEditText(wsText); } -FWL_ERR CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { +FWL_Error CFWL_DateTimePicker::SetEditText(const CFX_WideString& wsText) { return static_cast<IFWL_DateTimePicker*>(m_pIface)->SetEditText(wsText); } -FWL_ERR CFWL_DateTimePicker::GetCurSel(int32_t& iYear, - int32_t& iMonth, - int32_t& iDay) { +FWL_Error CFWL_DateTimePicker::GetCurSel(int32_t& iYear, + int32_t& iMonth, + int32_t& iDay) { return static_cast<IFWL_DateTimePicker*>(m_pIface) ->GetCurSel(iYear, iMonth, iDay); } -FWL_ERR CFWL_DateTimePicker::SetCurSel(int32_t iYear, - int32_t iMonth, - int32_t iDay) { +FWL_Error CFWL_DateTimePicker::SetCurSel(int32_t iYear, + int32_t iMonth, + int32_t iDay) { return static_cast<IFWL_DateTimePicker*>(m_pIface) ->SetCurSel(iYear, iMonth, iDay); } @@ -86,14 +86,14 @@ CFWL_DateTimePicker::CFWL_DateTimePickerDP::CFWL_DateTimePickerDP() { m_iDay = 1; } -FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetCaption( +FWL_Error CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetCaption( IFWL_Widget* pWidget, CFX_WideString& wsCaption) { wsCaption = m_wsData; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday( +FWL_Error CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday( IFWL_Widget* pWidget, int32_t& iYear, int32_t& iMonth, @@ -101,7 +101,7 @@ FWL_ERR CFWL_DateTimePicker::CFWL_DateTimePickerDP::GetToday( iYear = m_iYear; iMonth = m_iMonth; iDay = m_iDay; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_DateTimePicker::CanUndo() { @@ -156,16 +156,16 @@ FX_BOOL CFWL_DateTimePicker::DeSelect() { return static_cast<IFWL_DateTimePicker*>(m_pIface)->DeSelect(); } -FWL_ERR CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { +FWL_Error CFWL_DateTimePicker::GetBBox(CFX_RectF& rect) { return static_cast<IFWL_DateTimePicker*>(m_pIface)->GetBBox(rect); } -FWL_ERR CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { +FWL_Error CFWL_DateTimePicker::SetEditLimit(int32_t nLimit) { return static_cast<IFWL_DateTimePicker*>(m_pIface)->SetEditLimit(nLimit); } -FWL_ERR CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return static_cast<IFWL_DateTimePicker*>(m_pIface) ->ModifyEditStylesEx(dwStylesExAdded, dwStylesExRemoved); } diff --git a/xfa/fwl/lightwidget/cfwl_datetimepicker.h b/xfa/fwl/lightwidget/cfwl_datetimepicker.h index befe57a079..b4349d0cb0 100644 --- a/xfa/fwl/lightwidget/cfwl_datetimepicker.h +++ b/xfa/fwl/lightwidget/cfwl_datetimepicker.h @@ -13,14 +13,14 @@ class CFWL_DateTimePicker : public CFWL_Widget { public: static CFWL_DateTimePicker* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FWL_ERR SetToday(int32_t iYear, int32_t iMonth, int32_t iDay); - FWL_ERR GetEditText(CFX_WideString& wsText); - FWL_ERR SetEditText(const CFX_WideString& wsText); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error SetToday(int32_t iYear, int32_t iMonth, int32_t iDay); + FWL_Error GetEditText(CFX_WideString& wsText); + FWL_Error SetEditText(const CFX_WideString& wsText); int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - FWL_ERR GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); - FWL_ERR SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); + FWL_Error GetCurSel(int32_t& iYear, int32_t& iMonth, int32_t& iDay); + FWL_Error SetCurSel(int32_t iYear, int32_t iMonth, int32_t iDay); FX_BOOL CanUndo(); FX_BOOL CanRedo(); FX_BOOL Undo(); @@ -34,10 +34,10 @@ class CFWL_DateTimePicker : public CFWL_Widget { FX_BOOL SelectAll(); FX_BOOL Delete(); FX_BOOL DeSelect(); - FWL_ERR GetBBox(CFX_RectF& rect); - FWL_ERR SetEditLimit(int32_t nLimit); - FWL_ERR ModifyEditStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved); + FWL_Error GetBBox(CFX_RectF& rect); + FWL_Error SetEditLimit(int32_t nLimit); + FWL_Error ModifyEditStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); protected: CFWL_DateTimePicker(); @@ -45,11 +45,12 @@ class CFWL_DateTimePicker : public CFWL_Widget { class CFWL_DateTimePickerDP : public IFWL_DateTimePickerDP { public: CFWL_DateTimePickerDP(); - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); - virtual FWL_ERR GetToday(IFWL_Widget* pWidget, - int32_t& iYear, - int32_t& iMonth, - int32_t& iDay); + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption); + virtual FWL_Error GetToday(IFWL_Widget* pWidget, + int32_t& iYear, + int32_t& iMonth, + int32_t& iDay); int32_t m_iYear; int32_t m_iMonth; int32_t m_iDay; diff --git a/xfa/fwl/lightwidget/cfwl_edit.cpp b/xfa/fwl/lightwidget/cfwl_edit.cpp index ba0ff58f6d..0303e6c2a2 100644 --- a/xfa/fwl/lightwidget/cfwl_edit.cpp +++ b/xfa/fwl/lightwidget/cfwl_edit.cpp @@ -15,26 +15,26 @@ CFWL_Edit* CFWL_Edit::Create() { return new CFWL_Edit; } -FWL_ERR CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_Edit::Initialize(const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_Edit> pEdit(IFWL_Edit::Create( m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); - FWL_ERR ret = pEdit->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pEdit->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pEdit.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_Edit::SetText(const CFX_WideString& wsText) { +FWL_Error CFWL_Edit::SetText(const CFX_WideString& wsText) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->SetText(wsText); } @@ -44,17 +44,17 @@ int32_t CFWL_Edit::GetTextLength() const { return static_cast<IFWL_Edit*>(m_pIface)->GetTextLength(); } -FWL_ERR CFWL_Edit::GetText(CFX_WideString& wsText, - int32_t nStart, - int32_t nCount) const { +FWL_Error CFWL_Edit::GetText(CFX_WideString& wsText, + int32_t nStart, + int32_t nCount) const { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->GetText(wsText, nStart, nCount); } -FWL_ERR CFWL_Edit::ClearText() { +FWL_Error CFWL_Edit::ClearText() { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->ClearText(); } @@ -70,9 +70,9 @@ int32_t CFWL_Edit::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { return static_cast<IFWL_Edit*>(m_pIface)->SetCaretPos(nIndex, bBefore); } -FWL_ERR CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { +int32_t CFWL_Edit::AddSelRange(int32_t nStart, int32_t nCount) { if (!m_pIface) - return FWL_ERR_Indefinite; + return -1; static_cast<IFWL_Edit*>(m_pIface)->AddSelRange(nStart, nCount); int32_t pos = 0; int32_t sum = static_cast<IFWL_Edit*>(m_pIface)->GetTextLength(); @@ -96,9 +96,9 @@ int32_t CFWL_Edit::GetSelRange(int32_t nIndex, int32_t& nStart) { return static_cast<IFWL_Edit*>(m_pIface)->GetSelRange(nIndex, nStart); } -FWL_ERR CFWL_Edit::ClearSelections() { +FWL_Error CFWL_Edit::ClearSelections() { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->ClearSelections(); } @@ -108,55 +108,55 @@ int32_t CFWL_Edit::GetLimit() { return static_cast<IFWL_Edit*>(m_pIface)->GetLimit(); } -FWL_ERR CFWL_Edit::SetLimit(int32_t nLimit) { +FWL_Error CFWL_Edit::SetLimit(int32_t nLimit) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->SetLimit(nLimit); } -FWL_ERR CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { +FWL_Error CFWL_Edit::SetAliasChar(FX_WCHAR wAlias) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->SetAliasChar(wAlias); } -FWL_ERR CFWL_Edit::Insert(int32_t nStart, - const FX_WCHAR* lpText, - int32_t nLen) { +FWL_Error CFWL_Edit::Insert(int32_t nStart, + const FX_WCHAR* lpText, + int32_t nLen) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->Insert(nStart, lpText, nLen); } -FWL_ERR CFWL_Edit::DeleteSelections() { +FWL_Error CFWL_Edit::DeleteSelections() { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->DeleteSelections(); } -FWL_ERR CFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { +FWL_Error CFWL_Edit::DeleteRange(int32_t nStart, int32_t nCount) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->DeleteRange(nStart, nCount); } -FWL_ERR CFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) { +FWL_Error CFWL_Edit::ReplaceSelections(const CFX_WideStringC& wsReplace) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->ReplaceSelections(wsReplace); } -FWL_ERR CFWL_Edit::Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace) { +FWL_Error CFWL_Edit::Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->Replace(nStart, nLen, wsReplace); } -FWL_ERR CFWL_Edit::DoClipboard(int32_t iCmd) { +FWL_Error CFWL_Edit::DoClipboard(int32_t iCmd) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->DoClipboard(iCmd); } @@ -172,29 +172,29 @@ FX_BOOL CFWL_Edit::Undo(const CFX_ByteStringC& bsRecord) { return static_cast<IFWL_Edit*>(m_pIface)->Undo(bsRecord); } -FWL_ERR CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { +FWL_Error CFWL_Edit::SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface) ->SetTabWidth(fTabWidth, bEquidistant); } -FWL_ERR CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { +FWL_Error CFWL_Edit::SetNumberRange(int32_t iMin, int32_t iMax) { if (iMin > iMax) { - return FWL_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; } return static_cast<IFWL_Edit*>(m_pIface)->SetNumberRange(iMin, iMax); } -FWL_ERR CFWL_Edit::SetBackColor(uint32_t dwColor) { +FWL_Error CFWL_Edit::SetBackColor(uint32_t dwColor) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->SetBackColor(dwColor); } -FWL_ERR CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { +FWL_Error CFWL_Edit::SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_Edit*>(m_pIface)->SetFont(wsFont, fSize); } diff --git a/xfa/fwl/lightwidget/cfwl_edit.h b/xfa/fwl/lightwidget/cfwl_edit.h index 153c756044..5f3e045535 100644 --- a/xfa/fwl/lightwidget/cfwl_edit.h +++ b/xfa/fwl/lightwidget/cfwl_edit.h @@ -16,37 +16,37 @@ class CFWL_WidgetProperties; class CFWL_Edit : public CFWL_Widget { public: static CFWL_Edit* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FWL_ERR SetText(const CFX_WideString& wsText); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error SetText(const CFX_WideString& wsText); int32_t GetTextLength() const; - FWL_ERR GetText(CFX_WideString& wsText, - int32_t nStart = 0, - int32_t nCount = -1) const; - FWL_ERR ClearText(); + FWL_Error GetText(CFX_WideString& wsText, + int32_t nStart = 0, + int32_t nCount = -1) const; + FWL_Error ClearText(); int32_t GetCaretPos() const; int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore = TRUE); - FWL_ERR AddSelRange(int32_t nStart, int32_t nCount = -1); + int32_t AddSelRange(int32_t nStart, int32_t nCount = -1); int32_t CountSelRanges(); int32_t GetSelRange(int32_t nIndex, int32_t& nStart); - FWL_ERR ClearSelections(); + FWL_Error ClearSelections(); int32_t GetLimit(); - FWL_ERR SetLimit(int32_t nLimit); - FWL_ERR SetAliasChar(FX_WCHAR wAlias); - FWL_ERR SetFormatString(const CFX_WideString& wsFormat); - FWL_ERR Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); - FWL_ERR DeleteSelections(); - FWL_ERR DeleteRange(int32_t nStart, int32_t nCount = -1); - FWL_ERR ReplaceSelections(const CFX_WideStringC& wsReplace); - FWL_ERR Replace(int32_t nStart, - int32_t nLen, - const CFX_WideStringC& wsReplace); - FWL_ERR DoClipboard(int32_t iCmd); + FWL_Error SetLimit(int32_t nLimit); + FWL_Error SetAliasChar(FX_WCHAR wAlias); + FWL_Error SetFormatString(const CFX_WideString& wsFormat); + FWL_Error Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLen); + FWL_Error DeleteSelections(); + FWL_Error DeleteRange(int32_t nStart, int32_t nCount = -1); + FWL_Error ReplaceSelections(const CFX_WideStringC& wsReplace); + FWL_Error Replace(int32_t nStart, + int32_t nLen, + const CFX_WideStringC& wsReplace); + FWL_Error DoClipboard(int32_t iCmd); FX_BOOL Redo(const CFX_ByteStringC& bsRecord); FX_BOOL Undo(const CFX_ByteStringC& bsRecord); - FWL_ERR SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); - FWL_ERR SetNumberRange(int32_t iMin, int32_t iMax); - FWL_ERR SetBackColor(uint32_t dwColor); - FWL_ERR SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); + FWL_Error SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); + FWL_Error SetNumberRange(int32_t iMin, int32_t iMax); + FWL_Error SetBackColor(uint32_t dwColor); + FWL_Error SetFont(const CFX_WideString& wsFont, FX_FLOAT fSize); FX_BOOL CanUndo(); FX_BOOL CanRedo(); FX_BOOL Undo(); diff --git a/xfa/fwl/lightwidget/cfwl_listbox.cpp b/xfa/fwl/lightwidget/cfwl_listbox.cpp index 2102d2d3ee..46433a3198 100644 --- a/xfa/fwl/lightwidget/cfwl_listbox.cpp +++ b/xfa/fwl/lightwidget/cfwl_listbox.cpp @@ -14,26 +14,26 @@ CFWL_ListBox* CFWL_ListBox::Create() { return new CFWL_ListBox; } -FWL_ERR CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_ListBox::Initialize(const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_ListBox> pListBox(IFWL_ListBox::Create( m_pProperties->MakeWidgetImpProperties(&m_ListBoxDP), nullptr)); - FWL_ERR ret = pListBox->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pListBox->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pListBox.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem) { +FWL_Error CFWL_ListBox::AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem) { reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB = pDIB; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_HLISTITEM CFWL_ListBox::AddString(const CFX_WideStringC& wsAdd, @@ -91,27 +91,28 @@ int32_t CFWL_ListBox::GetSelIndex(int32_t nIndex) { return static_cast<IFWL_ListBox*>(m_pIface)->GetSelIndex(nIndex); } -FWL_ERR CFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { +FWL_Error CFWL_ListBox::SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ListBox*>(m_pIface)->SetSelItem(hItem, bSelect); } -FWL_ERR CFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText) { +FWL_Error CFWL_ListBox::GetItemText(FWL_HLISTITEM hItem, + CFX_WideString& wsText) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ListBox*>(m_pIface)->GetItemText(hItem, wsText); } -FWL_ERR CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { +FWL_Error CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ListBox*>(m_pIface)->GetScrollPos(fPos, bVert); } -FWL_ERR CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) { +FWL_Error CFWL_ListBox::SetItemHeight(FX_FLOAT fItemHeight) { m_ListBoxDP.m_fItemHeight = fItemHeight; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FWL_HLISTITEM CFWL_ListBox::GetFocusItem() { @@ -122,14 +123,10 @@ FWL_HLISTITEM CFWL_ListBox::GetFocusItem() { return nullptr; } -FWL_ERR CFWL_ListBox::SetFocusItem(FWL_HLISTITEM hItem) { +FWL_Error CFWL_ListBox::SetFocusItem(FWL_HLISTITEM hItem) { int32_t nIndex = m_ListBoxDP.GetItemIndex(GetWidget(), hItem); m_ListBoxDP.m_ItemArray[nIndex]->m_dwStates |= FWL_ITEMSTATE_LTB_Focused; - return FWL_ERR_Succeeded; -} - -FWL_ERR* CFWL_ListBox::Sort(IFWL_ListBoxCompare* pCom) { - return static_cast<IFWL_ListBox*>(m_pIface)->Sort(pCom); + return FWL_Error::Succeeded; } int32_t CFWL_ListBox::CountItems() { @@ -143,27 +140,27 @@ FWL_HLISTITEM CFWL_ListBox::GetItem(int32_t nIndex) { return (FWL_HLISTITEM)m_ListBoxDP.m_ItemArray[nIndex].get(); } -FWL_ERR CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem, - const CFX_WideStringC& wsText) { +FWL_Error CFWL_ListBox::SetItemString(FWL_HLISTITEM hItem, + const CFX_WideStringC& wsText) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = wsText; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem, - CFX_WideString& wsText) { +FWL_Error CFWL_ListBox::GetItemString(FWL_HLISTITEM hItem, + CFX_WideString& wsText) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBox::SetItemData(FWL_HLISTITEM hItem, void* pData) { +FWL_Error CFWL_ListBox::SetItemData(FWL_HLISTITEM hItem, void* pData) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; reinterpret_cast<CFWL_ListItem*>(hItem)->m_pData = pData; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void* CFWL_ListBox::GetItemData(FWL_HLISTITEM hItem) { @@ -212,10 +209,10 @@ CFWL_ListBox::CFWL_ListBoxDP::CFWL_ListBoxDP() {} CFWL_ListBox::CFWL_ListBoxDP::~CFWL_ListBoxDP() {} -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsData; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ListBox::CFWL_ListBoxDP::CountItems(IFWL_Widget* pWidget) { @@ -256,23 +253,23 @@ uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemStyles(IFWL_Widget* pWidget, return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates; } -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_WideString& wsText) { +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_WideString& wsText) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; wsText = reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtItem) { +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtItem) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_ListItem* pItem = reinterpret_cast<CFWL_ListItem*>(hItem); rtItem = pItem->m_rtItem; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget, @@ -283,31 +280,31 @@ void* CFWL_ListBox::CFWL_ListBoxDP::GetItemData(IFWL_Widget* pWidget, return pItem->m_pData; } -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - uint32_t dwStyle) { +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemStyles(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwStyle) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwStates = dwStyle; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const FX_WCHAR* pszText) { +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const FX_WCHAR* pszText) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; reinterpret_cast<CFWL_ListItem*>(hItem)->m_wsText = pszText; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtItem) { +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const CFX_RectF& rtItem) { if (!hItem) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtItem = rtItem; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_ListBox::CFWL_ListBoxDP::GetItemHeight(IFWL_Widget* pWidget) { @@ -319,19 +316,19 @@ CFX_DIBitmap* CFWL_ListBox::CFWL_ListBoxDP::GetItemIcon(IFWL_Widget* pWidget, return reinterpret_cast<CFWL_ListItem*>(hItem)->m_pDIB; } -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtCheck) { +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtCheck) { rtCheck = reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect( +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckRect( IFWL_Widget* pWidget, FWL_HLISTITEM hItem, const CFX_RectF& rtCheck) { reinterpret_cast<CFWL_ListItem*>(hItem)->m_rtCheckBox = rtCheck; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget, @@ -339,9 +336,10 @@ uint32_t CFWL_ListBox::CFWL_ListBoxDP::GetItemCheckState(IFWL_Widget* pWidget, return reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState; } -FWL_ERR CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - uint32_t dwCheckState) { +FWL_Error CFWL_ListBox::CFWL_ListBoxDP::SetItemCheckState( + IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwCheckState) { reinterpret_cast<CFWL_ListItem*>(hItem)->m_dwCheckState = dwCheckState; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } diff --git a/xfa/fwl/lightwidget/cfwl_listbox.h b/xfa/fwl/lightwidget/cfwl_listbox.h index 28fb42af69..a40d0f975c 100644 --- a/xfa/fwl/lightwidget/cfwl_listbox.h +++ b/xfa/fwl/lightwidget/cfwl_listbox.h @@ -20,8 +20,8 @@ class CFWL_ListItem; class CFWL_ListBox : public CFWL_Widget { public: static CFWL_ListBox* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FWL_ERR AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error AddDIBitmap(CFX_DIBitmap* pDIB, FWL_HLISTITEM hItem); FWL_HLISTITEM AddString(const CFX_WideStringC& wsAdd, FX_BOOL bSelect = FALSE); FX_BOOL DeleteString(FWL_HLISTITEM hItem); @@ -29,18 +29,17 @@ class CFWL_ListBox : public CFWL_Widget { int32_t CountSelItems(); FWL_HLISTITEM GetSelItem(int32_t nIndexSel); int32_t GetSelIndex(int32_t nIndex); - FWL_ERR SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); - FWL_ERR GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); - FWL_ERR GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); - FWL_ERR SetItemHeight(FX_FLOAT fItemHeight); + FWL_Error SetSelItem(FWL_HLISTITEM hItem, FX_BOOL bSelect = TRUE); + FWL_Error GetItemText(FWL_HLISTITEM hItem, CFX_WideString& wsText); + FWL_Error GetScrollPos(FX_FLOAT& fPos, FX_BOOL bVert = TRUE); + FWL_Error SetItemHeight(FX_FLOAT fItemHeight); FWL_HLISTITEM GetFocusItem(); - FWL_ERR SetFocusItem(FWL_HLISTITEM hItem); - FWL_ERR* Sort(IFWL_ListBoxCompare* pCom); + FWL_Error SetFocusItem(FWL_HLISTITEM hItem); int32_t CountItems(); FWL_HLISTITEM GetItem(int32_t nIndex); - FWL_ERR SetItemString(FWL_HLISTITEM hItem, const CFX_WideStringC& wsText); - FWL_ERR GetItemString(FWL_HLISTITEM hItem, CFX_WideString& wsText); - FWL_ERR SetItemData(FWL_HLISTITEM hItem, void* pData); + FWL_Error SetItemString(FWL_HLISTITEM hItem, const CFX_WideStringC& wsText); + FWL_Error GetItemString(FWL_HLISTITEM hItem, CFX_WideString& wsText); + FWL_Error SetItemData(FWL_HLISTITEM hItem, void* pData); void* GetItemData(FWL_HLISTITEM hItem); FWL_HLISTITEM GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy); uint32_t GetItemStates(FWL_HLISTITEM hItem); @@ -54,8 +53,8 @@ class CFWL_ListBox : public CFWL_Widget { ~CFWL_ListBoxDP(); // IFWL_DataProvider: - FWL_ERR GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) override; + FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) override; // IFWL_ListBoxDP: int32_t CountItems(IFWL_Widget* pWidget) override; @@ -65,36 +64,36 @@ class CFWL_ListBox : public CFWL_Widget { FWL_HLISTITEM hItem, int32_t nIndex) override; uint32_t GetItemStyles(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override; - FWL_ERR GetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_WideString& wsText) override; - FWL_ERR GetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtItem) override; + FWL_Error GetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_WideString& wsText) override; + FWL_Error GetItemRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtItem) override; void* GetItemData(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override; - FWL_ERR SetItemStyles(IFWL_Widget* pWidget, + FWL_Error SetItemStyles(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwStyle) override; + FWL_Error SetItemText(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const FX_WCHAR* pszText) override; + FWL_Error SetItemRect(IFWL_Widget* pWidget, FWL_HLISTITEM hItem, - uint32_t dwStyle) override; - FWL_ERR SetItemText(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const FX_WCHAR* pszText) override; - FWL_ERR SetItemRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtItem) override; + const CFX_RectF& rtItem) override; FX_FLOAT GetItemHeight(IFWL_Widget* pWidget) override; CFX_DIBitmap* GetItemIcon(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override; - FWL_ERR GetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - CFX_RectF& rtCheck) override; - FWL_ERR SetItemCheckRect(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - const CFX_RectF& rtCheck) override; + FWL_Error GetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + CFX_RectF& rtCheck) override; + FWL_Error SetItemCheckRect(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + const CFX_RectF& rtCheck) override; uint32_t GetItemCheckState(IFWL_Widget* pWidget, FWL_HLISTITEM hItem) override; - FWL_ERR SetItemCheckState(IFWL_Widget* pWidget, - FWL_HLISTITEM hItem, - uint32_t dwCheckState) override; + FWL_Error SetItemCheckState(IFWL_Widget* pWidget, + FWL_HLISTITEM hItem, + uint32_t dwCheckState) override; std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray; CFX_WideString m_wsData; diff --git a/xfa/fwl/lightwidget/cfwl_picturebox.cpp b/xfa/fwl/lightwidget/cfwl_picturebox.cpp index b0bd3c9931..f3f52ab993 100644 --- a/xfa/fwl/lightwidget/cfwl_picturebox.cpp +++ b/xfa/fwl/lightwidget/cfwl_picturebox.cpp @@ -12,94 +12,95 @@ CFWL_PictureBox* CFWL_PictureBox::Create() { return new CFWL_PictureBox; } -FWL_ERR CFWL_PictureBox::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_PictureBox::Initialize( + const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_PictureBox> pPictureBox(IFWL_PictureBox::Create( m_pProperties->MakeWidgetImpProperties(&m_PictureBoxDP), nullptr)); - FWL_ERR ret = pPictureBox->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pPictureBox->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pPictureBox.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_DIBitmap* CFWL_PictureBox::GetPicture() { return m_PictureBoxDP.m_pBitmap; } -FWL_ERR CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) { +FWL_Error CFWL_PictureBox::SetPicture(CFX_DIBitmap* pBitmap) { m_PictureBoxDP.m_pBitmap = pBitmap; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_FLOAT CFWL_PictureBox::GetRotation() { return m_PictureBoxDP.m_fRotation; } -FWL_ERR CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) { +FWL_Error CFWL_PictureBox::SetRotation(FX_FLOAT fRotation) { m_PictureBoxDP.m_fRotation = fRotation; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_PictureBox::GetFlipMode() { return m_PictureBoxDP.GetFlipMode(m_pIface); } -FWL_ERR CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) { +FWL_Error CFWL_PictureBox::SetFlipMode(int32_t iFlipMode) { m_PictureBoxDP.m_iFlipMode = iFlipMode; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_PictureBox::GetOpacity() { return m_PictureBoxDP.GetOpacity(m_pIface); } -FWL_ERR CFWL_PictureBox::SetOpacity(int32_t iOpacity) { +FWL_Error CFWL_PictureBox::SetOpacity(int32_t iOpacity) { m_PictureBoxDP.m_iOpacity = iOpacity; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) { +FWL_Error CFWL_PictureBox::GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY) { CFX_Matrix matrix; m_PictureBoxDP.GetMatrix(m_pIface, matrix); matrix.Scale(fScaleX, fScaleY); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) { +FWL_Error CFWL_PictureBox::SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY) { m_PictureBoxDP.m_fScaleX = fScaleX; m_PictureBoxDP.m_fScaleY = fScaleY; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) { +FWL_Error CFWL_PictureBox::GetOffset(FX_FLOAT& fx, FX_FLOAT& fy) { CFX_Matrix matrix; m_PictureBoxDP.GetMatrix(m_pIface, matrix); fx = matrix.e; fy = matrix.f; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) { +FWL_Error CFWL_PictureBox::SetOffset(FX_FLOAT fx, FX_FLOAT fy) { m_PictureBoxDP.m_fOffSetX = fx; m_PictureBoxDP.m_fOffSetY = fy; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_PictureBox::CFWL_PictureBox() {} CFWL_PictureBox::~CFWL_PictureBox() {} -FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption( +FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetCaption( IFWL_Widget* pWidget, CFX_WideString& wsCaption) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_DIBitmap* CFWL_PictureBox::CFWL_PictureBoxDP::GetPicture( @@ -121,8 +122,8 @@ int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetOpacity(IFWL_Widget* pWidget) { return m_iOpacity; } -FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget, - CFX_Matrix& matrix) { +FWL_Error CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget, + CFX_Matrix& matrix) { CFX_RectF rect; pWidget->GetClientRect(rect); FX_FLOAT fLen = rect.width / 2; @@ -133,7 +134,7 @@ FWL_ERR CFWL_PictureBox::CFWL_PictureBoxDP::GetMatrix(IFWL_Widget* pWidget, matrix.Translate(fLen, fWid); matrix.Scale(m_fScaleX, m_fScaleY); matrix.Translate(m_fOffSetX, m_fOffSetY); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_PictureBox::CFWL_PictureBoxDP::GetFlipMode(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/lightwidget/cfwl_picturebox.h b/xfa/fwl/lightwidget/cfwl_picturebox.h index 8fa985acd8..8b0b13de24 100644 --- a/xfa/fwl/lightwidget/cfwl_picturebox.h +++ b/xfa/fwl/lightwidget/cfwl_picturebox.h @@ -14,19 +14,19 @@ class CFWL_PictureBox : public CFWL_Widget { public: static CFWL_PictureBox* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); CFX_DIBitmap* GetPicture(); - FWL_ERR SetPicture(CFX_DIBitmap* pBitmap); + FWL_Error SetPicture(CFX_DIBitmap* pBitmap); FX_FLOAT GetRotation(); - FWL_ERR SetRotation(FX_FLOAT fRotation); + FWL_Error SetRotation(FX_FLOAT fRotation); int32_t GetFlipMode(); - FWL_ERR SetFlipMode(int32_t iFlipMode); + FWL_Error SetFlipMode(int32_t iFlipMode); int32_t GetOpacity(); - FWL_ERR SetOpacity(int32_t iOpacity); - FWL_ERR GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY); - FWL_ERR SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY); - FWL_ERR GetOffset(FX_FLOAT& fx, FX_FLOAT& fy); - FWL_ERR SetOffset(FX_FLOAT fx, FX_FLOAT fy); + FWL_Error SetOpacity(int32_t iOpacity); + FWL_Error GetScale(FX_FLOAT& fScaleX, FX_FLOAT& fScaleY); + FWL_Error SetScale(FX_FLOAT fScaleX, FX_FLOAT fScaleY); + FWL_Error GetOffset(FX_FLOAT& fx, FX_FLOAT& fy); + FWL_Error SetOffset(FX_FLOAT fx, FX_FLOAT fy); CFWL_PictureBox(); virtual ~CFWL_PictureBox(); @@ -41,13 +41,14 @@ class CFWL_PictureBox : public CFWL_Widget { m_fOffSetY = 0.0f; m_pBitmap = NULL; } - virtual FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); + virtual FWL_Error GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption); virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget); virtual CFX_DIBitmap* GetErrorPicture(IFWL_Widget* pWidget); virtual CFX_DIBitmap* GetInitialPicture(IFWL_Widget* pWidget); virtual int32_t GetOpacity(IFWL_Widget* pWidget); virtual int32_t GetFlipMode(IFWL_Widget* pWidget); - virtual FWL_ERR GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix); + virtual FWL_Error GetMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix); CFX_DIBitmap* m_pBitmap; int32_t m_iOpacity; int32_t m_iFlipMode; diff --git a/xfa/fwl/lightwidget/cfwl_pushbutton.cpp b/xfa/fwl/lightwidget/cfwl_pushbutton.cpp index 52747bdebe..7c8a9fa64d 100644 --- a/xfa/fwl/lightwidget/cfwl_pushbutton.cpp +++ b/xfa/fwl/lightwidget/cfwl_pushbutton.cpp @@ -12,51 +12,52 @@ CFWL_PushButton* CFWL_PushButton::Create() { return new CFWL_PushButton; } -FWL_ERR CFWL_PushButton::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_PushButton::Initialize( + const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_PushButton> pPushButton(IFWL_PushButton::Create( m_pProperties->MakeWidgetImpProperties(&m_buttonData), nullptr)); - FWL_ERR ret = pPushButton->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pPushButton->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pPushButton.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { +FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { wsCaption = m_buttonData.m_wsCaption; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { +FWL_Error CFWL_PushButton::SetCaption(const CFX_WideStringC& wsCaption) { m_buttonData.m_wsCaption = wsCaption; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_DIBitmap* CFWL_PushButton::GetPicture() { return m_buttonData.m_pBitmap; } -FWL_ERR CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) { +FWL_Error CFWL_PushButton::SetPicture(CFX_DIBitmap* pBitmap) { m_buttonData.m_pBitmap = pBitmap; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_PushButton::CFWL_PushButton() {} CFWL_PushButton::~CFWL_PushButton() {} -FWL_ERR CFWL_PushButton::CFWL_PushButtonDP::GetCaption( +FWL_Error CFWL_PushButton::CFWL_PushButtonDP::GetCaption( IFWL_Widget* pWidget, CFX_WideString& wsCaption) { wsCaption = m_wsCaption; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture( diff --git a/xfa/fwl/lightwidget/cfwl_pushbutton.h b/xfa/fwl/lightwidget/cfwl_pushbutton.h index 99b067d2cf..5ca3dded37 100644 --- a/xfa/fwl/lightwidget/cfwl_pushbutton.h +++ b/xfa/fwl/lightwidget/cfwl_pushbutton.h @@ -13,11 +13,11 @@ class CFWL_PushButton : public CFWL_Widget { public: static CFWL_PushButton* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FWL_ERR GetCaption(CFX_WideString& wsCaption); - FWL_ERR SetCaption(const CFX_WideStringC& wsCaption); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error GetCaption(CFX_WideString& wsCaption); + FWL_Error SetCaption(const CFX_WideStringC& wsCaption); CFX_DIBitmap* GetPicture(); - FWL_ERR SetPicture(CFX_DIBitmap* pBitmap); + FWL_Error SetPicture(CFX_DIBitmap* pBitmap); CFWL_PushButton(); virtual ~CFWL_PushButton(); @@ -25,7 +25,7 @@ class CFWL_PushButton : public CFWL_Widget { class CFWL_PushButtonDP : public IFWL_PushButtonDP { public: CFWL_PushButtonDP() : m_pBitmap(NULL) {} - FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); + FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); virtual CFX_DIBitmap* GetPicture(IFWL_Widget* pWidget); CFX_WideString m_wsCaption; CFX_DIBitmap* m_pBitmap; diff --git a/xfa/fwl/lightwidget/cfwl_scrollbar.cpp b/xfa/fwl/lightwidget/cfwl_scrollbar.cpp index 0c02314733..eb4276c2d1 100644 --- a/xfa/fwl/lightwidget/cfwl_scrollbar.cpp +++ b/xfa/fwl/lightwidget/cfwl_scrollbar.cpp @@ -18,21 +18,21 @@ CFWL_ScrollBar::CFWL_ScrollBar() {} CFWL_ScrollBar::~CFWL_ScrollBar() {} -FWL_ERR CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_ScrollBar::Initialize(const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_ScrollBar> pScrollBar(IFWL_ScrollBar::Create( m_pProperties->MakeWidgetImpProperties(nullptr), nullptr)); - FWL_ERR ret = pScrollBar->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pScrollBar->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pScrollBar.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_ScrollBar::IsVertical() { @@ -41,15 +41,15 @@ FX_BOOL CFWL_ScrollBar::IsVertical() { return static_cast<IFWL_ScrollBar*>(m_pIface)->IsVertical(); } -FWL_ERR CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { +FWL_Error CFWL_ScrollBar::GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ScrollBar*>(m_pIface)->GetRange(fMin, fMax); } -FWL_ERR CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { +FWL_Error CFWL_ScrollBar::SetRange(FX_FLOAT fMin, FX_FLOAT fMax) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ScrollBar*>(m_pIface)->SetRange(fMin, fMax); } @@ -59,9 +59,9 @@ FX_FLOAT CFWL_ScrollBar::GetPageSize() { return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPageSize(); } -FWL_ERR CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { +FWL_Error CFWL_ScrollBar::SetPageSize(FX_FLOAT fPageSize) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPageSize(fPageSize); } @@ -71,9 +71,9 @@ FX_FLOAT CFWL_ScrollBar::GetStepSize() { return static_cast<IFWL_ScrollBar*>(m_pIface)->GetStepSize(); } -FWL_ERR CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { +FWL_Error CFWL_ScrollBar::SetStepSize(FX_FLOAT fStepSize) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ScrollBar*>(m_pIface)->SetStepSize(fStepSize); } @@ -83,9 +83,9 @@ FX_FLOAT CFWL_ScrollBar::GetPos() { return static_cast<IFWL_ScrollBar*>(m_pIface)->GetPos(); } -FWL_ERR CFWL_ScrollBar::SetPos(FX_FLOAT fPos) { +FWL_Error CFWL_ScrollBar::SetPos(FX_FLOAT fPos) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ScrollBar*>(m_pIface)->SetPos(fPos); } @@ -95,9 +95,9 @@ FX_FLOAT CFWL_ScrollBar::GetTrackPos() { return static_cast<IFWL_ScrollBar*>(m_pIface)->GetTrackPos(); } -FWL_ERR CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { +FWL_Error CFWL_ScrollBar::SetTrackPos(FX_FLOAT fTrackPos) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return static_cast<IFWL_ScrollBar*>(m_pIface)->SetTrackPos(fTrackPos); } diff --git a/xfa/fwl/lightwidget/cfwl_scrollbar.h b/xfa/fwl/lightwidget/cfwl_scrollbar.h index 89c0fe44e4..fd80e8b8ab 100644 --- a/xfa/fwl/lightwidget/cfwl_scrollbar.h +++ b/xfa/fwl/lightwidget/cfwl_scrollbar.h @@ -12,18 +12,18 @@ class CFWL_ScrollBar : public CFWL_Widget { public: static CFWL_ScrollBar* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); FX_BOOL IsVertical(); - FWL_ERR GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); - FWL_ERR SetRange(FX_FLOAT fMin, FX_FLOAT fMax); + FWL_Error GetRange(FX_FLOAT& fMin, FX_FLOAT& fMax); + FWL_Error SetRange(FX_FLOAT fMin, FX_FLOAT fMax); FX_FLOAT GetPageSize(); - FWL_ERR SetPageSize(FX_FLOAT fPageSize); + FWL_Error SetPageSize(FX_FLOAT fPageSize); FX_FLOAT GetStepSize(); - FWL_ERR SetStepSize(FX_FLOAT fStepSize); + FWL_Error SetStepSize(FX_FLOAT fStepSize); FX_FLOAT GetPos(); - FWL_ERR SetPos(FX_FLOAT fPos); + FWL_Error SetPos(FX_FLOAT fPos); FX_FLOAT GetTrackPos(); - FWL_ERR SetTrackPos(FX_FLOAT fTrackPos); + FWL_Error SetTrackPos(FX_FLOAT fTrackPos); FX_BOOL DoScroll(uint32_t dwCode, FX_FLOAT fPos = 0.0f); CFWL_ScrollBar(); virtual ~CFWL_ScrollBar(); diff --git a/xfa/fwl/lightwidget/cfwl_theme.cpp b/xfa/fwl/lightwidget/cfwl_theme.cpp index 65a5aaf689..594dbd84a4 100644 --- a/xfa/fwl/lightwidget/cfwl_theme.cpp +++ b/xfa/fwl/lightwidget/cfwl_theme.cpp @@ -64,13 +64,13 @@ uint32_t CFWL_Theme::SetThemeID(IFWL_Widget* pWidget, return dwID; } -FWL_ERR CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { - return FWL_ERR_Succeeded; +FWL_Error CFWL_Theme::GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { + return FWL_Error::Succeeded; } -FWL_ERR CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) { - return FWL_ERR_Succeeded; +FWL_Error CFWL_Theme::SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix) { + return FWL_Error::Succeeded; } FX_BOOL CFWL_Theme::DrawBackground(CFWL_ThemeBackground* pParams) { @@ -90,7 +90,8 @@ FX_BOOL CFWL_Theme::IsCustomizedLayout(IFWL_Widget* pWidget) { return GetTheme(pWidget)->IsCustomizedLayout(pWidget); } -FWL_ERR CFWL_Theme::GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) { +FWL_Error CFWL_Theme::GetPartRect(CFWL_ThemePart* pThemePart, + CFX_RectF& rtPart) { return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rtPart); } @@ -104,30 +105,30 @@ FX_BOOL CFWL_Theme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { return GetTheme(pParams->m_pWidget)->CalcTextRect(pParams, rect); } -FWL_ERR CFWL_Theme::Initialize() { +FWL_Error CFWL_Theme::Initialize() { for (const auto& pTheme : m_ThemesArray) pTheme->Initialize(); FWLTHEME_Init(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_Theme::Finalize() { +FWL_Error CFWL_Theme::Finalize() { for (const auto& pTheme : m_ThemesArray) pTheme->Finalize(); FWLTHEME_Release(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_Theme::SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont) { +FWL_Error CFWL_Theme::SetFont(IFWL_Widget* pWidget, + const FX_WCHAR* strFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont) { for (const auto& pTheme : m_ThemesArray) pTheme->SetFont(pWidget, strFont, fFontSize, rgbFont); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_WidgetTP* CFWL_Theme::GetTheme(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/lightwidget/cfwl_theme.h b/xfa/fwl/lightwidget/cfwl_theme.h index 110a9dbb69..ba20013c10 100644 --- a/xfa/fwl/lightwidget/cfwl_theme.h +++ b/xfa/fwl/lightwidget/cfwl_theme.h @@ -31,26 +31,26 @@ class CFWL_Theme : public IFWL_ThemeProvider { uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren = TRUE) override; - FWL_ERR GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; - FWL_ERR SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) override; + FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) override; + FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix) override; FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; FX_BOOL DrawText(CFWL_ThemeText* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget) override; - FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; + FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, FX_FLOAT fx, FX_FLOAT fy) override; FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) override; - FWL_ERR Initialize(); - FWL_ERR Finalize(); - FWL_ERR SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont); + FWL_Error Initialize(); + FWL_Error Finalize(); + FWL_Error SetFont(IFWL_Widget* pWidget, + const FX_WCHAR* strFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont); CFWL_WidgetTP* GetTheme(IFWL_Widget* pWidget); protected: diff --git a/xfa/fwl/lightwidget/cfwl_tooltip.cpp b/xfa/fwl/lightwidget/cfwl_tooltip.cpp index efb61ce018..7a9a26cf9e 100644 --- a/xfa/fwl/lightwidget/cfwl_tooltip.cpp +++ b/xfa/fwl/lightwidget/cfwl_tooltip.cpp @@ -16,79 +16,73 @@ CFWL_ToolTip* CFWL_ToolTip::Create() { return new CFWL_ToolTip; } -FWL_ERR CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_ToolTip::Initialize(const CFWL_WidgetProperties* pProperties) { if (m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (pProperties) { *m_pProperties = *pProperties; } std::unique_ptr<IFWL_ToolTip> pToolTip(IFWL_ToolTip::Create( m_pProperties->MakeWidgetImpProperties(&m_tooltipData), nullptr)); - FWL_ERR ret = pToolTip->Initialize(); - if (ret != FWL_ERR_Succeeded) { + FWL_Error ret = pToolTip->Initialize(); + if (ret != FWL_Error::Succeeded) { return ret; } m_pIface = pToolTip.release(); CFWL_Widget::Initialize(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) { +void CFWL_ToolTip::GetCaption(CFX_WideString& wsCaption) { wsCaption = m_tooltipData.m_wsCaption; - return FWL_ERR_Succeeded; } -FWL_ERR CFWL_ToolTip::SetCaption(const CFX_WideStringC& wsCaption) { +void CFWL_ToolTip::SetCaption(const CFX_WideStringC& wsCaption) { m_tooltipData.m_wsCaption = wsCaption; - return FWL_ERR_Succeeded; } int32_t CFWL_ToolTip::GetInitialDelay() { return m_tooltipData.m_nInitDelayTime; } -int32_t CFWL_ToolTip::SetInitialDelay(int32_t nDelayTime) { +void CFWL_ToolTip::SetInitialDelay(int32_t nDelayTime) { m_tooltipData.m_nInitDelayTime = nDelayTime; - return FWL_ERR_Succeeded; } int32_t CFWL_ToolTip::GetAutoPopDelay() { return m_tooltipData.m_nAutoPopDelayTime; } -int32_t CFWL_ToolTip::SetAutoPopDelay(int32_t nDelayTime) { +void CFWL_ToolTip::SetAutoPopDelay(int32_t nDelayTime) { m_tooltipData.m_nAutoPopDelayTime = nDelayTime; - return FWL_ERR_Succeeded; } CFX_DIBitmap* CFWL_ToolTip::GetToolTipIcon() { return m_tooltipData.m_pBitmap; } -FWL_ERR CFWL_ToolTip::SetToolTipIcon(CFX_DIBitmap* pBitmap) { +void CFWL_ToolTip::SetToolTipIcon(CFX_DIBitmap* pBitmap) { m_tooltipData.m_pBitmap = pBitmap; - return FWL_ERR_Succeeded; } CFX_SizeF CFWL_ToolTip::GetToolTipIconSize() { return m_tooltipData.m_fIconSize; } -FWL_ERR CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) { +void CFWL_ToolTip::SetToolTipIconSize(CFX_SizeF fSize) { m_tooltipData.m_fIconSize = fSize; - return FWL_ERR_Succeeded; } -FWL_ERR CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { - return static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor); +void CFWL_ToolTip::SetAnchor(const CFX_RectF& rtAnchor) { + static_cast<IFWL_ToolTip*>(m_pIface)->SetAnchor(rtAnchor); } -FWL_ERR CFWL_ToolTip::Show() { - return static_cast<IFWL_ToolTip*>(m_pIface)->Show(); +void CFWL_ToolTip::Show() { + static_cast<IFWL_ToolTip*>(m_pIface)->Show(); } -FWL_ERR CFWL_ToolTip::Hide() { - return static_cast<IFWL_ToolTip*>(m_pIface)->Hide(); +void CFWL_ToolTip::Hide() { + static_cast<IFWL_ToolTip*>(m_pIface)->Hide(); } CFWL_ToolTip::CFWL_ToolTip() {} @@ -102,10 +96,10 @@ CFWL_ToolTip::CFWL_ToolTipDP::CFWL_ToolTipDP() : m_pBitmap(NULL) { m_fAnchor.Set(0.0, 0.0, 0.0, 0.0); } -FWL_ERR CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget, - CFX_WideString& wsCaption) { +FWL_Error CFWL_ToolTip::CFWL_ToolTipDP::GetCaption(IFWL_Widget* pWidget, + CFX_WideString& wsCaption) { wsCaption = m_wsCaption; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } int32_t CFWL_ToolTip::CFWL_ToolTipDP::GetInitialDelay(IFWL_Widget* pWidget) { diff --git a/xfa/fwl/lightwidget/cfwl_tooltip.h b/xfa/fwl/lightwidget/cfwl_tooltip.h index 817362a41c..74f702849c 100644 --- a/xfa/fwl/lightwidget/cfwl_tooltip.h +++ b/xfa/fwl/lightwidget/cfwl_tooltip.h @@ -13,28 +13,35 @@ class CFWL_ToolTip : public CFWL_Widget { public: static CFWL_ToolTip* Create(); - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); - FWL_ERR GetCaption(CFX_WideString& wsCaption); - FWL_ERR SetCaption(const CFX_WideStringC& wsCaption); + + CFWL_ToolTip(); + virtual ~CFWL_ToolTip(); + + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = nullptr); + + void GetCaption(CFX_WideString& wsCaption); + void SetCaption(const CFX_WideStringC& wsCaption); + int32_t GetInitialDelay(); - int32_t SetInitialDelay(int32_t nDelayTime); + void SetInitialDelay(int32_t nDelayTime); + int32_t GetAutoPopDelay(); - int32_t SetAutoPopDelay(int32_t nDelayTime); + void SetAutoPopDelay(int32_t nDelayTime); + CFX_DIBitmap* GetToolTipIcon(); - FWL_ERR SetToolTipIcon(CFX_DIBitmap* pBitmap); + void SetToolTipIcon(CFX_DIBitmap* pBitmap); CFX_SizeF GetToolTipIconSize(); - FWL_ERR SetToolTipIconSize(CFX_SizeF fSize); - FWL_ERR SetAnchor(const CFX_RectF& rtAnchor); - FWL_ERR Show(); - FWL_ERR Hide(); - CFWL_ToolTip(); - virtual ~CFWL_ToolTip(); + void SetToolTipIconSize(CFX_SizeF fSize); + + void SetAnchor(const CFX_RectF& rtAnchor); + void Show(); + void Hide(); protected: class CFWL_ToolTipDP : public IFWL_ToolTipDP { public: CFWL_ToolTipDP(); - FWL_ERR GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); + FWL_Error GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption); int32_t GetInitialDelay(IFWL_Widget* pWidget); int32_t GetAutoPopDelay(IFWL_Widget* pWidget); CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget); diff --git a/xfa/fwl/lightwidget/cfwl_widget.cpp b/xfa/fwl/lightwidget/cfwl_widget.cpp index 96238ae348..e1959797b3 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.cpp +++ b/xfa/fwl/lightwidget/cfwl_widget.cpp @@ -23,9 +23,9 @@ IFWL_Widget* CFWL_Widget::GetWidget() { return m_pIface; } -FWL_ERR CFWL_Widget::GetClassName(CFX_WideString& wsClass) const { +FWL_Error CFWL_Widget::GetClassName(CFX_WideString& wsClass) const { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->GetClassName(wsClass); } @@ -43,33 +43,33 @@ FX_BOOL CFWL_Widget::IsInstance(const CFX_WideStringC& wsClass) const { static void* gs_pFWLWidget = (void*)FXBSTR_ID('l', 'i', 'g', 't'); -FWL_ERR CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) { +FWL_Error CFWL_Widget::Initialize(const CFWL_WidgetProperties* pProperties) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->SetPrivateData(gs_pFWLWidget, this, nullptr); } -FWL_ERR CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { +FWL_Error CFWL_Widget::GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->GetWidgetRect(rect, bAutoSize); } -FWL_ERR CFWL_Widget::GetGlobalRect(CFX_RectF& rect) { +FWL_Error CFWL_Widget::GetGlobalRect(CFX_RectF& rect) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->GetGlobalRect(rect); } -FWL_ERR CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { +FWL_Error CFWL_Widget::SetWidgetRect(const CFX_RectF& rect) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->SetWidgetRect(rect); } -FWL_ERR CFWL_Widget::GetClientRect(CFX_RectF& rect) { +FWL_Error CFWL_Widget::GetClientRect(CFX_RectF& rect) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->GetClientRect(rect); } @@ -83,9 +83,9 @@ CFWL_Widget* CFWL_Widget::GetParent() { return nullptr; } -FWL_ERR CFWL_Widget::SetParent(CFWL_Widget* pParent) { +FWL_Error CFWL_Widget::SetParent(CFWL_Widget* pParent) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->SetParent(pParent ? pParent->GetWidget() : nullptr); } @@ -93,10 +93,10 @@ CFWL_Widget* CFWL_Widget::GetOwner() { return nullptr; } -FWL_ERR CFWL_Widget::SetOwner(CFWL_Widget* pOwner) { +FWL_Error CFWL_Widget::SetOwner(CFWL_Widget* pOwner) { if (!m_pIface) - return FWL_ERR_Indefinite; - return FWL_ERR_Succeeded; + return FWL_Error::Indefinite; + return FWL_Error::Succeeded; } uint32_t CFWL_Widget::GetStyles() { @@ -105,10 +105,10 @@ uint32_t CFWL_Widget::GetStyles() { return m_pIface->GetStyles(); } -FWL_ERR CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, - uint32_t dwStylesRemoved) { +FWL_Error CFWL_Widget::ModifyStyles(uint32_t dwStylesAdded, + uint32_t dwStylesRemoved) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->ModifyStyles(dwStylesAdded, dwStylesRemoved); } @@ -118,14 +118,14 @@ uint32_t CFWL_Widget::GetStylesEx() { return m_pIface->GetStylesEx(); } -FWL_ERR CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, - uint32_t dwStylesExRemoved) { +FWL_Error CFWL_Widget::ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved) { return m_pIface->ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } uint32_t CFWL_Widget::GetStates() { if (!m_pIface) - return FWL_ERR_Indefinite; + return 0; return m_pIface->GetStates(); } @@ -134,11 +134,11 @@ void CFWL_Widget::SetStates(uint32_t dwStates, FX_BOOL bSet) { m_pIface->SetStates(dwStates, bSet); } -FWL_ERR CFWL_Widget::SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback) { +FWL_Error CFWL_Widget::SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->SetPrivateData(module_id, pData, callback); } @@ -148,21 +148,21 @@ void* CFWL_Widget::GetPrivateData(void* module_id) { return m_pIface->GetPrivateData(module_id); } -FWL_ERR CFWL_Widget::Update() { +FWL_Error CFWL_Widget::Update() { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->Update(); } -FWL_ERR CFWL_Widget::LockUpdate() { +FWL_Error CFWL_Widget::LockUpdate() { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->LockUpdate(); } -FWL_ERR CFWL_Widget::UnlockUpdate() { +FWL_Error CFWL_Widget::UnlockUpdate() { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->UnlockUpdate(); } @@ -172,37 +172,37 @@ FWL_WidgetHit CFWL_Widget::HitTest(FX_FLOAT fx, FX_FLOAT fy) { return m_pIface->HitTest(fx, fy); } -FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget, - FX_FLOAT& fx, - FX_FLOAT& fy) { +FWL_Error CFWL_Widget::TransformTo(CFWL_Widget* pWidget, + FX_FLOAT& fx, + FX_FLOAT& fy) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : nullptr, fx, fy); } -FWL_ERR CFWL_Widget::TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt) { +FWL_Error CFWL_Widget::TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->TransformTo(pWidget ? pWidget->GetWidget() : nullptr, rt); } -FWL_ERR CFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { +FWL_Error CFWL_Widget::GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->GetMatrix(matrix, bGlobal); } -FWL_ERR CFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { +FWL_Error CFWL_Widget::SetMatrix(const CFX_Matrix& matrix) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->SetMatrix(matrix); } -FWL_ERR CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { +FWL_Error CFWL_Widget::DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; return m_pIface->DrawWidget(pGraphics, pMatrix); } @@ -229,9 +229,9 @@ CFWL_Widget::~CFWL_Widget() { } } -FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) { +FWL_Error CFWL_Widget::Repaint(const CFX_RectF* pRect) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFX_RectF rect; if (pRect) { @@ -243,17 +243,17 @@ FWL_ERR CFWL_Widget::Repaint(const CFX_RectF* pRect) { return m_pWidgetMgr->RepaintWidget(m_pIface, &rect); } -FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) { +FWL_Error CFWL_Widget::SetFocus(FX_BOOL bFocus) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_App* pApp = m_pIface->GetOwnerApp(); if (!pApp) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); if (!pDriver) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; if (bFocus) { pDriver->SetFocus(m_pIface); @@ -262,23 +262,23 @@ FWL_ERR CFWL_Widget::SetFocus(FX_BOOL bFocus) { pDriver->SetFocus(nullptr); } } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_Widget::SetGrab(FX_BOOL bSet) { +FWL_Error CFWL_Widget::SetGrab(FX_BOOL bSet) { if (!m_pIface) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; IFWL_App* pApp = m_pIface->GetOwnerApp(); if (!pApp) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; CFWL_NoteDriver* pDriver = pApp->GetNoteDriver(); if (!pDriver) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; pDriver->SetGrab(m_pIface, bSet); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_Widget::RegisterEventTarget(CFWL_Widget* pEventSource, diff --git a/xfa/fwl/lightwidget/cfwl_widget.h b/xfa/fwl/lightwidget/cfwl_widget.h index 5ec370ecea..fd30b71b4c 100644 --- a/xfa/fwl/lightwidget/cfwl_widget.h +++ b/xfa/fwl/lightwidget/cfwl_widget.h @@ -21,41 +21,43 @@ class CFWL_Widget { public: virtual ~CFWL_Widget(); IFWL_Widget* GetWidget(); - FWL_ERR GetClassName(CFX_WideString& wsClass) const; + FWL_Error GetClassName(CFX_WideString& wsClass) const; uint32_t GetClassID() const; virtual FX_BOOL IsInstance(const CFX_WideStringC& wsClass) const; - FWL_ERR GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); - FWL_ERR GetGlobalRect(CFX_RectF& rect); - FWL_ERR SetWidgetRect(const CFX_RectF& rect); - FWL_ERR GetClientRect(CFX_RectF& rtClient); + FWL_Error GetWidgetRect(CFX_RectF& rect, FX_BOOL bAutoSize = FALSE); + FWL_Error GetGlobalRect(CFX_RectF& rect); + FWL_Error SetWidgetRect(const CFX_RectF& rect); + FWL_Error GetClientRect(CFX_RectF& rtClient); CFWL_Widget* GetParent(); - FWL_ERR SetParent(CFWL_Widget* pParent); + FWL_Error SetParent(CFWL_Widget* pParent); CFWL_Widget* GetOwner(); - FWL_ERR SetOwner(CFWL_Widget* pOwner); + FWL_Error SetOwner(CFWL_Widget* pOwner); uint32_t GetStyles(); - FWL_ERR ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); + FWL_Error ModifyStyles(uint32_t dwStylesAdded, uint32_t dwStylesRemoved); uint32_t GetStylesEx(); - FWL_ERR ModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); + FWL_Error ModifyStylesEx(uint32_t dwStylesExAdded, + uint32_t dwStylesExRemoved); uint32_t GetStates(); void SetStates(uint32_t dwStates, FX_BOOL bSet = TRUE); - FWL_ERR SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); + FWL_Error SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback); void* GetPrivateData(void* module_id); - FWL_ERR Update(); - FWL_ERR LockUpdate(); - FWL_ERR UnlockUpdate(); + FWL_Error Update(); + FWL_Error LockUpdate(); + FWL_Error UnlockUpdate(); FWL_WidgetHit HitTest(FX_FLOAT fx, FX_FLOAT fy); - FWL_ERR TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); - FWL_ERR TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt); - FWL_ERR GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); - FWL_ERR SetMatrix(const CFX_Matrix& matrix); - FWL_ERR DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix = NULL); + FWL_Error TransformTo(CFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy); + FWL_Error TransformTo(CFWL_Widget* pWidget, CFX_RectF& rt); + FWL_Error GetMatrix(CFX_Matrix& matrix, FX_BOOL bGlobal = FALSE); + FWL_Error SetMatrix(const CFX_Matrix& matrix); + FWL_Error DrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); IFWL_WidgetDelegate* SetDelegate(IFWL_WidgetDelegate* pDelegate); - FWL_ERR Repaint(const CFX_RectF* pRect = NULL); - FWL_ERR SetFocus(FX_BOOL bFocus); - FWL_ERR SetGrab(FX_BOOL bSet); + FWL_Error Repaint(const CFX_RectF* pRect = NULL); + FWL_Error SetFocus(FX_BOOL bFocus); + FWL_Error SetGrab(FX_BOOL bSet); CFWL_Widget(); void RegisterEventTarget(CFWL_Widget* pEventSource = NULL, @@ -70,7 +72,7 @@ class CFWL_Widget { CFWL_WidgetProperties* m_pProperties; protected: - FWL_ERR Initialize(const CFWL_WidgetProperties* pProperties = NULL); + FWL_Error Initialize(const CFWL_WidgetProperties* pProperties = NULL); }; #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGET_H_ diff --git a/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp b/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp index 1596aba48a..fcb7232622 100644 --- a/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp +++ b/xfa/fwl/lightwidget/cfwl_widgetdelegate.cpp @@ -13,15 +13,9 @@ CFWL_WidgetDelegate::CFWL_WidgetDelegate() {} CFWL_WidgetDelegate::~CFWL_WidgetDelegate() {} -int32_t CFWL_WidgetDelegate::OnProcessMessage(CFWL_Message* pMessage) { - return 1; -} - -FWL_ERR CFWL_WidgetDelegate::OnProcessEvent(CFWL_Event* pEvent) { - return FWL_ERR_Succeeded; -} - -FWL_ERR CFWL_WidgetDelegate::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return FWL_ERR_Succeeded; -} +void CFWL_WidgetDelegate::OnProcessMessage(CFWL_Message* pMessage) {} + +void CFWL_WidgetDelegate::OnProcessEvent(CFWL_Event* pEvent) {} + +void CFWL_WidgetDelegate::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) {} diff --git a/xfa/fwl/lightwidget/cfwl_widgetdelegate.h b/xfa/fwl/lightwidget/cfwl_widgetdelegate.h index 42f6f9329f..1f5cdab8f4 100644 --- a/xfa/fwl/lightwidget/cfwl_widgetdelegate.h +++ b/xfa/fwl/lightwidget/cfwl_widgetdelegate.h @@ -7,6 +7,8 @@ #ifndef XFA_FWL_LIGHTWIDGET_CFWL_WIDGETDELEGATE_H_ #define XFA_FWL_LIGHTWIDGET_CFWL_WIDGETDELEGATE_H_ +#include <stdint.h> + #include "xfa/fwl/core/fwl_error.h" #include "xfa/fwl/core/ifwl_widgetdelegate.h" @@ -20,10 +22,10 @@ class CFWL_WidgetDelegate : public IFWL_WidgetDelegate { CFWL_WidgetDelegate(); virtual ~CFWL_WidgetDelegate(); - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = nullptr) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = nullptr) override; }; #endif // XFA_FWL_LIGHTWIDGET_CFWL_WIDGETDELEGATE_H_ diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index b7d3d724b6..78d829f8b0 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -98,11 +98,11 @@ FX_BOOL CFWL_CheckBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { } return TRUE; } -FWL_ERR CFWL_CheckBoxTP::Initialize() { +FWL_Error CFWL_CheckBoxTP::Initialize() { InitTTO(); return CFWL_WidgetTP::Initialize(); } -FWL_ERR CFWL_CheckBoxTP::Finalize() { +FWL_Error CFWL_CheckBoxTP::Finalize() { FinalizeTTO(); return CFWL_WidgetTP::Finalize(); } diff --git a/xfa/fwl/theme/cfwl_checkboxtp.h b/xfa/fwl/theme/cfwl_checkboxtp.h index bb2f14dec3..f6a3b82784 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.h +++ b/xfa/fwl/theme/cfwl_checkboxtp.h @@ -20,8 +20,8 @@ class CFWL_CheckBoxTP : public CFWL_WidgetTP { FX_BOOL bChildren = TRUE); virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); protected: void DrawBoxBk(IFWL_Widget* pWidget, diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index e557e6606b..644da90071 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -77,11 +77,11 @@ FX_BOOL CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { } return TRUE; } -FWL_ERR CFWL_EditTP::Initialize() { +FWL_Error CFWL_EditTP::Initialize() { InitTTO(); return CFWL_WidgetTP::Initialize(); } -FWL_ERR CFWL_EditTP::Finalize() { +FWL_Error CFWL_EditTP::Finalize() { FinalizeTTO(); return CFWL_WidgetTP::Finalize(); } diff --git a/xfa/fwl/theme/cfwl_edittp.h b/xfa/fwl/theme/cfwl_edittp.h index 73c99dafb7..7077737d8d 100644 --- a/xfa/fwl/theme/cfwl_edittp.h +++ b/xfa/fwl/theme/cfwl_edittp.h @@ -15,8 +15,8 @@ class CFWL_EditTP : public CFWL_WidgetTP { virtual ~CFWL_EditTP(); virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); }; #endif // XFA_FWL_THEME_CFWL_EDITTP_H_ diff --git a/xfa/fwl/theme/cfwl_formtp.cpp b/xfa/fwl/theme/cfwl_formtp.cpp index 6fd3453e69..6b876d2b40 100644 --- a/xfa/fwl/theme/cfwl_formtp.cpp +++ b/xfa/fwl/theme/cfwl_formtp.cpp @@ -44,14 +44,14 @@ CFWL_FormTP::~CFWL_FormTP() { delete m_pThemeData; } -FWL_ERR CFWL_FormTP::Initialize() { +FWL_Error CFWL_FormTP::Initialize() { InitTTO(); InitCaption(TRUE); InitCaption(FALSE); return CFWL_WidgetTP::Initialize(); } -FWL_ERR CFWL_FormTP::Finalize() { +FWL_Error CFWL_FormTP::Finalize() { FinalizeTTO(); delete m_pActiveBitmap; m_pActiveBitmap = nullptr; @@ -203,8 +203,8 @@ void* CFWL_FormTP::GetCapacity(CFWL_ThemePart* pThemePart, } return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } -FWL_ERR CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rtPart) { +FWL_Error CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, + CFX_RectF& rtPart) { switch (pThemePart->m_iPart) { case CFWL_Part::CloseBox: { CalCloseBox(pThemePart->m_pWidget, rtPart); @@ -228,7 +228,7 @@ FWL_ERR CFWL_FormTP::GetPartRect(CFWL_ThemePart* pThemePart, } default: {} } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_FormTP::CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect) { uint32_t dwStyles = pWidget->GetStyles(); diff --git a/xfa/fwl/theme/cfwl_formtp.h b/xfa/fwl/theme/cfwl_formtp.h index 6086eca80e..652528e0f9 100644 --- a/xfa/fwl/theme/cfwl_formtp.h +++ b/xfa/fwl/theme/cfwl_formtp.h @@ -15,8 +15,8 @@ class CFWL_FormTP : public CFWL_WidgetTP { CFWL_FormTP(); ~CFWL_FormTP() override; - FWL_ERR Initialize() override; - FWL_ERR Finalize() override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; FX_BOOL IsValidWidget(IFWL_Widget* pWidget) override; uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, @@ -25,7 +25,7 @@ class CFWL_FormTP : public CFWL_WidgetTP { FX_BOOL DrawText(CFWL_ThemeText* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; - FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; + FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) override; protected: void CalCloseBox(IFWL_Widget* pWidget, CFX_RectF& rect); diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index f1a017ab70..5bab1b09e5 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp @@ -66,11 +66,11 @@ FX_BOOL CFWL_ListBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { } return TRUE; } -FWL_ERR CFWL_ListBoxTP::Initialize() { +FWL_Error CFWL_ListBoxTP::Initialize() { InitTTO(); return CFWL_WidgetTP::Initialize(); } -FWL_ERR CFWL_ListBoxTP::Finalize() { +FWL_Error CFWL_ListBoxTP::Finalize() { FinalizeTTO(); return CFWL_WidgetTP::Finalize(); } diff --git a/xfa/fwl/theme/cfwl_listboxtp.h b/xfa/fwl/theme/cfwl_listboxtp.h index d4bd7eff94..9ae85c72e7 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.h +++ b/xfa/fwl/theme/cfwl_listboxtp.h @@ -15,8 +15,8 @@ class CFWL_ListBoxTP : public CFWL_WidgetTP { virtual ~CFWL_ListBoxTP(); virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); protected: void DrawListBoxItem(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index 8b10fb993c..fac318f69d 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -349,11 +349,11 @@ void* CFWL_MonthCalendarTP::GetCapacity(CFWL_ThemePart* pThemePart, } return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } -FWL_ERR CFWL_MonthCalendarTP::Initialize() { +FWL_Error CFWL_MonthCalendarTP::Initialize() { InitTTO(); return CFWL_WidgetTP::Initialize(); } -FWL_ERR CFWL_MonthCalendarTP::Finalize() { +FWL_Error CFWL_MonthCalendarTP::Finalize() { FinalizeTTO(); return CFWL_WidgetTP::Finalize(); } diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.h b/xfa/fwl/theme/cfwl_monthcalendartp.h index 08e65ca848..acc4787f0f 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.h +++ b/xfa/fwl/theme/cfwl_monthcalendartp.h @@ -22,8 +22,8 @@ class CFWL_MonthCalendarTP : public CFWL_WidgetTP { FX_BOOL DrawText(CFWL_ThemeText* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; - FWL_ERR Initialize() override; - FWL_ERR Finalize() override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; protected: FX_BOOL DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix); diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index 780c580369..103bae7aa9 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -102,11 +102,11 @@ void* CFWL_PushButtonTP::GetCapacity(CFWL_ThemePart* pThemePart, } return CFWL_WidgetTP::GetCapacity(pThemePart, dwCapacity); } -FWL_ERR CFWL_PushButtonTP::Initialize() { +FWL_Error CFWL_PushButtonTP::Initialize() { InitTTO(); return CFWL_WidgetTP::Initialize(); } -FWL_ERR CFWL_PushButtonTP::Finalize() { +FWL_Error CFWL_PushButtonTP::Finalize() { FinalizeTTO(); return CFWL_WidgetTP::Finalize(); } diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.h b/xfa/fwl/theme/cfwl_pushbuttontp.h index 6329f90207..e51ce55e78 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.h +++ b/xfa/fwl/theme/cfwl_pushbuttontp.h @@ -21,8 +21,8 @@ class CFWL_PushButtonTP : public CFWL_WidgetTP { FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams) override; void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity) override; - FWL_ERR Initialize() override; - FWL_ERR Finalize() override; + FWL_Error Initialize() override; + FWL_Error Finalize() override; protected: struct PBThemeData { diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index 6664bbed52..ecf338e103 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -66,15 +66,15 @@ uint32_t CFWL_WidgetTP::SetThemeID(IFWL_Widget* pWidget, } return dwOld; } -FWL_ERR CFWL_WidgetTP::GetThemeMatrix(IFWL_Widget* pWidget, - CFX_Matrix& matrix) { +FWL_Error CFWL_WidgetTP::GetThemeMatrix(IFWL_Widget* pWidget, + CFX_Matrix& matrix) { matrix.Set(_ctm.a, _ctm.b, _ctm.c, _ctm.d, _ctm.e, _ctm.f); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetTP::SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) { +FWL_Error CFWL_WidgetTP::SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix) { _ctm.Set(matrix.a, matrix.b, matrix.c, matrix.d, matrix.e, matrix.f); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFWL_WidgetTP::DrawBackground(CFWL_ThemeBackground* pParams) { return TRUE; @@ -154,9 +154,9 @@ void* CFWL_WidgetTP::GetCapacity(CFWL_ThemePart* pThemePart, FX_BOOL CFWL_WidgetTP::IsCustomizedLayout(IFWL_Widget* pWidget) { return FWL_GetThemeLayout(m_dwThemeID); } -FWL_ERR CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, - CFX_RectF& rect) { - return FWL_ERR_Succeeded; +FWL_Error CFWL_WidgetTP::GetPartRect(CFWL_ThemePart* pThemePart, + CFX_RectF& rect) { + return FWL_Error::Succeeded; } FX_BOOL CFWL_WidgetTP::IsInPart(CFWL_ThemePart* pThemePart, FX_FLOAT fx, @@ -174,51 +174,51 @@ FX_BOOL CFWL_WidgetTP::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { pParams->m_wsText.GetLength(), rect); return TRUE; } -FWL_ERR CFWL_WidgetTP::Initialize() { +FWL_Error CFWL_WidgetTP::Initialize() { m_dwThemeID = 0; _ctm.SetIdentity(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetTP::Finalize() { +FWL_Error CFWL_WidgetTP::Finalize() { if (!m_pTextOut) { FinalizeTTO(); } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } CFWL_WidgetTP::~CFWL_WidgetTP() {} -FWL_ERR CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont) { +FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, + const FX_WCHAR* strFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont) { if (!m_pTextOut) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(strFont, 0, 0); m_pTextOut->SetFont(m_pFDEFont); m_pTextOut->SetFontSize(fFontSize); m_pTextOut->SetTextColor(rgbFont); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, - IFX_Font* pFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont) { +FWL_Error CFWL_WidgetTP::SetFont(IFWL_Widget* pWidget, + IFX_Font* pFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont) { if (!m_pTextOut) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } m_pTextOut->SetFont(pFont); m_pTextOut->SetFontSize(fFontSize); m_pTextOut->SetTextColor(rgbFont); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } IFX_Font* CFWL_WidgetTP::GetFont(IFWL_Widget* pWidget) { return m_pFDEFont; } CFWL_WidgetTP::CFWL_WidgetTP() : m_dwRefCount(1), m_pTextOut(NULL), m_pFDEFont(NULL), m_dwThemeID(0) {} -FX_ERR CFWL_WidgetTP::InitTTO() { +FWL_Error CFWL_WidgetTP::InitTTO() { if (m_pTextOut) { - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } m_pFDEFont = CFWL_FontManager::GetInstance()->FindFont(FX_WSTRC(L"Helvetica"), 0, 0); @@ -227,14 +227,14 @@ FX_ERR CFWL_WidgetTP::InitTTO() { m_pTextOut->SetFontSize(FWLTHEME_CAPACITY_FontSize); m_pTextOut->SetTextColor(FWLTHEME_CAPACITY_TextColor); m_pTextOut->SetEllipsisString(L"..."); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFWL_WidgetTP::FinalizeTTO() { +FWL_Error CFWL_WidgetTP::FinalizeTTO() { if (m_pTextOut) { m_pTextOut->Release(); m_pTextOut = NULL; } - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } void CFWL_WidgetTP::DrawEdge(CFX_Graphics* pGraphics, diff --git a/xfa/fwl/theme/cfwl_widgettp.h b/xfa/fwl/theme/cfwl_widgettp.h index 8e5c8ba283..633892a8ee 100644 --- a/xfa/fwl/theme/cfwl_widgettp.h +++ b/xfa/fwl/theme/cfwl_widgettp.h @@ -111,36 +111,36 @@ class CFWL_WidgetTP { virtual uint32_t SetThemeID(IFWL_Widget* pWidget, uint32_t dwThemeID, FX_BOOL bChildren = TRUE); - virtual FWL_ERR GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix); - virtual FWL_ERR SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix); + virtual FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix); + virtual FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix); virtual FX_BOOL DrawBackground(CFWL_ThemeBackground* pParams); virtual FX_BOOL DrawText(CFWL_ThemeText* pParams); virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity); virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget); - virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart); + virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart); virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect); - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); virtual ~CFWL_WidgetTP(); - FWL_ERR SetFont(IFWL_Widget* pWidget, - const FX_WCHAR* strFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont); - FWL_ERR SetFont(IFWL_Widget* pWidget, - IFX_Font* pFont, - FX_FLOAT fFontSize, - FX_ARGB rgbFont); + FWL_Error SetFont(IFWL_Widget* pWidget, + const FX_WCHAR* strFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont); + FWL_Error SetFont(IFWL_Widget* pWidget, + IFX_Font* pFont, + FX_FLOAT fFontSize, + FX_ARGB rgbFont); IFX_Font* GetFont(IFWL_Widget* pWidget); protected: CFWL_WidgetTP(); - FX_ERR InitTTO(); - FX_ERR FinalizeTTO(); + FWL_Error InitTTO(); + FWL_Error FinalizeTTO(); void DrawEdge(CFX_Graphics* pGraphics, uint32_t dwStyles, const CFX_RectF* pRect, diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index b75fcd5ab0..84a6013528 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -295,11 +295,12 @@ FX_BOOL CXFA_FFCheckButton::UpdateFWLData() { m_pNormalWidget->Update(); return TRUE; } -int32_t CXFA_FFCheckButton::OnProcessMessage(CFWL_Message* pMessage) { - return m_pOldDelegate->OnProcessMessage(pMessage); + +void CXFA_FFCheckButton::OnProcessMessage(CFWL_Message* pMessage) { + m_pOldDelegate->OnProcessMessage(pMessage); } -FWL_ERR CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { +void CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); switch (pEvent->GetClassID()) { case CFWL_EventType::CheckStateChanged: { @@ -330,10 +331,10 @@ FWL_ERR CXFA_FFCheckButton::OnProcessEvent(CFWL_Event* pEvent) { default: break; } - return m_pOldDelegate->OnProcessEvent(pEvent); + m_pOldDelegate->OnProcessEvent(pEvent); } -FWL_ERR CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); +void CXFA_FFCheckButton::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.h b/xfa/fxfa/app/xfa_ffcheckbutton.h index a04284250b..c3323b4035 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.h +++ b/xfa/fxfa/app/xfa_ffcheckbutton.h @@ -25,10 +25,10 @@ class CXFA_FFCheckButton : public CXFA_FFField { virtual void UpdateWidgetProperty(); virtual FX_BOOL OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); void SetFWLCheckState(XFA_CHECKSTATE eCheckState); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual void OnProcessMessage(CFWL_Message* pMessage); + virtual void OnProcessEvent(CFWL_Event* pEvent); + virtual void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: virtual FX_BOOL CommitData(); diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index 6bb7c0bedb..4676bc9374 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -180,10 +180,12 @@ void CXFA_FFListBox::DeleteItem(int32_t nIndex) { m_pNormalWidget->Update(); AddInvalidateRect(); } -int32_t CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) { - return m_pOldDelegate->OnProcessMessage(pMessage); + +void CXFA_FFListBox::OnProcessMessage(CFWL_Message* pMessage) { + m_pOldDelegate->OnProcessMessage(pMessage); } -FWL_ERR CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) { + +void CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); switch (pEvent->GetClassID()) { case CFWL_EventType::SelectChanged: { @@ -194,11 +196,11 @@ FWL_ERR CXFA_FFListBox::OnProcessEvent(CFWL_Event* pEvent) { default: break; } - return m_pOldDelegate->OnProcessEvent(pEvent); + m_pOldDelegate->OnProcessEvent(pEvent); } -FWL_ERR CXFA_FFListBox::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); +void CXFA_FFListBox::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); } CXFA_FFComboBox::CXFA_FFComboBox(CXFA_FFPageView* pPageView, @@ -495,11 +497,11 @@ void CXFA_FFComboBox::OnPostOpen(IFWL_Widget* pWidget) { m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_PostOpen, &eParam); } -int32_t CXFA_FFComboBox::OnProcessMessage(CFWL_Message* pMessage) { - return m_pOldDelegate->OnProcessMessage(pMessage); +void CXFA_FFComboBox::OnProcessMessage(CFWL_Message* pMessage) { + m_pOldDelegate->OnProcessMessage(pMessage); } -FWL_ERR CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) { +void CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); switch (pEvent->GetClassID()) { case CFWL_EventType::SelectChanged: { @@ -524,10 +526,10 @@ FWL_ERR CXFA_FFComboBox::OnProcessEvent(CFWL_Event* pEvent) { default: break; } - return m_pOldDelegate->OnProcessEvent(pEvent); + m_pOldDelegate->OnProcessEvent(pEvent); } -FWL_ERR CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); +void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h index ba48380138..c59ca647aa 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.h +++ b/xfa/fxfa/app/xfa_ffchoicelist.h @@ -28,10 +28,10 @@ class CXFA_FFListBox : public CXFA_FFField { void SetItemState(int32_t nIndex, FX_BOOL bSelected); void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1); void DeleteItem(int32_t nIndex); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual void OnProcessMessage(CFWL_Message* pMessage); + virtual void OnProcessEvent(CFWL_Event* pEvent); + virtual void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: IFWL_WidgetDelegate* m_pOldDelegate; @@ -84,10 +84,10 @@ class CXFA_FFComboBox : public CXFA_FFField { void SetItemState(int32_t nIndex, FX_BOOL bSelected); void InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex = -1); void DeleteItem(int32_t nIndex); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual void OnProcessMessage(CFWL_Message* pMessage); + virtual void OnProcessEvent(CFWL_Event* pEvent); + virtual void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: IFWL_WidgetDelegate* m_pOldDelegate; diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index f56d5a1ece..cb65a0b9a9 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -785,11 +785,9 @@ FX_BOOL CXFA_FFField::IsDataChanged() { void CXFA_FFField::TranslateFWLMessage(CFWL_Message* pMessage) { GetApp()->GetWidgetMgrDelegate()->OnProcessMessageToForm(pMessage); } -int32_t CXFA_FFField::OnProcessMessage(CFWL_Message* pMessage) { - return FWL_ERR_Succeeded; -} +void CXFA_FFField::OnProcessMessage(CFWL_Message* pMessage) {} -FWL_ERR CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { +void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { switch (pEvent->GetClassID()) { case CFWL_EventType::Mouse: { CFWL_EvtMouse* event = (CFWL_EvtMouse*)pEvent; @@ -826,10 +824,7 @@ FWL_ERR CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { default: break; } - return FWL_ERR_Succeeded; } -FWL_ERR CXFA_FFField::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return FWL_ERR_Succeeded; -} +void CXFA_FFField::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) {} diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index 91908e3b98..fd6661dea2 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -85,10 +85,10 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { void SetEditScrollOffset(); public: - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual void OnProcessMessage(CFWL_Message* pMessage); + virtual void OnProcessEvent(CFWL_Event* pEvent); + virtual void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: CFWL_Widget* m_pNormalWidget; diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index 16fa0ef06a..2250eef2e4 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -123,14 +123,17 @@ FX_BOOL CXFA_FFImageEdit::UpdateFWLData() { m_pDataAcc->LoadImageEditImage(); return TRUE; } -int32_t CXFA_FFImageEdit::OnProcessMessage(CFWL_Message* pMessage) { - return m_pOldDelegate->OnProcessMessage(pMessage); + +void CXFA_FFImageEdit::OnProcessMessage(CFWL_Message* pMessage) { + m_pOldDelegate->OnProcessMessage(pMessage); } -FWL_ERR CXFA_FFImageEdit::OnProcessEvent(CFWL_Event* pEvent) { + +void CXFA_FFImageEdit::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); - return m_pOldDelegate->OnProcessEvent(pEvent); + m_pOldDelegate->OnProcessEvent(pEvent); } -FWL_ERR CXFA_FFImageEdit::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); + +void CXFA_FFImageEdit::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); } diff --git a/xfa/fxfa/app/xfa_ffimageedit.h b/xfa/fxfa/app/xfa_ffimageedit.h index 1acc13c7fa..fb3e21e19f 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.h +++ b/xfa/fxfa/app/xfa_ffimageedit.h @@ -21,10 +21,10 @@ class CXFA_FFImageEdit : public CXFA_FFField { virtual FX_BOOL LoadWidget(); virtual void UnloadWidget(); virtual FX_BOOL OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual void OnProcessMessage(CFWL_Message* pMessage); + virtual void OnProcessEvent(CFWL_Event* pEvent); + virtual void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: virtual void SetFWLRect(); diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp index 6db2b7078c..96b6d77096 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.cpp +++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp @@ -201,15 +201,18 @@ void CXFA_FFPushButton::RenderHighlightCaption(CFX_Graphics* pGS, } } } -int32_t CXFA_FFPushButton::OnProcessMessage(CFWL_Message* pMessage) { - return m_pOldDelegate->OnProcessMessage(pMessage); + +void CXFA_FFPushButton::OnProcessMessage(CFWL_Message* pMessage) { + m_pOldDelegate->OnProcessMessage(pMessage); } -FWL_ERR CXFA_FFPushButton::OnProcessEvent(CFWL_Event* pEvent) { + +void CXFA_FFPushButton::OnProcessEvent(CFWL_Event* pEvent) { m_pOldDelegate->OnProcessEvent(pEvent); - return CXFA_FFField::OnProcessEvent(pEvent); + CXFA_FFField::OnProcessEvent(pEvent); } -FWL_ERR CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { + +void CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HiliteInverted) { if ((m_pNormalWidget->GetStates() & FWL_STATE_PSB_Pressed) && (m_pNormalWidget->GetStates() & FWL_STATE_PSB_Hovered)) { @@ -240,7 +243,5 @@ FWL_ERR CXFA_FFPushButton::OnDrawWidget(CFX_Graphics* pGraphics, path.AddRectangle(0, 0, rect.width, rect.height); pGraphics->StrokePath(&path, (CFX_Matrix*)pMatrix); } - } else if (m_pNormalWidget->GetStylesEx() & XFA_FWL_PSBSTYLEEXT_HilitePush) { } - return FWL_ERR_Succeeded; } diff --git a/xfa/fxfa/app/xfa_ffpushbutton.h b/xfa/fxfa/app/xfa_ffpushbutton.h index a37670bb30..96cf785eb0 100644 --- a/xfa/fxfa/app/xfa_ffpushbutton.h +++ b/xfa/fxfa/app/xfa_ffpushbutton.h @@ -28,10 +28,10 @@ class CXFA_FFPushButton : public CXFA_FFField { virtual void UnloadWidget(); virtual FX_BOOL PerformLayout(); virtual void UpdateWidgetProperty(); - virtual int32_t OnProcessMessage(CFWL_Message* pMessage); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); - virtual FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL); + virtual void OnProcessMessage(CFWL_Message* pMessage); + virtual void OnProcessEvent(CFWL_Event* pEvent); + virtual void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL); protected: void LoadHighlightCaption(); diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index 07324cb358..f5605c9775 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -332,7 +332,8 @@ FX_BOOL CXFA_FFTextEdit::Delete() { return ((CFWL_Edit*)m_pNormalWidget)->Delete(); } FX_BOOL CXFA_FFTextEdit::DeSelect() { - return ((CFWL_Edit*)m_pNormalWidget)->ClearSelections(); + return ((CFWL_Edit*)m_pNormalWidget)->ClearSelections() == + FWL_Error::Succeeded; } FX_BOOL CXFA_FFTextEdit::GetSuggestWords( CFX_PointF pointf, @@ -400,11 +401,12 @@ FX_BOOL CXFA_FFTextEdit::GetSuggestWords( } return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest); } -int32_t CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { - return m_pOldDelegate->OnProcessMessage(pMessage); + +void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { + m_pOldDelegate->OnProcessMessage(pMessage); } -FWL_ERR CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { +void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFField::OnProcessEvent(pEvent); switch (pEvent->GetClassID()) { case CFWL_EventType::TextChanged: { @@ -432,13 +434,14 @@ FWL_ERR CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { default: break; } - return m_pOldDelegate->OnProcessEvent(pEvent); + m_pOldDelegate->OnProcessEvent(pEvent); } -FWL_ERR CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix) { - return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); +void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix) { + m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); } + CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFTextEdit(pPageView, pDataAcc) {} @@ -486,14 +489,14 @@ void CXFA_FFNumericEdit::UpdateWidgetProperty() { m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); } -FWL_ERR CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { +void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { if (pEvent->GetClassID() == CFWL_EventType::Validate) { CFWL_EvtEdtValidate* event = (CFWL_EvtEdtValidate*)pEvent; CFX_WideString wsChange = event->wsInsert; event->bValidate = OnValidate(m_pNormalWidget->GetWidget(), wsChange); - return event->bValidate; + return; } - return CXFA_FFTextEdit::OnProcessEvent(pEvent); + CXFA_FFTextEdit::OnProcessEvent(pEvent); } FX_BOOL CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget, @@ -788,12 +791,12 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); } -FWL_ERR CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { +void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, event->iDay); - return TRUE; + return; } - return CXFA_FFTextEdit::OnProcessEvent(pEvent); + CXFA_FFTextEdit::OnProcessEvent(pEvent); } diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h index ecdc2da485..9b73577aab 100644 --- a/xfa/fxfa/app/xfa_fftextedit.h +++ b/xfa/fxfa/app/xfa_fftextedit.h @@ -44,10 +44,10 @@ class CXFA_FFTextEdit : public CXFA_FFField { const CFX_ByteStringC& bsReplace) override; // IFWL_WidgetDelegate: - int32_t OnProcessMessage(CFWL_Message* pMessage) override; - FWL_ERR OnProcessEvent(CFWL_Event* pEvent) override; - FWL_ERR OnDrawWidget(CFX_Graphics* pGraphics, - const CFX_Matrix* pMatrix = NULL) override; + void OnProcessMessage(CFWL_Message* pMessage) override; + void OnProcessEvent(CFWL_Event* pEvent) override; + void OnDrawWidget(CFX_Graphics* pGraphics, + const CFX_Matrix* pMatrix = NULL) override; void OnTextChanged(IFWL_Widget* pWidget, const CFX_WideString& wsChanged, @@ -73,7 +73,7 @@ class CXFA_FFNumericEdit : public CXFA_FFTextEdit { virtual ~CXFA_FFNumericEdit(); virtual FX_BOOL LoadWidget(); virtual void UpdateWidgetProperty(); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); + virtual void OnProcessEvent(CFWL_Event* pEvent); public: FX_BOOL OnValidate(IFWL_Widget* pWidget, CFX_WideString& wsText); @@ -132,7 +132,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { int32_t iYear, int32_t iMonth, int32_t iDay); - virtual FWL_ERR OnProcessEvent(CFWL_Event* pEvent); + virtual void OnProcessEvent(CFWL_Event* pEvent); }; #endif // XFA_FXFA_APP_XFA_FFTEXTEDIT_H_ diff --git a/xfa/fxfa/app/xfa_fwladapter.cpp b/xfa/fxfa/app/xfa_fwladapter.cpp index 564d479d73..4a0828b5ef 100644 --- a/xfa/fxfa/app/xfa_fwladapter.cpp +++ b/xfa/fxfa/app/xfa_fwladapter.cpp @@ -13,15 +13,17 @@ CXFA_FWLAdapterWidgetMgr::CXFA_FWLAdapterWidgetMgr() {} CXFA_FWLAdapterWidgetMgr::~CXFA_FWLAdapterWidgetMgr() {} -FWL_ERR CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget, - const CFX_RectF* pRect) { +FWL_Error CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget, + const CFX_RectF* pRect) { if (!pWidget) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + CXFA_FFField* pField = (CXFA_FFField*)pWidget->GetPrivateData(pWidget); if (!pField) - return FWL_ERR_Indefinite; + return FWL_Error::Indefinite; + pField->AddInvalidateRect(nullptr); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CXFA_FWLAdapterWidgetMgr::GetPopupPos(IFWL_Widget* pWidget, diff --git a/xfa/fxfa/app/xfa_fwladapter.h b/xfa/fxfa/app/xfa_fwladapter.h index 7d2241668b..00e76db227 100644 --- a/xfa/fxfa/app/xfa_fwladapter.h +++ b/xfa/fxfa/app/xfa_fwladapter.h @@ -18,7 +18,7 @@ class CXFA_FWLAdapterWidgetMgr { CXFA_FWLAdapterWidgetMgr(); ~CXFA_FWLAdapterWidgetMgr(); - FWL_ERR RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect); + FWL_Error RepaintWidget(IFWL_Widget* pWidget, const CFX_RectF* pRect); FX_BOOL GetPopupPos(IFWL_Widget* pWidget, FX_FLOAT fMinHeight, FX_FLOAT fMaxHeight, diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 86da75e066..b07a7323b3 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -76,7 +76,7 @@ CXFA_FWLTheme::~CXFA_FWLTheme() { delete m_pCaretTP; delete m_pBarcodeTP; } -FWL_ERR CXFA_FWLTheme::Initialize() { +FWL_Error CXFA_FWLTheme::Initialize() { m_pTextOut = new CFDE_TextOut; for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts); ++i) { @@ -95,9 +95,9 @@ FWL_ERR CXFA_FWLTheme::Initialize() { ASSERT(NULL != m_pCalendarFont); FWLTHEME_Init(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } -FWL_ERR CXFA_FWLTheme::Finalize() { +FWL_Error CXFA_FWLTheme::Finalize() { if (m_pTextOut) { m_pTextOut->Release(); m_pTextOut = NULL; @@ -107,7 +107,7 @@ FWL_ERR CXFA_FWLTheme::Finalize() { m_pCalendarFont = NULL; } FWLTHEME_Release(); - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CXFA_FWLTheme::IsValidWidget(IFWL_Widget* pWidget) { return TRUE; @@ -124,14 +124,14 @@ FX_BOOL CXFA_FWLTheme::DrawBackground(CFWL_ThemeBackground* pParams) { return GetTheme(pParams->m_pWidget)->DrawBackground(pParams); } FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { - if (pParams->m_wsText.IsEmpty()) { - return FWL_ERR_Indefinite; - } + if (pParams->m_wsText.IsEmpty()) + return FALSE; + if (pParams->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); - if (!pWidget) { - return FWL_ERR_Indefinite; - } + if (!pWidget) + return FALSE; + m_pTextOut->SetStyles(pParams->m_dwTTOStyles); m_pTextOut->SetAlignment(pParams->m_iTTOAlign); m_pTextOut->SetFont(m_pCalendarFont); @@ -166,9 +166,9 @@ FX_BOOL CXFA_FWLTheme::DrawText(CFWL_ThemeText* pParams) { return TRUE; } CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); - if (!pWidget) { - return FWL_ERR_Indefinite; - } + if (!pWidget) + return FALSE; + CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); CFX_Graphics* pGraphics = pParams->m_pGraphics; CFX_RenderDevice* pRenderDevice = pGraphics->GetRenderDevice(); @@ -345,7 +345,7 @@ void* CXFA_FWLTheme::GetCapacity(CFWL_ThemePart* pThemePart, FX_BOOL CXFA_FWLTheme::IsCustomizedLayout(IFWL_Widget* pWidget) { return GetTheme(pWidget)->IsCustomizedLayout(pWidget); } -FWL_ERR CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart) { +FWL_Error CXFA_FWLTheme::GetPartRect(CFWL_ThemePart* pThemePart) { CFX_RectF rect; return GetTheme(pThemePart->m_pWidget)->GetPartRect(pThemePart, rect); } @@ -357,9 +357,8 @@ FX_BOOL CXFA_FWLTheme::IsInPart(CFWL_ThemePart* pThemePart, FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { if (pParams->m_pWidget->GetClassID() == FWL_CLASSHASH_MonthCalendar) { CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); - if (!pWidget) { - return FWL_ERR_Indefinite; - } + if (!pWidget) + return FALSE; if (!pParams) return FALSE; if (!m_pTextOut) @@ -374,9 +373,9 @@ FX_BOOL CXFA_FWLTheme::CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect) { return TRUE; } CXFA_FFWidget* pWidget = XFA_ThemeGetOuterWidget(pParams->m_pWidget); - if (!pWidget) { - return FWL_ERR_Indefinite; - } + if (!pWidget) + return FALSE; + CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); m_pTextOut->SetFont(pAcc->GetFDEFont()); m_pTextOut->SetFontSize(pAcc->GetFontSize()); diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index ae95637c8d..fa63085ba5 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -26,17 +26,17 @@ class CXFA_FWLTheme : public IFWL_ThemeProvider { public: CXFA_FWLTheme(CXFA_FFApp* pApp); virtual ~CXFA_FWLTheme(); - virtual FWL_ERR Release() { + virtual FWL_Error Release() { delete this; - return FWL_ERR_Succeeded; + return FWL_Error::Succeeded; } virtual IFWL_Widget* Retain() { return NULL; } - virtual FWL_ERR GetClassName(CFX_WideString& wsClass) const { - return FWL_ERR_Succeeded; + virtual FWL_Error GetClassName(CFX_WideString& wsClass) const { + return FWL_Error::Succeeded; } virtual uint32_t GetHashCode() const { return 0; } - virtual FWL_ERR Initialize(); - virtual FWL_ERR Finalize(); + virtual FWL_Error Initialize(); + virtual FWL_Error Finalize(); virtual FX_BOOL IsValidWidget(IFWL_Widget* pWidget); virtual uint32_t GetThemeID(IFWL_Widget* pWidget); virtual uint32_t SetThemeID(IFWL_Widget* pWidget, @@ -47,21 +47,21 @@ class CXFA_FWLTheme : public IFWL_ThemeProvider { virtual void* GetCapacity(CFWL_ThemePart* pThemePart, CFWL_WidgetCapacity dwCapacity); virtual FX_BOOL IsCustomizedLayout(IFWL_Widget* pWidget); - virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart); + virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart); virtual FX_BOOL IsInPart(CFWL_ThemePart* pThemePart, FX_FLOAT fx, FX_FLOAT fy); virtual FX_BOOL CalcTextRect(CFWL_ThemeText* pParams, CFX_RectF& rect); - virtual FWL_ERR GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { - return FWL_ERR_Succeeded; + virtual FWL_Error GetThemeMatrix(IFWL_Widget* pWidget, CFX_Matrix& matrix) { + return FWL_Error::Succeeded; } - virtual FWL_ERR SetThemeMatrix(IFWL_Widget* pWidget, - const CFX_Matrix& matrix) { - return FWL_ERR_Succeeded; + virtual FWL_Error SetThemeMatrix(IFWL_Widget* pWidget, + const CFX_Matrix& matrix) { + return FWL_Error::Succeeded; } - virtual FWL_ERR GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) { - return FWL_ERR_Succeeded; + virtual FWL_Error GetPartRect(CFWL_ThemePart* pThemePart, CFX_RectF& rtPart) { + return FWL_Error::Succeeded; } protected: diff --git a/xfa/fxgraphics/cagg_graphics.cpp b/xfa/fxgraphics/cagg_graphics.cpp index a4211810c4..564a2b14cc 100644 --- a/xfa/fxgraphics/cagg_graphics.cpp +++ b/xfa/fxgraphics/cagg_graphics.cpp @@ -8,21 +8,21 @@ CAGG_Graphics::CAGG_Graphics() : m_owner(nullptr) {} -FX_ERR CAGG_Graphics::Create(CFX_Graphics* owner, - int32_t width, - int32_t height, - FXDIB_Format format) { +FWL_Error CAGG_Graphics::Create(CFX_Graphics* owner, + int32_t width, + int32_t height, + FXDIB_Format format) { if (owner->m_renderDevice) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_owner) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_FxgeDevice* device = new CFX_FxgeDevice; device->Create(width, height, format); m_owner = owner; m_owner->m_renderDevice = device; m_owner->m_renderDevice->GetBitmap()->Clear(0xFFFFFFFF); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } CAGG_Graphics::~CAGG_Graphics() { diff --git a/xfa/fxgraphics/cagg_graphics.h b/xfa/fxgraphics/cagg_graphics.h index bac9c19167..5f53c73695 100644 --- a/xfa/fxgraphics/cagg_graphics.h +++ b/xfa/fxgraphics/cagg_graphics.h @@ -17,10 +17,10 @@ class CAGG_Graphics { CAGG_Graphics(); virtual ~CAGG_Graphics(); - FX_ERR Create(CFX_Graphics* owner, - int32_t width, - int32_t height, - FXDIB_Format format); + FWL_Error Create(CFX_Graphics* owner, + int32_t width, + int32_t height, + FXDIB_Format format); private: CFX_Graphics* m_owner; diff --git a/xfa/fxgraphics/cfx_color.cpp b/xfa/fxgraphics/cfx_color.cpp index 9cc9c14bbd..2044b76054 100644 --- a/xfa/fxgraphics/cfx_color.cpp +++ b/xfa/fxgraphics/cfx_color.cpp @@ -24,26 +24,26 @@ CFX_Color::~CFX_Color() { m_type = FX_COLOR_None; } -FX_ERR CFX_Color::Set(const FX_ARGB argb) { +FWL_Error CFX_Color::Set(const FX_ARGB argb) { m_type = FX_COLOR_Solid; m_info.argb = argb; m_info.pattern = nullptr; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Color::Set(CFX_Pattern* pattern, const FX_ARGB argb) { +FWL_Error CFX_Color::Set(CFX_Pattern* pattern, const FX_ARGB argb) { if (!pattern) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; m_type = FX_COLOR_Pattern; m_info.argb = argb; m_info.pattern = pattern; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Color::Set(CFX_Shading* shading) { +FWL_Error CFX_Color::Set(CFX_Shading* shading) { if (!shading) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; m_type = FX_COLOR_Shading; m_shading = shading; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } diff --git a/xfa/fxgraphics/cfx_color.h b/xfa/fxgraphics/cfx_color.h index 3f6684dc63..bf61c6859a 100644 --- a/xfa/fxgraphics/cfx_color.h +++ b/xfa/fxgraphics/cfx_color.h @@ -25,9 +25,9 @@ class CFX_Color { explicit CFX_Color(CFX_Shading* shading); virtual ~CFX_Color(); - FX_ERR Set(const FX_ARGB argb); - FX_ERR Set(CFX_Pattern* pattern, const FX_ARGB argb = 0x0); - FX_ERR Set(CFX_Shading* shading); + FWL_Error Set(const FX_ARGB argb); + FWL_Error Set(CFX_Pattern* pattern, const FX_ARGB argb = 0x0); + FWL_Error Set(CFX_Shading* shading); private: friend class CFX_Graphics; diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp index fd85714254..179e470e90 100644 --- a/xfa/fxgraphics/cfx_graphics.cpp +++ b/xfa/fxgraphics/cfx_graphics.cpp @@ -570,28 +570,28 @@ CFX_Graphics::CFX_Graphics() m_renderDevice(nullptr), m_aggGraphics(nullptr) {} -FX_ERR CFX_Graphics::Create(CFX_RenderDevice* renderDevice, - FX_BOOL isAntialiasing) { +FWL_Error CFX_Graphics::Create(CFX_RenderDevice* renderDevice, + FX_BOOL isAntialiasing) { if (!renderDevice) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type != FX_CONTEXT_None) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_type = FX_CONTEXT_Device; m_info.isAntialiasing = isAntialiasing; m_renderDevice = renderDevice; if (m_renderDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_SOFT_CLIP) - return FX_ERR_Succeeded; - return FX_ERR_Indefinite; + return FWL_Error::Succeeded; + return FWL_Error::Indefinite; } -FX_ERR CFX_Graphics::Create(int32_t width, - int32_t height, - FXDIB_Format format, - FX_BOOL isNative, - FX_BOOL isAntialiasing) { +FWL_Error CFX_Graphics::Create(int32_t width, + int32_t height, + FXDIB_Format format, + FX_BOOL isNative, + FX_BOOL isAntialiasing) { if (m_type != FX_CONTEXT_None) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_type = FX_CONTEXT_Device; m_info.isAntialiasing = isAntialiasing; @@ -603,99 +603,100 @@ CFX_Graphics::~CFX_Graphics() { delete m_aggGraphics; } -FX_ERR CFX_Graphics::GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal) { +FWL_Error CFX_Graphics::GetDeviceCap(const int32_t capID, + FX_DeviceCap& capVal) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { capVal = m_renderDevice->GetDeviceCaps(capID); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::IsPrinterDevice(FX_BOOL& isPrinter) { +FWL_Error CFX_Graphics::IsPrinterDevice(FX_BOOL& isPrinter) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { isPrinter = m_renderDevice->GetDeviceClass() == FXDC_PRINTER; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::EnableAntialiasing(FX_BOOL isAntialiasing) { +FWL_Error CFX_Graphics::EnableAntialiasing(FX_BOOL isAntialiasing) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.isAntialiasing = isAntialiasing; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SaveGraphState() { +FWL_Error CFX_Graphics::SaveGraphState() { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_renderDevice->SaveState(); m_infoStack.Add(new TInfo(m_info)); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::RestoreGraphState() { +FWL_Error CFX_Graphics::RestoreGraphState() { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_renderDevice->RestoreState(); int32_t size = m_infoStack.GetSize(); if (size <= 0) { - return FX_ERR_Intermediate_Value_Invalid; + return FWL_Error::IntermediateValueInvalid; } int32_t topIndex = size - 1; std::unique_ptr<TInfo> info(m_infoStack.GetAt(topIndex)); if (!info) - return FX_ERR_Intermediate_Value_Invalid; + return FWL_Error::IntermediateValueInvalid; m_info = *info; m_infoStack.RemoveAt(topIndex); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::GetLineCap(CFX_GraphStateData::LineCap& lineCap) const { +FWL_Error CFX_Graphics::GetLineCap(CFX_GraphStateData::LineCap& lineCap) const { if (m_type == FX_CONTEXT_Device && m_renderDevice) { lineCap = m_info.graphState.m_LineCap; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetLineCap(CFX_GraphStateData::LineCap lineCap) { +FWL_Error CFX_Graphics::SetLineCap(CFX_GraphStateData::LineCap lineCap) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.graphState.m_LineCap = lineCap; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::GetDashCount(int32_t& dashCount) const { +FWL_Error CFX_Graphics::GetDashCount(int32_t& dashCount) const { if (m_type == FX_CONTEXT_Device && m_renderDevice) { dashCount = m_info.graphState.m_DashCount; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::GetLineDash(FX_FLOAT& dashPhase, - FX_FLOAT* dashArray) const { +FWL_Error CFX_Graphics::GetLineDash(FX_FLOAT& dashPhase, + FX_FLOAT* dashArray) const { if (!dashArray) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) { dashPhase = m_info.graphState.m_DashPhase; FXSYS_memcpy(dashArray, m_info.graphState.m_DashArray, m_info.graphState.m_DashCount * sizeof(FX_FLOAT)); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetLineDash(FX_FLOAT dashPhase, - FX_FLOAT* dashArray, - int32_t dashCount) { +FWL_Error CFX_Graphics::SetLineDash(FX_FLOAT dashPhase, + FX_FLOAT* dashArray, + int32_t dashCount) { if (dashCount > 0 && !dashArray) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; dashCount = dashCount < 0 ? 0 : dashCount; if (m_type == FX_CONTEXT_Device && m_renderDevice) { @@ -708,164 +709,165 @@ FX_ERR CFX_Graphics::SetLineDash(FX_FLOAT dashPhase, for (int32_t i = 0; i < dashCount; i++) { m_info.graphState.m_DashArray[i] = dashArray[i] * scale; } - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetLineDash(FX_DashStyle dashStyle) { +FWL_Error CFX_Graphics::SetLineDash(FX_DashStyle dashStyle) { if (m_type == FX_CONTEXT_Device && m_renderDevice) return RenderDeviceSetLineDash(dashStyle); - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::GetLineJoin(CFX_GraphStateData::LineJoin& lineJoin) const { +FWL_Error CFX_Graphics::GetLineJoin( + CFX_GraphStateData::LineJoin& lineJoin) const { if (m_type == FX_CONTEXT_Device && m_renderDevice) { lineJoin = m_info.graphState.m_LineJoin; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetLineJoin(CFX_GraphStateData::LineJoin lineJoin) { +FWL_Error CFX_Graphics::SetLineJoin(CFX_GraphStateData::LineJoin lineJoin) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.graphState.m_LineJoin = lineJoin; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::GetMiterLimit(FX_FLOAT& miterLimit) const { +FWL_Error CFX_Graphics::GetMiterLimit(FX_FLOAT& miterLimit) const { if (m_type == FX_CONTEXT_Device && m_renderDevice) { miterLimit = m_info.graphState.m_MiterLimit; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetMiterLimit(FX_FLOAT miterLimit) { +FWL_Error CFX_Graphics::SetMiterLimit(FX_FLOAT miterLimit) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.graphState.m_MiterLimit = miterLimit; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::GetLineWidth(FX_FLOAT& lineWidth) const { +FWL_Error CFX_Graphics::GetLineWidth(FX_FLOAT& lineWidth) const { if (m_type == FX_CONTEXT_Device && m_renderDevice) { lineWidth = m_info.graphState.m_LineWidth; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash) { +FWL_Error CFX_Graphics::SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.graphState.m_LineWidth = lineWidth; m_info.isActOnDash = isActOnDash; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::GetStrokeAlignment( +FWL_Error CFX_Graphics::GetStrokeAlignment( FX_StrokeAlignment& strokeAlignment) const { if (m_type == FX_CONTEXT_Device && m_renderDevice) { strokeAlignment = m_info.strokeAlignment; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetStrokeAlignment(FX_StrokeAlignment strokeAlignment) { +FWL_Error CFX_Graphics::SetStrokeAlignment(FX_StrokeAlignment strokeAlignment) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.strokeAlignment = strokeAlignment; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetStrokeColor(CFX_Color* color) { +FWL_Error CFX_Graphics::SetStrokeColor(CFX_Color* color) { if (!color) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.strokeColor = color; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetFillColor(CFX_Color* color) { +FWL_Error CFX_Graphics::SetFillColor(CFX_Color* color) { if (!color) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.fillColor = color; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::StrokePath(CFX_Path* path, CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::StrokePath(CFX_Path* path, CFX_Matrix* matrix) { if (!path) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) return RenderDeviceStrokePath(path, matrix); - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::FillPath(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::FillPath(CFX_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { if (!path) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) return RenderDeviceFillPath(path, fillMode, matrix); - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::ClipPath(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::ClipPath(CFX_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { if (!path) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) { FX_BOOL result = m_renderDevice->SetClip_PathFill( path->GetPathData(), (CFX_Matrix*)matrix, fillMode); if (!result) - return FX_ERR_Indefinite; - return FX_ERR_Succeeded; + return FWL_Error::Indefinite; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::DrawImage(CFX_DIBSource* source, - const CFX_PointF& point, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::DrawImage(CFX_DIBSource* source, + const CFX_PointF& point, + CFX_Matrix* matrix) { if (!source) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) return RenderDeviceDrawImage(source, point, matrix); - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::StretchImage(CFX_DIBSource* source, - const CFX_RectF& rect, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::StretchImage(CFX_DIBSource* source, + const CFX_RectF& rect, + CFX_Matrix* matrix) { if (!source) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) return RenderDeviceStretchImage(source, rect, matrix); - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::ConcatMatrix(const CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::ConcatMatrix(const CFX_Matrix* matrix) { if (!matrix) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.CTM.Concat(*matrix); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } CFX_Matrix* CFX_Graphics::GetMatrix() { @@ -874,88 +876,88 @@ CFX_Matrix* CFX_Graphics::GetMatrix() { return nullptr; } -FX_ERR CFX_Graphics::GetClipRect(CFX_RectF& rect) const { +FWL_Error CFX_Graphics::GetClipRect(CFX_RectF& rect) const { if (m_type == FX_CONTEXT_Device && m_renderDevice) { FX_RECT r = m_renderDevice->GetClipBox(); rect.left = (FX_FLOAT)r.left; rect.top = (FX_FLOAT)r.top; rect.width = (FX_FLOAT)r.Width(); rect.height = (FX_FLOAT)r.Height(); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetClipRect(const CFX_RectF& rect) { +FWL_Error CFX_Graphics::SetClipRect(const CFX_RectF& rect) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { if (!m_renderDevice->SetClip_Rect( FX_RECT(FXSYS_round(rect.left), FXSYS_round(rect.top), FXSYS_round(rect.right()), FXSYS_round(rect.bottom())))) { - return FX_ERR_Method_Not_Supported; + return FWL_Error::MethodNotSupported; } - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::ClearClip() { +FWL_Error CFX_Graphics::ClearClip() { if (m_type == FX_CONTEXT_Device && m_renderDevice) - return FX_ERR_Succeeded; - return FX_ERR_Property_Invalid; + return FWL_Error::Succeeded; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetFont(CFX_Font* font) { +FWL_Error CFX_Graphics::SetFont(CFX_Font* font) { if (!font) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.font = font; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetFontSize(const FX_FLOAT size) { +FWL_Error CFX_Graphics::SetFontSize(const FX_FLOAT size) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.fontSize = size <= 0 ? 1.0f : size; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetFontHScale(const FX_FLOAT scale) { +FWL_Error CFX_Graphics::SetFontHScale(const FX_FLOAT scale) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.fontHScale = scale <= 0 ? 1.0f : scale; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetCharSpacing(const FX_FLOAT spacing) { +FWL_Error CFX_Graphics::SetCharSpacing(const FX_FLOAT spacing) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { m_info.fontSpacing = spacing < 0 ? 0 : spacing; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetTextDrawingMode(const int32_t mode) { +FWL_Error CFX_Graphics::SetTextDrawingMode(const int32_t mode) { if (m_type == FX_CONTEXT_Device && m_renderDevice) - return FX_ERR_Succeeded; - return FX_ERR_Property_Invalid; + return FWL_Error::Succeeded; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::ShowText(const CFX_PointF& point, - const CFX_WideString& text, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::ShowText(const CFX_PointF& point, + const CFX_WideString& text, + CFX_Matrix* matrix) { if (m_type == FX_CONTEXT_Device && m_renderDevice) return RenderDeviceShowText(point, text, matrix); - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::CalcTextRect(CFX_RectF& rect, - const CFX_WideString& text, - FX_BOOL isMultiline, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::CalcTextRect(CFX_RectF& rect, + const CFX_WideString& text, + FX_BOOL isMultiline, + CFX_Matrix* matrix) { if (m_type == FX_CONTEXT_Device && m_renderDevice) { int32_t length = text.GetLength(); uint32_t* charCodes = FX_Alloc(uint32_t, length); @@ -963,15 +965,15 @@ FX_ERR CFX_Graphics::CalcTextRect(CFX_RectF& rect, CalcTextInfo(text, charCodes, charPos, rect); FX_Free(charPos); FX_Free(charCodes); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::Transfer(CFX_Graphics* graphics, - const CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::Transfer(CFX_Graphics* graphics, + const CFX_Matrix* matrix) { if (!graphics || !graphics->m_renderDevice) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; CFX_Matrix m; m.Set(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, m_info.CTM.f); @@ -982,19 +984,19 @@ FX_ERR CFX_Graphics::Transfer(CFX_Graphics* graphics, CFX_DIBitmap* bitmap = graphics->m_renderDevice->GetBitmap(); FX_BOOL result = m_renderDevice->SetDIBits(bitmap, 0, 0); if (!result) - return FX_ERR_Method_Not_Supported; - return FX_ERR_Succeeded; + return FWL_Error::MethodNotSupported; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::Transfer(CFX_Graphics* graphics, - FX_FLOAT srcLeft, - FX_FLOAT srcTop, - const CFX_RectF& dstRect, - const CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::Transfer(CFX_Graphics* graphics, + FX_FLOAT srcLeft, + FX_FLOAT srcTop, + const CFX_RectF& dstRect, + const CFX_Matrix* matrix) { if (!graphics || !graphics->m_renderDevice) - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; CFX_Matrix m; m.Set(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, m_info.CTM.f); @@ -1007,37 +1009,37 @@ FX_ERR CFX_Graphics::Transfer(CFX_Graphics* graphics, bmp.Create((int32_t)dstRect.width, (int32_t)dstRect.height, graphics->m_renderDevice->GetBitmap()->GetFormat()); if (!result) - return FX_ERR_Intermediate_Value_Invalid; + return FWL_Error::IntermediateValueInvalid; result = graphics->m_renderDevice->GetDIBits(&bmp, (int32_t)srcLeft, (int32_t)srcTop); if (!result) - return FX_ERR_Method_Not_Supported; + return FWL_Error::MethodNotSupported; result = m_renderDevice->SetDIBits(&bmp, (int32_t)dstRect.left, (int32_t)dstRect.top); if (!result) - return FX_ERR_Method_Not_Supported; - return FX_ERR_Succeeded; + return FWL_Error::MethodNotSupported; + return FWL_Error::Succeeded; } - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } CFX_RenderDevice* CFX_Graphics::GetRenderDevice() { return m_renderDevice; } -FX_ERR CFX_Graphics::InverseRect(const CFX_RectF& rect) { +FWL_Error CFX_Graphics::InverseRect(const CFX_RectF& rect) { if (!m_renderDevice) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap(); if (!bitmap) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_RectF temp(rect); m_info.CTM.TransformRect(temp); CFX_RectF r; r.Set(0, 0, (FX_FLOAT)bitmap->GetWidth(), (FX_FLOAT)bitmap->GetWidth()); r.Intersect(temp); if (r.IsEmpty()) { - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; } FX_ARGB* pBuf = (FX_ARGB*)(bitmap->GetBuffer() + int32_t(r.top) * bitmap->GetPitch()); @@ -1051,23 +1053,23 @@ FX_ERR CFX_Graphics::InverseRect(const CFX_RectF& rect) { } pBuf = (FX_ARGB*)((uint8_t*)pBuf + bitmap->GetPitch()); } - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Graphics::XorDIBitmap(const CFX_DIBitmap* srcBitmap, - const CFX_RectF& rect) { +FWL_Error CFX_Graphics::XorDIBitmap(const CFX_DIBitmap* srcBitmap, + const CFX_RectF& rect) { if (!m_renderDevice) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_DIBitmap* dst = m_renderDevice->GetBitmap(); if (!dst) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_RectF temp(rect); m_info.CTM.TransformRect(temp); CFX_RectF r; r.Set(0, 0, (FX_FLOAT)dst->GetWidth(), (FX_FLOAT)dst->GetWidth()); r.Intersect(temp); if (r.IsEmpty()) { - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; } FX_ARGB* pSrcBuf = (FX_ARGB*)(srcBitmap->GetBuffer() + int32_t(r.top) * srcBitmap->GetPitch()); @@ -1087,23 +1089,23 @@ FX_ERR CFX_Graphics::XorDIBitmap(const CFX_DIBitmap* srcBitmap, pSrcBuf = (FX_ARGB*)((uint8_t*)pSrcBuf + srcBitmap->GetPitch()); pDstBuf = (FX_ARGB*)((uint8_t*)pDstBuf + dst->GetPitch()); } - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Graphics::EqvDIBitmap(const CFX_DIBitmap* srcBitmap, - const CFX_RectF& rect) { +FWL_Error CFX_Graphics::EqvDIBitmap(const CFX_DIBitmap* srcBitmap, + const CFX_RectF& rect) { if (!m_renderDevice) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_DIBitmap* dst = m_renderDevice->GetBitmap(); if (!dst) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_RectF temp(rect); m_info.CTM.TransformRect(temp); CFX_RectF r; r.Set(0, 0, (FX_FLOAT)dst->GetWidth(), (FX_FLOAT)dst->GetWidth()); r.Intersect(temp); if (r.IsEmpty()) { - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; } FX_ARGB* pSrcBuf = (FX_ARGB*)(srcBitmap->GetBuffer() + int32_t(r.top) * srcBitmap->GetPitch()); @@ -1123,44 +1125,44 @@ FX_ERR CFX_Graphics::EqvDIBitmap(const CFX_DIBitmap* srcBitmap, pSrcBuf = (FX_ARGB*)((uint8_t*)pSrcBuf + srcBitmap->GetPitch()); pDstBuf = (FX_ARGB*)((uint8_t*)pDstBuf + dst->GetPitch()); } - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) { +FWL_Error CFX_Graphics::RenderDeviceSetLineDash(FX_DashStyle dashStyle) { switch (dashStyle) { case FX_DASHSTYLE_Solid: { m_info.graphState.SetDashCount(0); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } case FX_DASHSTYLE_Dash: { FX_FLOAT dashArray[] = {3, 1}; SetLineDash(0, dashArray, 2); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } case FX_DASHSTYLE_Dot: { FX_FLOAT dashArray[] = {1, 1}; SetLineDash(0, dashArray, 2); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } case FX_DASHSTYLE_DashDot: { FX_FLOAT dashArray[] = {3, 1, 1, 1}; SetLineDash(0, dashArray, 4); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } case FX_DASHSTYLE_DashDotDot: { FX_FLOAT dashArray[] = {4, 1, 2, 1, 2, 1}; SetLineDash(0, dashArray, 6); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } default: - return FX_ERR_Parameter_Invalid; + return FWL_Error::ParameterInvalid; } } -FX_ERR CFX_Graphics::RenderDeviceStrokePath(CFX_Path* path, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::RenderDeviceStrokePath(CFX_Path* path, + CFX_Matrix* matrix) { if (!m_info.strokeColor) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_Matrix m; m.Set(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, m_info.CTM.f); @@ -1173,23 +1175,23 @@ FX_ERR CFX_Graphics::RenderDeviceStrokePath(CFX_Path* path, path->GetPathData(), (CFX_Matrix*)&m, &m_info.graphState, 0x0, m_info.strokeColor->m_info.argb, 0); if (!result) - return FX_ERR_Indefinite; - return FX_ERR_Succeeded; + return FWL_Error::Indefinite; + return FWL_Error::Succeeded; } case FX_COLOR_Pattern: return StrokePathWithPattern(path, &m); case FX_COLOR_Shading: return StrokePathWithShading(path, &m); default: - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } } -FX_ERR CFX_Graphics::RenderDeviceFillPath(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::RenderDeviceFillPath(CFX_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { if (!m_info.fillColor) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; CFX_Matrix m; m.Set(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, m_info.CTM.f); @@ -1202,21 +1204,21 @@ FX_ERR CFX_Graphics::RenderDeviceFillPath(CFX_Path* path, path->GetPathData(), (CFX_Matrix*)&m, &m_info.graphState, m_info.fillColor->m_info.argb, 0x0, fillMode); if (!result) - return FX_ERR_Indefinite; - return FX_ERR_Succeeded; + return FWL_Error::Indefinite; + return FWL_Error::Succeeded; } case FX_COLOR_Pattern: return FillPathWithPattern(path, fillMode, &m); case FX_COLOR_Shading: return FillPathWithShading(path, fillMode, &m); default: - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; } } -FX_ERR CFX_Graphics::RenderDeviceDrawImage(CFX_DIBSource* source, - const CFX_PointF& point, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::RenderDeviceDrawImage(CFX_DIBSource* source, + const CFX_PointF& point, + CFX_Matrix* matrix) { CFX_Matrix m1; m1.Set(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, m_info.CTM.f); @@ -1242,14 +1244,14 @@ FX_ERR CFX_Graphics::RenderDeviceDrawImage(CFX_DIBSource* source, bmp2.get(), FXSYS_round(r.left - left), FXSYS_round(r.top - top)) && m_renderDevice->SetDIBits(&bmp, 0, 0)) { - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Indefinite; + return FWL_Error::Indefinite; } -FX_ERR CFX_Graphics::RenderDeviceStretchImage(CFX_DIBSource* source, - const CFX_RectF& rect, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::RenderDeviceStretchImage(CFX_DIBSource* source, + const CFX_RectF& rect, + CFX_Matrix* matrix) { CFX_Matrix m1; m1.Set(m_info.CTM.a, m_info.CTM.b, m_info.CTM.c, m_info.CTM.d, m_info.CTM.e, m_info.CTM.f); @@ -1272,14 +1274,14 @@ FX_ERR CFX_Graphics::RenderDeviceStretchImage(CFX_DIBSource* source, FXSYS_round(r.Width()), FXSYS_round(r.Height()), bmp3.get(), FXSYS_round(r.left - left), FXSYS_round(r.top - top))) { - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } - return FX_ERR_Indefinite; + return FWL_Error::Indefinite; } -FX_ERR CFX_Graphics::RenderDeviceShowText(const CFX_PointF& point, - const CFX_WideString& text, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::RenderDeviceShowText(const CFX_PointF& point, + const CFX_WideString& text, + CFX_Matrix* matrix) { int32_t length = text.GetLength(); uint32_t* charCodes = FX_Alloc(uint32_t, length); FXTEXT_CHARPOS* charPos = FX_Alloc(FXTEXT_CHARPOS, length); @@ -1298,23 +1300,25 @@ FX_ERR CFX_Graphics::RenderDeviceShowText(const CFX_PointF& point, -m_info.fontSize * m_info.fontHScale, (CFX_Matrix*)&m, m_info.fillColor->m_info.argb, FXTEXT_CLEARTYPE); if (!result) - return FX_ERR_Indefinite; + return FWL_Error::Indefinite; FX_Free(charPos); FX_Free(charCodes); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Graphics::StrokePathWithPattern(CFX_Path* path, CFX_Matrix* matrix) { - return FX_ERR_Method_Not_Supported; +FWL_Error CFX_Graphics::StrokePathWithPattern(CFX_Path* path, + CFX_Matrix* matrix) { + return FWL_Error::MethodNotSupported; } -FX_ERR CFX_Graphics::StrokePathWithShading(CFX_Path* path, CFX_Matrix* matrix) { - return FX_ERR_Method_Not_Supported; +FWL_Error CFX_Graphics::StrokePathWithShading(CFX_Path* path, + CFX_Matrix* matrix) { + return FWL_Error::MethodNotSupported; } -FX_ERR CFX_Graphics::FillPathWithPattern(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::FillPathWithPattern(CFX_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { CFX_Pattern* pattern = m_info.fillColor->m_info.pattern; CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap(); int32_t width = bitmap->GetWidth(); @@ -1326,7 +1330,7 @@ FX_ERR CFX_Graphics::FillPathWithPattern(CFX_Path* path, FX_HatchStyle hatchStyle = m_info.fillColor->m_info.pattern->m_hatchStyle; if (hatchStyle < FX_HATCHSTYLE_Horizontal || hatchStyle > FX_HATCHSTYLE_SolidDiamond) { - return FX_ERR_Intermediate_Value_Invalid; + return FWL_Error::IntermediateValueInvalid; } const FX_HATCHDATA& data = hatchBitmapData[hatchStyle]; CFX_DIBitmap mask; @@ -1353,12 +1357,12 @@ FX_ERR CFX_Graphics::FillPathWithPattern(CFX_Path* path, fillMode); SetDIBitsWithMatrix(&bmp, &pattern->m_matrix); m_renderDevice->RestoreState(); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Graphics::FillPathWithShading(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::FillPathWithShading(CFX_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix) { CFX_DIBitmap* bitmap = m_renderDevice->GetBitmap(); int32_t width = bitmap->GetWidth(); int32_t height = bitmap->GetHeight(); @@ -1370,7 +1374,7 @@ FX_ERR CFX_Graphics::FillPathWithShading(CFX_Path* path, bmp.Create(width, height, FXDIB_Argb); m_renderDevice->GetDIBits(&bmp, 0, 0); int32_t pitch = bmp.GetPitch(); - FX_BOOL result = FALSE; + bool result = false; switch (m_info.fillColor->m_shading->m_type) { case FX_SHADING_Axial: { FX_FLOAT x_span = end_x - start_x; @@ -1399,7 +1403,7 @@ FX_ERR CFX_Graphics::FillPathWithShading(CFX_Path* path, dib_buf[column] = m_info.fillColor->m_shading->m_argbArray[index]; } } - result = TRUE; + result = true; break; } case FX_SHADING_Radial: { @@ -1460,10 +1464,13 @@ FX_ERR CFX_Graphics::FillPathWithShading(CFX_Path* path, dib_buf[column] = m_info.fillColor->m_shading->m_argbArray[index]; } } - result = TRUE; + result = true; + break; + } + default: { + result = false; break; } - default: { result = FALSE; } } if (result) { m_renderDevice->SaveState(); @@ -1472,11 +1479,11 @@ FX_ERR CFX_Graphics::FillPathWithShading(CFX_Path* path, SetDIBitsWithMatrix(&bmp, matrix); m_renderDevice->RestoreState(); } - return result; + return result ? FWL_Error::Succeeded : FWL_Error::PropertyInvalid; } -FX_ERR CFX_Graphics::SetDIBitsWithMatrix(CFX_DIBSource* source, - CFX_Matrix* matrix) { +FWL_Error CFX_Graphics::SetDIBitsWithMatrix(CFX_DIBSource* source, + CFX_Matrix* matrix) { if (matrix->IsIdentity()) { m_renderDevice->SetDIBits(source, 0, 0); } else { @@ -1490,13 +1497,13 @@ FX_ERR CFX_Graphics::SetDIBitsWithMatrix(CFX_DIBSource* source, bmp1->TransformTo((CFX_Matrix*)&m, left, top)); m_renderDevice->SetDIBits(bmp2.get(), left, top); } - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Graphics::CalcTextInfo(const CFX_WideString& text, - uint32_t* charCodes, - FXTEXT_CHARPOS* charPos, - CFX_RectF& rect) { +FWL_Error CFX_Graphics::CalcTextInfo(const CFX_WideString& text, + uint32_t* charCodes, + FXTEXT_CHARPOS* charPos, + CFX_RectF& rect) { std::unique_ptr<CFX_UnicodeEncoding> encoding( new CFX_UnicodeEncoding(m_info.font)); int32_t length = text.GetLength(); @@ -1535,7 +1542,7 @@ FX_ERR CFX_Graphics::CalcTextInfo(const CFX_WideString& text, } rect.width = (FX_FLOAT)penX - rect.left; rect.height = rect.top + m_info.fontSize * m_info.fontHScale - rect.top; - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_Graphics::TInfo::TInfo(const TInfo& info) diff --git a/xfa/fxgraphics/cfx_path.cpp b/xfa/fxgraphics/cfx_path.cpp index 2acdc3eac2..fe956d3fcc 100644 --- a/xfa/fxgraphics/cfx_path.cpp +++ b/xfa/fxgraphics/cfx_path.cpp @@ -12,163 +12,165 @@ CFX_Path::CFX_Path() { m_generator = nullptr; } -FX_ERR CFX_Path::Create() { +FWL_Error CFX_Path::Create() { if (m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator = new CFX_PathGenerator; m_generator->Create(); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } CFX_Path::~CFX_Path() { delete m_generator; } -FX_ERR CFX_Path::MoveTo(FX_FLOAT x, FX_FLOAT y) { +FWL_Error CFX_Path::MoveTo(FX_FLOAT x, FX_FLOAT y) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->MoveTo(x, y); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::LineTo(FX_FLOAT x, FX_FLOAT y) { +FWL_Error CFX_Path::LineTo(FX_FLOAT x, FX_FLOAT y) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->LineTo(x, y); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::BezierTo(FX_FLOAT ctrlX1, - FX_FLOAT ctrlY1, - FX_FLOAT ctrlX2, - FX_FLOAT ctrlY2, - FX_FLOAT toX, - FX_FLOAT toY) { +FWL_Error CFX_Path::BezierTo(FX_FLOAT ctrlX1, + FX_FLOAT ctrlY1, + FX_FLOAT ctrlX2, + FX_FLOAT ctrlY2, + FX_FLOAT toX, + FX_FLOAT toY) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->BezierTo(ctrlX1, ctrlY1, ctrlX2, ctrlY2, toX, toY); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::ArcTo(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle) { +FWL_Error CFX_Path::ArcTo(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height, + FX_FLOAT startAngle, + FX_FLOAT sweepAngle) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->ArcTo(left + width / 2, top + height / 2, width / 2, height / 2, startAngle, sweepAngle); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::Close() { +FWL_Error CFX_Path::Close() { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->Close(); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::AddLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2) { +FWL_Error CFX_Path::AddLine(FX_FLOAT x1, + FX_FLOAT y1, + FX_FLOAT x2, + FX_FLOAT y2) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->AddLine(x1, y1, x2, y2); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::AddBezier(FX_FLOAT startX, - FX_FLOAT startY, - FX_FLOAT ctrlX1, - FX_FLOAT ctrlY1, - FX_FLOAT ctrlX2, - FX_FLOAT ctrlY2, - FX_FLOAT endX, - FX_FLOAT endY) { +FWL_Error CFX_Path::AddBezier(FX_FLOAT startX, + FX_FLOAT startY, + FX_FLOAT ctrlX1, + FX_FLOAT ctrlY1, + FX_FLOAT ctrlX2, + FX_FLOAT ctrlY2, + FX_FLOAT endX, + FX_FLOAT endY) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->AddBezier(startX, startY, ctrlX1, ctrlY1, ctrlX2, ctrlY2, endX, endY); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::AddRectangle(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height) { +FWL_Error CFX_Path::AddRectangle(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->AddRectangle(left, top, left + width, top + height); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::AddEllipse(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height) { +FWL_Error CFX_Path::AddEllipse(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->AddEllipse(left + width / 2, top + height / 2, width / 2, height / 2); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::AddEllipse(const CFX_RectF& rect) { +FWL_Error CFX_Path::AddEllipse(const CFX_RectF& rect) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->AddEllipse(rect.left + rect.Width() / 2, rect.top + rect.Height() / 2, rect.Width() / 2, rect.Height() / 2); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::AddArc(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle) { +FWL_Error CFX_Path::AddArc(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height, + FX_FLOAT startAngle, + FX_FLOAT sweepAngle) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->AddArc(left + width / 2, top + height / 2, width / 2, height / 2, startAngle, sweepAngle); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::AddPie(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle) { +FWL_Error CFX_Path::AddPie(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height, + FX_FLOAT startAngle, + FX_FLOAT sweepAngle) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->AddPie(left + width / 2, top + height / 2, width / 2, height / 2, startAngle, sweepAngle); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::AddSubpath(CFX_Path* path) { +FWL_Error CFX_Path::AddSubpath(CFX_Path* path) { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->AddPathData(path->GetPathData()); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } -FX_ERR CFX_Path::Clear() { +FWL_Error CFX_Path::Clear() { if (!m_generator) - return FX_ERR_Property_Invalid; + return FWL_Error::PropertyInvalid; m_generator->GetPathData()->SetPointCount(0); - return FX_ERR_Succeeded; + return FWL_Error::Succeeded; } FX_BOOL CFX_Path::IsEmpty() { if (!m_generator) - return FX_ERR_Property_Invalid; - if (m_generator->GetPathData()->GetPointCount() == 0) { + return FALSE; + if (m_generator->GetPathData()->GetPointCount() == 0) return TRUE; - } return FALSE; } diff --git a/xfa/fxgraphics/cfx_path.h b/xfa/fxgraphics/cfx_path.h index 5b5840fa0b..f42586f0de 100644 --- a/xfa/fxgraphics/cfx_path.h +++ b/xfa/fxgraphics/cfx_path.h @@ -18,55 +18,55 @@ class CFX_Path { CFX_Path(); virtual ~CFX_Path(); - FX_ERR Create(); - FX_ERR MoveTo(FX_FLOAT x, FX_FLOAT y); - FX_ERR LineTo(FX_FLOAT x, FX_FLOAT y); - FX_ERR BezierTo(FX_FLOAT ctrlX1, - FX_FLOAT ctrlY1, - FX_FLOAT ctrlX2, - FX_FLOAT ctrlY2, - FX_FLOAT toX, - FX_FLOAT toY); - FX_ERR ArcTo(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle); - FX_ERR Close(); + FWL_Error Create(); + FWL_Error MoveTo(FX_FLOAT x, FX_FLOAT y); + FWL_Error LineTo(FX_FLOAT x, FX_FLOAT y); + FWL_Error BezierTo(FX_FLOAT ctrlX1, + FX_FLOAT ctrlY1, + FX_FLOAT ctrlX2, + FX_FLOAT ctrlY2, + FX_FLOAT toX, + FX_FLOAT toY); + FWL_Error ArcTo(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height, + FX_FLOAT startAngle, + FX_FLOAT sweepAngle); + FWL_Error Close(); - FX_ERR AddLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); - FX_ERR AddBezier(FX_FLOAT startX, - FX_FLOAT startY, - FX_FLOAT ctrlX1, - FX_FLOAT ctrlY1, - FX_FLOAT ctrlX2, - FX_FLOAT ctrlY2, - FX_FLOAT endX, - FX_FLOAT endY); - FX_ERR AddRectangle(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height); - FX_ERR AddEllipse(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height); - FX_ERR AddEllipse(const CFX_RectF& rect); - FX_ERR AddArc(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle); - FX_ERR AddPie(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle); - FX_ERR AddSubpath(CFX_Path* path); - FX_ERR Clear(); + FWL_Error AddLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2, FX_FLOAT y2); + FWL_Error AddBezier(FX_FLOAT startX, + FX_FLOAT startY, + FX_FLOAT ctrlX1, + FX_FLOAT ctrlY1, + FX_FLOAT ctrlX2, + FX_FLOAT ctrlY2, + FX_FLOAT endX, + FX_FLOAT endY); + FWL_Error AddRectangle(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height); + FWL_Error AddEllipse(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height); + FWL_Error AddEllipse(const CFX_RectF& rect); + FWL_Error AddArc(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height, + FX_FLOAT startAngle, + FX_FLOAT sweepAngle); + FWL_Error AddPie(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height, + FX_FLOAT startAngle, + FX_FLOAT sweepAngle); + FWL_Error AddSubpath(CFX_Path* path); + FWL_Error Clear(); FX_BOOL IsEmpty(); CFX_PathData* GetPathData(); diff --git a/xfa/fxgraphics/include/cfx_graphics.h b/xfa/fxgraphics/include/cfx_graphics.h index 7f456270a5..3f969432ea 100644 --- a/xfa/fxgraphics/include/cfx_graphics.h +++ b/xfa/fxgraphics/include/cfx_graphics.h @@ -10,20 +10,12 @@ #include "core/fxcrt/include/fx_system.h" #include "core/fxge/include/fx_dib.h" #include "core/fxge/include/fx_ge.h" +#include "xfa/fwl/core/fwl_error.h" class CFX_Color; class CFX_Path; class CAGG_Graphics; -#define FX_ERR_Succeeded 0 -#define FX_ERR_Indefinite -1 -#define FX_ERR_Parameter_Invalid -100 -#define FX_ERR_Property_Invalid -200 -#define FX_ERR_Intermediate_Value_Invalid -300 -#define FX_ERR_Method_Not_Supported -400 -#define FX_ERR_Out_Of_Memory -500 - -using FX_ERR = int; using FX_DeviceCap = int32_t; using FX_FillMode = int32_t; @@ -106,81 +98,82 @@ class CFX_Graphics { CFX_Graphics(); virtual ~CFX_Graphics(); - FX_ERR Create(CFX_RenderDevice* renderDevice, FX_BOOL isAntialiasing = TRUE); - FX_ERR Create(int32_t width, - int32_t height, - FXDIB_Format format, - FX_BOOL isNative = TRUE, - FX_BOOL isAntialiasing = TRUE); - - FX_ERR GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal); - FX_ERR IsPrinterDevice(FX_BOOL& isPrinter); - FX_ERR EnableAntialiasing(FX_BOOL isAntialiasing); - - FX_ERR SaveGraphState(); - FX_ERR RestoreGraphState(); - - FX_ERR GetLineCap(CFX_GraphStateData::LineCap& lineCap) const; - FX_ERR GetDashCount(int32_t& dashCount) const; - FX_ERR GetLineDash(FX_FLOAT& dashPhase, FX_FLOAT* dashArray) const; - FX_ERR GetLineJoin(CFX_GraphStateData::LineJoin& lineJoin) const; - FX_ERR GetMiterLimit(FX_FLOAT& miterLimit) const; - FX_ERR GetLineWidth(FX_FLOAT& lineWidth) const; - FX_ERR GetStrokeAlignment(FX_StrokeAlignment& strokeAlignment) const; - FX_ERR GetClipRect(CFX_RectF& rect) const; + FWL_Error Create(CFX_RenderDevice* renderDevice, + FX_BOOL isAntialiasing = TRUE); + FWL_Error Create(int32_t width, + int32_t height, + FXDIB_Format format, + FX_BOOL isNative = TRUE, + FX_BOOL isAntialiasing = TRUE); + + FWL_Error GetDeviceCap(const int32_t capID, FX_DeviceCap& capVal); + FWL_Error IsPrinterDevice(FX_BOOL& isPrinter); + FWL_Error EnableAntialiasing(FX_BOOL isAntialiasing); + + FWL_Error SaveGraphState(); + FWL_Error RestoreGraphState(); + + FWL_Error GetLineCap(CFX_GraphStateData::LineCap& lineCap) const; + FWL_Error GetDashCount(int32_t& dashCount) const; + FWL_Error GetLineDash(FX_FLOAT& dashPhase, FX_FLOAT* dashArray) const; + FWL_Error GetLineJoin(CFX_GraphStateData::LineJoin& lineJoin) const; + FWL_Error GetMiterLimit(FX_FLOAT& miterLimit) const; + FWL_Error GetLineWidth(FX_FLOAT& lineWidth) const; + FWL_Error GetStrokeAlignment(FX_StrokeAlignment& strokeAlignment) const; + FWL_Error GetClipRect(CFX_RectF& rect) const; CFX_Matrix* GetMatrix(); CFX_RenderDevice* GetRenderDevice(); - FX_ERR SetLineCap(CFX_GraphStateData::LineCap lineCap); - FX_ERR SetLineDash(FX_FLOAT dashPhase, - FX_FLOAT* dashArray, - int32_t dashCount); - FX_ERR SetLineDash(FX_DashStyle dashStyle); - FX_ERR SetLineJoin(CFX_GraphStateData::LineJoin lineJoin); - FX_ERR SetMiterLimit(FX_FLOAT miterLimit); - FX_ERR SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash = FALSE); - FX_ERR SetStrokeAlignment(FX_StrokeAlignment strokeAlignment); - FX_ERR SetStrokeColor(CFX_Color* color); - FX_ERR SetFillColor(CFX_Color* color); - FX_ERR SetClipRect(const CFX_RectF& rect); - FX_ERR SetFont(CFX_Font* font); - FX_ERR SetFontSize(const FX_FLOAT size); - FX_ERR SetFontHScale(const FX_FLOAT scale); - FX_ERR SetCharSpacing(const FX_FLOAT spacing); - FX_ERR SetTextDrawingMode(const int32_t mode); - - FX_ERR StrokePath(CFX_Path* path, CFX_Matrix* matrix = NULL); - FX_ERR FillPath(CFX_Path* path, - FX_FillMode fillMode = FXFILL_WINDING, - CFX_Matrix* matrix = NULL); - FX_ERR ClipPath(CFX_Path* path, - FX_FillMode fillMode = FXFILL_WINDING, - CFX_Matrix* matrix = NULL); - FX_ERR DrawImage(CFX_DIBSource* source, - const CFX_PointF& point, - CFX_Matrix* matrix = NULL); - FX_ERR StretchImage(CFX_DIBSource* source, - const CFX_RectF& rect, - CFX_Matrix* matrix = NULL); - FX_ERR ConcatMatrix(const CFX_Matrix* matrix); - FX_ERR ClearClip(); - FX_ERR ShowText(const CFX_PointF& point, - const CFX_WideString& text, - CFX_Matrix* matrix = NULL); - FX_ERR CalcTextRect(CFX_RectF& rect, - const CFX_WideString& text, - FX_BOOL isMultiline = FALSE, + FWL_Error SetLineCap(CFX_GraphStateData::LineCap lineCap); + FWL_Error SetLineDash(FX_FLOAT dashPhase, + FX_FLOAT* dashArray, + int32_t dashCount); + FWL_Error SetLineDash(FX_DashStyle dashStyle); + FWL_Error SetLineJoin(CFX_GraphStateData::LineJoin lineJoin); + FWL_Error SetMiterLimit(FX_FLOAT miterLimit); + FWL_Error SetLineWidth(FX_FLOAT lineWidth, FX_BOOL isActOnDash = FALSE); + FWL_Error SetStrokeAlignment(FX_StrokeAlignment strokeAlignment); + FWL_Error SetStrokeColor(CFX_Color* color); + FWL_Error SetFillColor(CFX_Color* color); + FWL_Error SetClipRect(const CFX_RectF& rect); + FWL_Error SetFont(CFX_Font* font); + FWL_Error SetFontSize(const FX_FLOAT size); + FWL_Error SetFontHScale(const FX_FLOAT scale); + FWL_Error SetCharSpacing(const FX_FLOAT spacing); + FWL_Error SetTextDrawingMode(const int32_t mode); + + FWL_Error StrokePath(CFX_Path* path, CFX_Matrix* matrix = NULL); + FWL_Error FillPath(CFX_Path* path, + FX_FillMode fillMode = FXFILL_WINDING, + CFX_Matrix* matrix = NULL); + FWL_Error ClipPath(CFX_Path* path, + FX_FillMode fillMode = FXFILL_WINDING, + CFX_Matrix* matrix = NULL); + FWL_Error DrawImage(CFX_DIBSource* source, + const CFX_PointF& point, CFX_Matrix* matrix = NULL); - FX_ERR Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix); - FX_ERR Transfer(CFX_Graphics* graphics, - FX_FLOAT srcLeft, - FX_FLOAT srcTop, - const CFX_RectF& dstRect, - const CFX_Matrix* matrix); - - FX_ERR InverseRect(const CFX_RectF& rect); - FX_ERR XorDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); - FX_ERR EqvDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); + FWL_Error StretchImage(CFX_DIBSource* source, + const CFX_RectF& rect, + CFX_Matrix* matrix = NULL); + FWL_Error ConcatMatrix(const CFX_Matrix* matrix); + FWL_Error ClearClip(); + FWL_Error ShowText(const CFX_PointF& point, + const CFX_WideString& text, + CFX_Matrix* matrix = NULL); + FWL_Error CalcTextRect(CFX_RectF& rect, + const CFX_WideString& text, + FX_BOOL isMultiline = FALSE, + CFX_Matrix* matrix = NULL); + FWL_Error Transfer(CFX_Graphics* graphics, const CFX_Matrix* matrix); + FWL_Error Transfer(CFX_Graphics* graphics, + FX_FLOAT srcLeft, + FX_FLOAT srcTop, + const CFX_RectF& dstRect, + const CFX_Matrix* matrix); + + FWL_Error InverseRect(const CFX_RectF& rect); + FWL_Error XorDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); + FWL_Error EqvDIBitmap(const CFX_DIBitmap* srcBitmap, const CFX_RectF& rect); protected: int32_t m_type; @@ -213,36 +206,36 @@ class CFX_Graphics { FX_FLOAT fontSpacing; } m_info; - FX_ERR RenderDeviceSetLineDash(FX_DashStyle dashStyle); - FX_ERR RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix); - FX_ERR RenderDeviceFillPath(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix); - FX_ERR RenderDeviceDrawImage(CFX_DIBSource* source, - const CFX_PointF& point, - CFX_Matrix* matrix); - FX_ERR RenderDeviceStretchImage(CFX_DIBSource* source, - const CFX_RectF& rect, + FWL_Error RenderDeviceSetLineDash(FX_DashStyle dashStyle); + FWL_Error RenderDeviceStrokePath(CFX_Path* path, CFX_Matrix* matrix); + FWL_Error RenderDeviceFillPath(CFX_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix); + FWL_Error RenderDeviceDrawImage(CFX_DIBSource* source, + const CFX_PointF& point, CFX_Matrix* matrix); - FX_ERR RenderDeviceShowText(const CFX_PointF& point, - const CFX_WideString& text, - CFX_Matrix* matrix); - - FX_ERR StrokePathWithPattern(CFX_Path* path, CFX_Matrix* matrix); - FX_ERR StrokePathWithShading(CFX_Path* path, CFX_Matrix* matrix); - - FX_ERR FillPathWithPattern(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix); - FX_ERR FillPathWithShading(CFX_Path* path, - FX_FillMode fillMode, - CFX_Matrix* matrix); - - FX_ERR SetDIBitsWithMatrix(CFX_DIBSource* source, CFX_Matrix* matrix); - FX_ERR CalcTextInfo(const CFX_WideString& text, - uint32_t* charCodes, - FXTEXT_CHARPOS* charPos, - CFX_RectF& rect); + FWL_Error RenderDeviceStretchImage(CFX_DIBSource* source, + const CFX_RectF& rect, + CFX_Matrix* matrix); + FWL_Error RenderDeviceShowText(const CFX_PointF& point, + const CFX_WideString& text, + CFX_Matrix* matrix); + + FWL_Error StrokePathWithPattern(CFX_Path* path, CFX_Matrix* matrix); + FWL_Error StrokePathWithShading(CFX_Path* path, CFX_Matrix* matrix); + + FWL_Error FillPathWithPattern(CFX_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix); + FWL_Error FillPathWithShading(CFX_Path* path, + FX_FillMode fillMode, + CFX_Matrix* matrix); + + FWL_Error SetDIBitsWithMatrix(CFX_DIBSource* source, CFX_Matrix* matrix); + FWL_Error CalcTextInfo(const CFX_WideString& text, + uint32_t* charCodes, + FXTEXT_CHARPOS* charPos, + CFX_RectF& rect); CFX_RenderDevice* m_renderDevice; CFX_ArrayTemplate<TInfo*> m_infoStack; |