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 16 matching lines...) Expand all Loading... | |
27 FPDF_PAGE page) { | 27 FPDF_PAGE page) { |
28 if (!page) | 28 if (!page) |
29 return nullptr; | 29 return nullptr; |
30 | 30 |
31 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); | 31 CPDFSDK_Document* pSDKDoc = FormHandleToSDKDoc(hHandle); |
32 return pSDKDoc ? pSDKDoc->GetPageView((CPDF_Page*)page, TRUE) : nullptr; | 32 return pSDKDoc ? pSDKDoc->GetPageView((CPDF_Page*)page, TRUE) : nullptr; |
33 } | 33 } |
34 | 34 |
35 } // namespace | 35 } // namespace |
36 | 36 |
37 DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | 37 DLLEXPORT int STDCALL FPDFPage_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); |
jun_fang
2015/08/10 23:51:00
nit: p as a prefix represents a pointer. However,
Lei Zhang
2015/08/15 02:02:27
Done.
| |
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_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, | |
59 FPDF_PAGE page, | |
60 double page_x, | |
61 double page_y) { | |
62 return FPDFPage_HasFormFieldAtPoint(hHandle, page, page_x, page_y); | |
63 } | |
64 | |
65 DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, | |
66 FPDF_PAGE page, | |
67 double page_x, | |
68 double page_y) { | |
69 if (!page || !hHandle) | |
70 return -1; | |
71 | |
72 CPDF_Page* pPage = (CPDF_Page*)page; | |
73 CPDF_InterForm pInterForm(pPage->m_pDocument, FALSE); | |
jun_fang
2015/08/10 23:51:00
The same as above.
Lei Zhang
2015/08/15 02:02:28
Done.
| |
74 int z_order = -1; | |
75 (void)pInterForm.GetControlAtPoint(pPage, (FX_FLOAT)page_x, (FX_FLOAT)page_y, | |
76 &z_order); | |
77 return z_order; | |
78 } | |
79 | |
59 DLLEXPORT FPDF_FORMHANDLE STDCALL | 80 DLLEXPORT FPDF_FORMHANDLE STDCALL |
60 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, | 81 FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, |
61 FPDF_FORMFILLINFO* formInfo) { | 82 FPDF_FORMFILLINFO* formInfo) { |
62 if (!document || !formInfo || formInfo->version != 1) | 83 if (!document || !formInfo || formInfo->version != 1) |
63 return nullptr; | 84 return nullptr; |
64 | 85 |
65 CPDF_Document* pDocument = (CPDF_Document*)document; | 86 CPDF_Document* pDocument = (CPDF_Document*)document; |
66 CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); | 87 CPDFDoc_Environment* pEnv = new CPDFDoc_Environment(pDocument, formInfo); |
67 pEnv->SetSDKDocument(new CPDFSDK_Document(pDocument, pEnv)); | 88 pEnv->SetSDKDocument(new CPDFSDK_Document(pDocument, pEnv)); |
68 return pEnv; | 89 return pEnv; |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
321 } | 342 } |
322 } else { | 343 } else { |
323 bExistCAAction = aa.ActionExist(CPDF_AAction::ClosePage); | 344 bExistCAAction = aa.ActionExist(CPDF_AAction::ClosePage); |
324 if (bExistCAAction) { | 345 if (bExistCAAction) { |
325 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 346 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
326 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); | 347 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, pSDKDoc); |
327 } | 348 } |
328 } | 349 } |
329 } | 350 } |
330 } | 351 } |
OLD | NEW |