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 "core/fpdfdoc/cpdf_formfield.h" | 7 #include "core/fpdfdoc/cpdf_formfield.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 if (iCount < 0 || index >= iCount) | 832 if (iCount < 0 || index >= iCount) |
833 return -1; | 833 return -1; |
834 return pArray->GetIntegerAt(index); | 834 return pArray->GetIntegerAt(index); |
835 } | 835 } |
836 | 836 |
837 FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) const { | 837 FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) const { |
838 CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict, "I")); | 838 CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict, "I")); |
839 if (!pArray) | 839 if (!pArray) |
840 return FALSE; | 840 return FALSE; |
841 | 841 |
842 for (const auto& pObj : *pArray) { | 842 for (CPDF_Object* pObj : *pArray) { |
843 if (pObj->GetInteger() == iOptIndex) | 843 if (pObj->GetInteger() == iOptIndex) |
844 return TRUE; | 844 return TRUE; |
845 } | 845 } |
846 return FALSE; | 846 return FALSE; |
847 } | 847 } |
848 | 848 |
849 FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, | 849 FX_BOOL CPDF_FormField::SelectOption(int iOptIndex, |
850 FX_BOOL bSelected, | 850 FX_BOOL bSelected, |
851 FX_BOOL bNotify) { | 851 FX_BOOL bNotify) { |
852 CPDF_Array* pArray = m_pDict->GetArrayFor("I"); | 852 CPDF_Array* pArray = m_pDict->GetArrayFor("I"); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 case ListBox: | 994 case ListBox: |
995 NotifyAfterSelectionChange(); | 995 NotifyAfterSelectionChange(); |
996 break; | 996 break; |
997 case ComboBox: | 997 case ComboBox: |
998 NotifyAfterValueChange(); | 998 NotifyAfterValueChange(); |
999 break; | 999 break; |
1000 default: | 1000 default: |
1001 break; | 1001 break; |
1002 } | 1002 } |
1003 } | 1003 } |
OLD | NEW |