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

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

Issue 1889863002: Make CPDF_Dictionary methods take CFX_ByteString arguments (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: One last caller. 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.AsStringC(), csValue.AsStringC()); 81 pSubDict->ReplaceKey(csKey2, csValue);
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 187 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 = pFonts->GetDictBy(csFontNameTag.AsStringC()); 289 CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag);
290 if (pElement) { 290 if (pElement) {
291 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); 291 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
292 if (pFont) { 292 if (pFont) {
293 return pFont; 293 return pFont;
294 } 294 }
295 } 295 }
296 } 296 }
297 } 297 }
298 if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag)) 298 if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag))
299 return pFormFont; 299 return pFormFont;
300 300
301 CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDictBy("P"); 301 CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDictBy("P");
302 pObj = FPDF_GetFieldAttr(pPageDict, "Resources"); 302 pObj = FPDF_GetFieldAttr(pPageDict, "Resources");
303 if (CPDF_Dictionary* pDict = ToDictionary(pObj)) { 303 if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
304 CPDF_Dictionary* pFonts = pDict->GetDictBy("Font"); 304 CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
305 if (pFonts) { 305 if (pFonts) {
306 CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag.AsStringC()); 306 CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag);
307 if (pElement) { 307 if (pElement) {
308 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); 308 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
309 if (pFont) { 309 if (pFont) {
310 return pFont; 310 return pFont;
311 } 311 }
312 } 312 }
313 } 313 }
314 } 314 }
315 return nullptr; 315 return nullptr;
316 } 316 }
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 } 426 }
427 427
428 CPDF_IconFit CPDF_ApSettings::GetIconFit() const { 428 CPDF_IconFit CPDF_ApSettings::GetIconFit() const {
429 return CPDF_IconFit(m_pDict ? m_pDict->GetDictBy("IF") : nullptr); 429 return CPDF_IconFit(m_pDict ? m_pDict->GetDictBy("IF") : nullptr);
430 } 430 }
431 431
432 int CPDF_ApSettings::GetTextPosition() const { 432 int CPDF_ApSettings::GetTextPosition() const {
433 return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION) 433 return m_pDict ? m_pDict->GetIntegerBy("TP", TEXTPOS_CAPTION)
434 : TEXTPOS_CAPTION; 434 : TEXTPOS_CAPTION;
435 } 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