John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // 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 Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 7 | #ifndef FPDFSDK_FSDK_DEFINE_H_ |
| 8 | #define FPDFSDK_FSDK_DEFINE_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
dsinclair | 488b7ad | 2016-10-04 11:55:50 -0700 | [diff] [blame] | 10 | #include "core/fpdfapi/parser/cpdf_parser.h" |
Nicolas Pena | 37cc5fb | 2017-04-04 12:12:49 -0400 | [diff] [blame] | 11 | #include "core/fxge/dib/cfx_dibitmap.h" |
dsinclair | 74a34fc | 2016-09-29 16:41:42 -0700 | [diff] [blame] | 12 | #include "core/fxge/fx_dib.h" |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 13 | #include "public/fpdfview.h" |
| 14 | |
Tom Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 15 | #ifdef PDF_ENABLE_XFA |
dsinclair | 521b750 | 2016-11-02 13:02:28 -0700 | [diff] [blame] | 16 | #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 17 | #endif // PDF_ENABLE_XFA |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 18 | |
Tom Sepez | 75f43c4 | 2015-07-15 16:35:53 -0700 | [diff] [blame] | 19 | #ifdef _WIN32 |
Tom Sepez | 75f43c4 | 2015-07-15 16:35:53 -0700 | [diff] [blame] | 20 | #include <math.h> |
Dan Sinclair | 61046b9 | 2016-02-18 14:48:48 -0500 | [diff] [blame] | 21 | #include <tchar.h> |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 22 | #endif |
| 23 | |
dsinclair | cac704d | 2016-07-28 12:59:09 -0700 | [diff] [blame] | 24 | class CPDF_Annot; |
| 25 | class CPDF_Page; |
Jane Liu | baa7ff4 | 2017-06-29 19:18:23 -0400 | [diff] [blame] | 26 | class CPDF_PageObject; |
weili | 9f515bc | 2016-07-24 08:08:24 -0700 | [diff] [blame] | 27 | class CPDF_PageRenderContext; |
Jane Liu | 3b05743 | 2017-06-19 10:44:01 -0400 | [diff] [blame] | 28 | class CPDF_PathObject; |
Tom Sepez | 75f43c4 | 2015-07-15 16:35:53 -0700 | [diff] [blame] | 29 | class IFSDK_PAUSE_Adapter; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 30 | |
tsepez | bea0497 | 2016-12-01 13:54:42 -0800 | [diff] [blame] | 31 | // Layering prevents fxcrt from knowing about FPDF_FILEACCESS, so this can't |
| 32 | // be a static method of IFX_SeekableReadStream. |
tsepez | 833619b | 2016-12-07 09:21:17 -0800 | [diff] [blame] | 33 | CFX_RetainPtr<IFX_SeekableReadStream> MakeSeekableReadStream( |
| 34 | FPDF_FILEACCESS* pFileAccess); |
Bo Xu | fdc00a7 | 2014-10-28 23:03:33 -0700 | [diff] [blame] | 35 | |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 36 | #ifdef PDF_ENABLE_XFA |
tsepez | fa89a20 | 2016-12-02 09:48:30 -0800 | [diff] [blame] | 37 | // Layering prevents fxcrt from knowing about FPDF_FILEHANDLER, so this can't |
| 38 | // be a static method of IFX_SeekableStream. |
tsepez | 833619b | 2016-12-07 09:21:17 -0800 | [diff] [blame] | 39 | CFX_RetainPtr<IFX_SeekableStream> MakeSeekableStream( |
| 40 | FPDF_FILEHANDLER* pFileHandler); |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 41 | #endif // PDF_ENABLE_XFA |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 42 | |
Tom Sepez | 50d12ad | 2015-11-24 09:50:51 -0800 | [diff] [blame] | 43 | // 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 Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 46 | #ifndef PDF_ENABLE_XFA |
| 47 | using UnderlyingDocumentType = CPDF_Document; |
| 48 | using UnderlyingPageType = CPDF_Page; |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 49 | #else // PDF_ENABLE_XFA |
dsinclair | 521b750 | 2016-11-02 13:02:28 -0700 | [diff] [blame] | 50 | using UnderlyingDocumentType = CPDFXFA_Context; |
Tom Sepez | 50d12ad | 2015-11-24 09:50:51 -0800 | [diff] [blame] | 51 | using UnderlyingPageType = CPDFXFA_Page; |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 52 | #endif // PDF_ENABLE_XFA |
Tom Sepez | 50d12ad | 2015-11-24 09:50:51 -0800 | [diff] [blame] | 53 | |
| 54 | // Conversions to/from underlying types. |
| 55 | UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc); |
| 56 | FPDF_DOCUMENT FPDFDocumentFromUnderlying(UnderlyingDocumentType* doc); |
| 57 | |
| 58 | UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page); |
| 59 | |
Tom Sepez | bf59a07 | 2015-10-21 14:07:23 -0700 | [diff] [blame] | 60 | // Conversions to/from FPDF_ types. |
Tom Sepez | 471a103 | 2015-10-15 16:17:18 -0700 | [diff] [blame] | 61 | CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc); |
Tom Sepez | bf59a07 | 2015-10-21 14:07:23 -0700 | [diff] [blame] | 62 | FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc); |
| 63 | |
Tom Sepez | db0be96 | 2015-10-16 14:00:21 -0700 | [diff] [blame] | 64 | CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page); |
Tom Sepez | 471a103 | 2015-10-15 16:17:18 -0700 | [diff] [blame] | 65 | |
Jane Liu | 3b05743 | 2017-06-19 10:44:01 -0400 | [diff] [blame] | 66 | CPDF_PathObject* CPDFPathObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object); |
| 67 | |
Jane Liu | baa7ff4 | 2017-06-29 19:18:23 -0400 | [diff] [blame] | 68 | CPDF_PageObject* CPDFPageObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object); |
| 69 | |
Jane Liu | 18ae06d | 2017-07-18 10:15:16 -0400 | [diff] [blame^] | 70 | CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment); |
| 71 | |
| 72 | CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string); |
| 73 | |
thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 74 | CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap); |
| 75 | |
Jane Liu | 18ae06d | 2017-07-18 10:15:16 -0400 | [diff] [blame^] | 76 | unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text, |
| 77 | void* buffer, |
| 78 | unsigned long buflen); |
| 79 | |
Tom Sepez | 75f43c4 | 2015-07-15 16:35:53 -0700 | [diff] [blame] | 80 | void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); |
| 81 | FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy); |
weili | 9f515bc | 2016-07-24 08:08:24 -0700 | [diff] [blame] | 82 | void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 83 | 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, |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 90 | bool bNeedToRestore, |
Tom Sepez | 75f43c4 | 2015-07-15 16:35:53 -0700 | [diff] [blame] | 91 | IFSDK_PAUSE_Adapter* pause); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 92 | |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 93 | void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code); |
Lei Zhang | 1b700c3 | 2015-10-30 23:55:35 -0700 | [diff] [blame] | 94 | void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot); |
Tom Sepez | f10ae63 | 2016-01-26 14:19:52 -0800 | [diff] [blame] | 95 | void ProcessParseError(CPDF_Parser::Error err); |
wileyrya | 864e9fb | 2017-05-26 11:38:14 -0500 | [diff] [blame] | 96 | FPDF_BOOL FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object, |
| 97 | unsigned int R, |
| 98 | unsigned int G, |
| 99 | unsigned int B, |
| 100 | unsigned int A); |
Tom Sepez | 7da9803 | 2015-08-19 10:42:45 -0700 | [diff] [blame] | 101 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 102 | #endif // FPDFSDK_FSDK_DEFINE_H_ |