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 #ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_ | 7 #ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_ |
8 #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ | 8 #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ |
9 | 9 |
| 10 #ifndef PDF_ENABLE_XFA |
10 #include "core/include/fpdfapi/fpdfapi.h" | 11 #include "core/include/fpdfapi/fpdfapi.h" |
| 12 #else |
| 13 #include "../../xfa/include/fwl/adapter/fwl_adaptertimermgr.h" |
| 14 #include "../../xfa/include/fxbarcode/BC_BarCode.h" |
| 15 #include "../../xfa/include/fxfa/fxfa.h" |
| 16 #include "../../xfa/include/fxgraphics/fx_graphics.h" |
| 17 #include "../../xfa/include/fxjse/fxjse.h" |
| 18 #endif |
11 #include "core/include/fpdfapi/fpdf_module.h" | 19 #include "core/include/fpdfapi/fpdf_module.h" |
12 #include "core/include/fpdfapi/fpdf_pageobj.h" | 20 #include "core/include/fpdfapi/fpdf_pageobj.h" |
13 #include "core/include/fpdfapi/fpdf_parser.h" | 21 #include "core/include/fpdfapi/fpdf_parser.h" |
14 #include "core/include/fpdfapi/fpdf_render.h" | 22 #include "core/include/fpdfapi/fpdf_render.h" |
15 #include "core/include/fpdfapi/fpdf_serial.h" | 23 #include "core/include/fpdfapi/fpdf_serial.h" |
| 24 #ifdef PDF_ENABLE_XFA |
| 25 #include "core/include/fpdfapi/fpdfapi.h" |
| 26 #endif |
16 #include "core/include/fpdfdoc/fpdf_doc.h" | 27 #include "core/include/fpdfdoc/fpdf_doc.h" |
17 #include "core/include/fpdfdoc/fpdf_vt.h" | 28 #include "core/include/fpdfdoc/fpdf_vt.h" |
18 #include "core/include/fxge/fx_ge.h" | 29 #include "core/include/fxge/fx_ge.h" |
19 #include "core/include/fxge/fx_ge_win32.h" | 30 #include "core/include/fxge/fx_ge_win32.h" |
| 31 #ifdef PDF_ENABLE_XFA |
| 32 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" |
| 33 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" |
| 34 #endif |
20 #include "public/fpdfview.h" | 35 #include "public/fpdfview.h" |
21 | 36 |
22 #ifdef _WIN32 | 37 #ifdef _WIN32 |
23 #include <tchar.h> | 38 #include <tchar.h> |
24 #include <math.h> | 39 #include <math.h> |
25 #endif | 40 #endif |
26 | 41 |
27 // Convert a #FX_ARGB to a #FX_COLORREF. | 42 // Convert a #FX_ARGB to a #FX_COLORREF. |
28 #define FX_ARGBTOCOLORREF(argb) \ | 43 #define FX_ARGBTOCOLORREF(argb) \ |
29 ((((FX_DWORD)argb & 0x00FF0000) >> 16) | ((FX_DWORD)argb & 0x0000FF00) | \ | 44 ((((FX_DWORD)argb & 0x00FF0000) >> 16) | ((FX_DWORD)argb & 0x0000FF00) | \ |
(...skipping 11 matching lines...) Expand all Loading... |
41 class CPDF_CustomAccess final : public IFX_FileRead { | 56 class CPDF_CustomAccess final : public IFX_FileRead { |
42 public: | 57 public: |
43 CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess); | 58 CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess); |
44 ~CPDF_CustomAccess() override {} | 59 ~CPDF_CustomAccess() override {} |
45 | 60 |
46 // IFX_FileRead | 61 // IFX_FileRead |
47 FX_FILESIZE GetSize() override { return m_FileAccess.m_FileLen; } | 62 FX_FILESIZE GetSize() override { return m_FileAccess.m_FileLen; } |
48 void Release() override { delete this; } | 63 void Release() override { delete this; } |
49 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; | 64 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; |
50 | 65 |
| 66 #ifdef PDF_ENABLE_XFA |
| 67 virtual CFX_ByteString GetFullPath() { return ""; } |
| 68 virtual FX_BOOL GetByte(FX_DWORD pos, uint8_t& ch); |
| 69 virtual FX_BOOL GetBlock(FX_DWORD pos, uint8_t* pBuf, FX_DWORD size); |
| 70 |
| 71 #endif |
51 private: | 72 private: |
52 FPDF_FILEACCESS m_FileAccess; | 73 FPDF_FILEACCESS m_FileAccess; |
| 74 #ifdef PDF_ENABLE_XFA |
| 75 uint8_t m_Buffer[512]; |
| 76 FX_DWORD m_BufferOffset; |
| 77 }; |
| 78 |
| 79 class CFPDF_FileStream : public IFX_FileStream { |
| 80 public: |
| 81 CFPDF_FileStream(FPDF_FILEHANDLER* pFS); |
| 82 virtual ~CFPDF_FileStream() {} |
| 83 |
| 84 virtual IFX_FileStream* Retain(); |
| 85 virtual void Release(); |
| 86 |
| 87 virtual FX_FILESIZE GetSize(); |
| 88 virtual FX_BOOL IsEOF(); |
| 89 virtual FX_FILESIZE GetPosition() { return m_nCurPos; } |
| 90 virtual void SetPosition(FX_FILESIZE pos) { m_nCurPos = pos; } |
| 91 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size); |
| 92 virtual size_t ReadBlock(void* buffer, size_t size); |
| 93 virtual FX_BOOL WriteBlock(const void* buffer, |
| 94 FX_FILESIZE offset, |
| 95 size_t size); |
| 96 virtual FX_BOOL Flush(); |
| 97 |
| 98 protected: |
| 99 FPDF_FILEHANDLER* m_pFS; |
| 100 FX_FILESIZE m_nCurPos; |
| 101 #endif |
53 }; | 102 }; |
54 | 103 |
55 // Object types for public FPDF_ types; these correspond to next layer down | 104 // Object types for public FPDF_ types; these correspond to next layer down |
56 // from fpdfsdk. For master, these are CPDF_ types, but for XFA, these are | 105 // from fpdfsdk. For master, these are CPDF_ types, but for XFA, these are |
57 // CPDFXFA_ types. | 106 // CPDFXFA_ types. |
| 107 #ifndef PDF_ENABLE_XFA |
58 using UnderlyingDocumentType = CPDF_Document; | 108 using UnderlyingDocumentType = CPDF_Document; |
59 using UnderlyingPageType = CPDF_Page; | 109 using UnderlyingPageType = CPDF_Page; |
| 110 #else |
| 111 using UnderlyingDocumentType = CPDFXFA_Document; |
| 112 using UnderlyingPageType = CPDFXFA_Page; |
| 113 #endif |
60 | 114 |
61 // Conversions to/from underlying types. | 115 // Conversions to/from underlying types. |
62 UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc); | 116 UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc); |
63 FPDF_DOCUMENT FPDFDocumentFromUnderlying(UnderlyingDocumentType* doc); | 117 FPDF_DOCUMENT FPDFDocumentFromUnderlying(UnderlyingDocumentType* doc); |
64 | 118 |
65 UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page); | 119 UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page); |
66 | 120 |
67 // Conversions to/from FPDF_ types. | 121 // Conversions to/from FPDF_ types. |
68 CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc); | 122 CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc); |
69 FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc); | 123 FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc); |
(...skipping 12 matching lines...) Expand all Loading... |
82 int rotate, | 136 int rotate, |
83 int flags, | 137 int flags, |
84 FX_BOOL bNeedToRestore, | 138 FX_BOOL bNeedToRestore, |
85 IFSDK_PAUSE_Adapter* pause); | 139 IFSDK_PAUSE_Adapter* pause); |
86 | 140 |
87 void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code); | 141 void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code); |
88 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot); | 142 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot); |
89 void ProcessParseError(FX_DWORD err_code); | 143 void ProcessParseError(FX_DWORD err_code); |
90 | 144 |
91 #endif // FPDFSDK_INCLUDE_FSDK_DEFINE_H_ | 145 #endif // FPDFSDK_INCLUDE_FSDK_DEFINE_H_ |
OLD | NEW |