| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_ | |
| 8 #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ | |
| 9 | |
| 10 #include "core/fpdfapi/fpdf_parser/cpdf_parser.h" | |
| 11 #include "core/fxge/fx_dib.h" | |
| 12 #include "public/fpdfview.h" | |
| 13 | |
| 14 #ifdef PDF_ENABLE_XFA | |
| 15 #include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" | |
| 16 #endif // PDF_ENABLE_XFA | |
| 17 | |
| 18 #ifdef _WIN32 | |
| 19 #include <math.h> | |
| 20 #include <tchar.h> | |
| 21 #endif | |
| 22 | |
| 23 class CPDF_Annot; | |
| 24 class CPDF_Page; | |
| 25 class CPDF_PageRenderContext; | |
| 26 class IFSDK_PAUSE_Adapter; | |
| 27 | |
| 28 class CPDF_CustomAccess final : public IFX_FileRead { | |
| 29 public: | |
| 30 explicit CPDF_CustomAccess(FPDF_FILEACCESS* pFileAccess); | |
| 31 ~CPDF_CustomAccess() override {} | |
| 32 | |
| 33 // IFX_FileRead | |
| 34 FX_FILESIZE GetSize() override; | |
| 35 void Release() override; | |
| 36 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; | |
| 37 | |
| 38 #ifdef PDF_ENABLE_XFA | |
| 39 virtual CFX_ByteString GetFullPath(); | |
| 40 virtual FX_BOOL GetByte(uint32_t pos, uint8_t& ch); | |
| 41 virtual FX_BOOL GetBlock(uint32_t pos, uint8_t* pBuf, uint32_t size); | |
| 42 #endif // PDF_ENABLE_XFA | |
| 43 | |
| 44 private: | |
| 45 FPDF_FILEACCESS m_FileAccess; | |
| 46 #ifdef PDF_ENABLE_XFA | |
| 47 uint8_t m_Buffer[512]; | |
| 48 uint32_t m_BufferOffset; | |
| 49 #endif // PDF_ENABLE_XFA | |
| 50 }; | |
| 51 | |
| 52 #ifdef PDF_ENABLE_XFA | |
| 53 class CFPDF_FileStream : public IFX_FileStream { | |
| 54 public: | |
| 55 explicit CFPDF_FileStream(FPDF_FILEHANDLER* pFS); | |
| 56 ~CFPDF_FileStream() override {} | |
| 57 | |
| 58 // IFX_FileStream: | |
| 59 IFX_FileStream* Retain() override; | |
| 60 void Release() override; | |
| 61 FX_FILESIZE GetSize() override; | |
| 62 FX_BOOL IsEOF() override; | |
| 63 FX_FILESIZE GetPosition() override; | |
| 64 FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) override; | |
| 65 size_t ReadBlock(void* buffer, size_t size) override; | |
| 66 FX_BOOL WriteBlock(const void* buffer, | |
| 67 FX_FILESIZE offset, | |
| 68 size_t size) override; | |
| 69 FX_BOOL Flush() override; | |
| 70 | |
| 71 void SetPosition(FX_FILESIZE pos) { m_nCurPos = pos; } | |
| 72 | |
| 73 protected: | |
| 74 FPDF_FILEHANDLER* m_pFS; | |
| 75 FX_FILESIZE m_nCurPos; | |
| 76 }; | |
| 77 #endif // PDF_ENABLE_XFA | |
| 78 | |
| 79 // Object types for public FPDF_ types; these correspond to next layer down | |
| 80 // from fpdfsdk. For master, these are CPDF_ types, but for XFA, these are | |
| 81 // CPDFXFA_ types. | |
| 82 #ifndef PDF_ENABLE_XFA | |
| 83 using UnderlyingDocumentType = CPDF_Document; | |
| 84 using UnderlyingPageType = CPDF_Page; | |
| 85 #else // PDF_ENABLE_XFA | |
| 86 using UnderlyingDocumentType = CPDFXFA_Document; | |
| 87 using UnderlyingPageType = CPDFXFA_Page; | |
| 88 #endif // PDF_ENABLE_XFA | |
| 89 | |
| 90 // Conversions to/from underlying types. | |
| 91 UnderlyingDocumentType* UnderlyingFromFPDFDocument(FPDF_DOCUMENT doc); | |
| 92 FPDF_DOCUMENT FPDFDocumentFromUnderlying(UnderlyingDocumentType* doc); | |
| 93 | |
| 94 UnderlyingPageType* UnderlyingFromFPDFPage(FPDF_PAGE page); | |
| 95 | |
| 96 // Conversions to/from FPDF_ types. | |
| 97 CPDF_Document* CPDFDocumentFromFPDFDocument(FPDF_DOCUMENT doc); | |
| 98 FPDF_DOCUMENT FPDFDocumentFromCPDFDocument(CPDF_Document* doc); | |
| 99 | |
| 100 CPDF_Page* CPDFPageFromFPDFPage(FPDF_PAGE page); | |
| 101 | |
| 102 CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap); | |
| 103 | |
| 104 void FSDK_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); | |
| 105 FPDF_BOOL FSDK_IsSandBoxPolicyEnabled(FPDF_DWORD policy); | |
| 106 void FPDF_RenderPage_Retail(CPDF_PageRenderContext* pContext, | |
| 107 FPDF_PAGE page, | |
| 108 int start_x, | |
| 109 int start_y, | |
| 110 int size_x, | |
| 111 int size_y, | |
| 112 int rotate, | |
| 113 int flags, | |
| 114 FX_BOOL bNeedToRestore, | |
| 115 IFSDK_PAUSE_Adapter* pause); | |
| 116 | |
| 117 void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code); | |
| 118 void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot); | |
| 119 void ProcessParseError(CPDF_Parser::Error err); | |
| 120 | |
| 121 #endif // FPDFSDK_INCLUDE_FSDK_DEFINE_H_ | |
| OLD | NEW |