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

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

Issue 1410673005: Add type cast definitions for CPDF_Number. (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
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 #include "doc_utils.h" 8 #include "doc_utils.h"
9 9
10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) { 10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 if (pValue == NULL) { 424 if (pValue == NULL) {
425 return 0; 425 return 0;
426 } 426 }
427 } 427 }
428 if (pValue->GetType() == PDFOBJ_STRING) { 428 if (pValue->GetType() == PDFOBJ_STRING) {
429 if (pValue->GetString().IsEmpty()) { 429 if (pValue->GetString().IsEmpty()) {
430 return 0; 430 return 0;
431 } 431 }
432 return 1; 432 return 1;
433 } 433 }
434 if (pValue->GetType() == PDFOBJ_NUMBER) { 434 if (pValue->IsNumber()) {
435 if (pValue->GetString().IsEmpty()) { 435 if (pValue->GetString().IsEmpty()) {
436 return 0; 436 return 0;
437 } 437 }
438 return 1; 438 return 1;
439 } 439 }
440 if (pValue->GetType() != PDFOBJ_ARRAY) { 440 if (pValue->GetType() != PDFOBJ_ARRAY) {
441 return 0; 441 return 0;
442 } 442 }
443 return ((CPDF_Array*)pValue)->GetCount(); 443 return ((CPDF_Array*)pValue)->GetCount();
444 } 444 }
445 int CPDF_FormField::GetSelectedIndex(int index) { 445 int CPDF_FormField::GetSelectedIndex(int index) {
446 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); 446 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
447 if (pValue == NULL) { 447 if (pValue == NULL) {
448 pValue = FPDF_GetFieldAttr(m_pDict, "I"); 448 pValue = FPDF_GetFieldAttr(m_pDict, "I");
449 if (pValue == NULL) { 449 if (pValue == NULL) {
450 return -1; 450 return -1;
451 } 451 }
452 } 452 }
453 if (pValue->GetType() == PDFOBJ_NUMBER) { 453 if (pValue->IsNumber())
454 return pValue->GetInteger(); 454 return pValue->GetInteger();
455 } 455
456 CFX_WideString sel_value; 456 CFX_WideString sel_value;
457 if (pValue->GetType() == PDFOBJ_STRING) { 457 if (pValue->GetType() == PDFOBJ_STRING) {
458 if (index != 0) { 458 if (index != 0) {
459 return -1; 459 return -1;
460 } 460 }
461 sel_value = pValue->GetUnicodeText(); 461 sel_value = pValue->GetUnicodeText();
462 } else { 462 } else {
463 if (pValue->GetType() != PDFOBJ_ARRAY) { 463 if (pValue->GetType() != PDFOBJ_ARRAY) {
464 return -1; 464 return -1;
465 } 465 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 if (pValue == NULL) { 534 if (pValue == NULL) {
535 return FALSE; 535 return FALSE;
536 } 536 }
537 } 537 }
538 if (pValue->GetType() == PDFOBJ_STRING) { 538 if (pValue->GetType() == PDFOBJ_STRING) {
539 if (pValue->GetUnicodeText() == opt_value) { 539 if (pValue->GetUnicodeText() == opt_value) {
540 return TRUE; 540 return TRUE;
541 } 541 }
542 return FALSE; 542 return FALSE;
543 } 543 }
544 if (pValue->GetType() == PDFOBJ_NUMBER) { 544 if (pValue->IsNumber()) {
545 if (pValue->GetString().IsEmpty()) { 545 if (pValue->GetString().IsEmpty()) {
546 return FALSE; 546 return FALSE;
547 } 547 }
548 if (pValue->GetInteger() == index) { 548 if (pValue->GetInteger() == index) {
549 return TRUE; 549 return TRUE;
550 } 550 }
551 return FALSE; 551 return FALSE;
552 } 552 }
553 if (pValue->GetType() != PDFOBJ_ARRAY) { 553 if (pValue->GetType() != PDFOBJ_ARRAY) {
554 return FALSE; 554 return FALSE;
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")) 1065 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font"))
1066 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict( 1066 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(
1067 font_name); 1067 font_name);
1068 1068
1069 if (pFontDict == NULL) { 1069 if (pFontDict == NULL) {
1070 return; 1070 return;
1071 } 1071 }
1072 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); 1072 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
1073 m_FontSize = FX_atof(syntax.GetWord()); 1073 m_FontSize = FX_atof(syntax.GetWord());
1074 } 1074 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698