blob: 4c59a28f9445b6ae4ca671218df30db8e9e0135b [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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_DEFINE_H
8#define _FPDFSDK_DEFINE_H
9
10#ifdef _WIN32
11#include <tchar.h>
12#include <math.h>
13#endif
14
John Abd-El-Malek207299b2014-12-15 12:13:45 -080015#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-Malek3f3b45c2014-05-23 17:28:10 -070022
John Abd-El-Malek207299b2014-12-15 12:13:45 -080023#include "../../core/include/fpdftext/fpdf_text.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070024
John Abd-El-Malek207299b2014-12-15 12:13:45 -080025#include "../../core/include/fxge/fx_ge_win32.h"
26#include "../../core/include/fxge/fx_ge.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070027
John Abd-El-Malek207299b2014-12-15 12:13:45 -080028#include "../../core/include/fxcodec/fx_codec.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070029
John Abd-El-Malek207299b2014-12-15 12:13:45 -080030#include "../../core/include/fpdfdoc/fpdf_doc.h"
31#include "../../core/include/fpdfdoc/fpdf_vt.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070032
John Abd-El-Malek207299b2014-12-15 12:13:45 -080033#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-Malek3f3b45c2014-05-23 17:28:10 -070038
John Abd-El-Malek207299b2014-12-15 12:13:45 -080039#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-Malek3f3b45c2014-05-23 17:28:10 -070042
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
74typedef unsigned int FX_UINT;
75
76#include "fpdfview.h"
77
Tom Sepez6fc8cbb2015-04-14 13:50:34 -070078class CPDF_CustomAccess FX_FINAL : public IFX_FileRead
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070079{
80public:
81 CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
82 ~CPDF_CustomAccess() {}
83
Bo Xufdc00a72014-10-28 23:03:33 -070084 virtual CFX_ByteString GetFullPath() { return ""; }
Tom Sepez368ed462014-08-13 17:12:28 -070085 virtual FX_FILESIZE GetSize() FX_OVERRIDE { return m_FileAccess.m_FileLen; }
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070086
Bo Xufdc00a72014-10-28 23:03:33 -070087 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 Sepez368ed462014-08-13 17:12:28 -070089 virtual void Release() FX_OVERRIDE { delete this; }
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070090
Tom Sepez368ed462014-08-13 17:12:28 -070091 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070092
93 FPDF_FILEACCESS m_FileAccess;
Bo Xufdc00a72014-10-28 23:03:33 -070094 FX_BYTE m_Buffer[512];
95 FX_DWORD m_BufferOffset;
96};
97
Tom Sepez6fc8cbb2015-04-14 13:50:34 -070098class CFPDF_FileStream : public IFX_FileStream
Bo Xufdc00a72014-10-28 23:03:33 -070099{
100public:
101 CFPDF_FileStream(FPDF_FILEHANDLER* pFS);
102 virtual ~CFPDF_FileStream() {}
103
104 virtual IFX_FileStream* Retain();
105 virtual void Release();
106
107 virtual FX_FILESIZE GetSize();
108 virtual FX_BOOL IsEOF();
109 virtual FX_FILESIZE GetPosition() {return m_nCurPos;}
110 virtual void SetPosition(FX_FILESIZE pos) {m_nCurPos = pos; }
111 virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);
112 virtual size_t ReadBlock(void* buffer, size_t size);
113 virtual FX_BOOL WriteBlock(const void* buffer, FX_FILESIZE offset, size_t size);
114 virtual FX_BOOL Flush();
115
116protected:
117 FPDF_FILEHANDLER* m_pFS;
118 FX_FILESIZE m_nCurPos;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700119};
120
121void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
122FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
123
124
125#endif//_FPDFSDK_DEFINE_H