| 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 "../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/fsdk_mgr.h" | 9 #include "../include/fsdk_mgr.h" |
| 10 #include "../include/fsdk_actionhandler.h" | 10 #include "../include/fsdk_actionhandler.h" |
| 11 #include "../include/javascript/IJavaScript.h" | 11 #include "../include/javascript/IJavaScript.h" |
| 12 | 12 |
| 13 /* -------------------------- CBA_ActionHandler -------------------------- */ | 13 CPDFSDK_ActionHandler::CPDFSDK_ActionHandler() |
| 14 | 14 : m_pFormActionHandler(new CPDFSDK_FormActionHandler) { |
| 15 CPDFSDK_ActionHandler::CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi) | |
| 16 : m_pFormActionHandler(new CPDFSDK_FormActionHandler), | |
| 17 m_pMediaActionHandler(NULL) {} | |
| 18 | |
| 19 void CPDFSDK_ActionHandler::SetMediaActionHandler( | |
| 20 CPDFSDK_MediaActionHandler* pHandler) { | |
| 21 ASSERT(pHandler != NULL); | |
| 22 ASSERT(m_pMediaActionHandler == NULL); | |
| 23 m_pMediaActionHandler = pHandler; | |
| 24 } | 15 } |
| 25 | 16 |
| 26 // document open | |
| 27 FX_BOOL CPDFSDK_ActionHandler::DoAction_DocOpen(const CPDF_Action& action, | 17 FX_BOOL CPDFSDK_ActionHandler::DoAction_DocOpen(const CPDF_Action& action, |
| 28 CPDFSDK_Document* pDocument) { | 18 CPDFSDK_Document* pDocument) { |
| 29 CFX_PtrList list; | 19 CFX_PtrList list; |
| 30 return ExecuteDocumentOpenAction(action, pDocument, list); | 20 return ExecuteDocumentOpenAction(action, pDocument, list); |
| 31 } | 21 } |
| 32 | 22 |
| 33 // document open | |
| 34 FX_BOOL CPDFSDK_ActionHandler::DoAction_JavaScript( | 23 FX_BOOL CPDFSDK_ActionHandler::DoAction_JavaScript( |
| 35 const CPDF_Action& JsAction, | 24 const CPDF_Action& JsAction, |
| 36 CFX_WideString csJSName, | 25 CFX_WideString csJSName, |
| 37 CPDFSDK_Document* pDocument) { | 26 CPDFSDK_Document* pDocument) { |
| 38 if (JsAction.GetType() == CPDF_Action::JavaScript) { | 27 if (JsAction.GetType() == CPDF_Action::JavaScript) { |
| 39 CFX_WideString swJS = JsAction.GetJavaScript(); | 28 CFX_WideString swJS = JsAction.GetJavaScript(); |
| 40 if (!swJS.IsEmpty()) { | 29 if (!swJS.IsEmpty()) { |
| 41 RunDocumentOpenJavaScript(pDocument, csJSName, swJS); | 30 RunDocumentOpenJavaScript(pDocument, csJSName, swJS); |
| 42 return TRUE; | 31 return TRUE; |
| 43 } | 32 } |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 break; | 436 break; |
| 448 case CPDF_Action::Launch: | 437 case CPDF_Action::Launch: |
| 449 DoAction_Launch(pDocument, action); | 438 DoAction_Launch(pDocument, action); |
| 450 break; | 439 break; |
| 451 case CPDF_Action::Thread: | 440 case CPDF_Action::Thread: |
| 452 break; | 441 break; |
| 453 case CPDF_Action::URI: | 442 case CPDF_Action::URI: |
| 454 DoAction_URI(pDocument, action); | 443 DoAction_URI(pDocument, action); |
| 455 break; | 444 break; |
| 456 case CPDF_Action::Sound: | 445 case CPDF_Action::Sound: |
| 457 if (m_pMediaActionHandler) { | |
| 458 m_pMediaActionHandler->DoAction_Sound(action, pDocument); | |
| 459 } | |
| 460 break; | 446 break; |
| 461 case CPDF_Action::Movie: | 447 case CPDF_Action::Movie: |
| 462 if (m_pMediaActionHandler) { | |
| 463 m_pMediaActionHandler->DoAction_Movie(action, pDocument); | |
| 464 } | |
| 465 break; | 448 break; |
| 466 case CPDF_Action::Hide: | 449 case CPDF_Action::Hide: |
| 467 if (m_pFormActionHandler) { | 450 if (m_pFormActionHandler) { |
| 468 m_pFormActionHandler->DoAction_Hide(action, pDocument); | 451 m_pFormActionHandler->DoAction_Hide(action, pDocument); |
| 469 } | 452 } |
| 470 break; | 453 break; |
| 471 case CPDF_Action::Named: | 454 case CPDF_Action::Named: |
| 472 DoAction_Named(pDocument, action); | 455 DoAction_Named(pDocument, action); |
| 473 break; | 456 break; |
| 474 case CPDF_Action::SubmitForm: | 457 case CPDF_Action::SubmitForm: |
| (...skipping 11 matching lines...) Expand all Loading... |
| 486 m_pFormActionHandler->DoAction_ImportData(action, pDocument); | 469 m_pFormActionHandler->DoAction_ImportData(action, pDocument); |
| 487 } | 470 } |
| 488 break; | 471 break; |
| 489 case CPDF_Action::JavaScript: | 472 case CPDF_Action::JavaScript: |
| 490 ASSERT(FALSE); | 473 ASSERT(FALSE); |
| 491 break; | 474 break; |
| 492 case CPDF_Action::SetOCGState: | 475 case CPDF_Action::SetOCGState: |
| 493 DoAction_SetOCGState(pDocument, action); | 476 DoAction_SetOCGState(pDocument, action); |
| 494 break; | 477 break; |
| 495 case CPDF_Action::Rendition: | 478 case CPDF_Action::Rendition: |
| 496 if (m_pMediaActionHandler) { | |
| 497 m_pMediaActionHandler->DoAction_Rendition(action, pDocument); | |
| 498 } | |
| 499 break; | 479 break; |
| 500 case CPDF_Action::Trans: | 480 case CPDF_Action::Trans: |
| 501 break; | 481 break; |
| 502 case CPDF_Action::GoTo3DView: | 482 case CPDF_Action::GoTo3DView: |
| 503 break; | 483 break; |
| 504 default: | 484 default: |
| 505 break; | 485 break; |
| 506 } | 486 } |
| 507 } | 487 } |
| 508 | 488 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 740 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
| 761 ASSERT(pInterForm != NULL); | 741 ASSERT(pInterForm != NULL); |
| 762 | 742 |
| 763 if (pInterForm->DoAction_ImportData(action)) { | 743 if (pInterForm->DoAction_ImportData(action)) { |
| 764 pDocument->SetChangeMark(); | 744 pDocument->SetChangeMark(); |
| 765 return TRUE; | 745 return TRUE; |
| 766 } | 746 } |
| 767 | 747 |
| 768 return FALSE; | 748 return FALSE; |
| 769 } | 749 } |
| 770 | |
| 771 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Rendition( | |
| 772 const CPDF_Action& action, | |
| 773 CPDFSDK_Document* pDocument) { | |
| 774 return FALSE; | |
| 775 } | |
| 776 | |
| 777 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Sound( | |
| 778 const CPDF_Action& action, | |
| 779 CPDFSDK_Document* pDocument) { | |
| 780 return FALSE; | |
| 781 } | |
| 782 | |
| 783 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Movie( | |
| 784 const CPDF_Action& action, | |
| 785 CPDFSDK_Document* pDocument) { | |
| 786 return FALSE; | |
| 787 } | |
| OLD | NEW |