blob: 3e957a6057bca5fb1bb5c6edba6ba8daa030aab6 [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 Sepez37458412015-10-06 11:33:46 -07007#ifndef FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_
8#define FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07009
Tom Sepez9a3f8122015-04-07 15:35:48 -070010#include "JS_Define.h"
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070011
Nico Weber9d8ec5a2015-08-04 13:00:21 -070012class PrintParamsObj : public CJS_EmbedObj {
13 public:
14 PrintParamsObj(CJS_Object* pJSObject);
Lei Zhang2b1a2d52015-08-14 22:16:22 -070015 ~PrintParamsObj() override {}
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070016
Nico Weber9d8ec5a2015-08-04 13:00:21 -070017 public:
18 FX_BOOL bUI;
19 int nStart;
20 int nEnd;
21 FX_BOOL bSilent;
22 FX_BOOL bShrinkToFit;
23 FX_BOOL bPrintAsImage;
24 FX_BOOL bReverse;
25 FX_BOOL bAnnotations;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070026};
27
Nico Weber9d8ec5a2015-08-04 13:00:21 -070028class CJS_PrintParamsObj : public CJS_Object {
29 public:
Tom Sepez808a99e2015-09-10 12:28:37 -070030 CJS_PrintParamsObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
Lei Zhang2b1a2d52015-08-14 22:16:22 -070031 ~CJS_PrintParamsObj() override {}
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070032
Tom Sepezcd56a7d2015-10-06 11:45:28 -070033 DECLARE_JS_CLASS();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070034};
35
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070036class Icon;
37class Field;
38
Nico Weber9d8ec5a2015-08-04 13:00:21 -070039struct IconElement {
40 IconElement() : IconName(L""), NextIcon(NULL), IconStream(NULL) {}
41 virtual ~IconElement() {}
42 CFX_WideString IconName;
43 IconElement* NextIcon;
44 Icon* IconStream;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070045};
46
Nico Weber9d8ec5a2015-08-04 13:00:21 -070047class IconTree {
48 public:
49 IconTree() : m_pHead(NULL), m_pEnd(NULL), m_iLength(0) {}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070050
Nico Weber9d8ec5a2015-08-04 13:00:21 -070051 virtual ~IconTree() {}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070052
Nico Weber9d8ec5a2015-08-04 13:00:21 -070053 public:
54 void InsertIconElement(IconElement* pNewIcon);
Nico Weber9d8ec5a2015-08-04 13:00:21 -070055 void DeleteIconTree();
56 int GetLength();
57 IconElement* operator[](int iIndex);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070058
Nico Weber9d8ec5a2015-08-04 13:00:21 -070059 private:
60 IconElement* m_pHead;
61 IconElement* m_pEnd;
62 int m_iLength;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070063};
64
65struct CJS_DelayData;
66struct CJS_DelayAnnot;
67struct CJS_AnnotObj;
68
Nico Weber9d8ec5a2015-08-04 13:00:21 -070069class Document : public CJS_EmbedObj {
70 public:
71 Document(CJS_Object* pJSObject);
Lei Zhang2b1a2d52015-08-14 22:16:22 -070072 ~Document() override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070073
Nico Weber9d8ec5a2015-08-04 13:00:21 -070074 public:
Tom Sepezba038bc2015-10-08 12:03:00 -070075 FX_BOOL ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
76 FX_BOOL author(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
77 FX_BOOL baseURL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
78 FX_BOOL bookmarkRoot(IJS_Context* cc,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070079 CJS_PropValue& vp,
80 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -070081 FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
82 FX_BOOL Collab(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
83 FX_BOOL creationDate(IJS_Context* cc,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070084 CJS_PropValue& vp,
85 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -070086 FX_BOOL creator(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
87 FX_BOOL delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
88 FX_BOOL dirty(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
89 FX_BOOL documentFileName(IJS_Context* cc,
Nico Weber9d8ec5a2015-08-04 13:00:21 -070090 CJS_PropValue& vp,
91 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -070092 FX_BOOL external(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
93 FX_BOOL filesize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
94 FX_BOOL icons(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
95 FX_BOOL info(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
96 FX_BOOL keywords(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
97 FX_BOOL layout(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
98 FX_BOOL media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
99 FX_BOOL modDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
100 FX_BOOL mouseX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
101 FX_BOOL mouseY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
102 FX_BOOL numFields(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
103 FX_BOOL numPages(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
104 FX_BOOL pageNum(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
105 FX_BOOL pageWindowRect(IJS_Context* cc,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700106 CJS_PropValue& vp,
107 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700108 FX_BOOL path(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
109 FX_BOOL producer(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
110 FX_BOOL subject(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
111 FX_BOOL title(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
112 FX_BOOL zoom(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
113 FX_BOOL zoomType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700114
Tom Sepezba038bc2015-10-08 12:03:00 -0700115 FX_BOOL addAnnot(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800116 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700117 CJS_Value& vRet,
118 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700119 FX_BOOL addField(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800120 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700121 CJS_Value& vRet,
122 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700123 FX_BOOL addLink(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800124 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700125 CJS_Value& vRet,
126 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700127 FX_BOOL addIcon(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800128 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700129 CJS_Value& vRet,
130 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700131 FX_BOOL calculateNow(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800132 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700133 CJS_Value& vRet,
134 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700135 FX_BOOL closeDoc(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800136 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700137 CJS_Value& vRet,
138 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700139 FX_BOOL createDataObject(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800140 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700141 CJS_Value& vRet,
142 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700143 FX_BOOL deletePages(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800144 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700145 CJS_Value& vRet,
146 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700147 FX_BOOL exportAsText(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800148 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700149 CJS_Value& vRet,
150 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700151 FX_BOOL exportAsFDF(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800152 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700153 CJS_Value& vRet,
154 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700155 FX_BOOL exportAsXFDF(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800156 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700157 CJS_Value& vRet,
158 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700159 FX_BOOL extractPages(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800160 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700161 CJS_Value& vRet,
162 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700163 FX_BOOL getAnnot(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800164 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700165 CJS_Value& vRet,
166 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700167 FX_BOOL getAnnots(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800168 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700169 CJS_Value& vRet,
170 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700171 FX_BOOL getAnnot3D(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800172 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700173 CJS_Value& vRet,
174 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700175 FX_BOOL getAnnots3D(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800176 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700177 CJS_Value& vRet,
178 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700179 FX_BOOL getField(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800180 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700181 CJS_Value& vRet,
182 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700183 FX_BOOL getIcon(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800184 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700185 CJS_Value& vRet,
186 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700187 FX_BOOL getLinks(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800188 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700189 CJS_Value& vRet,
190 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700191 FX_BOOL getNthFieldName(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800192 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700193 CJS_Value& vRet,
194 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700195 FX_BOOL getOCGs(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800196 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700197 CJS_Value& vRet,
198 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700199 FX_BOOL getPageBox(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800200 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700201 CJS_Value& vRet,
202 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700203 FX_BOOL getPageNthWord(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800204 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700205 CJS_Value& vRet,
206 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700207 FX_BOOL getPageNthWordQuads(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800208 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700209 CJS_Value& vRet,
210 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700211 FX_BOOL getPageNumWords(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800212 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700213 CJS_Value& vRet,
214 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700215 FX_BOOL getPrintParams(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800216 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700217 CJS_Value& vRet,
218 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700219 FX_BOOL getURL(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800220 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700221 CJS_Value& vRet,
222 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700223 FX_BOOL importAnFDF(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800224 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700225 CJS_Value& vRet,
226 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700227 FX_BOOL importAnXFDF(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800228 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700229 CJS_Value& vRet,
230 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700231 FX_BOOL importTextData(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800232 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700233 CJS_Value& vRet,
234 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700235 FX_BOOL insertPages(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800236 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700237 CJS_Value& vRet,
238 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700239 FX_BOOL mailForm(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800240 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700241 CJS_Value& vRet,
242 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700243 FX_BOOL print(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800244 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700245 CJS_Value& vRet,
246 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700247 FX_BOOL removeField(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800248 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700249 CJS_Value& vRet,
250 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700251 FX_BOOL replacePages(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800252 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700253 CJS_Value& vRet,
254 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700255 FX_BOOL resetForm(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800256 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700257 CJS_Value& vRet,
258 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700259 FX_BOOL saveAs(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800260 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700261 CJS_Value& vRet,
262 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700263 FX_BOOL submitForm(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800264 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700265 CJS_Value& vRet,
266 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700267 FX_BOOL mailDoc(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800268 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700269 CJS_Value& vRet,
270 CFX_WideString& sError);
Tom Sepezba038bc2015-10-08 12:03:00 -0700271 FX_BOOL removeIcon(IJS_Context* cc,
Lei Zhang945fdb72015-11-11 10:18:16 -0800272 const std::vector<CJS_Value>& params,
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700273 CJS_Value& vRet,
274 CFX_WideString& sError);
Lei Zhanga6d9f0e2015-06-13 00:48:38 -0700275
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700276 public:
277 void AttachDoc(CPDFSDK_Document* pDoc);
278 CPDFSDK_Document* GetReaderDoc();
279 static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc,
280 CFX_ByteString& strFileName);
281 static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc,
282 CFX_ByteString& strFolderName);
283 void AddDelayData(CJS_DelayData* pData);
284 void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
285 void AddDelayAnnotData(CJS_AnnotObj* pData);
286 void DoAnnotDelay();
287 void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
288 CJS_Document* GetCJSDoc() const;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700289
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700290 private:
291 CFX_WideString ReversalStr(CFX_WideString cbFrom);
292 CFX_WideString CutString(CFX_WideString cbFrom);
293 bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
294 int CountWords(CPDF_TextObject* pTextObj);
295 CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700296
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700297 v8::Isolate* m_isolate;
298 IconTree* m_pIconTree;
299 CPDFSDK_Document* m_pDocument;
300 CFX_WideString m_cwBaseURL;
301 bool m_bDelay;
302 CFX_ArrayTemplate<CJS_DelayData*> m_DelayData;
303 CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700304};
305
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700306class CJS_Document : public CJS_Object {
307 public:
Tom Sepez808a99e2015-09-10 12:28:37 -0700308 explicit CJS_Document(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
Lei Zhang2b1a2d52015-08-14 22:16:22 -0700309 ~CJS_Document() override {}
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700310
Lei Zhang2b1a2d52015-08-14 22:16:22 -0700311 // CJS_Object
Tom Sepez33420902015-10-13 15:00:10 -0700312 void InitInstance(IJS_Runtime* pIRuntime) override;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700313
Tom Sepezcd56a7d2015-10-06 11:45:28 -0700314 DECLARE_JS_CLASS();
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700315
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700316 JS_STATIC_PROP(ADBE, Document);
317 JS_STATIC_PROP(author, Document);
318 JS_STATIC_PROP(baseURL, Document);
319 JS_STATIC_PROP(bookmarkRoot, Document);
320 JS_STATIC_PROP(calculate, Document);
321 JS_STATIC_PROP(Collab, Document);
322 JS_STATIC_PROP(creationDate, Document);
323 JS_STATIC_PROP(creator, Document);
324 JS_STATIC_PROP(delay, Document);
325 JS_STATIC_PROP(dirty, Document);
326 JS_STATIC_PROP(documentFileName, Document);
327 JS_STATIC_PROP(external, Document);
328 JS_STATIC_PROP(filesize, Document);
329 JS_STATIC_PROP(icons, Document);
330 JS_STATIC_PROP(info, Document);
331 JS_STATIC_PROP(keywords, Document);
332 JS_STATIC_PROP(layout, Document);
333 JS_STATIC_PROP(media, Document);
334 JS_STATIC_PROP(modDate, Document);
335 JS_STATIC_PROP(mouseX, Document);
336 JS_STATIC_PROP(mouseY, Document);
337 JS_STATIC_PROP(numFields, Document);
338 JS_STATIC_PROP(numPages, Document);
339 JS_STATIC_PROP(pageNum, Document);
340 JS_STATIC_PROP(pageWindowRect, Document);
341 JS_STATIC_PROP(path, Document);
342 JS_STATIC_PROP(producer, Document);
343 JS_STATIC_PROP(subject, Document);
344 JS_STATIC_PROP(title, Document);
345 JS_STATIC_PROP(zoom, Document);
346 JS_STATIC_PROP(zoomType, Document);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700347
Nico Weber9d8ec5a2015-08-04 13:00:21 -0700348 JS_STATIC_METHOD(addAnnot, Document);
349 JS_STATIC_METHOD(addField, Document);
350 JS_STATIC_METHOD(addLink, Document);
351 JS_STATIC_METHOD(addIcon, Document);
352 JS_STATIC_METHOD(calculateNow, Document);
353 JS_STATIC_METHOD(closeDoc, Document);
354 JS_STATIC_METHOD(createDataObject, Document);
355 JS_STATIC_METHOD(deletePages, Document);
356 JS_STATIC_METHOD(exportAsText, Document);
357 JS_STATIC_METHOD(exportAsFDF, Document);
358 JS_STATIC_METHOD(exportAsXFDF, Document);
359 JS_STATIC_METHOD(extractPages, Document);
360 JS_STATIC_METHOD(getAnnot, Document);
361 JS_STATIC_METHOD(getAnnots, Document);
362 JS_STATIC_METHOD(getAnnot3D, Document);
363 JS_STATIC_METHOD(getAnnots3D, Document);
364 JS_STATIC_METHOD(getField, Document);
365 JS_STATIC_METHOD(getIcon, Document);
366 JS_STATIC_METHOD(getLinks, Document);
367 JS_STATIC_METHOD(getNthFieldName, Document);
368 JS_STATIC_METHOD(getOCGs, Document);
369 JS_STATIC_METHOD(getPageBox, Document);
370 JS_STATIC_METHOD(getPageNthWord, Document);
371 JS_STATIC_METHOD(getPageNthWordQuads, Document);
372 JS_STATIC_METHOD(getPageNumWords, Document);
373 JS_STATIC_METHOD(getPrintParams, Document);
374 JS_STATIC_METHOD(getURL, Document);
375 JS_STATIC_METHOD(importAnFDF, Document);
376 JS_STATIC_METHOD(importAnXFDF, Document);
377 JS_STATIC_METHOD(importTextData, Document);
378 JS_STATIC_METHOD(insertPages, Document);
379 JS_STATIC_METHOD(mailForm, Document);
380 JS_STATIC_METHOD(print, Document);
381 JS_STATIC_METHOD(removeField, Document);
382 JS_STATIC_METHOD(replacePages, Document);
383 JS_STATIC_METHOD(removeIcon, Document);
384 JS_STATIC_METHOD(resetForm, Document);
385 JS_STATIC_METHOD(saveAs, Document);
386 JS_STATIC_METHOD(submitForm, Document);
387 JS_STATIC_METHOD(mailDoc, Document);
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -0700388};
389
Tom Sepez37458412015-10-06 11:33:46 -0700390#endif // FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_