diff options
Diffstat (limited to 'fpdfsdk/cpdfsdk_pageview.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_pageview.cpp | 48 |
1 files changed, 34 insertions, 14 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index 4d9a905fd6..b0b5f8a68a 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -315,6 +315,40 @@ bool CPDFSDK_PageView::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { return true; } +bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = + m_pFormFillEnv->GetAnnotHandlerMgr(); + CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point)); + CPDFSDK_Annot::ObservedPtr pFocusAnnot(GetFocusAnnot()); + if (pFocusAnnot && pFocusAnnot != pFXAnnot) { + // Last focus Annot gets a chance to handle the event. + if (pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFocusAnnot, nFlag, point)) + return true; + } + return pFXAnnot && + pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFXAnnot, nFlag, point); +} + +bool CPDFSDK_PageView::OnLButtonDblClk(const CFX_PointF& point, + uint32_t nFlag) { + CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point)); + if (!pAnnot) { + m_pFormFillEnv->KillFocusAnnot(nFlag); + return false; + } + + CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = + m_pFormFillEnv->GetAnnotHandlerMgr(); + if (!pAnnotHandlerMgr->Annot_OnLButtonDblClk(this, &pAnnot, nFlag, point)) + return false; + + if (!pAnnot) + return false; + + m_pFormFillEnv->SetFocusAnnot(&pAnnot); + return true; +} + #ifdef PDF_ENABLE_XFA bool CPDFSDK_PageView::OnRButtonDown(const CFX_PointF& point, uint32_t nFlag) { CPDFSDK_Annot::ObservedPtr pAnnot(GetFXWidgetAtPoint(point)); @@ -347,20 +381,6 @@ bool CPDFSDK_PageView::OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) { } #endif // PDF_ENABLE_XFA -bool CPDFSDK_PageView::OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) { - CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = - m_pFormFillEnv->GetAnnotHandlerMgr(); - CPDFSDK_Annot::ObservedPtr pFXAnnot(GetFXWidgetAtPoint(point)); - CPDFSDK_Annot::ObservedPtr pFocusAnnot(GetFocusAnnot()); - if (pFocusAnnot && pFocusAnnot != pFXAnnot) { - // Last focus Annot gets a chance to handle the event. - if (pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFocusAnnot, nFlag, point)) - return true; - } - return pFXAnnot && - pAnnotHandlerMgr->Annot_OnLButtonUp(this, &pFXAnnot, nFlag, point); -} - bool CPDFSDK_PageView::OnMouseMove(const CFX_PointF& point, int nFlag) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); |