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

Side by Side Diff: fpdfsdk/fpdf_ext.cpp

Issue 1841173002: Rename GetElementValue() to GetDirectObject{By,At}(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Use "At" for arrays. Created 4 years, 8 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
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_ext.h" 7 #include "public/fpdf_ext.h"
8 8
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { 98 FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
99 int count = pElement->CountAttrs(); 99 int count = pElement->CountAttrs();
100 int i = 0; 100 int i = 0;
101 for (i = 0; i < count; i++) { 101 for (i = 0; i < count; i++) {
102 CFX_ByteString space, name; 102 CFX_ByteString space, name;
103 CFX_WideString value; 103 CFX_WideString value;
104 pElement->GetAttrByIndex(i, space, name, value); 104 pElement->GetAttrByIndex(i, space, name, value);
105 if (space == "xmlns" && name == "adhocwf" && 105 if (space == "xmlns" && name == "adhocwf" &&
106 value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") { 106 value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
107 CXML_Element* pVersion = pElement->GetElement("adhocwf", cbName); 107 CXML_Element* pVersion = pElement->GetObjectBy("adhocwf", cbName);
108 if (!pVersion) 108 if (!pVersion)
109 continue; 109 continue;
110 CFX_WideString wsContent = pVersion->GetContent(0); // == 1.1 110 CFX_WideString wsContent = pVersion->GetContent(0); // == 1.1
111 int nType = wsContent.GetInteger(); 111 int nType = wsContent.GetInteger();
112 switch (nType) { 112 switch (nType) {
113 case 1: 113 case 1:
114 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_ACROBAT); 114 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_ACROBAT);
115 break; 115 break;
116 case 2: 116 case 2:
117 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM); 117 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM);
118 break; 118 break;
119 case 0: 119 case 0:
120 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_EMAIL); 120 FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDFORM_EMAIL);
121 break; 121 break;
122 } 122 }
123 } 123 }
124 } 124 }
125 125
126 uint32_t nCount = pElement->CountChildren(); 126 uint32_t nCount = pElement->CountChildren();
127 for (i = 0; i < (int)nCount; i++) { 127 for (i = 0; i < (int)nCount; i++) {
128 CXML_Element::ChildType childType = pElement->GetChildType(i); 128 CXML_Element::ChildType childType = pElement->GetChildType(i);
129 if (childType == CXML_Element::Element) { 129 if (childType == CXML_Element::Element) {
130 CXML_Element* pChild = pElement->GetElement(i); 130 CXML_Element* pChild = pElement->GetObjectBy(i);
131 if (CheckSharedForm(pChild, cbName)) 131 if (CheckSharedForm(pChild, cbName))
132 return TRUE; 132 return TRUE;
133 } 133 }
134 } 134 }
135 return FALSE; 135 return FALSE;
136 } 136 }
137 137
138 void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { 138 void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) {
139 // Security 139 // Security
140 if (err_code == FPDF_ERR_SECURITY) { 140 if (err_code == FPDF_ERR_SECURITY) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { 194 DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document) {
195 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); 195 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
196 if (!pDoc) 196 if (!pDoc)
197 return PAGEMODE_UNKNOWN; 197 return PAGEMODE_UNKNOWN;
198 198
199 CPDF_Dictionary* pRoot = pDoc->GetRoot(); 199 CPDF_Dictionary* pRoot = pDoc->GetRoot();
200 if (!pRoot) 200 if (!pRoot)
201 return PAGEMODE_UNKNOWN; 201 return PAGEMODE_UNKNOWN;
202 202
203 CPDF_Object* pName = pRoot->GetElement("PageMode"); 203 CPDF_Object* pName = pRoot->GetObjectBy("PageMode");
204 if (!pName) 204 if (!pName)
205 return PAGEMODE_USENONE; 205 return PAGEMODE_USENONE;
206 206
207 CFX_ByteString strPageMode = pName->GetString(); 207 CFX_ByteString strPageMode = pName->GetString();
208 if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone")) 208 if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone"))
209 return PAGEMODE_USENONE; 209 return PAGEMODE_USENONE;
210 if (strPageMode.EqualNoCase("UseOutlines")) 210 if (strPageMode.EqualNoCase("UseOutlines"))
211 return PAGEMODE_USEOUTLINES; 211 return PAGEMODE_USEOUTLINES;
212 if (strPageMode.EqualNoCase("UseThumbs")) 212 if (strPageMode.EqualNoCase("UseThumbs"))
213 return PAGEMODE_USETHUMBS; 213 return PAGEMODE_USETHUMBS;
214 if (strPageMode.EqualNoCase("FullScreen")) 214 if (strPageMode.EqualNoCase("FullScreen"))
215 return PAGEMODE_FULLSCREEN; 215 return PAGEMODE_FULLSCREEN;
216 if (strPageMode.EqualNoCase("UseOC")) 216 if (strPageMode.EqualNoCase("UseOC"))
217 return PAGEMODE_USEOC; 217 return PAGEMODE_USEOC;
218 if (strPageMode.EqualNoCase("UseAttachments")) 218 if (strPageMode.EqualNoCase("UseAttachments"))
219 return PAGEMODE_USEATTACHMENTS; 219 return PAGEMODE_USEATTACHMENTS;
220 220
221 return PAGEMODE_UNKNOWN; 221 return PAGEMODE_UNKNOWN;
222 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698