Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 } | 33 } |
| 34 | 34 |
| 35 } // namespace | 35 } // namespace |
| 36 | 36 |
| 37 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | 37 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, |
| 38 FPDF_PAGE page, | 38 FPDF_PAGE page, |
| 39 double page_x, | 39 double page_x, |
| 40 double page_y) { | 40 double page_y) { |
| 41 if (!page || !hHandle) | 41 if (!page || !hHandle) |
| 42 return -1; | 42 return -1; |
| 43 | |
| 43 CPDF_Page* pPage = (CPDF_Page*)page; | 44 CPDF_Page* pPage = (CPDF_Page*)page; |
| 44 | 45 CPDF_InterForm pInterForm(pPage->m_pDocument, FALSE); |
| 45 nonstd::unique_ptr<CPDF_InterForm> pInterForm( | 46 CPDF_FormControl* pFormCtrl = pInterForm.GetControlAtPoint( |
| 46 new CPDF_InterForm(pPage->m_pDocument, FALSE)); | 47 pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, nullptr); |
| 47 CPDF_FormControl* pFormCtrl = | |
| 48 pInterForm->GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y); | |
| 49 if (!pFormCtrl) | 48 if (!pFormCtrl) |
| 50 return -1; | 49 return -1; |
| 51 | 50 |
| 52 CPDF_FormField* pFormField = pFormCtrl->GetField(); | 51 CPDF_FormField* pFormField = pFormCtrl->GetField(); |
| 53 if (!pFormField) | 52 if (!pFormField) |
| 54 return -1; | 53 return -1; |
| 55 | 54 |
| 56 return pFormField->GetFieldType(); | 55 return pFormField->GetFieldType(); |
| 57 } | 56 } |
| 58 | 57 |
| 58 DLLEXPORT int STDCALL FPDPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, | |
|
Tom Sepez
2015/08/07 18:14:06
nit: I never noticed these entry points were named
Lei Zhang
2015/08/07 23:03:41
I'll fix it but retain the old one.
| |
| 59 FPDF_PAGE page, | |
| 60 double page_x, | |
| 61 double page_y) { | |
| 62 if (!page || !hHandle) | |
| 63 return -1; | |
| 64 | |
| 65 CPDF_Page* pPage = (CPDF_Page*)page; | |
| 66 CPDF_InterForm pInterForm(pPage->m_pDocument, FALSE); | |
| 67 int z_order = -1; | |
| 68 pInterForm.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, | |
| 69 &z_order); | |
| 70 return z_order; | |
| 71 } | |
| 72 | |
| 59 DLLEXPORT FPDF_FORMHANDLE STDCALL | 73 DLLEXPORT FPDF_FORMHANDLE STDCALL |
| 60 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, | 74 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, |
| 61 FPDF_FORMFILLINFO* formInfo) { | 75 FPDF_FORMFILLINFO* formInfo) { |
| 62 if (!document || !formInfo || formInfo->version != 1) | 76 if (!document || !formInfo || formInfo->version != 1) |
| 63 return nullptr; | 77 return nullptr; |
| 64 | 78 |
| 65 CPDF_Document* pDocument = (CPDF_Document*)document; | 79 CPDF_Document* pDocument = (CPDF_Document*)document; |
| 66 CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); | 80 CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); |
| 67 pEnv->SetSDKDocument(new CPDFSDK_Document(pDocument, pEnv)); | 81 pEnv->SetSDKDocument(new CPDFSDK_Document(pDocument, pEnv)); |
| 68 return pEnv; | 82 return pEnv; |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 } | 335 } |
| 322 } else { | 336 } else { |
| 323 bExistCAAction = aa.ActionExist(CPDF_AAction::ClosePage); | 337 bExistCAAction = aa.ActionExist(CPDF_AAction::ClosePage); |
| 324 if (bExistCAAction) { | 338 if (bExistCAAction) { |
| 325 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 339 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
| 326 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 340 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
| 327 } | 341 } |
| 328 } | 342 } |
| 329 } | 343 } |
| 330 } | 344 } |
| OLD | NEW |