Chromium Code Reviews| 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 if (!doc) | |
| 123 return 0; | 124 return 0; |
| 124 CPDF_Document* pDoc = ((CPDFXFA_Document*)doc)->GetPDFDoc(); | |
| 125 return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo(); | 125 return ((CPDF_Parser*)pDoc->GetParser())->GetFirstPageNo(); |
|
Lei Zhang
2015/10/15 22:44:26
BTW, this cast is pointless. I need some shades so
Tom Sepez
2015/10/15 23:18:09
Done. Also a subtle error where the !pDoc not !do
| |
| 126 } | 126 } |
| 127 | 127 |
| 128 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, | 128 DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail, |
| 129 int page_index, | 129 int page_index, |
| 130 FX_DOWNLOADHINTS* hints) { | 130 FX_DOWNLOADHINTS* hints) { |
| 131 if (avail == NULL || hints == NULL) | 131 if (avail == NULL || hints == NULL) |
| 132 return 0; | 132 return 0; |
| 133 CFPDF_DownloadHintsWrap hints_wrap(hints); | 133 CFPDF_DownloadHintsWrap hints_wrap(hints); |
| 134 return ((CFPDF_DataAvail*)avail) | 134 return ((CFPDF_DataAvail*)avail) |
| 135 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap); | 135 ->m_pDataAvail->IsPageAvail(page_index, &hints_wrap); |
| 136 } | 136 } |
| 137 | 137 |
| 138 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, | 138 DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail, |
| 139 FX_DOWNLOADHINTS* hints) { | 139 FX_DOWNLOADHINTS* hints) { |
| 140 if (avail == NULL || hints == NULL) | 140 if (avail == NULL || hints == NULL) |
| 141 return -1; | 141 return -1; |
| 142 CFPDF_DownloadHintsWrap hints_wrap(hints); | 142 CFPDF_DownloadHintsWrap hints_wrap(hints); |
| 143 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); | 143 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsFormAvail(&hints_wrap); |
| 144 } | 144 } |
| 145 | 145 |
| 146 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { | 146 DLLEXPORT FPDF_BOOL STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail) { |
| 147 if (avail == NULL) | 147 if (avail == NULL) |
| 148 return -1; | 148 return -1; |
| 149 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); | 149 return ((CFPDF_DataAvail*)avail)->m_pDataAvail->IsLinearizedPDF(); |
| 150 } | 150 } |
| OLD | NEW |