| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| (...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 if (!pAPDict) { | 822 if (!pAPDict) { |
| 823 pAPDict = new CPDF_Dictionary; | 823 pAPDict = new CPDF_Dictionary; |
| 824 m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); | 824 m_pAnnot->GetAnnotDict()->SetAt("AP", pAPDict); |
| 825 } | 825 } |
| 826 | 826 |
| 827 CPDF_Stream* pStream = nullptr; | 827 CPDF_Stream* pStream = nullptr; |
| 828 CPDF_Dictionary* pParentDict = nullptr; | 828 CPDF_Dictionary* pParentDict = nullptr; |
| 829 | 829 |
| 830 if (sAPState.IsEmpty()) { | 830 if (sAPState.IsEmpty()) { |
| 831 pParentDict = pAPDict; | 831 pParentDict = pAPDict; |
| 832 pStream = pAPDict->GetStreamBy(sAPType.AsStringC()); | 832 pStream = pAPDict->GetStreamBy(sAPType); |
| 833 } else { | 833 } else { |
| 834 CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictBy(sAPType.AsStringC()); | 834 CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictBy(sAPType); |
| 835 if (!pAPTypeDict) { | 835 if (!pAPTypeDict) { |
| 836 pAPTypeDict = new CPDF_Dictionary; | 836 pAPTypeDict = new CPDF_Dictionary; |
| 837 pAPDict->SetAt(sAPType.AsStringC(), pAPTypeDict); | 837 pAPDict->SetAt(sAPType, pAPTypeDict); |
| 838 } | 838 } |
| 839 pParentDict = pAPTypeDict; | 839 pParentDict = pAPTypeDict; |
| 840 pStream = pAPTypeDict->GetStreamBy(sAPState.AsStringC()); | 840 pStream = pAPTypeDict->GetStreamBy(sAPState); |
| 841 } | 841 } |
| 842 | 842 |
| 843 if (!pStream) { | 843 if (!pStream) { |
| 844 pStream = new CPDF_Stream(nullptr, 0, nullptr); | 844 pStream = new CPDF_Stream(nullptr, 0, nullptr); |
| 845 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); | 845 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
| 846 int32_t objnum = pDoc->AddIndirectObject(pStream); | 846 int32_t objnum = pDoc->AddIndirectObject(pStream); |
| 847 pParentDict->SetAtReference(sAPType.AsStringC(), pDoc, objnum); | 847 pParentDict->SetAtReference(sAPType, pDoc, objnum); |
| 848 } | 848 } |
| 849 | 849 |
| 850 CPDF_Dictionary* pStreamDict = pStream->GetDict(); | 850 CPDF_Dictionary* pStreamDict = pStream->GetDict(); |
| 851 if (!pStreamDict) { | 851 if (!pStreamDict) { |
| 852 pStreamDict = new CPDF_Dictionary; | 852 pStreamDict = new CPDF_Dictionary; |
| 853 pStreamDict->SetAtName("Type", "XObject"); | 853 pStreamDict->SetAtName("Type", "XObject"); |
| 854 pStreamDict->SetAtName("Subtype", "Form"); | 854 pStreamDict->SetAtName("Subtype", "Form"); |
| 855 pStreamDict->SetAtInteger("FormType", 1); | 855 pStreamDict->SetAtInteger("FormType", 1); |
| 856 pStream->InitStream(nullptr, 0, pStreamDict); | 856 pStream->InitStream(nullptr, 0, pStreamDict); |
| 857 } | 857 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 954 | 954 |
| 955 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { | 955 CPDF_Page* CPDFSDK_Annot::GetPDFPage() { |
| 956 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; | 956 return m_pPageView ? m_pPageView->GetPDFPage() : nullptr; |
| 957 } | 957 } |
| 958 | 958 |
| 959 #ifdef PDF_ENABLE_XFA | 959 #ifdef PDF_ENABLE_XFA |
| 960 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { | 960 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() { |
| 961 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; | 961 return m_pPageView ? m_pPageView->GetPDFXFAPage() : nullptr; |
| 962 } | 962 } |
| 963 #endif // PDF_ENABLE_XFA | 963 #endif // PDF_ENABLE_XFA |
| OLD | NEW |