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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 FX_DWORD err_code = pParser->StartAsynParse( | 107 FX_DWORD err_code = pParser->StartAsynParse( |
108 ((CFPDF_DataAvail*)avail)->m_pDataAvail->GetFileRead()); | 108 ((CFPDF_DataAvail*)avail)->m_pDataAvail->GetFileRead()); |
109 if (err_code) { | 109 if (err_code) { |
110 delete pParser; | 110 delete pParser; |
111 ProcessParseError(err_code); | 111 ProcessParseError(err_code); |
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 return FPDFDocumentFromCPDFDocument(pParser->GetDocument()); |
117 CPDFXFA_App* pApp = CPDFXFA_App::GetInstance(); | |
118 return new CPDFXFA_Document(pPDFDoc, pApp); | |
119 } | 117 } |
120 | 118 |
121 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { | 119 DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc) { |
122 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); | 120 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(doc); |
123 return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0; | 121 return pDoc ? pDoc->GetParser()->GetFirstPageNo() : 0; |
124 } | 122 } |
125 | 123 |
126 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, | 124 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, |
127 int page_index, | 125 int page_index, |
128 FX_DOWNLOADHINTS* hints) { | 126 FX_DOWNLOADHINTS* hints) { |
(...skipping 10 matching lines...) Expand all Loading... |
139 return -1; | 137 return -1; |
140 CFPDF_DownloadHintsWrap hints_wrap(hints); | 138 CFPDF_DownloadHintsWrap hints_wrap(hints); |
141 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 139 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
142 } | 140 } |
143 | 141 |
144 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 142 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
145 if (avail == NULL) | 143 if (avail == NULL) |
146 return -1; | 144 return -1; |
147 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 145 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
148 } | 146 } |
OLD | NEW |