blob: 1c8dedefd70f4807e8a6b7a6744087d59e85164a [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
dsinclair114e46a2016-09-29 17:18:21 -07007#ifndef FPDFSDK_FSDK_ACTIONHANDLER_H_
8#define FPDFSDK_FSDK_ACTIONHANDLER_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Lei Zhangaa8bf7e2015-12-24 19:13:32 -080010#include <memory>
Tom Sepez6c7508b2016-01-20 14:59:25 -080011#include <set>
Lei Zhangaa8bf7e2015-12-24 19:13:32 -080012
dsinclair1727aee2016-09-29 13:12:56 -070013#include "core/fpdfdoc/cpdf_aaction.h"
14#include "core/fpdfdoc/cpdf_action.h"
dsinclaira52ab742016-09-29 13:59:29 -070015#include "core/fxcrt/fx_string.h"
dsinclair114e46a2016-09-29 17:18:21 -070016#include "fpdfsdk/pdfsdk_fieldaction.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070017
Tom Sepez245c80e2015-04-08 16:19:33 -070018class CPDFSDK_Annot;
dsinclair19c198b2016-10-11 12:51:37 -070019class CPDFSDK_FormFillEnvironment;
Tom Sepez245c80e2015-04-08 16:19:33 -070020class CPDF_Bookmark;
21class CPDF_Dictionary;
jaepark611adb82016-08-17 11:34:36 -070022class CPDF_FormField;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070023
Nico Weber9d8ec5a2015-08-04 13:00:21 -070024class CPDFSDK_ActionHandler {
25 public:
tsepez4cf55152016-11-02 14:37:54 -070026 bool DoAction_DocOpen(const CPDF_Action& action,
27 CPDFSDK_FormFillEnvironment* pFormFillEnv);
28 bool DoAction_JavaScript(const CPDF_Action& JsAction,
29 CFX_WideString csJSName,
dsinclair19c198b2016-10-11 12:51:37 -070030 CPDFSDK_FormFillEnvironment* pFormFillEnv);
tsepez4cf55152016-11-02 14:37:54 -070031 bool DoAction_Page(const CPDF_Action& action,
32 enum CPDF_AAction::AActionType eType,
33 CPDFSDK_FormFillEnvironment* pFormFillEnv);
34 bool DoAction_Document(const CPDF_Action& action,
35 enum CPDF_AAction::AActionType eType,
36 CPDFSDK_FormFillEnvironment* pFormFillEnv);
37 bool DoAction_BookMark(CPDF_Bookmark* pBookMark,
38 const CPDF_Action& action,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070039 CPDF_AAction::AActionType type,
tsepez4cf55152016-11-02 14:37:54 -070040 CPDFSDK_FormFillEnvironment* pFormFillEnv);
41 bool DoAction_Screen(const CPDF_Action& action,
42 CPDF_AAction::AActionType type,
43 CPDFSDK_FormFillEnvironment* pFormFillEnv,
44 CPDFSDK_Annot* pScreen);
45 bool DoAction_Link(const CPDF_Action& action,
46 CPDFSDK_FormFillEnvironment* pFormFillEnv);
47 bool DoAction_Field(const CPDF_Action& action,
48 CPDF_AAction::AActionType type,
49 CPDFSDK_FormFillEnvironment* pFormFillEnv,
50 CPDF_FormField* pFormField,
51 PDFSDK_FieldAction& data);
52 bool DoAction_FieldJavaScript(const CPDF_Action& JsAction,
53 CPDF_AAction::AActionType type,
54 CPDFSDK_FormFillEnvironment* pFormFillEnv,
55 CPDF_FormField* pFormField,
56 PDFSDK_FieldAction& data);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070057
Nico Weber9d8ec5a2015-08-04 13:00:21 -070058 private:
tsepez4cf55152016-11-02 14:37:54 -070059 bool ExecuteDocumentOpenAction(const CPDF_Action& action,
60 CPDFSDK_FormFillEnvironment* pFormFillEnv,
61 std::set<CPDF_Dictionary*>* visited);
62 bool ExecuteDocumentPageAction(const CPDF_Action& action,
63 CPDF_AAction::AActionType type,
64 CPDFSDK_FormFillEnvironment* pFormFillEnv,
65 std::set<CPDF_Dictionary*>* visited);
66 bool ExecuteFieldAction(const CPDF_Action& action,
67 CPDF_AAction::AActionType type,
dsinclair19c198b2016-10-11 12:51:37 -070068 CPDFSDK_FormFillEnvironment* pFormFillEnv,
tsepez4cf55152016-11-02 14:37:54 -070069 CPDF_FormField* pFormField,
70 PDFSDK_FieldAction& data,
Tom Sepez6c7508b2016-01-20 14:59:25 -080071 std::set<CPDF_Dictionary*>* visited);
tsepez4cf55152016-11-02 14:37:54 -070072 bool ExecuteScreenAction(const CPDF_Action& action,
73 CPDF_AAction::AActionType type,
74 CPDFSDK_FormFillEnvironment* pFormFillEnv,
75 CPDFSDK_Annot* pScreen,
76 std::set<CPDF_Dictionary*>* visited);
77 bool ExecuteBookMark(const CPDF_Action& action,
78 CPDFSDK_FormFillEnvironment* pFormFillEnv,
79 CPDF_Bookmark* pBookmark,
80 std::set<CPDF_Dictionary*>* visited);
81 bool ExecuteLinkAction(const CPDF_Action& action,
82 CPDFSDK_FormFillEnvironment* pFormFillEnv,
83 std::set<CPDF_Dictionary*>* visited);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070084
dsinclair19c198b2016-10-11 12:51:37 -070085 void DoAction_NoJs(const CPDF_Action& action,
86 CPDFSDK_FormFillEnvironment* pFormFillEnv);
87 void RunDocumentPageJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070088 CPDF_AAction::AActionType type,
89 const CFX_WideString& script);
dsinclair19c198b2016-10-11 12:51:37 -070090 void RunDocumentOpenJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070091 const CFX_WideString& sScriptName,
92 const CFX_WideString& script);
dsinclair19c198b2016-10-11 12:51:37 -070093 void RunFieldJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070094 CPDF_FormField* pFormField,
95 CPDF_AAction::AActionType type,
96 PDFSDK_FieldAction& data,
97 const CFX_WideString& script);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070098
tsepez4cf55152016-11-02 14:37:54 -070099 bool IsValidField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
100 CPDF_Dictionary* pFieldDict);
101 bool IsValidDocView(CPDFSDK_FormFillEnvironment* pFormFillEnv);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -0700102
dsinclair19c198b2016-10-11 12:51:37 -0700103 void DoAction_GoTo(CPDFSDK_FormFillEnvironment* pFormFillEnv,
104 const CPDF_Action& action);
105 void DoAction_GoToR(CPDFSDK_FormFillEnvironment* pFormFillEnv,
106 const CPDF_Action& action);
107 void DoAction_Launch(CPDFSDK_FormFillEnvironment* pFormFillEnv,
108 const CPDF_Action& action);
109 void DoAction_URI(CPDFSDK_FormFillEnvironment* pFormFillEnv,
110 const CPDF_Action& action);
111 void DoAction_Named(CPDFSDK_FormFillEnvironment* pFormFillEnv,
112 const CPDF_Action& action);
113 void DoAction_SetOCGState(CPDFSDK_FormFillEnvironment* pFormFillEnv,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700114 const CPDF_Action& action);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -0700115
tsepez4cf55152016-11-02 14:37:54 -0700116 bool DoAction_Hide(const CPDF_Action& action,
117 CPDFSDK_FormFillEnvironment* pFormFillEnv);
118 bool DoAction_SubmitForm(const CPDF_Action& action,
119 CPDFSDK_FormFillEnvironment* pFormFillEnv);
120 bool DoAction_ResetForm(const CPDF_Action& action,
121 CPDFSDK_FormFillEnvironment* pFormFillEnv);
122 bool DoAction_ImportData(const CPDF_Action& action,
123 CPDFSDK_FormFillEnvironment* pFormFillEnv);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700124};
125
dsinclair114e46a2016-09-29 17:18:21 -0700126#endif // FPDFSDK_FSDK_ACTIONHANDLER_H_