OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cpdfsdk_widgethandler.h" | 7 #include "fpdfsdk/cpdfsdk_widgethandler.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 CPDF_Page* pPage = pWidget->GetPDFPage(); | 48 CPDF_Page* pPage = pWidget->GetPDFPage(); |
49 CPDF_Document* pDocument = pPage->m_pDocument; | 49 CPDF_Document* pDocument = pPage->m_pDocument; |
50 uint32_t dwPermissions = pDocument->GetUserPermissions(); | 50 uint32_t dwPermissions = pDocument->GetUserPermissions(); |
51 return (dwPermissions & FPDFPERM_FILL_FORM) || | 51 return (dwPermissions & FPDFPERM_FILL_FORM) || |
52 (dwPermissions & FPDFPERM_ANNOT_FORM); | 52 (dwPermissions & FPDFPERM_ANNOT_FORM); |
53 } | 53 } |
54 | 54 |
55 CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CPDF_Annot* pAnnot, | 55 CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CPDF_Annot* pAnnot, |
56 CPDFSDK_PageView* pPage) { | 56 CPDFSDK_PageView* pPage) { |
57 CPDFSDK_Document* pSDKDoc = m_pEnv->GetSDKDocument(); | 57 CPDFSDK_InterForm* pInterForm = m_pEnv->GetSDKDocument()->GetInterForm(); |
58 CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm(); | |
59 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl( | 58 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl( |
60 pInterForm->GetInterForm(), pAnnot->GetAnnotDict()); | 59 pInterForm->GetInterForm(), pAnnot->GetAnnotDict()); |
61 if (!pCtrl) | 60 if (!pCtrl) |
62 return nullptr; | 61 return nullptr; |
63 | 62 |
64 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); | 63 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); |
65 pInterForm->AddMap(pCtrl, pWidget); | 64 pInterForm->AddMap(pCtrl, pWidget); |
66 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 65 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
67 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) | 66 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) |
68 pWidget->ResetAppearance(nullptr, FALSE); | 67 pWidget->ResetAppearance(nullptr, FALSE); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 | 295 |
297 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, | 296 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, |
298 CPDFSDK_Annot* pAnnot, | 297 CPDFSDK_Annot* pAnnot, |
299 const CFX_FloatPoint& point) { | 298 const CFX_FloatPoint& point) { |
300 ASSERT(pPageView); | 299 ASSERT(pPageView); |
301 ASSERT(pAnnot); | 300 ASSERT(pAnnot); |
302 | 301 |
303 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); | 302 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
304 return rect.Contains(point.x, point.y); | 303 return rect.Contains(point.x, point.y); |
305 } | 304 } |
OLD | NEW |