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/fpdfapi/fpdf_page/cpdf_contentmarkdata.h" | 7 #include "core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h" |
8 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" | 8 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" |
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const auto it = m_OCGStates.find(pOCGDict); | 178 const auto it = m_OCGStates.find(pOCGDict); |
179 if (it != m_OCGStates.end()) | 179 if (it != m_OCGStates.end()) |
180 return it->second; | 180 return it->second; |
181 | 181 |
182 bool bState = LoadOCGState(pOCGDict); | 182 bool bState = LoadOCGState(pOCGDict); |
183 m_OCGStates[pOCGDict] = bState; | 183 m_OCGStates[pOCGDict] = bState; |
184 return bState; | 184 return bState; |
185 } | 185 } |
186 | 186 |
187 bool CPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) { | 187 bool CPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) { |
188 const CPDF_ContentMarkData* pData = pObj->m_ContentMark; | 188 const CPDF_ContentMarkData* pData = pObj->m_ContentMark.GetObject(); |
189 for (int i = 0; i < pData->CountItems(); i++) { | 189 for (int i = 0; i < pData->CountItems(); i++) { |
190 const CPDF_ContentMarkItem& item = pData->GetItem(i); | 190 const CPDF_ContentMarkItem& item = pData->GetItem(i); |
191 if (item.GetName() == "OC" && | 191 if (item.GetName() == "OC" && |
192 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict && | 192 item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict && |
193 !CheckOCGVisible(item.GetParam())) { | 193 !CheckOCGVisible(item.GetParam())) { |
194 return false; | 194 return false; |
195 } | 195 } |
196 } | 196 } |
197 return true; | 197 return true; |
198 } | 198 } |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 bool CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary* pOCGDict) { | 276 bool CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary* pOCGDict) { |
277 if (!pOCGDict) | 277 if (!pOCGDict) |
278 return true; | 278 return true; |
279 | 279 |
280 CFX_ByteString csType = pOCGDict->GetStringBy("Type", "OCG"); | 280 CFX_ByteString csType = pOCGDict->GetStringBy("Type", "OCG"); |
281 if (csType == "OCG") | 281 if (csType == "OCG") |
282 return GetOCGVisible(pOCGDict); | 282 return GetOCGVisible(pOCGDict); |
283 return LoadOCMDState(pOCGDict); | 283 return LoadOCMDState(pOCGDict); |
284 } | 284 } |
OLD | NEW |