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 "fpdfsdk/fsdk_actionhandler.h" | 7 #include "fpdfsdk/fsdk_actionhandler.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 } | 215 } |
216 | 216 |
217 return TRUE; | 217 return TRUE; |
218 } | 218 } |
219 | 219 |
220 FX_BOOL CPDFSDK_ActionHandler::IsValidField( | 220 FX_BOOL CPDFSDK_ActionHandler::IsValidField( |
221 CPDFSDK_FormFillEnvironment* pFormFillEnv, | 221 CPDFSDK_FormFillEnvironment* pFormFillEnv, |
222 CPDF_Dictionary* pFieldDict) { | 222 CPDF_Dictionary* pFieldDict) { |
223 ASSERT(pFieldDict); | 223 ASSERT(pFieldDict); |
224 | 224 |
225 CPDFSDK_InterForm* pInterForm = | 225 CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
226 pFormFillEnv->GetSDKDocument()->GetInterForm(); | |
227 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 226 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
228 return !!pPDFInterForm->GetFieldByDict(pFieldDict); | 227 return !!pPDFInterForm->GetFieldByDict(pFieldDict); |
229 } | 228 } |
230 | 229 |
231 FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( | 230 FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction( |
232 const CPDF_Action& action, | 231 const CPDF_Action& action, |
233 CPDF_AAction::AActionType type, | 232 CPDF_AAction::AActionType type, |
234 CPDFSDK_FormFillEnvironment* pFormFillEnv, | 233 CPDFSDK_FormFillEnvironment* pFormFillEnv, |
235 CPDF_FormField* pFormField, | 234 CPDF_FormField* pFormField, |
236 PDFSDK_FieldAction& data, | 235 PDFSDK_FieldAction& data, |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 CPDFSDK_FormFillEnvironment* pFormFillEnv) { | 409 CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
411 ASSERT(pFormFillEnv); | 410 ASSERT(pFormFillEnv); |
412 return TRUE; | 411 return TRUE; |
413 } | 412 } |
414 | 413 |
415 void CPDFSDK_ActionHandler::DoAction_GoTo( | 414 void CPDFSDK_ActionHandler::DoAction_GoTo( |
416 CPDFSDK_FormFillEnvironment* pFormFillEnv, | 415 CPDFSDK_FormFillEnvironment* pFormFillEnv, |
417 const CPDF_Action& action) { | 416 const CPDF_Action& action) { |
418 ASSERT(action.GetDict()); | 417 ASSERT(action.GetDict()); |
419 | 418 |
420 CPDF_Document* pPDFDocument = | 419 CPDF_Document* pPDFDocument = pFormFillEnv->GetPDFDocument(); |
421 pFormFillEnv->GetSDKDocument()->GetPDFDocument(); | |
422 ASSERT(pPDFDocument); | 420 ASSERT(pPDFDocument); |
423 | 421 |
424 CPDF_Dest MyDest = action.GetDest(pPDFDocument); | 422 CPDF_Dest MyDest = action.GetDest(pPDFDocument); |
425 int nPageIndex = MyDest.GetPageIndex(pPDFDocument); | 423 int nPageIndex = MyDest.GetPageIndex(pPDFDocument); |
426 int nFitType = MyDest.GetZoomMode(); | 424 int nFitType = MyDest.GetZoomMode(); |
427 const CPDF_Array* pMyArray = ToArray(MyDest.GetObject()); | 425 const CPDF_Array* pMyArray = ToArray(MyDest.GetObject()); |
428 float* pPosAry = nullptr; | 426 float* pPosAry = nullptr; |
429 int sizeOfAry = 0; | 427 int sizeOfAry = 0; |
430 if (pMyArray) { | 428 if (pMyArray) { |
431 pPosAry = new float[pMyArray->GetCount()]; | 429 pPosAry = new float[pMyArray->GetCount()]; |
(...skipping 14 matching lines...) Expand all Loading... |
446 | 444 |
447 void CPDFSDK_ActionHandler::DoAction_Launch( | 445 void CPDFSDK_ActionHandler::DoAction_Launch( |
448 CPDFSDK_FormFillEnvironment* pFormFillEnv, | 446 CPDFSDK_FormFillEnvironment* pFormFillEnv, |
449 const CPDF_Action& action) {} | 447 const CPDF_Action& action) {} |
450 | 448 |
451 void CPDFSDK_ActionHandler::DoAction_URI( | 449 void CPDFSDK_ActionHandler::DoAction_URI( |
452 CPDFSDK_FormFillEnvironment* pFormFillEnv, | 450 CPDFSDK_FormFillEnvironment* pFormFillEnv, |
453 const CPDF_Action& action) { | 451 const CPDF_Action& action) { |
454 ASSERT(action.GetDict()); | 452 ASSERT(action.GetDict()); |
455 | 453 |
456 CFX_ByteString sURI = | 454 CFX_ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument()); |
457 action.GetURI(pFormFillEnv->GetSDKDocument()->GetPDFDocument()); | |
458 pFormFillEnv->DoURIAction(sURI.c_str()); | 455 pFormFillEnv->DoURIAction(sURI.c_str()); |
459 } | 456 } |
460 | 457 |
461 void CPDFSDK_ActionHandler::DoAction_Named( | 458 void CPDFSDK_ActionHandler::DoAction_Named( |
462 CPDFSDK_FormFillEnvironment* pFormFillEnv, | 459 CPDFSDK_FormFillEnvironment* pFormFillEnv, |
463 const CPDF_Action& action) { | 460 const CPDF_Action& action) { |
464 ASSERT(action.GetDict()); | 461 ASSERT(action.GetDict()); |
465 | 462 |
466 CFX_ByteString csName = action.GetNamedAction(); | 463 CFX_ByteString csName = action.GetNamedAction(); |
467 pFormFillEnv->ExecuteNamedAction(csName.c_str()); | 464 pFormFillEnv->ExecuteNamedAction(csName.c_str()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 if (!bRet) { | 586 if (!bRet) { |
590 // FIXME: return error. | 587 // FIXME: return error. |
591 } | 588 } |
592 | 589 |
593 pRuntime->ReleaseContext(pContext); | 590 pRuntime->ReleaseContext(pContext); |
594 } | 591 } |
595 | 592 |
596 FX_BOOL CPDFSDK_ActionHandler::DoAction_Hide( | 593 FX_BOOL CPDFSDK_ActionHandler::DoAction_Hide( |
597 const CPDF_Action& action, | 594 const CPDF_Action& action, |
598 CPDFSDK_FormFillEnvironment* pFormFillEnv) { | 595 CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
599 CPDFSDK_InterForm* pInterForm = | 596 CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
600 pFormFillEnv->GetSDKDocument()->GetInterForm(); | |
601 if (pInterForm->DoAction_Hide(action)) { | 597 if (pInterForm->DoAction_Hide(action)) { |
602 pFormFillEnv->GetSDKDocument()->SetChangeMark(); | 598 pFormFillEnv->SetChangeMark(); |
603 return TRUE; | 599 return TRUE; |
604 } | 600 } |
605 | 601 |
606 return FALSE; | 602 return FALSE; |
607 } | 603 } |
608 | 604 |
609 FX_BOOL CPDFSDK_ActionHandler::DoAction_SubmitForm( | 605 FX_BOOL CPDFSDK_ActionHandler::DoAction_SubmitForm( |
610 const CPDF_Action& action, | 606 const CPDF_Action& action, |
611 CPDFSDK_FormFillEnvironment* pFormFillEnv) { | 607 CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
612 CPDFSDK_InterForm* pInterForm = | 608 CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
613 pFormFillEnv->GetSDKDocument()->GetInterForm(); | |
614 return pInterForm->DoAction_SubmitForm(action); | 609 return pInterForm->DoAction_SubmitForm(action); |
615 } | 610 } |
616 | 611 |
617 FX_BOOL CPDFSDK_ActionHandler::DoAction_ResetForm( | 612 FX_BOOL CPDFSDK_ActionHandler::DoAction_ResetForm( |
618 const CPDF_Action& action, | 613 const CPDF_Action& action, |
619 CPDFSDK_FormFillEnvironment* pFormFillEnv) { | 614 CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
620 CPDFSDK_InterForm* pInterForm = | 615 CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
621 pFormFillEnv->GetSDKDocument()->GetInterForm(); | |
622 return pInterForm->DoAction_ResetForm(action); | 616 return pInterForm->DoAction_ResetForm(action); |
623 } | 617 } |
624 | 618 |
625 FX_BOOL CPDFSDK_ActionHandler::DoAction_ImportData( | 619 FX_BOOL CPDFSDK_ActionHandler::DoAction_ImportData( |
626 const CPDF_Action& action, | 620 const CPDF_Action& action, |
627 CPDFSDK_FormFillEnvironment* pFormFillEnv) { | 621 CPDFSDK_FormFillEnvironment* pFormFillEnv) { |
628 CPDFSDK_InterForm* pInterForm = | 622 CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); |
629 pFormFillEnv->GetSDKDocument()->GetInterForm(); | |
630 if (pInterForm->DoAction_ImportData(action)) { | 623 if (pInterForm->DoAction_ImportData(action)) { |
631 pFormFillEnv->GetSDKDocument()->SetChangeMark(); | 624 pFormFillEnv->SetChangeMark(); |
632 return TRUE; | 625 return TRUE; |
633 } | 626 } |
634 | 627 |
635 return FALSE; | 628 return FALSE; |
636 } | 629 } |
OLD | NEW |