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