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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 } | 568 } |
569 } else { | 569 } else { |
570 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); | 570 CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V"); |
571 if (pValue) { | 571 if (pValue) { |
572 if (GetType() == ListBox) { | 572 if (GetType() == ListBox) { |
573 SelectOption(index, false); | 573 SelectOption(index, false); |
574 if (pValue->IsString()) { | 574 if (pValue->IsString()) { |
575 if (pValue->GetUnicodeText() == opt_value) | 575 if (pValue->GetUnicodeText() == opt_value) |
576 m_pDict->RemoveFor("V"); | 576 m_pDict->RemoveFor("V"); |
577 } else if (pValue->IsArray()) { | 577 } else if (pValue->IsArray()) { |
578 std::unique_ptr<CPDF_Array> pArray(new CPDF_Array); | 578 std::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( |
| 579 new CPDF_Array); |
579 for (int i = 0; i < CountOptions(); i++) { | 580 for (int i = 0; i < CountOptions(); i++) { |
580 if (i != index && IsItemSelected(i)) { | 581 if (i != index && IsItemSelected(i)) { |
581 opt_value = GetOptionValue(i); | 582 opt_value = GetOptionValue(i); |
582 pArray->AddString(PDF_EncodeText(opt_value)); | 583 pArray->AddString(PDF_EncodeText(opt_value)); |
583 } | 584 } |
584 } | 585 } |
585 if (pArray->GetCount() > 0) | 586 if (pArray->GetCount() > 0) |
586 m_pDict->SetFor("V", pArray.release()); // std::move someday | 587 m_pDict->SetFor("V", pArray.release()); // std::move someday |
587 } | 588 } |
588 } else { | 589 } else { |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 case ListBox: | 990 case ListBox: |
990 NotifyAfterSelectionChange(); | 991 NotifyAfterSelectionChange(); |
991 break; | 992 break; |
992 case ComboBox: | 993 case ComboBox: |
993 NotifyAfterValueChange(); | 994 NotifyAfterValueChange(); |
994 break; | 995 break; |
995 default: | 996 default: |
996 break; | 997 break; |
997 } | 998 } |
998 } | 999 } |
OLD | NEW |