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 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 10 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return NULL; | 112 return NULL; |
113 } | 113 } |
114 ((CFPDF_DataAvail*)avail)->m_pDataAvail->SetDocument(pParser->GetDocument()); | 114 ((CFPDF_DataAvail*)avail)->m_pDataAvail->SetDocument(pParser->GetDocument()); |
115 CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS); | 115 CheckUnSupportError(pParser->GetDocument(), FPDF_ERR_SUCCESS); |
116 CPDF_Document* pPDFDoc = pParser->GetDocument(); | 116 CPDF_Document* pPDFDoc = pParser->GetDocument(); |
117 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); | 117 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); |
118 return new CPDFXFA_Document(pPDFDoc, pApp); | 118 return new CPDFXFA_Document(pPDFDoc, pApp); |
119 } | 119 } |
120 | 120 |
121 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { | 121 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { |
122 if (doc == NULL) | 122 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); |
123 return 0; | 123 return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0; |
124 CPDF_Document* pDoc = ((CPDFXFA_Document*)doc)->GetPDFDoc(); | |
125 return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo(); | |
126 } | 124 } |
127 | 125 |
128 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, | 126 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, |
129 int page_index, | 127 int page_index, |
130 FX_DOWNLOADHINTS* hints) { | 128 FX_DOWNLOADHINTS* hints) { |
131 if (avail == NULL || hints == NULL) | 129 if (avail == NULL || hints == NULL) |
132 return 0; | 130 return 0; |
133 CFPDF_DownloadHintsWrap hints_wrap(hints); | 131 CFPDF_DownloadHintsWrap hints_wrap(hints); |
134 return ((CFPDF_DataAvail*)avail) | 132 return ((CFPDF_DataAvail*)avail) |
135 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap); | 133 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap); |
136 } | 134 } |
137 | 135 |
138 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, | 136 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, |
139 FX_DOWNLOADHINTS* hints) { | 137 FX_DOWNLOADHINTS* hints) { |
140 if (avail == NULL || hints == NULL) | 138 if (avail == NULL || hints == NULL) |
141 return -1; | 139 return -1; |
142 CFPDF_DownloadHintsWrap hints_wrap(hints); | 140 CFPDF_DownloadHintsWrap hints_wrap(hints); |
143 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 141 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
144 } | 142 } |
145 | 143 |
146 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 144 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
147 if (avail == NULL) | 145 if (avail == NULL) |
148 return -1; | 146 return -1; |
149 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 147 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
150 } | 148 } |
OLD | NEW |