| 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 "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" | 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 CPDF_Document* pPDFDoc = m_pDocument->GetPDFDoc(); | 40 CPDF_Document* pPDFDoc = m_pDocument->GetPDFDoc(); |
| 41 if (!pPDFDoc) | 41 if (!pPDFDoc) |
| 42 return FALSE; | 42 return FALSE; |
| 43 | 43 |
| 44 CPDF_Dictionary* pDict = pPDFDoc->GetPage(m_iPageIndex); | 44 CPDF_Dictionary* pDict = pPDFDoc->GetPage(m_iPageIndex); |
| 45 if (!pDict) | 45 if (!pDict) |
| 46 return FALSE; | 46 return FALSE; |
| 47 | 47 |
| 48 if (!m_pPDFPage || m_pPDFPage->m_pFormDict != pDict) { | 48 if (!m_pPDFPage || m_pPDFPage->m_pFormDict != pDict) { |
| 49 m_pPDFPage.reset(new CPDF_Page); | 49 m_pPDFPage.reset(new CPDF_Page(pPDFDoc, pDict, true)); |
| 50 m_pPDFPage->Load(pPDFDoc, pDict); | 50 m_pPDFPage->ParseContent(); |
| 51 m_pPDFPage->ParseContent(nullptr); | |
| 52 } | 51 } |
| 53 return TRUE; | 52 return TRUE; |
| 54 } | 53 } |
| 55 | 54 |
| 56 FX_BOOL CPDFXFA_Page::LoadXFAPageView() { | 55 FX_BOOL CPDFXFA_Page::LoadXFAPageView() { |
| 57 if (!m_pDocument) | 56 if (!m_pDocument) |
| 58 return FALSE; | 57 return FALSE; |
| 59 | 58 |
| 60 CXFA_FFDoc* pXFADoc = m_pDocument->GetXFADoc(); | 59 CXFA_FFDoc* pXFADoc = m_pDocument->GetXFADoc(); |
| 61 if (!pXFADoc) | 60 if (!pXFADoc) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 88 } | 87 } |
| 89 default: | 88 default: |
| 90 return FALSE; | 89 return FALSE; |
| 91 } | 90 } |
| 92 } | 91 } |
| 93 | 92 |
| 94 FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) { | 93 FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) { |
| 95 if (!m_pDocument || m_iPageIndex < 0 || !pageDict) | 94 if (!m_pDocument || m_iPageIndex < 0 || !pageDict) |
| 96 return FALSE; | 95 return FALSE; |
| 97 | 96 |
| 98 m_pPDFPage.reset(new CPDF_Page()); | 97 m_pPDFPage.reset(new CPDF_Page(m_pDocument->GetPDFDoc(), pageDict, true)); |
| 99 m_pPDFPage->Load(m_pDocument->GetPDFDoc(), pageDict); | 98 m_pPDFPage->ParseContent(); |
| 100 m_pPDFPage->ParseContent(nullptr); | |
| 101 return TRUE; | 99 return TRUE; |
| 102 } | 100 } |
| 103 | 101 |
| 104 FX_FLOAT CPDFXFA_Page::GetPageWidth() const { | 102 FX_FLOAT CPDFXFA_Page::GetPageWidth() const { |
| 105 if (!m_pPDFPage && !m_pXFAPageView) | 103 if (!m_pPDFPage && !m_pXFAPageView) |
| 106 return 0.0f; | 104 return 0.0f; |
| 107 | 105 |
| 108 int nDocType = m_pDocument->GetDocType(); | 106 int nDocType = m_pDocument->GetDocType(); |
| 109 switch (nDocType) { | 107 switch (nDocType) { |
| 110 case DOCTYPE_DYNAMIC_XFA: { | 108 case DOCTYPE_DYNAMIC_XFA: { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 case DOCTYPE_PDF: | 220 case DOCTYPE_PDF: |
| 223 case DOCTYPE_STATIC_XFA: { | 221 case DOCTYPE_STATIC_XFA: { |
| 224 if (m_pPDFPage) { | 222 if (m_pPDFPage) { |
| 225 m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate); | 223 m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate); |
| 226 } | 224 } |
| 227 } break; | 225 } break; |
| 228 default: | 226 default: |
| 229 return; | 227 return; |
| 230 } | 228 } |
| 231 } | 229 } |
| OLD | NEW |