Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Side by Side Diff: fpdfsdk/src/fpdf_flatten.cpp

Issue 1410343003: [Merge to XFA] Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebase to origin/xfa Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_Utils.cpp ('k') | fpdfsdk/src/fpdf_transformpage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 if (!pSourceDoc || !pPageDic) 87 if (!pSourceDoc || !pPageDic)
88 return FLATTEN_FAIL; 88 return FLATTEN_FAIL;
89 89
90 GetContentsRect(pSourceDoc, pPageDic, pRectArray); 90 GetContentsRect(pSourceDoc, pPageDic, pRectArray);
91 CPDF_Array* pAnnots = pPageDic->GetArray("Annots"); 91 CPDF_Array* pAnnots = pPageDic->GetArray("Annots");
92 if (!pAnnots) 92 if (!pAnnots)
93 return FLATTEN_NOTHINGTODO; 93 return FLATTEN_NOTHINGTODO;
94 94
95 FX_DWORD dwSize = pAnnots->GetCount(); 95 FX_DWORD dwSize = pAnnots->GetCount();
96 for (int i = 0; i < (int)dwSize; i++) { 96 for (int i = 0; i < (int)dwSize; i++) {
97 CPDF_Object* pObj = pAnnots->GetElementValue(i); 97 CPDF_Dictionary* pAnnotDic = ToDictionary(pAnnots->GetElementValue(i));
98 if (!pObj || pObj->GetType() != PDFOBJ_DICTIONARY) 98 if (!pAnnotDic)
99 continue; 99 continue;
100 100
101 CPDF_Dictionary* pAnnotDic = (CPDF_Dictionary*)pObj;
102 CFX_ByteString sSubtype = pAnnotDic->GetString("Subtype"); 101 CFX_ByteString sSubtype = pAnnotDic->GetString("Subtype");
103 if (sSubtype == "Popup") 102 if (sSubtype == "Popup")
104 continue; 103 continue;
105 104
106 int nAnnotFlag = pAnnotDic->GetInteger("F"); 105 int nAnnotFlag = pAnnotDic->GetInteger("F");
107 if (nAnnotFlag & ANNOTFLAG_HIDDEN) 106 if (nAnnotFlag & ANNOTFLAG_HIDDEN)
108 continue; 107 continue;
109 108
110 if (nUsage == FLAT_NORMALDISPLAY) { 109 if (nUsage == FLAT_NORMALDISPLAY) {
111 if (nAnnotFlag & ANNOTFLAG_INVISIBLE) 110 if (nAnnotFlag & ANNOTFLAG_INVISIBLE)
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, 516 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE,
518 FALSE); 517 FALSE);
519 } 518 }
520 pPageDict->RemoveAt("Annots"); 519 pPageDict->RemoveAt("Annots");
521 520
522 ObjectArray.RemoveAll(); 521 ObjectArray.RemoveAll();
523 RectArray.RemoveAll(); 522 RectArray.RemoveAll();
524 523
525 return FLATTEN_SUCCESS; 524 return FLATTEN_SUCCESS;
526 } 525 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_Utils.cpp ('k') | fpdfsdk/src/fpdf_transformpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698