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