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