OLD | NEW |
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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 } | 465 } |
466 int CPDF_FormField::GetSelectedIndex(int index) | 466 int CPDF_FormField::GetSelectedIndex(int index) |
467 { | 467 { |
468 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); | 468 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); |
469 if (pValue == NULL) { | 469 if (pValue == NULL) { |
470 pValue = FPDF_GetFieldAttr(m_pDict, "I"); | 470 pValue = FPDF_GetFieldAttr(m_pDict, "I"); |
471 if (pValue == NULL) { | 471 if (pValue == NULL) { |
472 return -1; | 472 return -1; |
473 } | 473 } |
474 } | 474 } |
| 475 if (pValue->GetType() == PDFOBJ_NUMBER) { |
| 476 return pValue->GetInteger(); |
| 477 } |
475 CFX_WideString sel_value; | 478 CFX_WideString sel_value; |
476 if (pValue->GetType() == PDFOBJ_STRING) { | 479 if (pValue->GetType() == PDFOBJ_STRING) { |
477 if (index != 0) { | 480 if (index != 0) { |
478 return -1; | 481 return -1; |
479 } | 482 } |
480 sel_value = pValue->GetUnicodeText(); | 483 sel_value = pValue->GetUnicodeText(); |
481 } else if (pValue->GetType() == PDFOBJ_NUMBER) { | |
482 return pValue->GetInteger(); | |
483 } else { | 484 } else { |
484 if (pValue->GetType() != PDFOBJ_ARRAY) { | 485 if (pValue->GetType() != PDFOBJ_ARRAY) { |
485 return -1; | 486 return -1; |
486 } | 487 } |
487 if (index < 0) { | 488 if (index < 0) { |
488 return -1; | 489 return -1; |
489 } | 490 } |
490 CPDF_Object* elementValue = ((CPDF_Array*)pValue)->GetElementValue(index
); | 491 CPDF_Object* elementValue = ((CPDF_Array*)pValue)->GetElementValue(index
); |
491 sel_value = elementValue ? elementValue->GetUnicodeText() : CFX_WideStri
ng(); | 492 sel_value = elementValue ? elementValue->GetUnicodeText() : CFX_WideStri
ng(); |
492 } | 493 } |
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && | 1168 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && |
1168 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") ) | 1169 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") ) |
1169 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo
nt_name); | 1170 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo
nt_name); |
1170 | 1171 |
1171 if (pFontDict == NULL) { | 1172 if (pFontDict == NULL) { |
1172 return; | 1173 return; |
1173 } | 1174 } |
1174 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); | 1175 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); |
1175 m_FontSize = FX_atof(syntax.GetWord()); | 1176 m_FontSize = FX_atof(syntax.GetWord()); |
1176 } | 1177 } |
OLD | NEW |