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