Chromium Code Reviews| Index: fpdfsdk/src/fpdfsave.cpp |
| diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp |
| index 8f9ee7794d04dece204b766e75747a5ef93ddc65..96ecf79572356b7315030cc442a0956a71f4d289 100644 |
| --- a/fpdfsdk/src/fpdfsave.cpp |
| +++ b/fpdfsdk/src/fpdfsave.cpp |
| @@ -6,12 +6,16 @@ |
| #include "public/fpdf_save.h" |
| +#ifdef PDF_ENABLE_XFA |
| #include "../include/fpdfxfa/fpdfxfa_app.h" |
| #include "../include/fpdfxfa/fpdfxfa_doc.h" |
| #include "../include/fpdfxfa/fpdfxfa_util.h" |
| +#endif |
| #include "fpdfsdk/include/fsdk_define.h" |
| #include "public/fpdf_edit.h" |
| +#ifdef PDF_ENABLE_XFA |
| #include "public/fpdf_formfill.h" |
| +#endif |
| #if _FX_OS_ == _FX_ANDROID_ |
| #include "time.h" |
| @@ -56,6 +60,7 @@ void CFX_IFileWrite::Release() { |
| delete this; |
| } |
| +#ifdef PDF_ENABLE_XFA |
| #define XFA_DATASETS 0 |
| #define XFA_FORMS 1 |
| @@ -279,11 +284,16 @@ FX_BOOL _SendPreSaveToXFADoc(CPDFXFA_Document* pDocument, |
| return _SaveXFADocumentData(pDocument, fileList); |
| } |
| +#endif |
| FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, |
| FPDF_FILEWRITE* pFileWrite, |
| FPDF_DWORD flags, |
| FPDF_BOOL bSetVersion, |
| int fileVerion) { |
| +#ifndef PDF_ENABLE_XFA |
| + CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); |
| + if (!pDoc) |
| +#else |
| CPDFXFA_Document* pDoc = (CPDFXFA_Document*)document; |
|
Lei Zhang
2015/11/25 00:12:02
Maybe more UnderlyingDocumentType here?
|
| CFX_PtrArray fileList; |
| @@ -292,13 +302,18 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, |
| CPDF_Document* pPDFDoc = pDoc->GetPDFDoc(); |
| if (!pPDFDoc) |
| +#endif |
| return 0; |
| if (flags < FPDF_INCREMENTAL || flags > FPDF_REMOVE_SECURITY) { |
| flags = 0; |
| } |
| +#ifndef PDF_ENABLE_XFA |
| + CPDF_Creator FileMaker(pDoc); |
| +#else |
| CPDF_Creator FileMaker(pPDFDoc); |
| +#endif |
| if (bSetVersion) |
| FileMaker.SetFileVersion(fileVerion); |
| if (flags == FPDF_REMOVE_SECURITY) { |
| @@ -310,6 +325,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, |
| pStreamWrite = new CFX_IFileWrite; |
| pStreamWrite->Init(pFileWrite); |
| bRet = FileMaker.Create(pStreamWrite, flags); |
| +#ifdef PDF_ENABLE_XFA |
| _SendPostSaveToXFADoc(pDoc); |
| @@ -319,6 +335,7 @@ FPDF_BOOL _FPDF_Doc_Save(FPDF_DOCUMENT document, |
| } |
| fileList.RemoveAll(); |
| +#endif |
| pStreamWrite->Release(); |
| return bRet; |
| } |