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 "core/fpdfapi/fpdf_page/cpdf_contentmark.h" | 7 #include "core/fpdfapi/fpdf_page/cpdf_contentmark.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
10 #include "third_party/base/stl_util.h" | 10 #include "third_party/base/stl_util.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return m_Marks[index]; | 97 return m_Marks[index]; |
98 } | 98 } |
99 | 99 |
100 int CPDF_ContentMark::MarkData::GetMCID() const { | 100 int CPDF_ContentMark::MarkData::GetMCID() const { |
101 for (const auto& mark : m_Marks) { | 101 for (const auto& mark : m_Marks) { |
102 CPDF_ContentMarkItem::ParamType type = mark.GetParamType(); | 102 CPDF_ContentMarkItem::ParamType type = mark.GetParamType(); |
103 if (type == CPDF_ContentMarkItem::PropertiesDict || | 103 if (type == CPDF_ContentMarkItem::PropertiesDict || |
104 type == CPDF_ContentMarkItem::DirectDict) { | 104 type == CPDF_ContentMarkItem::DirectDict) { |
105 CPDF_Dictionary* pDict = mark.GetParam(); | 105 CPDF_Dictionary* pDict = mark.GetParam(); |
106 if (pDict->KeyExist("MCID")) | 106 if (pDict->KeyExist("MCID")) |
107 return pDict->GetIntegerBy("MCID"); | 107 return pDict->GetIntegerFor("MCID"); |
108 } | 108 } |
109 } | 109 } |
110 return -1; | 110 return -1; |
111 } | 111 } |
112 | 112 |
113 void CPDF_ContentMark::MarkData::AddMark(const CFX_ByteString& name, | 113 void CPDF_ContentMark::MarkData::AddMark(const CFX_ByteString& name, |
114 CPDF_Dictionary* pDict, | 114 CPDF_Dictionary* pDict, |
115 FX_BOOL bDirect) { | 115 FX_BOOL bDirect) { |
116 CPDF_ContentMarkItem item; | 116 CPDF_ContentMarkItem item; |
117 item.SetName(name); | 117 item.SetName(name); |
118 if (pDict) { | 118 if (pDict) { |
119 if (bDirect) { | 119 if (bDirect) { |
120 item.SetParam(CPDF_ContentMarkItem::DirectDict, | 120 item.SetParam(CPDF_ContentMarkItem::DirectDict, |
121 ToDictionary(pDict->Clone())); | 121 ToDictionary(pDict->Clone())); |
122 } else { | 122 } else { |
123 item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict); | 123 item.SetParam(CPDF_ContentMarkItem::PropertiesDict, pDict); |
124 } | 124 } |
125 } | 125 } |
126 m_Marks.push_back(item); | 126 m_Marks.push_back(item); |
127 } | 127 } |
128 | 128 |
129 void CPDF_ContentMark::MarkData::DeleteLastMark() { | 129 void CPDF_ContentMark::MarkData::DeleteLastMark() { |
130 if (!m_Marks.empty()) | 130 if (!m_Marks.empty()) |
131 m_Marks.pop_back(); | 131 m_Marks.pop_back(); |
132 } | 132 } |
OLD | NEW |