John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Tom Sepez | 19922bb | 2015-05-28 13:23:12 -0700 | [diff] [blame] | 7 | #ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_ |
| 8 | #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
| 10 | #ifdef _WIN32 |
| 11 | #include <tchar.h> |
| 12 | #include <math.h> |
| 13 | #endif |
| 14 | |
John Abd-El-Malek | 207299b | 2014-12-15 12:13:45 -0800 | [diff] [blame] | 15 | #include "../../core/include/fpdfapi/fpdf_parser.h" |
| 16 | #include "../../core/include/fpdfapi/fpdfapi.h" |
| 17 | #include "../../core/include/fpdfapi/fpdf_parser.h" |
| 18 | #include "../../core/include/fpdfapi/fpdf_module.h" |
| 19 | #include "../../core/include/fpdfapi/fpdf_render.h" |
| 20 | #include "../../core/include/fpdfapi/fpdf_pageobj.h" |
| 21 | #include "../../core/include/fpdfapi/fpdf_serial.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 22 | |
John Abd-El-Malek | 207299b | 2014-12-15 12:13:45 -0800 | [diff] [blame] | 23 | #include "../../core/include/fpdftext/fpdf_text.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 24 | |
John Abd-El-Malek | 207299b | 2014-12-15 12:13:45 -0800 | [diff] [blame] | 25 | #include "../../core/include/fxge/fx_ge_win32.h" |
| 26 | #include "../../core/include/fxge/fx_ge.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 27 | |
John Abd-El-Malek | 207299b | 2014-12-15 12:13:45 -0800 | [diff] [blame] | 28 | #include "../../core/include/fxcodec/fx_codec.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 29 | |
John Abd-El-Malek | 207299b | 2014-12-15 12:13:45 -0800 | [diff] [blame] | 30 | #include "../../core/include/fpdfdoc/fpdf_doc.h" |
| 31 | #include "../../core/include/fpdfdoc/fpdf_vt.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 32 | |
John Abd-El-Malek | 207299b | 2014-12-15 12:13:45 -0800 | [diff] [blame] | 33 | #include "../../core/include/fxcrt/fx_xml.h" |
| 34 | #include "../../xfa/include/fxbarcode/BC_BarCode.h" |
| 35 | #include "../../xfa/include/fxjse/fxjse.h" |
| 36 | #include "../../xfa/include/fxgraphics/fx_graphics.h" |
| 37 | #include "../../xfa/include/fxfa/fxfa.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 38 | |
John Abd-El-Malek | 207299b | 2014-12-15 12:13:45 -0800 | [diff] [blame] | 39 | #include "../../xfa/include/fwl/core/fwl_error.h" |
| 40 | #include "../../xfa/include/fwl/core/fwl_timer.h" |
| 41 | #include "../../xfa/include/fwl/adapter/fwl_adaptertimermgr.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 42 | |
| 43 | |
| 44 | #ifndef FX_GetAValue |
| 45 | /** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */ |
| 46 | #define FX_GetAValue(argb) ((argb & 0xFF000000) >> 24) |
| 47 | #endif |
| 48 | |
| 49 | #ifndef FX_GetRValue |
| 50 | /** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */ |
| 51 | #define FX_GetRValue(argb) ((argb & 0x00FF0000) >> 16) |
| 52 | #endif |
| 53 | |
| 54 | #ifndef FX_GetGValue |
| 55 | /** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */ |
| 56 | #define FX_GetGValue(argb) ((argb & 0x0000FF00) >> 8) |
| 57 | #endif |
| 58 | |
| 59 | #ifndef FX_GetBValue |
| 60 | /** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */ |
| 61 | #define FX_GetBValue(argb) (argb & 0x000000FF) |
| 62 | #endif |
| 63 | |
| 64 | #ifndef FX_ARGBTOCOLORREF |
| 65 | /** @brief Convert a #FX_ARGB to a #FX_COLORREF. */ |
| 66 | #define FX_ARGBTOCOLORREF(argb) ((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16)) |
| 67 | #endif |
| 68 | |
| 69 | #ifndef FX_COLORREFTOARGB |
| 70 | /** @brief Convert a #FX_COLORREF to a #FX_ARGB. */ |
| 71 | #define FX_COLORREFTOARGB(rgb) ((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16)) |
| 72 | #endif |
| 73 | |
| 74 | typedef unsigned int FX_UINT; |
| 75 | |
Tom Sepez | 1ed8a21 | 2015-05-11 15:25:39 -0700 | [diff] [blame] | 76 | #include "../../public/fpdfview.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 77 | |
Tom Sepez | b116136 | 2015-06-09 11:29:12 -0700 | [diff] [blame^] | 78 | class CPDF_CustomAccess final : public IFX_FileRead |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 79 | { |
| 80 | public: |
| 81 | CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess); |
| 82 | ~CPDF_CustomAccess() {} |
| 83 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 84 | |
Tom Sepez | b116136 | 2015-06-09 11:29:12 -0700 | [diff] [blame^] | 85 | virtual CFX_ByteString GetFullPath() { return ""; } |
| 86 | virtual FX_FILESIZE GetSize() override { return m_FileAccess.m_FileLen; } |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 87 | virtual FX_BOOL GetByte(FX_DWORD pos, FX_BYTE& ch); |
| 88 | virtual FX_BOOL GetBlock(FX_DWORD pos, FX_LPBYTE pBuf, FX_DWORD size); |
Tom Sepez | b116136 | 2015-06-09 11:29:12 -0700 | [diff] [blame^] | 89 | virtual void Release() override { delete this; } |
| 90 | virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 91 | |
| 92 | FPDF_FILEACCESS m_FileAccess; |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 93 | FX_BYTE m_Buffer[512]; |
| 94 | FX_DWORD m_BufferOffset; |
| 95 | }; |
| 96 | |
Tom Sepez | 6fc8cbb | 2015-04-14 13:50:34 -0700 | [diff] [blame] | 97 | class CFPDF_FileStream : public IFX_FileStream |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 98 | { |
| 99 | public: |
| 100 | CFPDF_FileStream(FPDF_FILEHANDLER* pFS); |
| 101 | virtual ~CFPDF_FileStream() {} |
| 102 | |
| 103 | virtual IFX_FileStream* Retain(); |
| 104 | virtual void Release(); |
| 105 | |
| 106 | virtual FX_FILESIZE GetSize(); |
| 107 | virtual FX_BOOL IsEOF(); |
| 108 | virtual FX_FILESIZE GetPosition() {return m_nCurPos;} |
| 109 | virtual void SetPosition(FX_FILESIZE pos) {m_nCurPos = pos; } |
| 110 | virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size); |
| 111 | virtual size_t ReadBlock(void* buffer, size_t size); |
| 112 | virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size); |
| 113 | virtual FX_BOOL Flush(); |
| 114 | |
| 115 | protected: |
| 116 | FPDF_FILEHANDLER* m_pFS; |
| 117 | FX_FILESIZE m_nCurPos; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 118 | }; |
| 119 | |
| 120 | void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); |
| 121 | FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy); |
| 122 | |
| 123 | |
Tom Sepez | 19922bb | 2015-05-28 13:23:12 -0700 | [diff] [blame] | 124 | #endif // FPDFSDK_INCLUDE_FSDK_DEFINE_H_ |