diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-21 14:27:59 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-21 20:44:29 +0000 |
commit | b45ea1fce52d93615470bab8b671cba5907fb01e (patch) | |
tree | 15153c437a253f73b3f5bb154a294ace77fe2c6d /xfa/fxfa/app | |
parent | 37a35df8c878d6e21a62ce0dfd2d480997d9e86c (diff) | |
download | pdfium-b45ea1fce52d93615470bab8b671cba5907fb01e.tar.xz |
Convert CFWL messages to use CFX_PointF
This Cl updates the various CFWL_Message classes to take CFX_PointF instead of
x,y values.
Change-Id: I5d9d01d68be64fc9e69c04574994c01286ad24e1
Reviewed-on: https://pdfium-review.googlesource.com/2811
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/xfa_ffbarcode.cpp | 18 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffbarcode.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffcheckbutton.cpp | 7 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffcheckbutton.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffchoicelist.cpp | 17 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffchoicelist.h | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fffield.cpp | 134 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fffield.h | 25 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffimageedit.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffimageedit.h | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffsignature.cpp | 49 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffsignature.h | 21 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftext.cpp | 32 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftext.h | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.cpp | 41 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.h | 8 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidget.cpp | 57 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgethandler.cpp | 62 |
18 files changed, 237 insertions, 266 deletions
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index 0207318e95..b136b8da5a 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -221,20 +221,18 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { } } -bool CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { +bool CXFA_FFBarcode::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; - if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { + if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) return false; - } - if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { + if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) return false; - } - return CXFA_FFTextEdit::OnLButtonDown(dwFlags, fx, fy); + return CXFA_FFTextEdit::OnLButtonDown(dwFlags, point); } -bool CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFBarcode::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; - if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) { + if (!pBarCodeWidget || pBarCodeWidget->IsProtectedType()) return false; - } - return CXFA_FFTextEdit::OnRButtonDown(dwFlags, fx, fy); + return CXFA_FFTextEdit::OnRButtonDown(dwFlags, point); } diff --git a/xfa/fxfa/app/xfa_ffbarcode.h b/xfa/fxfa/app/xfa_ffbarcode.h index 28d7486bcd..c20feb5167 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.h +++ b/xfa/fxfa/app/xfa_ffbarcode.h @@ -22,8 +22,8 @@ class CXFA_FFBarcode : public CXFA_FFTextEdit { CFX_Matrix* pMatrix, uint32_t dwStatus) override; void UpdateWidgetProperty() override; - bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; }; enum XFA_BARCODETYPEENUM { diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp index 8a20c1a879..f088b5d4dd 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp +++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp @@ -232,8 +232,7 @@ void CXFA_FFCheckButton::RenderWidget(CFX_Graphics* pGS, GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt); } bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { if (!m_pNormalWidget || !IsButtonDown()) return false; @@ -241,9 +240,7 @@ bool CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags, CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.h b/xfa/fxfa/app/xfa_ffcheckbutton.h index 4cb7d2113c..2c0acd6e3e 100644 --- a/xfa/fxfa/app/xfa_ffcheckbutton.h +++ b/xfa/fxfa/app/xfa_ffcheckbutton.h @@ -24,7 +24,7 @@ class CXFA_FFCheckButton : public CXFA_FFField { bool PerformLayout() override; bool UpdateFWLData() override; void UpdateWidgetProperty() override; - bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index efe8b0c8c2..3aabde870a 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -226,12 +226,9 @@ CFX_RectF CXFA_FFComboBox::GetBBox(uint32_t dwStatus, bool bDrawFocus) { return CXFA_FFWidget::GetBBox(dwStatus); } -bool CXFA_FFComboBox::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) - return false; - return static_cast<CFWL_ComboBox*>(m_pNormalWidget) - ->GetBBox() - .Contains(fx, fy); +bool CXFA_FFComboBox::PtInActiveRect(const CFX_PointF& point) { + auto pComboBox = static_cast<CFWL_ComboBox*>(m_pNormalWidget); + return pComboBox && pComboBox->GetBBox().Contains(point); } bool CXFA_FFComboBox::LoadWidget() { @@ -292,13 +289,15 @@ void CXFA_FFComboBox::UpdateWidgetProperty() { } pComboBox->EditModifyStylesEx(dwEditStyles, 0xFFFFFFFF); } -bool CXFA_FFComboBox::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) + +bool CXFA_FFComboBox::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { + if (!CXFA_FFField::OnRButtonUp(dwFlags, point)) return false; - GetDoc()->GetDocEnvironment()->PopupMenu(this, CFX_PointF(fx, fy)); + GetDoc()->GetDocEnvironment()->PopupMenu(this, point); return true; } + bool CXFA_FFComboBox::OnKillFocus(CXFA_FFWidget* pNewWidget) { bool flag = ProcessCommittedData(); if (!flag) { diff --git a/xfa/fxfa/app/xfa_ffchoicelist.h b/xfa/fxfa/app/xfa_ffchoicelist.h index 9eb42e593b..e89366ad13 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.h +++ b/xfa/fxfa/app/xfa_ffchoicelist.h @@ -48,7 +48,7 @@ class CXFA_FFComboBox : public CXFA_FFField { CFX_RectF GetBBox(uint32_t dwStatus, bool bDrawFocus = false) override; bool LoadWidget() override; void UpdateWidgetProperty() override; - bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; bool CanUndo() override; bool CanRedo() override; @@ -84,7 +84,7 @@ class CXFA_FFComboBox : public CXFA_FFField { protected: // CXFA_FFField - bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; + bool PtInActiveRect(const CFX_PointF& point) override; bool CommitData() override; bool UpdateFWLData() override; bool IsDataChanged() override; diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index 932754c09c..0c8d8c1b5f 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -98,6 +98,7 @@ void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { FX_FLOAT DashPattern[2] = {1, 1}; pGS->SetLineDash(0.0f, DashPattern, 2); pGS->SetLineWidth(0, false); + CFX_Path path; path.Create(); path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); @@ -350,145 +351,126 @@ bool CXFA_FFField::OnMouseExit() { return true; } -void CXFA_FFField::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { - if (!m_pNormalWidget) - return; - - CFX_RectF rtWidget = m_pNormalWidget->GetWidgetRect(); - fx -= rtWidget.left; - fy -= rtWidget.top; +CFX_PointF CXFA_FFField::FWLToClient(const CFX_PointF& point) { + return m_pNormalWidget ? point - m_pNormalWidget->GetWidgetRect().TopLeft() + : point; } -bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { +bool CXFA_FFField::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { + if (!m_pNormalWidget) return false; - } if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { return false; } - if (!PtInActiveRect(fx, fy)) { + if (!PtInActiveRect(point)) return false; - } + SetButtonDown(true); CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFField::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { + +bool CXFA_FFField::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { + if (!m_pNormalWidget) return false; - } - if (!IsButtonDown()) { + if (!IsButtonDown()) return false; - } + SetButtonDown(false); CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { + +bool CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) { + if (!m_pNormalWidget) return false; - } + CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDblClk; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFField::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { + +bool CXFA_FFField::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) { + if (!m_pNormalWidget) return false; - } + CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::Move; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } + bool CXFA_FFField::OnMouseWheel(uint32_t dwFlags, int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy) { - if (!m_pNormalWidget) { + const CFX_PointF& point) { + if (!m_pNormalWidget) return false; - } + CFWL_MessageMouseWheel ms(nullptr, m_pNormalWidget); ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); - ms.m_fDeltaX = zDelta; - ms.m_fDeltaY = 0; + ms.m_pos = FWLToClient(point); + ms.m_delta = CFX_PointF(zDelta, 0); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { + +bool CXFA_FFField::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { + if (!m_pNormalWidget) return false; - } if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { return false; } - if (!PtInActiveRect(fx, fy)) { + if (!PtInActiveRect(point)) return false; - } + SetButtonDown(true); CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFField::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { + +bool CXFA_FFField::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { + if (!m_pNormalWidget) return false; - } - if (!IsButtonDown()) { + if (!IsButtonDown()) return false; - } + SetButtonDown(false); CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::RightButtonUp; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { + +bool CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) { + if (!m_pNormalWidget) return false; - } + CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::RightButtonDblClk; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } @@ -557,27 +539,25 @@ bool CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { TranslateFWLMessage(&ms); return true; } -FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { - if (m_pNormalWidget) { - FX_FLOAT ffx = fx, ffy = fy; - FWLToClient(ffx, ffy); - if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown) - return FWL_WidgetHit::Client; +FWL_WidgetHit CXFA_FFField::OnHitTest(const CFX_PointF& point) { + if (m_pNormalWidget && + m_pNormalWidget->HitTest(FWLToClient(point)) != FWL_WidgetHit::Unknown) { + return FWL_WidgetHit::Client; } - if (!GetRectWithoutRotate().Contains(fx, fy)) + if (!GetRectWithoutRotate().Contains(point)) return FWL_WidgetHit::Unknown; - if (m_rtCaption.Contains(fx, fy)) + if (m_rtCaption.Contains(point)) return FWL_WidgetHit::Titlebar; return FWL_WidgetHit::Border; } -bool CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { +bool CXFA_FFField::OnSetCursor(const CFX_PointF& point) { return true; } -bool CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { - return m_pNormalWidget && m_pNormalWidget->GetWidgetRect().Contains(fx, fy); +bool CXFA_FFField::PtInActiveRect(const CFX_PointF& point) { + return m_pNormalWidget && m_pNormalWidget->GetWidgetRect().Contains(point); } void CXFA_FFField::LayoutCaption() { diff --git a/xfa/fxfa/app/xfa_fffield.h b/xfa/fxfa/app/xfa_fffield.h index 1ccd57f30e..f10ce61738 100644 --- a/xfa/fxfa/app/xfa_fffield.h +++ b/xfa/fxfa/app/xfa_fffield.h @@ -31,25 +31,24 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { bool PerformLayout() override; bool OnMouseEnter() override; bool OnMouseExit() override; - bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseWheel(uint32_t dwFlags, int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy) override; - bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + const CFX_PointF& point) override; + bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; bool OnSetFocus(CXFA_FFWidget* pOldWidget) override; bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override; bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override; bool OnChar(uint32_t dwChar, uint32_t dwFlags) override; - FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override; - bool OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) override; + FWL_WidgetHit OnHitTest(const CFX_PointF& point) override; + bool OnSetCursor(const CFX_PointF& point) override; // IFWL_WidgetDelegate void OnProcessMessage(CFWL_Message* pMessage) override; @@ -61,12 +60,12 @@ class CXFA_FFField : public CXFA_FFWidget, public IFWL_WidgetDelegate { uint32_t UpdateUIProperty(); protected: - bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; + bool PtInActiveRect(const CFX_PointF& point) override; virtual void SetFWLRect(); void SetFWLThemeProvider(); CFWL_Widget* GetNormalWidget() { return m_pNormalWidget; } - void FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy); + CFX_PointF FWLToClient(const CFX_PointF& point); void LayoutCaption(); void RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix = nullptr); diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index 93e9481ddf..01d29eed41 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -86,12 +86,10 @@ void CXFA_FFImageEdit::RenderWidget(CFX_Graphics* pGS, } bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) return false; - - if (!PtInActiveRect(fx, fy)) + if (!PtInActiveRect(point)) return false; SetButtonDown(true); @@ -99,9 +97,7 @@ bool CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } diff --git a/xfa/fxfa/app/xfa_ffimageedit.h b/xfa/fxfa/app/xfa_ffimageedit.h index 9a2d19b8a8..73032b9815 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.h +++ b/xfa/fxfa/app/xfa_ffimageedit.h @@ -20,7 +20,7 @@ class CXFA_FFImageEdit : public CXFA_FFField { uint32_t dwStatus) override; bool LoadWidget() override; void UnloadWidget() override; - bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; void OnProcessMessage(CFWL_Message* pMessage) override; void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CFX_Graphics* pGraphics, diff --git a/xfa/fxfa/app/xfa_ffsignature.cpp b/xfa/fxfa/app/xfa_ffsignature.cpp index 53f693d1ba..bf2bba3adf 100644 --- a/xfa/fxfa/app/xfa_ffsignature.cpp +++ b/xfa/fxfa/app/xfa_ffsignature.cpp @@ -41,69 +41,74 @@ void CXFA_FFSignature::RenderWidget(CFX_Graphics* pGS, bool CXFA_FFSignature::OnMouseEnter() { return false; } + bool CXFA_FFSignature::OnMouseExit() { return false; } + bool CXFA_FFSignature::OnLButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { return false; } -bool CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFSignature::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; } + bool CXFA_FFSignature::OnLButtonDblClk(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { return false; } -bool CXFA_FFSignature::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFSignature::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) { return false; } + bool CXFA_FFSignature::OnMouseWheel(uint32_t dwFlags, int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { return false; } + bool CXFA_FFSignature::OnRButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { return false; } -bool CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFSignature::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; } + bool CXFA_FFSignature::OnRButtonDblClk(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { return false; } + bool CXFA_FFSignature::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { return false; } + bool CXFA_FFSignature::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { return false; } + bool CXFA_FFSignature::OnChar(uint32_t dwChar, uint32_t dwFlags) { return false; } -FWL_WidgetHit CXFA_FFSignature::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { - if (m_pNormalWidget) { - FX_FLOAT ffx = fx, ffy = fy; - FWLToClient(ffx, ffy); - if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown) - return FWL_WidgetHit::Client; +FWL_WidgetHit CXFA_FFSignature::OnHitTest(const CFX_PointF& point) { + if (m_pNormalWidget && + m_pNormalWidget->HitTest(FWLToClient(point)) != FWL_WidgetHit::Unknown) { + return FWL_WidgetHit::Client; } - if (!GetRectWithoutRotate().Contains(fx, fy)) + if (!GetRectWithoutRotate().Contains(point)) return FWL_WidgetHit::Unknown; - if (m_rtCaption.Contains(fx, fy)) + if (m_rtCaption.Contains(point)) return FWL_WidgetHit::Titlebar; return FWL_WidgetHit::Client; } -bool CXFA_FFSignature::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { +bool CXFA_FFSignature::OnSetCursor(const CFX_PointF& point) { return false; } diff --git a/xfa/fxfa/app/xfa_ffsignature.h b/xfa/fxfa/app/xfa_ffsignature.h index 29c27360a9..934323f436 100644 --- a/xfa/fxfa/app/xfa_ffsignature.h +++ b/xfa/fxfa/app/xfa_ffsignature.h @@ -21,23 +21,22 @@ class CXFA_FFSignature final : public CXFA_FFField { bool LoadWidget() override; bool OnMouseEnter() override; bool OnMouseExit() override; - bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnLButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override; bool OnMouseWheel(uint32_t dwFlags, int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy) override; - bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnRButtonDblClk(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + const CFX_PointF& pointy) override; + bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) override; bool OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) override; bool OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) override; bool OnChar(uint32_t dwChar, uint32_t dwFlags) override; - FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override; - bool OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) override; + FWL_WidgetHit OnHitTest(const CFX_PointF& point) override; + bool OnSetCursor(const CFX_PointF& point) override; }; #endif // XFA_FXFA_APP_XFA_FFSIGNATURE_H_ diff --git a/xfa/fxfa/app/xfa_fftext.cpp b/xfa/fxfa/app/xfa_fftext.cpp index d8231bfda8..e8d7aa32d0 100644 --- a/xfa/fxfa/app/xfa_fftext.cpp +++ b/xfa/fxfa/app/xfa_fftext.cpp @@ -107,11 +107,11 @@ bool CXFA_FFText::PerformLayout() { return true; } -bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!GetRectWithoutRotate().Contains(fx, fy)) +bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { + if (!GetRectWithoutRotate().Contains(point)) return false; - const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); + const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point); if (!wsURLContent) return false; @@ -119,33 +119,33 @@ bool CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { return true; } -bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - return GetRectWithoutRotate().Contains(fx, fy) && !!GetLinkURLAtPoint(fx, fy); +bool CXFA_FFText::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) { + return GetRectWithoutRotate().Contains(point) && !!GetLinkURLAtPoint(point); } -bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!IsButtonDown()) { +bool CXFA_FFText::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { + if (!IsButtonDown()) return false; - } + SetButtonDown(false); - const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); - if (!wsURLContent) { + const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(point); + if (!wsURLContent) return false; - } + CXFA_FFDoc* pDoc = GetDoc(); pDoc->GetDocEnvironment()->GotoURL(pDoc, wsURLContent); return true; } -FWL_WidgetHit CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { - if (!GetRectWithoutRotate().Contains(fx, fy)) +FWL_WidgetHit CXFA_FFText::OnHitTest(const CFX_PointF& point) { + if (!GetRectWithoutRotate().Contains(point)) return FWL_WidgetHit::Unknown; - if (!GetLinkURLAtPoint(fx, fy)) + if (!GetLinkURLAtPoint(point)) return FWL_WidgetHit::Unknown; return FWL_WidgetHit::HyperLink; } -const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) { +const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(const CFX_PointF& point) { CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); if (!pTextLayout) return nullptr; @@ -154,7 +154,7 @@ const FX_WCHAR* CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) { for (const auto& pPieceLine : *pTextLayout->GetPieceLines()) { for (const auto& pPiece : pPieceLine->m_textPieces) { if (pPiece->pLinkData && - pPiece->rtPiece.Contains(fx - rect.left, fy - rect.top)) { + pPiece->rtPiece.Contains(point - rect.TopLeft())) { return pPiece->pLinkData->GetLinkURL(); } } diff --git a/xfa/fxfa/app/xfa_fftext.h b/xfa/fxfa/app/xfa_fftext.h index 2c01a6f349..c553821791 100644 --- a/xfa/fxfa/app/xfa_fftext.h +++ b/xfa/fxfa/app/xfa_fftext.h @@ -15,10 +15,10 @@ class CXFA_FFText : public CXFA_FFDraw { ~CXFA_FFText() override; // CXFA_FFWidget - bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - FWL_WidgetHit OnHitTest(FX_FLOAT fx, FX_FLOAT fy) override; + bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) override; + FWL_WidgetHit OnHitTest(const CFX_PointF& point) override; void RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix, uint32_t dwStatus) override; @@ -26,7 +26,7 @@ class CXFA_FFText : public CXFA_FFDraw { bool PerformLayout() override; private: - const FX_WCHAR* GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy); + const FX_WCHAR* GetLinkURLAtPoint(const CFX_PointF& point); }; #endif // XFA_FXFA_APP_XFA_FFTEXT_H_ diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index ad5ab434c6..094839f486 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -103,58 +103,53 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() { m_pNormalWidget->ModifyStyles(dwStyle, 0xFFFFFFFF); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); } -bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - if (!PtInActiveRect(fx, fy)) { + +bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { + if (!PtInActiveRect(point)) return false; - } if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; UpdateFWLData(); AddInvalidateRect(); } + SetButtonDown(true); CFWL_MessageMouse ms(nullptr, m_pNormalWidget); ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { + +bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { + if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) return false; - } - if (!PtInActiveRect(fx, fy)) { + if (!PtInActiveRect(point)) return false; - } if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; UpdateFWLData(); AddInvalidateRect(); } + SetButtonDown(true); CFWL_MessageMouse ms(nullptr, nullptr); ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; ms.m_dwFlags = dwFlags; - ms.m_fx = fx; - ms.m_fy = fy; - FWLToClient(ms.m_fx, ms.m_fy); + ms.m_pos = FWLToClient(point); TranslateFWLMessage(&ms); return true; } -bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { - if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) + +bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { + if (!CXFA_FFField::OnRButtonUp(dwFlags, point)) return false; - GetDoc()->GetDocEnvironment()->PopupMenu(this, CFX_PointF(fx, fy)); + GetDoc()->GetDocEnvironment()->PopupMenu(this, point); return true; } + bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged; if (!IsFocused()) { @@ -499,11 +494,11 @@ CFX_RectF CXFA_FFDateTimeEdit::GetBBox(uint32_t dwStatus, bool bDrawFocus) { return CXFA_FFWidget::GetBBox(dwStatus); } -bool CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { +bool CXFA_FFDateTimeEdit::PtInActiveRect(const CFX_PointF& point) { return m_pNormalWidget && static_cast<CFWL_DateTimePicker*>(m_pNormalWidget) ->GetBBox() - .Contains(fx, fy); + .Contains(point); } bool CXFA_FFDateTimeEdit::LoadWidget() { diff --git a/xfa/fxfa/app/xfa_fftextedit.h b/xfa/fxfa/app/xfa_fftextedit.h index 91c30ba8c9..1e0562a75b 100644 --- a/xfa/fxfa/app/xfa_fftextedit.h +++ b/xfa/fxfa/app/xfa_fftextedit.h @@ -19,9 +19,9 @@ class CXFA_FFTextEdit : public CXFA_FFField { // CXFA_FFField bool LoadWidget() override; void UpdateWidgetProperty() override; - bool OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; - bool OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) override; + bool OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) override; + bool OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) override; bool OnSetFocus(CXFA_FFWidget* pOldWidget) override; bool OnKillFocus(CXFA_FFWidget* pNewWidget) override; void OnProcessMessage(CFWL_Message* pMessage) override; @@ -95,7 +95,7 @@ class CXFA_FFDateTimeEdit : public CXFA_FFTextEdit { int32_t iDay); protected: - bool PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) override; + bool PtInActiveRect(const CFX_PointF& point) override; bool CommitData() override; bool UpdateFWLData() override; bool IsDataChanged() override; diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 7a8cc646dd..c917697948 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -189,38 +189,42 @@ bool CXFA_FFWidget::IsFocused() { bool CXFA_FFWidget::OnMouseEnter() { return false; } + bool CXFA_FFWidget::OnMouseExit() { return false; } -bool CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, const CFX_PointF& point) { return false; } -bool CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFWidget::OnLButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; } -bool CXFA_FFWidget::OnLButtonDblClk(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + +bool CXFA_FFWidget::OnLButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) { return false; } -bool CXFA_FFWidget::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFWidget::OnMouseMove(uint32_t dwFlags, const CFX_PointF& point) { return false; } + bool CXFA_FFWidget::OnMouseWheel(uint32_t dwFlags, int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { return false; } -bool CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFWidget::OnRButtonDown(uint32_t dwFlags, const CFX_PointF& point) { return false; } -bool CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFWidget::OnRButtonUp(uint32_t dwFlags, const CFX_PointF& point) { return false; } -bool CXFA_FFWidget::OnRButtonDblClk(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + +bool CXFA_FFWidget::OnRButtonDblClk(uint32_t dwFlags, const CFX_PointF& point) { return false; } @@ -236,6 +240,7 @@ bool CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam); return true; } + bool CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) { m_dwStatus &= ~XFA_WidgetStatus_Focused; EventKillFocus(); @@ -247,57 +252,75 @@ bool CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) { } return true; } + bool CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { return false; } + bool CXFA_FFWidget::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { return false; } + bool CXFA_FFWidget::OnChar(uint32_t dwChar, uint32_t dwFlags) { return false; } -FWL_WidgetHit CXFA_FFWidget::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { + +FWL_WidgetHit CXFA_FFWidget::OnHitTest(const CFX_PointF& point) { return FWL_WidgetHit::Unknown; } -bool CXFA_FFWidget::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { + +bool CXFA_FFWidget::OnSetCursor(const CFX_PointF& point) { return false; } + bool CXFA_FFWidget::CanUndo() { return false; } + bool CXFA_FFWidget::CanRedo() { return false; } + bool CXFA_FFWidget::Undo() { return false; } + bool CXFA_FFWidget::Redo() { return false; } + bool CXFA_FFWidget::CanCopy() { return false; } + bool CXFA_FFWidget::CanCut() { return false; } + bool CXFA_FFWidget::CanPaste() { return false; } + bool CXFA_FFWidget::CanSelectAll() { return false; } + bool CXFA_FFWidget::CanDelete() { return CanCut(); } + bool CXFA_FFWidget::CanDeSelect() { return CanCopy(); } + bool CXFA_FFWidget::Copy(CFX_WideString& wsCopy) { return false; } + bool CXFA_FFWidget::Cut(CFX_WideString& wsCut) { return false; } + bool CXFA_FFWidget::Paste(const CFX_WideString& wsPaste) { return false; } @@ -429,8 +452,8 @@ bool CXFA_FFWidget::IsAncestorOf(CXFA_FFWidget* pWidget) { return false; } -bool CXFA_FFWidget::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { - return GetWidgetRect().Contains(fx, fy); +bool CXFA_FFWidget::PtInActiveRect(const CFX_PointF& point) { + return GetWidgetRect().Contains(point); } CXFA_FFDocView* CXFA_FFWidget::GetDocView() { diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp index bbca0409d3..2fddfb6156 100644 --- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp +++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp @@ -40,11 +40,9 @@ bool CXFA_FFWidgetHandler::OnMouseExit(CXFA_FFWidget* hWidget) { bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { m_pDocView->LockUpdate(); - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - bool bRet = hWidget->OnLButtonDown(dwFlags, pos.x, pos.y); + bool bRet = hWidget->OnLButtonDown(dwFlags, hWidget->Rotate2Normal(point)); if (bRet && m_pDocView->SetFocus(hWidget)) { m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( m_pDocView->GetDoc(), hWidget); @@ -56,12 +54,10 @@ bool CXFA_FFWidgetHandler::OnLButtonDown(CXFA_FFWidget* hWidget, bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { m_pDocView->LockUpdate(); - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); m_pDocView->m_bLayoutEvent = true; - bool bRet = hWidget->OnLButtonUp(dwFlags, pos.x, pos.y); + bool bRet = hWidget->OnLButtonUp(dwFlags, hWidget->Rotate2Normal(point)); m_pDocView->UnlockUpdate(); m_pDocView->UpdateDocView(); return bRet; @@ -69,20 +65,16 @@ bool CXFA_FFWidgetHandler::OnLButtonUp(CXFA_FFWidget* hWidget, bool CXFA_FFWidgetHandler::OnLButtonDblClk(CXFA_FFWidget* hWidget, uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - bool bRet = hWidget->OnLButtonDblClk(dwFlags, pos.x, pos.y); + const CFX_PointF& point) { + bool bRet = hWidget->OnLButtonDblClk(dwFlags, hWidget->Rotate2Normal(point)); m_pDocView->RunInvalidate(); return bRet; } bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - bool bRet = hWidget->OnMouseMove(dwFlags, pos.x, pos.y); + const CFX_PointF& point) { + bool bRet = hWidget->OnMouseMove(dwFlags, hWidget->Rotate2Normal(point)); m_pDocView->RunInvalidate(); return bRet; } @@ -90,20 +82,17 @@ bool CXFA_FFWidgetHandler::OnMouseMove(CXFA_FFWidget* hWidget, bool CXFA_FFWidgetHandler::OnMouseWheel(CXFA_FFWidget* hWidget, uint32_t dwFlags, int16_t zDelta, - FX_FLOAT fx, - FX_FLOAT fy) { - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - bool bRet = hWidget->OnMouseWheel(dwFlags, zDelta, pos.x, pos.y); + const CFX_PointF& point) { + bool bRet = + hWidget->OnMouseWheel(dwFlags, zDelta, hWidget->Rotate2Normal(point)); m_pDocView->RunInvalidate(); return bRet; } bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - bool bRet = hWidget->OnRButtonDown(dwFlags, pos.x, pos.y); + const CFX_PointF& point) { + bool bRet = hWidget->OnRButtonDown(dwFlags, hWidget->Rotate2Normal(point)); if (bRet && m_pDocView->SetFocus(hWidget)) { m_pDocView->GetDoc()->GetDocEnvironment()->SetFocusWidget( m_pDocView->GetDoc(), hWidget); @@ -114,20 +103,16 @@ bool CXFA_FFWidgetHandler::OnRButtonDown(CXFA_FFWidget* hWidget, bool CXFA_FFWidgetHandler::OnRButtonUp(CXFA_FFWidget* hWidget, uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - bool bRet = hWidget->OnRButtonUp(dwFlags, pos.x, pos.y); + const CFX_PointF& point) { + bool bRet = hWidget->OnRButtonUp(dwFlags, hWidget->Rotate2Normal(point)); m_pDocView->RunInvalidate(); return bRet; } bool CXFA_FFWidgetHandler::OnRButtonDblClk(CXFA_FFWidget* hWidget, uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - bool bRet = hWidget->OnRButtonDblClk(dwFlags, pos.x, pos.y); + const CFX_PointF& point) { + bool bRet = hWidget->OnRButtonDblClk(dwFlags, hWidget->Rotate2Normal(point)); m_pDocView->RunInvalidate(); return bRet; } @@ -158,20 +143,15 @@ bool CXFA_FFWidgetHandler::OnChar(CXFA_FFWidget* hWidget, } FWL_WidgetHit CXFA_FFWidgetHandler::OnHitTest(CXFA_FFWidget* hWidget, - FX_FLOAT fx, - FX_FLOAT fy) { + const CFX_PointF& point) { if (!(hWidget->GetStatus() & XFA_WidgetStatus_Visible)) return FWL_WidgetHit::Unknown; - - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - return hWidget->OnHitTest(pos.x, pos.y); + return hWidget->OnHitTest(hWidget->Rotate2Normal(point)); } bool CXFA_FFWidgetHandler::OnSetCursor(CXFA_FFWidget* hWidget, - FX_FLOAT fx, - FX_FLOAT fy) { - CFX_PointF pos = hWidget->Rotate2Normal(CFX_PointF(fx, fy)); - return hWidget->OnSetCursor(pos.x, pos.y); + const CFX_PointF& point) { + return hWidget->OnSetCursor(hWidget->Rotate2Normal(point)); } void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget, |