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 "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
8 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); | 8 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); |
9 void SaveCheckedFieldStatus(CPDF_FormField* pField, C
FX_ByteArray& statusArray); | 9 void SaveCheckedFieldStatus(CPDF_FormField* pField, C
FX_ByteArray& statusArray); |
10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField *pField) | 10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField *pField) |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 639 } |
640 } else if (m_Type == ComboBox) { | 640 } else if (m_Type == ComboBox) { |
641 m_pDict->RemoveAt("V"); | 641 m_pDict->RemoveAt("V"); |
642 m_pDict->RemoveAt("I"); | 642 m_pDict->RemoveAt("I"); |
643 } | 643 } |
644 } | 644 } |
645 } else { | 645 } else { |
646 if (m_Type == ListBox) { | 646 if (m_Type == ListBox) { |
647 SelectOption(index, TRUE); | 647 SelectOption(index, TRUE); |
648 if (!(m_Flags & FORMLIST_MULTISELECT)) { | 648 if (!(m_Flags & FORMLIST_MULTISELECT)) { |
649 m_pDict->SetAtString("V", PDF_EncodeText(opt_value, opt_value.Ge
tLength())); | 649 m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); |
650 } else { | 650 } else { |
651 CPDF_Array* pArray = CPDF_Array::Create(); | 651 CPDF_Array* pArray = CPDF_Array::Create(); |
652 if (pArray == NULL) { | 652 if (pArray == NULL) { |
653 return FALSE; | 653 return FALSE; |
654 } | 654 } |
655 FX_BOOL bSelected; | 655 FX_BOOL bSelected; |
656 int iCount = CountOptions(); | 656 int iCount = CountOptions(); |
657 for (int i = 0; i < iCount; i ++) { | 657 for (int i = 0; i < iCount; i ++) { |
658 if (i != index) { | 658 if (i != index) { |
659 bSelected = IsItemSelected(i); | 659 bSelected = IsItemSelected(i); |
660 } else { | 660 } else { |
661 bSelected = TRUE; | 661 bSelected = TRUE; |
662 } | 662 } |
663 if (bSelected) { | 663 if (bSelected) { |
664 opt_value = GetOptionValue(i); | 664 opt_value = GetOptionValue(i); |
665 pArray->AddString(PDF_EncodeText(opt_value)); | 665 pArray->AddString(PDF_EncodeText(opt_value)); |
666 } | 666 } |
667 } | 667 } |
668 m_pDict->SetAt("V", pArray); | 668 m_pDict->SetAt("V", pArray); |
669 } | 669 } |
670 } else if (m_Type == ComboBox) { | 670 } else if (m_Type == ComboBox) { |
671 m_pDict->SetAtString("V", PDF_EncodeText(opt_value, opt_value.GetLen
gth())); | 671 m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); |
672 CPDF_Array* pI = CPDF_Array::Create(); | 672 CPDF_Array* pI = CPDF_Array::Create(); |
673 if (pI == NULL) { | 673 if (pI == NULL) { |
674 return FALSE; | 674 return FALSE; |
675 } | 675 } |
676 pI->AddInteger(index); | 676 pI->AddInteger(index); |
677 m_pDict->SetAt("I", pI); | 677 m_pDict->SetAt("I", pI); |
678 } | 678 } |
679 } | 679 } |
680 if (bNotify && m_pForm->m_pFormNotify != NULL) { | 680 if (bNotify && m_pForm->m_pFormNotify != NULL) { |
681 if (GetType() == ListBox) { | 681 if (GetType() == ListBox) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 { | 776 { |
777 int iCount = CountOptions(); | 777 int iCount = CountOptions(); |
778 for (int i = 0; i < iCount; i ++) { | 778 for (int i = 0; i < iCount; i ++) { |
779 CFX_WideString csValue = GetOptionValue(i); | 779 CFX_WideString csValue = GetOptionValue(i); |
780 if (csValue == csOptLabel) { | 780 if (csValue == csOptLabel) { |
781 return i; | 781 return i; |
782 } | 782 } |
783 } | 783 } |
784 return -1; | 784 return -1; |
785 } | 785 } |
786 int CPDF_FormField::FindOptionValue(FX_LPCWSTR csOptValue, int iStartIndex) | 786 int CPDF_FormField::FindOptionValue(const CFX_WideString& csOptValue, int iStart
Index) |
787 { | 787 { |
788 if (iStartIndex < 0) { | 788 if (iStartIndex < 0) { |
789 iStartIndex = 0; | 789 iStartIndex = 0; |
790 } | 790 } |
791 int iCount = CountOptions(); | 791 int iCount = CountOptions(); |
792 for (; iStartIndex < iCount; iStartIndex ++) { | 792 for (; iStartIndex < iCount; iStartIndex ++) { |
793 CFX_WideString csValue = GetOptionValue(iStartIndex); | 793 CFX_WideString csValue = GetOptionValue(iStartIndex); |
794 if (csValue == csOptValue) { | 794 if (csValue == csOptValue) { |
795 return iStartIndex; | 795 return iStartIndex; |
796 } | 796 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 if (pControl == NULL) { | 875 if (pControl == NULL) { |
876 return FALSE; | 876 return FALSE; |
877 } | 877 } |
878 if (!bChecked && pControl->IsChecked() == bChecked) { | 878 if (!bChecked && pControl->IsChecked() == bChecked) { |
879 return FALSE; | 879 return FALSE; |
880 } | 880 } |
881 CFX_ByteArray statusArray; | 881 CFX_ByteArray statusArray; |
882 if (bNotify && m_pForm->m_pFormNotify != NULL) { | 882 if (bNotify && m_pForm->m_pFormNotify != NULL) { |
883 SaveCheckedFieldStatus(this, statusArray); | 883 SaveCheckedFieldStatus(this, statusArray); |
884 } | 884 } |
885 CFX_WideString csWExport = pControl->GetExportValue(); | 885 CFX_WideString csWExport = pControl->GetExportValue(); |
886 CFX_ByteString csBExport = PDF_EncodeText(csWExport); | 886 CFX_ByteString csBExport = PDF_EncodeText(csWExport); |
887 int iCount = CountControls(); | 887 int iCount = CountControls(); |
888 FX_BOOL bUnison = PDF_FormField_IsUnison(this); | 888 FX_BOOL bUnison = PDF_FormField_IsUnison(this); |
889 for (int i = 0; i < iCount; i ++) { | 889 for (int i = 0; i < iCount; i ++) { |
890 CPDF_FormControl* pCtrl = GetControl(i); | 890 CPDF_FormControl* pCtrl = GetControl(i); |
891 if (bUnison) { | 891 if (bUnison) { |
892 CFX_WideString csEValue = pCtrl->GetExportValue(); | 892 CFX_WideString csEValue = pCtrl->GetExportValue(); |
893 if (csEValue == csWExport) { | 893 if (csEValue == csWExport) { |
894 if (pCtrl->GetOnStateName() == pControl->GetOnStateName()) { | 894 if (pCtrl->GetOnStateName() == pControl->GetOnStateName()) { |
895 pCtrl->CheckControl(bChecked); | 895 pCtrl->CheckControl(bChecked); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && | 1167 if (m_pForm->m_pFormDict && m_pForm->m_pFormDict->GetDict("DR") && |
1168 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") ) | 1168 m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font") ) |
1169 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo
nt_name); | 1169 pFontDict = m_pForm->m_pFormDict->GetDict("DR")->GetDict("Font")->GetDict(fo
nt_name); |
1170 | 1170 |
1171 if (pFontDict == NULL) { | 1171 if (pFontDict == NULL) { |
1172 return; | 1172 return; |
1173 } | 1173 } |
1174 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); | 1174 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); |
1175 m_FontSize = FX_atof(syntax.GetWord()); | 1175 m_FontSize = FX_atof(syntax.GetWord()); |
1176 } | 1176 } |
OLD | NEW |