Initial commit.
[pdfium.git] / fpdfsdk / include / fsdk_actionhandler.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4  \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef _FSDK_ACTIONHANDLER_H_\r
8 #define _FSDK_ACTIONHANDLER_H_\r
9 \r
10 \r
11 class CPDFDoc_Environment;\r
12 class IFXJS_Runtime;\r
13 \r
14 class CPDFSDK_FormActionHandler\r
15 {\r
16 public:\r
17         FX_BOOL DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument);\r
18         FX_BOOL DoAction_SubmitForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);\r
19         FX_BOOL DoAction_ResetForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);\r
20         FX_BOOL DoAction_ImportData(const CPDF_Action& action, CPDFSDK_Document* pDocument);\r
21 };\r
22 \r
23 class CPDFSDK_MediaActionHandler\r
24 {\r
25 public:\r
26         FX_BOOL DoAction_Rendition(const CPDF_Action& action, CPDFSDK_Document* pDocument);\r
27         FX_BOOL DoAction_Sound(const CPDF_Action& action, CPDFSDK_Document* pDocument);\r
28         FX_BOOL DoAction_Movie(const CPDF_Action& action, CPDFSDK_Document* pDocument);\r
29 };\r
30 \r
31 class  CPDFSDK_ActionHandler /*: public CReader_ActionHandler*/\r
32 {\r
33 public:\r
34         CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi);\r
35         virtual ~CPDFSDK_ActionHandler();\r
36         \r
37         virtual void            Destroy();\r
38         virtual FX_BOOL         DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CPDFSDK_DocView *pDocView*/);\r
39         virtual FX_BOOL         DoAction_JavaScript(const CPDF_Action& JsAction,CFX_WideString csJSName, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);\r
40         virtual FX_BOOL         DoAction_Page(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);\r
41         virtual FX_BOOL         DoAction_Document(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);\r
42         virtual FX_BOOL         DoAction_BookMark(CPDF_Bookmark *pBookMark, const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);     \r
43         virtual FX_BOOL         DoAction_Screen(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument,/* CReader_DocView *pDocView,*/ CPDFSDK_Annot* pScreen);\r
44         virtual FX_BOOL         DoAction_Link(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/);\r
45         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);\r
46         virtual FX_BOOL         DoAction_FieldJavaScript(const CPDF_Action& JsAction, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);\r
47 public:\r
48         void                            SetFormActionHandler(CPDFSDK_FormActionHandler* pHandler);\r
49         void                            SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler);\r
50         \r
51 private:\r
52         FX_BOOL                         ExecuteDocumentOpenAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);\r
53         FX_BOOL                         ExecuteDocumentPageAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_PtrList& list);\r
54         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);\r
55         FX_BOOL                         ExecuteScreenAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDFSDK_Annot* pScreen, CFX_PtrList& list);\r
56         FX_BOOL                         ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_Bookmark* pBookmark, CFX_PtrList& list);\r
57         FX_BOOL                         ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CFX_PtrList& list);\r
58         \r
59         void                            DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);\r
60         void                            RunDocumentPageJavaScript(CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script);\r
61         void                            RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script);\r
62         void                            RunFieldJavaScript(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, const CFX_WideString& script);\r
63         \r
64 private:\r
65         FX_BOOL                         IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict);\r
66         FX_BOOL                         IsValidDocView(CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/);\r
67         \r
68         void                            DoAction_GoTo(CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ const CPDF_Action& action);\r
69         void                            DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action);\r
70         void                            DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action);\r
71         void                            DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action);\r
72         void                            DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action);\r
73         void                            DoAction_SetOCGState(CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ const CPDF_Action& action);\r
74         \r
75 private:\r
76         CPDFDoc_Environment*                    m_pEvi;\r
77         CPDFSDK_FormActionHandler*              m_pFormActionHandler;\r
78         CPDFSDK_MediaActionHandler*             m_pMediaActionHandler;\r
79 };\r
80 \r
81 #endif //_BA_ACTIONHANDLER_H_\r
82 \r