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 "core/include/fpdfapi/fpdf_objects.h" | 7 #include "core/include/fpdfapi/fpdf_objects.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "core/include/fpdfapi/cpdf_parser.h" | 11 #include "core/include/fpdfapi/cpdf_parser.h" |
12 #include "core/include/fpdfapi/fpdf_parser.h" | 12 #include "core/include/fpdfapi/fpdf_parser_decode.h" |
13 #include "core/include/fxcrt/fx_string.h" | 13 #include "core/include/fxcrt/fx_string.h" |
14 #include "third_party/base/stl_util.h" | 14 #include "third_party/base/stl_util.h" |
15 | 15 |
16 CPDF_Object::~CPDF_Object() {} | 16 CPDF_Object::~CPDF_Object() {} |
17 | 17 |
18 CPDF_Object* CPDF_Object::GetDirect() const { | 18 CPDF_Object* CPDF_Object::GetDirect() const { |
19 return const_cast<CPDF_Object*>(this); | 19 return const_cast<CPDF_Object*>(this); |
20 } | 20 } |
21 | 21 |
22 void CPDF_Object::Release() { | 22 void CPDF_Object::Release() { |
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 CPDF_Array* pArray = GetArrayBy(key); | 662 CPDF_Array* pArray = GetArrayBy(key); |
663 if (pArray) | 663 if (pArray) |
664 matrix = pArray->GetMatrix(); | 664 matrix = pArray->GetMatrix(); |
665 return matrix; | 665 return matrix; |
666 } | 666 } |
667 | 667 |
668 FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { | 668 FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { |
669 return pdfium::ContainsKey(m_Map, key); | 669 return pdfium::ContainsKey(m_Map, key); |
670 } | 670 } |
671 | 671 |
| 672 bool CPDF_Dictionary::IsSignatureDict() const { |
| 673 CPDF_Object* pType = GetElementValue("Type"); |
| 674 if (!pType) |
| 675 pType = GetElementValue("FT"); |
| 676 return pType && pType->GetString() == "Sig"; |
| 677 } |
| 678 |
672 void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj) { | 679 void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj) { |
673 ASSERT(IsDictionary()); | 680 ASSERT(IsDictionary()); |
674 // Avoid 2 constructions of CFX_ByteString. | 681 // Avoid 2 constructions of CFX_ByteString. |
675 CFX_ByteString key_bytestring = key; | 682 CFX_ByteString key_bytestring = key; |
676 auto it = m_Map.find(key_bytestring); | 683 auto it = m_Map.find(key_bytestring); |
677 if (it == m_Map.end()) { | 684 if (it == m_Map.end()) { |
678 if (pObj) { | 685 if (pObj) { |
679 m_Map.insert(std::make_pair(key_bytestring, pObj)); | 686 m_Map.insert(std::make_pair(key_bytestring, pObj)); |
680 } | 687 } |
681 return; | 688 return; |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1132 pObj->Destroy(); | 1139 pObj->Destroy(); |
1133 return FALSE; | 1140 return FALSE; |
1134 } | 1141 } |
1135 it->second->Destroy(); | 1142 it->second->Destroy(); |
1136 } | 1143 } |
1137 pObj->m_ObjNum = objnum; | 1144 pObj->m_ObjNum = objnum; |
1138 m_IndirectObjs[objnum] = pObj; | 1145 m_IndirectObjs[objnum] = pObj; |
1139 m_LastObjNum = std::max(m_LastObjNum, objnum); | 1146 m_LastObjNum = std::max(m_LastObjNum, objnum); |
1140 return TRUE; | 1147 return TRUE; |
1141 } | 1148 } |
OLD | NEW |