| 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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 CPDFSDK_AnnotIterator annotIterator(this, true); | 569 CPDFSDK_AnnotIterator annotIterator(this, true); |
| 570 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { | 570 while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) { |
| 571 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); | 571 CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = pEnv->GetAnnotHandlerMgr(); |
| 572 pAnnotHandlerMgr->Annot_OnDraw(this, pSDKAnnot, pDevice, pUser2Device, 0); | 572 pAnnotHandlerMgr->Annot_OnDraw(this, pSDKAnnot, pDevice, pUser2Device, 0); |
| 573 } | 573 } |
| 574 } | 574 } |
| 575 | 575 |
| 576 const CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX, | 576 const CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX, |
| 577 FX_FLOAT pageY) { | 577 FX_FLOAT pageY) { |
| 578 for (const auto& pAnnot : m_pAnnotList->All()) { | 578 for (const auto& pAnnot : m_pAnnotList->All()) { |
| 579 CFX_FloatRect annotRect; | 579 CFX_FloatRect annotRect = pAnnot->GetRect(); |
| 580 pAnnot->GetRect(annotRect); | |
| 581 if (annotRect.Contains(pageX, pageY)) | 580 if (annotRect.Contains(pageX, pageY)) |
| 582 return pAnnot.get(); | 581 return pAnnot.get(); |
| 583 } | 582 } |
| 584 return nullptr; | 583 return nullptr; |
| 585 } | 584 } |
| 586 | 585 |
| 587 const CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX, | 586 const CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX, |
| 588 FX_FLOAT pageY) { | 587 FX_FLOAT pageY) { |
| 589 for (const auto& pAnnot : m_pAnnotList->All()) { | 588 for (const auto& pAnnot : m_pAnnotList->All()) { |
| 590 if (pAnnot->GetSubType() == "Widget") { | 589 if (pAnnot->GetSubType() == "Widget") { |
| 591 CFX_FloatRect annotRect; | 590 CFX_FloatRect annotRect = pAnnot->GetRect(); |
| 592 pAnnot->GetRect(annotRect); | |
| 593 if (annotRect.Contains(pageX, pageY)) | 591 if (annotRect.Contains(pageX, pageY)) |
| 594 return pAnnot.get(); | 592 return pAnnot.get(); |
| 595 } | 593 } |
| 596 } | 594 } |
| 597 return nullptr; | 595 return nullptr; |
| 598 } | 596 } |
| 599 | 597 |
| 600 CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, | 598 CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX, |
| 601 FX_FLOAT pageY) { | 599 FX_FLOAT pageY) { |
| 602 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 600 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1050 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { | 1048 int CPDFSDK_PageView::GetPageIndexForStaticPDF() const { |
| 1051 #ifdef PDF_ENABLE_XFA | 1049 #ifdef PDF_ENABLE_XFA |
| 1052 CPDF_Page* pPage = m_page->GetPDFPage(); | 1050 CPDF_Page* pPage = m_page->GetPDFPage(); |
| 1053 #else // PDF_ENABLE_XFA | 1051 #else // PDF_ENABLE_XFA |
| 1054 CPDF_Page* pPage = m_page; | 1052 CPDF_Page* pPage = m_page; |
| 1055 #endif // PDF_ENABLE_XFA | 1053 #endif // PDF_ENABLE_XFA |
| 1056 CPDF_Dictionary* pDict = pPage->m_pFormDict; | 1054 CPDF_Dictionary* pDict = pPage->m_pFormDict; |
| 1057 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); | 1055 CPDF_Document* pDoc = m_pSDKDoc->GetPDFDocument(); |
| 1058 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; | 1056 return (pDoc && pDict) ? pDoc->GetPageIndex(pDict->GetObjNum()) : -1; |
| 1059 } | 1057 } |
| OLD | NEW |