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 | |
Tom Sepez | 3745841 | 2015-10-06 11:33:46 -0700 | [diff] [blame] | 7 | #ifndef FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_ |
| 8 | #define FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_ |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 9 | |
Tom Sepez | 9a3f812 | 2015-04-07 15:35:48 -0700 | [diff] [blame] | 10 | #include "JS_Define.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 11 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 12 | class PrintParamsObj : public CJS_EmbedObj { |
| 13 | public: |
| 14 | PrintParamsObj(CJS_Object* pJSObject); |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 15 | ~PrintParamsObj() override {} |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 16 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 17 | 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 28 | class CJS_PrintParamsObj : public CJS_Object { |
| 29 | public: |
Tom Sepez | 808a99e | 2015-09-10 12:28:37 -0700 | [diff] [blame] | 30 | CJS_PrintParamsObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 31 | ~CJS_PrintParamsObj() override {} |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 32 | |
Tom Sepez | cd56a7d | 2015-10-06 11:45:28 -0700 | [diff] [blame] | 33 | DECLARE_JS_CLASS(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 34 | }; |
| 35 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 36 | class Icon; |
| 37 | class Field; |
| 38 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 39 | struct 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 47 | class IconTree { |
| 48 | public: |
| 49 | IconTree() : m_pHead(NULL), m_pEnd(NULL), m_iLength(0) {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 50 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 51 | virtual ~IconTree() {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 52 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 53 | public: |
| 54 | void InsertIconElement(IconElement* pNewIcon); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 55 | void DeleteIconTree(); |
| 56 | int GetLength(); |
| 57 | IconElement* operator[](int iIndex); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 58 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 59 | private: |
| 60 | IconElement* m_pHead; |
| 61 | IconElement* m_pEnd; |
| 62 | int m_iLength; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | struct CJS_DelayData; |
| 66 | struct CJS_DelayAnnot; |
| 67 | struct CJS_AnnotObj; |
| 68 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 69 | class Document : public CJS_EmbedObj { |
| 70 | public: |
| 71 | Document(CJS_Object* pJSObject); |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 72 | ~Document() override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 73 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 74 | public: |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 75 | 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 Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 79 | CJS_PropValue& vp, |
| 80 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 81 | 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 Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 84 | CJS_PropValue& vp, |
| 85 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 86 | 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 Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 90 | CJS_PropValue& vp, |
| 91 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 92 | 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 Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 106 | CJS_PropValue& vp, |
| 107 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 108 | 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 114 | |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 115 | FX_BOOL addAnnot(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 116 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 117 | CJS_Value& vRet, |
| 118 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 119 | FX_BOOL addField(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 120 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 121 | CJS_Value& vRet, |
| 122 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 123 | FX_BOOL addLink(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 124 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 125 | CJS_Value& vRet, |
| 126 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 127 | FX_BOOL addIcon(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 128 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 129 | CJS_Value& vRet, |
| 130 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 131 | FX_BOOL calculateNow(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 132 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 133 | CJS_Value& vRet, |
| 134 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 135 | FX_BOOL closeDoc(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 136 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 137 | CJS_Value& vRet, |
| 138 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 139 | FX_BOOL createDataObject(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 140 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 141 | CJS_Value& vRet, |
| 142 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 143 | FX_BOOL deletePages(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 144 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 145 | CJS_Value& vRet, |
| 146 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 147 | FX_BOOL exportAsText(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 148 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 149 | CJS_Value& vRet, |
| 150 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 151 | FX_BOOL exportAsFDF(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 152 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 153 | CJS_Value& vRet, |
| 154 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 155 | FX_BOOL exportAsXFDF(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 156 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 157 | CJS_Value& vRet, |
| 158 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 159 | FX_BOOL extractPages(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 160 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 161 | CJS_Value& vRet, |
| 162 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 163 | FX_BOOL getAnnot(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 164 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 165 | CJS_Value& vRet, |
| 166 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 167 | FX_BOOL getAnnots(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 168 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 169 | CJS_Value& vRet, |
| 170 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 171 | FX_BOOL getAnnot3D(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 172 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 173 | CJS_Value& vRet, |
| 174 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 175 | FX_BOOL getAnnots3D(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 176 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 177 | CJS_Value& vRet, |
| 178 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 179 | FX_BOOL getField(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 180 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 181 | CJS_Value& vRet, |
| 182 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 183 | FX_BOOL getIcon(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 184 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 185 | CJS_Value& vRet, |
| 186 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 187 | FX_BOOL getLinks(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 188 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 189 | CJS_Value& vRet, |
| 190 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 191 | FX_BOOL getNthFieldName(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 192 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 193 | CJS_Value& vRet, |
| 194 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 195 | FX_BOOL getOCGs(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 196 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 197 | CJS_Value& vRet, |
| 198 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 199 | FX_BOOL getPageBox(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 200 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 201 | CJS_Value& vRet, |
| 202 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 203 | FX_BOOL getPageNthWord(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 204 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 205 | CJS_Value& vRet, |
| 206 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 207 | FX_BOOL getPageNthWordQuads(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 208 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 209 | CJS_Value& vRet, |
| 210 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 211 | FX_BOOL getPageNumWords(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 212 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 213 | CJS_Value& vRet, |
| 214 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 215 | FX_BOOL getPrintParams(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 216 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 217 | CJS_Value& vRet, |
| 218 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 219 | FX_BOOL getURL(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 220 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 221 | CJS_Value& vRet, |
| 222 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 223 | FX_BOOL importAnFDF(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 224 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 225 | CJS_Value& vRet, |
| 226 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 227 | FX_BOOL importAnXFDF(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 228 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 229 | CJS_Value& vRet, |
| 230 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 231 | FX_BOOL importTextData(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 232 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 233 | CJS_Value& vRet, |
| 234 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 235 | FX_BOOL insertPages(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 236 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 237 | CJS_Value& vRet, |
| 238 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 239 | FX_BOOL mailForm(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 240 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 241 | CJS_Value& vRet, |
| 242 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 243 | FX_BOOL print(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 244 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 245 | CJS_Value& vRet, |
| 246 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 247 | FX_BOOL removeField(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 248 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 249 | CJS_Value& vRet, |
| 250 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 251 | FX_BOOL replacePages(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 252 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 253 | CJS_Value& vRet, |
| 254 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 255 | FX_BOOL resetForm(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 256 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 257 | CJS_Value& vRet, |
| 258 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 259 | FX_BOOL saveAs(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 260 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 261 | CJS_Value& vRet, |
| 262 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 263 | FX_BOOL submitForm(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 264 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 265 | CJS_Value& vRet, |
| 266 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 267 | FX_BOOL mailDoc(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 268 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 269 | CJS_Value& vRet, |
| 270 | CFX_WideString& sError); |
Tom Sepez | ba038bc | 2015-10-08 12:03:00 -0700 | [diff] [blame] | 271 | FX_BOOL removeIcon(IJS_Context* cc, |
Lei Zhang | 945fdb7 | 2015-11-11 10:18:16 -0800 | [diff] [blame^] | 272 | const std::vector<CJS_Value>& params, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 273 | CJS_Value& vRet, |
| 274 | CFX_WideString& sError); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 275 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 276 | 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 289 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 290 | 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 296 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 297 | 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 304 | }; |
| 305 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 306 | class CJS_Document : public CJS_Object { |
| 307 | public: |
Tom Sepez | 808a99e | 2015-09-10 12:28:37 -0700 | [diff] [blame] | 308 | explicit CJS_Document(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 309 | ~CJS_Document() override {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 310 | |
Lei Zhang | 2b1a2d5 | 2015-08-14 22:16:22 -0700 | [diff] [blame] | 311 | // CJS_Object |
Tom Sepez | 3342090 | 2015-10-13 15:00:10 -0700 | [diff] [blame] | 312 | void InitInstance(IJS_Runtime* pIRuntime) override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 313 | |
Tom Sepez | cd56a7d | 2015-10-06 11:45:28 -0700 | [diff] [blame] | 314 | DECLARE_JS_CLASS(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 315 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 316 | 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 347 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 348 | 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-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 388 | }; |
| 389 | |
Tom Sepez | 3745841 | 2015-10-06 11:33:46 -0700 | [diff] [blame] | 390 | #endif // FPDFSDK_SRC_JAVASCRIPT_DOCUMENT_H_ |