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