Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: core/src/fpdfdoc/doc_formfield.cpp

Issue 1653253002: Kill CFX_ByteArray in master. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 9
10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) { 10 FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 m_Type = Sign; 95 m_Type = Sign;
96 } 96 }
97 } 97 }
98 CFX_WideString CPDF_FormField::GetFullName() { 98 CFX_WideString CPDF_FormField::GetFullName() {
99 return ::GetFullName(m_pDict); 99 return ::GetFullName(m_pDict);
100 } 100 }
101 FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) { 101 FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
102 switch (m_Type) { 102 switch (m_Type) {
103 case CPDF_FormField::CheckBox: 103 case CPDF_FormField::CheckBox:
104 case CPDF_FormField::RadioButton: { 104 case CPDF_FormField::RadioButton: {
105 CFX_ByteArray statusArray; 105 std::vector<uint8_t> statusArray;
106 if (bNotify && m_pForm->m_pFormNotify) { 106 if (bNotify && m_pForm->m_pFormNotify) {
107 SaveCheckedFieldStatus(this, statusArray); 107 SaveCheckedFieldStatus(this, &statusArray);
108 } 108 }
109 int iCount = CountControls(); 109 int iCount = CountControls();
110 if (iCount) { 110 if (iCount) {
111 if (PDF_FormField_IsUnison(this)) { 111 if (PDF_FormField_IsUnison(this)) {
112 for (int i = 0; i < iCount; i++) { 112 for (int i = 0; i < iCount; i++) {
113 CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE); 113 CheckControl(i, GetControl(i)->IsDefaultChecked(), FALSE);
114 } 114 }
115 } else { 115 } else {
116 for (int i = 0; i < iCount; i++) { 116 for (int i = 0; i < iCount; i++) {
117 CPDF_FormControl* pControl = GetControl(i); 117 CPDF_FormControl* pControl = GetControl(i);
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 FX_BOOL bChecked, 733 FX_BOOL bChecked,
734 FX_BOOL bNotify) { 734 FX_BOOL bNotify) {
735 ASSERT(GetType() == CheckBox || GetType() == RadioButton); 735 ASSERT(GetType() == CheckBox || GetType() == RadioButton);
736 CPDF_FormControl* pControl = GetControl(iControlIndex); 736 CPDF_FormControl* pControl = GetControl(iControlIndex);
737 if (!pControl) { 737 if (!pControl) {
738 return FALSE; 738 return FALSE;
739 } 739 }
740 if (!bChecked && pControl->IsChecked() == bChecked) { 740 if (!bChecked && pControl->IsChecked() == bChecked) {
741 return FALSE; 741 return FALSE;
742 } 742 }
743 CFX_ByteArray statusArray; 743 std::vector<uint8_t> statusArray;
744 if (bNotify && m_pForm->m_pFormNotify) { 744 if (bNotify && m_pForm->m_pFormNotify) {
745 SaveCheckedFieldStatus(this, statusArray); 745 SaveCheckedFieldStatus(this, &statusArray);
746 } 746 }
747 CFX_WideString csWExport = pControl->GetExportValue(); 747 CFX_WideString csWExport = pControl->GetExportValue();
748 CFX_ByteString csBExport = PDF_EncodeText(csWExport); 748 CFX_ByteString csBExport = PDF_EncodeText(csWExport);
749 int iCount = CountControls(); 749 int iCount = CountControls();
750 FX_BOOL bUnison = PDF_FormField_IsUnison(this); 750 FX_BOOL bUnison = PDF_FormField_IsUnison(this);
751 for (int i = 0; i < iCount; i++) { 751 for (int i = 0; i < iCount; i++) {
752 CPDF_FormControl* pCtrl = GetControl(i); 752 CPDF_FormControl* pCtrl = GetControl(i);
753 if (bUnison) { 753 if (bUnison) {
754 CFX_WideString csEValue = pCtrl->GetExportValue(); 754 CFX_WideString csEValue = pCtrl->GetExportValue();
755 if (csEValue == csWExport) { 755 if (csEValue == csWExport) {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 csExport = pControl->GetExportValue(); 810 csExport = pControl->GetExportValue();
811 break; 811 break;
812 } 812 }
813 } 813 }
814 return csExport; 814 return csExport;
815 } 815 }
816 FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value, 816 FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
817 FX_BOOL bDefault, 817 FX_BOOL bDefault,
818 FX_BOOL bNotify) { 818 FX_BOOL bNotify) {
819 ASSERT(GetType() == CheckBox || GetType() == RadioButton); 819 ASSERT(GetType() == CheckBox || GetType() == RadioButton);
820 CFX_ByteArray statusArray; 820 std::vector<uint8_t> statusArray;
821 if (bNotify && m_pForm->m_pFormNotify) { 821 if (bNotify && m_pForm->m_pFormNotify) {
822 SaveCheckedFieldStatus(this, statusArray); 822 SaveCheckedFieldStatus(this, &statusArray);
823 } 823 }
824 int iCount = CountControls(); 824 int iCount = CountControls();
825 for (int i = 0; i < iCount; i++) { 825 for (int i = 0; i < iCount; i++) {
826 CPDF_FormControl* pControl = GetControl(i); 826 CPDF_FormControl* pControl = GetControl(i);
827 CFX_WideString csExport = pControl->GetExportValue(); 827 CFX_WideString csExport = pControl->GetExportValue();
828 if (csExport == value) { 828 if (csExport == value) {
829 if (bDefault) { 829 if (bDefault) {
830 } else { 830 } else {
831 CheckControl(GetControlIndex(pControl), TRUE); 831 CheckControl(GetControlIndex(pControl), TRUE);
832 } 832 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 pFontDict = m_pForm->m_pFormDict->GetDictBy("DR") 1020 pFontDict = m_pForm->m_pFormDict->GetDictBy("DR")
1021 ->GetDictBy("Font") 1021 ->GetDictBy("Font")
1022 ->GetDictBy(font_name); 1022 ->GetDictBy(font_name);
1023 1023
1024 if (!pFontDict) { 1024 if (!pFontDict) {
1025 return; 1025 return;
1026 } 1026 }
1027 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict); 1027 m_pFont = m_pForm->m_pDocument->LoadFont(pFontDict);
1028 m_FontSize = FX_atof(syntax.GetWord()); 1028 m_FontSize = FX_atof(syntax.GetWord());
1029 } 1029 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698