| 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 "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
| 8 static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dict
ionary *pGroupDict) | 8 static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dict
ionary *pGroupDict) |
| 9 { | 9 { |
| 10 if (pObject == NULL || pGroupDict == NULL) { | 10 if (pObject == NULL || pGroupDict == NULL) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 int32_t iCount = pExpression->GetCount(); | 200 int32_t iCount = pExpression->GetCount(); |
| 201 CPDF_Object *pOCGObj; | 201 CPDF_Object *pOCGObj; |
| 202 CFX_ByteString csOperator = pExpression->GetString(0); | 202 CFX_ByteString csOperator = pExpression->GetString(0); |
| 203 if (csOperator == FX_BSTRC("Not")) { | 203 if (csOperator == FX_BSTRC("Not")) { |
| 204 pOCGObj = pExpression->GetElementValue(1); | 204 pOCGObj = pExpression->GetElementValue(1); |
| 205 if (pOCGObj == NULL) { | 205 if (pOCGObj == NULL) { |
| 206 return FALSE; | 206 return FALSE; |
| 207 } | 207 } |
| 208 if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) { | 208 if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) { |
| 209 return !(bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : Get
OCGVisible((CPDF_Dictionary*)pOCGObj)); | 209 return !(bFromConfig ? LoadOCGState((CPDF_Dictionary*)pOCGObj) : Get
OCGVisible((CPDF_Dictionary*)pOCGObj)); |
| 210 } else if (pOCGObj->GetType() == PDFOBJ_ARRAY) { | 210 } |
| 211 if (pOCGObj->GetType() == PDFOBJ_ARRAY) { |
| 211 return !GetOCGVE((CPDF_Array*)pOCGObj, bFromConfig, nLevel + 1); | 212 return !GetOCGVE((CPDF_Array*)pOCGObj, bFromConfig, nLevel + 1); |
| 212 } else { | |
| 213 return FALSE; | |
| 214 } | 213 } |
| 214 return FALSE; |
| 215 } | 215 } |
| 216 if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) { | 216 if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) { |
| 217 FX_BOOL bValue = FALSE; | 217 FX_BOOL bValue = FALSE; |
| 218 for (int32_t i = 1; i < iCount; i ++) { | 218 for (int32_t i = 1; i < iCount; i ++) { |
| 219 pOCGObj = pExpression->GetElementValue(1); | 219 pOCGObj = pExpression->GetElementValue(1); |
| 220 if (pOCGObj == NULL) { | 220 if (pOCGObj == NULL) { |
| 221 continue; | 221 continue; |
| 222 } | 222 } |
| 223 FX_BOOL bItem = FALSE; | 223 FX_BOOL bItem = FALSE; |
| 224 if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) { | 224 if (pOCGObj->GetType() == PDFOBJ_DICTIONARY) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 return FALSE; | 279 return FALSE; |
| 280 } | 280 } |
| 281 if (csP == FX_BSTRC("AllOff") && bItem) { | 281 if (csP == FX_BSTRC("AllOff") && bItem) { |
| 282 return FALSE; | 282 return FALSE; |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 return bState; | 285 return bState; |
| 286 } | 286 } |
| 287 FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary *pOCGDict) | 287 FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary *pOCGDict) |
| 288 { | 288 { |
| 289 if (pOCGDict == NULL) { | 289 if (!pOCGDict) { |
| 290 return TRUE; | 290 return TRUE; |
| 291 } | 291 } |
| 292 CFX_ByteString csType = pOCGDict->GetString(FX_BSTRC("Type"), FX_BSTRC("OCG"
)); | 292 CFX_ByteString csType = pOCGDict->GetString(FX_BSTRC("Type"), FX_BSTRC("OCG"
)); |
| 293 if (csType == FX_BSTRC("OCG")) { | 293 if (csType == FX_BSTRC("OCG")) { |
| 294 return GetOCGVisible(pOCGDict); | 294 return GetOCGVisible(pOCGDict); |
| 295 } else { | |
| 296 return LoadOCMDState(pOCGDict, FALSE); | |
| 297 } | 295 } |
| 296 return LoadOCMDState(pOCGDict, FALSE); |
| 298 } | 297 } |
| 299 void CPDF_OCContext::ResetOCContext() | 298 void CPDF_OCContext::ResetOCContext() |
| 300 { | 299 { |
| 301 m_OCGStates.clear(); | 300 m_OCGStates.clear(); |
| 302 } | 301 } |
| OLD | NEW |