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 #include "../../public/fpdf_formfill.h" | 8 #include "../../public/fpdf_formfill.h" |
9 #include "../include/fsdk_define.h" | 9 #include "../include/fsdk_define.h" |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 delete pParser; | 108 delete pParser; |
109 ProcessParseError(err_code); | 109 ProcessParseError(err_code); |
110 return NULL; | 110 return NULL; |
111 } | 111 } |
112 ((CFPDF_DataAvail*)avail)->m_pDataAvail->SetDocument(pParser->GetDocument()); | 112 ((CFPDF_DataAvail*)avail)->m_pDataAvail->SetDocument(pParser->GetDocument()); |
113 CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS); | 113 CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS); |
114 return pParser->GetDocument(); | 114 return pParser->GetDocument(); |
115 } | 115 } |
116 | 116 |
117 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { | 117 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { |
118 if (doc == NULL) | 118 CPDF_Document* pDoc = CPDF_Document::FromFPDFDocument(doc); |
| 119 if (!doc) |
119 return 0; | 120 return 0; |
120 CPDF_Document* pDoc = (CPDF_Document*)doc; | |
121 return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo(); | 121 return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo(); |
122 } | 122 } |
123 | 123 |
124 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, | 124 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, |
125 int page_index, | 125 int page_index, |
126 FX_DOWNLOADHINTS* hints) { | 126 FX_DOWNLOADHINTS* hints) { |
127 if (avail == NULL || hints == NULL) | 127 if (avail == NULL || hints == NULL) |
128 return 0; | 128 return 0; |
129 CFPDF_DownloadHintsWrap hints_wrap(hints); | 129 CFPDF_DownloadHintsWrap hints_wrap(hints); |
130 return ((CFPDF_DataAvail*)avail) | 130 return ((CFPDF_DataAvail*)avail) |
131 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap); | 131 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap); |
132 } | 132 } |
133 | 133 |
134 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, | 134 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, |
135 FX_DOWNLOADHINTS* hints) { | 135 FX_DOWNLOADHINTS* hints) { |
136 if (avail == NULL || hints == NULL) | 136 if (avail == NULL || hints == NULL) |
137 return -1; | 137 return -1; |
138 CFPDF_DownloadHintsWrap hints_wrap(hints); | 138 CFPDF_DownloadHintsWrap hints_wrap(hints); |
139 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 139 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
140 } | 140 } |
141 | 141 |
142 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 142 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
143 if (avail == NULL) | 143 if (avail == NULL) |
144 return -1; | 144 return -1; |
145 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 145 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
146 } | 146 } |
OLD | NEW |