| 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 |  | 
| Dan Sinclair | 00d47a6 | 2018-03-28 18:39:04 +0000 | [diff] [blame] | 7 | #ifndef FPDFSDK_CPDFSDK_HELPERS_H_ | 
|  | 8 | #define FPDFSDK_CPDFSDK_HELPERS_H_ | 
| John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 |  | 
| Lei Zhang | bc10648 | 2019-05-30 23:55:19 +0000 | [diff] [blame] | 10 | #include "build/build_config.h" | 
| Tom Sepez | 101535f | 2018-06-12 13:36:05 +0000 | [diff] [blame] | 11 | #include "core/fpdfapi/page/cpdf_page.h" | 
| dsinclair | 488b7ad | 2016-10-04 11:55:50 -0700 | [diff] [blame] | 12 | #include "core/fpdfapi/parser/cpdf_parser.h" | 
| Nicolas Pena | 37cc5fb | 2017-04-04 12:12:49 -0400 | [diff] [blame] | 13 | #include "core/fxge/dib/cfx_dibitmap.h" | 
| Lei Zhang | aaed698 | 2018-03-22 18:39:05 +0000 | [diff] [blame] | 14 | #include "public/fpdf_doc.h" | 
| Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 15 | #include "public/fpdfview.h" | 
|  | 16 |  | 
| Tom Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 17 | #ifdef PDF_ENABLE_XFA | 
| Tom Sepez | a1d3442 | 2018-04-24 20:54:41 +0000 | [diff] [blame] | 18 | #include "core/fxcrt/fx_stream.h" | 
| Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 19 | #endif  // PDF_ENABLE_XFA | 
| John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 20 |  | 
| Lei Zhang | bc10648 | 2019-05-30 23:55:19 +0000 | [diff] [blame] | 21 | #if defined(OS_WIN) | 
| Tom Sepez | 75f43c4 | 2015-07-15 16:35:53 -0700 | [diff] [blame] | 22 | #include <math.h> | 
| Dan Sinclair | 61046b9 | 2016-02-18 14:48:48 -0500 | [diff] [blame] | 23 | #include <tchar.h> | 
| John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 24 | #endif | 
|  | 25 |  | 
| dsinclair | cac704d | 2016-07-28 12:59:09 -0700 | [diff] [blame] | 26 | class CPDF_Annot; | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 27 | class CPDF_AnnotContext; | 
|  | 28 | class CPDF_ClipPath; | 
|  | 29 | class CPDF_ContentMarkItem; | 
|  | 30 | class CPDF_Object; | 
|  | 31 | class CPDF_Font; | 
|  | 32 | class CPDF_LinkExtract; | 
| Jane Liu | baa7ff4 | 2017-06-29 19:18:23 -0400 | [diff] [blame] | 33 | class CPDF_PageObject; | 
| weili | 9f515bc | 2016-07-24 08:08:24 -0700 | [diff] [blame] | 34 | class CPDF_PageRenderContext; | 
| Jane Liu | 548334e | 2017-08-03 16:33:40 -0400 | [diff] [blame] | 35 | class CPDF_Stream; | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 36 | class CPDF_StructElement; | 
|  | 37 | class CPDF_StructTree; | 
|  | 38 | class CPDF_TextPage; | 
|  | 39 | class CPDF_TextPageFind; | 
| Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 40 | class CPDFSDK_FormFillEnvironment; | 
| Lei Zhang | e6fcdfa | 2019-02-14 04:07:09 +0000 | [diff] [blame] | 41 | class CPDFSDK_InteractiveForm; | 
| Dan Sinclair | 7d12532 | 2018-03-28 18:49:34 +0000 | [diff] [blame] | 42 | class IPDFSDK_PauseAdapter; | 
| Miklos Vajna | 36eed87 | 2017-09-20 22:52:43 +0200 | [diff] [blame] | 43 | class FX_PATHPOINT; | 
| John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 44 |  | 
| Tom Sepez | a1d3442 | 2018-04-24 20:54:41 +0000 | [diff] [blame] | 45 | #ifdef PDF_ENABLE_XFA | 
|  | 46 | class CPDFXFA_Context; | 
|  | 47 | class CPDFXFA_Page; | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 48 | class CXFA_FFWidget; | 
| Tom Sepez | a1d3442 | 2018-04-24 20:54:41 +0000 | [diff] [blame] | 49 | #endif  // PDF_ENABLE_XFA | 
|  | 50 |  | 
| Tom Sepez | 50d12ad | 2015-11-24 09:50:51 -0800 | [diff] [blame] | 51 | // Conversions to/from underlying types. | 
| Tom Sepez | 101535f | 2018-06-12 13:36:05 +0000 | [diff] [blame] | 52 | IPDF_Page* IPDFPageFromFPDFPage(FPDF_PAGE page); | 
|  | 53 | FPDF_PAGE FPDFPageFromIPDFPage(IPDF_Page* page); | 
| Tom Sepez | db0be96 | 2015-10-16 14:00:21 -0700 | [diff] [blame] | 54 | CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page); | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 55 | FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc); | 
|  | 56 | CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc); | 
|  | 57 |  | 
|  | 58 | // Conversions to/from incomplete FPDF_ API types. | 
| Tom Sepez | 2292360 | 2019-07-15 21:33:35 +0000 | [diff] [blame] | 59 | inline FPDF_ACTION FPDFActionFromCPDFDictionary(CPDF_Dictionary* action) { | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 60 | return reinterpret_cast<FPDF_ACTION>(action); | 
|  | 61 | } | 
| Tom Sepez | 2292360 | 2019-07-15 21:33:35 +0000 | [diff] [blame] | 62 | inline CPDF_Dictionary* CPDFDictionaryFromFPDFAction(FPDF_ACTION action) { | 
|  | 63 | return reinterpret_cast<CPDF_Dictionary*>(action); | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 64 | } | 
|  | 65 |  | 
|  | 66 | inline FPDF_ANNOTATION FPDFAnnotationFromCPDFAnnotContext( | 
|  | 67 | CPDF_AnnotContext* annot) { | 
|  | 68 | return reinterpret_cast<FPDF_ANNOTATION>(annot); | 
|  | 69 | } | 
|  | 70 | inline CPDF_AnnotContext* CPDFAnnotContextFromFPDFAnnotation( | 
|  | 71 | FPDF_ANNOTATION annot) { | 
|  | 72 | return reinterpret_cast<CPDF_AnnotContext*>(annot); | 
|  | 73 | } | 
|  | 74 |  | 
|  | 75 | inline FPDF_ATTACHMENT FPDFAttachmentFromCPDFObject(CPDF_Object* attachment) { | 
|  | 76 | return reinterpret_cast<FPDF_ATTACHMENT>(attachment); | 
|  | 77 | } | 
|  | 78 | inline CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment) { | 
|  | 79 | return reinterpret_cast<CPDF_Object*>(attachment); | 
|  | 80 | } | 
|  | 81 |  | 
|  | 82 | inline FPDF_BITMAP FPDFBitmapFromCFXDIBitmap(CFX_DIBitmap* bitmap) { | 
|  | 83 | return reinterpret_cast<FPDF_BITMAP>(bitmap); | 
|  | 84 | } | 
|  | 85 | inline CFX_DIBitmap* CFXDIBitmapFromFPDFBitmap(FPDF_BITMAP bitmap) { | 
|  | 86 | return reinterpret_cast<CFX_DIBitmap*>(bitmap); | 
|  | 87 | } | 
|  | 88 |  | 
| Tom Sepez | 2292360 | 2019-07-15 21:33:35 +0000 | [diff] [blame] | 89 | inline FPDF_BOOKMARK FPDFBookmarkFromCPDFDictionary(CPDF_Dictionary* bookmark) { | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 90 | return reinterpret_cast<FPDF_BOOKMARK>(bookmark); | 
|  | 91 | } | 
| Tom Sepez | 2292360 | 2019-07-15 21:33:35 +0000 | [diff] [blame] | 92 | inline CPDF_Dictionary* CPDFDictionaryFromFPDFBookmark(FPDF_BOOKMARK bookmark) { | 
|  | 93 | return reinterpret_cast<CPDF_Dictionary*>(bookmark); | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 94 | } | 
|  | 95 |  | 
|  | 96 | inline FPDF_CLIPPATH FPDFClipPathFromCPDFClipPath(CPDF_ClipPath* path) { | 
|  | 97 | return reinterpret_cast<FPDF_CLIPPATH>(path); | 
|  | 98 | } | 
|  | 99 | inline CPDF_ClipPath* CPDFClipPathFromFPDFClipPath(FPDF_CLIPPATH path) { | 
|  | 100 | return reinterpret_cast<CPDF_ClipPath*>(path); | 
|  | 101 | } | 
|  | 102 |  | 
| Tom Sepez | 2292360 | 2019-07-15 21:33:35 +0000 | [diff] [blame] | 103 | inline FPDF_DEST FPDFDestFromCPDFArray(CPDF_Array* dest) { | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 104 | return reinterpret_cast<FPDF_DEST>(dest); | 
|  | 105 | } | 
| Tom Sepez | 2292360 | 2019-07-15 21:33:35 +0000 | [diff] [blame] | 106 | inline CPDF_Array* CPDFArrayFromFPDFDest(FPDF_DEST dest) { | 
|  | 107 | return reinterpret_cast<CPDF_Array*>(dest); | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 108 | } | 
|  | 109 |  | 
|  | 110 | inline FPDF_FONT FPDFFontFromCPDFFont(CPDF_Font* font) { | 
|  | 111 | return reinterpret_cast<FPDF_FONT>(font); | 
|  | 112 | } | 
|  | 113 | inline CPDF_Font* CPDFFontFromFPDFFont(FPDF_FONT font) { | 
|  | 114 | return reinterpret_cast<CPDF_Font*>(font); | 
|  | 115 | } | 
|  | 116 |  | 
|  | 117 | inline FPDF_LINK FPDFLinkFromCPDFDictionary(CPDF_Dictionary* link) { | 
|  | 118 | return reinterpret_cast<FPDF_LINK>(link); | 
|  | 119 | } | 
|  | 120 | inline CPDF_Dictionary* CPDFDictionaryFromFPDFLink(FPDF_LINK link) { | 
|  | 121 | return reinterpret_cast<CPDF_Dictionary*>(link); | 
|  | 122 | } | 
|  | 123 |  | 
|  | 124 | inline FPDF_PAGELINK FPDFPageLinkFromCPDFLinkExtract(CPDF_LinkExtract* link) { | 
|  | 125 | return reinterpret_cast<FPDF_PAGELINK>(link); | 
|  | 126 | } | 
|  | 127 | inline CPDF_LinkExtract* CPDFLinkExtractFromFPDFPageLink(FPDF_PAGELINK link) { | 
|  | 128 | return reinterpret_cast<CPDF_LinkExtract*>(link); | 
|  | 129 | } | 
|  | 130 |  | 
|  | 131 | inline FPDF_PAGEOBJECT FPDFPageObjectFromCPDFPageObject( | 
|  | 132 | CPDF_PageObject* page_object) { | 
|  | 133 | return reinterpret_cast<FPDF_PAGEOBJECT>(page_object); | 
|  | 134 | } | 
|  | 135 | inline CPDF_PageObject* CPDFPageObjectFromFPDFPageObject( | 
|  | 136 | FPDF_PAGEOBJECT page_object) { | 
|  | 137 | return reinterpret_cast<CPDF_PageObject*>(page_object); | 
|  | 138 | } | 
|  | 139 |  | 
|  | 140 | inline FPDF_PAGEOBJECTMARK FPDFPageObjectMarkFromCPDFContentMarkItem( | 
| Henrique Nakashima | 144107d | 2018-07-10 21:04:05 +0000 | [diff] [blame] | 141 | CPDF_ContentMarkItem* mark) { | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 142 | return reinterpret_cast<FPDF_PAGEOBJECTMARK>(mark); | 
|  | 143 | } | 
| Henrique Nakashima | 144107d | 2018-07-10 21:04:05 +0000 | [diff] [blame] | 144 | inline CPDF_ContentMarkItem* CPDFContentMarkItemFromFPDFPageObjectMark( | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 145 | FPDF_PAGEOBJECTMARK mark) { | 
| Henrique Nakashima | 144107d | 2018-07-10 21:04:05 +0000 | [diff] [blame] | 146 | return reinterpret_cast<CPDF_ContentMarkItem*>(mark); | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 147 | } | 
|  | 148 |  | 
| Tom Sepez | 2292360 | 2019-07-15 21:33:35 +0000 | [diff] [blame] | 149 | inline FPDF_PAGERANGE FPDFPageRangeFromCPDFArray(CPDF_Array* range) { | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 150 | return reinterpret_cast<FPDF_PAGERANGE>(range); | 
|  | 151 | } | 
| Tom Sepez | 2292360 | 2019-07-15 21:33:35 +0000 | [diff] [blame] | 152 | inline CPDF_Array* CPDFArrayFromFPDFPageRange(FPDF_PAGERANGE range) { | 
|  | 153 | return reinterpret_cast<CPDF_Array*>(range); | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 154 | } | 
|  | 155 |  | 
|  | 156 | inline FPDF_PATHSEGMENT FPDFPathSegmentFromFXPathPoint( | 
|  | 157 | const FX_PATHPOINT* segment) { | 
|  | 158 | return reinterpret_cast<FPDF_PATHSEGMENT>(segment); | 
|  | 159 | } | 
|  | 160 | inline const FX_PATHPOINT* FXPathPointFromFPDFPathSegment( | 
|  | 161 | FPDF_PATHSEGMENT segment) { | 
|  | 162 | return reinterpret_cast<const FX_PATHPOINT*>(segment); | 
|  | 163 | } | 
|  | 164 |  | 
|  | 165 | inline FPDF_STRUCTTREE FPDFStructTreeFromCPDFStructTree( | 
|  | 166 | CPDF_StructTree* struct_tree) { | 
|  | 167 | return reinterpret_cast<FPDF_STRUCTTREE>(struct_tree); | 
|  | 168 | } | 
|  | 169 | inline CPDF_StructTree* CPDFStructTreeFromFPDFStructTree( | 
|  | 170 | FPDF_STRUCTTREE struct_tree) { | 
|  | 171 | return reinterpret_cast<CPDF_StructTree*>(struct_tree); | 
|  | 172 | } | 
|  | 173 |  | 
|  | 174 | inline FPDF_STRUCTELEMENT FPDFStructElementFromCPDFStructElement( | 
|  | 175 | CPDF_StructElement* struct_element) { | 
|  | 176 | return reinterpret_cast<FPDF_STRUCTELEMENT>(struct_element); | 
|  | 177 | } | 
|  | 178 | inline CPDF_StructElement* CPDFStructElementFromFPDFStructElement( | 
|  | 179 | FPDF_STRUCTELEMENT struct_element) { | 
|  | 180 | return reinterpret_cast<CPDF_StructElement*>(struct_element); | 
|  | 181 | } | 
|  | 182 |  | 
|  | 183 | inline FPDF_TEXTPAGE FPDFTextPageFromCPDFTextPage(CPDF_TextPage* page) { | 
|  | 184 | return reinterpret_cast<FPDF_TEXTPAGE>(page); | 
|  | 185 | } | 
|  | 186 | inline CPDF_TextPage* CPDFTextPageFromFPDFTextPage(FPDF_TEXTPAGE page) { | 
|  | 187 | return reinterpret_cast<CPDF_TextPage*>(page); | 
|  | 188 | } | 
|  | 189 |  | 
|  | 190 | inline FPDF_SCHHANDLE FPDFSchHandleFromCPDFTextPageFind( | 
|  | 191 | CPDF_TextPageFind* handle) { | 
|  | 192 | return reinterpret_cast<FPDF_SCHHANDLE>(handle); | 
|  | 193 | } | 
|  | 194 | inline CPDF_TextPageFind* CPDFTextPageFindFromFPDFSchHandle( | 
|  | 195 | FPDF_SCHHANDLE handle) { | 
|  | 196 | return reinterpret_cast<CPDF_TextPageFind*>(handle); | 
|  | 197 | } | 
|  | 198 |  | 
| Tom Sepez | 2563fc3 | 2018-08-01 19:13:06 +0000 | [diff] [blame] | 199 | inline FPDF_FORMHANDLE FPDFFormHandleFromCPDFSDKFormFillEnvironment( | 
|  | 200 | CPDFSDK_FormFillEnvironment* handle) { | 
|  | 201 | return reinterpret_cast<FPDF_FORMHANDLE>(handle); | 
|  | 202 | } | 
|  | 203 | inline CPDFSDK_FormFillEnvironment* | 
|  | 204 | CPDFSDKFormFillEnvironmentFromFPDFFormHandle(FPDF_FORMHANDLE handle) { | 
|  | 205 | return reinterpret_cast<CPDFSDK_FormFillEnvironment*>(handle); | 
|  | 206 | } | 
|  | 207 |  | 
| Lei Zhang | e6fcdfa | 2019-02-14 04:07:09 +0000 | [diff] [blame] | 208 | CPDFSDK_InteractiveForm* FormHandleToInteractiveForm(FPDF_FORMHANDLE hHandle); | 
|  | 209 |  | 
| Lei Zhang | b46a763 | 2019-01-09 02:56:16 +0000 | [diff] [blame] | 210 | ByteString ByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string); | 
| thestig | befa450 | 2016-05-26 20:15:19 -0700 | [diff] [blame] | 211 |  | 
| Lei Zhang | f5fcd9e | 2018-12-23 03:11:50 +0000 | [diff] [blame] | 212 | WideString WideStringFromFPDFWideString(FPDF_WIDESTRING wide_string); | 
|  | 213 |  | 
| Dan Sinclair | 7aba472 | 2018-03-28 17:04:16 +0000 | [diff] [blame] | 214 | #ifdef PDF_ENABLE_XFA | 
| Tom Sepez | 525147a | 2018-05-03 17:19:53 +0000 | [diff] [blame] | 215 | inline FPDF_WIDGET FPDFWidgetFromCXFAFFWidget(CXFA_FFWidget* widget) { | 
|  | 216 | return reinterpret_cast<FPDF_WIDGET>(widget); | 
|  | 217 | } | 
|  | 218 | inline CXFA_FFWidget* CXFAFFWidgetFromFPDFWidget(FPDF_WIDGET widget) { | 
|  | 219 | return reinterpret_cast<CXFA_FFWidget*>(widget); | 
|  | 220 | } | 
|  | 221 |  | 
| Dan Sinclair | 7aba472 | 2018-03-28 17:04:16 +0000 | [diff] [blame] | 222 | // Layering prevents fxcrt from knowing about FPDF_FILEHANDLER, so this can't | 
|  | 223 | // be a static method of IFX_SeekableStream. | 
|  | 224 | RetainPtr<IFX_SeekableStream> MakeSeekableStream( | 
|  | 225 | FPDF_FILEHANDLER* pFileHandler); | 
|  | 226 | #endif  // PDF_ENABLE_XFA | 
| Lei Zhang | 11767d3 | 2018-03-21 18:59:44 +0000 | [diff] [blame] | 227 |  | 
| Lei Zhang | 5cee3f2 | 2018-05-25 21:48:49 +0000 | [diff] [blame] | 228 | const CPDF_Array* GetQuadPointsArrayFromDictionary(const CPDF_Dictionary* dict); | 
|  | 229 | CPDF_Array* GetQuadPointsArrayFromDictionary(CPDF_Dictionary* dict); | 
| Ralf Sippl | 1638179 | 2018-04-12 21:20:26 +0000 | [diff] [blame] | 230 | CPDF_Array* AddQuadPointsArrayToDictionary(CPDF_Dictionary* dict); | 
|  | 231 | bool IsValidQuadPointsIndex(const CPDF_Array* array, size_t index); | 
|  | 232 | bool GetQuadPointsAtIndex(const CPDF_Array* array, | 
|  | 233 | size_t quad_index, | 
|  | 234 | FS_QUADPOINTSF* quad_points); | 
| Lei Zhang | aaed698 | 2018-03-22 18:39:05 +0000 | [diff] [blame] | 235 |  | 
| Lei Zhang | 367e7de | 2017-10-31 13:32:17 +0000 | [diff] [blame] | 236 | CFX_FloatRect CFXFloatRectFromFSRECTF(const FS_RECTF& rect); | 
|  | 237 | void FSRECTFFromCFXFloatRect(const CFX_FloatRect& rect, FS_RECTF* out_rect); | 
|  | 238 |  | 
| Lei Zhang | 6fef1e4 | 2018-12-20 19:14:02 +0000 | [diff] [blame] | 239 | CFX_Matrix CFXMatrixFromFSMatrix(const FS_MATRIX& matrix); | 
|  | 240 |  | 
| Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 241 | unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text, | 
| Jane Liu | 18ae06d | 2017-07-18 10:15:16 -0400 | [diff] [blame] | 242 | void* buffer, | 
|  | 243 | unsigned long buflen); | 
| Jeremy Chinsen | 617a2e8 | 2019-06-20 00:11:12 +0000 | [diff] [blame] | 244 |  | 
|  | 245 | // Returns the length of the raw stream data from |stream|. The raw data is the | 
|  | 246 | // stream's data as stored in the PDF without applying any filters. If |buffer| | 
|  | 247 | // is non-nullptr and |buflen| is large enough to contain the raw data, then | 
|  | 248 | // the raw data is copied into |buffer|. | 
|  | 249 | unsigned long GetRawStreamMaybeCopyAndReturnLength(const CPDF_Stream* stream, | 
|  | 250 | void* buffer, | 
|  | 251 | unsigned long buflen); | 
|  | 252 |  | 
|  | 253 | // Return the length of the decoded stream data of |stream|. The decoded data is | 
|  | 254 | // the uncompressed stream data, i.e. the raw stream data after having all | 
|  | 255 | // filters applied. If |buffer| is non-nullptr and |buflen| is large enough to | 
|  | 256 | // contain the decoded data, then the decoded data is copied into |buffer|. | 
| Jane Liu | 548334e | 2017-08-03 16:33:40 -0400 | [diff] [blame] | 257 | unsigned long DecodeStreamMaybeCopyAndReturnLength(const CPDF_Stream* stream, | 
|  | 258 | void* buffer, | 
|  | 259 | unsigned long buflen); | 
|  | 260 |  | 
| Tom Sepez | 75f43c4 | 2015-07-15 16:35:53 -0700 | [diff] [blame] | 261 | void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); | 
|  | 262 | FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy); | 
| Dan Sinclair | 7aba472 | 2018-03-28 17:04:16 +0000 | [diff] [blame] | 263 |  | 
|  | 264 | // TODO(dsinclair): Where should this live? | 
| Tom Sepez | 59d2a59 | 2018-09-14 19:51:10 +0000 | [diff] [blame] | 265 | void RenderPageWithContext(CPDF_PageRenderContext* pContext, | 
|  | 266 | FPDF_PAGE page, | 
|  | 267 | int start_x, | 
|  | 268 | int start_y, | 
|  | 269 | int size_x, | 
|  | 270 | int size_y, | 
|  | 271 | int rotate, | 
|  | 272 | int flags, | 
|  | 273 | bool bNeedToRestore, | 
|  | 274 | IPDFSDK_PauseAdapter* pause); | 
| John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 275 |  | 
| Tom Sepez | 8128485 | 2018-06-12 19:26:15 +0000 | [diff] [blame] | 276 | void ReportUnsupportedFeatures(CPDF_Document* pDoc); | 
| Ryan Smith | 69fce9b | 2019-03-11 21:53:42 +0000 | [diff] [blame] | 277 | void CheckForUnsupportedAnnot(const CPDF_Annot* pAnnot); | 
| Dan Sinclair | 7aba472 | 2018-03-28 17:04:16 +0000 | [diff] [blame] | 278 |  | 
| Lei Zhang | bc10648 | 2019-05-30 23:55:19 +0000 | [diff] [blame] | 279 | #if !defined(OS_WIN) | 
| Dan Sinclair | 7aba472 | 2018-03-28 17:04:16 +0000 | [diff] [blame] | 280 | void SetLastError(int err); | 
|  | 281 | int GetLastError(); | 
| Lei Zhang | bc10648 | 2019-05-30 23:55:19 +0000 | [diff] [blame] | 282 | #endif | 
| Dan Sinclair | 7aba472 | 2018-03-28 17:04:16 +0000 | [diff] [blame] | 283 |  | 
| Tom Sepez | f10ae63 | 2016-01-26 14:19:52 -0800 | [diff] [blame] | 284 | void ProcessParseError(CPDF_Parser::Error err); | 
| Dan Sinclair | 7aba472 | 2018-03-28 17:04:16 +0000 | [diff] [blame] | 285 |  | 
| Dan Sinclair | 00d47a6 | 2018-03-28 18:39:04 +0000 | [diff] [blame] | 286 | #endif  // FPDFSDK_CPDFSDK_HELPERS_H_ |