| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "fpdfsdk/include/fsdk_mgr.h" | 9 #include "fpdfsdk/include/fsdk_mgr.h" |
| 10 | 10 |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 m_pAnnotList.reset(); | 631 m_pAnnotList.reset(); |
| 632 } | 632 } |
| 633 | 633 |
| 634 void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, | 634 void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice, |
| 635 CPDF_Matrix* pUser2Device, | 635 CPDF_Matrix* pUser2Device, |
| 636 CPDF_RenderOptions* pOptions, | 636 CPDF_RenderOptions* pOptions, |
| 637 const FX_RECT& pClip) { | 637 const FX_RECT& pClip) { |
| 638 m_curMatrix = *pUser2Device; | 638 m_curMatrix = *pUser2Device; |
| 639 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 639 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 640 CPDFXFA_Page* pPage = GetPDFXFAPage(); | 640 CPDFXFA_Page* pPage = GetPDFXFAPage(); |
| 641 | |
| 642 if (pPage == NULL) | 641 if (pPage == NULL) |
| 643 return; | 642 return; |
| 644 | 643 |
| 645 #ifdef PDF_ENABLE_XFA | 644 #ifdef PDF_ENABLE_XFA |
| 646 if (pPage->GetDocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { | 645 if (pPage->GetDocument()->GetDocType() == DOCTYPE_DYNAMIC_XFA) { |
| 647 CFX_Graphics gs; | 646 CFX_Graphics gs; |
| 648 gs.Create(pDevice); | 647 gs.Create(pDevice); |
| 649 CFX_RectF rectClip; | 648 CFX_RectF rectClip; |
| 650 rectClip.Set(static_cast<FX_FLOAT>(pClip.left), | 649 rectClip.Set(static_cast<FX_FLOAT>(pClip.left), |
| 651 static_cast<FX_FLOAT>(pClip.top), | 650 static_cast<FX_FLOAT>(pClip.top), |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 | 710 |
| 712 return nullptr; | 711 return nullptr; |
| 713 } | 712 } |
| 714 | 713 |
| 715 CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, | 714 CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX, |
| 716 FX_FLOAT pageY) { | 715 FX_FLOAT pageY) { |
| 717 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 716 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| 718 CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); | 717 CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr(); |
| 719 CPDFSDK_AnnotIterator annotIterator(this, false); | 718 CPDFSDK_AnnotIterator annotIterator(this, false); |
| 720 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { | 719 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { |
| 721 if (pSDKAnnot->GetType() == "Widget" || | 720 bool bHitTest = pSDKAnnot->GetType() == "Widget"; |
| 722 pSDKAnnot->GetType() == FSDK_XFAWIDGET_TYPENAME) { | 721 bHitTest = bHitTest || pSDKAnnot->GetType() == FSDK_XFAWIDGET_TYPENAME; |
| 722 if (bHitTest) { |
| 723 pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); | 723 pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot); |
| 724 CPDF_Point point(pageX, pageY); | 724 CPDF_Point point(pageX, pageY); |
| 725 if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot, point)) | 725 if (pAnnotMgr->Annot_OnHitTest(this, pSDKAnnot, point)) |
| 726 return pSDKAnnot; | 726 return pSDKAnnot; |
| 727 } | 727 } |
| 728 } | 728 } |
| 729 | 729 |
| 730 return nullptr; | 730 return nullptr; |
| 731 } | 731 } |
| 732 | 732 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 if (m_page) { | 808 if (m_page) { |
| 809 return m_page->GetDocument()->GetPDFDoc(); | 809 return m_page->GetDocument()->GetPDFDoc(); |
| 810 } | 810 } |
| 811 return NULL; | 811 return NULL; |
| 812 } | 812 } |
| 813 | 813 |
| 814 CPDF_Page* CPDFSDK_PageView::GetPDFPage() { | 814 CPDF_Page* CPDFSDK_PageView::GetPDFPage() { |
| 815 if (m_page) { | 815 if (m_page) { |
| 816 return m_page->GetPDFPage(); | 816 return m_page->GetPDFPage(); |
| 817 } | 817 } |
| 818 | |
| 819 return NULL; | 818 return NULL; |
| 820 } | 819 } |
| 821 | 820 |
| 822 size_t CPDFSDK_PageView::CountAnnots() const { | 821 size_t CPDFSDK_PageView::CountAnnots() const { |
| 823 return m_fxAnnotArray.size(); | 822 return m_fxAnnotArray.size(); |
| 824 } | 823 } |
| 825 | 824 |
| 826 CPDFSDK_Annot* CPDFSDK_PageView::GetAnnot(size_t nIndex) { | 825 CPDFSDK_Annot* CPDFSDK_PageView::GetAnnot(size_t nIndex) { |
| 827 return nIndex < m_fxAnnotArray.size() ? m_fxAnnotArray[nIndex] : nullptr; | 826 return nIndex < m_fxAnnotArray.size() ? m_fxAnnotArray[nIndex] : nullptr; |
| 828 } | 827 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1080 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); | 1079 CPDFSDK_Annot* pFocusAnnot = m_pSDKDoc->GetFocusAnnot(); |
| 1081 if (!pFocusAnnot) | 1080 if (!pFocusAnnot) |
| 1082 return nullptr; | 1081 return nullptr; |
| 1083 | 1082 |
| 1084 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { | 1083 for (CPDFSDK_Annot* pAnnot : m_fxAnnotArray) { |
| 1085 if (pAnnot == pFocusAnnot) | 1084 if (pAnnot == pFocusAnnot) |
| 1086 return pAnnot; | 1085 return pAnnot; |
| 1087 } | 1086 } |
| 1088 return nullptr; | 1087 return nullptr; |
| 1089 } | 1088 } |
| OLD | NEW |