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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 continue; | 982 continue; |
983 } | 983 } |
984 if (pKid->GetStringBy("Subtype") != "Widget") { | 984 if (pKid->GetStringBy("Subtype") != "Widget") { |
985 continue; | 985 continue; |
986 } | 986 } |
987 AddControl(pField, pKid); | 987 AddControl(pField, pKid); |
988 } | 988 } |
989 } | 989 } |
990 return pField; | 990 return pField; |
991 } | 991 } |
992 CPDF_FormControl* CPDF_InterForm::AddControl(const CPDF_FormField* pField, | 992 CPDF_FormControl* CPDF_InterForm::AddControl(CPDF_FormField* pField, |
993 CPDF_Dictionary* pWidgetDict) { | 993 CPDF_Dictionary* pWidgetDict) { |
994 const auto it = m_ControlMap.find(pWidgetDict); | 994 const auto it = m_ControlMap.find(pWidgetDict); |
995 if (it != m_ControlMap.end()) | 995 if (it != m_ControlMap.end()) |
996 return it->second; | 996 return it->second; |
997 | 997 |
998 CPDF_FormControl* pControl = | 998 CPDF_FormControl* pControl = new CPDF_FormControl(pField, pWidgetDict); |
999 new CPDF_FormControl((CPDF_FormField*)pField, pWidgetDict); | |
1000 m_ControlMap[pWidgetDict] = pControl; | 999 m_ControlMap[pWidgetDict] = pControl; |
1001 ((CPDF_FormField*)pField)->m_ControlList.Add(pControl); | 1000 pField->m_ControlList.Add(pControl); |
1002 return pControl; | 1001 return pControl; |
1003 } | 1002 } |
1004 | 1003 |
1005 CPDF_FormField* CPDF_InterForm::CheckRequiredFields( | 1004 CPDF_FormField* CPDF_InterForm::CheckRequiredFields( |
1006 const std::vector<CPDF_FormField*>* fields, | 1005 const std::vector<CPDF_FormField*>* fields, |
1007 bool bIncludeOrExclude) const { | 1006 bool bIncludeOrExclude) const { |
1008 int nCount = m_pFieldTree->m_Root.CountFields(); | 1007 int nCount = m_pFieldTree->m_Root.CountFields(); |
1009 for (int i = 0; i < nCount; ++i) { | 1008 for (int i = 0; i < nCount; ++i) { |
1010 CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i); | 1009 CPDF_FormField* pField = m_pFieldTree->m_Root.GetField(i); |
1011 if (!pField) | 1010 if (!pField) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 FDF_ImportField(pField, L"", bNotify); | 1188 FDF_ImportField(pField, L"", bNotify); |
1190 } | 1189 } |
1191 if (bNotify && m_pFormNotify) | 1190 if (bNotify && m_pFormNotify) |
1192 m_pFormNotify->AfterFormImportData(this); | 1191 m_pFormNotify->AfterFormImportData(this); |
1193 return TRUE; | 1192 return TRUE; |
1194 } | 1193 } |
1195 | 1194 |
1196 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { | 1195 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { |
1197 m_pFormNotify = pNotify; | 1196 m_pFormNotify = pNotify; |
1198 } | 1197 } |
OLD | NEW |