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 "public/fpdfview.h" | 7 #include "public/fpdfview.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "fpdfsdk/cpdfsdk_pageview.h" | 30 #include "fpdfsdk/cpdfsdk_pageview.h" |
31 #include "fpdfsdk/fsdk_define.h" | 31 #include "fpdfsdk/fsdk_define.h" |
32 #include "fpdfsdk/fsdk_pauseadapter.h" | 32 #include "fpdfsdk/fsdk_pauseadapter.h" |
33 #include "fpdfsdk/javascript/ijs_runtime.h" | 33 #include "fpdfsdk/javascript/ijs_runtime.h" |
34 #include "public/fpdf_ext.h" | 34 #include "public/fpdf_ext.h" |
35 #include "public/fpdf_progressive.h" | 35 #include "public/fpdf_progressive.h" |
36 #include "third_party/base/numerics/safe_conversions_impl.h" | 36 #include "third_party/base/numerics/safe_conversions_impl.h" |
37 #include "third_party/base/ptr_util.h" | 37 #include "third_party/base/ptr_util.h" |
38 | 38 |
39 #ifdef PDF_ENABLE_XFA | 39 #ifdef PDF_ENABLE_XFA |
40 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" | 40 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
41 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" | 41 #include "fpdfsdk/fpdfxfa/cpdfxfa_page.h" |
42 #include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h" | 42 #include "fpdfsdk/fpdfxfa/cxfa_fwladaptertimermgr.h" |
43 #include "public/fpdf_formfill.h" | 43 #include "public/fpdf_formfill.h" |
44 #include "xfa/fxbarcode/BC_Library.h" | 44 #include "xfa/fxbarcode/BC_Library.h" |
45 #endif // PDF_ENABLE_XFA | 45 #endif // PDF_ENABLE_XFA |
46 | 46 |
47 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 47 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
48 #include "core/fxge/cfx_windowsdevice.h" | 48 #include "core/fxge/cfx_windowsdevice.h" |
49 #endif | 49 #endif |
50 | 50 |
(...skipping 13 matching lines...) Expand all Loading... |
64 #ifdef PDF_ENABLE_XFA | 64 #ifdef PDF_ENABLE_XFA |
65 return doc ? UnderlyingFromFPDFDocument(doc)->GetPDFDoc() : nullptr; | 65 return doc ? UnderlyingFromFPDFDocument(doc)->GetPDFDoc() : nullptr; |
66 #else // PDF_ENABLE_XFA | 66 #else // PDF_ENABLE_XFA |
67 return UnderlyingFromFPDFDocument(doc); | 67 return UnderlyingFromFPDFDocument(doc); |
68 #endif // PDF_ENABLE_XFA | 68 #endif // PDF_ENABLE_XFA |
69 } | 69 } |
70 | 70 |
71 FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc) { | 71 FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc) { |
72 #ifdef PDF_ENABLE_XFA | 72 #ifdef PDF_ENABLE_XFA |
73 return doc ? FPDFDocumentFromUnderlying( | 73 return doc ? FPDFDocumentFromUnderlying( |
74 new CPDFXFA_Document(pdfium::WrapUnique(doc))) | 74 new CPDFXFA_Context(pdfium::WrapUnique(doc))) |
75 : nullptr; | 75 : nullptr; |
76 #else // PDF_ENABLE_XFA | 76 #else // PDF_ENABLE_XFA |
77 return FPDFDocumentFromUnderlying(doc); | 77 return FPDFDocumentFromUnderlying(doc); |
78 #endif // PDF_ENABLE_XFA | 78 #endif // PDF_ENABLE_XFA |
79 } | 79 } |
80 | 80 |
81 CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page) { | 81 CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page) { |
82 #ifdef PDF_ENABLE_XFA | 82 #ifdef PDF_ENABLE_XFA |
83 return page ? UnderlyingFromFPDFPage(page)->GetPDFPage() : nullptr; | 83 return page ? UnderlyingFromFPDFPage(page)->GetPDFPage() : nullptr; |
84 #else // PDF_ENABLE_XFA | 84 #else // PDF_ENABLE_XFA |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 return FPDFDocumentFromCPDFDocument(pDocument.release()); | 345 return FPDFDocumentFromCPDFDocument(pDocument.release()); |
346 } | 346 } |
347 | 347 |
348 #ifdef PDF_ENABLE_XFA | 348 #ifdef PDF_ENABLE_XFA |
349 DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, | 349 DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, |
350 int* docType) { | 350 int* docType) { |
351 if (!document) | 351 if (!document) |
352 return FALSE; | 352 return FALSE; |
353 | 353 |
354 CPDF_Document* pdfDoc = | 354 CPDF_Document* pdfDoc = |
355 (static_cast<CPDFXFA_Document*>(document))->GetPDFDoc(); | 355 (static_cast<CPDFXFA_Context*>(document))->GetPDFDoc(); |
356 if (!pdfDoc) | 356 if (!pdfDoc) |
357 return FALSE; | 357 return FALSE; |
358 | 358 |
359 CPDF_Dictionary* pRoot = pdfDoc->GetRoot(); | 359 CPDF_Dictionary* pRoot = pdfDoc->GetRoot(); |
360 if (!pRoot) | 360 if (!pRoot) |
361 return FALSE; | 361 return FALSE; |
362 | 362 |
363 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); | 363 CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); |
364 if (!pAcroForm) | 364 if (!pAcroForm) |
365 return FALSE; | 365 return FALSE; |
366 | 366 |
367 CPDF_Object* pXFA = pAcroForm->GetObjectFor("XFA"); | 367 CPDF_Object* pXFA = pAcroForm->GetObjectFor("XFA"); |
368 if (!pXFA) | 368 if (!pXFA) |
369 return FALSE; | 369 return FALSE; |
370 | 370 |
371 bool bDynamicXFA = pRoot->GetBooleanFor("NeedsRendering", false); | 371 bool bDynamicXFA = pRoot->GetBooleanFor("NeedsRendering", false); |
372 *docType = bDynamicXFA ? DOCTYPE_DYNAMIC_XFA : DOCTYPE_STATIC_XFA; | 372 *docType = bDynamicXFA ? DOCTYPE_DYNAMIC_XFA : DOCTYPE_STATIC_XFA; |
373 return TRUE; | 373 return TRUE; |
374 } | 374 } |
375 | 375 |
376 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) { | 376 DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document) { |
377 return document && (static_cast<CPDFXFA_Document*>(document))->LoadXFADoc(); | 377 return document && (static_cast<CPDFXFA_Context*>(document))->LoadXFADoc(); |
378 } | 378 } |
379 #endif // PDF_ENABLE_XFA | 379 #endif // PDF_ENABLE_XFA |
380 | 380 |
381 class CMemFile final : public IFX_SeekableReadStream { | 381 class CMemFile final : public IFX_SeekableReadStream { |
382 public: | 382 public: |
383 CMemFile(uint8_t* pBuf, FX_FILESIZE size) : m_pBuf(pBuf), m_size(size) {} | 383 CMemFile(uint8_t* pBuf, FX_FILESIZE size) : m_pBuf(pBuf), m_size(size) {} |
384 | 384 |
385 void Release() override { delete this; } | 385 void Release() override { delete this; } |
386 FX_FILESIZE GetSize() override { return m_size; } | 386 FX_FILESIZE GetSize() override { return m_size; } |
387 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { | 387 bool ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override { |
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 if (!buffer) { | 1091 if (!buffer) { |
1092 *buflen = len; | 1092 *buflen = len; |
1093 } else if (*buflen >= len) { | 1093 } else if (*buflen >= len) { |
1094 memcpy(buffer, utf16Name.c_str(), len); | 1094 memcpy(buffer, utf16Name.c_str(), len); |
1095 *buflen = len; | 1095 *buflen = len; |
1096 } else { | 1096 } else { |
1097 *buflen = -1; | 1097 *buflen = -1; |
1098 } | 1098 } |
1099 return (FPDF_DEST)pDestObj; | 1099 return (FPDF_DEST)pDestObj; |
1100 } | 1100 } |
OLD | NEW |