| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 | 675 |
| 676 CFX_ByteString csStr = | 676 CFX_ByteString csStr = |
| 677 PDF_EncodeText(csOptLabel.c_str(), csOptLabel.GetLength()); | 677 PDF_EncodeText(csOptLabel.c_str(), csOptLabel.GetLength()); |
| 678 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "Opt"); | 678 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "Opt"); |
| 679 CPDF_Array* pOpt = ToArray(pValue); | 679 CPDF_Array* pOpt = ToArray(pValue); |
| 680 if (!pOpt) { | 680 if (!pOpt) { |
| 681 pOpt = new CPDF_Array; | 681 pOpt = new CPDF_Array; |
| 682 m_pDict->SetFor("Opt", pOpt); | 682 m_pDict->SetFor("Opt", pOpt); |
| 683 } | 683 } |
| 684 | 684 |
| 685 int iCount = pdfium::base::checked_cast<int, size_t>(pOpt->GetCount()); | 685 int iCount = pdfium::base::checked_cast<int>(pOpt->GetCount()); |
| 686 if (index >= iCount) { | 686 if (index >= iCount) { |
| 687 pOpt->AddString(csStr); | 687 pOpt->AddString(csStr); |
| 688 index = iCount; | 688 index = iCount; |
| 689 } else { | 689 } else { |
| 690 CPDF_String* pString = new CPDF_String(csStr, false); | 690 CPDF_String* pString = new CPDF_String(csStr, false); |
| 691 pOpt->InsertAt(index, pString); | 691 pOpt->InsertAt(index, pString); |
| 692 } | 692 } |
| 693 | 693 |
| 694 if (bNotify) | 694 if (bNotify) |
| 695 NotifyListOrComboBoxAfterChange(); | 695 NotifyListOrComboBoxAfterChange(); |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 case ListBox: | 989 case ListBox: |
| 990 NotifyAfterSelectionChange(); | 990 NotifyAfterSelectionChange(); |
| 991 break; | 991 break; |
| 992 case ComboBox: | 992 case ComboBox: |
| 993 NotifyAfterValueChange(); | 993 NotifyAfterValueChange(); |
| 994 break; | 994 break; |
| 995 default: | 995 default: |
| 996 break; | 996 break; |
| 997 } | 997 } |
| 998 } | 998 } |
| OLD | NEW |