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_Document * pPDFDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); | |
312 if (!pPDFDoc) | |
313 return FALSE; | |
314 | |
315 CPDF_Dictionary* pRoot = pPDFDoc->GetRoot(); | |
316 if (!pRoot) | |
317 return FALSE; | |
318 | |
319 CPDF_Dictionary* pAcroForm = pRoot->GetDict("AcroForm"); | |
320 if (!pAcroForm) | |
321 return FALSE; | |
322 | |
323 CPDF_Object* pXFA = pAcroForm->GetElement("XFA"); | |
324 if (!pXFA) | |
325 return FALSE; | |
326 | |
327 FX_BOOL bDymasticXFA = FALSE; | |
Tom Sepez
2015/02/17 22:16:34
nit: Dymastic isn't a word as far as I know. Did
| |
328 bDymasticXFA = pRoot->GetBoolean("NeedsRendering", FALSE); | |
329 | |
330 if (bDymasticXFA) | |
331 docType = DOCTYPE_DYNIMIC_XFA; | |
332 else | |
333 docType = DOCTYPE_STATIC_XFA; | |
334 | |
335 return TRUE; | |
336 } | |
337 | |
305 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) | 338 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) |
306 { | 339 { |
307 if (!document||!((CPDFXFA_Document*)document)->GetPDFDoc()) | 340 if (!document||!((CPDFXFA_Document*)document)->GetPDFDoc()) |
308 return FALSE; | 341 return FALSE; |
309 | 342 |
310 int iDocType = DOCTYPE_PDF; | 343 int iDocType = DOCTYPE_PDF; |
311 FX_BOOL hasXFAField = FPDF_HasXFAField(((CPDFXFA_Document*)document)->Ge tPDFDoc(), iDocType); | 344 FX_BOOL hasXFAField = FPDF_HasXFAField(((CPDFXFA_Document*)document)->Ge tPDFDoc(), iDocType); |
312 if (!hasXFAField) | 345 if (!hasXFAField) |
313 return FALSE; | 346 return FALSE; |
314 return ((CPDFXFA_Document*)document)->LoadXFADoc(); | 347 return ((CPDFXFA_Document*)document)->LoadXFADoc(); |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1060 if (!buffer) { | 1093 if (!buffer) { |
1061 buflen = len; | 1094 buflen = len; |
1062 } else if (buflen >= len) { | 1095 } else if (buflen >= len) { |
1063 memcpy(buffer, utf16Name.c_str(), len); | 1096 memcpy(buffer, utf16Name.c_str(), len); |
1064 buflen = len; | 1097 buflen = len; |
1065 } else { | 1098 } else { |
1066 buflen = -1; | 1099 buflen = -1; |
1067 } | 1100 } |
1068 return (FPDF_DEST)pDestObj; | 1101 return (FPDF_DEST)pDestObj; |
1069 } | 1102 } |
OLD | NEW |