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

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

Issue 1420583003: Revert "Revert "Add type cast definitions for CPDF_Dictionary."" (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 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/src/fpdfdoc/doc_form.cpp ('k') | core/src/fpdfdoc/doc_ocg.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 "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, 8 CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField,
9 CPDF_Dictionary* pWidgetDict) { 9 CPDF_Dictionary* pWidgetDict) {
10 m_pField = pField; 10 m_pField = pField;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return; 54 return;
55 } 55 }
56 FX_POSITION pos1 = pAP->GetStartPos(); 56 FX_POSITION pos1 = pAP->GetStartPos();
57 while (pos1) { 57 while (pos1) {
58 CFX_ByteString csKey1; 58 CFX_ByteString csKey1;
59 CPDF_Object* pObj1 = pAP->GetNextElement(pos1, csKey1); 59 CPDF_Object* pObj1 = pAP->GetNextElement(pos1, csKey1);
60 if (pObj1 == NULL) { 60 if (pObj1 == NULL) {
61 continue; 61 continue;
62 } 62 }
63 CPDF_Object* pObjDirect1 = pObj1->GetDirect(); 63 CPDF_Object* pObjDirect1 = pObj1->GetDirect();
64 if (pObjDirect1->GetType() != PDFOBJ_DICTIONARY) { 64 CPDF_Dictionary* pSubDict = pObjDirect1->AsDictionary();
65 if (!pSubDict)
65 continue; 66 continue;
66 } 67
67 CPDF_Dictionary* pSubDict = (CPDF_Dictionary*)pObjDirect1;
68 FX_POSITION pos2 = pSubDict->GetStartPos(); 68 FX_POSITION pos2 = pSubDict->GetStartPos();
69 while (pos2) { 69 while (pos2) {
70 CFX_ByteString csKey2; 70 CFX_ByteString csKey2;
71 CPDF_Object* pObj2 = pSubDict->GetNextElement(pos2, csKey2); 71 CPDF_Object* pObj2 = pSubDict->GetNextElement(pos2, csKey2);
72 if (pObj2 == NULL) { 72 if (pObj2 == NULL) {
73 continue; 73 continue;
74 } 74 }
75 if (csKey2 != "Off") { 75 if (csKey2 != "Off") {
76 pSubDict->ReplaceKey(csKey2, csValue); 76 pSubDict->ReplaceKey(csKey2, csValue);
77 break; 77 break;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 280
281 CPDF_Font* CPDF_FormControl::GetDefaultControlFont() { 281 CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
282 CPDF_DefaultAppearance cDA = GetDefaultAppearance(); 282 CPDF_DefaultAppearance cDA = GetDefaultAppearance();
283 CFX_ByteString csFontNameTag; 283 CFX_ByteString csFontNameTag;
284 FX_FLOAT fFontSize; 284 FX_FLOAT fFontSize;
285 cDA.GetFont(csFontNameTag, fFontSize); 285 cDA.GetFont(csFontNameTag, fFontSize);
286 if (csFontNameTag.IsEmpty()) 286 if (csFontNameTag.IsEmpty())
287 return nullptr; 287 return nullptr;
288 288
289 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR"); 289 CPDF_Object* pObj = FPDF_GetFieldAttr(m_pWidgetDict, "DR");
290 if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { 290 if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
291 CPDF_Dictionary* pFonts = ((CPDF_Dictionary*)pObj)->GetDict("Font"); 291 CPDF_Dictionary* pFonts = pDict->GetDict("Font");
292 if (pFonts) { 292 if (pFonts) {
293 CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag); 293 CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag);
294 if (pElement) { 294 if (pElement) {
295 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); 295 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
296 if (pFont) { 296 if (pFont) {
297 return pFont; 297 return pFont;
298 } 298 }
299 } 299 }
300 } 300 }
301 } 301 }
302 if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag)) 302 if (CPDF_Font* pFormFont = m_pField->m_pForm->GetFormFont(csFontNameTag))
303 return pFormFont; 303 return pFormFont;
304 304
305 CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDict("P"); 305 CPDF_Dictionary* pPageDict = m_pWidgetDict->GetDict("P");
306 pObj = FPDF_GetFieldAttr(pPageDict, "Resources"); 306 pObj = FPDF_GetFieldAttr(pPageDict, "Resources");
307 if (pObj && pObj->GetType() == PDFOBJ_DICTIONARY) { 307 if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
308 CPDF_Dictionary* pFonts = ((CPDF_Dictionary*)pObj)->GetDict("Font"); 308 CPDF_Dictionary* pFonts = pDict->GetDict("Font");
309 if (pFonts) { 309 if (pFonts) {
310 CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag); 310 CPDF_Dictionary* pElement = pFonts->GetDict(csFontNameTag);
311 if (pElement) { 311 if (pElement) {
312 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); 312 CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
313 if (pFont) { 313 if (pFont) {
314 return pFont; 314 return pFont;
315 } 315 }
316 } 316 }
317 } 317 }
318 } 318 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 return NULL; 439 return NULL;
440 } 440 }
441 return m_pDict->GetDict(FX_BSTRC("IF")); 441 return m_pDict->GetDict(FX_BSTRC("IF"));
442 } 442 }
443 int CPDF_ApSettings::GetTextPosition() { 443 int CPDF_ApSettings::GetTextPosition() {
444 if (m_pDict == NULL) { 444 if (m_pDict == NULL) {
445 return TEXTPOS_CAPTION; 445 return TEXTPOS_CAPTION;
446 } 446 }
447 return m_pDict->GetInteger(FX_BSTRC("TP"), TEXTPOS_CAPTION); 447 return m_pDict->GetInteger(FX_BSTRC("TP"), TEXTPOS_CAPTION);
448 } 448 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fpdfdoc/doc_ocg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698