Clean up CPDF_AnnotList.
[pdfium.git] / fpdfsdk / include / fsdk_define.h
index 8a839ab..4177f76 100644 (file)
@@ -1,90 +1,79 @@
 // 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
 
-#include "../../core/include/fpdfapi/fpdf_parser.h" 
-#include "../../core/include/fpdfapi/fpdfapi.h" 
-#include "../../core/include/fpdfapi/fpdf_parser.h" 
-#include "../../core/include/fpdfapi/fpdf_module.h" 
-#include "../../core/include/fpdfapi/fpdf_render.h" 
-#include "../../core/include/fpdfapi/fpdf_pageobj.h" 
-#include "../../core/include/fpdfapi/fpdf_serial.h" 
-
-#include "../../core/include/fpdftext/fpdf_text.h"
+// 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))
 
-#include "../../core/include/fxge/fx_ge_win32.h"
-#include "../../core/include/fxge/fx_ge.h"
+// 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))
 
-#include "../../core/include/fxcodec/fx_codec.h"
+typedef unsigned int FX_UINT;
+class CRenderContext;
+class IFSDK_PAUSE_Adapter;
 
-#include "../../core/include/fpdfdoc/fpdf_doc.h" 
-#include "../../core/include/fpdfdoc/fpdf_vt.h" 
+class CPDF_CustomAccess final : public IFX_FileRead {
+ public:
+  CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
+  ~CPDF_CustomAccess() override {}
 
-#include "../../core/include/fxcrt/fx_xml.h" 
-
-
-#ifndef FX_GetAValue
-/** @brief It retrieves an intensity value for the alpha component of a #FX_ARGB value. */
-#define FX_GetAValue(argb)                     ((argb & 0xFF000000) >> 24)
-#endif
-
-#ifndef FX_GetRValue
-/** @brief It retrieves an intensity value for the red component of a #FX_ARGB value. */
-#define FX_GetRValue(argb)                     ((argb & 0x00FF0000) >> 16)
-#endif
-
-#ifndef FX_GetGValue
-/** @brief It retrieves an intensity value for the green component of a #FX_ARGB value. */
-#define FX_GetGValue(argb)                     ((argb & 0x0000FF00) >> 8)
-#endif
+  // 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;
 
-#ifndef FX_GetBValue
-/** @brief It retrieves an intensity value for the blue component of a #FX_ARGB value. */
-#define FX_GetBValue(argb)                     (argb & 0x000000FF)
-#endif
-
-#ifndef FX_ARGBTOCOLORREF
-/** @brief 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))
-#endif
-
-#ifndef FX_COLORREFTOARGB
-/** @brief 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))
-#endif
-
-typedef unsigned int FX_UINT;  
-
-#include "../../public/fpdfview.h"
-
-class CPDF_CustomAccess FX_FINAL : public IFX_FileRead
-{
-public:
-       CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess);
-       ~CPDF_CustomAccess() {}
-
-       virtual FX_FILESIZE     GetSize() FX_OVERRIDE { return m_FileAccess.m_FileLen; }
-
-       virtual void            Release() FX_OVERRIDE { delete this; }
-
-       virtual FX_BOOL         ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) FX_OVERRIDE;
-
-private:
-       FPDF_FILEACCESS         m_FileAccess;
+ private:
+  FPDF_FILEACCESS m_FileAccess;
 };
 
-void           FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
-FPDF_BOOL      FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
-
+// 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_