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

Side by Side Diff: fpdfsdk/fpdfsave.cpp

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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/fpdfformfill.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_app.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 <vector> 9 #include <vector>
10 10
11 #include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" 11 #include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h"
12 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
13 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
14 #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" 14 #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h"
15 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" 15 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
16 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" 16 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
17 #include "core/fxcrt/include/fx_ext.h" 17 #include "core/fxcrt/include/fx_ext.h"
18 #include "fpdfsdk/include/fsdk_define.h" 18 #include "fpdfsdk/include/fsdk_define.h"
19 #include "public/fpdf_edit.h" 19 #include "public/fpdf_edit.h"
20 20
21 #ifdef PDF_ENABLE_XFA 21 #ifdef PDF_ENABLE_XFA
22 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" 22 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
23 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 23 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
24 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" 24 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
25 #include "public/fpdf_formfill.h" 25 #include "public/fpdf_formfill.h"
26 #include "xfa/include/fxfa/xfa_checksum.h"
27 #include "xfa/include/fxfa/xfa_ffapp.h"
28 #include "xfa/include/fxfa/xfa_ffdocview.h"
29 #include "xfa/include/fxfa/xfa_ffwidgethandler.h"
26 #endif 30 #endif
27 31
28 #if _FX_OS_ == _FX_ANDROID_ 32 #if _FX_OS_ == _FX_ANDROID_
29 #include "time.h" 33 #include "time.h"
30 #else 34 #else
31 #include <ctime> 35 #include <ctime>
32 #endif 36 #endif
33 37
34 class CFX_IFileWrite final : public IFX_StreamWrite { 38 class CFX_IFileWrite final : public IFX_StreamWrite {
35 public: 39 public:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 if (!pDocument) 80 if (!pDocument)
77 return false; 81 return false;
78 82
79 if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && 83 if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
80 pDocument->GetDocType() != DOCTYPE_STATIC_XFA) 84 pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
81 return true; 85 return true;
82 86
83 if (!CPDFXFA_App::GetInstance()->GetXFAApp()) 87 if (!CPDFXFA_App::GetInstance()->GetXFAApp())
84 return true; 88 return true;
85 89
86 IXFA_DocView* pXFADocView = pDocument->GetXFADocView(); 90 CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView();
87 if (!pXFADocView) 91 if (!pXFADocView)
88 return true; 92 return true;
89 93
90 IXFA_DocHandler* pXFADocHandler = 94 CXFA_FFDocHandler* pXFADocHandler =
91 CPDFXFA_App::GetInstance()->GetXFAApp()->GetDocHandler(); 95 CPDFXFA_App::GetInstance()->GetXFAApp()->GetDocHandler();
92 CPDF_Document* pPDFDocument = pDocument->GetPDFDoc(); 96 CPDF_Document* pPDFDocument = pDocument->GetPDFDoc();
93 if (!pDocument) 97 if (!pDocument)
94 return false; 98 return false;
95 99
96 CPDF_Dictionary* pRoot = pPDFDocument->GetRoot(); 100 CPDF_Dictionary* pRoot = pPDFDocument->GetRoot();
97 if (!pRoot) 101 if (!pRoot)
98 return false; 102 return false;
99 103
100 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm"); 104 CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm");
(...skipping 20 matching lines...) Expand all
121 CPDF_Object* pPDFObj = pArray->GetObjectAt(i); 125 CPDF_Object* pPDFObj = pArray->GetObjectAt(i);
122 if (!pPDFObj->IsString()) 126 if (!pPDFObj->IsString())
123 continue; 127 continue;
124 if (pPDFObj->GetString() == "form") 128 if (pPDFObj->GetString() == "form")
125 iFormIndex = i + 1; 129 iFormIndex = i + 1;
126 else if (pPDFObj->GetString() == "datasets") 130 else if (pPDFObj->GetString() == "datasets")
127 iDataSetsIndex = i + 1; 131 iDataSetsIndex = i + 1;
128 else if (pPDFObj->GetString() == "template") 132 else if (pPDFObj->GetString() == "template")
129 iTemplate = i + 1; 133 iTemplate = i + 1;
130 } 134 }
131 std::unique_ptr<IXFA_ChecksumContext, ReleaseDeleter<IXFA_ChecksumContext>> 135 std::unique_ptr<CXFA_ChecksumContext, ReleaseDeleter<CXFA_ChecksumContext>>
132 pContext(XFA_Checksum_Create()); 136 pContext(new CXFA_ChecksumContext);
133 pContext->StartChecksum(); 137 pContext->StartChecksum();
134 138
135 // template 139 // template
136 if (iTemplate > -1) { 140 if (iTemplate > -1) {
137 CPDF_Stream* pTemplateStream = pArray->GetStreamAt(iTemplate); 141 CPDF_Stream* pTemplateStream = pArray->GetStreamAt(iTemplate);
138 CPDF_StreamAcc streamAcc; 142 CPDF_StreamAcc streamAcc;
139 streamAcc.LoadAllData(pTemplateStream); 143 streamAcc.LoadAllData(pTemplateStream);
140 uint8_t* pData = (uint8_t*)streamAcc.GetData(); 144 uint8_t* pData = (uint8_t*)streamAcc.GetData();
141 uint32_t dwSize2 = streamAcc.GetSize(); 145 uint32_t dwSize2 = streamAcc.GetSize();
142 ScopedFileStream pTemplate(FX_CreateMemoryStream(pData, dwSize2)); 146 ScopedFileStream pTemplate(FX_CreateMemoryStream(pData, dwSize2));
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 225 }
222 226
223 bool SendPostSaveToXFADoc(CPDFXFA_Document* pDocument) { 227 bool SendPostSaveToXFADoc(CPDFXFA_Document* pDocument) {
224 if (!pDocument) 228 if (!pDocument)
225 return false; 229 return false;
226 230
227 if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && 231 if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
228 pDocument->GetDocType() != DOCTYPE_STATIC_XFA) 232 pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
229 return true; 233 return true;
230 234
231 IXFA_DocView* pXFADocView = pDocument->GetXFADocView(); 235 CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView();
232 if (!pXFADocView) 236 if (!pXFADocView)
233 return false; 237 return false;
234 238
235 IXFA_WidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler(); 239 CXFA_FFWidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler();
236 CXFA_WidgetAcc* pWidgetAcc = NULL; 240 CXFA_WidgetAcc* pWidgetAcc = NULL;
237 IXFA_WidgetAccIterator* pWidgetAccIterator = 241 CXFA_WidgetAccIterator* pWidgetAccIterator =
238 pXFADocView->CreateWidgetAccIterator(); 242 pXFADocView->CreateWidgetAccIterator();
239 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 243 pWidgetAcc = pWidgetAccIterator->MoveToNext();
240 while (pWidgetAcc) { 244 while (pWidgetAcc) {
241 CXFA_EventParam preParam; 245 CXFA_EventParam preParam;
242 preParam.m_eType = XFA_EVENT_PostSave; 246 preParam.m_eType = XFA_EVENT_PostSave;
243 pWidgetHander->ProcessEvent(pWidgetAcc, &preParam); 247 pWidgetHander->ProcessEvent(pWidgetAcc, &preParam);
244 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 248 pWidgetAcc = pWidgetAccIterator->MoveToNext();
245 } 249 }
246 pWidgetAccIterator->Release(); 250 pWidgetAccIterator->Release();
247 pXFADocView->UpdateDocView(); 251 pXFADocView->UpdateDocView();
248 pDocument->_ClearChangeMark(); 252 pDocument->_ClearChangeMark();
249 return true; 253 return true;
250 } 254 }
251 255
252 bool SendPreSaveToXFADoc(CPDFXFA_Document* pDocument, 256 bool SendPreSaveToXFADoc(CPDFXFA_Document* pDocument,
253 std::vector<ScopedFileStream>* fileList) { 257 std::vector<ScopedFileStream>* fileList) {
254 if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA && 258 if (pDocument->GetDocType() != DOCTYPE_DYNAMIC_XFA &&
255 pDocument->GetDocType() != DOCTYPE_STATIC_XFA) 259 pDocument->GetDocType() != DOCTYPE_STATIC_XFA)
256 return true; 260 return true;
257 261
258 IXFA_DocView* pXFADocView = pDocument->GetXFADocView(); 262 CXFA_FFDocView* pXFADocView = pDocument->GetXFADocView();
259 if (!pXFADocView) 263 if (!pXFADocView)
260 return true; 264 return true;
261 265
262 IXFA_WidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler(); 266 CXFA_FFWidgetHandler* pWidgetHander = pXFADocView->GetWidgetHandler();
263 CXFA_WidgetAcc* pWidgetAcc = NULL; 267 CXFA_WidgetAcc* pWidgetAcc = NULL;
264 IXFA_WidgetAccIterator* pWidgetAccIterator = 268 CXFA_WidgetAccIterator* pWidgetAccIterator =
265 pXFADocView->CreateWidgetAccIterator(); 269 pXFADocView->CreateWidgetAccIterator();
266 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 270 pWidgetAcc = pWidgetAccIterator->MoveToNext();
267 while (pWidgetAcc) { 271 while (pWidgetAcc) {
268 CXFA_EventParam preParam; 272 CXFA_EventParam preParam;
269 preParam.m_eType = XFA_EVENT_PreSave; 273 preParam.m_eType = XFA_EVENT_PreSave;
270 pWidgetHander->ProcessEvent(pWidgetAcc, &preParam); 274 pWidgetHander->ProcessEvent(pWidgetAcc, &preParam);
271 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 275 pWidgetAcc = pWidgetAccIterator->MoveToNext();
272 } 276 }
273 pWidgetAccIterator->Release(); 277 pWidgetAccIterator->Release();
274 pXFADocView->UpdateDocView(); 278 pXFADocView->UpdateDocView();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 FPDF_DWORD flags) { 324 FPDF_DWORD flags) {
321 return FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0); 325 return FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0);
322 } 326 }
323 327
324 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, 328 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
325 FPDF_FILEWRITE* pFileWrite, 329 FPDF_FILEWRITE* pFileWrite,
326 FPDF_DWORD flags, 330 FPDF_DWORD flags,
327 int fileVersion) { 331 int fileVersion) {
328 return FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion); 332 return FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion);
329 } 333 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfformfill.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_app.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698