OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "public/fpdf_dataavail.h" | 7 #include "public/fpdf_dataavail.h" |
8 | 8 |
9 #include "../include/fpdfxfa/fpdfxfa_app.h" | |
10 #include "../include/fpdfxfa/fpdfxfa_doc.h" | |
11 #include "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
12 #include "public/fpdf_formfill.h" | 10 #include "public/fpdf_formfill.h" |
13 | 11 |
| 12 // These checks are here because core/ and public/ cannot depend on each other. |
| 13 static_assert(IPDF_DataAvail::DataError == PDF_DATA_ERROR, |
| 14 "IPDF_DataAvail::DataError value mismatch"); |
| 15 static_assert(IPDF_DataAvail::DataNotAvailable == PDF_DATA_NOTAVAIL, |
| 16 "IPDF_DataAvail::DataNotAvailable value mismatch"); |
| 17 static_assert(IPDF_DataAvail::DataAvailable == PDF_DATA_AVAIL, |
| 18 "IPDF_DataAvail::DataAvailable value mismatch"); |
| 19 |
| 20 static_assert(IPDF_DataAvail::LinearizationUnknown == PDF_LINEARIZATION_UNKNOWN, |
| 21 "IPDF_DataAvail::LinearizationUnknown value mismatch"); |
| 22 static_assert(IPDF_DataAvail::NotLinearized == PDF_NOT_LINEARIZED, |
| 23 "IPDF_DataAvail::NotLinearized value mismatch"); |
| 24 static_assert(IPDF_DataAvail::Linearized == PDF_LINEARIZED, |
| 25 "IPDF_DataAvail::Linearized value mismatch"); |
| 26 |
| 27 static_assert(IPDF_DataAvail::FormError == PDF_FORM_ERROR, |
| 28 "IPDF_DataAvail::FormError value mismatch"); |
| 29 static_assert(IPDF_DataAvail::FormNotAvailable == PDF_FORM_NOTAVAIL, |
| 30 "IPDF_DataAvail::FormNotAvailable value mismatch"); |
| 31 static_assert(IPDF_DataAvail::FormAvailable == PDF_FORM_AVAIL, |
| 32 "IPDF_DataAvail::FormAvailable value mismatch"); |
| 33 static_assert(IPDF_DataAvail::FormNotExist == PDF_FORM_NOTEXIST, |
| 34 "IPDF_DataAvail::FormNotExist value mismatch"); |
| 35 |
14 class CFPDF_FileAvailWrap : public IFX_FileAvail { | 36 class CFPDF_FileAvailWrap : public IFX_FileAvail { |
15 public: | 37 public: |
16 CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } | 38 CFPDF_FileAvailWrap() { m_pfileAvail = NULL; } |
17 ~CFPDF_FileAvailWrap() override {} | 39 ~CFPDF_FileAvailWrap() override {} |
18 | 40 |
19 void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } | 41 void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; } |
20 | 42 |
21 // IFX_FileAvail | 43 // IFX_FileAvail |
22 FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) override { | 44 FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) override { |
23 return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); | 45 return m_pfileAvail->IsDataAvail(m_pfileAvail, offset, size); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return PDF_FORM_ERROR; | 160 return PDF_FORM_ERROR; |
139 CFPDF_DownloadHintsWrap hints_wrap(hints); | 161 CFPDF_DownloadHintsWrap hints_wrap(hints); |
140 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 162 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
141 } | 163 } |
142 | 164 |
143 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 165 DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
144 if (!avail) | 166 if (!avail) |
145 return PDF_LINEARIZATION_UNKNOWN; | 167 return PDF_LINEARIZATION_UNKNOWN; |
146 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 168 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
147 } | 169 } |
OLD | NEW |