Clean up CPDF_AnnotList.
[pdfium.git] / fpdfsdk / include / fsdk_define.h
index 5f9cde3..4177f76 100644 (file)
-// Copyright 2014 PDFium Authors. All rights reserved.\r
-// Use of this source code is governed by a BSD-style license that can be\r
-// found in the LICENSE file.\r
\r
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
-\r
-#ifndef _FPDFSDK_DEFINE_H\r
-#define _FPDFSDK_DEFINE_H\r
-\r
-#ifdef _WIN32\r
-#include <tchar.h>\r
-#include <math.h>\r
-#endif\r
-\r
-//#define API5\r
-#define API6\r
-#define  _FPDFAPI_ASYNC_PARSING_\r
-#define _FXSDK_OPENSOURCE_\r
-\r
-#ifdef _FPDFEMB_WCE_\r
-       #include "../../core/include/fpdfapi/fpdfapi.h" \r
-       #include "../../core/include/fpdfapi/fpdf_parser.h" \r
-       #include "../../core/include/fpdfapi/fpdf_module.h" \r
-       #include "../../core/include/fpdfapi/fpdf_render.h" \r
-       #include "../../core/include/fpdfapi/fpdf_pageobj.h" \r
-       #include "../../core/include/fpdfapi/fpdf_serial.h" \r
-\r
-       #include "../../core/include/fpdftext/fpdf_text.h"\r
-\r
-       #include "../../core/include/fxge/fx_ge_win32.h"\r
-       #include "../../core/include/fxge/fx_ge.h"\r
-\r
-       #include "../../core/include/fxcodec/fx_codec.h"\r
-\r
-       #include "../../core/include/fpdfdoc/fpdf_doc.h" \r
-       #include "../../core/include/fpdfdoc/fpdf_vt.h" \r
-\r
-       #include "../../core/include/fxcrt/fx_xml.h" \r
-       #include "../../core/include/fxcrt/fx_crypt.h"\r
-\r
-#else\r
-       #ifdef API6\r
-               #include "../../core/include/fpdfapi/fpdf_parser.h" \r
-               #include "../../core/include/fpdfapi/fpdfapi.h" \r
-               #include "../../core/include/fpdfapi/fpdf_parser.h" \r
-               #include "../../core/include/fpdfapi/fpdf_module.h" \r
-               #include "../../core/include/fpdfapi/fpdf_render.h" \r
-               #include "../../core/include/fpdfapi/fpdf_pageobj.h" \r
-               #include "../../core/include/fpdfapi/fpdf_serial.h" \r
-\r
-               #include "../../core/include/fpdftext/fpdf_text.h"\r
-\r
-               #include "../../core/include/fxge/fx_ge_win32.h"\r
-               #include "../../core/include/fxge/fx_ge.h"\r
-\r
-               #include "../../core/include/fxcodec/fx_codec.h"\r
-\r
-               #include "../../core/include/fpdfdoc/fpdf_doc.h" \r
-               #include "../../core/include/fpdfdoc/fpdf_vt.h" \r
-\r
-               #include "../../core/include/fxcrt/fx_xml.h" \r
-       //      #include "../../core/include/fdrm/fx_crypt.h"\r
-               #ifdef _LICENSED_BUILD_\r
-                       #include "../../cryptopp/Cryptlib.h"\r
-               #endif\r
-       #endif\r
-#endif\r
-\r
-\r
-#ifndef FX_GetAValue\r
-/** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */\r
-#define FX_GetAValue(argb)                     ((argb & 0xFF000000) >> 24)\r
-#endif\r
-\r
-#ifndef FX_GetRValue\r
-/** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */\r
-#define FX_GetRValue(argb)                     ((argb & 0x00FF0000) >> 16)\r
-#endif\r
-\r
-#ifndef FX_GetGValue\r
-/** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */\r
-#define FX_GetGValue(argb)                     ((argb & 0x0000FF00) >> 8)\r
-#endif\r
-\r
-#ifndef FX_GetBValue\r
-/** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */\r
-#define FX_GetBValue(argb)                     (argb & 0x000000FF)\r
-#endif\r
-\r
-#ifndef FX_ARGBTOCOLORREF\r
-/** @brief Convert a #FX_ARGB to a #FX_COLORREF. */\r
-#define FX_ARGBTOCOLORREF(argb)                ((((FX_DWORD)argb & 0x00FF0000) >> 16)|((FX_DWORD)argb & 0x0000FF00)|(((FX_DWORD)argb & 0x000000FF) << 16))\r
-#endif\r
-\r
-#ifndef FX_COLORREFTOARGB\r
-/** @brief Convert a #FX_COLORREF to a #FX_ARGB. */\r
-#define FX_COLORREFTOARGB(rgb)         ((FX_DWORD)0xFF000000|(((FX_DWORD)rgb & 0x000000FF) << 16)|((FX_DWORD)rgb & 0x0000FF00)|(((FX_DWORD)rgb & 0x00FF0000) >> 16))\r
-#endif\r
-\r
-typedef unsigned int FX_UINT;  \r
-\r
-#include "fpdfview.h"\r
-\r
-class CPDF_CustomAccess : public IFX_FileRead, public CFX_Object\r
-{\r
-public:\r
-       CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);\r
-       ~CPDF_CustomAccess() {}\r
-\r
-       virtual CFX_ByteString GetFullPath() { return ""; }\r
-       virtual FX_FILESIZE     GetSize() { return m_FileAccess.m_FileLen; }\r
-\r
-       virtual FX_BOOL         GetByte(FX_DWORD pos, FX_BYTE& ch);\r
-       virtual FX_BOOL         GetBlock(FX_DWORD pos, FX_LPBYTE pBuf, FX_DWORD size);\r
-       virtual void            Release() { delete this; }\r
-\r
-       virtual FX_BOOL         ReadBlock(void* buffer, FX_FILESIZE offset, size_t size);\r
-\r
-       FPDF_FILEACCESS         m_FileAccess;\r
-       FX_BYTE                         m_Buffer[512];\r
-       FX_DWORD                        m_BufferOffset;\r
-};\r
-\r
-void           FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);\r
-FPDF_BOOL      FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);\r
-\r
-\r
-#endif//_FPDFSDK_DEFINE_H\r
+// Copyright 2014 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_
+#define FPDFSDK_INCLUDE_FSDK_DEFINE_H_
+
+#include "../../core/include/fpdfapi/fpdf_module.h"
+#include "../../core/include/fpdfapi/fpdf_pageobj.h"
+#include "../../core/include/fpdfapi/fpdf_parser.h"
+#include "../../core/include/fpdfapi/fpdf_render.h"
+#include "../../core/include/fpdfapi/fpdf_serial.h"
+#include "../../core/include/fpdfapi/fpdfapi.h"
+#include "../../core/include/fpdfdoc/fpdf_doc.h"
+#include "../../core/include/fpdfdoc/fpdf_vt.h"
+#include "../../core/include/fxge/fx_ge.h"
+#include "../../core/include/fxge/fx_ge_win32.h"
+#include "../../public/fpdfview.h"
+
+#ifdef _WIN32
+#include <tchar.h>
+#include <math.h>
+#endif
+
+// Convert a #FX_ARGB to a #FX_COLORREF.
+#define FX_ARGBTOCOLORREF(argb)                                            \
+  ((((FX_DWORD)argb & 0x00FF0000) >> 16) | ((FX_DWORD)argb & 0x0000FF00) | \
+   (((FX_DWORD)argb & 0x000000FF) << 16))
+
+// Convert a #FX_COLORREF to a #FX_ARGB.
+#define FX_COLORREFTOARGB(rgb)                                   \
+  ((FX_DWORD)0xFF000000 | (((FX_DWORD)rgb & 0x000000FF) << 16) | \
+   ((FX_DWORD)rgb & 0x0000FF00) | (((FX_DWORD)rgb & 0x00FF0000) >> 16))
+
+typedef unsigned int FX_UINT;
+class CRenderContext;
+class IFSDK_PAUSE_Adapter;
+
+class CPDF_CustomAccess final : public IFX_FileRead {
+ public:
+  CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
+  ~CPDF_CustomAccess() override {}
+
+  // IFX_FileRead
+  FX_FILESIZE GetSize() override { return m_FileAccess.m_FileLen; }
+  void Release() override { delete this; }
+  FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override;
+
+ private:
+  FPDF_FILEACCESS m_FileAccess;
+};
+
+// Conversions to/from FPDF_ types.
+CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc);
+FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc);
+
+CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page);
+
+void DropContext(void* data);
+void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
+FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
+void FPDF_RenderPage_Retail(CRenderContext* pContext,
+                            FPDF_PAGE page,
+                            int start_x,
+                            int start_y,
+                            int size_x,
+                            int size_y,
+                            int rotate,
+                            int flags,
+                            FX_BOOL bNeedToRestore,
+                            IFSDK_PAUSE_Adapter* pause);
+
+void CheckUnSupportError(CPDF_Document* pDoc, FX_DWORD err_code);
+void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot);
+void ProcessParseError(FX_DWORD err_code);
+
+#endif  // FPDFSDK_INCLUDE_FSDK_DEFINE_H_