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 7 #ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_ 8 #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ 9 10 #ifdef _WIN32 11 #include <tchar.h> 12 #include <math.h> 13 #endif 14 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" 22 23 #include "../../core/include/fpdftext/fpdf_text.h" 24 25 #include "../../core/include/fxge/fx_ge_win32.h" 26 #include "../../core/include/fxge/fx_ge.h" 27 28 #include "../../core/include/fxcodec/fx_codec.h" 29 30 #include "../../core/include/fpdfdoc/fpdf_doc.h" 31 #include "../../core/include/fpdfdoc/fpdf_vt.h" 32 33 #include "../../core/include/fxcrt/fx_xml.h" 34 35 36 #ifndef FX_GetAValue 37 /** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */ 38 #define FX_GetAValue(argb) ((argb & 0xFF000000) >> 24) 39 #endif 40 41 #ifndef FX_GetRValue 42 /** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */ 43 #define FX_GetRValue(argb) ((argb & 0x00FF0000) >> 16) 44 #endif 45 46 #ifndef FX_GetGValue 47 /** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */ 48 #define FX_GetGValue(argb) ((argb & 0x0000FF00) >> 8) 49 #endif 50 51 #ifndef FX_GetBValue 52 /** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */ 53 #define FX_GetBValue(argb) (argb & 0x000000FF) 54 #endif 55 56 #ifndef FX_ARGBTOCOLORREF 57 /** @brief Convert a #FX_ARGB to a #FX_COLORREF. */ 58 #define FX_ARGBTOCOLORREF(argb) ((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16)) 59 #endif 60 61 #ifndef FX_COLORREFTOARGB 62 /** @brief Convert a #FX_COLORREF to a #FX_ARGB. */ 63 #define FX_COLORREFTOARGB(rgb) ((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16)) 64 #endif 65 66 typedef unsigned int FX_UINT; 67 68 #include "../../public/fpdfview.h" 69 70 class CPDF_CustomAccess FX_FINAL : public IFX_FileRead 71 { 72 public: 73 CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess); ~CPDF_CustomAccess()74 ~CPDF_CustomAccess() {} 75 GetSize()76 virtual FX_FILESIZE GetSize() FX_OVERRIDE { return m_FileAccess.m_FileLen; } 77 Release()78 virtual void Release() FX_OVERRIDE { delete this; } 79 80 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE; 81 82 private: 83 FPDF_FILEACCESS m_FileAccess; 84 }; 85 86 void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); 87 FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy); 88 89 90 #endif // FPDFSDK_INCLUDE_FSDK_DEFINE_H_ 91