Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: fpdfsdk/src/javascript/Document.h

Issue 1799773002: Move fpdfsdk/src up to fpdfsdk/. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/javascript/Consts.cpp ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // 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.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_
8 #define FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_
9
10 #include <list>
11 #include <memory>
12 #include <vector>
13
14 #include "fpdfsdk/src/javascript/JS_Define.h"
15
16 class PrintParamsObj : public CJS_EmbedObj {
17 public:
18 PrintParamsObj(CJS_Object* pJSObject);
19 ~PrintParamsObj() override {}
20
21 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;
30 };
31
32 class CJS_PrintParamsObj : public CJS_Object {
33 public:
34 CJS_PrintParamsObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
35 ~CJS_PrintParamsObj() override {}
36
37 DECLARE_JS_CLASS();
38 };
39
40 class Icon;
41 class Field;
42
43 struct IconElement {
44 IconElement(const CFX_WideString& name, Icon* stream)
45 : IconName(name), IconStream(stream) {}
46
47 CFX_WideString IconName;
48 Icon* IconStream;
49 };
50
51 struct CJS_DelayData;
52 struct CJS_DelayAnnot;
53 struct CJS_AnnotObj;
54
55 class Document : public CJS_EmbedObj {
56 public:
57 Document(CJS_Object* pJSObject);
58 ~Document() override;
59
60 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,
64 CJS_PropValue& vp,
65 CFX_WideString& sError);
66 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,
69 CJS_PropValue& vp,
70 CFX_WideString& sError);
71 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,
75 CJS_PropValue& vp,
76 CFX_WideString& sError);
77 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,
91 CJS_PropValue& vp,
92 CFX_WideString& sError);
93 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);
99
100 FX_BOOL addAnnot(IJS_Context* cc,
101 const std::vector<CJS_Value>& params,
102 CJS_Value& vRet,
103 CFX_WideString& sError);
104 FX_BOOL addField(IJS_Context* cc,
105 const std::vector<CJS_Value>& params,
106 CJS_Value& vRet,
107 CFX_WideString& sError);
108 FX_BOOL addLink(IJS_Context* cc,
109 const std::vector<CJS_Value>& params,
110 CJS_Value& vRet,
111 CFX_WideString& sError);
112 FX_BOOL addIcon(IJS_Context* cc,
113 const std::vector<CJS_Value>& params,
114 CJS_Value& vRet,
115 CFX_WideString& sError);
116 FX_BOOL calculateNow(IJS_Context* cc,
117 const std::vector<CJS_Value>& params,
118 CJS_Value& vRet,
119 CFX_WideString& sError);
120 FX_BOOL closeDoc(IJS_Context* cc,
121 const std::vector<CJS_Value>& params,
122 CJS_Value& vRet,
123 CFX_WideString& sError);
124 FX_BOOL createDataObject(IJS_Context* cc,
125 const std::vector<CJS_Value>& params,
126 CJS_Value& vRet,
127 CFX_WideString& sError);
128 FX_BOOL deletePages(IJS_Context* cc,
129 const std::vector<CJS_Value>& params,
130 CJS_Value& vRet,
131 CFX_WideString& sError);
132 FX_BOOL exportAsText(IJS_Context* cc,
133 const std::vector<CJS_Value>& params,
134 CJS_Value& vRet,
135 CFX_WideString& sError);
136 FX_BOOL exportAsFDF(IJS_Context* cc,
137 const std::vector<CJS_Value>& params,
138 CJS_Value& vRet,
139 CFX_WideString& sError);
140 FX_BOOL exportAsXFDF(IJS_Context* cc,
141 const std::vector<CJS_Value>& params,
142 CJS_Value& vRet,
143 CFX_WideString& sError);
144 FX_BOOL extractPages(IJS_Context* cc,
145 const std::vector<CJS_Value>& params,
146 CJS_Value& vRet,
147 CFX_WideString& sError);
148 FX_BOOL getAnnot(IJS_Context* cc,
149 const std::vector<CJS_Value>& params,
150 CJS_Value& vRet,
151 CFX_WideString& sError);
152 FX_BOOL getAnnots(IJS_Context* cc,
153 const std::vector<CJS_Value>& params,
154 CJS_Value& vRet,
155 CFX_WideString& sError);
156 FX_BOOL getAnnot3D(IJS_Context* cc,
157 const std::vector<CJS_Value>& params,
158 CJS_Value& vRet,
159 CFX_WideString& sError);
160 FX_BOOL getAnnots3D(IJS_Context* cc,
161 const std::vector<CJS_Value>& params,
162 CJS_Value& vRet,
163 CFX_WideString& sError);
164 FX_BOOL getField(IJS_Context* cc,
165 const std::vector<CJS_Value>& params,
166 CJS_Value& vRet,
167 CFX_WideString& sError);
168 FX_BOOL getIcon(IJS_Context* cc,
169 const std::vector<CJS_Value>& params,
170 CJS_Value& vRet,
171 CFX_WideString& sError);
172 FX_BOOL getLinks(IJS_Context* cc,
173 const std::vector<CJS_Value>& params,
174 CJS_Value& vRet,
175 CFX_WideString& sError);
176 FX_BOOL getNthFieldName(IJS_Context* cc,
177 const std::vector<CJS_Value>& params,
178 CJS_Value& vRet,
179 CFX_WideString& sError);
180 FX_BOOL getOCGs(IJS_Context* cc,
181 const std::vector<CJS_Value>& params,
182 CJS_Value& vRet,
183 CFX_WideString& sError);
184 FX_BOOL getPageBox(IJS_Context* cc,
185 const std::vector<CJS_Value>& params,
186 CJS_Value& vRet,
187 CFX_WideString& sError);
188 FX_BOOL getPageNthWord(IJS_Context* cc,
189 const std::vector<CJS_Value>& params,
190 CJS_Value& vRet,
191 CFX_WideString& sError);
192 FX_BOOL getPageNthWordQuads(IJS_Context* cc,
193 const std::vector<CJS_Value>& params,
194 CJS_Value& vRet,
195 CFX_WideString& sError);
196 FX_BOOL getPageNumWords(IJS_Context* cc,
197 const std::vector<CJS_Value>& params,
198 CJS_Value& vRet,
199 CFX_WideString& sError);
200 FX_BOOL getPrintParams(IJS_Context* cc,
201 const std::vector<CJS_Value>& params,
202 CJS_Value& vRet,
203 CFX_WideString& sError);
204 FX_BOOL getURL(IJS_Context* cc,
205 const std::vector<CJS_Value>& params,
206 CJS_Value& vRet,
207 CFX_WideString& sError);
208 FX_BOOL importAnFDF(IJS_Context* cc,
209 const std::vector<CJS_Value>& params,
210 CJS_Value& vRet,
211 CFX_WideString& sError);
212 FX_BOOL importAnXFDF(IJS_Context* cc,
213 const std::vector<CJS_Value>& params,
214 CJS_Value& vRet,
215 CFX_WideString& sError);
216 FX_BOOL importTextData(IJS_Context* cc,
217 const std::vector<CJS_Value>& params,
218 CJS_Value& vRet,
219 CFX_WideString& sError);
220 FX_BOOL insertPages(IJS_Context* cc,
221 const std::vector<CJS_Value>& params,
222 CJS_Value& vRet,
223 CFX_WideString& sError);
224 FX_BOOL mailForm(IJS_Context* cc,
225 const std::vector<CJS_Value>& params,
226 CJS_Value& vRet,
227 CFX_WideString& sError);
228 FX_BOOL print(IJS_Context* cc,
229 const std::vector<CJS_Value>& params,
230 CJS_Value& vRet,
231 CFX_WideString& sError);
232 FX_BOOL removeField(IJS_Context* cc,
233 const std::vector<CJS_Value>& params,
234 CJS_Value& vRet,
235 CFX_WideString& sError);
236 FX_BOOL replacePages(IJS_Context* cc,
237 const std::vector<CJS_Value>& params,
238 CJS_Value& vRet,
239 CFX_WideString& sError);
240 FX_BOOL resetForm(IJS_Context* cc,
241 const std::vector<CJS_Value>& params,
242 CJS_Value& vRet,
243 CFX_WideString& sError);
244 FX_BOOL saveAs(IJS_Context* cc,
245 const std::vector<CJS_Value>& params,
246 CJS_Value& vRet,
247 CFX_WideString& sError);
248 FX_BOOL submitForm(IJS_Context* cc,
249 const std::vector<CJS_Value>& params,
250 CJS_Value& vRet,
251 CFX_WideString& sError);
252 FX_BOOL mailDoc(IJS_Context* cc,
253 const std::vector<CJS_Value>& params,
254 CJS_Value& vRet,
255 CFX_WideString& sError);
256 FX_BOOL removeIcon(IJS_Context* cc,
257 const std::vector<CJS_Value>& params,
258 CJS_Value& vRet,
259 CFX_WideString& sError);
260
261 void AttachDoc(CPDFSDK_Document* pDoc);
262 CPDFSDK_Document* GetReaderDoc();
263 void AddDelayData(CJS_DelayData* pData);
264 void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
265 void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
266 CJS_Document* GetCJSDoc() const;
267
268 private:
269 bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
270 int CountWords(CPDF_TextObject* pTextObj);
271 CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
272
273 v8::Isolate* m_isolate;
274 std::list<std::unique_ptr<IconElement>> m_IconList;
275 CPDFSDK_Document* m_pDocument;
276 CFX_WideString m_cwBaseURL;
277 bool m_bDelay;
278 CFX_ArrayTemplate<CJS_DelayData*> m_DelayData;
279 };
280
281 class CJS_Document : public CJS_Object {
282 public:
283 explicit CJS_Document(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {}
284 ~CJS_Document() override {}
285
286 // CJS_Object
287 void InitInstance(IJS_Runtime* pIRuntime) override;
288
289 DECLARE_JS_CLASS();
290
291 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);
322
323 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);
363 };
364
365 #endif // FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/Consts.cpp ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698