From b9eed2f50403e59c7aa414e272ae732d9bca0a7b Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 10 Jul 2017 11:35:18 -0400 Subject: Fix nits in CFFL_FormFiller MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleanup nits in CFFL_FormFiller. Split CFFL_Button into own files. Change-Id: I41fa7118a46aa1f495c15f90a4c4b77b309a10d3 Reviewed-on: https://pdfium-review.googlesource.com/7339 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- BUILD.gn | 2 + fpdfsdk/formfiller/cffl_button.cpp | 101 ++++++++++++++ fpdfsdk/formfiller/cffl_button.h | 56 ++++++++ fpdfsdk/formfiller/cffl_checkbox.h | 2 +- fpdfsdk/formfiller/cffl_formfiller.cpp | 244 +++++++++------------------------ fpdfsdk/formfiller/cffl_formfiller.h | 36 ----- fpdfsdk/formfiller/cffl_pushbutton.h | 2 +- fpdfsdk/formfiller/cffl_radiobutton.h | 2 +- fpdfsdk/pdfwindow/cpwl_color.h | 4 + 9 files changed, 234 insertions(+), 215 deletions(-) create mode 100644 fpdfsdk/formfiller/cffl_button.cpp create mode 100644 fpdfsdk/formfiller/cffl_button.h diff --git a/BUILD.gn b/BUILD.gn index 83bad1b13a..e99cc86841 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1196,6 +1196,8 @@ static_library("formfiller") { sources = [ "fpdfsdk/formfiller/cba_fontmap.cpp", "fpdfsdk/formfiller/cba_fontmap.h", + "fpdfsdk/formfiller/cffl_button.cpp", + "fpdfsdk/formfiller/cffl_button.h", "fpdfsdk/formfiller/cffl_checkbox.cpp", "fpdfsdk/formfiller/cffl_checkbox.h", "fpdfsdk/formfiller/cffl_combobox.cpp", diff --git a/fpdfsdk/formfiller/cffl_button.cpp b/fpdfsdk/formfiller/cffl_button.cpp new file mode 100644 index 0000000000..2a290ed213 --- /dev/null +++ b/fpdfsdk/formfiller/cffl_button.cpp @@ -0,0 +1,101 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "fpdfsdk/formfiller/cffl_button.h" + +CFFL_Button::CFFL_Button(CPDFSDK_FormFillEnvironment* pApp, + CPDFSDK_Widget* pWidget) + : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(false), m_bMouseDown(false) {} + +CFFL_Button::~CFFL_Button() {} + +void CFFL_Button::OnMouseEnter(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot) { + m_bMouseIn = true; + InvalidateRect(GetViewBBox(pPageView, pAnnot)); +} + +void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot) { + m_bMouseIn = false; + InvalidateRect(GetViewBBox(pPageView, pAnnot)); + EndTimer(); + ASSERT(m_pWidget); +} + +bool CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_PointF& point) { + if (!pAnnot->GetRect().Contains(point)) + return false; + + m_bMouseDown = true; + m_bValid = true; + InvalidateRect(GetViewBBox(pPageView, pAnnot)); + return true; +} + +bool CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_PointF& point) { + if (!pAnnot->GetRect().Contains(point)) + return false; + + m_bMouseDown = false; + m_pWidget->GetPDFPage(); + InvalidateRect(GetViewBBox(pPageView, pAnnot)); + return true; +} + +bool CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_PointF& point) { + return true; +} + +void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_RenderDevice* pDevice, + CFX_Matrix* pUser2Device) { + ASSERT(pPageView); + CPDFSDK_Widget* pWidget = static_cast(pAnnot); + CPDF_FormControl* pCtrl = pWidget->GetFormControl(); + if (pCtrl->GetHighlightingMode() != CPDF_FormControl::Push) { + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); + return; + } + if (m_bMouseDown) { + if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) { + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, nullptr); + } else { + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, + nullptr); + } + return; + } + if (m_bMouseIn) { + if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover)) { + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover, + nullptr); + } else { + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, + nullptr); + } + return; + } + + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); +} + +void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_RenderDevice* pDevice, + CFX_Matrix* pUser2Device) { + OnDraw(pPageView, pAnnot, pDevice, pUser2Device); +} diff --git a/fpdfsdk/formfiller/cffl_button.h b/fpdfsdk/formfiller/cffl_button.h new file mode 100644 index 0000000000..37c294dbf0 --- /dev/null +++ b/fpdfsdk/formfiller/cffl_button.h @@ -0,0 +1,56 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef FPDFSDK_FORMFILLER_CFFL_BUTTON_H_ +#define FPDFSDK_FORMFILLER_CFFL_BUTTON_H_ + +#include "core/fxcrt/fx_coordinates.h" +#include "fpdfsdk/formfiller/cffl_formfiller.h" + +class CFX_RenderDevice; +class CFX_Matrix; +class CPDFSDK_Annot; +class CPDFSDK_FormFillEnvironment; +class CPDFSDK_PageView; +class CPDFSDK_Widget; + +class CFFL_Button : public CFFL_FormFiller { + public: + CFFL_Button(CPDFSDK_FormFillEnvironment* pFormFillEnv, + CPDFSDK_Widget* pWidget); + ~CFFL_Button() override; + + // CFFL_FormFiller + void OnMouseEnter(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot) override; + void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; + bool OnLButtonDown(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_PointF& point) override; + bool OnLButtonUp(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_PointF& point) override; + bool OnMouseMove(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + uint32_t nFlags, + const CFX_PointF& point) override; + void OnDraw(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_RenderDevice* pDevice, + CFX_Matrix* pUser2Device) override; + void OnDrawDeactive(CPDFSDK_PageView* pPageView, + CPDFSDK_Annot* pAnnot, + CFX_RenderDevice* pDevice, + CFX_Matrix* pUser2Device) override; + + private: + bool m_bMouseIn; + bool m_bMouseDown; +}; + +#endif // FPDFSDK_FORMFILLER_CFFL_BUTTON_H_ diff --git a/fpdfsdk/formfiller/cffl_checkbox.h b/fpdfsdk/formfiller/cffl_checkbox.h index f6c7172c1c..f84fb3eb37 100644 --- a/fpdfsdk/formfiller/cffl_checkbox.h +++ b/fpdfsdk/formfiller/cffl_checkbox.h @@ -7,7 +7,7 @@ #ifndef FPDFSDK_FORMFILLER_CFFL_CHECKBOX_H_ #define FPDFSDK_FORMFILLER_CFFL_CHECKBOX_H_ -#include "fpdfsdk/formfiller/cffl_formfiller.h" +#include "fpdfsdk/formfiller/cffl_button.h" class CPWL_CheckBox; diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index f45a52cd21..31f6963348 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -17,11 +17,13 @@ #include "fpdfsdk/fsdk_common.h" #include "fpdfsdk/pdfwindow/cpwl_utils.h" -#define GetRed(rgb) ((uint8_t)(rgb)) -#define GetGreen(rgb) ((uint8_t)(((uint16_t)(rgb)) >> 8)) -#define GetBlue(rgb) ((uint8_t)((rgb) >> 16)) +namespace { -#define FFL_HINT_ELAPSE 800 +CPDFSDK_Widget* CPDFSDKAnnotToWidget(CPDFSDK_Annot* annot) { + return static_cast(annot); +} + +} // namespace CFFL_FormFiller::CFFL_FormFiller(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDFSDK_Widget* pWidget) @@ -36,7 +38,8 @@ CFFL_FormFiller::~CFFL_FormFiller() { void CFFL_FormFiller::DestroyWindows() { for (const auto& it : m_Maps) { CPWL_Wnd* pWnd = it.second; - CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); + CFFL_PrivateData* pData = + static_cast(pWnd->GetAttachedData()); pWnd->InvalidateProvider(this); pWnd->Destroy(); delete pWnd; @@ -47,16 +50,13 @@ void CFFL_FormFiller::DestroyWindows() { void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CFX_FloatRect& rcWindow) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) pWnd->Move(CFX_FloatRect(rcWindow), true, false); - } } CFX_FloatRect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { - return pWnd->GetWindowRect(); - } - return CFX_FloatRect(); + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); + return pWnd ? pWnd->GetWindowRect() : CFX_FloatRect(); } FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, @@ -65,21 +65,15 @@ FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, ASSERT(pAnnot); CFX_FloatRect rcAnnot = m_pWidget->GetRect(); - - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { - CFX_FloatRect rcWindow = pWnd->GetWindowRect(); - rcAnnot = PWLtoFFL(rcWindow); - } + if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) + rcAnnot = PWLtoFFL(pWnd->GetWindowRect()); CFX_FloatRect rcWin = rcAnnot; - CFX_FloatRect rcFocus = GetFocusBox(pPageView); if (!rcFocus.IsEmpty()) rcWin.Union(rcFocus); - CFX_FloatRect rect = CPWL_Utils::InflateRect(rcWin, 1); - - return rect.GetOuterRect(); + return CPWL_Utils::InflateRect(rcWin, 1).GetOuterRect(); } void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, @@ -92,20 +86,22 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, CFX_Matrix mt = GetCurMatrix(); mt.Concat(*pUser2Device); pWnd->DrawAppearance(pDevice, &mt); - } else { - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; - if (CFFL_InteractiveFormFiller::IsVisible(pWidget)) - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, - nullptr); + return; } + + CPDFSDK_Widget* pWidget = CPDFSDKAnnotToWidget(pAnnot); + if (!CFFL_InteractiveFormFiller::IsVisible(pWidget)) + return; + + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); } void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device) { - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); + CPDFSDKAnnotToWidget(pAnnot)->DrawAppearance(pDevice, pUser2Device, + CPDF_Annot::Normal, nullptr); } void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, @@ -262,12 +258,8 @@ void CFFL_FormFiller::KillFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag) { return; CPDFSDK_PageView* pPageView = GetCurPageView(false); - if (!pPageView) + if (!pPageView || !CommitData(pPageView, nFlag)) return; - - if (!CommitData(pPageView, nFlag)) - return; - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) pWnd->KillFocus(); @@ -297,26 +289,19 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { uint32_t dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; uint32_t dwFieldFlag = m_pWidget->GetFieldFlags(); - if (dwFieldFlag & FIELDFLAG_READONLY) { + if (dwFieldFlag & FIELDFLAG_READONLY) dwCreateFlags |= PWS_READONLY; - } FX_COLORREF color; - if (m_pWidget->GetFillColor(color)) { - cp.sBackgroundColor = - CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); - } - - if (m_pWidget->GetBorderColor(color)) { - cp.sBorderColor = - CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); - } + if (m_pWidget->GetFillColor(color)) + cp.sBackgroundColor = CPWL_Color(color); + if (m_pWidget->GetBorderColor(color)) + cp.sBorderColor = CPWL_Color(color); cp.sTextColor = CPWL_Color(COLORTYPE_GRAY, 0); - if (m_pWidget->GetTextColor(color)) { - cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); - } + if (m_pWidget->GetTextColor(color)) + cp.sTextColor = CPWL_Color(color); cp.fFontSize = m_pWidget->GetFontSize(); cp.dwBorderWidth = m_pWidget->GetBorderWidth(); @@ -327,8 +312,6 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { cp.sDash = CPWL_Dash(3, 3, 0); break; case BorderStyle::BEVELED: - cp.dwBorderWidth *= 2; - break; case BorderStyle::INSET: cp.dwBorderWidth *= 2; break; @@ -408,9 +391,6 @@ CFX_Matrix CFFL_FormFiller::GetCurMatrix() { CFX_Matrix mt; CFX_FloatRect rcDA = m_pWidget->GetPDFAnnot()->GetRect(); switch (m_pWidget->GetRotate()) { - default: - case 0: - break; case 90: mt = CFX_Matrix(0, 1, -1, 0, rcDA.right - rcDA.left, 0); break; @@ -421,6 +401,9 @@ CFX_Matrix CFFL_FormFiller::GetCurMatrix() { case 270: mt = CFX_Matrix(0, -1, 1, 0, 0, rcDA.top - rcDA.bottom); break; + case 0: + default: + break; } mt.e += rcDA.left; mt.f += rcDA.bottom; @@ -444,13 +427,14 @@ CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView(bool renew) { } CFX_FloatRect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { - if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) { - CFX_FloatRect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); - CFX_FloatRect rcPage = pPageView->GetPDFPage()->GetPageBBox(); - if (rcPage.Contains(rcFocus)) - return rcFocus; - } - return CFX_FloatRect(); + CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); + if (!pWnd) + return CFX_FloatRect(); + + CFX_FloatRect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); + return pPageView->GetPDFPage()->GetPageBBox().Contains(rcFocus) + ? rcFocus + : CFX_FloatRect(); } CFX_FloatRect CFFL_FormFiller::FFLtoPWL(const CFX_FloatRect& rect) { @@ -484,38 +468,40 @@ CFX_FloatRect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, } bool CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, uint32_t nFlag) { - if (IsDataChanged(pPageView)) { - CFFL_InteractiveFormFiller* pFormFiller = - m_pFormFillEnv->GetInteractiveFormFiller(); - CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); - - if (!pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, nFlag)) { - if (!pObserved) - return false; - ResetPDFWindow(pPageView, false); - return true; - } - if (!pObserved) - return false; + if (!IsDataChanged(pPageView)) + return true; - if (!pFormFiller->OnValidate(&pObserved, pPageView, nFlag)) { - if (!pObserved) - return false; - ResetPDFWindow(pPageView, false); - return true; - } - if (!pObserved) - return false; + CFFL_InteractiveFormFiller* pFormFiller = + m_pFormFillEnv->GetInteractiveFormFiller(); + CPDFSDK_Annot::ObservedPtr pObserved(m_pWidget.Get()); - SaveData(pPageView); - pFormFiller->OnCalculate(&pObserved, pPageView, nFlag); + if (!pFormFiller->OnKeyStrokeCommit(&pObserved, pPageView, nFlag)) { if (!pObserved) return false; + ResetPDFWindow(pPageView, false); + return true; + } + if (!pObserved) + return false; - pFormFiller->OnFormat(&pObserved, pPageView, nFlag); + if (!pFormFiller->OnValidate(&pObserved, pPageView, nFlag)) { if (!pObserved) return false; + ResetPDFWindow(pPageView, false); + return true; } + if (!pObserved) + return false; + + SaveData(pPageView); + pFormFiller->OnCalculate(&pObserved, pPageView, nFlag); + if (!pObserved) + return false; + + pFormFiller->OnFormat(&pObserved, pPageView, nFlag); + if (!pObserved) + return false; + return true; } @@ -578,97 +564,3 @@ void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, void CFFL_FormFiller::InvalidateRect(const FX_RECT& rect) { m_pFormFillEnv->Invalidate(m_pWidget->GetUnderlyingPage(), rect); } - -CFFL_Button::CFFL_Button(CPDFSDK_FormFillEnvironment* pApp, - CPDFSDK_Widget* pWidget) - : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(false), m_bMouseDown(false) {} - -CFFL_Button::~CFFL_Button() {} - -void CFFL_Button::OnMouseEnter(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot) { - m_bMouseIn = true; - InvalidateRect(GetViewBBox(pPageView, pAnnot)); -} - -void CFFL_Button::OnMouseExit(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot) { - m_bMouseIn = false; - - InvalidateRect(GetViewBBox(pPageView, pAnnot)); - EndTimer(); - ASSERT(m_pWidget); -} - -bool CFFL_Button::OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_PointF& point) { - if (!pAnnot->GetRect().Contains(point)) - return false; - - m_bMouseDown = true; - m_bValid = true; - InvalidateRect(GetViewBBox(pPageView, pAnnot)); - return true; -} - -bool CFFL_Button::OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_PointF& point) { - if (!pAnnot->GetRect().Contains(point)) - return false; - - m_bMouseDown = false; - m_pWidget->GetPDFPage(); - - InvalidateRect(GetViewBBox(pPageView, pAnnot)); - return true; -} - -bool CFFL_Button::OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_PointF& point) { - return true; -} - -void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - ASSERT(pPageView); - CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; - CPDF_FormControl* pCtrl = pWidget->GetFormControl(); - CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); - - if (eHM != CPDF_FormControl::Push) { - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); - return; - } - - if (m_bMouseDown) { - if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, nullptr); - else - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, - nullptr); - } else if (m_bMouseIn) { - if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover)) - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover, - nullptr); - else - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, - nullptr); - } else { - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); - } -} - -void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) { - OnDraw(pPageView, pAnnot, pDevice, pUser2Device); -} diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index 2ddbdf2d6e..3eedebea47 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -160,40 +160,4 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { CFX_PointF m_ptOldPos; }; -class CFFL_Button : public CFFL_FormFiller { - public: - CFFL_Button(CPDFSDK_FormFillEnvironment* pFormFillEnv, - CPDFSDK_Widget* pWidget); - ~CFFL_Button() override; - - // CFFL_FormFiller - void OnMouseEnter(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot) override; - void OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; - bool OnLButtonDown(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_PointF& point) override; - bool OnLButtonUp(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_PointF& point) override; - bool OnMouseMove(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - uint32_t nFlags, - const CFX_PointF& point) override; - void OnDraw(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - void OnDrawDeactive(CPDFSDK_PageView* pPageView, - CPDFSDK_Annot* pAnnot, - CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device) override; - - protected: - bool m_bMouseIn; - bool m_bMouseDown; -}; - #endif // FPDFSDK_FORMFILLER_CFFL_FORMFILLER_H_ diff --git a/fpdfsdk/formfiller/cffl_pushbutton.h b/fpdfsdk/formfiller/cffl_pushbutton.h index 334abc27ad..9ae4752fa9 100644 --- a/fpdfsdk/formfiller/cffl_pushbutton.h +++ b/fpdfsdk/formfiller/cffl_pushbutton.h @@ -7,7 +7,7 @@ #ifndef FPDFSDK_FORMFILLER_CFFL_PUSHBUTTON_H_ #define FPDFSDK_FORMFILLER_CFFL_PUSHBUTTON_H_ -#include "fpdfsdk/formfiller/cffl_formfiller.h" +#include "fpdfsdk/formfiller/cffl_button.h" class CFFL_PushButton : public CFFL_Button { public: diff --git a/fpdfsdk/formfiller/cffl_radiobutton.h b/fpdfsdk/formfiller/cffl_radiobutton.h index 29b7e3835a..981e2df62e 100644 --- a/fpdfsdk/formfiller/cffl_radiobutton.h +++ b/fpdfsdk/formfiller/cffl_radiobutton.h @@ -7,7 +7,7 @@ #ifndef FPDFSDK_FORMFILLER_CFFL_RADIOBUTTON_H_ #define FPDFSDK_FORMFILLER_CFFL_RADIOBUTTON_H_ -#include "fpdfsdk/formfiller/cffl_formfiller.h" +#include "fpdfsdk/formfiller/cffl_button.h" class CPWL_RadioButton; diff --git a/fpdfsdk/pdfwindow/cpwl_color.h b/fpdfsdk/pdfwindow/cpwl_color.h index 6eae48738f..83e73efbf5 100644 --- a/fpdfsdk/pdfwindow/cpwl_color.h +++ b/fpdfsdk/pdfwindow/cpwl_color.h @@ -8,8 +8,12 @@ #define FPDFSDK_PDFWINDOW_CPWL_COLOR_H_ #include "core/fpdfdoc/cpdf_formcontrol.h" +#include "core/fxge/fx_dib.h" struct CPWL_Color { + explicit CPWL_Color(FX_COLORREF ref) + : CPWL_Color(FXARGB_R(ref), FXARGB_G(ref), FXARGB_B(ref)) {} + CPWL_Color(int32_t type = COLORTYPE_TRANSPARENT, float color1 = 0.0f, float color2 = 0.0f, -- cgit v1.2.3