blob: 311380ec986c0366ff9ad1d2394251b59bf44340 [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// Copyright 2014 PDFium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Lei Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Tom Sepez19922bb2015-05-28 13:23:12 -07007#ifndef FPDFSDK_INCLUDE_FSDK_ACTIONHANDLER_H_
8#define FPDFSDK_INCLUDE_FSDK_ACTIONHANDLER_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Tom Sepez245c80e2015-04-08 16:19:33 -070010#include "../../core/include/fpdfdoc/fpdf_doc.h"
11#include "../../core/include/fxcrt/fx_string.h"
12#include "fsdk_baseform.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070013
Tom Sepez245c80e2015-04-08 16:19:33 -070014class CFX_PtrList;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070015class CPDFDoc_Environment;
Tom Sepez245c80e2015-04-08 16:19:33 -070016class CPDFSDK_Annot;
17class CPDFSDK_Document;
18class CPDF_Bookmark;
19class CPDF_Dictionary;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020class IFXJS_Runtime;
21
22class CPDFSDK_FormActionHandler
23{
24public:
25 FX_BOOL DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument);
26 FX_BOOL DoAction_SubmitForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
27 FX_BOOL DoAction_ResetForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
28 FX_BOOL DoAction_ImportData(const CPDF_Action& action, CPDFSDK_Document* pDocument);
29};
30
31class CPDFSDK_MediaActionHandler
32{
33public:
34 FX_BOOL DoAction_Rendition(const CPDF_Action& action, CPDFSDK_Document* pDocument);
35 FX_BOOL DoAction_Sound(const CPDF_Action& action, CPDFSDK_Document* pDocument);
36 FX_BOOL DoAction_Movie(const CPDF_Action& action, CPDFSDK_Document* pDocument);
37};
38
39class CPDFSDK_ActionHandler /*: public CReader_ActionHandler*/
40{
41public:
42 CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi);
43 virtual ~CPDFSDK_ActionHandler();
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070044
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070045 virtual void Destroy();
46 virtual FX_BOOL DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CPDFSDK_DocView *pDocView*/);
47 virtual FX_BOOL DoAction_JavaScript(const CPDF_Action& JsAction,CFX_WideString csJSName, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
48 virtual FX_BOOL DoAction_Page(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
49 virtual FX_BOOL DoAction_Document(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070050 virtual FX_BOOL DoAction_BookMark(CPDF_Bookmark *pBookMark, const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070051 virtual FX_BOOL DoAction_Screen(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument,/* CReader_DocView *pDocView,*/ CPDFSDK_Annot* pScreen);
52 virtual FX_BOOL DoAction_Link(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);
53 virtual FX_BOOL DoAction_Field(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
54 virtual FX_BOOL DoAction_FieldJavaScript(const CPDF_Action& JsAction, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
55public:
56 void SetFormActionHandler(CPDFSDK_FormActionHandler* pHandler);
57 void SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070058
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070059private:
60 FX_BOOL ExecuteDocumentOpenAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);
61 FX_BOOL ExecuteDocumentPageAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);
62 FX_BOOL ExecuteFieldAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrList& list);
63 FX_BOOL ExecuteScreenAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDFSDK_Annot* pScreen, CFX_PtrList& list);
64 FX_BOOL ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_Bookmark* pBookmark, CFX_PtrList& list);
65 FX_BOOL ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CFX_PtrList& list);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070066
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070067 void DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);
68 void RunDocumentPageJavaScript(CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script);
69 void RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script);
70 void RunFieldJavaScript(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, const CFX_WideString& script);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070071
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070072private:
73 FX_BOOL IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict);
74 FX_BOOL IsValidDocView(CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070075
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070076 void DoAction_GoTo(CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ const CPDF_Action& action);
77 void DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action);
78 void DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action);
79 void DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action);
80 void DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action);
81 void DoAction_SetOCGState(CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ const CPDF_Action& action);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070082
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070083private:
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070084 CPDFSDK_FormActionHandler* m_pFormActionHandler;
85 CPDFSDK_MediaActionHandler* m_pMediaActionHandler;
86};
87
Tom Sepez19922bb2015-05-28 13:23:12 -070088#endif // FPDFSDK_INCLUDE_FSDK_ACTIONHANDLER_H_