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/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../fpdf_page/pageint.h" | 9 #include "../fpdf_page/pageint.h" |
10 #include <limits.h> | 10 #include <limits.h> |
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 static int InsertDeletePDFPage(CPDF_Document* pDoc, CPDF_Dictionary* pPages, | 1053 static int InsertDeletePDFPage(CPDF_Document* pDoc, CPDF_Dictionary* pPages, |
1054 int nPagesToGo, CPDF_Dictionary* pPage, FX_BOOL b
Insert, CFX_PtrArray& stackList) | 1054 int nPagesToGo, CPDF_Dictionary* pPage, FX_BOOL b
Insert, CFX_PtrArray& stackList) |
1055 { | 1055 { |
1056 CPDF_Array* pKidList = pPages->GetArray("Kids"); | 1056 CPDF_Array* pKidList = pPages->GetArray("Kids"); |
1057 if (!pKidList) { | 1057 if (!pKidList) { |
1058 return -1; | 1058 return -1; |
1059 } | 1059 } |
1060 int nKids = pKidList->GetCount(); | 1060 int nKids = pKidList->GetCount(); |
1061 for (int i = 0; i < nKids; i ++) { | 1061 for (int i = 0; i < nKids; i ++) { |
1062 CPDF_Dictionary* pKid = pKidList->GetDict(i); | 1062 CPDF_Dictionary* pKid = pKidList->GetDict(i); |
1063 if (pKid->GetString("Type") == FX_BSTRC("Page")) { | 1063 if (pKid->GetStringAt("Type") == "Page") { |
1064 if (nPagesToGo == 0) { | 1064 if (nPagesToGo == 0) { |
1065 if (bInsert) { | 1065 if (bInsert) { |
1066 pKidList->InsertAt(i, CPDF_Reference::Create(pDoc, pPage->Ge
tObjNum())); | 1066 pKidList->InsertAt(i, CPDF_Reference::Create(pDoc, pPage->Ge
tObjNum())); |
1067 pPage->SetAtReference("Parent", pDoc, pPages->GetObjNum()); | 1067 pPage->SetAtReference("Parent", pDoc, pPages->GetObjNum()); |
1068 } else { | 1068 } else { |
1069 pKidList->RemoveAt(i); | 1069 pKidList->RemoveAt(i); |
1070 } | 1070 } |
1071 pPages->SetAtInteger("Count", pPages->GetInteger("Count") + (bIn
sert ? 1 : -1)); | 1071 pPages->SetAtInteger("Count", pPages->GetInteger("Count") + (bIn
sert ? 1 : -1)); |
1072 return 1; | 1072 return 1; |
1073 } | 1073 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, const CFX_ByteStringC& nam
e) | 1172 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, const CFX_ByteStringC& nam
e) |
1173 { | 1173 { |
1174 if (pPageDict->KeyExist(name)) { | 1174 if (pPageDict->KeyExist(name)) { |
1175 return; | 1175 return; |
1176 } | 1176 } |
1177 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); | 1177 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); |
1178 if (pObj) { | 1178 if (pObj) { |
1179 pPageDict->SetAt(name, pObj->Clone()); | 1179 pPageDict->SetAt(name, pObj->Clone()); |
1180 } | 1180 } |
1181 } | 1181 } |
OLD | NEW |