John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 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. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | f766ad2 | 2016-03-14 13:51:24 -0400 | [diff] [blame^] | 7 | #ifndef FPDFSDK_JAVASCRIPT_DOCUMENT_H_ |
| 8 | #define FPDFSDK_JAVASCRIPT_DOCUMENT_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
Tom Sepez | 6ba32d9 | 2016-01-05 16:26:32 -0800 | [diff] [blame] | 10 | #include <list> |
| 11 | #include <memory> |
Dan Sinclair | 3ebd121 | 2016-03-09 09:59:23 -0500 | [diff] [blame] | 12 | #include <vector> |
Tom Sepez | 6ba32d9 | 2016-01-05 16:26:32 -0800 | [diff] [blame] | 13 | |
Dan Sinclair | f766ad2 | 2016-03-14 13:51:24 -0400 | [diff] [blame^] | 14 | #include "fpdfsdk/javascript/JS_Define.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 15 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 16 | class PrintParamsObj : public CJS_EmbedObj { |
| 17 | public: |
| 18 | PrintParamsObj(CJS_Object* pJSObject); |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 19 | ~PrintParamsObj() override {} |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 20 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 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; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 30 | }; |
| 31 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 32 | class CJS_PrintParamsObj : public CJS_Object { |
| 33 | public: |
Tom Sepez | 808a99e | 2015-09-10 12:28:37 -0700 | [diff] [blame] | 34 | CJS_PrintParamsObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 35 | ~CJS_PrintParamsObj() override {} |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 36 | |
Tom Sepez | cd56a7d | 2015-10-06 11:45:28 -0700 | [diff] [blame] | 37 | DECLARE_JS_CLASS(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 38 | }; |
| 39 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 40 | class Icon; |
| 41 | class Field; |
| 42 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 43 | struct IconElement { |
Tom Sepez | 6ba32d9 | 2016-01-05 16:26:32 -0800 | [diff] [blame] | 44 | IconElement(const CFX_WideString& name, Icon* stream) |
| 45 | : IconName(name), IconStream(stream) {} |
| 46 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 47 | CFX_WideString IconName; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 48 | Icon* IconStream; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 51 | struct CJS_DelayData; |
| 52 | struct CJS_DelayAnnot; |
| 53 | struct CJS_AnnotObj; |
| 54 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 55 | class Document : public CJS_EmbedObj { |
| 56 | public: |
| 57 | Document(CJS_Object* pJSObject); |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 58 | ~Document() override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 59 | |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 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, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 64 | CJS_PropValue& vp, |
| 65 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 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, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 69 | CJS_PropValue& vp, |
| 70 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 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, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 75 | CJS_PropValue& vp, |
| 76 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 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, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 91 | CJS_PropValue& vp, |
| 92 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 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); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 99 | |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 100 | FX_BOOL addAnnot(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 101 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 102 | CJS_Value& vRet, |
| 103 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 104 | FX_BOOL addField(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 105 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 106 | CJS_Value& vRet, |
| 107 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 108 | FX_BOOL addLink(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 109 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 110 | CJS_Value& vRet, |
| 111 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 112 | FX_BOOL addIcon(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 113 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 114 | CJS_Value& vRet, |
| 115 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 116 | FX_BOOL calculateNow(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 117 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 118 | CJS_Value& vRet, |
| 119 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 120 | FX_BOOL closeDoc(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 121 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 122 | CJS_Value& vRet, |
| 123 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 124 | FX_BOOL createDataObject(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 125 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 126 | CJS_Value& vRet, |
| 127 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 128 | FX_BOOL deletePages(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 129 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 130 | CJS_Value& vRet, |
| 131 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 132 | FX_BOOL exportAsText(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 133 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 134 | CJS_Value& vRet, |
| 135 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 136 | FX_BOOL exportAsFDF(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 137 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 138 | CJS_Value& vRet, |
| 139 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 140 | FX_BOOL exportAsXFDF(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 141 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 142 | CJS_Value& vRet, |
| 143 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 144 | FX_BOOL extractPages(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 145 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 146 | CJS_Value& vRet, |
| 147 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 148 | FX_BOOL getAnnot(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 149 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 150 | CJS_Value& vRet, |
| 151 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 152 | FX_BOOL getAnnots(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 153 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 154 | CJS_Value& vRet, |
| 155 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 156 | FX_BOOL getAnnot3D(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 157 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 158 | CJS_Value& vRet, |
| 159 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 160 | FX_BOOL getAnnots3D(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 161 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 162 | CJS_Value& vRet, |
| 163 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 164 | FX_BOOL getField(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 165 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 166 | CJS_Value& vRet, |
| 167 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 168 | FX_BOOL getIcon(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 169 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 170 | CJS_Value& vRet, |
| 171 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 172 | FX_BOOL getLinks(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 173 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 174 | CJS_Value& vRet, |
| 175 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 176 | FX_BOOL getNthFieldName(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 177 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 178 | CJS_Value& vRet, |
| 179 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 180 | FX_BOOL getOCGs(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 181 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 182 | CJS_Value& vRet, |
| 183 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 184 | FX_BOOL getPageBox(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 185 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 186 | CJS_Value& vRet, |
| 187 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 188 | FX_BOOL getPageNthWord(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 189 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 190 | CJS_Value& vRet, |
| 191 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 192 | FX_BOOL getPageNthWordQuads(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 193 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 194 | CJS_Value& vRet, |
| 195 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 196 | FX_BOOL getPageNumWords(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 197 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 198 | CJS_Value& vRet, |
| 199 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 200 | FX_BOOL getPrintParams(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 201 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 202 | CJS_Value& vRet, |
| 203 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 204 | FX_BOOL getURL(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 205 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 206 | CJS_Value& vRet, |
| 207 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 208 | FX_BOOL importAnFDF(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 209 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 210 | CJS_Value& vRet, |
| 211 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 212 | FX_BOOL importAnXFDF(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 213 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 214 | CJS_Value& vRet, |
| 215 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 216 | FX_BOOL importTextData(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 217 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 218 | CJS_Value& vRet, |
| 219 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 220 | FX_BOOL insertPages(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 221 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 222 | CJS_Value& vRet, |
| 223 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 224 | FX_BOOL mailForm(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 225 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 226 | CJS_Value& vRet, |
| 227 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 228 | FX_BOOL print(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 229 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 230 | CJS_Value& vRet, |
| 231 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 232 | FX_BOOL removeField(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 233 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 234 | CJS_Value& vRet, |
| 235 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 236 | FX_BOOL replacePages(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 237 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 238 | CJS_Value& vRet, |
| 239 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 240 | FX_BOOL resetForm(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 241 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 242 | CJS_Value& vRet, |
| 243 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 244 | FX_BOOL saveAs(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 245 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 246 | CJS_Value& vRet, |
| 247 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 248 | FX_BOOL submitForm(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 249 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 250 | CJS_Value& vRet, |
| 251 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 252 | FX_BOOL mailDoc(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 253 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 254 | CJS_Value& vRet, |
| 255 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 256 | FX_BOOL removeIcon(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame] | 257 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 258 | CJS_Value& vRet, |
| 259 | CFX_WideString& sError); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 260 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 261 | void AttachDoc(CPDFSDK_Document* pDoc); |
| 262 | CPDFSDK_Document* GetReaderDoc(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 263 | void AddDelayData(CJS_DelayData* pData); |
| 264 | void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 265 | void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; } |
| 266 | CJS_Document* GetCJSDoc() const; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 267 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 268 | private: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 269 | 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 272 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 273 | v8::Isolate* m_isolate; |
Tom Sepez | 6ba32d9 | 2016-01-05 16:26:32 -0800 | [diff] [blame] | 274 | std::list<std::unique_ptr<IconElement>> m_IconList; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 275 | CPDFSDK_Document* m_pDocument; |
| 276 | CFX_WideString m_cwBaseURL; |
| 277 | bool m_bDelay; |
| 278 | CFX_ArrayTemplate<CJS_DelayData*> m_DelayData; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 279 | }; |
| 280 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 281 | class CJS_Document : public CJS_Object { |
| 282 | public: |
Tom Sepez | 808a99e | 2015-09-10 12:28:37 -0700 | [diff] [blame] | 283 | explicit CJS_Document(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 284 | ~CJS_Document() override {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 285 | |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 286 | // CJS_Object |
Tom Sepez | 3342090 | 2015-10-13 15:00:10 -0700 | [diff] [blame] | 287 | void InitInstance(IJS_Runtime* pIRuntime) override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 288 | |
Tom Sepez | cd56a7d | 2015-10-06 11:45:28 -0700 | [diff] [blame] | 289 | DECLARE_JS_CLASS(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 290 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 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); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 322 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 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); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 363 | }; |
| 364 | |
Dan Sinclair | f766ad2 | 2016-03-14 13:51:24 -0400 | [diff] [blame^] | 365 | #endif // FPDFSDK_JAVASCRIPT_DOCUMENT_H_ |