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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1098 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { | 1098 CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { |
1099 CPDF_Dictionary* pDict = new CPDF_Dictionary; | 1099 CPDF_Dictionary* pDict = new CPDF_Dictionary; |
1100 pDict->SetAtName("Type", "Page"); | 1100 pDict->SetAtName("Type", "Page"); |
1101 FX_DWORD dwObjNum = AddIndirectObject(pDict); | 1101 FX_DWORD dwObjNum = AddIndirectObject(pDict); |
1102 if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { | 1102 if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { |
1103 ReleaseIndirectObject(dwObjNum); | 1103 ReleaseIndirectObject(dwObjNum); |
1104 return NULL; | 1104 return NULL; |
1105 } | 1105 } |
1106 return pDict; | 1106 return pDict; |
1107 } | 1107 } |
1108 int _PDF_GetStandardFontName(CFX_ByteString& name); | 1108 |
1109 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, | 1109 CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font, |
1110 CPDF_FontEncoding* pEncoding) { | 1110 CPDF_FontEncoding* pEncoding) { |
1111 CFX_ByteString name(font, -1); | 1111 CFX_ByteString name(font, -1); |
Tom Sepez
2015/10/16 21:32:33
nit: the -1 isn't needed, the one-arg form hits st
Lei Zhang
2015/10/16 21:34:52
There's more of them. I'll fix them all in another
| |
1112 if (_PDF_GetStandardFontName(name) < 0) { | 1112 if (PDF_GetStandardFontName(&name) < 0) |
1113 return NULL; | 1113 return nullptr; |
1114 } | |
1115 return GetPageData()->GetStandardFont(name, pEncoding); | 1114 return GetPageData()->GetStandardFont(name, pEncoding); |
1116 } | 1115 } |
1116 | |
1117 void CPDF_Document::DeletePage(int iPage) { | 1117 void CPDF_Document::DeletePage(int iPage) { |
1118 CPDF_Dictionary* pRoot = GetRoot(); | 1118 CPDF_Dictionary* pRoot = GetRoot(); |
1119 if (pRoot == NULL) { | 1119 if (pRoot == NULL) { |
1120 return; | 1120 return; |
1121 } | 1121 } |
1122 CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); | 1122 CPDF_Dictionary* pPages = pRoot->GetDict("Pages"); |
1123 if (pPages == NULL) { | 1123 if (pPages == NULL) { |
1124 return; | 1124 return; |
1125 } | 1125 } |
1126 int nPages = pPages->GetInteger("Count"); | 1126 int nPages = pPages->GetInteger("Count"); |
(...skipping 12 matching lines...) Expand all Loading... | |
1139 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, | 1139 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, |
1140 const CFX_ByteStringC& name) { | 1140 const CFX_ByteStringC& name) { |
1141 if (pPageDict->KeyExist(name)) { | 1141 if (pPageDict->KeyExist(name)) { |
1142 return; | 1142 return; |
1143 } | 1143 } |
1144 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); | 1144 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); |
1145 if (pObj) { | 1145 if (pObj) { |
1146 pPageDict->SetAt(name, pObj->Clone()); | 1146 pPageDict->SetAt(name, pObj->Clone()); |
1147 } | 1147 } |
1148 } | 1148 } |
OLD | NEW |