| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "core/include/fpdfdoc/fpdf_doc.h" | 9 #include "core/include/fpdfdoc/fpdf_doc.h" |
| 10 #include "doc_utils.h" | 10 #include "doc_utils.h" |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 } | 672 } |
| 673 } | 673 } |
| 674 } | 674 } |
| 675 FX_BOOL CPDF_IconFit::GetFittingBounds() { | 675 FX_BOOL CPDF_IconFit::GetFittingBounds() { |
| 676 if (!m_pDict) { | 676 if (!m_pDict) { |
| 677 return FALSE; | 677 return FALSE; |
| 678 } | 678 } |
| 679 return m_pDict->GetBooleanBy("FB"); | 679 return m_pDict->GetBooleanBy("FB"); |
| 680 } | 680 } |
| 681 void SaveCheckedFieldStatus(CPDF_FormField* pField, | 681 void SaveCheckedFieldStatus(CPDF_FormField* pField, |
| 682 CFX_ByteArray& statusArray) { | 682 std::vector<uint8_t>* statusArray) { |
| 683 int iCount = pField->CountControls(); | 683 int iCount = pField->CountControls(); |
| 684 for (int i = 0; i < iCount; i++) { | 684 for (int i = 0; i < iCount; i++) { |
| 685 CPDF_FormControl* pControl = pField->GetControl(i); | 685 if (CPDF_FormControl* pControl = pField->GetControl(i)) |
| 686 if (!pControl) { | 686 statusArray->push_back(pControl->IsChecked() ? 1 : 0); |
| 687 continue; | |
| 688 } | |
| 689 statusArray.Add(pControl->IsChecked() ? 1 : 0); | |
| 690 } | 687 } |
| 691 } | 688 } |
| 692 CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, | 689 CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, |
| 693 const FX_CHAR* name, | 690 const FX_CHAR* name, |
| 694 int nLevel) { | 691 int nLevel) { |
| 695 if (nLevel > FPDFDOC_UTILS_MAXRECURSION) { | 692 if (nLevel > FPDFDOC_UTILS_MAXRECURSION) { |
| 696 return NULL; | 693 return NULL; |
| 697 } | 694 } |
| 698 if (!pFieldDict) { | 695 if (!pFieldDict) { |
| 699 return NULL; | 696 return NULL; |
| 700 } | 697 } |
| 701 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); | 698 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); |
| 702 if (pAttr) { | 699 if (pAttr) { |
| 703 return pAttr; | 700 return pAttr; |
| 704 } | 701 } |
| 705 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); | 702 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); |
| 706 if (!pParent) { | 703 if (!pParent) { |
| 707 return NULL; | 704 return NULL; |
| 708 } | 705 } |
| 709 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); | 706 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); |
| 710 } | 707 } |
| OLD | NEW |