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

Side by Side Diff: fpdfsdk/fpdfformfill.cpp

Issue 2421603002: Reland: Make the CPDFXFA_App non-global (Closed)
Patch Set: Review feedback Created 4 years, 1 month 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);
262 #endif // PDF_ENABLE_XFA 261 #endif // PDF_ENABLE_XFA
263 262
264 return pFormFillEnv; 263 return pFormFillEnv;
265 } 264 }
266 265
267 DLLEXPORT void STDCALL 266 DLLEXPORT void STDCALL
268 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { 267 FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) {
269 if (!hHandle) 268 if (!hHandle)
270 return; 269 return;
271 270
272 CPDFSDK_FormFillEnvironment* pFormFillEnv = 271 CPDFSDK_FormFillEnvironment* pFormFillEnv =
273 HandleToCPDFSDKEnvironment(hHandle); 272 HandleToCPDFSDKEnvironment(hHandle);
274 273
275 #ifdef PDF_ENABLE_XFA 274 #ifdef PDF_ENABLE_XFA
276 CPDFXFA_App::GetInstance()->RemoveFormFillEnv(pFormFillEnv);
277
278 // Reset the focused annotations and remove the SDK document from the 275 // Reset the focused annotations and remove the SDK document from the
279 // XFA document. 276 // XFA document.
280 pFormFillEnv->ClearAllFocusedAnnots(); 277 pFormFillEnv->ClearAllFocusedAnnots();
281 // If the document was closed first, it's possible the XFA document 278 // If the document was closed first, it's possible the XFA document
282 // is now a nullptr. 279 // is now a nullptr.
283 if (pFormFillEnv->GetXFADocument()) 280 if (pFormFillEnv->GetXFADocument())
284 pFormFillEnv->GetXFADocument()->SetFormFillEnv(nullptr); 281 pFormFillEnv->GetXFADocument()->SetFormFillEnv(nullptr);
285 #endif // PDF_ENABLE_XFA 282 #endif // PDF_ENABLE_XFA
286 283
287 delete pFormFillEnv; 284 delete pFormFillEnv;
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 pFormFillEnv); 741 pFormFillEnv);
745 } 742 }
746 } else { 743 } else {
747 if (aa.ActionExist(CPDF_AAction::ClosePage)) { 744 if (aa.ActionExist(CPDF_AAction::ClosePage)) {
748 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage); 745 CPDF_Action action = aa.GetAction(CPDF_AAction::ClosePage);
749 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage, 746 pActionHandler->DoAction_Page(action, CPDF_AAction::ClosePage,
750 pFormFillEnv); 747 pFormFillEnv);
751 } 748 }
752 } 749 }
753 } 750 }
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