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

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

Issue 939483003: Keep the declaration of FPDF_HasXFAField consistent with other XFA APIs (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 10 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/src/fpdfsave.cpp ('k') | fpdfsdk/src/fpdfxfa/fpdfxfa_util.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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h" 8 #include "../include/fsdk_mgr.h"
9 #include "../include/fpdfview.h" 9 #include "../include/fpdfview.h"
10 #include "../include/fsdk_rendercontext.h" 10 #include "../include/fsdk_rendercontext.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 return NULL; 295 return NULL;
296 } 296 }
297 CPDF_Document* pPDFDoc = pParser->GetDocument(); 297 CPDF_Document* pPDFDoc = pParser->GetDocument();
298 if (!pPDFDoc) 298 if (!pPDFDoc)
299 return NULL; 299 return NULL;
300 300
301 CPDFXFA_App* pProvider = FPDFXFA_GetApp(); 301 CPDFXFA_App* pProvider = FPDFXFA_GetApp();
302 CPDFXFA_Document* pDocument = FX_NEW CPDFXFA_Document(pPDFDoc, pProvider ); 302 CPDFXFA_Document* pDocument = FX_NEW CPDFXFA_Document(pPDFDoc, pProvider );
303 return pDocument; 303 return pDocument;
304 } 304 }
305
306 DLLEXPORT FX_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, int& docType)
307 {
308 if (!document)
309 return FALSE;
310
311 CPDF_Dictionary* pRoot = ((CPDF_Document*)document)->GetRoot();
312 if (!pRoot)
313 return FALSE;
314
315 CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm");
316 if (!pAcroForm)
317 return FALSE;
318
319 CPDF_Object* pXFA = pAcroForm->GetElement("XFA");
320 if (!pXFA)
321 return FALSE;
322
323 FX_BOOL bDynamicXFA = pRoot->GetBoolean("NeedsRendering", FALSE);
324
325 if (bDynamicXFA)
326 docType = DOCTYPE_DYNIMIC_XFA;
327 else
328 docType = DOCTYPE_STATIC_XFA;
329
330 return TRUE;
331 }
332
305 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) 333 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document)
306 { 334 {
307 » if (!document||!((CPDFXFA_Document*)document)->GetPDFDoc()) 335 » if (!document)
308 return FALSE; 336 return FALSE;
309 337
310 int iDocType = DOCTYPE_PDF; 338 int iDocType = DOCTYPE_PDF;
311 » FX_BOOL hasXFAField = FPDF_HasXFAField(((CPDFXFA_Document*)document)->Ge tPDFDoc(), iDocType); 339 » FX_BOOL hasXFAField = FPDF_HasXFAField(document, iDocType);
312 if (!hasXFAField) 340 if (!hasXFAField)
313 return FALSE; 341 return FALSE;
314 return ((CPDFXFA_Document*)document)->LoadXFADoc(); 342 return ((CPDFXFA_Document*)document)->LoadXFADoc();
315 } 343 }
316 344
317 345
318 extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); 346 extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code);
319 347
320 class CMemFile FX_FINAL: public IFX_FileRead, public CFX_Object 348 class CMemFile FX_FINAL: public IFX_FileRead, public CFX_Object
321 { 349 {
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 if (!buffer) { 1088 if (!buffer) {
1061 buflen = len; 1089 buflen = len;
1062 } else if (buflen >= len) { 1090 } else if (buflen >= len) {
1063 memcpy(buffer, utf16Name.c_str(), len); 1091 memcpy(buffer, utf16Name.c_str(), len);
1064 buflen = len; 1092 buflen = len;
1065 } else { 1093 } else {
1066 buflen = -1; 1094 buflen = -1;
1067 } 1095 }
1068 return (FPDF_DEST)pDestObj; 1096 return (FPDF_DEST)pDestObj;
1069 } 1097 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfsave.cpp ('k') | fpdfsdk/src/fpdfxfa/fpdfxfa_util.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698