blob: 610b854a9d1180de79d2d9794c3f45501c2435ca [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.
Lei Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
dsinclair114e46a2016-09-29 17:18:21 -07007#ifndef FPDFSDK_FSDK_DEFINE_H_
8#define FPDFSDK_FSDK_DEFINE_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
dsinclair488b7ad2016-10-04 11:55:50 -070010#include "core/fpdfapi/parser/cpdf_parser.h"
Nicolas Pena37cc5fb2017-04-04 12:12:49 -040011#include "core/fxge/dib/cfx_dibitmap.h"
dsinclair74a34fc2016-09-29 16:41:42 -070012#include "core/fxge/fx_dib.h"
Tom Sepez40e9ff32015-11-30 12:39:54 -080013#include "public/fpdfview.h"
14
Tom Sepez51da0932015-11-25 16:05:49 -080015#ifdef PDF_ENABLE_XFA
dsinclair521b7502016-11-02 13:02:28 -070016#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
Tom Sepez40e9ff32015-11-30 12:39:54 -080017#endif // PDF_ENABLE_XFA
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070018
Tom Sepez75f43c42015-07-15 16:35:53 -070019#ifdef _WIN32
Tom Sepez75f43c42015-07-15 16:35:53 -070020#include <math.h>
Dan Sinclair61046b92016-02-18 14:48:48 -050021#include <tchar.h>
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070022#endif
23
dsinclaircac704d2016-07-28 12:59:09 -070024class CPDF_Annot;
25class CPDF_Page;
Jane Liubaa7ff42017-06-29 19:18:23 -040026class CPDF_PageObject;
weili9f515bc2016-07-24 08:08:24 -070027class CPDF_PageRenderContext;
Jane Liu3b057432017-06-19 10:44:01 -040028class CPDF_PathObject;
Tom Sepez75f43c42015-07-15 16:35:53 -070029class IFSDK_PAUSE_Adapter;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070030
tsepezbea04972016-12-01 13:54:42 -080031// Layering prevents fxcrt from knowing about FPDF_FILEACCESS, so this can't
32// be a static method of IFX_SeekableReadStream.
tsepez833619b2016-12-07 09:21:17 -080033CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream(
34 FPDF_FILEACCESS* pFileAccess);
Bo Xufdc00a72014-10-28 23:03:33 -070035
Tom Sepez40e9ff32015-11-30 12:39:54 -080036#ifdef PDF_ENABLE_XFA
tsepezfa89a202016-12-02 09:48:30 -080037// Layering prevents fxcrt from knowing about FPDF_FILEHANDLER, so this can't
38// be a static method of IFX_SeekableStream.
tsepez833619b2016-12-07 09:21:17 -080039CFX_RetainPtr<IFX_SeekableStream> MakeSeekableStream(
40 FPDF_FILEHANDLER* pFileHandler);
Tom Sepez40e9ff32015-11-30 12:39:54 -080041#endif // PDF_ENABLE_XFA
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070042
Tom Sepez50d12ad2015-11-24 09:50:51 -080043// Object types for public FPDF_ types; these correspond to next layer down
44// from fpdfsdk. For master, these are CPDF_ types, but for XFA, these are
45// CPDFXFA_ types.
Tom Sepez51da0932015-11-25 16:05:49 -080046#ifndef PDF_ENABLE_XFA
47using UnderlyingDocumentType = CPDF_Document;
48using UnderlyingPageType = CPDF_Page;
Tom Sepez40e9ff32015-11-30 12:39:54 -080049#else // PDF_ENABLE_XFA
dsinclair521b7502016-11-02 13:02:28 -070050using UnderlyingDocumentType = CPDFXFA_Context;
Tom Sepez50d12ad2015-11-24 09:50:51 -080051using UnderlyingPageType = CPDFXFA_Page;
Tom Sepez40e9ff32015-11-30 12:39:54 -080052#endif // PDF_ENABLE_XFA
Tom Sepez50d12ad2015-11-24 09:50:51 -080053
54// Conversions to/from underlying types.
55UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc);
56FPDF_DOCUMENT FPDFDocumentFromUnderlying(UnderlyingDocumentType* doc);
57
58UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page);
59
Tom Sepezbf59a072015-10-21 14:07:23 -070060// Conversions to/from FPDF_ types.
Tom Sepez471a1032015-10-15 16:17:18 -070061CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc);
Tom Sepezbf59a072015-10-21 14:07:23 -070062FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc);
63
Tom Sepezdb0be962015-10-16 14:00:21 -070064CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page);
Tom Sepez471a1032015-10-15 16:17:18 -070065
Jane Liu3b057432017-06-19 10:44:01 -040066CPDF_PathObject* CPDFPathObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object);
67
Jane Liubaa7ff42017-06-29 19:18:23 -040068CPDF_PageObject* CPDFPageObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object);
69
Jane Liu18ae06d2017-07-18 10:15:16 -040070CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment);
71
72CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string);
73
thestigbefa4502016-05-26 20:15:19 -070074CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap);
75
Jane Liu18ae06d2017-07-18 10:15:16 -040076unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text,
77 void* buffer,
78 unsigned long buflen);
79
Tom Sepez75f43c42015-07-15 16:35:53 -070080void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable);
81FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy);
weili9f515bc2016-07-24 08:08:24 -070082void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070083 FPDF_PAGE page,
84 int start_x,
85 int start_y,
86 int size_x,
87 int size_y,
88 int rotate,
89 int flags,
tsepez4cf55152016-11-02 14:37:54 -070090 bool bNeedToRestore,
Tom Sepez75f43c42015-07-15 16:35:53 -070091 IFSDK_PAUSE_Adapter* pause);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070092
tsepezc3255f52016-03-25 14:52:27 -070093void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code);
Lei Zhang1b700c32015-10-30 23:55:35 -070094void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot);
Tom Sepezf10ae632016-01-26 14:19:52 -080095void ProcessParseError(CPDF_Parser::Error err);
wileyrya864e9fb2017-05-26 11:38:14 -050096FPDF_BOOL FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object,
97 unsigned int R,
98 unsigned int G,
99 unsigned int B,
100 unsigned int A);
Tom Sepez7da98032015-08-19 10:42:45 -0700101
dsinclair114e46a2016-09-29 17:18:21 -0700102#endif // FPDFSDK_FSDK_DEFINE_H_