OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 CORE_INCLUDE_FPDFAPI_IPDF_DATA_AVAIL_H_ | |
8 #define CORE_INCLUDE_FPDFAPI_IPDF_DATA_AVAIL_H_ | |
9 | |
10 #include "core/include/fxcrt/fx_stream.h" | |
11 #include "core/include/fxcrt/fx_system.h" | |
12 | |
13 class CPDF_Document; | |
14 class CPDF_Object; | |
15 | |
16 class IPDF_DataAvail { | |
17 public: | |
18 // Must match PDF_DATA_* definitions in public/fpdf_dataavail.h, but cannot | |
19 // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts | |
20 // to make sure the two sets of values match. | |
21 enum DocAvailStatus { | |
22 DataError = -1, // PDF_DATA_ERROR | |
23 DataNotAvailable = 0, // PDF_DATA_NOTAVAIL | |
24 DataAvailable = 1, // PDF_DATA_AVAIL | |
25 }; | |
26 | |
27 // Must match PDF_*LINEAR* definitions in public/fpdf_dataavail.h, but cannot | |
28 // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts | |
29 // to make sure the two sets of values match. | |
30 enum DocLinearizationStatus { | |
31 LinearizationUnknown = -1, // PDF_LINEARIZATION_UNKNOWN | |
32 NotLinearized = 0, // PDF_NOT_LINEARIZED | |
33 Linearized = 1, // PDF_LINEARIZED | |
34 }; | |
35 | |
36 // Must match PDF_FORM_* definitions in public/fpdf_dataavail.h, but cannot | |
37 // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts | |
38 // to make sure the two sets of values match. | |
39 enum DocFormStatus { | |
40 FormError = -1, // PDF_FORM_ERROR | |
41 FormNotAvailable = 0, // PDF_FORM_NOTAVAIL | |
42 FormAvailable = 1, // PDF_FORM_AVAIL | |
43 FormNotExist = 2, // PDF_FORM_NOTEXIST | |
44 }; | |
45 | |
46 class FileAvail { | |
47 public: | |
48 virtual ~FileAvail(); | |
49 virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) = 0; | |
50 }; | |
51 | |
52 class DownloadHints { | |
53 public: | |
54 virtual ~DownloadHints(); | |
55 virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) = 0; | |
56 }; | |
57 | |
58 static IPDF_DataAvail* Create(FileAvail* pFileAvail, IFX_FileRead* pFileRead); | |
59 virtual ~IPDF_DataAvail(); | |
60 | |
61 FileAvail* GetFileAvail() const { return m_pFileAvail; } | |
62 IFX_FileRead* GetFileRead() const { return m_pFileRead; } | |
63 | |
64 virtual DocAvailStatus IsDocAvail(DownloadHints* pHints) = 0; | |
65 virtual void SetDocument(CPDF_Document* pDoc) = 0; | |
66 virtual DocAvailStatus IsPageAvail(int iPage, DownloadHints* pHints) = 0; | |
67 virtual FX_BOOL IsLinearized() = 0; | |
68 virtual DocFormStatus IsFormAvail(DownloadHints* pHints) = 0; | |
69 virtual DocLinearizationStatus IsLinearizedPDF() = 0; | |
70 virtual void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, | |
71 FX_DWORD* pSize) = 0; | |
72 | |
73 protected: | |
74 IPDF_DataAvail(FileAvail* pFileAvail, IFX_FileRead* pFileRead); | |
75 | |
76 FileAvail* m_pFileAvail; | |
77 IFX_FileRead* m_pFileRead; | |
78 }; | |
79 | |
80 #endif // CORE_INCLUDE_FPDFAPI_IPDF_DATA_AVAIL_H_ | |
OLD | NEW |