Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Side by Side Diff: fpdfsdk/fpdfformfill.cpp

Issue 2414883006: Revert of Reland: Make the CPDFXFA_App non-global (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdfdoc_unittest.cpp ('k') | fpdfsdk/fpdfsave.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // environment 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 #endif // PDF_ENABLE_XFA 262 #endif // PDF_ENABLE_XFA
262 263
263 return pFormFillEnv; 264 return pFormFillEnv;
264 } 265 }
265 266
266 DLLEXPORT void STDCALL 267 DLLEXPORT void STDCALL
267 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { 268 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) {
268 if (!hHandle) 269 if (!hHandle)
269 return; 270 return;
270 271
271 CPDFSDK_FormFillEnvironment* pFormFillEnv = 272 CPDFSDK_FormFillEnvironment* pFormFillEnv =
272 HandleToCPDFSDKEnvironment(hHandle); 273 HandleToCPDFSDKEnvironment(hHandle);
273 274
274 #ifdef PDF_ENABLE_XFA 275 #ifdef PDF_ENABLE_XFA
276 CPDFXFA_App::GetInstance()->RemoveFormFillEnv(pFormFillEnv);
277
275 // Reset the focused annotations and remove the SDK document from the 278 // Reset the focused annotations and remove the SDK document from the
276 // XFA document. 279 // XFA document.
277 pFormFillEnv->ClearAllFocusedAnnots(); 280 pFormFillEnv->ClearAllFocusedAnnots();
278 // If the document was closed first, it's possible the XFA document 281 // If the document was closed first, it's possible the XFA document
279 // is now a nullptr. 282 // is now a nullptr.
280 if (pFormFillEnv->GetXFADocument()) 283 if (pFormFillEnv->GetXFADocument())
281 pFormFillEnv->GetXFADocument()->SetFormFillEnv(nullptr); 284 pFormFillEnv->GetXFADocument()->SetFormFillEnv(nullptr);
282 #endif // PDF_ENABLE_XFA 285 #endif // PDF_ENABLE_XFA
283 286
284 delete pFormFillEnv; 287 delete pFormFillEnv;
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 pFormFillEnv); 744 pFormFillEnv);
742 } 745 }
743 } else { 746 } else {
744 if (aa.ActionExist(CPDF_AAction::ClosePage)) { 747 if (aa.ActionExist(CPDF_AAction::ClosePage)) {
745 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); 748 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage);
746 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, 749 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage,
747 pFormFillEnv); 750 pFormFillEnv);
748 } 751 }
749 } 752 }
750 } 753 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfdoc_unittest.cpp ('k') | fpdfsdk/fpdfsave.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698