| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/include/cpdfsdk_widget.h" | 7 #include "fpdfsdk/include/cpdfsdk_widget.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1828 if (sImageAlias.IsEmpty()) | 1828 if (sImageAlias.IsEmpty()) |
| 1829 sImageAlias = "IMG"; | 1829 sImageAlias = "IMG"; |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources"); | 1832 CPDF_Dictionary* pStreamResList = pStreamDict->GetDictFor("Resources"); |
| 1833 if (!pStreamResList) { | 1833 if (!pStreamResList) { |
| 1834 pStreamResList = new CPDF_Dictionary(); | 1834 pStreamResList = new CPDF_Dictionary(); |
| 1835 pStreamDict->SetFor("Resources", pStreamResList); | 1835 pStreamDict->SetFor("Resources", pStreamResList); |
| 1836 } | 1836 } |
| 1837 | 1837 |
| 1838 if (pStreamResList) { | 1838 CPDF_Dictionary* pXObject = new CPDF_Dictionary; |
| 1839 CPDF_Dictionary* pXObject = new CPDF_Dictionary; | 1839 pXObject->SetReferenceFor(sImageAlias, pDoc, pImage->GetObjNum()); |
| 1840 pXObject->SetReferenceFor(sImageAlias, pDoc, pImage); | 1840 pStreamResList->SetFor("XObject", pXObject); |
| 1841 pStreamResList->SetFor("XObject", pXObject); | |
| 1842 } | |
| 1843 } | 1841 } |
| 1844 | 1842 |
| 1845 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) { | 1843 void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) { |
| 1846 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP")) | 1844 if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictFor("AP")) |
| 1847 pAPDict->RemoveFor(sAPType); | 1845 pAPDict->RemoveFor(sAPType); |
| 1848 } | 1846 } |
| 1849 | 1847 |
| 1850 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, | 1848 FX_BOOL CPDFSDK_Widget::OnAAction(CPDF_AAction::AActionType type, |
| 1851 PDFSDK_FieldAction& data, | 1849 PDFSDK_FieldAction& data, |
| 1852 CPDFSDK_PageView* pPageView) { | 1850 CPDFSDK_PageView* pPageView) { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 return FALSE; | 1949 return FALSE; |
| 1952 | 1950 |
| 1953 if (!IsVisible()) | 1951 if (!IsVisible()) |
| 1954 return FALSE; | 1952 return FALSE; |
| 1955 | 1953 |
| 1956 if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) | 1954 if ((GetFieldFlags() & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) |
| 1957 return FALSE; | 1955 return FALSE; |
| 1958 | 1956 |
| 1959 return TRUE; | 1957 return TRUE; |
| 1960 } | 1958 } |
| OLD | NEW |