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

Side by Side Diff: core/fpdfdoc/doc_formcontrol.cpp

Issue 1862123003: Rename both As{Byte,Wide}StringC() helpers to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, fix new usage. 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
« no previous file with comments | « core/fpdfdoc/doc_form.cpp ('k') | core/fpdfdoc/doc_formfield.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 <algorithm> 7 #include <algorithm>
8 8
9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 auto subdict_it = pSubDict->begin(); 72 auto subdict_it = pSubDict->begin();
73 while (subdict_it != pSubDict->end()) { 73 while (subdict_it != pSubDict->end()) {
74 const CFX_ByteString& csKey2 = subdict_it->first; 74 const CFX_ByteString& csKey2 = subdict_it->first;
75 CPDF_Object* pObj2 = subdict_it->second; 75 CPDF_Object* pObj2 = subdict_it->second;
76 ++subdict_it; 76 ++subdict_it;
77 if (!pObj2) { 77 if (!pObj2) {
78 continue; 78 continue;
79 } 79 }
80 if (csKey2 != "Off") { 80 if (csKey2 != "Off") {
81 pSubDict->ReplaceKey(csKey2.AsByteStringC(), csValue.AsByteStringC()); 81 pSubDict->ReplaceKey(csKey2.AsStringC(), csValue.AsStringC());
82 break; 82 break;
83 } 83 }
84 } 84 }
85 } 85 }
86 } 86 }
87 CFX_ByteString CPDF_FormControl::GetCheckedAPState() { 87 CFX_ByteString CPDF_FormControl::GetCheckedAPState() {
88 ASSERT(GetType() == CPDF_FormField::CheckBox || 88 ASSERT(GetType() == CPDF_FormField::CheckBox ||
89 GetType() == CPDF_FormField::RadioButton); 89 GetType() == CPDF_FormField::RadioButton);
90 CFX_ByteString csOn = GetOnStateName(); 90 CFX_ByteString csOn = GetOnStateName();
91 if (GetType() == CPDF_FormField::RadioButton || 91 if (GetType() == CPDF_FormField::RadioButton ||
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 return Invert; 196 return Invert;
197 } 197 }
198 198
199 CPDF_ApSettings CPDF_FormControl::GetMK() const { 199 CPDF_ApSettings CPDF_FormControl::GetMK() const {
200 return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDictBy("MK") 200 return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDictBy("MK")
201 : nullptr); 201 : nullptr);
202 } 202 }
203 203
204 bool CPDF_FormControl::HasMKEntry(CFX_ByteString csEntry) const { 204 bool CPDF_FormControl::HasMKEntry(CFX_ByteString csEntry) const {
205 return GetMK().HasMKEntry(csEntry.AsByteStringC()); 205 return GetMK().HasMKEntry(csEntry.AsStringC());
206 } 206 }
207 207
208 int CPDF_FormControl::GetRotation() { 208 int CPDF_FormControl::GetRotation() {
209 return GetMK().GetRotation(); 209 return GetMK().GetRotation();
210 } 210 }
211 211
212 FX_ARGB CPDF_FormControl::GetColor(int& iColorType, CFX_ByteString csEntry) { 212 FX_ARGB CPDF_FormControl::GetColor(int& iColorType, CFX_ByteString csEntry) {
213 return GetMK().GetColor(iColorType, csEntry.AsByteStringC()); 213 return GetMK().GetColor(iColorType, csEntry.AsStringC());
214 } 214 }
215 215
216 FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, CFX_ByteString csEntry) { 216 FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, CFX_ByteString csEntry) {
217 return GetMK().GetOriginalColor(index, csEntry.AsByteStringC()); 217 return GetMK().GetOriginalColor(index, csEntry.AsStringC());
218 } 218 }
219 219
220 void CPDF_FormControl::GetOriginalColor(int& iColorType, 220 void CPDF_FormControl::GetOriginalColor(int& iColorType,
221 FX_FLOAT fc[4], 221 FX_FLOAT fc[4],
222 CFX_ByteString csEntry) { 222 CFX_ByteString csEntry) {
223 GetMK().GetOriginalColor(iColorType, fc, csEntry.AsByteStringC()); 223 GetMK().GetOriginalColor(iColorType, fc, csEntry.AsStringC());
224 } 224 }
225 CFX_WideString CPDF_FormControl::GetCaption(CFX_ByteString csEntry) { 225 CFX_WideString CPDF_FormControl::GetCaption(CFX_ByteString csEntry) {
226 return GetMK().GetCaption(csEntry.AsByteStringC()); 226 return GetMK().GetCaption(csEntry.AsStringC());
227 } 227 }
228 228
229 CPDF_Stream* CPDF_FormControl::GetIcon(CFX_ByteString csEntry) { 229 CPDF_Stream* CPDF_FormControl::GetIcon(CFX_ByteString csEntry) {
230 return GetMK().GetIcon(csEntry.AsByteStringC()); 230 return GetMK().GetIcon(csEntry.AsStringC());
231 } 231 }
232 232
233 CPDF_IconFit CPDF_FormControl::GetIconFit() { 233 CPDF_IconFit CPDF_FormControl::GetIconFit() {
234 return GetMK().GetIconFit(); 234 return GetMK().GetIconFit();
235 } 235 }
236 236
237 int CPDF_FormControl::GetTextPosition() { 237 int CPDF_FormControl::GetTextPosition() {
238 return GetMK().GetTextPosition(); 238 return GetMK().GetTextPosition();
239 } 239 }
240 240
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 CFX_ByteString csFontNameTag; 279 CFX_ByteString csFontNameTag;
280 FX_FLOAT fFontSize; 280 FX_FLOAT fFontSize;
281 cDA.GetFont(csFontNameTag, fFontSize); 281 cDA.GetFont(csFontNameTag, fFontSize);
282 if (csFontNameTag.IsEmpty()) 282 if (csFontNameTag.IsEmpty())
283 return nullptr; 283 return nullptr;
284 284
285 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR"); 285 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR");
286 if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { 286 if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
287 CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); 287 CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
288 if (pFonts) { 288 if (pFonts) {
289 CPDF_Dictionary* pElement = 289 CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag.AsStringC());
290 pFonts->GetDictBy(csFontNameTag.AsByteStringC());
291 if (pElement) { 290 if (pElement) {
292 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); 291 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
293 if (pFont) { 292 if (pFont) {
294 return pFont; 293 return pFont;
295 } 294 }
296 } 295 }
297 } 296 }
298 } 297 }
299 if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag)) 298 if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag))
300 return pFormFont; 299 return pFormFont;
301 300
302 CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDictBy("P"); 301 CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDictBy("P");
303 pObj = FPDF_GetFieldAttr(pPageDict, "Resources"); 302 pObj = FPDF_GetFieldAttr(pPageDict, "Resources");
304 if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { 303 if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
305 CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); 304 CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
306 if (pFonts) { 305 if (pFonts) {
307 CPDF_Dictionary* pElement = 306 CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag.AsStringC());
308 pFonts->GetDictBy(csFontNameTag.AsByteStringC());
309 if (pElement) { 307 if (pElement) {
310 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); 308 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
311 if (pFont) { 309 if (pFont) {
312 return pFont; 310 return pFont;
313 } 311 }
314 } 312 }
315 } 313 }
316 } 314 }
317 return nullptr; 315 return nullptr;
318 } 316 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 426 }
429 427
430 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { 428 CPDF_IconFit CPDF_ApSettings::GetIconFit() const {
431 return CPDF_IconFit(m_pDict ? m_pDict->GetDictBy("IF") : nullptr); 429 return CPDF_IconFit(m_pDict ? m_pDict->GetDictBy("IF") : nullptr);
432 } 430 }
433 431
434 int CPDF_ApSettings::GetTextPosition() const { 432 int CPDF_ApSettings::GetTextPosition() const {
435 return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION) 433 return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION)
436 : TEXTPOS_CAPTION; 434 : TEXTPOS_CAPTION;
437 } 435 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/doc_form.cpp ('k') | core/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698