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/include/fpdfdoc/fpdf_doc.h" | 7 #include "core/include/fpdfdoc/fpdf_doc.h" |
8 #include "doc_utils.h" | 8 #include "doc_utils.h" |
9 #include "third_party/base/stl_util.h" | 9 #include "third_party/base/stl_util.h" |
10 | 10 |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 return pNode ? pNode->CountFields() : 0; | 656 return pNode ? pNode->CountFields() : 0; |
657 } | 657 } |
658 CPDF_FormField* CPDF_InterForm::GetField(FX_DWORD index, | 658 CPDF_FormField* CPDF_InterForm::GetField(FX_DWORD index, |
659 const CFX_WideString& csFieldName) { | 659 const CFX_WideString& csFieldName) { |
660 if (csFieldName == L"") { | 660 if (csFieldName == L"") { |
661 return m_pFieldTree->m_Root.GetField(index); | 661 return m_pFieldTree->m_Root.GetField(index); |
662 } | 662 } |
663 CFieldTree::_Node* pNode = m_pFieldTree->FindNode(csFieldName); | 663 CFieldTree::_Node* pNode = m_pFieldTree->FindNode(csFieldName); |
664 return pNode ? pNode->GetField(index) : nullptr; | 664 return pNode ? pNode->GetField(index) : nullptr; |
665 } | 665 } |
666 void CPDF_InterForm::GetAllFieldNames(CFX_WideStringArray& allFieldNames) { | |
667 allFieldNames.RemoveAll(); | |
668 int nCount = m_pFieldTree->m_Root.CountFields(); | |
669 for (int i = 0; i < nCount; i++) { | |
670 CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i); | |
671 if (pField) { | |
672 CFX_WideString full_name = GetFullName(pField->GetFieldDict()); | |
673 allFieldNames.Add(full_name); | |
674 } | |
675 } | |
676 } | |
677 | 666 |
678 CPDF_FormField* CPDF_InterForm::GetFieldByDict( | 667 CPDF_FormField* CPDF_InterForm::GetFieldByDict( |
679 CPDF_Dictionary* pFieldDict) const { | 668 CPDF_Dictionary* pFieldDict) const { |
680 if (!pFieldDict) { | 669 if (!pFieldDict) { |
681 return NULL; | 670 return NULL; |
682 } | 671 } |
683 CFX_WideString csWName = GetFullName(pFieldDict); | 672 CFX_WideString csWName = GetFullName(pFieldDict); |
684 return m_pFieldTree->GetField(csWName); | 673 return m_pFieldTree->GetField(csWName); |
685 } | 674 } |
686 | 675 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 FDF_ImportField(pField, L"", bNotify); | 1212 FDF_ImportField(pField, L"", bNotify); |
1224 } | 1213 } |
1225 if (bNotify && m_pFormNotify) { | 1214 if (bNotify && m_pFormNotify) { |
1226 m_pFormNotify->AfterFormImportData(this); | 1215 m_pFormNotify->AfterFormImportData(this); |
1227 } | 1216 } |
1228 return TRUE; | 1217 return TRUE; |
1229 } | 1218 } |
1230 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { | 1219 void CPDF_InterForm::SetFormNotify(const CPDF_FormNotify* pNotify) { |
1231 m_pFormNotify = (CPDF_FormNotify*)pNotify; | 1220 m_pFormNotify = (CPDF_FormNotify*)pNotify; |
1232 } | 1221 } |
OLD | NEW |