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