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 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 csNewFieldName = csSub; | 613 csNewFieldName = csSub; |
614 return TRUE; | 614 return TRUE; |
615 } | 615 } |
616 FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, | 616 FX_BOOL CPDF_InterForm::ValidateFieldName(CFX_WideString& csNewFieldName, |
617 int iType) { | 617 int iType) { |
618 return ValidateFieldName(csNewFieldName, iType, nullptr, nullptr); | 618 return ValidateFieldName(csNewFieldName, iType, nullptr, nullptr); |
619 } | 619 } |
620 FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormField* pField, | 620 FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormField* pField, |
621 CFX_WideString& csNewFieldName) { | 621 CFX_WideString& csNewFieldName) { |
622 return pField && !csNewFieldName.IsEmpty() && | 622 return pField && !csNewFieldName.IsEmpty() && |
623 ValidateFieldName(csNewFieldName, | 623 ValidateFieldName(csNewFieldName, pField->GetFieldType(), pField, |
624 ((CPDF_FormField*)pField)->GetFieldType(), pField, | |
625 nullptr); | 624 nullptr); |
626 } | 625 } |
627 FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormControl* pControl, | 626 FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormControl* pControl, |
628 CFX_WideString& csNewFieldName) { | 627 CFX_WideString& csNewFieldName) { |
629 if (!pControl || csNewFieldName.IsEmpty()) { | 628 if (!pControl || csNewFieldName.IsEmpty()) { |
630 return FALSE; | 629 return FALSE; |
631 } | 630 } |
632 CPDF_FormField* pField = ((CPDF_FormControl*)pControl)->GetField(); | 631 CPDF_FormField* pField = pControl->GetField(); |
633 return ValidateFieldName(csNewFieldName, pField->GetFieldType(), pField, | 632 return ValidateFieldName(csNewFieldName, pField->GetFieldType(), pField, |
634 pControl); | 633 pControl); |
635 } | 634 } |
636 int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, | 635 int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, |
637 const CFX_ByteString& name2) { | 636 const CFX_ByteString& name2) { |
638 if (name1.GetLength() == name2.GetLength()) { | 637 if (name1.GetLength() == name2.GetLength()) { |
639 return name1 == name2 ? 1 : 0; | 638 return name1 == name2 ? 1 : 0; |
640 } | 639 } |
641 const FX_CHAR* ptr1 = name1.c_str(); | 640 const FX_CHAR* ptr1 = name1.c_str(); |
642 const FX_CHAR* ptr2 = name2.c_str(); | 641 const FX_CHAR* ptr2 = name2.c_str(); |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 FDF_ImportField(pField, L"", bNotify); | 1189 FDF_ImportField(pField, L"", bNotify); |
1191 } | 1190 } |
1192 if (bNotify && m_pFormNotify) | 1191 if (bNotify && m_pFormNotify) |
1193 m_pFormNotify->AfterFormImportData(this); | 1192 m_pFormNotify->AfterFormImportData(this); |
1194 return TRUE; | 1193 return TRUE; |
1195 } | 1194 } |
1196 | 1195 |
1197 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { | 1196 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { |
1198 m_pFormNotify = pNotify; | 1197 m_pFormNotify = pNotify; |
1199 } | 1198 } |
OLD | NEW |