John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Lei Zhang | b4e7f30 | 2015-11-06 15:52:32 -0800 | [diff] [blame] | 7 | #include "public/fpdf_formfill.h" |
| 8 | |
Lei Zhang | aa8bf7e | 2015-12-24 19:13:32 -0800 | [diff] [blame] | 9 | #include <memory> |
Tom Sepez | ab27768 | 2016-02-17 10:07:21 -0800 | [diff] [blame] | 10 | #include <vector> |
Lei Zhang | aa8bf7e | 2015-12-24 19:13:32 -0800 | [diff] [blame] | 11 | |
dsinclair | 41872fa | 2016-10-04 11:29:35 -0700 | [diff] [blame] | 12 | #include "core/fpdfapi/page/cpdf_page.h" |
Lei Zhang | 8153561 | 2018-10-09 21:15:17 +0000 | [diff] [blame] | 13 | #include "core/fpdfapi/parser/cpdf_dictionary.h" |
dsinclair | 488b7ad | 2016-10-04 11:55:50 -0700 | [diff] [blame] | 14 | #include "core/fpdfapi/parser/cpdf_document.h" |
dsinclair | 69d9c68 | 2016-10-04 12:18:35 -0700 | [diff] [blame] | 15 | #include "core/fpdfapi/render/cpdf_renderoptions.h" |
dsinclair | 1727aee | 2016-09-29 13:12:56 -0700 | [diff] [blame] | 16 | #include "core/fpdfdoc/cpdf_formcontrol.h" |
| 17 | #include "core/fpdfdoc/cpdf_formfield.h" |
Lei Zhang | c345065 | 2018-10-11 16:54:42 +0000 | [diff] [blame] | 18 | #include "core/fpdfdoc/cpdf_interactiveform.h" |
dsinclair | 1727aee | 2016-09-29 13:12:56 -0700 | [diff] [blame] | 19 | #include "core/fpdfdoc/cpdf_occontext.h" |
Dan Sinclair | a5085d4 | 2017-05-11 16:26:50 -0400 | [diff] [blame] | 20 | #include "core/fxge/cfx_defaultrenderdevice.h" |
Dan Sinclair | 7d12532 | 2018-03-28 18:49:34 +0000 | [diff] [blame] | 21 | #include "fpdfsdk/cpdfsdk_actionhandler.h" |
dsinclair | 735606d | 2016-10-05 15:47:02 -0700 | [diff] [blame] | 22 | #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
Dan Sinclair | 00d47a6 | 2018-03-28 18:39:04 +0000 | [diff] [blame] | 23 | #include "fpdfsdk/cpdfsdk_helpers.h" |
Lei Zhang | c345065 | 2018-10-11 16:54:42 +0000 | [diff] [blame] | 24 | #include "fpdfsdk/cpdfsdk_interactiveform.h" |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 25 | #include "fpdfsdk/cpdfsdk_pageview.h" |
Lei Zhang | b4e7f30 | 2015-11-06 15:52:32 -0800 | [diff] [blame] | 26 | #include "public/fpdfview.h" |
tsepez | 36eb4bd | 2016-10-03 15:24:27 -0700 | [diff] [blame] | 27 | #include "third_party/base/ptr_util.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 28 | |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 29 | #ifdef PDF_ENABLE_XFA |
dsinclair | 521b750 | 2016-11-02 13:02:28 -0700 | [diff] [blame] | 30 | #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
dsinclair | 4d29e78 | 2016-10-04 14:02:47 -0700 | [diff] [blame] | 31 | #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" |
Dan Sinclair | 80c4878 | 2017-03-23 12:11:20 -0400 | [diff] [blame] | 32 | #include "xfa/fxfa/cxfa_ffdocview.h" |
| 33 | #include "xfa/fxfa/cxfa_ffpageview.h" |
| 34 | #include "xfa/fxfa/cxfa_ffwidget.h" |
Dan Sinclair | cdba747 | 2017-03-23 09:17:10 -0400 | [diff] [blame] | 35 | |
Ryan Harrison | c3cc2ab | 2018-06-21 21:09:54 +0000 | [diff] [blame] | 36 | static_assert(static_cast<int>(AlertButton::kDefault) == |
| 37 | JSPLATFORM_ALERT_BUTTON_DEFAULT, |
| 38 | "Default alert button types must match"); |
| 39 | static_assert(static_cast<int>(AlertButton::kOK) == JSPLATFORM_ALERT_BUTTON_OK, |
| 40 | "OK alert button types must match"); |
| 41 | static_assert(static_cast<int>(AlertButton::kOKCancel) == |
| 42 | JSPLATFORM_ALERT_BUTTON_OKCANCEL, |
| 43 | "OKCancel alert button types must match"); |
| 44 | static_assert(static_cast<int>(AlertButton::kYesNo) == |
| 45 | JSPLATFORM_ALERT_BUTTON_YESNO, |
| 46 | "YesNo alert button types must match"); |
| 47 | static_assert(static_cast<int>(AlertButton::kYesNoCancel) == |
| 48 | JSPLATFORM_ALERT_BUTTON_YESNOCANCEL, |
| 49 | "YesNoCancel alert button types must match"); |
| 50 | |
| 51 | static_assert(static_cast<int>(AlertIcon::kDefault) == |
| 52 | JSPLATFORM_ALERT_ICON_DEFAULT, |
| 53 | "Default alert icon types must match"); |
| 54 | static_assert(static_cast<int>(AlertIcon::kError) == |
| 55 | JSPLATFORM_ALERT_ICON_ERROR, |
| 56 | "Error alert icon types must match"); |
| 57 | static_assert(static_cast<int>(AlertIcon::kWarning) == |
| 58 | JSPLATFORM_ALERT_ICON_WARNING, |
| 59 | "Warning alert icon types must match"); |
| 60 | static_assert(static_cast<int>(AlertIcon::kQuestion) == |
| 61 | JSPLATFORM_ALERT_ICON_QUESTION, |
| 62 | "Question alert icon types must match"); |
| 63 | static_assert(static_cast<int>(AlertIcon::kStatus) == |
| 64 | JSPLATFORM_ALERT_ICON_STATUS, |
| 65 | "Status alert icon types must match"); |
| 66 | static_assert(static_cast<int>(AlertIcon::kAsterisk) == |
| 67 | JSPLATFORM_ALERT_ICON_ASTERISK, |
| 68 | "Asterisk alert icon types must match"); |
| 69 | |
| 70 | static_assert(static_cast<int>(AlertReturn::kOK) == JSPLATFORM_ALERT_RETURN_OK, |
| 71 | "OK alert return types must match"); |
| 72 | static_assert(static_cast<int>(AlertReturn::kCancel) == |
| 73 | JSPLATFORM_ALERT_RETURN_CANCEL, |
| 74 | "Cancel alert return types must match"); |
| 75 | static_assert(static_cast<int>(AlertReturn::kNo) == JSPLATFORM_ALERT_RETURN_NO, |
| 76 | "No alert return types must match"); |
| 77 | static_assert(static_cast<int>(AlertReturn::kYes) == |
| 78 | JSPLATFORM_ALERT_RETURN_YES, |
| 79 | "Yes alert return types must match"); |
| 80 | |
Ryan Harrison | 854d71c | 2017-10-18 12:28:14 -0400 | [diff] [blame] | 81 | static_assert(static_cast<int>(FormType::kNone) == FORMTYPE_NONE, |
| 82 | "None form types must match"); |
| 83 | static_assert(static_cast<int>(FormType::kAcroForm) == FORMTYPE_ACRO_FORM, |
| 84 | "AcroForm form types must match"); |
| 85 | static_assert(static_cast<int>(FormType::kXFAFull) == FORMTYPE_XFA_FULL, |
| 86 | "XFA full form types must match"); |
| 87 | static_assert(static_cast<int>(FormType::kXFAForeground) == |
| 88 | FORMTYPE_XFA_FOREGROUND, |
| 89 | "XFA foreground form types must match"); |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 90 | #endif // PDF_ENABLE_XFA |
| 91 | |
Ryan Harrison | 9baf31f | 2018-01-12 18:36:30 +0000 | [diff] [blame] | 92 | static_assert(static_cast<int>(FormFieldType::kUnknown) == |
| 93 | FPDF_FORMFIELD_UNKNOWN, |
| 94 | "Unknown form field types must match"); |
| 95 | static_assert(static_cast<int>(FormFieldType::kPushButton) == |
| 96 | FPDF_FORMFIELD_PUSHBUTTON, |
| 97 | "PushButton form field types must match"); |
| 98 | static_assert(static_cast<int>(FormFieldType::kCheckBox) == |
| 99 | FPDF_FORMFIELD_CHECKBOX, |
| 100 | "CheckBox form field types must match"); |
| 101 | static_assert(static_cast<int>(FormFieldType::kRadioButton) == |
| 102 | FPDF_FORMFIELD_RADIOBUTTON, |
| 103 | "RadioButton form field types must match"); |
| 104 | static_assert(static_cast<int>(FormFieldType::kComboBox) == |
| 105 | FPDF_FORMFIELD_COMBOBOX, |
| 106 | "ComboBox form field types must match"); |
| 107 | static_assert(static_cast<int>(FormFieldType::kListBox) == |
| 108 | FPDF_FORMFIELD_LISTBOX, |
| 109 | "ListBox form field types must match"); |
| 110 | static_assert(static_cast<int>(FormFieldType::kTextField) == |
| 111 | FPDF_FORMFIELD_TEXTFIELD, |
| 112 | "TextField form field types must match"); |
| 113 | static_assert(static_cast<int>(FormFieldType::kSignature) == |
| 114 | FPDF_FORMFIELD_SIGNATURE, |
| 115 | "Signature form field types must match"); |
| 116 | #ifdef PDF_ENABLE_XFA |
| 117 | static_assert(static_cast<int>(FormFieldType::kXFA) == FPDF_FORMFIELD_XFA, |
| 118 | "XFA form field types must match"); |
Ryan Harrison | 2056fac | 2018-01-16 16:06:45 +0000 | [diff] [blame] | 119 | static_assert(static_cast<int>(FormFieldType::kXFA_CheckBox) == |
| 120 | FPDF_FORMFIELD_XFA_CHECKBOX, |
| 121 | "XFA CheckBox form field types must match"); |
| 122 | static_assert(static_cast<int>(FormFieldType::kXFA_ComboBox) == |
| 123 | FPDF_FORMFIELD_XFA_COMBOBOX, |
| 124 | "XFA ComboBox form field types must match"); |
| 125 | static_assert(static_cast<int>(FormFieldType::kXFA_ImageField) == |
| 126 | FPDF_FORMFIELD_XFA_IMAGEFIELD, |
| 127 | "XFA ImageField form field types must match"); |
| 128 | static_assert(static_cast<int>(FormFieldType::kXFA_ListBox) == |
| 129 | FPDF_FORMFIELD_XFA_LISTBOX, |
| 130 | "XFA ListBox form field types must match"); |
| 131 | static_assert(static_cast<int>(FormFieldType::kXFA_PushButton) == |
| 132 | FPDF_FORMFIELD_XFA_PUSHBUTTON, |
| 133 | "XFA PushButton form field types must match"); |
| 134 | static_assert(static_cast<int>(FormFieldType::kXFA_Signature) == |
| 135 | FPDF_FORMFIELD_XFA_SIGNATURE, |
| 136 | "XFA Signature form field types must match"); |
| 137 | static_assert(static_cast<int>(FormFieldType::kXFA_TextField) == |
| 138 | FPDF_FORMFIELD_XFA_TEXTFIELD, |
| 139 | "XFA TextField form field types must match"); |
Ryan Harrison | 9baf31f | 2018-01-12 18:36:30 +0000 | [diff] [blame] | 140 | #endif // PDF_ENABLE_XFA |
| 141 | static_assert(kFormFieldTypeCount == FPDF_FORMFIELD_COUNT, |
| 142 | "Number of form field types must match"); |
| 143 | |
Tom Sepez | dcbc02f | 2015-07-17 09:16:17 -0700 | [diff] [blame] | 144 | namespace { |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 145 | |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 146 | CPDFSDK_InteractiveForm* FormHandleToInteractiveForm(FPDF_FORMHANDLE hHandle) { |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 147 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 148 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 149 | return pFormFillEnv ? pFormFillEnv->GetInteractiveForm() : nullptr; |
Tom Sepez | dcbc02f | 2015-07-17 09:16:17 -0700 | [diff] [blame] | 150 | } |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 151 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 152 | CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, |
Tom Sepez | dae73f5 | 2018-06-13 17:54:57 +0000 | [diff] [blame] | 153 | FPDF_PAGE fpdf_page) { |
| 154 | IPDF_Page* pPage = IPDFPageFromFPDFPage(fpdf_page); |
Tom Sepez | 540c436 | 2015-11-24 13:33:57 -0800 | [diff] [blame] | 155 | if (!pPage) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 156 | return nullptr; |
Tom Sepez | 0b13398 | 2015-07-28 11:23:22 -0700 | [diff] [blame] | 157 | |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 158 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 159 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 160 | return pFormFillEnv ? pFormFillEnv->GetPageView(pPage, true) : nullptr; |
Tom Sepez | dcbc02f | 2015-07-17 09:16:17 -0700 | [diff] [blame] | 161 | } |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 162 | |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 163 | void FFLCommon(FPDF_FORMHANDLE hHandle, |
| 164 | FPDF_BITMAP bitmap, |
| 165 | FPDF_RECORDER recorder, |
Tom Sepez | dae73f5 | 2018-06-13 17:54:57 +0000 | [diff] [blame] | 166 | FPDF_PAGE fpdf_page, |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 167 | int start_x, |
| 168 | int start_y, |
| 169 | int size_x, |
| 170 | int size_y, |
| 171 | int rotate, |
| 172 | int flags) { |
| 173 | if (!hHandle) |
| 174 | return; |
| 175 | |
Tom Sepez | dae73f5 | 2018-06-13 17:54:57 +0000 | [diff] [blame] | 176 | IPDF_Page* pPage = IPDFPageFromFPDFPage(fpdf_page); |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 177 | if (!pPage) |
| 178 | return; |
| 179 | |
Tom Sepez | ca027339 | 2018-05-25 23:37:50 +0000 | [diff] [blame] | 180 | CPDF_Document* pPDFDoc = pPage->GetDocument(); |
Tom Sepez | dae73f5 | 2018-06-13 17:54:57 +0000 | [diff] [blame] | 181 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, fpdf_page); |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 182 | |
Lei Zhang | c4242b2 | 2018-04-12 15:50:49 +0000 | [diff] [blame] | 183 | const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y); |
| 184 | CFX_Matrix matrix = pPage->GetDisplayMatrix(rect, rotate); |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 185 | |
Dan Sinclair | a5085d4 | 2017-05-11 16:26:50 -0400 | [diff] [blame] | 186 | auto pDevice = pdfium::MakeUnique<CFX_DefaultRenderDevice>(); |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 187 | #ifdef _SKIA_SUPPORT_ |
| 188 | pDevice->AttachRecorder(static_cast<SkPictureRecorder*>(recorder)); |
| 189 | #endif |
Tom Sepez | dae73f5 | 2018-06-13 17:54:57 +0000 | [diff] [blame] | 190 | |
Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 191 | RetainPtr<CFX_DIBitmap> holder(CFXDIBitmapFromFPDFBitmap(bitmap)); |
Tom Sepez | f0799fe | 2017-03-28 09:31:32 -0700 | [diff] [blame] | 192 | pDevice->Attach(holder, false, nullptr, false); |
Tom Sepez | 1629f60 | 2017-04-21 14:11:26 -0700 | [diff] [blame] | 193 | { |
| 194 | CFX_RenderDevice::StateRestorer restorer(pDevice.get()); |
Lei Zhang | c4242b2 | 2018-04-12 15:50:49 +0000 | [diff] [blame] | 195 | pDevice->SetClip_Rect(rect); |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 196 | |
Tom Sepez | 1629f60 | 2017-04-21 14:11:26 -0700 | [diff] [blame] | 197 | CPDF_RenderOptions options; |
Dan Sinclair | 921fe6b | 2017-10-05 11:14:12 -0400 | [diff] [blame] | 198 | uint32_t option_flags = options.GetFlags(); |
Tom Sepez | 1629f60 | 2017-04-21 14:11:26 -0700 | [diff] [blame] | 199 | if (flags & FPDF_LCD_TEXT) |
Dan Sinclair | 921fe6b | 2017-10-05 11:14:12 -0400 | [diff] [blame] | 200 | option_flags |= RENDER_CLEARTYPE; |
Tom Sepez | 1629f60 | 2017-04-21 14:11:26 -0700 | [diff] [blame] | 201 | else |
Dan Sinclair | 921fe6b | 2017-10-05 11:14:12 -0400 | [diff] [blame] | 202 | option_flags &= ~RENDER_CLEARTYPE; |
| 203 | options.SetFlags(option_flags); |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 204 | |
Tom Sepez | 1629f60 | 2017-04-21 14:11:26 -0700 | [diff] [blame] | 205 | // Grayscale output |
Dan Sinclair | f55e72e | 2017-07-13 14:53:28 -0400 | [diff] [blame] | 206 | if (flags & FPDF_GRAYSCALE) |
Dan Sinclair | 921fe6b | 2017-10-05 11:14:12 -0400 | [diff] [blame] | 207 | options.SetColorMode(CPDF_RenderOptions::kGray); |
Dan Sinclair | f55e72e | 2017-07-13 14:53:28 -0400 | [diff] [blame] | 208 | |
Dan Sinclair | 921fe6b | 2017-10-05 11:14:12 -0400 | [diff] [blame] | 209 | options.SetDrawAnnots(flags & FPDF_ANNOT); |
Dan Sinclair | 921fe6b | 2017-10-05 11:14:12 -0400 | [diff] [blame] | 210 | options.SetOCContext( |
| 211 | pdfium::MakeRetain<CPDF_OCContext>(pPDFDoc, CPDF_OCContext::View)); |
Tom Sepez | ca027339 | 2018-05-25 23:37:50 +0000 | [diff] [blame] | 212 | |
Tom Sepez | 45a5524 | 2018-05-25 23:57:13 +0000 | [diff] [blame] | 213 | if (pPageView) |
Lei Zhang | 09ee087 | 2018-10-09 19:13:55 +0000 | [diff] [blame] | 214 | pPageView->PageView_OnDraw(pDevice.get(), matrix, &options, rect); |
Tom Sepez | 1629f60 | 2017-04-21 14:11:26 -0700 | [diff] [blame] | 215 | } |
Tom Sepez | dae73f5 | 2018-06-13 17:54:57 +0000 | [diff] [blame] | 216 | |
caryclark | 8f87550 | 2016-12-06 13:49:34 -0800 | [diff] [blame] | 217 | #ifdef _SKIA_SUPPORT_PATHS_ |
Cary Clark | 364d18b | 2017-07-25 10:39:10 -0400 | [diff] [blame] | 218 | pDevice->Flush(true); |
Tom Sepez | f0799fe | 2017-03-28 09:31:32 -0700 | [diff] [blame] | 219 | holder->UnPreMultiply(); |
caryclark | 687fbde | 2016-11-22 12:44:25 -0800 | [diff] [blame] | 220 | #endif |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 221 | } |
| 222 | |
Tom Sepez | dcbc02f | 2015-07-17 09:16:17 -0700 | [diff] [blame] | 223 | } // namespace |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 224 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 225 | FPDF_EXPORT int FPDF_CALLCONV |
| 226 | FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, |
| 227 | FPDF_PAGE page, |
| 228 | double page_x, |
| 229 | double page_y) { |
Tom Sepez | db0be96 | 2015-10-16 14:00:21 -0700 | [diff] [blame] | 230 | if (!hHandle) |
Tom Sepez | dcbc02f | 2015-07-17 09:16:17 -0700 | [diff] [blame] | 231 | return -1; |
Tom Sepez | db0be96 | 2015-10-16 14:00:21 -0700 | [diff] [blame] | 232 | CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 233 | if (pPage) { |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 234 | CPDF_InteractiveForm interactive_form(pPage->GetDocument()); |
| 235 | CPDF_FormControl* pFormCtrl = interactive_form.GetControlAtPoint( |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 236 | pPage, |
| 237 | CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)), |
Dan Sinclair | b45ea1f | 2017-02-21 14:27:59 -0500 | [diff] [blame] | 238 | nullptr); |
Lei Zhang | bdf72c3 | 2015-08-14 19:24:08 -0700 | [diff] [blame] | 239 | if (!pFormCtrl) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 240 | return -1; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 241 | CPDF_FormField* pFormField = pFormCtrl->GetField(); |
Ryan Harrison | 9baf31f | 2018-01-12 18:36:30 +0000 | [diff] [blame] | 242 | return pFormField ? static_cast<int>(pFormField->GetFieldType()) : -1; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 243 | } |
| 244 | |
Lei Zhang | 7f9fdde | 2016-02-22 20:47:13 -0800 | [diff] [blame] | 245 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | 101535f | 2018-06-12 13:36:05 +0000 | [diff] [blame] | 246 | CPDFXFA_Page* pXFAPage = ToXFAPage(IPDFPageFromFPDFPage(page)); |
Lei Zhang | 7f9fdde | 2016-02-22 20:47:13 -0800 | [diff] [blame] | 247 | if (!pXFAPage) |
| 248 | return -1; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 249 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 250 | CXFA_FFPageView* pPageView = pXFAPage->GetXFAPageView(); |
Lei Zhang | 7f9fdde | 2016-02-22 20:47:13 -0800 | [diff] [blame] | 251 | if (!pPageView) |
| 252 | return -1; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 253 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 254 | CXFA_FFDocView* pDocView = pPageView->GetDocView(); |
Lei Zhang | 7f9fdde | 2016-02-22 20:47:13 -0800 | [diff] [blame] | 255 | if (!pDocView) |
| 256 | return -1; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 257 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 258 | CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); |
Lei Zhang | 7f9fdde | 2016-02-22 20:47:13 -0800 | [diff] [blame] | 259 | if (!pWidgetHandler) |
| 260 | return -1; |
| 261 | |
tsepez | cc4d6d8 | 2016-05-16 13:21:03 -0700 | [diff] [blame] | 262 | std::unique_ptr<IXFA_WidgetIterator> pWidgetIterator( |
dsinclair | 935d8d5 | 2016-05-17 10:32:18 -0700 | [diff] [blame] | 263 | pPageView->CreateWidgetIterator(XFA_TRAVERSEWAY_Form, |
| 264 | XFA_WidgetStatus_Viewable)); |
Lei Zhang | 7f9fdde | 2016-02-22 20:47:13 -0800 | [diff] [blame] | 265 | if (!pWidgetIterator) |
| 266 | return -1; |
| 267 | |
Ryan Harrison | 9baf31f | 2018-01-12 18:36:30 +0000 | [diff] [blame] | 268 | CXFA_FFWidget* pXFAAnnot; |
| 269 | while ((pXFAAnnot = pWidgetIterator->MoveToNext()) != nullptr) { |
Henrique Nakashima | 1087ebc | 2018-02-16 19:31:39 +0000 | [diff] [blame] | 270 | if (pXFAAnnot->GetFormFieldType() == FormFieldType::kXFA) |
| 271 | continue; |
| 272 | |
| 273 | CFX_RectF rcBBox = pXFAAnnot->GetWidgetRect(); |
Lei Zhang | 7f9fdde | 2016-02-22 20:47:13 -0800 | [diff] [blame] | 274 | CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, |
| 275 | rcBBox.top + rcBBox.height); |
Lei Zhang | 1fed5a2 | 2017-06-01 11:52:22 -0700 | [diff] [blame] | 276 | rcWidget.Inflate(1.0f, 1.0f); |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 277 | if (rcWidget.Contains(CFX_PointF(static_cast<float>(page_x), |
| 278 | static_cast<float>(page_y)))) { |
Ryan Harrison | 2056fac | 2018-01-16 16:06:45 +0000 | [diff] [blame] | 279 | return static_cast<int>(pXFAAnnot->GetFormFieldType()); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 280 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 281 | } |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 282 | #endif // PDF_ENABLE_XFA |
Lei Zhang | 7f9fdde | 2016-02-22 20:47:13 -0800 | [diff] [blame] | 283 | return -1; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 284 | } |
| 285 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 286 | FPDF_EXPORT int FPDF_CALLCONV |
| 287 | FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, |
| 288 | FPDF_PAGE page, |
| 289 | double page_x, |
| 290 | double page_y) { |
Tom Sepez | db0be96 | 2015-10-16 14:00:21 -0700 | [diff] [blame] | 291 | if (!hHandle) |
Lei Zhang | bdf72c3 | 2015-08-14 19:24:08 -0700 | [diff] [blame] | 292 | return -1; |
Tom Sepez | db0be96 | 2015-10-16 14:00:21 -0700 | [diff] [blame] | 293 | CPDF_Page* pPage = CPDFPageFromFPDFPage(page); |
| 294 | if (!pPage) |
| 295 | return -1; |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 296 | CPDF_InteractiveForm interactive_form(pPage->GetDocument()); |
Lei Zhang | bdf72c3 | 2015-08-14 19:24:08 -0700 | [diff] [blame] | 297 | int z_order = -1; |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 298 | (void)interactive_form.GetControlAtPoint( |
Dan Sinclair | 05df075 | 2017-03-14 14:43:42 -0400 | [diff] [blame] | 299 | pPage, CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)), |
Ryan Harrison | 6cec70a | 2018-06-05 14:06:10 +0000 | [diff] [blame] | 300 | &z_order); |
Lei Zhang | bdf72c3 | 2015-08-14 19:24:08 -0700 | [diff] [blame] | 301 | return z_order; |
| 302 | } |
| 303 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 304 | FPDF_EXPORT FPDF_FORMHANDLE FPDF_CALLCONV |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 305 | FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, |
| 306 | FPDF_FORMFILLINFO* formInfo) { |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 307 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | 540c436 | 2015-11-24 13:33:57 -0800 | [diff] [blame] | 308 | const int kRequiredVersion = 2; |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 309 | #else // PDF_ENABLE_XFA |
| 310 | const int kRequiredVersion = 1; |
| 311 | #endif // PDF_ENABLE_XFA |
Tom Sepez | 540c436 | 2015-11-24 13:33:57 -0800 | [diff] [blame] | 312 | if (!formInfo || formInfo->version != kRequiredVersion) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 313 | return nullptr; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 314 | |
Tom Sepez | fe06d51 | 2018-05-01 17:25:25 +0000 | [diff] [blame] | 315 | auto* pDocument = CPDFDocumentFromFPDFDocument(document); |
Tom Sepez | 540c436 | 2015-11-24 13:33:57 -0800 | [diff] [blame] | 316 | if (!pDocument) |
| 317 | return nullptr; |
| 318 | |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 319 | #ifdef PDF_ENABLE_XFA |
dsinclair | 521b750 | 2016-11-02 13:02:28 -0700 | [diff] [blame] | 320 | // If the CPDFXFA_Context has a FormFillEnvironment already then we've done |
dsinclair | 8779fa8 | 2016-10-12 12:05:44 -0700 | [diff] [blame] | 321 | // this and can just return the old Env. Otherwise, we'll end up setting a new |
| 322 | // environment into the XFADocument and, that could get weird. |
Tom Sepez | fe06d51 | 2018-05-01 17:25:25 +0000 | [diff] [blame] | 323 | auto* pContext = static_cast<CPDFXFA_Context*>(pDocument->GetExtension()); |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 324 | if (pContext && pContext->GetFormFillEnv()) { |
| 325 | return FPDFFormHandleFromCPDFSDKFormFillEnvironment( |
| 326 | pContext->GetFormFillEnv()); |
| 327 | } |
dsinclair | a939bfe | 2016-09-22 13:18:45 -0700 | [diff] [blame] | 328 | #endif |
| 329 | |
Tom Sepez | da8063f | 2018-04-30 17:41:49 +0000 | [diff] [blame] | 330 | auto pFormFillEnv = pdfium::MakeUnique<CPDFSDK_FormFillEnvironment>( |
| 331 | CPDFDocumentFromFPDFDocument(document), formInfo); |
dsinclair | a939bfe | 2016-09-22 13:18:45 -0700 | [diff] [blame] | 332 | |
| 333 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | 3f3c39d | 2018-05-01 17:46:34 +0000 | [diff] [blame] | 334 | if (pContext) |
| 335 | pContext->SetFormFillEnv(pFormFillEnv.get()); |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 336 | #endif // PDF_ENABLE_XFA |
dsinclair | a939bfe | 2016-09-22 13:18:45 -0700 | [diff] [blame] | 337 | |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 338 | return FPDFFormHandleFromCPDFSDKFormFillEnvironment( |
| 339 | pFormFillEnv.release()); // Caller takes ownership. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 340 | } |
| 341 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 342 | FPDF_EXPORT void FPDF_CALLCONV |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 343 | FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 344 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 345 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
Lei Zhang | 1fed5a2 | 2017-06-01 11:52:22 -0700 | [diff] [blame] | 346 | if (!pFormFillEnv) |
| 347 | return; |
dsinclair | a939bfe | 2016-09-22 13:18:45 -0700 | [diff] [blame] | 348 | |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 349 | #ifdef PDF_ENABLE_XFA |
dsinclair | 2116105 | 2016-10-05 15:46:15 -0700 | [diff] [blame] | 350 | // Reset the focused annotations and remove the SDK document from the |
| 351 | // XFA document. |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 352 | pFormFillEnv->ClearAllFocusedAnnots(); |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 353 | // If the document was closed first, it's possible the XFA document |
| 354 | // is now a nullptr. |
dsinclair | 521b750 | 2016-11-02 13:02:28 -0700 | [diff] [blame] | 355 | if (pFormFillEnv->GetXFAContext()) |
| 356 | pFormFillEnv->GetXFAContext()->SetFormFillEnv(nullptr); |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 357 | #endif // PDF_ENABLE_XFA |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 358 | delete pFormFillEnv; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 359 | } |
| 360 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 361 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, |
| 362 | FPDF_PAGE page, |
| 363 | int modifier, |
| 364 | double page_x, |
| 365 | double page_y) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 366 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 367 | if (!pPageView) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 368 | return false; |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 369 | return pPageView->OnMouseMove(CFX_PointF(page_x, page_y), modifier); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 370 | } |
| 371 | |
Lei Zhang | 63b0126 | 2017-08-31 08:54:46 -0700 | [diff] [blame] | 372 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnFocus(FPDF_FORMHANDLE hHandle, |
| 373 | FPDF_PAGE page, |
| 374 | int modifier, |
| 375 | double page_x, |
| 376 | double page_y) { |
| 377 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 378 | if (!pPageView) |
| 379 | return false; |
| 380 | return pPageView->OnFocus(CFX_PointF(page_x, page_y), modifier); |
| 381 | } |
| 382 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 383 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, |
| 384 | FPDF_PAGE page, |
| 385 | int modifier, |
| 386 | double page_x, |
| 387 | double page_y) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 388 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 389 | if (!pPageView) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 390 | return false; |
Ryan Harrison | 9ce75b8 | 2018-06-06 19:45:14 +0000 | [diff] [blame] | 391 | #ifdef PDF_ENABLE_CLICK_LOGGING |
| 392 | fprintf(stderr, "mousedown,left,%d,%d\n", static_cast<int>(round(page_x)), |
| 393 | static_cast<int>(round(page_y))); |
| 394 | #endif // PDF_ENABLE_CLICK_LOGGING |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 395 | return pPageView->OnLButtonDown(CFX_PointF(page_x, page_y), modifier); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 396 | } |
| 397 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 398 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, |
| 399 | FPDF_PAGE page, |
| 400 | int modifier, |
| 401 | double page_x, |
| 402 | double page_y) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 403 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 404 | if (!pPageView) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 405 | return false; |
Ryan Harrison | 9ce75b8 | 2018-06-06 19:45:14 +0000 | [diff] [blame] | 406 | #ifdef PDF_ENABLE_CLICK_LOGGING |
| 407 | fprintf(stderr, "mouseup,left,%d,%d\n", static_cast<int>(round(page_x)), |
| 408 | static_cast<int>(round(page_y))); |
| 409 | #endif // PDF_ENABLE_CLICK_LOGGING |
Lei Zhang | 1fed5a2 | 2017-06-01 11:52:22 -0700 | [diff] [blame] | 410 | return pPageView->OnLButtonUp(CFX_PointF(page_x, page_y), modifier); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 411 | } |
| 412 | |
Lei Zhang | a37989f | 2018-10-17 20:32:41 +0000 | [diff] [blame^] | 413 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV |
| 414 | FORM_OnLButtonDoubleClick(FPDF_FORMHANDLE hHandle, |
| 415 | FPDF_PAGE page, |
| 416 | int modifier, |
| 417 | double page_x, |
| 418 | double page_y) { |
| 419 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 420 | if (!pPageView) |
| 421 | return false; |
| 422 | #ifdef PDF_ENABLE_CLICK_LOGGING |
| 423 | fprintf(stderr, "mousedown,doubleleft,%d,%d\n", |
| 424 | static_cast<int>(round(page_x)), static_cast<int>(round(page_y))); |
| 425 | #endif // PDF_ENABLE_CLICK_LOGGING |
| 426 | return pPageView->OnLButtonDblClk(CFX_PointF(page_x, page_y), modifier); |
| 427 | } |
| 428 | |
Tom Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 429 | #ifdef PDF_ENABLE_XFA |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 430 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, |
| 431 | FPDF_PAGE page, |
| 432 | int modifier, |
| 433 | double page_x, |
| 434 | double page_y) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 435 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 436 | if (!pPageView) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 437 | return false; |
Ryan Harrison | 9ce75b8 | 2018-06-06 19:45:14 +0000 | [diff] [blame] | 438 | #ifdef PDF_ENABLE_CLICK_LOGGING |
| 439 | fprintf(stderr, "mousedown,right,%d,%d\n", static_cast<int>(round(page_x)), |
| 440 | static_cast<int>(round(page_y))); |
| 441 | #endif // PDF_ENABLE_CLICK_LOGGING |
Dan Sinclair | f528eee | 2017-02-14 11:52:07 -0500 | [diff] [blame] | 442 | return pPageView->OnRButtonDown(CFX_PointF(page_x, page_y), modifier); |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 443 | } |
| 444 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 445 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, |
| 446 | FPDF_PAGE page, |
| 447 | int modifier, |
| 448 | double page_x, |
| 449 | double page_y) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 450 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 451 | if (!pPageView) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 452 | return false; |
Ryan Harrison | 9ce75b8 | 2018-06-06 19:45:14 +0000 | [diff] [blame] | 453 | #ifdef PDF_ENABLE_CLICK_LOGGING |
| 454 | fprintf(stderr, "mouseup,right,%d,%d\n", static_cast<int>(round(page_x)), |
| 455 | static_cast<int>(round(page_y))); |
| 456 | #endif // PDF_ENABLE_CLICK_LOGGING |
Lei Zhang | 1fed5a2 | 2017-06-01 11:52:22 -0700 | [diff] [blame] | 457 | return pPageView->OnRButtonUp(CFX_PointF(page_x, page_y), modifier); |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 458 | } |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 459 | #endif // PDF_ENABLE_XFA |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 460 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 461 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, |
| 462 | FPDF_PAGE page, |
| 463 | int nKeyCode, |
| 464 | int modifier) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 465 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 466 | if (!pPageView) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 467 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 468 | return pPageView->OnKeyDown(nKeyCode, modifier); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 469 | } |
| 470 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 471 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, |
| 472 | FPDF_PAGE page, |
| 473 | int nKeyCode, |
| 474 | int modifier) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 475 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 476 | if (!pPageView) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 477 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 478 | return pPageView->OnKeyUp(nKeyCode, modifier); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 479 | } |
| 480 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 481 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle, |
| 482 | FPDF_PAGE page, |
| 483 | int nChar, |
| 484 | int modifier) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 485 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 486 | if (!pPageView) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 487 | return false; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 488 | return pPageView->OnChar(nChar, modifier); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 489 | } |
| 490 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 491 | FPDF_EXPORT unsigned long FPDF_CALLCONV |
Lei Zhang | a4c7ac4 | 2018-04-17 15:12:58 +0000 | [diff] [blame] | 492 | FORM_GetFocusedText(FPDF_FORMHANDLE hHandle, |
| 493 | FPDF_PAGE page, |
| 494 | void* buffer, |
| 495 | unsigned long buflen) { |
| 496 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 497 | if (!pPageView) |
| 498 | return 0; |
| 499 | |
| 500 | return Utf16EncodeMaybeCopyAndReturnLength(pPageView->GetFocusedFormText(), |
| 501 | buffer, buflen); |
| 502 | } |
| 503 | |
| 504 | FPDF_EXPORT unsigned long FPDF_CALLCONV |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 505 | FORM_GetSelectedText(FPDF_FORMHANDLE hHandle, |
| 506 | FPDF_PAGE page, |
| 507 | void* buffer, |
| 508 | unsigned long buflen) { |
Diana Gage | dce2d72 | 2017-06-20 11:17:11 -0700 | [diff] [blame] | 509 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 510 | if (!pPageView) |
| 511 | return 0; |
| 512 | |
Lei Zhang | a4c7ac4 | 2018-04-17 15:12:58 +0000 | [diff] [blame] | 513 | return Utf16EncodeMaybeCopyAndReturnLength(pPageView->GetSelectedText(), |
| 514 | buffer, buflen); |
Diana Gage | dce2d72 | 2017-06-20 11:17:11 -0700 | [diff] [blame] | 515 | } |
| 516 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 517 | FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle, |
| 518 | FPDF_PAGE page, |
| 519 | FPDF_WIDESTRING wsText) { |
Diana Gage | 1c7f142 | 2017-07-24 11:19:52 -0700 | [diff] [blame] | 520 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 521 | if (!pPageView) |
| 522 | return; |
Diana Gage | ab39097 | 2017-07-28 17:07:39 -0700 | [diff] [blame] | 523 | |
Ryan Harrison | 875e98c | 2017-09-27 10:53:11 -0400 | [diff] [blame] | 524 | size_t len = WideString::WStringLength(wsText); |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 525 | WideString wide_str_text = WideString::FromUTF16LE(wsText, len); |
Diana Gage | ab39097 | 2017-07-28 17:07:39 -0700 | [diff] [blame] | 526 | |
| 527 | pPageView->ReplaceSelection(wide_str_text); |
Diana Gage | 1c7f142 | 2017-07-24 11:19:52 -0700 | [diff] [blame] | 528 | } |
| 529 | |
Lei Zhang | ee96772 | 2018-04-19 20:55:54 +0000 | [diff] [blame] | 530 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanUndo(FPDF_FORMHANDLE hHandle, |
| 531 | FPDF_PAGE page) { |
| 532 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 533 | if (!pPageView) |
| 534 | return false; |
| 535 | return pPageView->CanUndo(); |
| 536 | } |
| 537 | |
| 538 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanRedo(FPDF_FORMHANDLE hHandle, |
| 539 | FPDF_PAGE page) { |
| 540 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 541 | if (!pPageView) |
| 542 | return false; |
| 543 | return pPageView->CanRedo(); |
| 544 | } |
| 545 | |
| 546 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Undo(FPDF_FORMHANDLE hHandle, |
| 547 | FPDF_PAGE page) { |
| 548 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 549 | if (!pPageView) |
| 550 | return false; |
| 551 | return pPageView->Undo(); |
| 552 | } |
| 553 | |
| 554 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Redo(FPDF_FORMHANDLE hHandle, |
| 555 | FPDF_PAGE page) { |
| 556 | CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page); |
| 557 | if (!pPageView) |
| 558 | return false; |
| 559 | return pPageView->Redo(); |
| 560 | } |
| 561 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 562 | FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV |
| 563 | FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) { |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 564 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 565 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 566 | if (!pFormFillEnv) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 567 | return false; |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 568 | return pFormFillEnv->KillFocusAnnot(0); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 569 | } |
| 570 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 571 | FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, |
| 572 | FPDF_BITMAP bitmap, |
| 573 | FPDF_PAGE page, |
| 574 | int start_x, |
| 575 | int start_y, |
| 576 | int size_x, |
| 577 | int size_y, |
| 578 | int rotate, |
| 579 | int flags) { |
Cary Clark | 399be5b | 2016-03-14 16:51:29 -0400 | [diff] [blame] | 580 | FFLCommon(hHandle, bitmap, nullptr, page, start_x, start_y, size_x, size_y, |
| 581 | rotate, flags); |
| 582 | } |
| 583 | |
| 584 | #ifdef _SKIA_SUPPORT_ |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 585 | FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLRecord(FPDF_FORMHANDLE hHandle, |
| 586 | FPDF_RECORDER recorder, |
| 587 | FPDF_PAGE page, |
| 588 | int start_x, |
| 589 | int start_y, |
| 590 | int size_x, |
| 591 | int size_y, |
| 592 | int rotate, |
| 593 | int flags) { |
Cary Clark | 399be5b | 2016-03-14 16:51:29 -0400 | [diff] [blame] | 594 | FFLCommon(hHandle, nullptr, recorder, page, start_x, start_y, size_x, size_y, |
| 595 | rotate, flags); |
| 596 | } |
| 597 | #endif |
| 598 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 599 | FPDF_EXPORT void FPDF_CALLCONV |
| 600 | FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, |
| 601 | int fieldType, |
| 602 | unsigned long color) { |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 603 | CPDFSDK_InteractiveForm* pForm = FormHandleToInteractiveForm(hHandle); |
| 604 | if (!pForm) |
Ryan Harrison | 9baf31f | 2018-01-12 18:36:30 +0000 | [diff] [blame] | 605 | return; |
| 606 | |
| 607 | Optional<FormFieldType> cast_input = IntToFormFieldType(fieldType); |
Ryan Harrison | 2056fac | 2018-01-16 16:06:45 +0000 | [diff] [blame] | 608 | if (!cast_input) |
Ryan Harrison | 9baf31f | 2018-01-12 18:36:30 +0000 | [diff] [blame] | 609 | return; |
| 610 | |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 611 | if (cast_input.value() == FormFieldType::kUnknown) |
| 612 | pForm->SetAllHighlightColors(color); |
| 613 | else |
| 614 | pForm->SetHighlightColor(color, cast_input.value()); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 615 | } |
| 616 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 617 | FPDF_EXPORT void FPDF_CALLCONV |
| 618 | FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha) { |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 619 | if (CPDFSDK_InteractiveForm* pForm = FormHandleToInteractiveForm(hHandle)) |
| 620 | pForm->SetHighlightAlpha(alpha); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 621 | } |
| 622 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 623 | FPDF_EXPORT void FPDF_CALLCONV |
| 624 | FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle) { |
Lei Zhang | 073ecf4 | 2018-10-11 16:56:00 +0000 | [diff] [blame] | 625 | if (CPDFSDK_InteractiveForm* pForm = FormHandleToInteractiveForm(hHandle)) |
| 626 | pForm->RemoveAllHighLights(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 627 | } |
| 628 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 629 | FPDF_EXPORT void FPDF_CALLCONV FORM_OnAfterLoadPage(FPDF_PAGE page, |
| 630 | FPDF_FORMHANDLE hHandle) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 631 | if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, page)) |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 632 | pPageView->SetValid(true); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 633 | } |
| 634 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 635 | FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page, |
| 636 | FPDF_FORMHANDLE hHandle) { |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 637 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 638 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 639 | if (!pFormFillEnv) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 640 | return; |
Tom Sepez | dcbc02f | 2015-07-17 09:16:17 -0700 | [diff] [blame] | 641 | |
Tom Sepez | 101535f | 2018-06-12 13:36:05 +0000 | [diff] [blame] | 642 | IPDF_Page* pPage = IPDFPageFromFPDFPage(page); |
Tom Sepez | 540c436 | 2015-11-24 13:33:57 -0800 | [diff] [blame] | 643 | if (!pPage) |
| 644 | return; |
| 645 | |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 646 | CPDFSDK_PageView* pPageView = pFormFillEnv->GetPageView(pPage, false); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 647 | if (pPageView) { |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 648 | pPageView->SetValid(false); |
Tom Sepez | 50d12ad | 2015-11-24 09:50:51 -0800 | [diff] [blame] | 649 | // RemovePageView() takes care of the delete for us. |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 650 | pFormFillEnv->RemovePageView(pPage); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 651 | } |
| 652 | } |
| 653 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 654 | FPDF_EXPORT void FPDF_CALLCONV |
| 655 | FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) { |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 656 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 657 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
Tom Sepez | f5ca90c | 2018-02-01 02:15:44 +0000 | [diff] [blame] | 658 | if (pFormFillEnv && pFormFillEnv->IsJSPlatformPresent()) |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 659 | pFormFillEnv->ProcJavascriptFun(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 660 | } |
| 661 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 662 | FPDF_EXPORT void FPDF_CALLCONV |
| 663 | FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle) { |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 664 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 665 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
Tom Sepez | f5ca90c | 2018-02-01 02:15:44 +0000 | [diff] [blame] | 666 | if (pFormFillEnv && pFormFillEnv->IsJSPlatformPresent()) |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 667 | pFormFillEnv->ProcOpenAction(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 668 | } |
| 669 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 670 | FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, |
| 671 | int aaType) { |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 672 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 673 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 674 | if (!pFormFillEnv) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 675 | return; |
| 676 | |
dsinclair | 7cbe68e | 2016-10-12 11:56:23 -0700 | [diff] [blame] | 677 | CPDF_Document* pDoc = pFormFillEnv->GetPDFDocument(); |
Lei Zhang | 0158106 | 2017-08-30 14:19:26 -0700 | [diff] [blame] | 678 | const CPDF_Dictionary* pDict = pDoc->GetRoot(); |
Lei Zhang | 1fed5a2 | 2017-06-01 11:52:22 -0700 | [diff] [blame] | 679 | if (!pDict) |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 680 | return; |
Tom Sepez | 468e589 | 2015-10-13 15:49:36 -0700 | [diff] [blame] | 681 | |
Henrique Nakashima | 7b094f8 | 2018-05-08 20:32:08 +0000 | [diff] [blame] | 682 | CPDF_AAction aa(pDict->GetDictFor("AA")); |
Lei Zhang | 1fed5a2 | 2017-06-01 11:52:22 -0700 | [diff] [blame] | 683 | auto type = static_cast<CPDF_AAction::AActionType>(aaType); |
| 684 | if (aa.ActionExist(type)) { |
| 685 | CPDF_Action action = aa.GetAction(type); |
Lei Zhang | 7db136a | 2018-10-10 21:34:17 +0000 | [diff] [blame] | 686 | pFormFillEnv->GetActionHandler()->DoAction_Document(action, type, |
| 687 | pFormFillEnv); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 688 | } |
| 689 | } |
| 690 | |
Dan Sinclair | 00d2ad1 | 2017-08-10 14:13:02 -0400 | [diff] [blame] | 691 | FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page, |
| 692 | FPDF_FORMHANDLE hHandle, |
| 693 | int aaType) { |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 694 | CPDFSDK_FormFillEnvironment* pFormFillEnv = |
Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 695 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(hHandle); |
dsinclair | f3fbe83 | 2016-10-11 13:08:04 -0700 | [diff] [blame] | 696 | if (!pFormFillEnv) |
tonikitoo | 401d4f2 | 2016-08-10 11:37:45 -0700 | [diff] [blame] | 697 | return; |
| 698 | |
Tom Sepez | 101535f | 2018-06-12 13:36:05 +0000 | [diff] [blame] | 699 | IPDF_Page* pPage = IPDFPageFromFPDFPage(page); |
Tom Sepez | 540c436 | 2015-11-24 13:33:57 -0800 | [diff] [blame] | 700 | CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); |
Henrique Nakashima | 7b094f8 | 2018-05-08 20:32:08 +0000 | [diff] [blame] | 701 | if (!pPDFPage) |
| 702 | return; |
| 703 | |
| 704 | if (!pFormFillEnv->GetPageView(pPage, false)) |
tonikitoo | 401d4f2 | 2016-08-10 11:37:45 -0700 | [diff] [blame] | 705 | return; |
| 706 | |
Lei Zhang | cddc8ed | 2017-06-20 17:26:44 -0700 | [diff] [blame] | 707 | CPDFSDK_ActionHandler* pActionHandler = pFormFillEnv->GetActionHandler(); |
Henrique Nakashima | 888af47 | 2018-06-07 19:43:42 +0000 | [diff] [blame] | 708 | CPDF_Dictionary* pPageDict = pPDFPage->GetDict(); |
Henrique Nakashima | 7b094f8 | 2018-05-08 20:32:08 +0000 | [diff] [blame] | 709 | CPDF_AAction aa(pPageDict->GetDictFor("AA")); |
Lei Zhang | 1fed5a2 | 2017-06-01 11:52:22 -0700 | [diff] [blame] | 710 | CPDF_AAction::AActionType type = aaType == FPDFPAGE_AACTION_OPEN |
| 711 | ? CPDF_AAction::OpenPage |
| 712 | : CPDF_AAction::ClosePage; |
Henrique Nakashima | 7b094f8 | 2018-05-08 20:32:08 +0000 | [diff] [blame] | 713 | if (aa.ActionExist(type)) { |
| 714 | CPDF_Action action = aa.GetAction(type); |
| 715 | pActionHandler->DoAction_Page(action, type, pFormFillEnv); |
| 716 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 717 | } |