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

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 1751753002: Remove implicit conversions and some cleanup (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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 "fpdfsdk/include/fsdk_baseform.h" 7 #include "fpdfsdk/include/fsdk_baseform.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 2336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0); 2347 fa.bShift = pEnv->FFI_IsSHIFTKeyDown(0);
2348 fa.sValue = csValue; 2348 fa.sValue = csValue;
2349 pActionHandler->DoAction_FieldJavaScript(action, CPDF_AAction::Validate, 2349 pActionHandler->DoAction_FieldJavaScript(action, CPDF_AAction::Validate,
2350 m_pDocument, pFormField, fa); 2350 m_pDocument, pFormField, fa);
2351 return fa.bRC; 2351 return fa.bRC;
2352 } 2352 }
2353 2353
2354 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { 2354 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) {
2355 ASSERT(action); 2355 ASSERT(action);
2356 2356
2357 CPDF_ActionFields af = action.GetWidgets(); 2357 CPDF_ActionFields af(&action);
2358 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); 2358 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields();
2359 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); 2359 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects);
2360 2360
2361 FX_BOOL bHide = action.GetHideStatus(); 2361 FX_BOOL bHide = action.GetHideStatus();
2362 FX_BOOL bChanged = FALSE; 2362 FX_BOOL bChanged = FALSE;
2363 2363
2364 for (CPDF_FormField* pField : fields) { 2364 for (CPDF_FormField* pField : fields) {
2365 for (int i = 0, sz = pField->CountControls(); i < sz; ++i) { 2365 for (int i = 0, sz = pField->CountControls(); i < sz; ++i) {
2366 CPDF_FormControl* pControl = pField->GetControl(i); 2366 CPDF_FormControl* pControl = pField->GetControl(i);
2367 ASSERT(pControl); 2367 ASSERT(pControl);
(...skipping 16 matching lines...) Expand all
2384 return bChanged; 2384 return bChanged;
2385 } 2385 }
2386 2386
2387 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { 2387 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) {
2388 CFX_WideString sDestination = action.GetFilePath(); 2388 CFX_WideString sDestination = action.GetFilePath();
2389 if (sDestination.IsEmpty()) 2389 if (sDestination.IsEmpty())
2390 return FALSE; 2390 return FALSE;
2391 2391
2392 CPDF_Dictionary* pActionDict = action.GetDict(); 2392 CPDF_Dictionary* pActionDict = action.GetDict();
2393 if (pActionDict->KeyExist("Fields")) { 2393 if (pActionDict->KeyExist("Fields")) {
2394 CPDF_ActionFields af = action.GetWidgets(); 2394 CPDF_ActionFields af(&action);
2395 FX_DWORD dwFlags = action.GetFlags(); 2395 FX_DWORD dwFlags = action.GetFlags();
2396 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); 2396 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields();
2397 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); 2397 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects);
2398 if (!fields.empty()) { 2398 if (!fields.empty()) {
2399 bool bIncludeOrExclude = !(dwFlags & 0x01); 2399 bool bIncludeOrExclude = !(dwFlags & 0x01);
2400 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude)) 2400 if (m_pInterForm->CheckRequiredFields(&fields, bIncludeOrExclude))
2401 return FALSE; 2401 return FALSE;
2402 2402
2403 return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE); 2403 return SubmitFields(sDestination, fields, bIncludeOrExclude, FALSE);
2404 } 2404 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
2557 return bRet; 2557 return bRet;
2558 } 2558 }
2559 2559
2560 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { 2560 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) {
2561 ASSERT(action); 2561 ASSERT(action);
2562 2562
2563 CPDF_Dictionary* pActionDict = action.GetDict(); 2563 CPDF_Dictionary* pActionDict = action.GetDict();
2564 if (!pActionDict->KeyExist("Fields")) 2564 if (!pActionDict->KeyExist("Fields"))
2565 return m_pInterForm->ResetForm(true); 2565 return m_pInterForm->ResetForm(true);
2566 2566
2567 CPDF_ActionFields af = action.GetWidgets(); 2567 CPDF_ActionFields af(&action);
2568 FX_DWORD dwFlags = action.GetFlags(); 2568 FX_DWORD dwFlags = action.GetFlags();
2569 2569
2570 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields(); 2570 std::vector<CPDF_Object*> fieldObjects = af.GetAllFields();
2571 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects); 2571 std::vector<CPDF_FormField*> fields = GetFieldFromObjects(fieldObjects);
2572 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), true); 2572 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), true);
2573 } 2573 }
2574 2574
2575 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) { 2575 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) {
2576 return FALSE; 2576 return FALSE;
2577 } 2577 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 break; 2857 break;
2858 } 2858 }
2859 } 2859 }
2860 } 2860 }
2861 2861
2862 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { 2862 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) {
2863 CFX_FloatRect rcAnnot; 2863 CFX_FloatRect rcAnnot;
2864 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); 2864 pAnnot->GetPDFAnnot()->GetRect(rcAnnot);
2865 return rcAnnot; 2865 return rcAnnot;
2866 } 2866 }
OLDNEW
« core/src/fpdfdoc/doc_formfield.cpp ('K') | « fpdfsdk/src/fsdk_baseannot.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698