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 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 const int kRequiredVersion = 1; | 239 const int kRequiredVersion = 1; |
240 #endif // PDF_ENABLE_XFA | 240 #endif // PDF_ENABLE_XFA |
241 if (!formInfo || formInfo->version != kRequiredVersion) | 241 if (!formInfo || formInfo->version != kRequiredVersion) |
242 return nullptr; | 242 return nullptr; |
243 | 243 |
244 UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); | 244 UnderlyingDocumentType* pDocument = UnderlyingFromFPDFDocument(document); |
245 if (!pDocument) | 245 if (!pDocument) |
246 return nullptr; | 246 return nullptr; |
247 | 247 |
248 #ifdef PDF_ENABLE_XFA | 248 #ifdef PDF_ENABLE_XFA |
249 // If the CPDFXFA_Document has a SDKDocument already then we've done this | 249 // If the CPDFXFA_Document has a FormFillEnvironment already then we've done |
250 // and can just return the old Env. Otherwise, we'll end up setting a new | 250 // this and can just return the old Env. Otherwise, we'll end up setting a new |
251 // SDKDocument into the XFADocument and, that could get weird. | 251 // environment into the XFADocument and, that could get weird. |
252 if (pDocument->GetFormFillEnv()) | 252 if (pDocument->GetFormFillEnv()) |
253 return pDocument->GetFormFillEnv(); | 253 return pDocument->GetFormFillEnv(); |
254 #endif | 254 #endif |
255 | 255 |
256 CPDFSDK_FormFillEnvironment* pFormFillEnv = | 256 CPDFSDK_FormFillEnvironment* pFormFillEnv = |
257 new CPDFSDK_FormFillEnvironment(pDocument, formInfo); | 257 new CPDFSDK_FormFillEnvironment(pDocument, formInfo); |
258 | 258 |
259 #ifdef PDF_ENABLE_XFA | 259 #ifdef PDF_ENABLE_XFA |
260 pDocument->SetFormFillEnv(pFormFillEnv); | 260 pDocument->SetFormFillEnv(pFormFillEnv); |
261 CPDFXFA_App::GetInstance()->AddFormFillEnv(pFormFillEnv); | 261 CPDFXFA_App::GetInstance()->AddFormFillEnv(pFormFillEnv); |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 pFormFillEnv); | 744 pFormFillEnv); |
745 } | 745 } |
746 } else { | 746 } else { |
747 if (aa.ActionExist(CPDF_AAction::ClosePage)) { | 747 if (aa.ActionExist(CPDF_AAction::ClosePage)) { |
748 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); | 748 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); |
749 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, | 749 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, |
750 pFormFillEnv); | 750 pFormFillEnv); |
751 } | 751 } |
752 } | 752 } |
753 } | 753 } |
OLD | NEW |