| 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 "../../public/fpdf_flatten.h" | 7 #include "../../public/fpdf_flatten.h" |
| 8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
| 9 | 9 |
| 10 typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray; | 10 typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return FLATTEN_NOTHINGTODO; | 95 return FLATTEN_NOTHINGTODO; |
| 96 | 96 |
| 97 FX_DWORD dwSize = pAnnots->GetCount(); | 97 FX_DWORD dwSize = pAnnots->GetCount(); |
| 98 for (int i = 0; i < (int)dwSize; i++) | 98 for (int i = 0; i < (int)dwSize; i++) |
| 99 { | 99 { |
| 100 CPDF_Object* pObj = pAnnots->GetElementValue(i); | 100 CPDF_Object* pObj = pAnnots->GetElementValue(i); |
| 101 if (!pObj || pObj->GetType() != PDFOBJ_DICTIONARY) | 101 if (!pObj || pObj->GetType() != PDFOBJ_DICTIONARY) |
| 102 continue; | 102 continue; |
| 103 | 103 |
| 104 CPDF_Dictionary* pAnnotDic = (CPDF_Dictionary*)pObj; | 104 CPDF_Dictionary* pAnnotDic = (CPDF_Dictionary*)pObj; |
| 105 CFX_ByteString sSubtype = pAnnotDic->GetString("Subtype"); | 105 CFX_ByteString sSubtype = pAnnotDic->GetStringAt("Subtype"); |
| 106 if (sSubtype == "Popup") | 106 if (sSubtype == "Popup") |
| 107 continue; | 107 continue; |
| 108 | 108 |
| 109 int nAnnotFlag = pAnnotDic->GetInteger("F"); | 109 int nAnnotFlag = pAnnotDic->GetInteger("F"); |
| 110 if (nAnnotFlag & ANNOTFLAG_HIDDEN) | 110 if (nAnnotFlag & ANNOTFLAG_HIDDEN) |
| 111 continue; | 111 continue; |
| 112 | 112 |
| 113 if(nUsage == FLAT_NORMALDISPLAY) | 113 if(nUsage == FLAT_NORMALDISPLAY) |
| 114 { | 114 { |
| 115 if (nAnnotFlag & ANNOTFLAG_INVISIBLE) | 115 if (nAnnotFlag & ANNOTFLAG_INVISIBLE) |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 } | 438 } |
| 439 | 439 |
| 440 for (int i = 0; i < nStreams; i++) | 440 for (int i = 0; i < nStreams; i++) |
| 441 { | 441 { |
| 442 CPDF_Dictionary* pAnnotDic = ObjectArray.GetAt(i); | 442 CPDF_Dictionary* pAnnotDic = ObjectArray.GetAt(i); |
| 443 if (!pAnnotDic)continue; | 443 if (!pAnnotDic)continue; |
| 444 | 444 |
| 445 CPDF_Rect rcAnnot = pAnnotDic->GetRect("Rect"); | 445 CPDF_Rect rcAnnot = pAnnotDic->GetRect("Rect"); |
| 446 rcAnnot.Normalize(); | 446 rcAnnot.Normalize(); |
| 447 | 447 |
| 448 » » CFX_ByteString sAnnotState = pAnnotDic->GetString("AS"); | 448 » » CFX_ByteString sAnnotState = pAnnotDic->GetStringAt("AS"); |
| 449 CPDF_Dictionary* pAnnotAP = pAnnotDic->GetDict("AP"); | 449 CPDF_Dictionary* pAnnotAP = pAnnotDic->GetDict("AP"); |
| 450 if (!pAnnotAP)continue; | 450 if (!pAnnotAP)continue; |
| 451 | 451 |
| 452 CPDF_Stream* pAPStream = pAnnotAP->GetStream("N"); | 452 CPDF_Stream* pAPStream = pAnnotAP->GetStream("N"); |
| 453 if (!pAPStream) | 453 if (!pAPStream) |
| 454 { | 454 { |
| 455 CPDF_Dictionary* pAPDic = pAnnotAP->GetDict("N"); | 455 CPDF_Dictionary* pAPDic = pAnnotAP->GetDict("N"); |
| 456 if (!pAPDic)continue; | 456 if (!pAPDic)continue; |
| 457 | 457 |
| 458 if (!sAnnotState.IsEmpty()) | 458 if (!sAnnotState.IsEmpty()) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 | 540 |
| 541 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(
), FALSE, FALSE); | 541 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(
), FALSE, FALSE); |
| 542 } | 542 } |
| 543 pPageDict->RemoveAt( "Annots" ); | 543 pPageDict->RemoveAt( "Annots" ); |
| 544 | 544 |
| 545 ObjectArray.RemoveAll(); | 545 ObjectArray.RemoveAll(); |
| 546 RectArray.RemoveAll(); | 546 RectArray.RemoveAll(); |
| 547 | 547 |
| 548 return FLATTEN_SUCCESS; | 548 return FLATTEN_SUCCESS; |
| 549 } | 549 } |
| OLD | NEW |