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->GetAnnotSubtype() == "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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFocusAnnot, nFlag, point); | 828 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFocusAnnot, nFlag, point); |
827 } | 829 } |
828 if (pFXAnnot && !bRet) | 830 if (pFXAnnot && !bRet) |
829 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFXAnnot, nFlag, point); | 831 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFXAnnot, nFlag, point); |
830 return bRet; | 832 return bRet; |
831 } | 833 } |
832 | 834 |
833 FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { | 835 FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { |
834 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 836 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
835 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 837 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
836 if (CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y)) { | 838 if (CPDFSDK_Annot* pFXAnnot = GetFXAnnotAtPoint(point.x, point.y)) { |
837 if (m_CaptureWidget && m_CaptureWidget != pFXAnnot) { | 839 if (m_CaptureWidget && m_CaptureWidget != pFXAnnot) { |
838 m_bExitWidget = TRUE; | 840 m_bExitWidget = TRUE; |
839 m_bEnterWidget = FALSE; | 841 m_bEnterWidget = FALSE; |
840 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); | 842 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); |
841 } | 843 } |
842 m_CaptureWidget = (CPDFSDK_Widget*)pFXAnnot; | 844 m_CaptureWidget = pFXAnnot; |
843 m_bOnWidget = TRUE; | 845 m_bOnWidget = TRUE; |
844 if (!m_bEnterWidget) { | 846 if (!m_bEnterWidget) { |
845 m_bEnterWidget = TRUE; | 847 m_bEnterWidget = TRUE; |
846 m_bExitWidget = FALSE; | 848 m_bExitWidget = FALSE; |
847 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot, nFlag); | 849 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot, nFlag); |
848 } | 850 } |
849 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); | 851 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); |
850 return TRUE; | 852 return TRUE; |
851 } | 853 } |
852 if (m_bOnWidget) { | 854 if (m_bOnWidget) { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 return pAnnot; | 1022 return pAnnot; |
1021 } | 1023 } |
1022 return nullptr; | 1024 return nullptr; |
1023 } | 1025 } |
1024 | 1026 |
1025 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 1027 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
1026 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; | 1028 CPDF_Dictionary* pDict = GetPDFPage()->m_pFormDict; |
1027 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 1029 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
1028 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 1030 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
1029 } | 1031 } |
OLD | NEW |