OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FPDFSDK_JAVASCRIPT_DOCUMENT_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_DOCUMENT_H_ |
8 #define FPDFSDK_JAVASCRIPT_DOCUMENT_H_ | 8 #define FPDFSDK_JAVASCRIPT_DOCUMENT_H_ |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "core/fpdfapi/page/cpdf_pageobject.h" | 14 #include "core/fpdfapi/page/cpdf_pageobject.h" |
15 #include "core/fpdfapi/page/cpdf_textobject.h" | 15 #include "core/fpdfapi/page/cpdf_textobject.h" |
16 #include "fpdfsdk/cpdfsdk_document.h" | 16 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
17 #include "fpdfsdk/javascript/JS_Define.h" | 17 #include "fpdfsdk/javascript/JS_Define.h" |
18 | 18 |
19 class PrintParamsObj : public CJS_EmbedObj { | 19 class PrintParamsObj : public CJS_EmbedObj { |
20 public: | 20 public: |
21 PrintParamsObj(CJS_Object* pJSObject); | 21 PrintParamsObj(CJS_Object* pJSObject); |
22 ~PrintParamsObj() override {} | 22 ~PrintParamsObj() override {} |
23 | 23 |
24 public: | 24 public: |
25 FX_BOOL bUI; | 25 FX_BOOL bUI; |
26 int nStart; | 26 int nStart; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 FX_BOOL mailDoc(IJS_Context* cc, | 263 FX_BOOL mailDoc(IJS_Context* cc, |
264 const std::vector<CJS_Value>& params, | 264 const std::vector<CJS_Value>& params, |
265 CJS_Value& vRet, | 265 CJS_Value& vRet, |
266 CFX_WideString& sError); | 266 CFX_WideString& sError); |
267 FX_BOOL removeIcon(IJS_Context* cc, | 267 FX_BOOL removeIcon(IJS_Context* cc, |
268 const std::vector<CJS_Value>& params, | 268 const std::vector<CJS_Value>& params, |
269 CJS_Value& vRet, | 269 CJS_Value& vRet, |
270 CFX_WideString& sError); | 270 CFX_WideString& sError); |
271 FX_BOOL URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 271 FX_BOOL URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
272 | 272 |
273 void AttachDoc(CPDFSDK_Document* pDoc); | 273 void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv); |
274 CPDFSDK_Document* GetReaderDoc() const { return m_pDocument.Get(); } | 274 CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { |
| 275 return m_pFormFillEnv.Get(); |
| 276 } |
275 void AddDelayData(CJS_DelayData* pData); | 277 void AddDelayData(CJS_DelayData* pData); |
276 void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex); | 278 void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex); |
277 CJS_Document* GetCJSDoc() const; | 279 CJS_Document* GetCJSDoc() const; |
278 | 280 |
279 private: | 281 private: |
280 bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect); | 282 bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect); |
281 int CountWords(CPDF_TextObject* pTextObj); | 283 int CountWords(CPDF_TextObject* pTextObj); |
282 CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); | 284 CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); |
283 | 285 |
284 FX_BOOL getPropertyInternal(IJS_Context* cc, | 286 FX_BOOL getPropertyInternal(IJS_Context* cc, |
285 CJS_PropValue& vp, | 287 CJS_PropValue& vp, |
286 const CFX_ByteString& propName, | 288 const CFX_ByteString& propName, |
287 CFX_WideString& sError); | 289 CFX_WideString& sError); |
288 | 290 |
289 CPDFSDK_Document::ObservedPtr m_pDocument; | 291 CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; |
290 CFX_WideString m_cwBaseURL; | 292 CFX_WideString m_cwBaseURL; |
291 std::list<std::unique_ptr<CJS_DelayData>> m_DelayData; | 293 std::list<std::unique_ptr<CJS_DelayData>> m_DelayData; |
292 std::list<std::unique_ptr<IconElement>> m_IconList; | 294 std::list<std::unique_ptr<IconElement>> m_IconList; |
293 bool m_bDelay; | 295 bool m_bDelay; |
294 }; | 296 }; |
295 | 297 |
296 class CJS_Document : public CJS_Object { | 298 class CJS_Document : public CJS_Object { |
297 public: | 299 public: |
298 explicit CJS_Document(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | 300 explicit CJS_Document(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
299 ~CJS_Document() override {} | 301 ~CJS_Document() override {} |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 JS_STATIC_METHOD(replacePages, Document); | 376 JS_STATIC_METHOD(replacePages, Document); |
375 JS_STATIC_METHOD(removeIcon, Document); | 377 JS_STATIC_METHOD(removeIcon, Document); |
376 JS_STATIC_METHOD(resetForm, Document); | 378 JS_STATIC_METHOD(resetForm, Document); |
377 JS_STATIC_METHOD(saveAs, Document); | 379 JS_STATIC_METHOD(saveAs, Document); |
378 JS_STATIC_METHOD(submitForm, Document); | 380 JS_STATIC_METHOD(submitForm, Document); |
379 JS_STATIC_METHOD(syncAnnotScan, Document); | 381 JS_STATIC_METHOD(syncAnnotScan, Document); |
380 JS_STATIC_METHOD(mailDoc, Document); | 382 JS_STATIC_METHOD(mailDoc, Document); |
381 }; | 383 }; |
382 | 384 |
383 #endif // FPDFSDK_JAVASCRIPT_DOCUMENT_H_ | 385 #endif // FPDFSDK_JAVASCRIPT_DOCUMENT_H_ |
OLD | NEW |