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

Side by Side Diff: core/fpdfdoc/cpdf_interform.cpp

Issue 2498223005: Make CPDF_Array take unique_ptrs (Closed)
Patch Set: nits Created 4 years, 1 month 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
« no previous file with comments | « core/fpdfdoc/cpdf_formfield.cpp ('k') | fpdfsdk/cpdfsdk_baannot.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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/font/cpdf_font.h" 9 #include "core/fpdfapi/font/cpdf_font.h"
10 #include "core/fpdfapi/font/cpdf_fontencoding.h" 10 #include "core/fpdfapi/font/cpdf_fontencoding.h"
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 1230
1231 uint32_t dwFlags = pField->GetFieldFlags(); 1231 uint32_t dwFlags = pField->GetFieldFlags();
1232 if (dwFlags & 0x04) 1232 if (dwFlags & 0x04)
1233 continue; 1233 continue;
1234 1234
1235 if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) { 1235 if (bIncludeOrExclude == pdfium::ContainsValue(fields, pField)) {
1236 if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringFor("V").IsEmpty()) 1236 if ((dwFlags & 0x02) != 0 && pField->m_pDict->GetStringFor("V").IsEmpty())
1237 continue; 1237 continue;
1238 1238
1239 CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict()); 1239 CFX_WideString fullname = FPDF_GetFullName(pField->GetFieldDict());
1240 CPDF_Dictionary* pFieldDict = 1240 auto pFieldDict =
1241 new CPDF_Dictionary(pDoc->GetByteStringPool()); 1241 pdfium::MakeUnique<CPDF_Dictionary>(pDoc->GetByteStringPool());
1242 pFieldDict->SetFor("T", new CPDF_String(fullname)); 1242 pFieldDict->SetFor("T", new CPDF_String(fullname));
1243 if (pField->GetType() == CPDF_FormField::CheckBox || 1243 if (pField->GetType() == CPDF_FormField::CheckBox ||
1244 pField->GetType() == CPDF_FormField::RadioButton) { 1244 pField->GetType() == CPDF_FormField::RadioButton) {
1245 CFX_WideString csExport = pField->GetCheckValue(false); 1245 CFX_WideString csExport = pField->GetCheckValue(false);
1246 CFX_ByteString csBExport = PDF_EncodeText(csExport); 1246 CFX_ByteString csBExport = PDF_EncodeText(csExport);
1247 CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt"); 1247 CPDF_Object* pOpt = FPDF_GetFieldAttr(pField->m_pDict, "Opt");
1248 if (pOpt) 1248 if (pOpt)
1249 pFieldDict->SetStringFor("V", csBExport); 1249 pFieldDict->SetStringFor("V", csBExport);
1250 else 1250 else
1251 pFieldDict->SetNameFor("V", csBExport); 1251 pFieldDict->SetNameFor("V", csBExport);
1252 } else { 1252 } else {
1253 CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V"); 1253 CPDF_Object* pV = FPDF_GetFieldAttr(pField->m_pDict, "V");
1254 if (pV) 1254 if (pV)
1255 pFieldDict->SetFor("V", pV->CloneDirectObject().release()); 1255 pFieldDict->SetFor("V", pV->CloneDirectObject().release());
1256 } 1256 }
1257 pFields->Add(pFieldDict); 1257 pFields->Add(std::move(pFieldDict));
1258 } 1258 }
1259 } 1259 }
1260 return pDoc; 1260 return pDoc;
1261 } 1261 }
1262 1262
1263 void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict, 1263 void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
1264 const CFX_WideString& parent_name, 1264 const CFX_WideString& parent_name,
1265 bool bNotify, 1265 bool bNotify,
1266 int nLevel) { 1266 int nLevel) {
1267 CFX_WideString name; 1267 CFX_WideString name;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 else if (iType == FIELDTYPE_LISTBOX) 1315 else if (iType == FIELDTYPE_LISTBOX)
1316 m_pFormNotify->AfterSelectionChange(pField); 1316 m_pFormNotify->AfterSelectionChange(pField);
1317 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD) 1317 else if (iType == FIELDTYPE_COMBOBOX || iType == FIELDTYPE_TEXTFIELD)
1318 m_pFormNotify->AfterValueChange(pField); 1318 m_pFormNotify->AfterValueChange(pField);
1319 } 1319 }
1320 } 1320 }
1321 1321
1322 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) { 1322 void CPDF_InterForm::SetFormNotify(IPDF_FormNotify* pNotify) {
1323 m_pFormNotify = pNotify; 1323 m_pFormNotify = pNotify;
1324 } 1324 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_formfield.cpp ('k') | fpdfsdk/cpdfsdk_baannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698