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

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

Issue 984783002: Merge to XFA: Make conversion between CPDF_Action and its dictionary explicit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 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
« no previous file with comments | « fpdfsdk/src/fsdk_baseannot.cpp ('k') | fpdfsdk/src/fsdk_mgr.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 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/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fpdfxfa/fpdfxfa_doc.h" 8 #include "../include/fpdfxfa/fpdfxfa_doc.h"
9 #include "../include/fpdfxfa/fpdfxfa_util.h" 9 #include "../include/fpdfxfa/fpdfxfa_util.h"
10 #include "../include/fsdk_mgr.h" 10 #include "../include/fsdk_mgr.h"
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 case CPDF_AAction::CursorExit: 2303 case CPDF_AAction::CursorExit:
2304 case CPDF_AAction::ButtonDown: 2304 case CPDF_AAction::ButtonDown:
2305 case CPDF_AAction::ButtonUp: 2305 case CPDF_AAction::ButtonUp:
2306 case CPDF_AAction::GetFocus: 2306 case CPDF_AAction::GetFocus:
2307 case CPDF_AAction::LoseFocus: 2307 case CPDF_AAction::LoseFocus:
2308 case CPDF_AAction::PageOpen: 2308 case CPDF_AAction::PageOpen:
2309 case CPDF_AAction::PageClose: 2309 case CPDF_AAction::PageClose:
2310 case CPDF_AAction::PageVisible: 2310 case CPDF_AAction::PageVisible:
2311 case CPDF_AAction::PageInvisible: 2311 case CPDF_AAction::PageInvisible:
2312 return CPDFSDK_BAAnnot::GetAAction(eAAT); 2312 return CPDFSDK_BAAnnot::GetAAction(eAAT);
2313
2313 case CPDF_AAction::KeyStroke: 2314 case CPDF_AAction::KeyStroke:
2314 case CPDF_AAction::Format: 2315 case CPDF_AAction::Format:
2315 case CPDF_AAction::Validate: 2316 case CPDF_AAction::Validate:
2316 case CPDF_AAction::Calculate: 2317 case CPDF_AAction::Calculate:
2317 { 2318 {
2318 CPDF_FormField* pField = this->GetFormField(); 2319 CPDF_FormField* pField = this->GetFormField();
2319 ASSERT(pField != NULL);
2320
2321 if (CPDF_AAction aa = pField->GetAdditionalAction()) 2320 if (CPDF_AAction aa = pField->GetAdditionalAction())
2322 return aa.GetAction(eAAT); 2321 return aa.GetAction(eAAT);
2323 » » » else 2322 » » » return CPDFSDK_BAAnnot::GetAAction(eAAT);
2324 » » » » return CPDFSDK_BAAnnot::GetAAction(eAAT);
2325 } 2323 }
2326 default: 2324 default:
2327 » » return NULL; 2325 » » break;
2328 } 2326 }
2329 2327
2330 » return NULL; 2328 » return CPDF_Action();
2331 } 2329 }
2332 2330
2333 2331
2334 CFX_WideString CPDFSDK_Widget::GetAlternateName() const 2332 CFX_WideString CPDFSDK_Widget::GetAlternateName() const
2335 { 2333 {
2336 CPDF_FormField* pFormField = GetFormField(); 2334 CPDF_FormField* pFormField = GetFormField();
2337 ASSERT(pFormField != NULL); 2335 ASSERT(pFormField != NULL);
2338 2336
2339 return pFormField->GetAlternateName(); 2337 return pFormField->GetAlternateName();
2340 } 2338 }
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 bRC = fa.bRC; 2921 bRC = fa.bRC;
2924 2922
2925 } 2923 }
2926 } 2924 }
2927 } 2925 }
2928 2926
2929 /* ----------------------------- action ----------------------------- */ 2927 /* ----------------------------- action ----------------------------- */
2930 2928
2931 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) 2929 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action)
2932 { 2930 {
2933 » ASSERT(action != NULL); 2931 » ASSERT(action);
2934 2932
2935 CPDF_ActionFields af = action.GetWidgets(); 2933 CPDF_ActionFields af = action.GetWidgets();
2936 CFX_PtrArray fieldObjects; 2934 CFX_PtrArray fieldObjects;
2937 af.GetAllFields(fieldObjects); 2935 af.GetAllFields(fieldObjects);
2938 CFX_PtrArray widgetArray; 2936 CFX_PtrArray widgetArray;
2939 CFX_PtrArray fields; 2937 CFX_PtrArray fields;
2940 GetFieldFromObjects(fieldObjects, fields); 2938 GetFieldFromObjects(fieldObjects, fields);
2941 2939
2942 FX_BOOL bHide = action.GetHideStatus(); 2940 FX_BOOL bHide = action.GetHideStatus();
2943 2941
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 bChanged = TRUE; 2977 bChanged = TRUE;
2980 } 2978 }
2981 } 2979 }
2982 } 2980 }
2983 2981
2984 return bChanged; 2982 return bChanged;
2985 } 2983 }
2986 2984
2987 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) 2985 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action)
2988 { 2986 {
2989 » ASSERT(action != NULL); 2987 » ASSERT(action);
2990 ASSERT(m_pInterForm != NULL); 2988 ASSERT(m_pInterForm != NULL);
2991 2989
2992 CFX_WideString sDestination = action.GetFilePath(); 2990 CFX_WideString sDestination = action.GetFilePath();
2993 if (sDestination.IsEmpty()) return FALSE; 2991 if (sDestination.IsEmpty()) return FALSE;
2994 2992
2995 » CPDF_Dictionary* pActionDict = action; 2993 » CPDF_Dictionary* pActionDict = action.GetDict();
2996 if (pActionDict->KeyExist("Fields")) 2994 if (pActionDict->KeyExist("Fields"))
2997 { 2995 {
2998 CPDF_ActionFields af = action.GetWidgets(); 2996 CPDF_ActionFields af = action.GetWidgets();
2999 FX_DWORD dwFlags = action.GetFlags(); 2997 FX_DWORD dwFlags = action.GetFlags();
3000 2998
3001 CFX_PtrArray fieldObjects; 2999 CFX_PtrArray fieldObjects;
3002 af.GetAllFields(fieldObjects); 3000 af.GetAllFields(fieldObjects);
3003 CFX_PtrArray fields; 3001 CFX_PtrArray fields;
3004 GetFieldFromObjects(fieldObjects, fields); 3002 GetFieldFromObjects(fieldObjects, fields);
3005 3003
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3231 3229
3232 FX_BOOL bRet = pFDF->WriteBuf(textBuf); 3230 FX_BOOL bRet = pFDF->WriteBuf(textBuf);
3233 delete pFDF; 3231 delete pFDF;
3234 3232
3235 return bRet; 3233 return bRet;
3236 } 3234 }
3237 3235
3238 3236
3239 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) 3237 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action)
3240 { 3238 {
3241 » ASSERT(action != NULL); 3239 » ASSERT(action);
3242 3240
3243 » CPDF_Dictionary* pActionDict = action; 3241 » CPDF_Dictionary* pActionDict = action.GetDict();
3244
3245 if (pActionDict->KeyExist("Fields")) 3242 if (pActionDict->KeyExist("Fields"))
3246 { 3243 {
3247 CPDF_ActionFields af = action.GetWidgets(); 3244 CPDF_ActionFields af = action.GetWidgets();
3248 FX_DWORD dwFlags = action.GetFlags(); 3245 FX_DWORD dwFlags = action.GetFlags();
3249 » » 3246
3250 CFX_PtrArray fieldObjects; 3247 CFX_PtrArray fieldObjects;
3251 af.GetAllFields(fieldObjects); 3248 af.GetAllFields(fieldObjects);
3252 CFX_PtrArray fields; 3249 CFX_PtrArray fields;
3253 GetFieldFromObjects(fieldObjects, fields); 3250 GetFieldFromObjects(fieldObjects, fields);
3254
3255 ASSERT(m_pInterForm != NULL);
3256
3257 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE); 3251 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE);
3258 } 3252 }
3259 » else 3253
3260 » { 3254 » return m_pInterForm->ResetForm(TRUE);
3261 » » ASSERT(m_pInterForm != NULL);
3262 » » return m_pInterForm->ResetForm(TRUE);
3263 » }
3264 } 3255 }
3265 3256
3266 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) 3257 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action)
3267 { 3258 {
3268 return FALSE; 3259 return FALSE;
3269 } 3260 }
3270 3261
3271 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr Array& fields) 3262 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr Array& fields)
3272 { 3263 {
3273 ASSERT(m_pInterForm != NULL); 3264 ASSERT(m_pInterForm != NULL);
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after
3805 3796
3806 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 3797 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
3807 ASSERT(pPDFAnnot != NULL); 3798 ASSERT(pPDFAnnot != NULL);
3808 3799
3809 CPDF_Rect rcAnnot; 3800 CPDF_Rect rcAnnot;
3810 pPDFAnnot->GetRect(rcAnnot); 3801 pPDFAnnot->GetRect(rcAnnot);
3811 3802
3812 return rcAnnot; 3803 return rcAnnot;
3813 } 3804 }
3814 3805
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_baseannot.cpp ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698