Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "fpdfsdk/include/fsdk_mgr.h" | 7 #include "fpdfsdk/include/fsdk_mgr.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 595 return nullptr; | 595 return nullptr; |
| 596 } | 596 } |
| 597 | 597 |
| 598 CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, | 598 CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, |
| 599 FX_FLOAT pageY) { | 599 FX_FLOAT pageY) { |
| 600 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 600 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 601 CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); | 601 CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); |
| 602 CPDFSDK_AnnotIterator annotIterator(this, false); | 602 CPDFSDK_AnnotIterator annotIterator(this, false); |
| 603 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { | 603 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { |
| 604 CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); | 604 CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); |
| 605 if (pSDKAnnot->GetType() == "Popup") | |
| 606 continue; | |
| 605 if (rc.Contains(pageX, pageY)) | 607 if (rc.Contains(pageX, pageY)) |
| 606 return pSDKAnnot; | 608 return pSDKAnnot; |
| 607 } | 609 } |
| 608 | 610 |
| 609 return nullptr; | 611 return nullptr; |
| 610 } | 612 } |
| 611 | 613 |
| 612 CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, | 614 CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, |
| 613 FX_FLOAT pageY) { | 615 FX_FLOAT pageY) { |
| 614 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 616 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 755 } | 757 } |
| 756 return nullptr; | 758 return nullptr; |
| 757 } | 759 } |
| 758 #endif // PDF_ENABLE_XFA | 760 #endif // PDF_ENABLE_XFA |
| 759 | 761 |
| 760 FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, | 762 FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, |
| 761 FX_UINT nFlag) { | 763 FX_UINT nFlag) { |
| 762 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 764 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 763 ASSERT(pEnv); | 765 ASSERT(pEnv); |
| 764 CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y); | 766 CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y); |
| 767 | |
|
Lei Zhang
2016/08/27 02:16:53
nit: extra blank line?
jaepark
2016/08/29 21:19:25
Done.
| |
| 765 if (!pFXAnnot) { | 768 if (!pFXAnnot) { |
| 766 KillFocusAnnot(nFlag); | 769 KillFocusAnnot(nFlag); |
| 767 return FALSE; | 770 return FALSE; |
| 768 } | 771 } |
| 769 | 772 |
| 770 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 773 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
| 771 FX_BOOL bRet = | 774 FX_BOOL bRet = |
| 772 pAnnotHandlerMgr->Annot_OnLButtonDown(this, pFXAnnot, nFlag, point); | 775 pAnnotHandlerMgr->Annot_OnLButtonDown(this, pFXAnnot, nFlag, point); |
| 773 if (bRet) | 776 if (bRet) |
| 774 SetFocusAnnot(pFXAnnot); | 777 SetFocusAnnot(pFXAnnot); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 825 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFocusAnnot, nFlag, point); | 828 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFocusAnnot, nFlag, point); |
| 826 } | 829 } |
| 827 if (pFXAnnot && !bRet) | 830 if (pFXAnnot && !bRet) |
| 828 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFXAnnot, nFlag, point); | 831 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFXAnnot, nFlag, point); |
| 829 return bRet; | 832 return bRet; |
| 830 } | 833 } |
| 831 | 834 |
| 832 FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { | 835 FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { |
| 833 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 836 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 834 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 837 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
| 835 if (CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y)) { | 838 if (CPDFSDK_Annot* pFXAnnot = GetFXAnnotAtPoint(point.x, point.y)) { |
| 836 if (m_CaptureWidget && m_CaptureWidget != pFXAnnot) { | 839 if (m_CaptureWidget && m_CaptureWidget != pFXAnnot) { |
| 837 m_bExitWidget = TRUE; | 840 m_bExitWidget = TRUE; |
| 838 m_bEnterWidget = FALSE; | 841 m_bEnterWidget = FALSE; |
| 839 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); | 842 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); |
| 840 } | 843 } |
| 841 m_CaptureWidget = (CPDFSDK_Widget*)pFXAnnot; | 844 m_CaptureWidget = pFXAnnot; |
| 842 m_bOnWidget = TRUE; | 845 m_bOnWidget = TRUE; |
| 843 if (!m_bEnterWidget) { | 846 if (!m_bEnterWidget) { |
| 844 m_bEnterWidget = TRUE; | 847 m_bEnterWidget = TRUE; |
| 845 m_bExitWidget = FALSE; | 848 m_bExitWidget = FALSE; |
| 846 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot, nFlag); | 849 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot, nFlag); |
| 847 } | 850 } |
| 848 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); | 851 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); |
| 849 return TRUE; | 852 return TRUE; |
| 850 } | 853 } |
| 851 if (m_bOnWidget) { | 854 if (m_bOnWidget) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1019 return pAnnot; | 1022 return pAnnot; |
| 1020 } | 1023 } |
| 1021 return nullptr; | 1024 return nullptr; |
| 1022 } | 1025 } |
| 1023 | 1026 |
| 1024 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 1027 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
| 1025 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; | 1028 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; |
| 1026 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 1029 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
| 1027 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 1030 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
| 1028 } | 1031 } |
| OLD | NEW |