| 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 fBottom = pA->GetNumberAt(1); | 671 fBottom = pA->GetNumberAt(1); |
| 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 |
| 682 CFX_ByteArray& statusArray) { | 682 std::vector<bool> SaveCheckedFieldStatus(CPDF_FormField* pField) { |
| 683 std::vector<bool> result; |
| 683 int iCount = pField->CountControls(); | 684 int iCount = pField->CountControls(); |
| 684 for (int i = 0; i < iCount; i++) { | 685 for (int i = 0; i < iCount; ++i) { |
| 685 CPDF_FormControl* pControl = pField->GetControl(i); | 686 if (CPDF_FormControl* pControl = pField->GetControl(i)) |
| 686 if (!pControl) { | 687 result.push_back(pControl->IsChecked()); |
| 687 continue; | |
| 688 } | |
| 689 statusArray.Add(pControl->IsChecked() ? 1 : 0); | |
| 690 } | 688 } |
| 689 return result; |
| 691 } | 690 } |
| 691 |
| 692 CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, | 692 CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, |
| 693 const FX_CHAR* name, | 693 const FX_CHAR* name, |
| 694 int nLevel) { | 694 int nLevel) { |
| 695 if (nLevel > FPDFDOC_UTILS_MAXRECURSION) { | 695 if (nLevel > FPDFDOC_UTILS_MAXRECURSION) { |
| 696 return NULL; | 696 return NULL; |
| 697 } | 697 } |
| 698 if (!pFieldDict) { | 698 if (!pFieldDict) { |
| 699 return NULL; | 699 return NULL; |
| 700 } | 700 } |
| 701 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); | 701 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); |
| 702 if (pAttr) { | 702 if (pAttr) { |
| 703 return pAttr; | 703 return pAttr; |
| 704 } | 704 } |
| 705 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); | 705 CPDF_Dictionary* pParent = pFieldDict->GetDictBy("Parent"); |
| 706 if (!pParent) { | 706 if (!pParent) { |
| 707 return NULL; | 707 return NULL; |
| 708 } | 708 } |
| 709 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); | 709 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); |
| 710 } | 710 } |
| OLD | NEW |