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 #ifndef _FSDK_ACTIONHANDLER_H_ | 7 #ifndef _FSDK_ACTIONHANDLER_H_ |
8 #define _FSDK_ACTIONHANDLER_H_ | 8 #define _FSDK_ACTIONHANDLER_H_ |
9 | 9 |
10 | |
11 class CPDFDoc_Environment; | 10 class CPDFDoc_Environment; |
12 class IFXJS_Runtime; | 11 class IFXJS_Runtime; |
13 | 12 |
14 class CPDFSDK_FormActionHandler | 13 class CPDFSDK_FormActionHandler { |
15 { | 14 public: |
16 public: | 15 FX_BOOL DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument); |
17 » FX_BOOL»DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocu
ment); | 16 FX_BOOL DoAction_SubmitForm(const CPDF_Action& action, |
18 » FX_BOOL»DoAction_SubmitForm(const CPDF_Action& action, CPDFSDK_Document*
pDocument); | 17 CPDFSDK_Document* pDocument); |
19 » FX_BOOL»DoAction_ResetForm(const CPDF_Action& action, CPDFSDK_Document*
pDocument); | 18 FX_BOOL DoAction_ResetForm(const CPDF_Action& action, |
20 » FX_BOOL»DoAction_ImportData(const CPDF_Action& action, CPDFSDK_Document*
pDocument); | 19 CPDFSDK_Document* pDocument); |
| 20 FX_BOOL DoAction_ImportData(const CPDF_Action& action, |
| 21 CPDFSDK_Document* pDocument); |
21 }; | 22 }; |
22 | 23 |
23 class CPDFSDK_MediaActionHandler | 24 class CPDFSDK_MediaActionHandler { |
24 { | 25 public: |
25 public: | 26 FX_BOOL DoAction_Rendition(const CPDF_Action& action, |
26 » FX_BOOL»DoAction_Rendition(const CPDF_Action& action, CPDFSDK_Document*
pDocument); | 27 CPDFSDK_Document* pDocument); |
27 » FX_BOOL»DoAction_Sound(const CPDF_Action& action, CPDFSDK_Document* pDoc
ument); | 28 FX_BOOL DoAction_Sound(const CPDF_Action& action, |
28 » FX_BOOL»DoAction_Movie(const CPDF_Action& action, CPDFSDK_Document* pDoc
ument); | 29 CPDFSDK_Document* pDocument); |
| 30 FX_BOOL DoAction_Movie(const CPDF_Action& action, |
| 31 CPDFSDK_Document* pDocument); |
29 }; | 32 }; |
30 | 33 |
31 class CPDFSDK_ActionHandler /*: public CReader_ActionHandler*/ | 34 class CPDFSDK_ActionHandler /*: public CReader_ActionHandler*/ |
32 { | 35 { |
33 public: | 36 public: |
34 » CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi); | 37 CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi); |
35 » virtual ~CPDFSDK_ActionHandler(); | 38 virtual ~CPDFSDK_ActionHandler(); |
36 » | 39 |
37 » virtual void» » Destroy(); | 40 virtual void Destroy(); |
38 » virtual FX_BOOL»» DoAction_DocOpen(const CPDF_Action& action, CPDF
SDK_Document* pDocument/*, CPDFSDK_DocView *pDocView*/); | 41 virtual FX_BOOL DoAction_DocOpen( |
39 » virtual FX_BOOL»» DoAction_JavaScript(const CPDF_Action& JsAction,
CFX_WideString csJSName, CPDFSDK_Document* pDocument/*, CReader_DocView *pDocVie
w*/); | 42 const CPDF_Action& action, |
40 » virtual FX_BOOL»» DoAction_Page(const CPDF_Action& action, enum CP
DF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocView *p
DocView*/); | 43 CPDFSDK_Document* pDocument /*, CPDFSDK_DocView *pDocView*/); |
41 » virtual FX_BOOL»» DoAction_Document(const CPDF_Action& action, enu
m CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument/*, CReader_DocVie
w *pDocView*/); | 44 virtual FX_BOOL DoAction_JavaScript( |
42 » virtual FX_BOOL»» DoAction_BookMark(CPDF_Bookmark *pBookMark, cons
t CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocume
nt/*, CReader_DocView *pDocView*/);» | 45 const CPDF_Action& JsAction, |
43 » virtual FX_BOOL»» DoAction_Screen(const CPDF_Action& action, CPDF_
AAction::AActionType type, CPDFSDK_Document* pDocument,/* CReader_DocView *pDocV
iew,*/ CPDFSDK_Annot* pScreen); | 46 CFX_WideString csJSName, |
44 » virtual FX_BOOL»» DoAction_Link(const CPDF_Action& action, CPDFSDK
_Document* pDocument/*, CReader_DocView *pDocView*/); | 47 CPDFSDK_Document* pDocument /*, CReader_DocView *pDocView*/); |
45 » virtual FX_BOOL»» DoAction_Field(const CPDF_Action& action, CPDF_A
Action::AActionType type, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocVi
ew,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data); | 48 virtual FX_BOOL DoAction_Page( |
46 » virtual FX_BOOL»» DoAction_FieldJavaScript(const CPDF_Action& JsAc
tion, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormFiel
d* pFormField, PDFSDK_FieldAction& data); | 49 const CPDF_Action& action, |
47 public: | 50 enum CPDF_AAction::AActionType eType, |
48 » void» » » » SetFormActionHandler(CPDFSDK_FormActionH
andler* pHandler); | 51 CPDFSDK_Document* pDocument /*, CReader_DocView *pDocView*/); |
49 » void» » » » SetMediaActionHandler(CPDFSDK_MediaActio
nHandler* pHandler); | 52 virtual FX_BOOL DoAction_Document( |
50 » | 53 const CPDF_Action& action, |
51 private: | 54 enum CPDF_AAction::AActionType eType, |
52 » FX_BOOL»» » » ExecuteDocumentOpenAction(const CPDF_Act
ion& action, CPDFSDK_Document* pDocument, /*CReader_DocView *pDocView,*/ CFX_Ptr
List& list); | 55 CPDFSDK_Document* pDocument /*, CReader_DocView *pDocView*/); |
53 » FX_BOOL»» » » ExecuteDocumentPageAction(const CPDF_Act
ion& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CRea
der_DocView *pDocView,*/ CFX_PtrList& list); | 56 virtual FX_BOOL DoAction_BookMark( |
54 » FX_BOOL»» » » ExecuteFieldAction(const CPDF_Action& ac
tion, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_Doc
View* pDocView,*/ CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrL
ist& list); | 57 CPDF_Bookmark* pBookMark, |
55 » FX_BOOL»» » » ExecuteScreenAction(const CPDF_Action& a
ction, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, /*CReader_Do
cView* pDocView,*/ CPDFSDK_Annot* pScreen, CFX_PtrList& list); | 58 const CPDF_Action& action, |
56 » FX_BOOL»» » » ExecuteBookMark(const CPDF_Action& actio
n, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CPDF_Bookmark* pB
ookmark, CFX_PtrList& list); | 59 CPDF_AAction::AActionType type, |
57 » FX_BOOL»» » » ExecuteLinkAction(const CPDF_Action& act
ion, CPDFSDK_Document* pDocument, /*CReader_DocView* pDocView,*/ CFX_PtrList& li
st); | 60 CPDFSDK_Document* pDocument /*, CReader_DocView *pDocView*/); |
58 » | 61 virtual FX_BOOL DoAction_Screen( |
59 » void» » » » DoAction_NoJs(const CPDF_Action& action,
CPDFSDK_Document* pDocument/*, CReader_DocView* pDocView*/); | 62 const CPDF_Action& action, |
60 » void» » » » RunDocumentPageJavaScript(CPDFSDK_Docume
nt* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script); | 63 CPDF_AAction::AActionType type, |
61 » void» » » » RunDocumentOpenJavaScript(CPDFSDK_Docume
nt* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script); | 64 CPDFSDK_Document* pDocument, |
62 » void» » » » RunFieldJavaScript(CPDFSDK_Document* pDo
cument, CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_Field
Action& data, const CFX_WideString& script); | 65 /* CReader_DocView *pDocView,*/ CPDFSDK_Annot* pScreen); |
63 » | 66 virtual FX_BOOL DoAction_Link( |
64 private: | 67 const CPDF_Action& action, |
65 » FX_BOOL»» » » IsValidField(CPDFSDK_Document* pDocument
, CPDF_Dictionary* pFieldDict); | 68 CPDFSDK_Document* pDocument /*, CReader_DocView *pDocView*/); |
66 » FX_BOOL»» » » IsValidDocView(CPDFSDK_Document* pDocume
nt/*, CReader_DocView* pDocView*/); | 69 virtual FX_BOOL DoAction_Field( |
67 » | 70 const CPDF_Action& action, |
68 » void» » » » DoAction_GoTo(CPDFSDK_Document* pDocumen
t, /*CReader_DocView *pDocView,*/ const CPDF_Action& action); | 71 CPDF_AAction::AActionType type, |
69 » void» » » » DoAction_GoToR(CPDFSDK_Document* pDocume
nt, const CPDF_Action& action); | 72 CPDFSDK_Document* pDocument, |
70 » void» » » » DoAction_Launch(CPDFSDK_Document* pDocum
ent, const CPDF_Action& action); | 73 /*CReader_DocView *pDocView,*/ CPDF_FormField* pFormField, |
71 » void» » » » DoAction_URI(CPDFSDK_Document* pDocument
, const CPDF_Action& action); | 74 PDFSDK_FieldAction& data); |
72 » void» » » » DoAction_Named(CPDFSDK_Document* pDocume
nt, const CPDF_Action& action); | 75 virtual FX_BOOL DoAction_FieldJavaScript(const CPDF_Action& JsAction, |
73 » void» » » » DoAction_SetOCGState(CPDFSDK_Document* p
Document, /*CReader_DocView* pDocView,*/ const CPDF_Action& action); | 76 CPDF_AAction::AActionType type, |
74 » | 77 CPDFSDK_Document* pDocument, |
75 private: | 78 CPDF_FormField* pFormField, |
76 » CPDFSDK_FormActionHandler*» » m_pFormActionHandler; | 79 PDFSDK_FieldAction& data); |
77 » CPDFSDK_MediaActionHandler*» » m_pMediaActionHandler; | 80 |
| 81 public: |
| 82 void SetFormActionHandler(CPDFSDK_FormActionHandler* pHandler); |
| 83 void SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler); |
| 84 |
| 85 private: |
| 86 FX_BOOL ExecuteDocumentOpenAction( |
| 87 const CPDF_Action& action, |
| 88 CPDFSDK_Document* pDocument, |
| 89 /*CReader_DocView *pDocView,*/ CFX_PtrList& list); |
| 90 FX_BOOL ExecuteDocumentPageAction( |
| 91 const CPDF_Action& action, |
| 92 CPDF_AAction::AActionType type, |
| 93 CPDFSDK_Document* pDocument, |
| 94 /*CReader_DocView *pDocView,*/ CFX_PtrList& list); |
| 95 FX_BOOL ExecuteFieldAction( |
| 96 const CPDF_Action& action, |
| 97 CPDF_AAction::AActionType type, |
| 98 CPDFSDK_Document* pDocument, |
| 99 /*CReader_DocView* pDocView,*/ CPDF_FormField* pFormField, |
| 100 PDFSDK_FieldAction& data, |
| 101 CFX_PtrList& list); |
| 102 FX_BOOL ExecuteScreenAction( |
| 103 const CPDF_Action& action, |
| 104 CPDF_AAction::AActionType type, |
| 105 CPDFSDK_Document* pDocument, |
| 106 /*CReader_DocView* pDocView,*/ CPDFSDK_Annot* pScreen, |
| 107 CFX_PtrList& list); |
| 108 FX_BOOL ExecuteBookMark( |
| 109 const CPDF_Action& action, |
| 110 CPDFSDK_Document* pDocument, |
| 111 /*CReader_DocView* pDocView,*/ CPDF_Bookmark* pBookmark, |
| 112 CFX_PtrList& list); |
| 113 FX_BOOL ExecuteLinkAction(const CPDF_Action& action, |
| 114 CPDFSDK_Document* pDocument, |
| 115 /*CReader_DocView* pDocView,*/ CFX_PtrList& list); |
| 116 |
| 117 void DoAction_NoJs( |
| 118 const CPDF_Action& action, |
| 119 CPDFSDK_Document* pDocument /*, CReader_DocView* pDocView*/); |
| 120 void RunDocumentPageJavaScript(CPDFSDK_Document* pDocument, |
| 121 CPDF_AAction::AActionType type, |
| 122 const CFX_WideString& script); |
| 123 void RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument, |
| 124 const CFX_WideString& sScriptName, |
| 125 const CFX_WideString& script); |
| 126 void RunFieldJavaScript(CPDFSDK_Document* pDocument, |
| 127 CPDF_FormField* pFormField, |
| 128 CPDF_AAction::AActionType type, |
| 129 PDFSDK_FieldAction& data, |
| 130 const CFX_WideString& script); |
| 131 |
| 132 private: |
| 133 FX_BOOL IsValidField(CPDFSDK_Document* pDocument, |
| 134 CPDF_Dictionary* pFieldDict); |
| 135 FX_BOOL IsValidDocView( |
| 136 CPDFSDK_Document* pDocument /*, CReader_DocView* pDocView*/); |
| 137 |
| 138 void DoAction_GoTo(CPDFSDK_Document* pDocument, |
| 139 /*CReader_DocView *pDocView,*/ const CPDF_Action& action); |
| 140 void DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action); |
| 141 void DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action); |
| 142 void DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action); |
| 143 void DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action); |
| 144 void DoAction_SetOCGState( |
| 145 CPDFSDK_Document* pDocument, |
| 146 /*CReader_DocView* pDocView,*/ const CPDF_Action& action); |
| 147 |
| 148 private: |
| 149 CPDFSDK_FormActionHandler* m_pFormActionHandler; |
| 150 CPDFSDK_MediaActionHandler* m_pMediaActionHandler; |
78 }; | 151 }; |
79 | 152 |
80 #endif //_BA_ACTIONHANDLER_H_ | 153 #endif //_BA_ACTIONHANDLER_H_ |
81 | |
OLD | NEW |