blob: 8ae6c1d21d3be85b58675b081125d6b4ef3c1715 [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
Dan Sinclairf766ad22016-03-14 13:51:24 -04007#ifndef FPDFSDK_JAVASCRIPT_DOCUMENT_H_
8#define FPDFSDK_JAVASCRIPT_DOCUMENT_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Tom Sepez6ba32d92016-01-05 16:26:32 -080010#include <list>
11#include <memory>
Dan Sinclair3ebd1212016-03-09 09:59:23 -050012#include <vector>
Tom Sepez6ba32d92016-01-05 16:26:32 -080013
Dan Sinclairf766ad22016-03-14 13:51:24 -040014#include "fpdfsdk/javascript/JS_Define.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070015
Nico Weber9d8ec5a2015-08-04 13:00:21 -070016class PrintParamsObj : public CJS_EmbedObj {
17 public:
18 PrintParamsObj(CJS_Object* pJSObject);
Lei Zhang2b1a2d52015-08-14 22:16:22 -070019 ~PrintParamsObj() override {}
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070020
Nico Weber9d8ec5a2015-08-04 13:00:21 -070021 public:
22 FX_BOOL bUI;
23 int nStart;
24 int nEnd;
25 FX_BOOL bSilent;
26 FX_BOOL bShrinkToFit;
27 FX_BOOL bPrintAsImage;
28 FX_BOOL bReverse;
29 FX_BOOL bAnnotations;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070030};
31
Nico Weber9d8ec5a2015-08-04 13:00:21 -070032class CJS_PrintParamsObj : public CJS_Object {
33 public:
Tom Sepez808a99e2015-09-10 12:28:37 -070034 CJS_PrintParamsObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
Lei Zhang2b1a2d52015-08-14 22:16:22 -070035 ~CJS_PrintParamsObj() override {}
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070036
Tom Sepezcd56a7d2015-10-06 11:45:28 -070037 DECLARE_JS_CLASS();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070038};
39
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070040class Icon;
41class Field;
42
Nico Weber9d8ec5a2015-08-04 13:00:21 -070043struct IconElement {
Tom Sepez6ba32d92016-01-05 16:26:32 -080044 IconElement(const CFX_WideString& name, Icon* stream)
45 : IconName(name), IconStream(stream) {}
46
Nico Weber9d8ec5a2015-08-04 13:00:21 -070047 CFX_WideString IconName;
Nico Weber9d8ec5a2015-08-04 13:00:21 -070048 Icon* IconStream;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070049};
50
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070051struct CJS_DelayData;
52struct CJS_DelayAnnot;
53struct CJS_AnnotObj;
54
Nico Weber9d8ec5a2015-08-04 13:00:21 -070055class Document : public CJS_EmbedObj {
56 public:
57 Document(CJS_Object* pJSObject);
Lei Zhang2b1a2d52015-08-14 22:16:22 -070058 ~Document() override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070059
Tom Sepezba038bc2015-10-08 12:03:00 -070060 FX_BOOL ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
61 FX_BOOL author(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
62 FX_BOOL baseURL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
63 FX_BOOL bookmarkRoot(IJS_Context* cc,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070064 CJS_PropValue& vp,
65 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -070066 FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
67 FX_BOOL Collab(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
68 FX_BOOL creationDate(IJS_Context* cc,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070069 CJS_PropValue& vp,
70 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -070071 FX_BOOL creator(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
72 FX_BOOL delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
73 FX_BOOL dirty(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
74 FX_BOOL documentFileName(IJS_Context* cc,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070075 CJS_PropValue& vp,
76 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -070077 FX_BOOL external(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
78 FX_BOOL filesize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
79 FX_BOOL icons(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
80 FX_BOOL info(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
81 FX_BOOL keywords(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
82 FX_BOOL layout(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
83 FX_BOOL media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
84 FX_BOOL modDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
85 FX_BOOL mouseX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
86 FX_BOOL mouseY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
87 FX_BOOL numFields(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
88 FX_BOOL numPages(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
89 FX_BOOL pageNum(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
90 FX_BOOL pageWindowRect(IJS_Context* cc,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070091 CJS_PropValue& vp,
92 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -070093 FX_BOOL path(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
94 FX_BOOL producer(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
95 FX_BOOL subject(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
96 FX_BOOL title(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
97 FX_BOOL zoom(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
98 FX_BOOL zoomType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070099
Tom Sepezba038bc2015-10-08 12:03:00 -0700100 FX_BOOL addAnnot(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800101 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700102 CJS_Value& vRet,
103 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700104 FX_BOOL addField(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800105 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700106 CJS_Value& vRet,
107 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700108 FX_BOOL addLink(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800109 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700110 CJS_Value& vRet,
111 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700112 FX_BOOL addIcon(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800113 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700114 CJS_Value& vRet,
115 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700116 FX_BOOL calculateNow(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800117 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700118 CJS_Value& vRet,
119 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700120 FX_BOOL closeDoc(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800121 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700122 CJS_Value& vRet,
123 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700124 FX_BOOL createDataObject(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800125 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700126 CJS_Value& vRet,
127 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700128 FX_BOOL deletePages(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800129 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700130 CJS_Value& vRet,
131 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700132 FX_BOOL exportAsText(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800133 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700134 CJS_Value& vRet,
135 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700136 FX_BOOL exportAsFDF(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800137 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700138 CJS_Value& vRet,
139 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700140 FX_BOOL exportAsXFDF(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800141 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700142 CJS_Value& vRet,
143 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700144 FX_BOOL extractPages(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800145 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700146 CJS_Value& vRet,
147 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700148 FX_BOOL getAnnot(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800149 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700150 CJS_Value& vRet,
151 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700152 FX_BOOL getAnnots(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800153 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700154 CJS_Value& vRet,
155 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700156 FX_BOOL getAnnot3D(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800157 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700158 CJS_Value& vRet,
159 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700160 FX_BOOL getAnnots3D(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800161 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700162 CJS_Value& vRet,
163 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700164 FX_BOOL getField(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800165 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700166 CJS_Value& vRet,
167 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700168 FX_BOOL getIcon(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800169 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700170 CJS_Value& vRet,
171 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700172 FX_BOOL getLinks(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800173 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700174 CJS_Value& vRet,
175 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700176 FX_BOOL getNthFieldName(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800177 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700178 CJS_Value& vRet,
179 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700180 FX_BOOL getOCGs(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800181 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700182 CJS_Value& vRet,
183 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700184 FX_BOOL getPageBox(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800185 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700186 CJS_Value& vRet,
187 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700188 FX_BOOL getPageNthWord(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800189 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700190 CJS_Value& vRet,
191 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700192 FX_BOOL getPageNthWordQuads(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800193 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700194 CJS_Value& vRet,
195 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700196 FX_BOOL getPageNumWords(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800197 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700198 CJS_Value& vRet,
199 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700200 FX_BOOL getPrintParams(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800201 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700202 CJS_Value& vRet,
203 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700204 FX_BOOL getURL(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800205 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700206 CJS_Value& vRet,
207 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700208 FX_BOOL importAnFDF(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800209 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700210 CJS_Value& vRet,
211 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700212 FX_BOOL importAnXFDF(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800213 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700214 CJS_Value& vRet,
215 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700216 FX_BOOL importTextData(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800217 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700218 CJS_Value& vRet,
219 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700220 FX_BOOL insertPages(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800221 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700222 CJS_Value& vRet,
223 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700224 FX_BOOL mailForm(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800225 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700226 CJS_Value& vRet,
227 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700228 FX_BOOL print(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800229 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700230 CJS_Value& vRet,
231 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700232 FX_BOOL removeField(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800233 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700234 CJS_Value& vRet,
235 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700236 FX_BOOL replacePages(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800237 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700238 CJS_Value& vRet,
239 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700240 FX_BOOL resetForm(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800241 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700242 CJS_Value& vRet,
243 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700244 FX_BOOL saveAs(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800245 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700246 CJS_Value& vRet,
247 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700248 FX_BOOL submitForm(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800249 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700250 CJS_Value& vRet,
251 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700252 FX_BOOL mailDoc(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800253 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700254 CJS_Value& vRet,
255 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700256 FX_BOOL removeIcon(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800257 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700258 CJS_Value& vRet,
259 CFX_WideString& sError);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -0700260
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700261 void AttachDoc(CPDFSDK_Document* pDoc);
262 CPDFSDK_Document* GetReaderDoc();
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700263 void AddDelayData(CJS_DelayData* pData);
264 void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700265 void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
266 CJS_Document* GetCJSDoc() const;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700267
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700268 private:
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700269 bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
270 int CountWords(CPDF_TextObject* pTextObj);
271 CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700272
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700273 v8::Isolate* m_isolate;
Tom Sepez6ba32d92016-01-05 16:26:32 -0800274 std::list<std::unique_ptr<IconElement>> m_IconList;
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700275 CPDFSDK_Document* m_pDocument;
276 CFX_WideString m_cwBaseURL;
277 bool m_bDelay;
278 CFX_ArrayTemplate<CJS_DelayData*> m_DelayData;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700279};
280
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700281class CJS_Document : public CJS_Object {
282 public:
Tom Sepez808a99e2015-09-10 12:28:37 -0700283 explicit CJS_Document(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
Lei Zhang2b1a2d52015-08-14 22:16:22 -0700284 ~CJS_Document() override {}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700285
Lei Zhang2b1a2d52015-08-14 22:16:22 -0700286 // CJS_Object
Tom Sepez33420902015-10-13 15:00:10 -0700287 void InitInstance(IJS_Runtime* pIRuntime) override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700288
Tom Sepezcd56a7d2015-10-06 11:45:28 -0700289 DECLARE_JS_CLASS();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700290
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700291 JS_STATIC_PROP(ADBE, Document);
292 JS_STATIC_PROP(author, Document);
293 JS_STATIC_PROP(baseURL, Document);
294 JS_STATIC_PROP(bookmarkRoot, Document);
295 JS_STATIC_PROP(calculate, Document);
296 JS_STATIC_PROP(Collab, Document);
297 JS_STATIC_PROP(creationDate, Document);
298 JS_STATIC_PROP(creator, Document);
299 JS_STATIC_PROP(delay, Document);
300 JS_STATIC_PROP(dirty, Document);
301 JS_STATIC_PROP(documentFileName, Document);
302 JS_STATIC_PROP(external, Document);
303 JS_STATIC_PROP(filesize, Document);
304 JS_STATIC_PROP(icons, Document);
305 JS_STATIC_PROP(info, Document);
306 JS_STATIC_PROP(keywords, Document);
307 JS_STATIC_PROP(layout, Document);
308 JS_STATIC_PROP(media, Document);
309 JS_STATIC_PROP(modDate, Document);
310 JS_STATIC_PROP(mouseX, Document);
311 JS_STATIC_PROP(mouseY, Document);
312 JS_STATIC_PROP(numFields, Document);
313 JS_STATIC_PROP(numPages, Document);
314 JS_STATIC_PROP(pageNum, Document);
315 JS_STATIC_PROP(pageWindowRect, Document);
316 JS_STATIC_PROP(path, Document);
317 JS_STATIC_PROP(producer, Document);
318 JS_STATIC_PROP(subject, Document);
319 JS_STATIC_PROP(title, Document);
320 JS_STATIC_PROP(zoom, Document);
321 JS_STATIC_PROP(zoomType, Document);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700322
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700323 JS_STATIC_METHOD(addAnnot, Document);
324 JS_STATIC_METHOD(addField, Document);
325 JS_STATIC_METHOD(addLink, Document);
326 JS_STATIC_METHOD(addIcon, Document);
327 JS_STATIC_METHOD(calculateNow, Document);
328 JS_STATIC_METHOD(closeDoc, Document);
329 JS_STATIC_METHOD(createDataObject, Document);
330 JS_STATIC_METHOD(deletePages, Document);
331 JS_STATIC_METHOD(exportAsText, Document);
332 JS_STATIC_METHOD(exportAsFDF, Document);
333 JS_STATIC_METHOD(exportAsXFDF, Document);
334 JS_STATIC_METHOD(extractPages, Document);
335 JS_STATIC_METHOD(getAnnot, Document);
336 JS_STATIC_METHOD(getAnnots, Document);
337 JS_STATIC_METHOD(getAnnot3D, Document);
338 JS_STATIC_METHOD(getAnnots3D, Document);
339 JS_STATIC_METHOD(getField, Document);
340 JS_STATIC_METHOD(getIcon, Document);
341 JS_STATIC_METHOD(getLinks, Document);
342 JS_STATIC_METHOD(getNthFieldName, Document);
343 JS_STATIC_METHOD(getOCGs, Document);
344 JS_STATIC_METHOD(getPageBox, Document);
345 JS_STATIC_METHOD(getPageNthWord, Document);
346 JS_STATIC_METHOD(getPageNthWordQuads, Document);
347 JS_STATIC_METHOD(getPageNumWords, Document);
348 JS_STATIC_METHOD(getPrintParams, Document);
349 JS_STATIC_METHOD(getURL, Document);
350 JS_STATIC_METHOD(importAnFDF, Document);
351 JS_STATIC_METHOD(importAnXFDF, Document);
352 JS_STATIC_METHOD(importTextData, Document);
353 JS_STATIC_METHOD(insertPages, Document);
354 JS_STATIC_METHOD(mailForm, Document);
355 JS_STATIC_METHOD(print, Document);
356 JS_STATIC_METHOD(removeField, Document);
357 JS_STATIC_METHOD(replacePages, Document);
358 JS_STATIC_METHOD(removeIcon, Document);
359 JS_STATIC_METHOD(resetForm, Document);
360 JS_STATIC_METHOD(saveAs, Document);
361 JS_STATIC_METHOD(submitForm, Document);
362 JS_STATIC_METHOD(mailDoc, Document);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700363};
364
Dan Sinclairf766ad22016-03-14 13:51:24 -0400365#endif // FPDFSDK_JAVASCRIPT_DOCUMENT_H_