| 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_parser/include/cpdf_array.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 9 #include "core/fpdfdoc/include/fpdf_doc.h" | 9 #include "core/fpdfdoc/include/fpdf_doc.h" |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 if (!pOCGs) { | 131 if (!pOCGs) { |
| 132 continue; | 132 continue; |
| 133 } | 133 } |
| 134 if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) { | 134 if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) { |
| 135 continue; | 135 continue; |
| 136 } | 136 } |
| 137 CPDF_Dictionary* pState = pUsage->GetDictBy(csConfig); | 137 CPDF_Dictionary* pState = pUsage->GetDictBy(csConfig); |
| 138 if (!pState) { | 138 if (!pState) { |
| 139 continue; | 139 continue; |
| 140 } | 140 } |
| 141 bState = pState->GetStringBy(csFind.AsStringC()) != "OFF"; | 141 bState = pState->GetStringBy(csFind) != "OFF"; |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 return bState; | 144 return bState; |
| 145 } | 145 } |
| 146 FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const { | 146 FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const { |
| 147 if (!FPDFDOC_OCG_HasIntent(pOCGDict, "View", "View")) { | 147 if (!FPDFDOC_OCG_HasIntent(pOCGDict, "View", "View")) { |
| 148 return TRUE; | 148 return TRUE; |
| 149 } | 149 } |
| 150 CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType); | 150 CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType); |
| 151 CPDF_Dictionary* pUsage = pOCGDict->GetDictBy("Usage"); | 151 CPDF_Dictionary* pUsage = pOCGDict->GetDictBy("Usage"); |
| 152 if (pUsage) { | 152 if (pUsage) { |
| 153 CPDF_Dictionary* pState = pUsage->GetDictBy(csState.AsStringC()); | 153 CPDF_Dictionary* pState = pUsage->GetDictBy(csState); |
| 154 if (pState) { | 154 if (pState) { |
| 155 CFX_ByteString csFind = csState + "State"; | 155 CFX_ByteString csFind = csState + "State"; |
| 156 if (pState->KeyExist(csFind.AsStringC())) { | 156 if (pState->KeyExist(csFind)) { |
| 157 return pState->GetStringBy(csFind.AsStringC()) != "OFF"; | 157 return pState->GetStringBy(csFind) != "OFF"; |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 if (csState != "View") { | 160 if (csState != "View") { |
| 161 pState = pUsage->GetDictBy("View"); | 161 pState = pUsage->GetDictBy("View"); |
| 162 if (pState && pState->KeyExist("ViewState")) { | 162 if (pState && pState->KeyExist("ViewState")) { |
| 163 return pState->GetStringBy("ViewState") != "OFF"; | 163 return pState->GetStringBy("ViewState") != "OFF"; |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 FX_BOOL bDefValid = FALSE; | 167 FX_BOOL bDefValid = FALSE; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 269 } |
| 270 CFX_ByteString csType = pOCGDict->GetStringBy("Type", "OCG"); | 270 CFX_ByteString csType = pOCGDict->GetStringBy("Type", "OCG"); |
| 271 if (csType == "OCG") { | 271 if (csType == "OCG") { |
| 272 return GetOCGVisible(pOCGDict); | 272 return GetOCGVisible(pOCGDict); |
| 273 } | 273 } |
| 274 return LoadOCMDState(pOCGDict, FALSE); | 274 return LoadOCMDState(pOCGDict, FALSE); |
| 275 } | 275 } |
| 276 void CPDF_OCContext::ResetOCContext() { | 276 void CPDF_OCContext::ResetOCContext() { |
| 277 m_OCGStates.clear(); | 277 m_OCGStates.clear(); |
| 278 } | 278 } |
| OLD | NEW |