OLD | NEW |
---|---|
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 Loading... | |
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 = FALSE; | |
Tom Sepez
2015/02/17 22:34:29
nit: assigning this to false and then immediately
| |
324 bDynamicXFA = pRoot->GetBoolean("NeedsRendering", FALSE); | |
325 | |
326 if (bDynamicXFA) | |
327 docType = DOCTYPE_DYNIMIC_XFA; | |
328 else | |
329 docType = DOCTYPE_STATIC_XFA; | |
330 | |
331 return TRUE; | |
332 } | |
333 | |
305 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) | 334 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) |
306 { | 335 { |
307 » if (!document||!((CPDFXFA_Document*)document)->GetPDFDoc()) | 336 » if (!document) |
308 return FALSE; | 337 return FALSE; |
309 | 338 |
310 int iDocType = DOCTYPE_PDF; | 339 int iDocType = DOCTYPE_PDF; |
311 » FX_BOOL hasXFAField = FPDF_HasXFAField(((CPDFXFA_Document*)document)->Ge tPDFDoc(), iDocType); | 340 » FX_BOOL hasXFAField = FPDF_HasXFAField(document, iDocType); |
312 if (!hasXFAField) | 341 if (!hasXFAField) |
313 return FALSE; | 342 return FALSE; |
314 return ((CPDFXFA_Document*)document)->LoadXFADoc(); | 343 return ((CPDFXFA_Document*)document)->LoadXFADoc(); |
315 } | 344 } |
316 | 345 |
317 | 346 |
318 extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); | 347 extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); |
319 | 348 |
320 class CMemFile FX_FINAL: public IFX_FileRead, public CFX_Object | 349 class CMemFile FX_FINAL: public IFX_FileRead, public CFX_Object |
321 { | 350 { |
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1060 if (!buffer) { | 1089 if (!buffer) { |
1061 buflen = len; | 1090 buflen = len; |
1062 } else if (buflen >= len) { | 1091 } else if (buflen >= len) { |
1063 memcpy(buffer, utf16Name.c_str(), len); | 1092 memcpy(buffer, utf16Name.c_str(), len); |
1064 buflen = len; | 1093 buflen = len; |
1065 } else { | 1094 } else { |
1066 buflen = -1; | 1095 buflen = -1; |
1067 } | 1096 } |
1068 return (FPDF_DEST)pDestObj; | 1097 return (FPDF_DEST)pDestObj; |
1069 } | 1098 } |
OLD | NEW |