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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 305 |
306 DLLEXPORT FX_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, int& docType) | 306 DLLEXPORT FX_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, int& docType) |
307 { | 307 { |
308 if (!document) | 308 if (!document) |
309 return FALSE; | 309 return FALSE; |
310 | 310 |
311 » CPDF_Dictionary* pRoot = ((CPDF_Document*)document)->GetRoot(); | 311 » CPDF_Document *pdfDoc = (static_cast<CPDFXFA_Document *>(document))->Get
PDFDoc(); |
| 312 » if (!pdfDoc) |
| 313 » » return FALSE; |
| 314 |
| 315 » CPDF_Dictionary* pRoot = pdfDoc->GetRoot(); |
312 if (!pRoot) | 316 if (!pRoot) |
313 return FALSE; | 317 return FALSE; |
314 | 318 |
315 CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm"); | 319 CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm"); |
316 if (!pAcroForm) | 320 if (!pAcroForm) |
317 return FALSE; | 321 return FALSE; |
318 | 322 |
319 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); | 323 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); |
320 if (!pXFA) | 324 if (!pXFA) |
321 return FALSE; | 325 return FALSE; |
322 | 326 |
323 FX_BOOL bDynamicXFA = pRoot->GetBoolean("NeedsRendering", FALSE); | 327 FX_BOOL bDynamicXFA = pRoot->GetBoolean("NeedsRendering", FALSE); |
324 | 328 |
325 if (bDynamicXFA) | 329 if (bDynamicXFA) |
326 docType = DOCTYPE_DYNIMIC_XFA; | 330 docType = DOCTYPE_DYNIMIC_XFA; |
327 else | 331 else |
328 docType = DOCTYPE_STATIC_XFA; | 332 docType = DOCTYPE_STATIC_XFA; |
329 | 333 |
330 return TRUE; | 334 return TRUE; |
331 } | 335 } |
332 | 336 |
333 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) | 337 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) |
334 { | 338 { |
335 » if (!document) | 339 » return document && (static_cast<CPDFXFA_Document *>(document))->LoadXFAD
oc(); |
336 » » return FALSE; | |
337 | |
338 » int iDocType = DOCTYPE_PDF; | |
339 » FX_BOOL hasXFAField = FPDF_HasXFAField(document, iDocType); | |
340 » if (!hasXFAField) | |
341 » » return FALSE; | |
342 » return ((CPDFXFA_Document*)document)->LoadXFADoc(); | |
343 } | 340 } |
344 | 341 |
345 | 342 |
346 extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); | 343 extern void CheckUnSupportError(CPDF_Document * pDoc, FX_DWORD err_code); |
347 | 344 |
348 class CMemFile FX_FINAL: public IFX_FileRead, public CFX_Object | 345 class CMemFile FX_FINAL: public IFX_FileRead, public CFX_Object |
349 { | 346 { |
350 public: | 347 public: |
351 CMemFile(FX_BYTE* pBuf, FX_FILESIZE size):m_pBuf(pBuf),m_size(size) {} | 348 CMemFile(FX_BYTE* pBuf, FX_FILESIZE size):m_pBuf(pBuf),m_size(size) {} |
352 | 349 |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 if (!buffer) { | 1085 if (!buffer) { |
1089 buflen = len; | 1086 buflen = len; |
1090 } else if (buflen >= len) { | 1087 } else if (buflen >= len) { |
1091 memcpy(buffer, utf16Name.c_str(), len); | 1088 memcpy(buffer, utf16Name.c_str(), len); |
1092 buflen = len; | 1089 buflen = len; |
1093 } else { | 1090 } else { |
1094 buflen = -1; | 1091 buflen = -1; |
1095 } | 1092 } |
1096 return (FPDF_DEST)pDestObj; | 1093 return (FPDF_DEST)pDestObj; |
1097 } | 1094 } |
OLD | NEW |