5f9cde3858d37fe1b250dfc7dfabbc902d299885
[pdfium.git] / fpdfsdk / include / fsdk_define.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4  \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FPDFSDK_DEFINE_H\r
8 #define _FPDFSDK_DEFINE_H\r
9 \r
10 #ifdef _WIN32\r
11 #include <tchar.h>\r
12 #include <math.h>\r
13 #endif\r
14 \r
15 //#define API5\r
16 #define API6\r
17 #define  _FPDFAPI_ASYNC_PARSING_\r
18 #define _FXSDK_OPENSOURCE_\r
19 \r
20 #ifdef _FPDFEMB_WCE_\r
21         #include "../../core/include/fpdfapi/fpdfapi.h" \r
22         #include "../../core/include/fpdfapi/fpdf_parser.h" \r
23         #include "../../core/include/fpdfapi/fpdf_module.h" \r
24         #include "../../core/include/fpdfapi/fpdf_render.h" \r
25         #include "../../core/include/fpdfapi/fpdf_pageobj.h" \r
26         #include "../../core/include/fpdfapi/fpdf_serial.h" \r
27 \r
28         #include "../../core/include/fpdftext/fpdf_text.h"\r
29 \r
30         #include "../../core/include/fxge/fx_ge_win32.h"\r
31         #include "../../core/include/fxge/fx_ge.h"\r
32 \r
33         #include "../../core/include/fxcodec/fx_codec.h"\r
34 \r
35         #include "../../core/include/fpdfdoc/fpdf_doc.h" \r
36         #include "../../core/include/fpdfdoc/fpdf_vt.h" \r
37 \r
38         #include "../../core/include/fxcrt/fx_xml.h" \r
39         #include "../../core/include/fxcrt/fx_crypt.h"\r
40 \r
41 #else\r
42         #ifdef API6\r
43                 #include "../../core/include/fpdfapi/fpdf_parser.h" \r
44                 #include "../../core/include/fpdfapi/fpdfapi.h" \r
45                 #include "../../core/include/fpdfapi/fpdf_parser.h" \r
46                 #include "../../core/include/fpdfapi/fpdf_module.h" \r
47                 #include "../../core/include/fpdfapi/fpdf_render.h" \r
48                 #include "../../core/include/fpdfapi/fpdf_pageobj.h" \r
49                 #include "../../core/include/fpdfapi/fpdf_serial.h" \r
50 \r
51                 #include "../../core/include/fpdftext/fpdf_text.h"\r
52 \r
53                 #include "../../core/include/fxge/fx_ge_win32.h"\r
54                 #include "../../core/include/fxge/fx_ge.h"\r
55 \r
56                 #include "../../core/include/fxcodec/fx_codec.h"\r
57 \r
58                 #include "../../core/include/fpdfdoc/fpdf_doc.h" \r
59                 #include "../../core/include/fpdfdoc/fpdf_vt.h" \r
60 \r
61                 #include "../../core/include/fxcrt/fx_xml.h" \r
62         //      #include "../../core/include/fdrm/fx_crypt.h"\r
63                 #ifdef _LICENSED_BUILD_\r
64                         #include "../../cryptopp/Cryptlib.h"\r
65                 #endif\r
66         #endif\r
67 #endif\r
68 \r
69 \r
70 #ifndef FX_GetAValue\r
71 /** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */\r
72 #define FX_GetAValue(argb)                      ((argb & 0xFF000000) >> 24)\r
73 #endif\r
74 \r
75 #ifndef FX_GetRValue\r
76 /** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */\r
77 #define FX_GetRValue(argb)                      ((argb & 0x00FF0000) >> 16)\r
78 #endif\r
79 \r
80 #ifndef FX_GetGValue\r
81 /** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */\r
82 #define FX_GetGValue(argb)                      ((argb & 0x0000FF00) >> 8)\r
83 #endif\r
84 \r
85 #ifndef FX_GetBValue\r
86 /** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */\r
87 #define FX_GetBValue(argb)                      (argb & 0x000000FF)\r
88 #endif\r
89 \r
90 #ifndef FX_ARGBTOCOLORREF\r
91 /** @brief Convert a #FX_ARGB to a #FX_COLORREF. */\r
92 #define FX_ARGBTOCOLORREF(argb)         ((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16))\r
93 #endif\r
94 \r
95 #ifndef FX_COLORREFTOARGB\r
96 /** @brief Convert a #FX_COLORREF to a #FX_ARGB. */\r
97 #define FX_COLORREFTOARGB(rgb)          ((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16))\r
98 #endif\r
99 \r
100 typedef unsigned int FX_UINT;   \r
101 \r
102 #include "fpdfview.h"\r
103 \r
104 class CPDF_CustomAccess : public IFX_FileRead, public CFX_Object\r
105 {\r
106 public:\r
107         CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);\r
108         ~CPDF_CustomAccess() {}\r
109 \r
110         virtual CFX_ByteString GetFullPath() { return ""; }\r
111         virtual FX_FILESIZE     GetSize() { return m_FileAccess.m_FileLen; }\r
112 \r
113         virtual FX_BOOL         GetByte(FX_DWORD pos, FX_BYTE& ch);\r
114         virtual FX_BOOL         GetBlock(FX_DWORD pos, FX_LPBYTE pBuf, FX_DWORD size);\r
115         virtual void            Release() { delete this; }\r
116 \r
117         virtual FX_BOOL         ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);\r
118 \r
119         FPDF_FILEACCESS         m_FileAccess;\r
120         FX_BYTE                         m_Buffer[512];\r
121         FX_DWORD                        m_BufferOffset;\r
122 };\r
123 \r
124 void            FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);\r
125 FPDF_BOOL       FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);\r
126 \r
127 \r
128 #endif//_FPDFSDK_DEFINE_H\r