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

Side by Side Diff: fpdfsdk/src/fpdfsave.cpp

Issue 1472363003: XFA: More underlying types (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Missing include Created 5 years 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/src/fpdfformfill.cpp ('k') | fpdfsdk/src/fpdftext.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_save.h" 7 #include "public/fpdf_save.h"
8 8
9 #include "../include/fpdfxfa/fpdfxfa_app.h" 9 #include "../include/fpdfxfa/fpdfxfa_app.h"
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" 10 #include "../include/fpdfxfa/fpdfxfa_doc.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 pWidgetAccIterator->Release(); 277 pWidgetAccIterator->Release();
278 pXFADocView->UpdateDocView(); 278 pXFADocView->UpdateDocView();
279 return _SaveXFADocumentData(pDocument, fileList); 279 return _SaveXFADocumentData(pDocument, fileList);
280 } 280 }
281 281
282 FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, 282 FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document,
283 FPDF_FILEWRITE* pFileWrite, 283 FPDF_FILEWRITE* pFileWrite,
284 FPDF_DWORD flags, 284 FPDF_DWORD flags,
285 FPDF_BOOL bSetVersion, 285 FPDF_BOOL bSetVersion,
286 int fileVerion) { 286 int fileVerion) {
287 CPDFXFA_Document* pDoc = (CPDFXFA_Document*)document; 287 CPDF_Document* pPDFDoc = CPDFDocumentFromFPDFDocument(document);
288
289 CFX_PtrArray fileList;
290
291 _SendPreSaveToXFADoc(pDoc, fileList);
292
293 CPDF_Document* pPDFDoc = pDoc->GetPDFDoc();
294 if (!pPDFDoc) 288 if (!pPDFDoc)
295 return 0; 289 return 0;
296 290
291 CPDFXFA_Document* pDoc = (CPDFXFA_Document*)document;
292 CFX_PtrArray fileList;
293 _SendPreSaveToXFADoc(pDoc, fileList);
294
297 if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY) { 295 if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY) {
298 flags = 0; 296 flags = 0;
299 } 297 }
300 298
301 CPDF_Creator FileMaker(pPDFDoc); 299 CPDF_Creator FileMaker(pPDFDoc);
302 if (bSetVersion) 300 if (bSetVersion)
303 FileMaker.SetFileVersion(fileVerion); 301 FileMaker.SetFileVersion(fileVerion);
304 if (flags == FPDF_REMOVE_SECURITY) { 302 if (flags == FPDF_REMOVE_SECURITY) {
305 flags = 0; 303 flags = 0;
306 FileMaker.RemoveSecurity(); 304 FileMaker.RemoveSecurity();
307 } 305 }
306
308 CFX_IFileWrite* pStreamWrite = NULL; 307 CFX_IFileWrite* pStreamWrite = NULL;
309 FX_BOOL bRet; 308 FX_BOOL bRet;
310 pStreamWrite = new CFX_IFileWrite; 309 pStreamWrite = new CFX_IFileWrite;
311 pStreamWrite->Init(pFileWrite); 310 pStreamWrite->Init(pFileWrite);
312 bRet = FileMaker.Create(pStreamWrite, flags); 311 bRet = FileMaker.Create(pStreamWrite, flags);
313
314 _SendPostSaveToXFADoc(pDoc); 312 _SendPostSaveToXFADoc(pDoc);
315
316 for (int i = 0; i < fileList.GetSize(); i++) { 313 for (int i = 0; i < fileList.GetSize(); i++) {
317 IFX_FileStream* pFile = (IFX_FileStream*)fileList.GetAt(i); 314 IFX_FileStream* pFile = (IFX_FileStream*)fileList.GetAt(i);
318 pFile->Release(); 315 pFile->Release();
319 } 316 }
320 fileList.RemoveAll(); 317 fileList.RemoveAll();
321
322 pStreamWrite->Release(); 318 pStreamWrite->Release();
323 return bRet; 319 return bRet;
324 } 320 }
325 321
326 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document, 322 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
327 FPDF_FILEWRITE* pFileWrite, 323 FPDF_FILEWRITE* pFileWrite,
328 FPDF_DWORD flags) { 324 FPDF_DWORD flags) {
329 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0); 325 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0);
330 } 326 }
331 327
332 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, 328 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
333 FPDF_FILEWRITE* pFileWrite, 329 FPDF_FILEWRITE* pFileWrite,
334 FPDF_DWORD flags, 330 FPDF_DWORD flags,
335 int fileVersion) { 331 int fileVersion) {
336 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion); 332 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion);
337 } 333 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfformfill.cpp ('k') | fpdfsdk/src/fpdftext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698