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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 } | 765 } |
766 return nullptr; | 766 return nullptr; |
767 } | 767 } |
768 #endif // PDF_ENABLE_XFA | 768 #endif // PDF_ENABLE_XFA |
769 | 769 |
770 FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, | 770 FX_BOOL CPDFSDK_PageView::OnLButtonDown(const CFX_FloatPoint& point, |
771 FX_UINT nFlag) { | 771 FX_UINT nFlag) { |
772 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 772 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
773 ASSERT(pEnv); | 773 ASSERT(pEnv); |
774 CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y); | 774 CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y); |
| 775 |
775 if (!pFXAnnot) { | 776 if (!pFXAnnot) { |
776 KillFocusAnnot(nFlag); | 777 KillFocusAnnot(nFlag); |
777 return FALSE; | 778 return FALSE; |
778 } | 779 } |
779 | 780 |
780 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 781 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
781 FX_BOOL bRet = | 782 FX_BOOL bRet = |
782 pAnnotHandlerMgr->Annot_OnLButtonDown(this, pFXAnnot, nFlag, point); | 783 pAnnotHandlerMgr->Annot_OnLButtonDown(this, pFXAnnot, nFlag, point); |
783 if (bRet) | 784 if (bRet) |
784 SetFocusAnnot(pFXAnnot); | 785 SetFocusAnnot(pFXAnnot); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFocusAnnot, nFlag, point); | 840 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFocusAnnot, nFlag, point); |
840 } | 841 } |
841 if (pFXAnnot && !bRet) | 842 if (pFXAnnot && !bRet) |
842 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFXAnnot, nFlag, point); | 843 bRet = pAnnotHandlerMgr->Annot_OnLButtonUp(this, pFXAnnot, nFlag, point); |
843 return bRet; | 844 return bRet; |
844 } | 845 } |
845 | 846 |
846 FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { | 847 FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { |
847 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 848 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
848 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 849 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
849 if (CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y)) { | 850 if (CPDFSDK_Annot* pFXAnnot = GetFXAnnotAtPoint(point.x, point.y)) { |
850 if (m_CaptureWidget && m_CaptureWidget != pFXAnnot) { | 851 if (m_CaptureWidget && m_CaptureWidget != pFXAnnot) { |
851 m_bExitWidget = TRUE; | 852 m_bExitWidget = TRUE; |
852 m_bEnterWidget = FALSE; | 853 m_bEnterWidget = FALSE; |
853 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); | 854 pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag); |
854 } | 855 } |
855 m_CaptureWidget = (CPDFSDK_Widget*)pFXAnnot; | 856 m_CaptureWidget = pFXAnnot; |
856 m_bOnWidget = TRUE; | 857 m_bOnWidget = TRUE; |
857 if (!m_bEnterWidget) { | 858 if (!m_bEnterWidget) { |
858 m_bEnterWidget = TRUE; | 859 m_bEnterWidget = TRUE; |
859 m_bExitWidget = FALSE; | 860 m_bExitWidget = FALSE; |
860 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot, nFlag); | 861 pAnnotHandlerMgr->Annot_OnMouseEnter(this, pFXAnnot, nFlag); |
861 } | 862 } |
862 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); | 863 pAnnotHandlerMgr->Annot_OnMouseMove(this, pFXAnnot, nFlag, point); |
863 return TRUE; | 864 return TRUE; |
864 } | 865 } |
865 if (m_bOnWidget) { | 866 if (m_bOnWidget) { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1057 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 1058 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
1058 #ifdef PDF_ENABLE_XFA | 1059 #ifdef PDF_ENABLE_XFA |
1059 CPDF_Page* pPage = m_page->GetPDFPage(); | 1060 CPDF_Page* pPage = m_page->GetPDFPage(); |
1060 #else // PDF_ENABLE_XFA | 1061 #else // PDF_ENABLE_XFA |
1061 CPDF_Page* pPage = m_page; | 1062 CPDF_Page* pPage = m_page; |
1062 #endif // PDF_ENABLE_XFA | 1063 #endif // PDF_ENABLE_XFA |
1063 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 1064 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
1064 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 1065 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
1065 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 1066 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
1066 } | 1067 } |
OLD | NEW |