| 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 "../../public/fpdf_formfill.h" | 7 #include "../../public/fpdf_formfill.h" |
| 8 #include "../../public/fpdfview.h" | 8 #include "../../public/fpdfview.h" |
| 9 #include "../../third_party/base/nonstd_unique_ptr.h" | 9 #include "../../third_party/base/nonstd_unique_ptr.h" |
| 10 #include "../include/fsdk_define.h" | 10 #include "../include/fsdk_define.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); | 35 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); |
| 36 return pSDKDoc ? pSDKDoc->GetPageView((CPDFXFA_Page*)page, TRUE) : nullptr; | 36 return pSDKDoc ? pSDKDoc->GetPageView((CPDFXFA_Page*)page, TRUE) : nullptr; |
| 37 } | 37 } |
| 38 | 38 |
| 39 } // namespace | 39 } // namespace |
| 40 | 40 |
| 41 DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | 41 DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, |
| 42 FPDF_PAGE page, | 42 FPDF_PAGE page, |
| 43 double page_x, | 43 double page_x, |
| 44 double page_y) { | 44 double page_y) { |
| 45 if (!page || !hHandle) | 45 if (!hHandle) |
| 46 return -1; | 46 return -1; |
| 47 | 47 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 48 CPDF_Page* pPage = ((CPDFXFA_Page*)page)->GetPDFPage(); | |
| 49 if (pPage) { | 48 if (pPage) { |
| 50 CPDF_InterForm interform(pPage->m_pDocument, FALSE); | 49 CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
| 51 CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( | 50 CPDF_FormControl* pFormCtrl = interform.GetControlAtPoint( |
| 52 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); | 51 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); |
| 53 if (!pFormCtrl) | 52 if (!pFormCtrl) |
| 54 return -1; | 53 return -1; |
| 55 | 54 |
| 56 CPDF_FormField* pFormField = pFormCtrl->GetField(); | 55 CPDF_FormField* pFormField = pFormCtrl->GetField(); |
| 57 if (!pFormField) | 56 if (!pFormField) |
| 58 return -1; | 57 return -1; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 FPDF_PAGE page, | 107 FPDF_PAGE page, |
| 109 double page_x, | 108 double page_x, |
| 110 double page_y) { | 109 double page_y) { |
| 111 return FPDFPage_HasFormFieldAtPoint(hHandle, page, page_x, page_y); | 110 return FPDFPage_HasFormFieldAtPoint(hHandle, page, page_x, page_y); |
| 112 } | 111 } |
| 113 | 112 |
| 114 DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, | 113 DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, |
| 115 FPDF_PAGE page, | 114 FPDF_PAGE page, |
| 116 double page_x, | 115 double page_x, |
| 117 double page_y) { | 116 double page_y) { |
| 118 if (!page || !hHandle) | 117 if (!hHandle) |
| 119 return -1; | 118 return -1; |
| 120 | 119 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 121 CPDF_Page* pPage = (CPDF_Page*)page; | 120 if (!pPage) |
| 121 return -1; |
| 122 CPDF_InterForm interform(pPage->m_pDocument, FALSE); | 122 CPDF_InterForm interform(pPage->m_pDocument, FALSE); |
| 123 int z_order = -1; | 123 int z_order = -1; |
| 124 (void)interform.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, | 124 (void)interform.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, |
| 125 &z_order); | 125 &z_order); |
| 126 return z_order; | 126 return z_order; |
| 127 } | 127 } |
| 128 | 128 |
| 129 DLLEXPORT FPDF_FORMHANDLE STDCALL | 129 DLLEXPORT FPDF_FORMHANDLE STDCALL |
| 130 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, | 130 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, |
| 131 FPDF_FORMFILLINFO* formInfo) { | 131 FPDF_FORMFILLINFO* formInfo) { |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 } | 675 } |
| 676 } else { | 676 } else { |
| 677 bExistCAAction = aa.ActionExist(CPDF_AAction::ClosePage); | 677 bExistCAAction = aa.ActionExist(CPDF_AAction::ClosePage); |
| 678 if (bExistCAAction) { | 678 if (bExistCAAction) { |
| 679 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 679 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 680 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 680 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
| 681 } | 681 } |
| 682 } | 682 } |
| 683 } | 683 } |
| 684 } | 684 } |
| OLD | NEW |