blob: 39ec4f41af148adb74013f8307b22797d2e87d29 [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"
Tom Sepez2c286192015-06-18 12:47:11 -070012#include "../../third_party/base/nonstd_unique_ptr.h"
Tom Sepez245c80e2015-04-08 16:19:33 -070013#include "fsdk_baseform.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070014
Tom Sepez245c80e2015-04-08 16:19:33 -070015class CFX_PtrList;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070016class CPDFDoc_Environment;
Tom Sepez245c80e2015-04-08 16:19:33 -070017class CPDFSDK_Annot;
18class CPDFSDK_Document;
19class CPDF_Bookmark;
20class CPDF_Dictionary;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070021class IFXJS_Runtime;
22
23class CPDFSDK_FormActionHandler
24{
25public:
26 FX_BOOL DoAction_Hide(const CPDF_Action& action, CPDFSDK_Document* pDocument);
27 FX_BOOL DoAction_SubmitForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
28 FX_BOOL DoAction_ResetForm(const CPDF_Action& action, CPDFSDK_Document* pDocument);
29 FX_BOOL DoAction_ImportData(const CPDF_Action& action, CPDFSDK_Document* pDocument);
30};
31
32class CPDFSDK_MediaActionHandler
33{
34public:
35 FX_BOOL DoAction_Rendition(const CPDF_Action& action, CPDFSDK_Document* pDocument);
36 FX_BOOL DoAction_Sound(const CPDF_Action& action, CPDFSDK_Document* pDocument);
37 FX_BOOL DoAction_Movie(const CPDF_Action& action, CPDFSDK_Document* pDocument);
38};
39
Tom Sepez2c286192015-06-18 12:47:11 -070040class CPDFSDK_ActionHandler
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070041{
42public:
43 CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070044
Tom Sepez2c286192015-06-18 12:47:11 -070045 void SetMediaActionHandler(CPDFSDK_MediaActionHandler* pHandler);
46
47 FX_BOOL DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_Document* pDocument);
48 FX_BOOL DoAction_JavaScript(const CPDF_Action& JsAction,CFX_WideString csJSName, CPDFSDK_Document* pDocument);
49 FX_BOOL DoAction_Page(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument);
50 FX_BOOL DoAction_Document(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, CPDFSDK_Document* pDocument);
51 FX_BOOL DoAction_BookMark(CPDF_Bookmark *pBookMark, const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument);
52 FX_BOOL DoAction_Screen(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen);
53 FX_BOOL DoAction_Link(const CPDF_Action& action, CPDFSDK_Document* pDocument);
54 FX_BOOL DoAction_Field(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
55 FX_BOOL DoAction_FieldJavaScript(const CPDF_Action& JsAction, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070056
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070057private:
Tom Sepez2c286192015-06-18 12:47:11 -070058 FX_BOOL ExecuteDocumentOpenAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, CFX_PtrList& list);
59 FX_BOOL ExecuteDocumentPageAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CFX_PtrList& list);
60 FX_BOOL ExecuteFieldAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, PDFSDK_FieldAction& data, CFX_PtrList& list);
61 FX_BOOL ExecuteScreenAction(const CPDF_Action& action, CPDF_AAction::AActionType type, CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen, CFX_PtrList& list);
62 FX_BOOL ExecuteBookMark(const CPDF_Action& action, CPDFSDK_Document* pDocument, CPDF_Bookmark* pBookmark, CFX_PtrList& list);
63 FX_BOOL ExecuteLinkAction(const CPDF_Action& action, CPDFSDK_Document* pDocument, CFX_PtrList& list);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070064
Tom Sepez2c286192015-06-18 12:47:11 -070065 void DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Document* pDocument);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070066 void RunDocumentPageJavaScript(CPDFSDK_Document* pDocument, CPDF_AAction::AActionType type, const CFX_WideString& script);
67 void RunDocumentOpenJavaScript(CPDFSDK_Document* pDocument, const CFX_WideString& sScriptName, const CFX_WideString& script);
68 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 -070069
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070070 FX_BOOL IsValidField(CPDFSDK_Document* pDocument, CPDF_Dictionary* pFieldDict);
Tom Sepez2c286192015-06-18 12:47:11 -070071 FX_BOOL IsValidDocView(CPDFSDK_Document* pDocument);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070072
Tom Sepez2c286192015-06-18 12:47:11 -070073 void DoAction_GoTo(CPDFSDK_Document* pDocument, const CPDF_Action& action);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070074 void DoAction_GoToR(CPDFSDK_Document* pDocument, const CPDF_Action& action);
75 void DoAction_Launch(CPDFSDK_Document* pDocument, const CPDF_Action& action);
76 void DoAction_URI(CPDFSDK_Document* pDocument, const CPDF_Action& action);
77 void DoAction_Named(CPDFSDK_Document* pDocument, const CPDF_Action& action);
Tom Sepez2c286192015-06-18 12:47:11 -070078 void DoAction_SetOCGState(CPDFSDK_Document* pDocument, const CPDF_Action& action);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070079
Tom Sepez2c286192015-06-18 12:47:11 -070080 nonstd::unique_ptr<CPDFSDK_FormActionHandler> m_pFormActionHandler;
81 CPDFSDK_MediaActionHandler* m_pMediaActionHandler;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070082};
83
Tom Sepez19922bb2015-05-28 13:23:12 -070084#endif // FPDFSDK_INCLUDE_FSDK_ACTIONHANDLER_H_