summaryrefslogtreecommitdiff
path: root/fpdfsdk/include/javascript
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
committerNico Weber <thakis@chromium.org>2015-08-04 13:00:21 -0700
commit9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch)
treec97037f398d714665aefccb6eb54d0969ad7030c /fpdfsdk/include/javascript
parent780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff)
downloadpdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz
XFA: clang-format all pdfium code.
No behavior change. Generated by: find . -name '*.cpp' -o -name '*.h' | \ grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \ xargs ../../buildtools/mac/clang-format -i Then manually merged https://codereview.chromium.org/1269223002/ See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion. BUG=none
Diffstat (limited to 'fpdfsdk/include/javascript')
-rw-r--r--fpdfsdk/include/javascript/Consts.h119
-rw-r--r--fpdfsdk/include/javascript/Document.h592
-rw-r--r--fpdfsdk/include/javascript/Field.h929
-rw-r--r--fpdfsdk/include/javascript/IJavaScript.h230
-rw-r--r--fpdfsdk/include/javascript/Icon.h42
-rw-r--r--fpdfsdk/include/javascript/JS_Context.h210
-rw-r--r--fpdfsdk/include/javascript/JS_Define.h635
-rw-r--r--fpdfsdk/include/javascript/JS_EventHandler.h345
-rw-r--r--fpdfsdk/include/javascript/JS_GlobalData.h145
-rw-r--r--fpdfsdk/include/javascript/JS_Object.h461
-rw-r--r--fpdfsdk/include/javascript/JS_Runtime.h86
-rw-r--r--fpdfsdk/include/javascript/JS_Value.h304
-rw-r--r--fpdfsdk/include/javascript/PublicMethods.h240
-rw-r--r--fpdfsdk/include/javascript/app.h349
-rw-r--r--fpdfsdk/include/javascript/color.h117
-rw-r--r--fpdfsdk/include/javascript/console.h52
-rw-r--r--fpdfsdk/include/javascript/event.h123
-rw-r--r--fpdfsdk/include/javascript/global.h133
-rw-r--r--fpdfsdk/include/javascript/report.h40
-rw-r--r--fpdfsdk/include/javascript/resource.h36
-rw-r--r--fpdfsdk/include/javascript/util.h76
21 files changed, 3043 insertions, 2221 deletions
diff --git a/fpdfsdk/include/javascript/Consts.h b/fpdfsdk/include/javascript/Consts.h
index d04cc6b54c..c0abe4c7d4 100644
--- a/fpdfsdk/include/javascript/Consts.h
+++ b/fpdfsdk/include/javascript/Consts.h
@@ -11,117 +11,108 @@
/* ------------------------------ border ------------------------------ */
-class CJS_Border : public CJS_Object
-{
-public:
- CJS_Border(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Border(void){};
+class CJS_Border : public CJS_Object {
+ public:
+ CJS_Border(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Border(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ display ------------------------------ */
-class CJS_Display : public CJS_Object
-{
-public:
- CJS_Display(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Display(void){};
+class CJS_Display : public CJS_Object {
+ public:
+ CJS_Display(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Display(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ font ------------------------------ */
-class CJS_Font : public CJS_Object
-{
-public:
- CJS_Font(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Font(void){};
+class CJS_Font : public CJS_Object {
+ public:
+ CJS_Font(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Font(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ highlight ------------------------------ */
-class CJS_Highlight : public CJS_Object
-{
-public:
- CJS_Highlight(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Highlight(void){};
+class CJS_Highlight : public CJS_Object {
+ public:
+ CJS_Highlight(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Highlight(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ position ------------------------------ */
-class CJS_Position : public CJS_Object
-{
-public:
- CJS_Position(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Position(void){};
+class CJS_Position : public CJS_Object {
+ public:
+ CJS_Position(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Position(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ scaleHow ------------------------------ */
-class CJS_ScaleHow : public CJS_Object
-{
-public:
- CJS_ScaleHow(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_ScaleHow(void){};
+class CJS_ScaleHow : public CJS_Object {
+ public:
+ CJS_ScaleHow(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_ScaleHow(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ scaleWhen ------------------------------ */
-class CJS_ScaleWhen : public CJS_Object
-{
-public:
- CJS_ScaleWhen(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_ScaleWhen(void){};
+class CJS_ScaleWhen : public CJS_Object {
+ public:
+ CJS_ScaleWhen(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_ScaleWhen(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ style ------------------------------ */
-class CJS_Style : public CJS_Object
-{
-public:
- CJS_Style(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Style(void){};
+class CJS_Style : public CJS_Object {
+ public:
+ CJS_Style(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Style(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
/* ------------------------------ zoomtype ------------------------------ */
-class CJS_Zoomtype : public CJS_Object
-{
-public:
- CJS_Zoomtype(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Zoomtype(void){};
+class CJS_Zoomtype : public CJS_Object {
+ public:
+ CJS_Zoomtype(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Zoomtype(void){};
- DECLARE_JS_CLASS_CONST();
+ DECLARE_JS_CLASS_CONST();
};
-/* ------------------------------ CJS_GlobalConsts ------------------------------ */
+/* ------------------------------ CJS_GlobalConsts
+ * ------------------------------ */
-class CJS_GlobalConsts : public CJS_Object
-{
-public:
- static int Init(IJS_Runtime* pRuntime);
+class CJS_GlobalConsts : public CJS_Object {
+ public:
+ static int Init(IJS_Runtime* pRuntime);
};
-/* ------------------------------ CJS_GlobalArrays ------------------------------ */
+/* ------------------------------ CJS_GlobalArrays
+ * ------------------------------ */
-class CJS_GlobalArrays : public CJS_Object
-{
-public:
- static int Init(IJS_Runtime* pRuntime);
+class CJS_GlobalArrays : public CJS_Object {
+ public:
+ static int Init(IJS_Runtime* pRuntime);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_CONSTS_H_
diff --git a/fpdfsdk/include/javascript/Document.h b/fpdfsdk/include/javascript/Document.h
index 11642366f4..52a1981b5e 100644
--- a/fpdfsdk/include/javascript/Document.h
+++ b/fpdfsdk/include/javascript/Document.h
@@ -9,267 +9,399 @@
#include "JS_Define.h"
-class PrintParamsObj : public CJS_EmbedObj
-{
-public:
- PrintParamsObj(CJS_Object* pJSObject);
- virtual ~PrintParamsObj(){}
+class PrintParamsObj : public CJS_EmbedObj {
+ public:
+ PrintParamsObj(CJS_Object* pJSObject);
+ virtual ~PrintParamsObj() {}
-public:
- FX_BOOL bUI;
- int nStart;
- int nEnd;
- FX_BOOL bSilent;
- FX_BOOL bShrinkToFit;
- FX_BOOL bPrintAsImage;
- FX_BOOL bReverse;
- FX_BOOL bAnnotations;
+ public:
+ FX_BOOL bUI;
+ int nStart;
+ int nEnd;
+ FX_BOOL bSilent;
+ FX_BOOL bShrinkToFit;
+ FX_BOOL bPrintAsImage;
+ FX_BOOL bReverse;
+ FX_BOOL bAnnotations;
};
-class CJS_PrintParamsObj : public CJS_Object
-{
-public:
- CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {}
- virtual ~CJS_PrintParamsObj(){}
+class CJS_PrintParamsObj : public CJS_Object {
+ public:
+ CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {}
+ virtual ~CJS_PrintParamsObj() {}
- DECLARE_JS_CLASS(CJS_PrintParamsObj);
+ DECLARE_JS_CLASS(CJS_PrintParamsObj);
};
-
class Icon;
class Field;
-struct IconElement
-{
- IconElement() : IconName(L""), NextIcon(NULL), IconStream(NULL) {}
- virtual ~IconElement()
- {
- }
- CFX_WideString IconName;
- IconElement* NextIcon;
- Icon* IconStream;
+struct IconElement {
+ IconElement() : IconName(L""), NextIcon(NULL), IconStream(NULL) {}
+ virtual ~IconElement() {}
+ CFX_WideString IconName;
+ IconElement* NextIcon;
+ Icon* IconStream;
};
-class IconTree
-{
-public:
- IconTree():m_pHead(NULL), m_pEnd(NULL), m_iLength(0)
- {
-
- }
+class IconTree {
+ public:
+ IconTree() : m_pHead(NULL), m_pEnd(NULL), m_iLength(0) {}
- virtual ~IconTree()
- {
- }
+ virtual ~IconTree() {}
-public:
- void InsertIconElement(IconElement* pNewIcon);
- void DeleteIconElement(CFX_WideString swIconName);
- void DeleteIconTree();
- int GetLength();
- IconElement* operator[](int iIndex);
+ public:
+ void InsertIconElement(IconElement* pNewIcon);
+ void DeleteIconElement(CFX_WideString swIconName);
+ void DeleteIconTree();
+ int GetLength();
+ IconElement* operator[](int iIndex);
-private:
- IconElement* m_pHead;
- IconElement* m_pEnd;
- int m_iLength;
+ private:
+ IconElement* m_pHead;
+ IconElement* m_pEnd;
+ int m_iLength;
};
struct CJS_DelayData;
struct CJS_DelayAnnot;
struct CJS_AnnotObj;
-class Document : public CJS_EmbedObj
-{
-public:
- Document(CJS_Object* pJSObject);
- virtual ~Document();
+class Document : public CJS_EmbedObj {
+ public:
+ Document(CJS_Object* pJSObject);
+ virtual ~Document();
-public:
- FX_BOOL ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL author(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL bookmarkRoot(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL Collab(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL creationDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL creator(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL dirty(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL filesize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL keywords(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL layout(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL modDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numFields(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numPages(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL pageNum(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL pageWindowRect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL path(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL producer(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL subject(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL title(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL zoom(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL zoomType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ public:
+ FX_BOOL ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL author(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL bookmarkRoot(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL calculate(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL Collab(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL creationDate(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL creator(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL dirty(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL documentFileName(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL external(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL filesize(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL keywords(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL layout(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL modDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL numFields(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL numPages(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL pageNum(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL pageWindowRect(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL path(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL producer(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL subject(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL title(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL zoom(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL zoomType(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
- FX_BOOL addAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL addField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL addLink(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL addIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL calculateNow(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL closeDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL createDataObject(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL deletePages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL exportAsText(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL exportAsFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL exportAsXFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL extractPages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getAnnots(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getAnnot3D(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getAnnots3D(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getLinks(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getNthFieldName(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getOCGs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPageBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPageNthWord(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPageNthWordQuads(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPageNumWords(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getPrintParams(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL importAnFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL importAnXFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL importTextData(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL insertPages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL mailForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL print(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL removeField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL replacePages(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL resetForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL saveAs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL submitForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL mailDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+ FX_BOOL addAnnot(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL addField(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL addLink(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL addIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL calculateNow(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL closeDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL createDataObject(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL deletePages(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL exportAsText(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL exportAsFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL exportAsXFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL extractPages(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getAnnot(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getAnnots(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getAnnot3D(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getAnnots3D(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getField(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getLinks(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getNthFieldName(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getOCGs(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPageBox(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPageNthWord(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPageNthWordQuads(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPageNumWords(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getPrintParams(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getURL(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL importAnFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL importAnXFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL importTextData(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL insertPages(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL mailForm(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL print(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL removeField(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL replacePages(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL resetForm(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL saveAs(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL submitForm(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL mailDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL removeIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
-public:
- void AttachDoc(CPDFSDK_Document* pDoc);
- CPDFSDK_Document* GetReaderDoc();
- static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc, CFX_ByteString& strFileName);
- static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc, CFX_ByteString& strFolderName);
- void AddDelayData(CJS_DelayData* pData);
- void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
- void AddDelayAnnotData(CJS_AnnotObj *pData);
- void DoAnnotDelay();
- void SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}
- CJS_Document* GetCJSDoc() const;
+ public:
+ void AttachDoc(CPDFSDK_Document* pDoc);
+ CPDFSDK_Document* GetReaderDoc();
+ static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc,
+ CFX_ByteString& strFileName);
+ static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc,
+ CFX_ByteString& strFolderName);
+ void AddDelayData(CJS_DelayData* pData);
+ void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex);
+ void AddDelayAnnotData(CJS_AnnotObj* pData);
+ void DoAnnotDelay();
+ void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
+ CJS_Document* GetCJSDoc() const;
-private:
- CFX_WideString ReversalStr(CFX_WideString cbFrom);
- CFX_WideString CutString(CFX_WideString cbFrom);
- bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
- int CountWords(CPDF_TextObject* pTextObj);
- CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
- FX_BOOL ParserParams(JSObject *pObj,CJS_AnnotObj& annotobj);
+ private:
+ CFX_WideString ReversalStr(CFX_WideString cbFrom);
+ CFX_WideString CutString(CFX_WideString cbFrom);
+ bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect);
+ int CountWords(CPDF_TextObject* pTextObj);
+ CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
+ FX_BOOL ParserParams(JSObject* pObj, CJS_AnnotObj& annotobj);
- v8::Isolate* m_isolate;
- IconTree* m_pIconTree;
- CPDFSDK_Document* m_pDocument;
- CFX_WideString m_cwBaseURL;
- bool m_bDelay;
- CFX_ArrayTemplate<CJS_DelayData*> m_DelayData;
- CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData;
+ v8::Isolate* m_isolate;
+ IconTree* m_pIconTree;
+ CPDFSDK_Document* m_pDocument;
+ CFX_WideString m_cwBaseURL;
+ bool m_bDelay;
+ CFX_ArrayTemplate<CJS_DelayData*> m_DelayData;
+ CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData;
};
-class CJS_Document : public CJS_Object
-{
-public:
- CJS_Document(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Document(){};
+class CJS_Document : public CJS_Object {
+ public:
+ CJS_Document(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Document(){};
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
+ virtual FX_BOOL InitInstance(IFXJS_Context* cc);
- DECLARE_JS_CLASS(CJS_Document);
+ DECLARE_JS_CLASS(CJS_Document);
- JS_STATIC_PROP(ADBE, Document);
- JS_STATIC_PROP(author, Document);
- JS_STATIC_PROP(baseURL, Document);
- JS_STATIC_PROP(bookmarkRoot, Document);
- JS_STATIC_PROP(calculate, Document);
- JS_STATIC_PROP(Collab, Document);
- JS_STATIC_PROP(creationDate, Document);
- JS_STATIC_PROP(creator, Document);
- JS_STATIC_PROP(delay, Document);
- JS_STATIC_PROP(dirty, Document);
- JS_STATIC_PROP(documentFileName, Document);
- JS_STATIC_PROP(external, Document);
- JS_STATIC_PROP(filesize, Document);
- JS_STATIC_PROP(icons, Document);
- JS_STATIC_PROP(info, Document);
- JS_STATIC_PROP(keywords, Document);
- JS_STATIC_PROP(layout, Document);
- JS_STATIC_PROP(media, Document);
- JS_STATIC_PROP(modDate, Document);
- JS_STATIC_PROP(mouseX, Document);
- JS_STATIC_PROP(mouseY, Document);
- JS_STATIC_PROP(numFields, Document);
- JS_STATIC_PROP(numPages, Document);
- JS_STATIC_PROP(pageNum, Document);
- JS_STATIC_PROP(pageWindowRect, Document);
- JS_STATIC_PROP(path, Document);
- JS_STATIC_PROP(producer, Document);
- JS_STATIC_PROP(subject, Document);
- JS_STATIC_PROP(title, Document);
- JS_STATIC_PROP(zoom, Document);
- JS_STATIC_PROP(zoomType, Document);
+ JS_STATIC_PROP(ADBE, Document);
+ JS_STATIC_PROP(author, Document);
+ JS_STATIC_PROP(baseURL, Document);
+ JS_STATIC_PROP(bookmarkRoot, Document);
+ JS_STATIC_PROP(calculate, Document);
+ JS_STATIC_PROP(Collab, Document);
+ JS_STATIC_PROP(creationDate, Document);
+ JS_STATIC_PROP(creator, Document);
+ JS_STATIC_PROP(delay, Document);
+ JS_STATIC_PROP(dirty, Document);
+ JS_STATIC_PROP(documentFileName, Document);
+ JS_STATIC_PROP(external, Document);
+ JS_STATIC_PROP(filesize, Document);
+ JS_STATIC_PROP(icons, Document);
+ JS_STATIC_PROP(info, Document);
+ JS_STATIC_PROP(keywords, Document);
+ JS_STATIC_PROP(layout, Document);
+ JS_STATIC_PROP(media, Document);
+ JS_STATIC_PROP(modDate, Document);
+ JS_STATIC_PROP(mouseX, Document);
+ JS_STATIC_PROP(mouseY, Document);
+ JS_STATIC_PROP(numFields, Document);
+ JS_STATIC_PROP(numPages, Document);
+ JS_STATIC_PROP(pageNum, Document);
+ JS_STATIC_PROP(pageWindowRect, Document);
+ JS_STATIC_PROP(path, Document);
+ JS_STATIC_PROP(producer, Document);
+ JS_STATIC_PROP(subject, Document);
+ JS_STATIC_PROP(title, Document);
+ JS_STATIC_PROP(zoom, Document);
+ JS_STATIC_PROP(zoomType, Document);
- JS_STATIC_METHOD(addAnnot,Document);
- JS_STATIC_METHOD(addField, Document);
- JS_STATIC_METHOD(addLink, Document);
- JS_STATIC_METHOD(addIcon, Document);
- JS_STATIC_METHOD(calculateNow, Document);
- JS_STATIC_METHOD(closeDoc, Document);
- JS_STATIC_METHOD(createDataObject, Document);
- JS_STATIC_METHOD(deletePages, Document);
- JS_STATIC_METHOD(exportAsText, Document);
- JS_STATIC_METHOD(exportAsFDF, Document);
- JS_STATIC_METHOD(exportAsXFDF, Document);
- JS_STATIC_METHOD(extractPages, Document);
- JS_STATIC_METHOD(getAnnot, Document);
- JS_STATIC_METHOD(getAnnots, Document);
- JS_STATIC_METHOD(getAnnot3D, Document);
- JS_STATIC_METHOD(getAnnots3D, Document);
- JS_STATIC_METHOD(getField, Document);
- JS_STATIC_METHOD(getIcon, Document);
- JS_STATIC_METHOD(getLinks, Document);
- JS_STATIC_METHOD(getNthFieldName, Document);
- JS_STATIC_METHOD(getOCGs, Document);
- JS_STATIC_METHOD(getPageBox, Document);
- JS_STATIC_METHOD(getPageNthWord, Document);
- JS_STATIC_METHOD(getPageNthWordQuads, Document);
- JS_STATIC_METHOD(getPageNumWords, Document);
- JS_STATIC_METHOD(getPrintParams, Document);
- JS_STATIC_METHOD(getURL, Document);
- JS_STATIC_METHOD(importAnFDF, Document);
- JS_STATIC_METHOD(importAnXFDF, Document);
- JS_STATIC_METHOD(importTextData, Document);
- JS_STATIC_METHOD(insertPages, Document);
- JS_STATIC_METHOD(mailForm, Document);
- JS_STATIC_METHOD(print, Document);
- JS_STATIC_METHOD(removeField, Document);
- JS_STATIC_METHOD(replacePages, Document);
- JS_STATIC_METHOD(removeIcon, Document);
- JS_STATIC_METHOD(resetForm, Document);
- JS_STATIC_METHOD(saveAs, Document);
- JS_STATIC_METHOD(submitForm, Document);
- JS_STATIC_METHOD(mailDoc, Document);
+ JS_STATIC_METHOD(addAnnot, Document);
+ JS_STATIC_METHOD(addField, Document);
+ JS_STATIC_METHOD(addLink, Document);
+ JS_STATIC_METHOD(addIcon, Document);
+ JS_STATIC_METHOD(calculateNow, Document);
+ JS_STATIC_METHOD(closeDoc, Document);
+ JS_STATIC_METHOD(createDataObject, Document);
+ JS_STATIC_METHOD(deletePages, Document);
+ JS_STATIC_METHOD(exportAsText, Document);
+ JS_STATIC_METHOD(exportAsFDF, Document);
+ JS_STATIC_METHOD(exportAsXFDF, Document);
+ JS_STATIC_METHOD(extractPages, Document);
+ JS_STATIC_METHOD(getAnnot, Document);
+ JS_STATIC_METHOD(getAnnots, Document);
+ JS_STATIC_METHOD(getAnnot3D, Document);
+ JS_STATIC_METHOD(getAnnots3D, Document);
+ JS_STATIC_METHOD(getField, Document);
+ JS_STATIC_METHOD(getIcon, Document);
+ JS_STATIC_METHOD(getLinks, Document);
+ JS_STATIC_METHOD(getNthFieldName, Document);
+ JS_STATIC_METHOD(getOCGs, Document);
+ JS_STATIC_METHOD(getPageBox, Document);
+ JS_STATIC_METHOD(getPageNthWord, Document);
+ JS_STATIC_METHOD(getPageNthWordQuads, Document);
+ JS_STATIC_METHOD(getPageNumWords, Document);
+ JS_STATIC_METHOD(getPrintParams, Document);
+ JS_STATIC_METHOD(getURL, Document);
+ JS_STATIC_METHOD(importAnFDF, Document);
+ JS_STATIC_METHOD(importAnXFDF, Document);
+ JS_STATIC_METHOD(importTextData, Document);
+ JS_STATIC_METHOD(insertPages, Document);
+ JS_STATIC_METHOD(mailForm, Document);
+ JS_STATIC_METHOD(print, Document);
+ JS_STATIC_METHOD(removeField, Document);
+ JS_STATIC_METHOD(replacePages, Document);
+ JS_STATIC_METHOD(removeIcon, Document);
+ JS_STATIC_METHOD(resetForm, Document);
+ JS_STATIC_METHOD(saveAs, Document);
+ JS_STATIC_METHOD(submitForm, Document);
+ JS_STATIC_METHOD(mailDoc, Document);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_DOCUMENT_H_
diff --git a/fpdfsdk/include/javascript/Field.h b/fpdfsdk/include/javascript/Field.h
index 70d1d39b48..afbf783bf2 100644
--- a/fpdfsdk/include/javascript/Field.h
+++ b/fpdfsdk/include/javascript/Field.h
@@ -14,346 +14,611 @@
class Document;
-enum FIELD_PROP
-{
- FP_ALIGNMENT,
- FP_BORDERSTYLE,
- FP_BUTTONALIGNX,
- FP_BUTTONALIGNY,
- FP_BUTTONFITBOUNDS,
- FP_BUTTONPOSITION,
- FP_BUTTONSCALEHOW,
- FP_BUTTONSCALEWHEN,
- FP_CALCORDERINDEX,
- FP_CHARLIMIT,
- FP_COMB,
- FP_COMMITONSELCHANGE,
- FP_CURRENTVALUEINDICES,
- FP_DEFAULTVALUE,
- FP_DONOTSCROLL,
- FP_DISPLAY,
- FP_FILLCOLOR,
- FP_HIDDEN,
- FP_HIGHLIGHT,
- FP_LINEWIDTH,
- FP_MULTILINE,
- FP_MULTIPLESELECTION,
- FP_PASSWORD,
- FP_RECT,
- FP_RICHTEXT,
- FP_RICHVALUE,
- FP_ROTATION,
- FP_STROKECOLOR,
- FP_STYLE,
- FP_TEXTCOLOR,
- FP_TEXTFONT,
- FP_TEXTSIZE,
- FP_USERNAME,
- FP_VALUE
+enum FIELD_PROP {
+ FP_ALIGNMENT,
+ FP_BORDERSTYLE,
+ FP_BUTTONALIGNX,
+ FP_BUTTONALIGNY,
+ FP_BUTTONFITBOUNDS,
+ FP_BUTTONPOSITION,
+ FP_BUTTONSCALEHOW,
+ FP_BUTTONSCALEWHEN,
+ FP_CALCORDERINDEX,
+ FP_CHARLIMIT,
+ FP_COMB,
+ FP_COMMITONSELCHANGE,
+ FP_CURRENTVALUEINDICES,
+ FP_DEFAULTVALUE,
+ FP_DONOTSCROLL,
+ FP_DISPLAY,
+ FP_FILLCOLOR,
+ FP_HIDDEN,
+ FP_HIGHLIGHT,
+ FP_LINEWIDTH,
+ FP_MULTILINE,
+ FP_MULTIPLESELECTION,
+ FP_PASSWORD,
+ FP_RECT,
+ FP_RICHTEXT,
+ FP_RICHVALUE,
+ FP_ROTATION,
+ FP_STROKECOLOR,
+ FP_STYLE,
+ FP_TEXTCOLOR,
+ FP_TEXTFONT,
+ FP_TEXTSIZE,
+ FP_USERNAME,
+ FP_VALUE
};
-class CJS_WideStringArray
-{
-public:
- CJS_WideStringArray(){}
- virtual ~CJS_WideStringArray()
- {
- for (int i=0,sz=m_Data.GetSize(); i<sz; i++)
- delete m_Data.GetAt(i);
- m_Data.RemoveAll();
- }
-
- void Add(const CFX_WideString& string)
- {
- m_Data.Add(new CFX_WideString(string));
- }
-
- int GetSize() const
- {
- return m_Data.GetSize();
- }
-
- CFX_WideString GetAt(int i) const
- {
- return *m_Data.GetAt(i);
- }
-
-private:
- CFX_ArrayTemplate<CFX_WideString*> m_Data;
+class CJS_WideStringArray {
+ public:
+ CJS_WideStringArray() {}
+ virtual ~CJS_WideStringArray() {
+ for (int i = 0, sz = m_Data.GetSize(); i < sz; i++)
+ delete m_Data.GetAt(i);
+ m_Data.RemoveAll();
+ }
+
+ void Add(const CFX_WideString& string) {
+ m_Data.Add(new CFX_WideString(string));
+ }
+
+ int GetSize() const { return m_Data.GetSize(); }
+
+ CFX_WideString GetAt(int i) const { return *m_Data.GetAt(i); }
+
+ private:
+ CFX_ArrayTemplate<CFX_WideString*> m_Data;
};
-struct CJS_DelayData
-{
- CFX_WideString sFieldName;
- int nControlIndex;
- enum FIELD_PROP eProp;
- int32_t num;
- bool b;
- CFX_ByteString string;
- CFX_WideString widestring;
- CPDF_Rect rect;
- CPWL_Color color;
- CFX_DWordArray wordarray;
- CJS_WideStringArray widestringarray;
+struct CJS_DelayData {
+ CFX_WideString sFieldName;
+ int nControlIndex;
+ enum FIELD_PROP eProp;
+ int32_t num;
+ bool b;
+ CFX_ByteString string;
+ CFX_WideString widestring;
+ CPDF_Rect rect;
+ CPWL_Color color;
+ CFX_DWordArray wordarray;
+ CJS_WideStringArray widestringarray;
};
-class Field : public CJS_EmbedObj
-{
-public:
- Field(CJS_Object* pJSObject);
- virtual ~Field(void);
-
- FX_BOOL alignment(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL borderStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonAlignX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonAlignY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonFitBounds(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonPosition(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonScaleHow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL buttonScaleWhen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL calcOrderIndex(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL charLimit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL commitOnSelChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL currentValueIndices(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL defaultStyle(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL defaultValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL doNotScroll(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL doNotSpellCheck(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL editable(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL exportValues(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fileSelect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fillColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL highlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL lineWidth(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL multiline(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL multipleSelection(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numItems(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL password(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL radiosInUnison(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL readonly(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL required(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richText(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rotation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL strokeColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL submitName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL textColor(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL textFont(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL textSize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL userName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL valueAsString(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
-
- FX_BOOL browseForFileToSubmit(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonGetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonGetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonImportIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonSetCaption(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL buttonSetIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL checkThisBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL clearItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL defaultIsChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL deleteItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getArray(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL getLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL insertItemAt(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL isBoxChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL isDefaultChecked(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setAction(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setFocus(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setItems(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setLock(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureGetModifications(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureGetSeedValue(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureInfo(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureSetSeedValue(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureSign(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL signatureValidate(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
-
-public:
- static void SetAlignment(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetBorderStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetButtonAlignX(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonAlignY(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonFitBounds(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetButtonPosition(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonScaleHow(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetButtonScaleWhen(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetCalcOrderIndex(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetCharLimit(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetComb(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetCommitOnSelChange(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetCurrentValueIndices(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_DWordArray& array);
- static void SetDefaultStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);
- static void SetDefaultValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);
- static void SetDoNotScroll(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetDisplay(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetFillColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetHidden(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetHighlight(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetLineWidth(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetMultiline(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetMultipleSelection(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetPassword(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetRect(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPDF_Rect& rect);
- static void SetRichText(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, bool b);
- static void SetRichValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex);
- static void SetRotation(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetStrokeColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetStyle(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetTextColor(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CPWL_Color& color);
- static void SetTextFont(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_ByteString& string);
- static void SetTextSize(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, int number);
- static void SetUserName(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CFX_WideString& string);
- static void SetValue(CPDFSDK_Document* pDocument, const CFX_WideString& swFieldName, int nControlIndex, const CJS_WideStringArray& strArray);
-
-public:
- static void AddField(CPDFSDK_Document* pDocument, int nPageIndex, int nFieldType,
- const CFX_WideString& sName, const CPDF_Rect& rcCoords);
-public:
- static void UpdateFormField(CPDFSDK_Document* pDocument, CPDF_FormField* pFormField,
- FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);
- static void UpdateFormControl(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl,
- FX_BOOL bChangeMark, FX_BOOL bResetAP, FX_BOOL bRefresh);
-
- static CPDFSDK_Widget* GetWidget(CPDFSDK_Document* pDocument, CPDF_FormControl* pFormControl);
- static void GetFormFields(CPDFSDK_Document* pDocument, const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);
-
- static void DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData);
-
-public:
- FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName);
- void SetDelay(FX_BOOL bDelay);
- void SetIsolate(v8::Isolate* isolate) {m_isolate = isolate;}
-protected:
- void ParseFieldName(const std::wstring &strFieldNameParsed,std::wstring &strFieldName,int & iControlNo);
- void GetFormFields(const CFX_WideString& csFieldName, CFX_PtrArray& FieldsArray);
- CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
- FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
-
- void AddDelay_Int(enum FIELD_PROP prop, int32_t n);
- void AddDelay_Bool(enum FIELD_PROP prop,bool b);
- void AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string);
- void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string);
- void AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect);
- void AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color);
- void AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array);
- void AddDelay_WideStringArray(enum FIELD_PROP prop, const CJS_WideStringArray& array);
-
- void DoDelay();
-public:
- Document* m_pJSDoc;
- CPDFSDK_Document* m_pDocument;
- CFX_WideString m_FieldName;
- int m_nFormControlIndex;
- FX_BOOL m_bCanSet;
-
- FX_BOOL m_bDelay;
- v8::Isolate* m_isolate;
+class Field : public CJS_EmbedObj {
+ public:
+ Field(CJS_Object* pJSObject);
+ virtual ~Field(void);
+
+ FX_BOOL alignment(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL borderStyle(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonAlignX(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonAlignY(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonFitBounds(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonPosition(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonScaleHow(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL buttonScaleWhen(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL calcOrderIndex(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL charLimit(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL comb(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL commitOnSelChange(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL currentValueIndices(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL defaultStyle(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL defaultValue(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL doNotScroll(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL doNotSpellCheck(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL display(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL doc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL editable(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL exportValues(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL fileSelect(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL fillColor(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL hidden(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL highlight(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL lineWidth(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL multiline(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL multipleSelection(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL numItems(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL page(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL password(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL print(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL radiosInUnison(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL readonly(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL rect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL required(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL richText(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL richValue(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL rotation(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL strokeColor(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL style(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL submitName(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL textColor(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL textFont(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL textSize(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL userName(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL valueAsString(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+
+ FX_BOOL browseForFileToSubmit(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonGetCaption(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonGetIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonImportIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonSetCaption(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL buttonSetIcon(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL checkThisBox(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL clearItems(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL defaultIsChecked(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL deleteItemAt(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getArray(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getItemAt(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL getLock(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL insertItemAt(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL isBoxChecked(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL isDefaultChecked(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setAction(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setFocus(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setItems(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setLock(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureGetModifications(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureGetSeedValue(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureInfo(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureSetSeedValue(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureSign(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL signatureValidate(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+
+ public:
+ static void SetAlignment(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetBorderStyle(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetButtonAlignX(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetButtonAlignY(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetButtonFitBounds(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetButtonPosition(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetButtonScaleHow(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetButtonScaleWhen(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetCalcOrderIndex(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetCharLimit(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetComb(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetCommitOnSelChange(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetCurrentValueIndices(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_DWordArray& array);
+ static void SetDefaultStyle(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex);
+ static void SetDefaultValue(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_WideString& string);
+ static void SetDoNotScroll(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetDisplay(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetFillColor(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CPWL_Color& color);
+ static void SetHidden(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetHighlight(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetLineWidth(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetMultiline(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetMultipleSelection(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetPassword(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetRect(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CPDF_Rect& rect);
+ static void SetRichText(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ bool b);
+ static void SetRichValue(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex);
+ static void SetRotation(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetStrokeColor(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CPWL_Color& color);
+ static void SetStyle(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetTextColor(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CPWL_Color& color);
+ static void SetTextFont(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_ByteString& string);
+ static void SetTextSize(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ int number);
+ static void SetUserName(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CFX_WideString& string);
+ static void SetValue(CPDFSDK_Document* pDocument,
+ const CFX_WideString& swFieldName,
+ int nControlIndex,
+ const CJS_WideStringArray& strArray);
+
+ public:
+ static void AddField(CPDFSDK_Document* pDocument,
+ int nPageIndex,
+ int nFieldType,
+ const CFX_WideString& sName,
+ const CPDF_Rect& rcCoords);
+
+ public:
+ static void UpdateFormField(CPDFSDK_Document* pDocument,
+ CPDF_FormField* pFormField,
+ FX_BOOL bChangeMark,
+ FX_BOOL bResetAP,
+ FX_BOOL bRefresh);
+ static void UpdateFormControl(CPDFSDK_Document* pDocument,
+ CPDF_FormControl* pFormControl,
+ FX_BOOL bChangeMark,
+ FX_BOOL bResetAP,
+ FX_BOOL bRefresh);
+
+ static CPDFSDK_Widget* GetWidget(CPDFSDK_Document* pDocument,
+ CPDF_FormControl* pFormControl);
+ static void GetFormFields(CPDFSDK_Document* pDocument,
+ const CFX_WideString& csFieldName,
+ CFX_PtrArray& FieldsArray);
+
+ static void DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData);
+
+ public:
+ FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName);
+ void SetDelay(FX_BOOL bDelay);
+ void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
+
+ protected:
+ void ParseFieldName(const std::wstring& strFieldNameParsed,
+ std::wstring& strFieldName,
+ int& iControlNo);
+ void GetFormFields(const CFX_WideString& csFieldName,
+ CFX_PtrArray& FieldsArray);
+ CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
+ FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
+
+ void AddDelay_Int(enum FIELD_PROP prop, int32_t n);
+ void AddDelay_Bool(enum FIELD_PROP prop, bool b);
+ void AddDelay_String(enum FIELD_PROP prop, const CFX_ByteString& string);
+ void AddDelay_WideString(enum FIELD_PROP prop, const CFX_WideString& string);
+ void AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect);
+ void AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color);
+ void AddDelay_WordArray(enum FIELD_PROP prop, const CFX_DWordArray& array);
+ void AddDelay_WideStringArray(enum FIELD_PROP prop,
+ const CJS_WideStringArray& array);
+
+ void DoDelay();
+
+ public:
+ Document* m_pJSDoc;
+ CPDFSDK_Document* m_pDocument;
+ CFX_WideString m_FieldName;
+ int m_nFormControlIndex;
+ FX_BOOL m_bCanSet;
+
+ FX_BOOL m_bDelay;
+ v8::Isolate* m_isolate;
};
-class CJS_Field : public CJS_Object
-{
-public:
- CJS_Field(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Field(void){};
-
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
-
- DECLARE_JS_CLASS(CJS_Field);
-
- JS_STATIC_PROP(alignment, Field);
- JS_STATIC_PROP(borderStyle, Field);
- JS_STATIC_PROP(buttonAlignX, Field);
- JS_STATIC_PROP(buttonAlignY, Field);
- JS_STATIC_PROP(buttonFitBounds, Field);
- JS_STATIC_PROP(buttonPosition, Field);
- JS_STATIC_PROP(buttonScaleHow, Field);
- JS_STATIC_PROP(buttonScaleWhen, Field);
- JS_STATIC_PROP(calcOrderIndex, Field);
- JS_STATIC_PROP(charLimit, Field);
- JS_STATIC_PROP(comb, Field);
- JS_STATIC_PROP(commitOnSelChange, Field);
- JS_STATIC_PROP(currentValueIndices, Field);
- JS_STATIC_PROP(defaultStyle, Field);
- JS_STATIC_PROP(defaultValue, Field);
- JS_STATIC_PROP(doNotScroll, Field);
- JS_STATIC_PROP(doNotSpellCheck, Field);
- JS_STATIC_PROP(delay, Field);
- JS_STATIC_PROP(display, Field);
- JS_STATIC_PROP(doc, Field);
- JS_STATIC_PROP(editable, Field);
- JS_STATIC_PROP(exportValues, Field);
- JS_STATIC_PROP(fileSelect, Field);
- JS_STATIC_PROP(fillColor, Field);
- JS_STATIC_PROP(hidden, Field);
- JS_STATIC_PROP(highlight, Field);
- JS_STATIC_PROP(lineWidth, Field);
- JS_STATIC_PROP(multiline, Field);
- JS_STATIC_PROP(multipleSelection, Field);
- JS_STATIC_PROP(name, Field);
- JS_STATIC_PROP(numItems, Field);
- JS_STATIC_PROP(page, Field);
- JS_STATIC_PROP(password, Field);
- JS_STATIC_PROP(print, Field);
- JS_STATIC_PROP(radiosInUnison, Field);
- JS_STATIC_PROP(readonly, Field);
- JS_STATIC_PROP(rect, Field);
- JS_STATIC_PROP(required, Field);
- JS_STATIC_PROP(richText, Field);
- JS_STATIC_PROP(richValue, Field);
- JS_STATIC_PROP(rotation, Field);
- JS_STATIC_PROP(strokeColor, Field);
- JS_STATIC_PROP(style, Field);
- JS_STATIC_PROP(submitName, Field);
- JS_STATIC_PROP(textColor, Field);
- JS_STATIC_PROP(textFont, Field);
- JS_STATIC_PROP(textSize, Field);
- JS_STATIC_PROP(type, Field);
- JS_STATIC_PROP(userName, Field);
- JS_STATIC_PROP(value, Field);
- JS_STATIC_PROP(valueAsString, Field);
- JS_STATIC_PROP(source, Field);
-
- JS_STATIC_METHOD(browseForFileToSubmit, Field);
- JS_STATIC_METHOD(buttonGetCaption, Field);
- JS_STATIC_METHOD(buttonGetIcon, Field);
- JS_STATIC_METHOD(buttonImportIcon, Field);
- JS_STATIC_METHOD(buttonSetCaption, Field);
- JS_STATIC_METHOD(buttonSetIcon, Field);
- JS_STATIC_METHOD(checkThisBox, Field);
- JS_STATIC_METHOD(clearItems, Field);
- JS_STATIC_METHOD(defaultIsChecked, Field);
- JS_STATIC_METHOD(deleteItemAt, Field);
- JS_STATIC_METHOD(getArray, Field);
- JS_STATIC_METHOD(getItemAt, Field);
- JS_STATIC_METHOD(getLock, Field);
- JS_STATIC_METHOD(insertItemAt, Field);
- JS_STATIC_METHOD(isBoxChecked, Field);
- JS_STATIC_METHOD(isDefaultChecked, Field);
- JS_STATIC_METHOD(setAction, Field);
- JS_STATIC_METHOD(setFocus, Field);
- JS_STATIC_METHOD(setItems, Field);
- JS_STATIC_METHOD(setLock, Field);
- JS_STATIC_METHOD(signatureGetModifications, Field);
- JS_STATIC_METHOD(signatureGetSeedValue, Field);
- JS_STATIC_METHOD(signatureInfo, Field);
- JS_STATIC_METHOD(signatureSetSeedValue, Field);
- JS_STATIC_METHOD(signatureSign, Field);
- JS_STATIC_METHOD(signatureValidate, Field);
+class CJS_Field : public CJS_Object {
+ public:
+ CJS_Field(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Field(void){};
+
+ virtual FX_BOOL InitInstance(IFXJS_Context* cc);
+
+ DECLARE_JS_CLASS(CJS_Field);
+
+ JS_STATIC_PROP(alignment, Field);
+ JS_STATIC_PROP(borderStyle, Field);
+ JS_STATIC_PROP(buttonAlignX, Field);
+ JS_STATIC_PROP(buttonAlignY, Field);
+ JS_STATIC_PROP(buttonFitBounds, Field);
+ JS_STATIC_PROP(buttonPosition, Field);
+ JS_STATIC_PROP(buttonScaleHow, Field);
+ JS_STATIC_PROP(buttonScaleWhen, Field);
+ JS_STATIC_PROP(calcOrderIndex, Field);
+ JS_STATIC_PROP(charLimit, Field);
+ JS_STATIC_PROP(comb, Field);
+ JS_STATIC_PROP(commitOnSelChange, Field);
+ JS_STATIC_PROP(currentValueIndices, Field);
+ JS_STATIC_PROP(defaultStyle, Field);
+ JS_STATIC_PROP(defaultValue, Field);
+ JS_STATIC_PROP(doNotScroll, Field);
+ JS_STATIC_PROP(doNotSpellCheck, Field);
+ JS_STATIC_PROP(delay, Field);
+ JS_STATIC_PROP(display, Field);
+ JS_STATIC_PROP(doc, Field);
+ JS_STATIC_PROP(editable, Field);
+ JS_STATIC_PROP(exportValues, Field);
+ JS_STATIC_PROP(fileSelect, Field);
+ JS_STATIC_PROP(fillColor, Field);
+ JS_STATIC_PROP(hidden, Field);
+ JS_STATIC_PROP(highlight, Field);
+ JS_STATIC_PROP(lineWidth, Field);
+ JS_STATIC_PROP(multiline, Field);
+ JS_STATIC_PROP(multipleSelection, Field);
+ JS_STATIC_PROP(name, Field);
+ JS_STATIC_PROP(numItems, Field);
+ JS_STATIC_PROP(page, Field);
+ JS_STATIC_PROP(password, Field);
+ JS_STATIC_PROP(print, Field);
+ JS_STATIC_PROP(radiosInUnison, Field);
+ JS_STATIC_PROP(readonly, Field);
+ JS_STATIC_PROP(rect, Field);
+ JS_STATIC_PROP(required, Field);
+ JS_STATIC_PROP(richText, Field);
+ JS_STATIC_PROP(richValue, Field);
+ JS_STATIC_PROP(rotation, Field);
+ JS_STATIC_PROP(strokeColor, Field);
+ JS_STATIC_PROP(style, Field);
+ JS_STATIC_PROP(submitName, Field);
+ JS_STATIC_PROP(textColor, Field);
+ JS_STATIC_PROP(textFont, Field);
+ JS_STATIC_PROP(textSize, Field);
+ JS_STATIC_PROP(type, Field);
+ JS_STATIC_PROP(userName, Field);
+ JS_STATIC_PROP(value, Field);
+ JS_STATIC_PROP(valueAsString, Field);
+ JS_STATIC_PROP(source, Field);
+
+ JS_STATIC_METHOD(browseForFileToSubmit, Field);
+ JS_STATIC_METHOD(buttonGetCaption, Field);
+ JS_STATIC_METHOD(buttonGetIcon, Field);
+ JS_STATIC_METHOD(buttonImportIcon, Field);
+ JS_STATIC_METHOD(buttonSetCaption, Field);
+ JS_STATIC_METHOD(buttonSetIcon, Field);
+ JS_STATIC_METHOD(checkThisBox, Field);
+ JS_STATIC_METHOD(clearItems, Field);
+ JS_STATIC_METHOD(defaultIsChecked, Field);
+ JS_STATIC_METHOD(deleteItemAt, Field);
+ JS_STATIC_METHOD(getArray, Field);
+ JS_STATIC_METHOD(getItemAt, Field);
+ JS_STATIC_METHOD(getLock, Field);
+ JS_STATIC_METHOD(insertItemAt, Field);
+ JS_STATIC_METHOD(isBoxChecked, Field);
+ JS_STATIC_METHOD(isDefaultChecked, Field);
+ JS_STATIC_METHOD(setAction, Field);
+ JS_STATIC_METHOD(setFocus, Field);
+ JS_STATIC_METHOD(setItems, Field);
+ JS_STATIC_METHOD(setLock, Field);
+ JS_STATIC_METHOD(signatureGetModifications, Field);
+ JS_STATIC_METHOD(signatureGetSeedValue, Field);
+ JS_STATIC_METHOD(signatureInfo, Field);
+ JS_STATIC_METHOD(signatureSetSeedValue, Field);
+ JS_STATIC_METHOD(signatureSign, Field);
+ JS_STATIC_METHOD(signatureValidate, Field);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_FIELD_H_
diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h
index 1d9396fb79..d2cbfb1dd8 100644
--- a/fpdfsdk/include/javascript/IJavaScript.h
+++ b/fpdfsdk/include/javascript/IJavaScript.h
@@ -16,103 +16,161 @@ class CPDF_FormField;
class CPDFSDK_Annot;
class CPDFSDK_Document;
-class IFXJS_Context
-{
-public:
- virtual ~IFXJS_Context() { }
- virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info) = 0;
- virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info) = 0;
-
- virtual void OnApp_Init() = 0;
-
- virtual void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName) = 0;
- virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc) = 0;
- virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc) = 0;
-
- virtual void OnPage_Open(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_Close(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_InView(CPDFSDK_Document* pTarget) = 0;
- virtual void OnPage_OutView(CPDFSDK_Document* pTarget) = 0;
-
- virtual void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget) = 0;
- virtual void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;
- virtual void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value) = 0;
-
- virtual void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;
- virtual void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit) = 0;
- virtual void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc) = 0;
- virtual void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) = 0;
-
- virtual void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen) = 0;
-
- virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0;
- virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0;
-
- virtual void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString &) = 0;
- virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0;
- virtual void OnConsole_Exec() = 0;
- virtual void OnExternal_Exec() = 0;
-
- virtual void EnableMessageBox(FX_BOOL bEnable) = 0;
+class IFXJS_Context {
+ public:
+ virtual ~IFXJS_Context() {}
+ virtual FX_BOOL Compile(const CFX_WideString& script,
+ CFX_WideString& info) = 0;
+ virtual FX_BOOL RunScript(const CFX_WideString& script,
+ CFX_WideString& info) = 0;
+
+ virtual void OnApp_Init() = 0;
+
+ virtual void OnDoc_Open(CPDFSDK_Document* pDoc,
+ const CFX_WideString& strTargetName) = 0;
+ virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc) = 0;
+ virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc) = 0;
+ virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc) = 0;
+ virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc) = 0;
+ virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc) = 0;
+
+ virtual void OnPage_Open(CPDFSDK_Document* pTarget) = 0;
+ virtual void OnPage_Close(CPDFSDK_Document* pTarget) = 0;
+ virtual void OnPage_InView(CPDFSDK_Document* pTarget) = 0;
+ virtual void OnPage_OutView(CPDFSDK_Document* pTarget) = 0;
+
+ virtual void OnField_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget) = 0;
+ virtual void OnField_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget) = 0;
+ virtual void OnField_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget) = 0;
+ virtual void OnField_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget) = 0;
+ virtual void OnField_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value) = 0;
+ virtual void OnField_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value) = 0;
+
+ virtual void OnField_Calculate(CPDF_FormField* pSource,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc) = 0;
+ virtual void OnField_Format(CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit) = 0;
+ virtual void OnField_Keystroke(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL KeyDown,
+ FX_BOOL bModifier,
+ int& nSelEnd,
+ int& nSelStart,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit,
+ FX_BOOL bFieldFull,
+ FX_BOOL& bRc) = 0;
+ virtual void OnField_Validate(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc) = 0;
+
+ virtual void OnScreen_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_Open(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_Close(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_InView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+ virtual void OnScreen_OutView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen) = 0;
+
+ virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0;
+ virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget) = 0;
+
+ virtual void OnMenu_Exec(CPDFSDK_Document* pTarget,
+ const CFX_WideString&) = 0;
+ virtual void OnBatchExec(CPDFSDK_Document* pTarget) = 0;
+ virtual void OnConsole_Exec() = 0;
+ virtual void OnExternal_Exec() = 0;
+
+ virtual void EnableMessageBox(FX_BOOL bEnable) = 0;
};
-class IFXJS_Runtime
-{
-public:
- virtual IFXJS_Context* NewContext() = 0;
- virtual void ReleaseContext(IFXJS_Context * pContext) = 0;
- virtual IFXJS_Context* GetCurrentContext() = 0;
+class IFXJS_Runtime {
+ public:
+ virtual IFXJS_Context* NewContext() = 0;
+ virtual void ReleaseContext(IFXJS_Context* pContext) = 0;
+ virtual IFXJS_Context* GetCurrentContext() = 0;
- virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;
+ virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0;
- virtual CPDFSDK_Document* GetReaderDocument() = 0;
+ virtual CPDFSDK_Document* GetReaderDocument() = 0;
- virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) = 0;
- virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue) = 0;
+ virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue) = 0;
+ virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue) = 0;
-protected:
- ~IFXJS_Runtime() { }
+ protected:
+ ~IFXJS_Runtime() {}
};
class CPDFDoc_Environment;
class CJS_GlobalData;
-class CJS_RuntimeFactory
-{
-public:
- CJS_RuntimeFactory():m_bInit(FALSE),m_nRef(0),m_pGlobalData(NULL),m_nGlobalDataCount(0) {}
- ~CJS_RuntimeFactory();
- IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp);
- void DeleteJSRuntime(IFXJS_Runtime* pRuntime);
- void AddRef();
- void Release();
-
- CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp);
- void ReleaseGlobalData();
-private:
- FX_BOOL m_bInit;
- int m_nRef;
- CJS_GlobalData* m_pGlobalData;
- int32_t m_nGlobalDataCount;
+class CJS_RuntimeFactory {
+ public:
+ CJS_RuntimeFactory()
+ : m_bInit(FALSE), m_nRef(0), m_pGlobalData(NULL), m_nGlobalDataCount(0) {}
+ ~CJS_RuntimeFactory();
+ IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp);
+ void DeleteJSRuntime(IFXJS_Runtime* pRuntime);
+ void AddRef();
+ void Release();
+
+ CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp);
+ void ReleaseGlobalData();
+
+ private:
+ FX_BOOL m_bInit;
+ int m_nRef;
+ CJS_GlobalData* m_pGlobalData;
+ int32_t m_nGlobalDataCount;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_
diff --git a/fpdfsdk/include/javascript/Icon.h b/fpdfsdk/include/javascript/Icon.h
index 0298005f00..0b549ec613 100644
--- a/fpdfsdk/include/javascript/Icon.h
+++ b/fpdfsdk/include/javascript/Icon.h
@@ -9,32 +9,30 @@
#include "JS_Define.h"
-class Icon : public CJS_EmbedObj
-{
-public:
- Icon(CJS_Object* pJSObject);
- virtual ~Icon();
- FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- void SetStream(CPDF_Stream* pIconStream);
- CPDF_Stream* GetStream();
- void SetIconName(CFX_WideString name);
- CFX_WideString GetIconName();
-
-private:
- CPDF_Stream* m_pIconStream;
- CFX_WideString m_swIconName;
+class Icon : public CJS_EmbedObj {
+ public:
+ Icon(CJS_Object* pJSObject);
+ virtual ~Icon();
+ FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ void SetStream(CPDF_Stream* pIconStream);
+ CPDF_Stream* GetStream();
+ void SetIconName(CFX_WideString name);
+ CFX_WideString GetIconName();
+
+ private:
+ CPDF_Stream* m_pIconStream;
+ CFX_WideString m_swIconName;
};
-class CJS_Icon : public CJS_Object
-{
-public:
- CJS_Icon(JSFXObject pObject) : CJS_Object(pObject){};
- virtual ~CJS_Icon(){};
+class CJS_Icon : public CJS_Object {
+ public:
+ CJS_Icon(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Icon(){};
-public:
- DECLARE_JS_CLASS(CJS_Icon);
+ public:
+ DECLARE_JS_CLASS(CJS_Icon);
- JS_STATIC_PROP(name, Icon);
+ JS_STATIC_PROP(name, Icon);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_ICON_H_
diff --git a/fpdfsdk/include/javascript/JS_Context.h b/fpdfsdk/include/javascript/JS_Context.h
index 060bb55937..f61f37cdc6 100644
--- a/fpdfsdk/include/javascript/JS_Context.h
+++ b/fpdfsdk/include/javascript/JS_Context.h
@@ -14,84 +14,138 @@
class CJS_EventHandler;
class CJS_Runtime;
-class CJS_Context : public IFXJS_Context
-{
-public:
- CJS_Context(CJS_Runtime* pRuntime);
- virtual ~CJS_Context();
-
-public:
- virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info);
- virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info);
-
-public:
- virtual void OnApp_Init();
-
- virtual void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
- virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
- virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
- virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc);
- virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc);
- virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc);
-
- virtual void OnPage_Open(CPDFSDK_Document* pTarget);
- virtual void OnPage_Close(CPDFSDK_Document* pTarget);
- virtual void OnPage_InView(CPDFSDK_Document* pTarget);
- virtual void OnPage_OutView(CPDFSDK_Document* pTarget);
-
- virtual void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- virtual void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
- virtual void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
-
- virtual void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
- virtual void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);
- virtual void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc);
- virtual void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
-
- virtual void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- virtual void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
-
- virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
- virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget);
-
- virtual void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);
- virtual void OnBatchExec(CPDFSDK_Document* pTarget);
- virtual void OnConsole_Exec();
- virtual void OnExternal_Exec();
-
- virtual void EnableMessageBox(FX_BOOL bEnable) {m_bMsgBoxEnable = bEnable;}
- FX_BOOL IsMsgBoxEnabled() const {return m_bMsgBoxEnable;}
-
-public:
- CPDFDoc_Environment* GetReaderApp();
- CJS_Runtime* GetJSRuntime(){return m_pRuntime;}
-
- FX_BOOL DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info);
-
- CJS_EventHandler* GetEventHandler(){return m_pEventHandler;};
- CPDFSDK_Document* GetReaderDocument();
-
-private:
- CJS_Runtime* m_pRuntime;
- CJS_EventHandler* m_pEventHandler;
-
- FX_BOOL m_bBusy;
- FX_BOOL m_bMsgBoxEnable;
+class CJS_Context : public IFXJS_Context {
+ public:
+ CJS_Context(CJS_Runtime* pRuntime);
+ virtual ~CJS_Context();
+
+ public:
+ virtual FX_BOOL Compile(const CFX_WideString& script, CFX_WideString& info);
+ virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info);
+
+ public:
+ virtual void OnApp_Init();
+
+ virtual void OnDoc_Open(CPDFSDK_Document* pDoc,
+ const CFX_WideString& strTargetName);
+ virtual void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
+ virtual void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
+ virtual void OnDoc_WillSave(CPDFSDK_Document* pDoc);
+ virtual void OnDoc_DidSave(CPDFSDK_Document* pDoc);
+ virtual void OnDoc_WillClose(CPDFSDK_Document* pDoc);
+
+ virtual void OnPage_Open(CPDFSDK_Document* pTarget);
+ virtual void OnPage_Close(CPDFSDK_Document* pTarget);
+ virtual void OnPage_InView(CPDFSDK_Document* pTarget);
+ virtual void OnPage_OutView(CPDFSDK_Document* pTarget);
+
+ virtual void OnField_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ virtual void OnField_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ virtual void OnField_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ virtual void OnField_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ virtual void OnField_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value);
+ virtual void OnField_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value);
+
+ virtual void OnField_Calculate(CPDF_FormField* pSource,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc);
+ virtual void OnField_Format(CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit);
+ virtual void OnField_Keystroke(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ int& nSelEnd,
+ int& nSelStart,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit,
+ FX_BOOL bFieldFull,
+ FX_BOOL& bRc);
+ virtual void OnField_Validate(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc);
+
+ virtual void OnScreen_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_Open(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_Close(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_InView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ virtual void OnScreen_OutView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+
+ virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
+ virtual void OnLink_MouseUp(CPDFSDK_Document* pTarget);
+
+ virtual void OnMenu_Exec(CPDFSDK_Document* pTarget,
+ const CFX_WideString& strTargetName);
+ virtual void OnBatchExec(CPDFSDK_Document* pTarget);
+ virtual void OnConsole_Exec();
+ virtual void OnExternal_Exec();
+
+ virtual void EnableMessageBox(FX_BOOL bEnable) { m_bMsgBoxEnable = bEnable; }
+ FX_BOOL IsMsgBoxEnabled() const { return m_bMsgBoxEnable; }
+
+ public:
+ CPDFDoc_Environment* GetReaderApp();
+ CJS_Runtime* GetJSRuntime() { return m_pRuntime; }
+
+ FX_BOOL DoJob(int nMode, const CFX_WideString& script, CFX_WideString& info);
+
+ CJS_EventHandler* GetEventHandler() { return m_pEventHandler; };
+ CPDFSDK_Document* GetReaderDocument();
+
+ private:
+ CJS_Runtime* m_pRuntime;
+ CJS_EventHandler* m_pEventHandler;
+
+ FX_BOOL m_bBusy;
+ FX_BOOL m_bMsgBoxEnable;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_CONTEXT_H_
diff --git a/fpdfsdk/include/javascript/JS_Define.h b/fpdfsdk/include/javascript/JS_Define.h
index c480ce30c3..7490a2f636 100644
--- a/fpdfsdk/include/javascript/JS_Define.h
+++ b/fpdfsdk/include/javascript/JS_Define.h
@@ -12,46 +12,68 @@
#include "JS_Object.h"
#include "JS_Value.h"
-struct JSConstSpec
-{
- const wchar_t* pName;
- double number;
- const wchar_t* string;
- uint8_t t; //0:double 1:str
+struct JSConstSpec {
+ const wchar_t* pName;
+ double number;
+ const wchar_t* string;
+ uint8_t t; // 0:double 1:str
};
-struct JSPropertySpec
-{
- const wchar_t* pName;
- v8::AccessorGetterCallback pPropGet;
- v8::AccessorSetterCallback pPropPut;
+struct JSPropertySpec {
+ const wchar_t* pName;
+ v8::AccessorGetterCallback pPropGet;
+ v8::AccessorSetterCallback pPropPut;
};
-struct JSMethodSpec
-{
- const wchar_t* pName;
- v8::FunctionCallback pMethodCall;
+struct JSMethodSpec {
+ const wchar_t* pName;
+ v8::FunctionCallback pMethodCall;
};
-/* ====================================== PUBLIC DEFINE SPEC ============================================== */
-#define JS_WIDESTRING(widestring) L###widestring
-
-#define BEGIN_JS_STATIC_CONST(js_class_name) JSConstSpec js_class_name::JS_Class_Consts[] = {
-#define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) {JS_WIDESTRING(const_name), pValue, L"", 0},
-#define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) {JS_WIDESTRING(const_name), 0, JS_WIDESTRING(pValue), 1},
-#define END_JS_STATIC_CONST() {0, 0, 0, 0}};
-
-#define BEGIN_JS_STATIC_PROP(js_class_name) JSPropertySpec js_class_name::JS_Class_Properties[] = {
-#define JS_STATIC_PROP_ENTRY(prop_name) {JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static},
-#define END_JS_STATIC_PROP() {0, 0, 0}};
-
-#define BEGIN_JS_STATIC_METHOD(js_class_name) JSMethodSpec js_class_name::JS_Class_Methods[] = {
-#define JS_STATIC_METHOD_ENTRY(method_name) {JS_WIDESTRING(method_name), method_name##_static},
-#define END_JS_STATIC_METHOD() {0, 0}};
-
-/* ======================================== PROP CALLBACK ============================================ */
-
-template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
+/* ====================================== PUBLIC DEFINE SPEC
+ * ============================================== */
+#define JS_WIDESTRING(widestring) L## #widestring
+
+#define BEGIN_JS_STATIC_CONST(js_class_name) \
+ JSConstSpec js_class_name::JS_Class_Consts[] = {
+#define JS_STATIC_CONST_ENTRY_NUMBER(const_name, pValue) \
+ { JS_WIDESTRING(const_name), pValue, L"", 0 } \
+ ,
+#define JS_STATIC_CONST_ENTRY_STRING(const_name, pValue) \
+ { JS_WIDESTRING(const_name), 0, JS_WIDESTRING(pValue), 1 } \
+ ,
+#define END_JS_STATIC_CONST() \
+ { 0, 0, 0, 0 } \
+ } \
+ ;
+
+#define BEGIN_JS_STATIC_PROP(js_class_name) \
+ JSPropertySpec js_class_name::JS_Class_Properties[] = {
+#define JS_STATIC_PROP_ENTRY(prop_name) \
+ { \
+ JS_WIDESTRING(prop_name), get_##prop_name##_static, set_##prop_name##_static \
+ } \
+ ,
+#define END_JS_STATIC_PROP() \
+ { 0, 0, 0 } \
+ } \
+ ;
+
+#define BEGIN_JS_STATIC_METHOD(js_class_name) \
+ JSMethodSpec js_class_name::JS_Class_Methods[] = {
+#define JS_STATIC_METHOD_ENTRY(method_name) \
+ { JS_WIDESTRING(method_name), method_name##_static } \
+ ,
+#define END_JS_STATIC_METHOD() \
+ { 0, 0 } \
+ } \
+ ;
+
+/* ======================================== PROP CALLBACK
+ * ============================================ */
+
+template <class C,
+ FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropGetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -61,17 +83,19 @@ void JSPropGetter(const char* prop_name_string,
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_PropValue value(isolate);
value.StartGetting();
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());
+ CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate, info.Holder());
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
CFX_WideString sError;
if (!(pObj->*M)(pRuntimeContext, value, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, sError));
+ JS_Error(isolate,
+ JSFormatErrorString(class_name_string, prop_name_string, sError));
return;
}
info.GetReturnValue().Set((v8::Local<v8::Value>)value);
}
-template <class C, FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
+template <class C,
+ FX_BOOL (C::*M)(IFXJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropSetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -82,32 +106,37 @@ void JSPropSetter(const char* prop_name_string,
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_PropValue propValue(CJS_Value(isolate, value, VT_unknown));
propValue.StartSetting();
- CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate,info.Holder());
+ CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate, info.Holder());
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
CFX_WideString sError;
if (!(pObj->*M)(pRuntimeContext, propValue, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name_string, prop_name_string, sError));
+ JS_Error(isolate,
+ JSFormatErrorString(class_name_string, prop_name_string, sError));
}
}
-#define JS_STATIC_PROP(prop_name, class_name) \
- static void get_##prop_name##_static( \
- v8::Local<v8::String> property, \
- const v8::PropertyCallbackInfo<v8::Value>& info) { \
- JSPropGetter<class_name, &class_name::prop_name>( \
- #prop_name, #class_name, property, info); \
- } \
- static void set_##prop_name##_static( \
- v8::Local<v8::String> property, \
- v8::Local<v8::Value> value, \
- const v8::PropertyCallbackInfo<void>& info) { \
- JSPropSetter<class_name, &class_name::prop_name>( \
- #prop_name, #class_name, property, value, info); \
+#define JS_STATIC_PROP(prop_name, class_name) \
+ static void get_##prop_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Value>& info) { \
+ JSPropGetter<class_name, &class_name::prop_name>(#prop_name, #class_name, \
+ property, info); \
+ } \
+ static void set_##prop_name##_static( \
+ v8::Local<v8::String> property, v8::Local<v8::Value> value, \
+ const v8::PropertyCallbackInfo<void>& info) { \
+ JSPropSetter<class_name, &class_name::prop_name>(#prop_name, #class_name, \
+ property, value, info); \
}
-/* ========================================= METHOD CALLBACK =========================================== */
+/* ========================================= METHOD CALLBACK
+ * =========================================== */
-template <class C, FX_BOOL (C::*M)(IFXJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)>
+template <class C,
+ FX_BOOL (C::*M)(IFXJS_Context*,
+ const CJS_Parameters&,
+ CJS_Value&,
+ CFX_WideString&)>
void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -115,121 +144,140 @@ void JSMethod(const char* method_name_string,
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Parameters parameters;
- for (unsigned int i = 0; i<(unsigned int)info.Length(); i++) {
+ for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));
}
CJS_Value valueRes(isolate);
- CJS_Object* pJSObj = (CJS_Object *)JS_GetPrivate(isolate,info.Holder());
+ CJS_Object* pJSObj = (CJS_Object*)JS_GetPrivate(isolate, info.Holder());
C* pObj = reinterpret_cast<C*>(pJSObj->GetEmbedObject());
CFX_WideString sError;
if (!(pObj->*M)(pRuntimeContext, parameters, valueRes, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name_string, method_name_string, sError));
+ JS_Error(isolate, JSFormatErrorString(class_name_string, method_name_string,
+ sError));
return;
}
info.GetReturnValue().Set(valueRes.ToV8Value());
}
-#define JS_STATIC_METHOD(method_name, class_name) \
- static void method_name##_static( \
- const v8::FunctionCallbackInfo<v8::Value>& info) { \
- JSMethod<class_name, &class_name::method_name>( \
- #method_name, #class_name, info); \
+#define JS_STATIC_METHOD(method_name, class_name) \
+ static void method_name##_static( \
+ const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ JSMethod<class_name, &class_name::method_name>(#method_name, #class_name, \
+ info); \
}
#define JS_SPECIAL_STATIC_METHOD(method_name, class_alternate, class_name) \
- static void method_name##_static( \
- const v8::FunctionCallbackInfo<v8::Value>& info) { \
- JSMethod<class_alternate, &class_alternate::method_name>( \
- #method_name, #class_name, info); \
+ static void method_name##_static( \
+ const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ JSMethod<class_alternate, &class_alternate::method_name>( \
+ #method_name, #class_name, info); \
}
-/* ===================================== JS CLASS =============================================== */
-
-#define DECLARE_JS_CLASS(js_class_name) \
- static void JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global);\
- static void JSDestructor(JSFXObject obj);\
- static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static JSConstSpec JS_Class_Consts[];\
- static JSPropertySpec JS_Class_Properties[];\
- static JSMethodSpec JS_Class_Methods[];\
- static const wchar_t* m_pClassName
-
-#define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
-const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
-void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global)\
-{\
- CJS_Object* pObj = FX_NEW js_class_name(obj);\
- pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
- JS_SetPrivate(NULL,obj,(void*)pObj); \
- pObj->InitInstance(cc);\
-}\
-\
-void js_class_name::JSDestructor(JSFXObject obj) \
-{\
- js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
- ASSERT(pObj != NULL);\
- pObj->ExitInstance();\
- delete pObj;\
-}\
-\
-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
-{\
- int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor);\
- if (nObjDefnID >= 0)\
- {\
- for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\
- {\
- if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet, JS_Class_Properties[j].pPropPut) < 0) return -1;\
- }\
- for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\
- {\
- if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName, JS_Class_Methods[k].pMethodCall) < 0) return -1;\
- }\
- return nObjDefnID;\
- }\
- return -1;\
-}
+/* ===================================== JS CLASS
+ * =============================================== */
+
+#define DECLARE_JS_CLASS(js_class_name) \
+ static void JSConstructor(IFXJS_Context* cc, JSFXObject obj, \
+ JSFXObject global); \
+ static void JSDestructor(JSFXObject obj); \
+ static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType); \
+ static JSConstSpec JS_Class_Consts[]; \
+ static JSPropertySpec JS_Class_Properties[]; \
+ static JSMethodSpec JS_Class_Methods[]; \
+ static const wchar_t* m_pClassName
+
+#define IMPLEMENT_JS_CLASS_RICH(js_class_name, class_alternate, class_name) \
+ const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \
+ void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, \
+ JSFXObject global) { \
+ CJS_Object* pObj = FX_NEW js_class_name(obj); \
+ pObj->SetEmbedObject(FX_NEW class_alternate(pObj)); \
+ JS_SetPrivate(NULL, obj, (void*)pObj); \
+ pObj->InitInstance(cc); \
+ } \
+ \
+ void js_class_name::JSDestructor(JSFXObject obj) { \
+ js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL, obj); \
+ ASSERT(pObj != NULL); \
+ pObj->ExitInstance(); \
+ delete pObj; \
+ } \
+ \
+ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType) { \
+ int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, \
+ eObjType, JSConstructor, JSDestructor); \
+ if (nObjDefnID >= 0) { \
+ for (int j = 0, \
+ szj = sizeof(JS_Class_Properties) / sizeof(JSPropertySpec) - 1; \
+ j < szj; j++) { \
+ if (JS_DefineObjProperty(pRuntime, nObjDefnID, \
+ JS_Class_Properties[j].pName, \
+ JS_Class_Properties[j].pPropGet, \
+ JS_Class_Properties[j].pPropPut) < 0) \
+ return -1; \
+ } \
+ for (int k = 0, \
+ szk = sizeof(JS_Class_Methods) / sizeof(JSMethodSpec) - 1; \
+ k < szk; k++) { \
+ if (JS_DefineObjMethod(pRuntime, nObjDefnID, \
+ JS_Class_Methods[k].pName, \
+ JS_Class_Methods[k].pMethodCall) < 0) \
+ return -1; \
+ } \
+ return nObjDefnID; \
+ } \
+ return -1; \
+ }
-#define IMPLEMENT_JS_CLASS(js_class_name, class_name) IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)
-
-/* ======================================== CONST CLASS ============================================ */
-
-#define DECLARE_JS_CLASS_CONST() \
- static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static JSConstSpec JS_Class_Consts[];\
- static const wchar_t* m_pClassName
-
-#define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
-const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
-{\
- int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, NULL, NULL);\
- if (nObjDefnID >=0)\
- {\
- for (int i=0, sz=sizeof(JS_Class_Consts)/sizeof(JSConstSpec)-1; i<sz; i++)\
- {\
- if (JS_Class_Consts[i].t == 0)\
- {\
- if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewNumber(pRuntime,JS_Class_Consts[i].number)) < 0) return -1;\
- }\
- else\
- {\
- if (JS_DefineObjConst(pRuntime, nObjDefnID, JS_Class_Consts[i].pName, JS_NewString(pRuntime,JS_Class_Consts[i].string)) < 0) return -1;\
- }\
- }\
- return nObjDefnID;\
- }\
- return -1;\
-}
+#define IMPLEMENT_JS_CLASS(js_class_name, class_name) \
+ IMPLEMENT_JS_CLASS_RICH(js_class_name, class_name, class_name)
+
+/* ======================================== CONST CLASS
+ * ============================================ */
+
+#define DECLARE_JS_CLASS_CONST() \
+ static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType); \
+ static JSConstSpec JS_Class_Consts[]; \
+ static const wchar_t* m_pClassName
+
+#define IMPLEMENT_JS_CLASS_CONST(js_class_name, class_name) \
+ const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \
+ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType) { \
+ int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, \
+ eObjType, NULL, NULL); \
+ if (nObjDefnID >= 0) { \
+ for (int i = 0, sz = sizeof(JS_Class_Consts) / sizeof(JSConstSpec) - 1; \
+ i < sz; i++) { \
+ if (JS_Class_Consts[i].t == 0) { \
+ if (JS_DefineObjConst( \
+ pRuntime, nObjDefnID, JS_Class_Consts[i].pName, \
+ JS_NewNumber(pRuntime, JS_Class_Consts[i].number)) < 0) \
+ return -1; \
+ } else { \
+ if (JS_DefineObjConst( \
+ pRuntime, nObjDefnID, JS_Class_Consts[i].pName, \
+ JS_NewString(pRuntime, JS_Class_Consts[i].string)) < 0) \
+ return -1; \
+ } \
+ } \
+ return nObjDefnID; \
+ } \
+ return -1; \
+ }
-/* ===================================== SPECIAL JS CLASS =============================================== */
+/* ===================================== SPECIAL JS CLASS
+ * =============================================== */
template <class Alt>
-void JSSpecialPropQuery(const char *, v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info) {
+void JSSpecialPropQuery(const char*,
+ v8::Local<v8::String> property,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
v8::Isolate* isolate = info.GetIsolate();
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
- CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
+ CFX_WideString propname =
+ CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
+ CJS_Object* pJSObj =
+ reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
FX_BOOL bRet = pObj->QueryProperty(propname.c_str());
info.GetReturnValue().Set(bRet ? 4 : 0);
@@ -243,16 +291,18 @@ void JSSpecialPropGet(const char* class_name,
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
- CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
+ CJS_Object* pJSObj =
+ reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
+ CFX_WideString propname =
+ CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
CFX_WideString sError;
CJS_PropValue value(isolate);
value.StartGetting();
if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), value, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError));
- return;
+ JS_Error(isolate, JSFormatErrorString(class_name, "GetProperty", sError));
+ return;
}
info.GetReturnValue().Set((v8::Local<v8::Value>)value);
}
@@ -266,15 +316,17 @@ void JSSpecialPropPut(const char* class_name,
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
- CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
+ CJS_Object* pJSObj =
+ reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
+ CFX_WideString propname =
+ CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
CFX_WideString sError;
- CJS_PropValue PropValue(CJS_Value(isolate,value,VT_unknown));
+ CJS_PropValue PropValue(CJS_Value(isolate, value, VT_unknown));
PropValue.StartSetting();
if (!pObj->DoProperty(pRuntimeContext, propname.c_str(), PropValue, sError)) {
- JS_Error(isolate, JSFormatErrorString(class_name, "PutProperty", sError));
+ JS_Error(isolate, JSFormatErrorString(class_name, "PutProperty", sError));
}
}
@@ -286,10 +338,12 @@ void JSSpecialPropDel(const char* class_name,
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
- CJS_Object* pJSObj = reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
+ CJS_Object* pJSObj =
+ reinterpret_cast<CJS_Object*>(JS_GetPrivate(isolate, info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
v8::String::Utf8Value utf8_value(property);
- CFX_WideString propname = CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
+ CFX_WideString propname =
+ CFX_WideString::FromUTF8(*utf8_value, utf8_value.length());
CFX_WideString sError;
if (!pObj->DelProperty(pRuntimeContext, propname.c_str(), sError)) {
CFX_ByteString cbName;
@@ -298,83 +352,114 @@ void JSSpecialPropDel(const char* class_name,
}
}
-#define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
- static void JSConstructor(IFXJS_Context* cc, JSFXObject obj, JSFXObject global);\
- static void JSDestructor(JSFXObject obj);\
- static JSConstSpec JS_Class_Consts[];\
- static JSPropertySpec JS_Class_Properties[];\
- static JSMethodSpec JS_Class_Methods[];\
- static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType);\
- static const wchar_t* m_pClassName;\
- static void queryprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info);\
- static void getprop_##js_class_name##_static(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info);\
- static void putprop_##js_class_name##_static(v8::Local<v8::String> property,v8::Local<v8::Value> value,const v8::PropertyCallbackInfo<v8::Value>& info);\
- static void delprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Boolean>& info)
+#define DECLARE_SPECIAL_JS_CLASS(js_class_name) \
+ static void JSConstructor(IFXJS_Context* cc, JSFXObject obj, \
+ JSFXObject global); \
+ static void JSDestructor(JSFXObject obj); \
+ static JSConstSpec JS_Class_Consts[]; \
+ static JSPropertySpec JS_Class_Properties[]; \
+ static JSMethodSpec JS_Class_Methods[]; \
+ static int Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType); \
+ static const wchar_t* m_pClassName; \
+ static void queryprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Integer>& info); \
+ static void getprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Value>& info); \
+ static void putprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, v8::Local<v8::Value> value, \
+ const v8::PropertyCallbackInfo<v8::Value>& info); \
+ static void delprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Boolean>& info)
#define IMPLEMENT_SPECIAL_JS_CLASS(js_class_name, class_alternate, class_name) \
-const wchar_t * js_class_name::m_pClassName = JS_WIDESTRING(class_name);\
-void js_class_name::queryprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Integer>& info) { \
- JSSpecialPropQuery<class_alternate>(#class_name, property, info); \
-}\
-void js_class_name::getprop_##js_class_name##_static(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& info) { \
- JSSpecialPropGet<class_alternate>(#class_name, property, info); \
-} \
-void js_class_name::putprop_##js_class_name##_static(v8::Local<v8::String> property,v8::Local<v8::Value> value,const v8::PropertyCallbackInfo<v8::Value>& info) {\
- JSSpecialPropPut<class_alternate>(#class_name, property, value, info); \
-}\
-void js_class_name::delprop_##js_class_name##_static(v8::Local<v8::String> property,const v8::PropertyCallbackInfo<v8::Boolean>& info) { \
- JSSpecialPropDel<class_alternate>(#class_name, property, info); \
-} \
-void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj,JSFXObject global)\
-{\
- CJS_Object* pObj = FX_NEW js_class_name(obj);\
- pObj->SetEmbedObject(FX_NEW class_alternate(pObj));\
- JS_SetPrivate(NULL,obj, (void*)pObj); \
- pObj->InitInstance(cc);\
-}\
-\
-void js_class_name::JSDestructor(JSFXObject obj) \
-{\
- js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL,obj);\
- ASSERT(pObj != NULL);\
- pObj->ExitInstance();\
- delete pObj;\
-}\
-\
-int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType)\
-{\
-\
- int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, eObjType, JSConstructor, JSDestructor);\
-\
- if (nObjDefnID >= 0)\
- {\
- for (int j=0, szj=sizeof(JS_Class_Properties)/sizeof(JSPropertySpec)-1; j<szj; j++)\
- {\
- if (JS_DefineObjProperty(pRuntime, nObjDefnID, JS_Class_Properties[j].pName, JS_Class_Properties[j].pPropGet,JS_Class_Properties[j].pPropPut)<0)return -1;\
- }\
-\
- for (int k=0, szk=sizeof(JS_Class_Methods)/sizeof(JSMethodSpec)-1; k<szk; k++)\
- {\
- if (JS_DefineObjMethod(pRuntime, nObjDefnID,JS_Class_Methods[k].pName,JS_Class_Methods[k].pMethodCall)<0)return -1;\
- }\
- if (JS_DefineObjAllProperties(pRuntime, nObjDefnID, js_class_name::queryprop_##js_class_name##_static, js_class_name::getprop_##js_class_name##_static,js_class_name::putprop_##js_class_name##_static,js_class_name::delprop_##js_class_name##_static)<0) return -1;\
-\
- return nObjDefnID;\
- }\
-\
- return -1;\
-}
+ const wchar_t* js_class_name::m_pClassName = JS_WIDESTRING(class_name); \
+ void js_class_name::queryprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Integer>& info) { \
+ JSSpecialPropQuery<class_alternate>(#class_name, property, info); \
+ } \
+ void js_class_name::getprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Value>& info) { \
+ JSSpecialPropGet<class_alternate>(#class_name, property, info); \
+ } \
+ void js_class_name::putprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, v8::Local<v8::Value> value, \
+ const v8::PropertyCallbackInfo<v8::Value>& info) { \
+ JSSpecialPropPut<class_alternate>(#class_name, property, value, info); \
+ } \
+ void js_class_name::delprop_##js_class_name##_static( \
+ v8::Local<v8::String> property, \
+ const v8::PropertyCallbackInfo<v8::Boolean>& info) { \
+ JSSpecialPropDel<class_alternate>(#class_name, property, info); \
+ } \
+ void js_class_name::JSConstructor(IFXJS_Context* cc, JSFXObject obj, \
+ JSFXObject global) { \
+ CJS_Object* pObj = FX_NEW js_class_name(obj); \
+ pObj->SetEmbedObject(FX_NEW class_alternate(pObj)); \
+ JS_SetPrivate(NULL, obj, (void*)pObj); \
+ pObj->InitInstance(cc); \
+ } \
+ \
+ void js_class_name::JSDestructor(JSFXObject obj) { \
+ js_class_name* pObj = (js_class_name*)JS_GetPrivate(NULL, obj); \
+ ASSERT(pObj != NULL); \
+ pObj->ExitInstance(); \
+ delete pObj; \
+ } \
+ \
+ int js_class_name::Init(IJS_Runtime* pRuntime, FXJSOBJTYPE eObjType) { \
+ int nObjDefnID = JS_DefineObj(pRuntime, js_class_name::m_pClassName, \
+ eObjType, JSConstructor, JSDestructor); \
+ \
+ if (nObjDefnID >= 0) { \
+ for (int j = 0, \
+ szj = sizeof(JS_Class_Properties) / sizeof(JSPropertySpec) - 1; \
+ j < szj; j++) { \
+ if (JS_DefineObjProperty(pRuntime, nObjDefnID, \
+ JS_Class_Properties[j].pName, \
+ JS_Class_Properties[j].pPropGet, \
+ JS_Class_Properties[j].pPropPut) < 0) \
+ return -1; \
+ } \
+ \
+ for (int k = 0, \
+ szk = sizeof(JS_Class_Methods) / sizeof(JSMethodSpec) - 1; \
+ k < szk; k++) { \
+ if (JS_DefineObjMethod(pRuntime, nObjDefnID, \
+ JS_Class_Methods[k].pName, \
+ JS_Class_Methods[k].pMethodCall) < 0) \
+ return -1; \
+ } \
+ if (JS_DefineObjAllProperties( \
+ pRuntime, nObjDefnID, \
+ js_class_name::queryprop_##js_class_name##_static, \
+ js_class_name::getprop_##js_class_name##_static, \
+ js_class_name::putprop_##js_class_name##_static, \
+ js_class_name::delprop_##js_class_name##_static) < 0) \
+ return -1; \
+ \
+ return nObjDefnID; \
+ } \
+ \
+ return -1; \
+ }
-/* ======================================== GLOBAL METHODS ============================================ */
+/* ======================================== GLOBAL METHODS
+ * ============================================ */
-template <FX_BOOL (*F)(IFXJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)>
-void JSGlobalFunc(const char *func_name_string,
+template <FX_BOOL (
+ *F)(IFXJS_Context*, const CJS_Parameters&, CJS_Value&, CFX_WideString&)>
+void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
v8::Isolate* isolate = info.GetIsolate();
IFXJS_Runtime* pRuntime = (IFXJS_Runtime*)isolate->GetData(2);
IFXJS_Context* pRuntimeContext = pRuntime->GetCurrentContext();
CJS_Parameters parameters;
- for (unsigned int i = 0; i<(unsigned int)info.Length(); i++) {
+ for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) {
parameters.push_back(CJS_Value(isolate, info[i], VT_unknown));
}
CJS_Value valueRes(isolate);
@@ -386,63 +471,71 @@ void JSGlobalFunc(const char *func_name_string,
info.GetReturnValue().Set(valueRes.ToV8Value());
}
-#define JS_STATIC_GLOBAL_FUN(fun_name) \
- static void fun_name##_static(const v8::FunctionCallbackInfo<v8::Value>& info) { \
- JSGlobalFunc<fun_name>(#fun_name, info); \
+#define JS_STATIC_GLOBAL_FUN(fun_name) \
+ static void fun_name##_static( \
+ const v8::FunctionCallbackInfo<v8::Value>& info) { \
+ JSGlobalFunc<fun_name>(#fun_name, info); \
}
-#define JS_STATIC_DECLARE_GLOBAL_FUN() \
-static JSMethodSpec global_methods[]; \
-static int Init(IJS_Runtime* pRuntime)
+#define JS_STATIC_DECLARE_GLOBAL_FUN() \
+ static JSMethodSpec global_methods[]; \
+ static int Init(IJS_Runtime* pRuntime)
#define BEGIN_JS_STATIC_GLOBAL_FUN(js_class_name) \
-JSMethodSpec js_class_name::global_methods[] = {
-
-#define JS_STATIC_GLOBAL_FUN_ENTRY(method_name) JS_STATIC_METHOD_ENTRY(method_name)
+ JSMethodSpec js_class_name::global_methods[] = {
+#define JS_STATIC_GLOBAL_FUN_ENTRY(method_name) \
+ JS_STATIC_METHOD_ENTRY(method_name)
#define END_JS_STATIC_GLOBAL_FUN() END_JS_STATIC_METHOD()
-#define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \
-int js_class_name::Init(IJS_Runtime* pRuntime)\
-{\
- for (int i=0, sz=sizeof(js_class_name::global_methods)/sizeof(JSMethodSpec)-1; i<sz; i++)\
- {\
- if (JS_DefineGlobalMethod(pRuntime,\
- js_class_name::global_methods[i].pName,\
- js_class_name::global_methods[i].pMethodCall\
- ) < 0\
- )return -1;\
- }\
- return 0;\
-}
-
-/* ======================================== GLOBAL CONSTS ============================================ */
-#define DEFINE_GLOBAL_CONST(pRuntime, const_name , const_value)\
-if (JS_DefineGlobalConst(pRuntime,JS_WIDESTRING(const_name),JS_NewString(pRuntime,JS_WIDESTRING(const_value)))) return -1
-
-/* ======================================== GLOBAL ARRAYS ============================================ */
+#define IMPLEMENT_JS_STATIC_GLOBAL_FUN(js_class_name) \
+ int js_class_name::Init(IJS_Runtime* pRuntime) { \
+ for (int i = 0, sz = sizeof(js_class_name::global_methods) / \
+ sizeof(JSMethodSpec) - \
+ 1; \
+ i < sz; i++) { \
+ if (JS_DefineGlobalMethod( \
+ pRuntime, js_class_name::global_methods[i].pName, \
+ js_class_name::global_methods[i].pMethodCall) < 0) \
+ return -1; \
+ } \
+ return 0; \
+ }
-#define DEFINE_GLOBAL_ARRAY(pRuntime)\
-int size = FX_ArraySize(ArrayContent);\
-\
-CJS_Array array(pRuntime);\
-for (int i=0; i<size; i++) array.SetElement(i,CJS_Value(pRuntime,ArrayContent[i]));\
-\
-CJS_PropValue prop(pRuntime);\
-prop << array;\
-if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, prop.ToV8Value()) < 0)\
- return -1
+/* ======================================== GLOBAL CONSTS
+ * ============================================ */
+#define DEFINE_GLOBAL_CONST(pRuntime, const_name, const_value) \
+ if (JS_DefineGlobalConst( \
+ pRuntime, JS_WIDESTRING(const_name), \
+ JS_NewString(pRuntime, JS_WIDESTRING(const_value)))) \
+ return -1
+
+/* ======================================== GLOBAL ARRAYS
+ * ============================================ */
+
+#define DEFINE_GLOBAL_ARRAY(pRuntime) \
+ int size = FX_ArraySize(ArrayContent); \
+ \
+ CJS_Array array(pRuntime); \
+ for (int i = 0; i < size; i++) \
+ array.SetElement(i, CJS_Value(pRuntime, ArrayContent[i])); \
+ \
+ CJS_PropValue prop(pRuntime); \
+ prop << array; \
+ if (JS_DefineGlobalConst(pRuntime, (const wchar_t*)ArrayName, \
+ prop.ToV8Value()) < 0) \
+ return -1
/* ============================================================ */
-#define VALUE_NAME_STRING L"string"
-#define VALUE_NAME_NUMBER L"number"
-#define VALUE_NAME_BOOLEAN L"boolean"
-#define VALUE_NAME_DATE L"date"
-#define VALUE_NAME_OBJECT L"object"
-#define VALUE_NAME_FXOBJ L"fxobj"
-#define VALUE_NAME_NULL L"null"
-#define VALUE_NAME_UNDEFINED L"undefined"
+#define VALUE_NAME_STRING L"string"
+#define VALUE_NAME_NUMBER L"number"
+#define VALUE_NAME_BOOLEAN L"boolean"
+#define VALUE_NAME_DATE L"date"
+#define VALUE_NAME_OBJECT L"object"
+#define VALUE_NAME_FXOBJ L"fxobj"
+#define VALUE_NAME_NULL L"null"
+#define VALUE_NAME_UNDEFINED L"undefined"
FXJSVALUETYPE GET_VALUE_TYPE(v8::Local<v8::Value> p);
diff --git a/fpdfsdk/include/javascript/JS_EventHandler.h b/fpdfsdk/include/javascript/JS_EventHandler.h
index 62afb829e7..5e4982c1df 100644
--- a/fpdfsdk/include/javascript/JS_EventHandler.h
+++ b/fpdfsdk/include/javascript/JS_EventHandler.h
@@ -17,157 +17,204 @@ class CPDF_Bookmark;
class CPDF_FormField;
class Field;
-enum JS_EVENT_T
-{
- JET_UNKNOWN,
- JET_APP_INIT,
- JET_DOC_OPEN,
- JET_DOC_WILLPRINT,
- JET_DOC_DIDPRINT,
- JET_DOC_WILLSAVE,
- JET_DOC_DIDSAVE,
- JET_DOC_WILLCLOSE,
- JET_PAGE_OPEN,
- JET_PAGE_CLOSE,
- JET_PAGE_INVIEW,
- JET_PAGE_OUTVIEW,
- JET_FIELD_MOUSEDOWN,
- JET_FIELD_MOUSEUP,
- JET_FIELD_MOUSEENTER,
- JET_FIELD_MOUSEEXIT,
- JET_FIELD_FOCUS,
- JET_FIELD_BLUR,
- JET_FIELD_KEYSTROKE,
- JET_FIELD_VALIDATE,
- JET_FIELD_CALCULATE,
- JET_FIELD_FORMAT,
- JET_SCREEN_FOCUS,
- JET_SCREEN_BLUR,
- JET_SCREEN_OPEN,
- JET_SCREEN_CLOSE,
- JET_SCREEN_MOUSEDOWN,
- JET_SCREEN_MOUSEUP,
- JET_SCREEN_MOUSEENTER,
- JET_SCREEN_MOUSEEXIT,
- JET_SCREEN_INVIEW,
- JET_SCREEN_OUTVIEW,
- JET_BATCH_EXEC,
- JET_MENU_EXEC,
- JET_CONSOLE_EXEC,
- JET_EXTERNAL_EXEC,
- JET_BOOKMARK_MOUSEUP,
- JET_LINK_MOUSEUP
+enum JS_EVENT_T {
+ JET_UNKNOWN,
+ JET_APP_INIT,
+ JET_DOC_OPEN,
+ JET_DOC_WILLPRINT,
+ JET_DOC_DIDPRINT,
+ JET_DOC_WILLSAVE,
+ JET_DOC_DIDSAVE,
+ JET_DOC_WILLCLOSE,
+ JET_PAGE_OPEN,
+ JET_PAGE_CLOSE,
+ JET_PAGE_INVIEW,
+ JET_PAGE_OUTVIEW,
+ JET_FIELD_MOUSEDOWN,
+ JET_FIELD_MOUSEUP,
+ JET_FIELD_MOUSEENTER,
+ JET_FIELD_MOUSEEXIT,
+ JET_FIELD_FOCUS,
+ JET_FIELD_BLUR,
+ JET_FIELD_KEYSTROKE,
+ JET_FIELD_VALIDATE,
+ JET_FIELD_CALCULATE,
+ JET_FIELD_FORMAT,
+ JET_SCREEN_FOCUS,
+ JET_SCREEN_BLUR,
+ JET_SCREEN_OPEN,
+ JET_SCREEN_CLOSE,
+ JET_SCREEN_MOUSEDOWN,
+ JET_SCREEN_MOUSEUP,
+ JET_SCREEN_MOUSEENTER,
+ JET_SCREEN_MOUSEEXIT,
+ JET_SCREEN_INVIEW,
+ JET_SCREEN_OUTVIEW,
+ JET_BATCH_EXEC,
+ JET_MENU_EXEC,
+ JET_CONSOLE_EXEC,
+ JET_EXTERNAL_EXEC,
+ JET_BOOKMARK_MOUSEUP,
+ JET_LINK_MOUSEUP
};
-class CJS_EventHandler
-{
-public:
- CJS_EventHandler(CJS_Context * pContext);
- virtual ~CJS_EventHandler();
-
- void OnApp_Init();
-
- void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
- void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
- void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
- void OnDoc_WillSave(CPDFSDK_Document* pDoc);
- void OnDoc_DidSave(CPDFSDK_Document* pDoc);
- void OnDoc_WillClose(CPDFSDK_Document* pDoc);
-
- void OnPage_Open(CPDFSDK_Document* pDoc);
- void OnPage_Close(CPDFSDK_Document* pDoc);
- void OnPage_InView(CPDFSDK_Document* pTarget);
- void OnPage_OutView(CPDFSDK_Document* pTarget);
-
- void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
- void OnField_Format(CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit);
- void OnField_Keystroke(CFX_WideString& strChange, const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown, FX_BOOL bModifier, int &nSelEnd,int &nSelStart, FX_BOOL bShift,
- CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL bWillCommit,
- FX_BOOL bFieldFull, FX_BOOL &bRc);
- void OnField_Validate(CFX_WideString& strChange, const CFX_WideString& strChangeEx, FX_BOOL bKeyDown,
- FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc);
-
- void OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField *pTarget);
- void OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
- void OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_FormField* pTarget, const CFX_WideString& Value);
-
- void OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
- void OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
-
- void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
- void OnLink_MouseUp(CPDFSDK_Document* pTarget);
-
- void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString& strTargetName);
- void OnBatchExec(CPDFSDK_Document *pTarget);
- void OnConsole_Exec();
- void OnExternal_Exec();
-
-public:
- void Initial(JS_EVENT_T type);
- void Destroy();
- FX_BOOL IsValid();
-
-
- CFX_WideString& Change();
- CFX_WideString ChangeEx();
- int CommitKey();
- FX_BOOL FieldFull();
- FX_BOOL KeyDown();
- FX_BOOL Modifier();
- const FX_WCHAR* Name();
- const FX_WCHAR* Type();
- FX_BOOL& Rc();
- int& SelEnd();
- int& SelStart();
- FX_BOOL Shift();
- Field* Source();
- Field* Target_Field();
- CFX_WideString& Value();
- FX_BOOL WillCommit();
- CFX_WideString TargetName();
-
- JS_EVENT_T EventType() {return m_eEventType;};
-
-public:
- CJS_Context* m_pJSContext;
- JS_EVENT_T m_eEventType;
- FX_BOOL m_bValid;
-
- CFX_WideString m_strTargetName;
- CFX_WideString m_strSourceName;
- CFX_WideString* m_pWideStrChange;
- CFX_WideString m_WideStrChangeDu;
- CFX_WideString m_WideStrChangeEx;
- int m_nCommitKey;
- FX_BOOL m_bKeyDown;
- FX_BOOL m_bModifier;
- FX_BOOL m_bShift;
- int* m_pISelEnd;
- int m_nSelEndDu;
- int* m_pISelStart;
- int m_nSelStartDu;
- FX_BOOL m_bWillCommit;
- CFX_WideString* m_pValue;
- FX_BOOL m_bFieldFull;
- FX_BOOL* m_pbRc;
- FX_BOOL m_bRcDu;
-
- CPDFSDK_Document* m_pSourceDoc;
- CPDF_Bookmark* m_pTargetBookMark;
- CPDFSDK_Document* m_pTargetDoc;
- CPDFSDK_Annot* m_pTargetAnnot;
+class CJS_EventHandler {
+ public:
+ CJS_EventHandler(CJS_Context* pContext);
+ virtual ~CJS_EventHandler();
+
+ void OnApp_Init();
+
+ void OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName);
+ void OnDoc_WillPrint(CPDFSDK_Document* pDoc);
+ void OnDoc_DidPrint(CPDFSDK_Document* pDoc);
+ void OnDoc_WillSave(CPDFSDK_Document* pDoc);
+ void OnDoc_DidSave(CPDFSDK_Document* pDoc);
+ void OnDoc_WillClose(CPDFSDK_Document* pDoc);
+
+ void OnPage_Open(CPDFSDK_Document* pDoc);
+ void OnPage_Close(CPDFSDK_Document* pDoc);
+ void OnPage_InView(CPDFSDK_Document* pTarget);
+ void OnPage_OutView(CPDFSDK_Document* pTarget);
+
+ void OnField_Calculate(CPDF_FormField* pSource,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc);
+ void OnField_Format(CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit);
+ void OnField_Keystroke(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL KeyDown,
+ FX_BOOL bModifier,
+ int& nSelEnd,
+ int& nSelStart,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL bWillCommit,
+ FX_BOOL bFieldFull,
+ FX_BOOL& bRc);
+ void OnField_Validate(CFX_WideString& strChange,
+ const CFX_WideString& strChangeEx,
+ FX_BOOL bKeyDown,
+ FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ CFX_WideString& Value,
+ FX_BOOL& bRc);
+
+ void OnField_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ void OnField_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ void OnField_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ void OnField_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget);
+ void OnField_Blur(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value);
+ void OnField_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDF_FormField* pTarget,
+ const CFX_WideString& Value);
+
+ void OnScreen_Focus(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_Close(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseDown(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseUp(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseEnter(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseExit(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_InView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+ void OnScreen_OutView(FX_BOOL bModifier,
+ FX_BOOL bShift,
+ CPDFSDK_Annot* pScreen);
+
+ void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
+ void OnLink_MouseUp(CPDFSDK_Document* pTarget);
+
+ void OnMenu_Exec(CPDFSDK_Document* pTarget,
+ const CFX_WideString& strTargetName);
+ void OnBatchExec(CPDFSDK_Document* pTarget);
+ void OnConsole_Exec();
+ void OnExternal_Exec();
+
+ public:
+ void Initial(JS_EVENT_T type);
+ void Destroy();
+ FX_BOOL IsValid();
+
+ CFX_WideString& Change();
+ CFX_WideString ChangeEx();
+ int CommitKey();
+ FX_BOOL FieldFull();
+ FX_BOOL KeyDown();
+ FX_BOOL Modifier();
+ const FX_WCHAR* Name();
+ const FX_WCHAR* Type();
+ FX_BOOL& Rc();
+ int& SelEnd();
+ int& SelStart();
+ FX_BOOL Shift();
+ Field* Source();
+ Field* Target_Field();
+ CFX_WideString& Value();
+ FX_BOOL WillCommit();
+ CFX_WideString TargetName();
+
+ JS_EVENT_T EventType() { return m_eEventType; };
+
+ public:
+ CJS_Context* m_pJSContext;
+ JS_EVENT_T m_eEventType;
+ FX_BOOL m_bValid;
+
+ CFX_WideString m_strTargetName;
+ CFX_WideString m_strSourceName;
+ CFX_WideString* m_pWideStrChange;
+ CFX_WideString m_WideStrChangeDu;
+ CFX_WideString m_WideStrChangeEx;
+ int m_nCommitKey;
+ FX_BOOL m_bKeyDown;
+ FX_BOOL m_bModifier;
+ FX_BOOL m_bShift;
+ int* m_pISelEnd;
+ int m_nSelEndDu;
+ int* m_pISelStart;
+ int m_nSelStartDu;
+ FX_BOOL m_bWillCommit;
+ CFX_WideString* m_pValue;
+ FX_BOOL m_bFieldFull;
+ FX_BOOL* m_pbRc;
+ FX_BOOL m_bRcDu;
+
+ CPDFSDK_Document* m_pSourceDoc;
+ CPDF_Bookmark* m_pTargetBookMark;
+ CPDFSDK_Document* m_pTargetDoc;
+ CPDFSDK_Annot* m_pTargetAnnot;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_EVENTHANDLER_H_
diff --git a/fpdfsdk/include/javascript/JS_GlobalData.h b/fpdfsdk/include/javascript/JS_GlobalData.h
index bbc0b12173..46b94a4dda 100644
--- a/fpdfsdk/include/javascript/JS_GlobalData.h
+++ b/fpdfsdk/include/javascript/JS_GlobalData.h
@@ -9,90 +9,95 @@
#include "../../../core/include/fxcrt/fx_basic.h"
-#define JS_GLOBALDATA_TYPE_NUMBER 0
-#define JS_GLOBALDATA_TYPE_BOOLEAN 1
-#define JS_GLOBALDATA_TYPE_STRING 2
-#define JS_GLOBALDATA_TYPE_OBJECT 3
-#define JS_GLOBALDATA_TYPE_NULL 4
+#define JS_GLOBALDATA_TYPE_NUMBER 0
+#define JS_GLOBALDATA_TYPE_BOOLEAN 1
+#define JS_GLOBALDATA_TYPE_STRING 2
+#define JS_GLOBALDATA_TYPE_OBJECT 3
+#define JS_GLOBALDATA_TYPE_NULL 4
class CJS_KeyValue;
class CPDFDoc_Environment;
-class CJS_GlobalVariableArray
-{
-public:
- CJS_GlobalVariableArray();
- virtual ~CJS_GlobalVariableArray();
+class CJS_GlobalVariableArray {
+ public:
+ CJS_GlobalVariableArray();
+ virtual ~CJS_GlobalVariableArray();
- void Add(CJS_KeyValue* p);
- int Count() const;
- CJS_KeyValue* GetAt(int index) const;
- void Copy(const CJS_GlobalVariableArray& array);
+ void Add(CJS_KeyValue* p);
+ int Count() const;
+ CJS_KeyValue* GetAt(int index) const;
+ void Copy(const CJS_GlobalVariableArray& array);
- void Empty();
+ void Empty();
-private:
- CFX_ArrayTemplate<CJS_KeyValue*> array;
+ private:
+ CFX_ArrayTemplate<CJS_KeyValue*> array;
};
-class CJS_KeyValue
-{
-public:
- CJS_KeyValue(){}
- virtual ~CJS_KeyValue(){}
-
- CFX_ByteString sKey;
- int nType; //0:int 1:bool 2:string 3:obj
- double dData;
- bool bData;
- CFX_ByteString sData;
- CJS_GlobalVariableArray objData;
+class CJS_KeyValue {
+ public:
+ CJS_KeyValue() {}
+ virtual ~CJS_KeyValue() {}
+
+ CFX_ByteString sKey;
+ int nType; // 0:int 1:bool 2:string 3:obj
+ double dData;
+ bool bData;
+ CFX_ByteString sData;
+ CJS_GlobalVariableArray objData;
};
-class CJS_GlobalData_Element
-{
-public:
- CJS_GlobalData_Element(){}
- virtual ~CJS_GlobalData_Element(){}
+class CJS_GlobalData_Element {
+ public:
+ CJS_GlobalData_Element() {}
+ virtual ~CJS_GlobalData_Element() {}
- CJS_KeyValue data;
- FX_BOOL bPersistent;
+ CJS_KeyValue data;
+ FX_BOOL bPersistent;
};
-class CJS_GlobalData
-{
-public:
- CJS_GlobalData(CPDFDoc_Environment* pApp);
- virtual ~CJS_GlobalData();
-
-public:
- void SetGlobalVariableNumber(const FX_CHAR* propname, double dData);
- void SetGlobalVariableBoolean(const FX_CHAR* propname, bool bData);
- void SetGlobalVariableString(const FX_CHAR* propname, const CFX_ByteString& sData);
- void SetGlobalVariableObject(const FX_CHAR* propname, const CJS_GlobalVariableArray& array);
- void SetGlobalVariableNull(const FX_CHAR* propname);
-
- FX_BOOL SetGlobalVariablePersistent(const FX_CHAR* propname, FX_BOOL bPersistent);
- FX_BOOL DeleteGlobalVariable(const FX_CHAR* propname);
-
- int32_t GetSize() const;
- CJS_GlobalData_Element* GetAt(int index) const;
-
-private:
- void LoadGlobalPersistentVariables();
- void SaveGlobalPersisitentVariables();
-
- CJS_GlobalData_Element* GetGlobalVariable(const FX_CHAR* propname);
- int FindGlobalVariable(const FX_CHAR* propname);
-
- void LoadFileBuffer(const FX_WCHAR* sFilePath, uint8_t*& pBuffer, int32_t& nLength);
- void WriteFileBuffer(const FX_WCHAR* sFilePath, const FX_CHAR* pBuffer, int32_t nLength);
- void MakeByteString(const CFX_ByteString& name, CJS_KeyValue* pData, CFX_BinaryBuf& sData);
-
-private:
- CFX_ArrayTemplate<CJS_GlobalData_Element*> m_arrayGlobalData;
- CFX_WideString m_sFilePath;
- CPDFDoc_Environment* m_pApp;
+class CJS_GlobalData {
+ public:
+ CJS_GlobalData(CPDFDoc_Environment* pApp);
+ virtual ~CJS_GlobalData();
+
+ public:
+ void SetGlobalVariableNumber(const FX_CHAR* propname, double dData);
+ void SetGlobalVariableBoolean(const FX_CHAR* propname, bool bData);
+ void SetGlobalVariableString(const FX_CHAR* propname,
+ const CFX_ByteString& sData);
+ void SetGlobalVariableObject(const FX_CHAR* propname,
+ const CJS_GlobalVariableArray& array);
+ void SetGlobalVariableNull(const FX_CHAR* propname);
+
+ FX_BOOL SetGlobalVariablePersistent(const FX_CHAR* propname,
+ FX_BOOL bPersistent);
+ FX_BOOL DeleteGlobalVariable(const FX_CHAR* propname);
+
+ int32_t GetSize() const;
+ CJS_GlobalData_Element* GetAt(int index) const;
+
+ private:
+ void LoadGlobalPersistentVariables();
+ void SaveGlobalPersisitentVariables();
+
+ CJS_GlobalData_Element* GetGlobalVariable(const FX_CHAR* propname);
+ int FindGlobalVariable(const FX_CHAR* propname);
+
+ void LoadFileBuffer(const FX_WCHAR* sFilePath,
+ uint8_t*& pBuffer,
+ int32_t& nLength);
+ void WriteFileBuffer(const FX_WCHAR* sFilePath,
+ const FX_CHAR* pBuffer,
+ int32_t nLength);
+ void MakeByteString(const CFX_ByteString& name,
+ CJS_KeyValue* pData,
+ CFX_BinaryBuf& sData);
+
+ private:
+ CFX_ArrayTemplate<CJS_GlobalData_Element*> m_arrayGlobalData;
+ CFX_WideString m_sFilePath;
+ CPDFDoc_Environment* m_pApp;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_GLOBALDATA_H_
diff --git a/fpdfsdk/include/javascript/JS_Object.h b/fpdfsdk/include/javascript/JS_Object.h
index abfc818079..fe8a91f471 100644
--- a/fpdfsdk/include/javascript/JS_Object.h
+++ b/fpdfsdk/include/javascript/JS_Object.h
@@ -7,8 +7,8 @@
#ifndef FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_
#define FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_
-#include "../fsdk_define.h" // For FX_UINT
-#include "../fsdk_mgr.h" // For CPDFDoc_Environment
+#include "../fsdk_define.h" // For FX_UINT
+#include "../fsdk_mgr.h" // For CPDFDoc_Environment
#include "../fx_systemhandler.h" // For IFX_SystemHandler
#include "../jsapi/fxjs_v8.h"
@@ -17,284 +17,233 @@ class CJS_Object;
class CJS_Timer;
class CJS_Context;
-class CJS_EmbedObj
-{
-public:
- CJS_EmbedObj(CJS_Object* pJSObject);
- virtual ~CJS_EmbedObj();
+class CJS_EmbedObj {
+ public:
+ CJS_EmbedObj(CJS_Object* pJSObject);
+ virtual ~CJS_EmbedObj();
- virtual void TimerProc(CJS_Timer* pTimer){};
+ virtual void TimerProc(CJS_Timer* pTimer){};
- CJS_Timer* BeginTimer(CPDFDoc_Environment * pApp, FX_UINT nElapse);
- void EndTimer(CJS_Timer* pTimer);
+ CJS_Timer* BeginTimer(CPDFDoc_Environment* pApp, FX_UINT nElapse);
+ void EndTimer(CJS_Timer* pTimer);
- CJS_Object* GetJSObject(){return m_pJSObject;};
- operator CJS_Object* (){return m_pJSObject;};
+ CJS_Object* GetJSObject() { return m_pJSObject; };
+ operator CJS_Object*() { return m_pJSObject; };
- CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc);
- int MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, const FX_WCHAR* swMsg, const FX_WCHAR* swTitle = NULL, FX_UINT nType = 0, FX_UINT nIcon = 0);
- void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
+ CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc);
+ int MsgBox(CPDFDoc_Environment* pApp,
+ CPDFSDK_PageView* pPageView,
+ const FX_WCHAR* swMsg,
+ const FX_WCHAR* swTitle = NULL,
+ FX_UINT nType = 0,
+ FX_UINT nIcon = 0);
+ void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
-protected:
- CJS_Object* m_pJSObject;
+ protected:
+ CJS_Object* m_pJSObject;
};
-class CJS_Object
-{
-public:
- CJS_Object(JSFXObject pObject);
- virtual ~CJS_Object(void);
+class CJS_Object {
+ public:
+ CJS_Object(JSFXObject pObject);
+ virtual ~CJS_Object(void);
- void MakeWeak();
- void Dispose();
+ void MakeWeak();
+ void Dispose();
- virtual FX_BOOL IsType(const FX_CHAR* sClassName){return TRUE;};
- virtual CFX_ByteString GetClassName(){return "";};
+ virtual FX_BOOL IsType(const FX_CHAR* sClassName) { return TRUE; };
+ virtual CFX_ByteString GetClassName() { return ""; };
- virtual FX_BOOL InitInstance(IFXJS_Context* cc){return TRUE;};
- virtual FX_BOOL ExitInstance(){return TRUE;};
+ virtual FX_BOOL InitInstance(IFXJS_Context* cc) { return TRUE; };
+ virtual FX_BOOL ExitInstance() { return TRUE; };
- operator JSFXObject () {return v8::Local<v8::Object>::New(m_pIsolate, m_pObject);}
- operator CJS_EmbedObj* (){return m_pEmbedObj;};
+ operator JSFXObject() {
+ return v8::Local<v8::Object>::New(m_pIsolate, m_pObject);
+ }
+ operator CJS_EmbedObj*() { return m_pEmbedObj; };
- void SetEmbedObject(CJS_EmbedObj* pObj){m_pEmbedObj = pObj;};
- CJS_EmbedObj * GetEmbedObject(){return m_pEmbedObj;};
+ void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj = pObj; };
+ CJS_EmbedObj* GetEmbedObject() { return m_pEmbedObj; };
- static CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc);
- static int MsgBox(CPDFDoc_Environment* pApp, CPDFSDK_PageView* pPageView, const FX_WCHAR* swMsg, const FX_WCHAR* swTitle = NULL, FX_UINT nType = 0,FX_UINT nIcon = 0);
- static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
+ static CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc);
+ static int MsgBox(CPDFDoc_Environment* pApp,
+ CPDFSDK_PageView* pPageView,
+ const FX_WCHAR* swMsg,
+ const FX_WCHAR* swTitle = NULL,
+ FX_UINT nType = 0,
+ FX_UINT nIcon = 0);
+ static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg);
- v8::Isolate* GetIsolate() {return m_pIsolate;}
-protected:
- CJS_EmbedObj * m_pEmbedObj;
- v8::Global<v8::Object> m_pObject;
- v8::Isolate* m_pIsolate;
+ v8::Isolate* GetIsolate() { return m_pIsolate; }
+
+ protected:
+ CJS_EmbedObj* m_pEmbedObj;
+ v8::Global<v8::Object> m_pObject;
+ v8::Isolate* m_pIsolate;
};
-struct JS_TIMER_MAP
-{
- FX_UINT nID;
- CJS_Timer * pTimer;
+struct JS_TIMER_MAP {
+ FX_UINT nID;
+ CJS_Timer* pTimer;
};
-typedef CFX_ArrayTemplate<JS_TIMER_MAP*> CTimerMapArray;
-
-struct JS_TIMER_MAPARRAY
-{
-public:
- JS_TIMER_MAPARRAY()
- {
- }
-
- ~JS_TIMER_MAPARRAY()
- {
- Reset();
- }
-
- void Reset()
- {
- for (int i=0,sz=m_Array.GetSize(); i<sz; i++)
- delete m_Array.GetAt(i);
-
- m_Array.RemoveAll();
- }
-
- void SetAt(FX_UINT nIndex,CJS_Timer * pTimer)
- {
- int i = Find(nIndex);
-
- if (i>=0)
- {
- if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
- pMap->pTimer = pTimer;
- }
- else
- {
- if (JS_TIMER_MAP * pMap = new JS_TIMER_MAP)
- {
- pMap->nID = nIndex;
- pMap->pTimer = pTimer;
- m_Array.Add(pMap);
- }
- }
- }
-
- CJS_Timer * GetAt(FX_UINT nIndex)
- {
- int i = Find(nIndex);
-
- if (i>=0)
- {
- if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
- return pMap->pTimer;
- }
- return NULL;
- }
-
- void RemoveAt(FX_UINT nIndex)
- {
- int i = Find(nIndex);
-
- if (i>=0)
- {
- delete m_Array.GetAt(i);
- m_Array.RemoveAt(i);
- }
- //To prevent potential fake memory leak reported by vc6.
- if(m_Array.GetSize() == 0)
- m_Array.RemoveAll();
- }
-
- int Find(FX_UINT nIndex)
- {
- for (int i=0,sz=m_Array.GetSize(); i<sz; i++)
- {
- if (JS_TIMER_MAP * pMap = m_Array.GetAt(i))
- {
- if (pMap->nID == nIndex)
- return i;
- }
- }
-
- return -1;
- }
-
- CTimerMapArray m_Array;
+typedef CFX_ArrayTemplate<JS_TIMER_MAP*> CTimerMapArray;
+
+struct JS_TIMER_MAPARRAY {
+ public:
+ JS_TIMER_MAPARRAY() {}
+
+ ~JS_TIMER_MAPARRAY() { Reset(); }
+
+ void Reset() {
+ for (int i = 0, sz = m_Array.GetSize(); i < sz; i++)
+ delete m_Array.GetAt(i);
+
+ m_Array.RemoveAll();
+ }
+
+ void SetAt(FX_UINT nIndex, CJS_Timer* pTimer) {
+ int i = Find(nIndex);
+
+ if (i >= 0) {
+ if (JS_TIMER_MAP* pMap = m_Array.GetAt(i))
+ pMap->pTimer = pTimer;
+ } else {
+ if (JS_TIMER_MAP* pMap = new JS_TIMER_MAP) {
+ pMap->nID = nIndex;
+ pMap->pTimer = pTimer;
+ m_Array.Add(pMap);
+ }
+ }
+ }
+
+ CJS_Timer* GetAt(FX_UINT nIndex) {
+ int i = Find(nIndex);
+
+ if (i >= 0) {
+ if (JS_TIMER_MAP* pMap = m_Array.GetAt(i))
+ return pMap->pTimer;
+ }
+ return NULL;
+ }
+
+ void RemoveAt(FX_UINT nIndex) {
+ int i = Find(nIndex);
+
+ if (i >= 0) {
+ delete m_Array.GetAt(i);
+ m_Array.RemoveAt(i);
+ }
+ // To prevent potential fake memory leak reported by vc6.
+ if (m_Array.GetSize() == 0)
+ m_Array.RemoveAll();
+ }
+
+ int Find(FX_UINT nIndex) {
+ for (int i = 0, sz = m_Array.GetSize(); i < sz; i++) {
+ if (JS_TIMER_MAP* pMap = m_Array.GetAt(i)) {
+ if (pMap->nID == nIndex)
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ CTimerMapArray m_Array;
};
JS_TIMER_MAPARRAY& GetTimeMap();
class CJS_Runtime;
-class CJS_Timer
-{
-public:
- CJS_Timer(CJS_EmbedObj * pObj, CPDFDoc_Environment* pApp):
- m_nTimerID(0),
- m_pEmbedObj(pObj),
- m_bProcessing(FALSE),
- m_dwStartTime(0),
- m_dwTimeOut(0),
- m_dwElapse(0),
- m_pRuntime(NULL),
- m_nType(0),
- m_pApp(pApp)
- {
- }
-
- virtual ~CJS_Timer()
- {
- KillJSTimer();
- }
-
-public:
- FX_UINT SetJSTimer(FX_UINT nElapse)
- {
- if (m_nTimerID)KillJSTimer();
- IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
- m_nTimerID = pHandler->SetTimer(nElapse,TimerProc);
- GetTimeMap().SetAt(m_nTimerID,this);
- m_dwElapse = nElapse;
- return m_nTimerID;
- };
-
- void KillJSTimer()
- {
- if (m_nTimerID)
- {
- if (m_pApp == NULL) {
- GetTimeMap().RemoveAt(m_nTimerID);
- m_nTimerID = 0;
- return;
- }
- IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
- pHandler->KillTimer(m_nTimerID);
- GetTimeMap().RemoveAt(m_nTimerID);
- m_nTimerID = 0;
- }
- };
-
- void SetType(int nType)
- {
- m_nType = nType;
- }
-
- int GetType() const
- {
- return m_nType;
- }
-
- void SetStartTime(FX_DWORD dwStartTime)
- {
- m_dwStartTime = dwStartTime;
- }
-
- FX_DWORD GetStartTime() const
- {
- return m_dwStartTime;
- }
-
- void SetTimeOut(FX_DWORD dwTimeOut)
- {
- m_dwTimeOut = dwTimeOut;
- }
-
- FX_DWORD GetTimeOut() const
- {
- return m_dwTimeOut;
- }
-
- void SetRuntime(CJS_Runtime* pRuntime)
- {
- m_pRuntime = pRuntime;
- }
-
- CJS_Runtime* GetRuntime() const
- {
- return m_pRuntime;
- }
-
- void SetJScript(const CFX_WideString& script)
- {
- m_swJScript = script;
- }
-
- CFX_WideString GetJScript() const
- {
- return m_swJScript;
- }
-
- static void TimerProc(int idEvent)
- {
- if (CJS_Timer * pTimer = GetTimeMap().GetAt(idEvent))
- {
- if (!pTimer->m_bProcessing)
- {
- pTimer->m_bProcessing = TRUE;
- if (pTimer->m_pEmbedObj) pTimer->m_pEmbedObj->TimerProc(pTimer);
- pTimer->m_bProcessing = FALSE;
- }
- else
- {
- // TRACE(L"BUSY!\n");
- }
- }
- };
-
-private:
- FX_UINT m_nTimerID;
- CJS_EmbedObj* m_pEmbedObj;
- FX_BOOL m_bProcessing;
-
- //data
- FX_DWORD m_dwStartTime;
- FX_DWORD m_dwTimeOut;
- FX_DWORD m_dwElapse;
- CJS_Runtime* m_pRuntime;
- CFX_WideString m_swJScript;
- int m_nType; //0:Interval; 1:TimeOut
-
- CPDFDoc_Environment* m_pApp;
+class CJS_Timer {
+ public:
+ CJS_Timer(CJS_EmbedObj* pObj, CPDFDoc_Environment* pApp)
+ : m_nTimerID(0),
+ m_pEmbedObj(pObj),
+ m_bProcessing(FALSE),
+ m_dwStartTime(0),
+ m_dwTimeOut(0),
+ m_dwElapse(0),
+ m_pRuntime(NULL),
+ m_nType(0),
+ m_pApp(pApp) {}
+
+ virtual ~CJS_Timer() { KillJSTimer(); }
+
+ public:
+ FX_UINT SetJSTimer(FX_UINT nElapse) {
+ if (m_nTimerID)
+ KillJSTimer();
+ IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
+ m_nTimerID = pHandler->SetTimer(nElapse, TimerProc);
+ GetTimeMap().SetAt(m_nTimerID, this);
+ m_dwElapse = nElapse;
+ return m_nTimerID;
+ };
+
+ void KillJSTimer() {
+ if (m_nTimerID) {
+ if (m_pApp == NULL) {
+ GetTimeMap().RemoveAt(m_nTimerID);
+ m_nTimerID = 0;
+ return;
+ }
+ IFX_SystemHandler* pHandler = m_pApp->GetSysHandler();
+ pHandler->KillTimer(m_nTimerID);
+ GetTimeMap().RemoveAt(m_nTimerID);
+ m_nTimerID = 0;
+ }
+ };
+
+ void SetType(int nType) { m_nType = nType; }
+
+ int GetType() const { return m_nType; }
+
+ void SetStartTime(FX_DWORD dwStartTime) { m_dwStartTime = dwStartTime; }
+
+ FX_DWORD GetStartTime() const { return m_dwStartTime; }
+
+ void SetTimeOut(FX_DWORD dwTimeOut) { m_dwTimeOut = dwTimeOut; }
+
+ FX_DWORD GetTimeOut() const { return m_dwTimeOut; }
+
+ void SetRuntime(CJS_Runtime* pRuntime) { m_pRuntime = pRuntime; }
+
+ CJS_Runtime* GetRuntime() const { return m_pRuntime; }
+
+ void SetJScript(const CFX_WideString& script) { m_swJScript = script; }
+
+ CFX_WideString GetJScript() const { return m_swJScript; }
+
+ static void TimerProc(int idEvent) {
+ if (CJS_Timer* pTimer = GetTimeMap().GetAt(idEvent)) {
+ if (!pTimer->m_bProcessing) {
+ pTimer->m_bProcessing = TRUE;
+ if (pTimer->m_pEmbedObj)
+ pTimer->m_pEmbedObj->TimerProc(pTimer);
+ pTimer->m_bProcessing = FALSE;
+ } else {
+ // TRACE(L"BUSY!\n");
+ }
+ }
+ };
+
+ private:
+ FX_UINT m_nTimerID;
+ CJS_EmbedObj* m_pEmbedObj;
+ FX_BOOL m_bProcessing;
+
+ // data
+ FX_DWORD m_dwStartTime;
+ FX_DWORD m_dwTimeOut;
+ FX_DWORD m_dwElapse;
+ CJS_Runtime* m_pRuntime;
+ CFX_WideString m_swJScript;
+ int m_nType; // 0:Interval; 1:TimeOut
+
+ CPDFDoc_Environment* m_pApp;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_
diff --git a/fpdfsdk/include/javascript/JS_Runtime.h b/fpdfsdk/include/javascript/JS_Runtime.h
index 20d7d63eff..1fb0348263 100644
--- a/fpdfsdk/include/javascript/JS_Runtime.h
+++ b/fpdfsdk/include/javascript/JS_Runtime.h
@@ -16,63 +16,65 @@
class CJS_Context;
class CJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
- void* Allocate(size_t length) override;
- void* AllocateUninitialized(size_t length) override;
- void Free(void* data, size_t length) override;
+ void* Allocate(size_t length) override;
+ void* AllocateUninitialized(size_t length) override;
+ void Free(void* data, size_t length) override;
};
-class CJS_FieldEvent
-{
-public:
- CFX_WideString sTargetName;
- JS_EVENT_T eEventType;
- CJS_FieldEvent* pNext;
+class CJS_FieldEvent {
+ public:
+ CFX_WideString sTargetName;
+ JS_EVENT_T eEventType;
+ CJS_FieldEvent* pNext;
};
-class CJS_Runtime : public IFXJS_Runtime
-{
-public:
- CJS_Runtime(CPDFDoc_Environment * pApp);
- virtual ~CJS_Runtime();
+class CJS_Runtime : public IFXJS_Runtime {
+ public:
+ CJS_Runtime(CPDFDoc_Environment* pApp);
+ virtual ~CJS_Runtime();
- virtual IFXJS_Context * NewContext();
- virtual void ReleaseContext(IFXJS_Context * pContext);
- virtual IFXJS_Context* GetCurrentContext();
+ virtual IFXJS_Context* NewContext();
+ virtual void ReleaseContext(IFXJS_Context* pContext);
+ virtual IFXJS_Context* GetCurrentContext();
- virtual void SetReaderDocument(CPDFSDK_Document *pReaderDoc);
- virtual CPDFSDK_Document * GetReaderDocument(){return m_pDocument;}
+ virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc);
+ virtual CPDFSDK_Document* GetReaderDocument() { return m_pDocument; }
- CPDFDoc_Environment * GetReaderApp(){return m_pApp;}
+ CPDFDoc_Environment* GetReaderApp() { return m_pApp; }
- FX_BOOL InitJSObjects();
+ FX_BOOL InitJSObjects();
- FX_BOOL AddEventToLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
- void RemoveEventInLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
- void RemoveEventsInLoop(CJS_FieldEvent* pStart);
+ FX_BOOL AddEventToLoop(const CFX_WideString& sTargetName,
+ JS_EVENT_T eEventType);
+ void RemoveEventInLoop(const CFX_WideString& sTargetName,
+ JS_EVENT_T eEventType);
+ void RemoveEventsInLoop(CJS_FieldEvent* pStart);
- void BeginBlock(){m_bBlocking = TRUE;}
- void EndBlock(){m_bBlocking = FALSE;}
- FX_BOOL IsBlocking(){return m_bBlocking;}
+ void BeginBlock() { m_bBlocking = TRUE; }
+ void EndBlock() { m_bBlocking = FALSE; }
+ FX_BOOL IsBlocking() { return m_bBlocking; }
- operator IJS_Runtime*() {return (IJS_Runtime*)m_isolate;}
- v8::Isolate* GetIsolate(){return m_isolate;};
- void SetIsolate(v8::Isolate* isolate){m_isolate = isolate;}
+ operator IJS_Runtime*() { return (IJS_Runtime*)m_isolate; }
+ v8::Isolate* GetIsolate() { return m_isolate; };
+ void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; }
- v8::Local<v8::Context> NewJSContext();
+ v8::Local<v8::Context> NewJSContext();
+ virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue);
+ virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name,
+ FXJSE_HVALUE hValue);
- virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue);
- virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, FXJSE_HVALUE hValue);
-protected:
- CFX_ArrayTemplate<CJS_Context*> m_ContextArray;
- CPDFDoc_Environment* m_pApp;
- CPDFSDK_Document* m_pDocument;
- FX_BOOL m_bBlocking;
- CJS_FieldEvent* m_pFieldEventPath;
+ protected:
+ CFX_ArrayTemplate<CJS_Context*> m_ContextArray;
+ CPDFDoc_Environment* m_pApp;
+ CPDFSDK_Document* m_pDocument;
+ FX_BOOL m_bBlocking;
+ CJS_FieldEvent* m_pFieldEventPath;
- v8::Isolate* m_isolate;
- nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
- v8::Global<v8::Context> m_context;
+ v8::Isolate* m_isolate;
+ nonstd::unique_ptr<CJS_ArrayBufferAllocator> m_pArrayBufferAllocator;
+ v8::Global<v8::Context> m_context;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_RUNTIME_H_
diff --git a/fpdfsdk/include/javascript/JS_Value.h b/fpdfsdk/include/javascript/JS_Value.h
index 6186817fa5..1606fb5396 100644
--- a/fpdfsdk/include/javascript/JS_Value.h
+++ b/fpdfsdk/include/javascript/JS_Value.h
@@ -15,175 +15,179 @@ class CJS_Date;
class CJS_Document;
class CJS_Object;
-class CJS_Value
-{
-public:
- CJS_Value(v8::Isolate* isolate);
- CJS_Value(v8::Isolate* isolate, v8::Local<v8::Value> pValue,FXJSVALUETYPE t);
- CJS_Value(v8::Isolate* isolate, const int &iValue);
- CJS_Value(v8::Isolate* isolate, const double &dValue);
- CJS_Value(v8::Isolate* isolate, const float &fValue);
- CJS_Value(v8::Isolate* isolate, const bool &bValue);
- CJS_Value(v8::Isolate* isolate, JSFXObject);
- CJS_Value(v8::Isolate* isolate, CJS_Object*);
- CJS_Value(v8::Isolate* isolate, CJS_Document*);
- CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr);
- CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr);
- CJS_Value(v8::Isolate* isolate, CJS_Array& array);
-
- ~CJS_Value();
-
- void SetNull();
- void Attach(v8::Local<v8::Value> pValue,FXJSVALUETYPE t);
- void Attach(CJS_Value *pValue);
- void Detach();
-
-
- int ToInt() const;
- bool ToBool() const;
- double ToDouble() const;
- float ToFloat() const;
- CJS_Object* ToCJSObject() const;
- CFX_WideString ToCFXWideString() const;
- CFX_ByteString ToCFXByteString() const;
- v8::Local<v8::Object> ToV8Object() const;
- v8::Local<v8::Array> ToV8Array() const;
- v8::Local<v8::Value> ToV8Value() const;
-
- void operator = (int iValue);
- void operator = (bool bValue);
- void operator = (double);
- void operator = (float);
- void operator = (CJS_Object*);
- void operator = (CJS_Document*);
- void operator = (v8::Local<v8::Object>);
- void operator = (CJS_Array &);
- void operator = (CJS_Date &);
- void operator = (const FX_WCHAR* pWstr);
- void operator = (const FX_CHAR* pStr);
- void operator = (CJS_Value value);
-
- FX_BOOL IsArrayObject() const;
- FX_BOOL IsDateObject() const;
- FXJSVALUETYPE GetType() const;
-
- FX_BOOL ConvertToArray(CJS_Array &) const;
- FX_BOOL ConvertToDate(CJS_Date &) const;
-
- v8::Isolate* GetIsolate() {return m_isolate;}
-protected:
- v8::Local<v8::Value> m_pValue;
- FXJSVALUETYPE m_eType;
- v8::Isolate* m_isolate;
+class CJS_Value {
+ public:
+ CJS_Value(v8::Isolate* isolate);
+ CJS_Value(v8::Isolate* isolate, v8::Local<v8::Value> pValue, FXJSVALUETYPE t);
+ CJS_Value(v8::Isolate* isolate, const int& iValue);
+ CJS_Value(v8::Isolate* isolate, const double& dValue);
+ CJS_Value(v8::Isolate* isolate, const float& fValue);
+ CJS_Value(v8::Isolate* isolate, const bool& bValue);
+ CJS_Value(v8::Isolate* isolate, JSFXObject);
+ CJS_Value(v8::Isolate* isolate, CJS_Object*);
+ CJS_Value(v8::Isolate* isolate, CJS_Document*);
+ CJS_Value(v8::Isolate* isolate, const FX_CHAR* pStr);
+ CJS_Value(v8::Isolate* isolate, const FX_WCHAR* pWstr);
+ CJS_Value(v8::Isolate* isolate, CJS_Array& array);
+
+ ~CJS_Value();
+
+ void SetNull();
+ void Attach(v8::Local<v8::Value> pValue, FXJSVALUETYPE t);
+ void Attach(CJS_Value* pValue);
+ void Detach();
+
+ int ToInt() const;
+ bool ToBool() const;
+ double ToDouble() const;
+ float ToFloat() const;
+ CJS_Object* ToCJSObject() const;
+ CFX_WideString ToCFXWideString() const;
+ CFX_ByteString ToCFXByteString() const;
+ v8::Local<v8::Object> ToV8Object() const;
+ v8::Local<v8::Array> ToV8Array() const;
+ v8::Local<v8::Value> ToV8Value() const;
+
+ void operator=(int iValue);
+ void operator=(bool bValue);
+ void operator=(double);
+ void operator=(float);
+ void operator=(CJS_Object*);
+ void operator=(CJS_Document*);
+ void operator=(v8::Local<v8::Object>);
+ void operator=(CJS_Array&);
+ void operator=(CJS_Date&);
+ void operator=(const FX_WCHAR* pWstr);
+ void operator=(const FX_CHAR* pStr);
+ void operator=(CJS_Value value);
+
+ FX_BOOL IsArrayObject() const;
+ FX_BOOL IsDateObject() const;
+ FXJSVALUETYPE GetType() const;
+
+ FX_BOOL ConvertToArray(CJS_Array&) const;
+ FX_BOOL ConvertToDate(CJS_Date&) const;
+
+ v8::Isolate* GetIsolate() { return m_isolate; }
+
+ protected:
+ v8::Local<v8::Value> m_pValue;
+ FXJSVALUETYPE m_eType;
+ v8::Isolate* m_isolate;
};
-class CJS_Parameters : public CFX_ArrayTemplate<CJS_Value>
-{
-public:
- void push_back(const CJS_Value& newElement) {
- CFX_ArrayTemplate<CJS_Value>::Add(newElement);
- }
- int size() const {
- return CFX_ArrayTemplate<CJS_Value>::GetSize();
- }
+class CJS_Parameters : public CFX_ArrayTemplate<CJS_Value> {
+ public:
+ void push_back(const CJS_Value& newElement) {
+ CFX_ArrayTemplate<CJS_Value>::Add(newElement);
+ }
+ int size() const { return CFX_ArrayTemplate<CJS_Value>::GetSize(); }
};
-class CJS_PropValue: public CJS_Value
-{
-public:
- CJS_PropValue(const CJS_Value&);
- CJS_PropValue(v8::Isolate* isolate);
- ~CJS_PropValue();
-public:
- FX_BOOL IsSetting();
- FX_BOOL IsGetting();
- void operator<<(int);
- void operator>>(int&) const;
- void operator<<(bool);
- void operator>>(bool&) const;
- void operator<<(double);
- void operator>>(double&) const;
- void operator<<(CJS_Object* pObj);
- void operator>>(CJS_Object*& ppObj) const;
- void operator<<(CJS_Document* pJsDoc);
- void operator>>(CJS_Document*& ppJsDoc) const;
- void operator<<(CFX_ByteString);
- void operator>>(CFX_ByteString&) const;
- void operator<<(CFX_WideString);
- void operator>>(CFX_WideString&) const;
- void operator<<(const FX_WCHAR* c_string);
- void operator<<(JSFXObject);
- void operator>>(JSFXObject&) const;
- void operator>>(CJS_Array& array) const;
- void operator<<(CJS_Array& array);
- void operator<<(CJS_Date& date);
- void operator>>(CJS_Date& date) const;
- operator v8::Local<v8::Value>() const;
- void StartSetting();
- void StartGetting();
-private:
- FX_BOOL m_bIsSetting;
+class CJS_PropValue : public CJS_Value {
+ public:
+ CJS_PropValue(const CJS_Value&);
+ CJS_PropValue(v8::Isolate* isolate);
+ ~CJS_PropValue();
+
+ public:
+ FX_BOOL IsSetting();
+ FX_BOOL IsGetting();
+ void operator<<(int);
+ void operator>>(int&) const;
+ void operator<<(bool);
+ void operator>>(bool&) const;
+ void operator<<(double);
+ void operator>>(double&) const;
+ void operator<<(CJS_Object* pObj);
+ void operator>>(CJS_Object*& ppObj) const;
+ void operator<<(CJS_Document* pJsDoc);
+ void operator>>(CJS_Document*& ppJsDoc) const;
+ void operator<<(CFX_ByteString);
+ void operator>>(CFX_ByteString&) const;
+ void operator<<(CFX_WideString);
+ void operator>>(CFX_WideString&) const;
+ void operator<<(const FX_WCHAR* c_string);
+ void operator<<(JSFXObject);
+ void operator>>(JSFXObject&) const;
+ void operator>>(CJS_Array& array) const;
+ void operator<<(CJS_Array& array);
+ void operator<<(CJS_Date& date);
+ void operator>>(CJS_Date& date) const;
+ operator v8::Local<v8::Value>() const;
+ void StartSetting();
+ void StartGetting();
+
+ private:
+ FX_BOOL m_bIsSetting;
};
-class CJS_Array
-{
-public:
- CJS_Array(v8::Isolate* isolate);
- virtual ~CJS_Array();
-
- void Attach(v8::Local<v8::Array> pArray);
- void GetElement(unsigned index,CJS_Value &value);
- void SetElement(unsigned index,CJS_Value value);
- int GetLength();
- FX_BOOL IsAttached();
- operator v8::Local<v8::Array>();
-
- v8::Isolate* GetIsolate() {return m_isolate;}
-private:
- v8::Local<v8::Array> m_pArray;
- v8::Isolate* m_isolate;
+class CJS_Array {
+ public:
+ CJS_Array(v8::Isolate* isolate);
+ virtual ~CJS_Array();
+
+ void Attach(v8::Local<v8::Array> pArray);
+ void GetElement(unsigned index, CJS_Value& value);
+ void SetElement(unsigned index, CJS_Value value);
+ int GetLength();
+ FX_BOOL IsAttached();
+ operator v8::Local<v8::Array>();
+
+ v8::Isolate* GetIsolate() { return m_isolate; }
+
+ private:
+ v8::Local<v8::Array> m_pArray;
+ v8::Isolate* m_isolate;
};
-class CJS_Date
-{
-friend class CJS_Value;
-public:
- CJS_Date(v8::Isolate* isolate);
- CJS_Date(v8::Isolate* isolate,double dMsec_time);
- CJS_Date(v8::Isolate* isolate,int year, int mon, int day,int hour, int min, int sec);
- virtual ~CJS_Date();
- void Attach(v8::Local<v8::Value> pDate);
+class CJS_Date {
+ friend class CJS_Value;
+
+ public:
+ CJS_Date(v8::Isolate* isolate);
+ CJS_Date(v8::Isolate* isolate, double dMsec_time);
+ CJS_Date(v8::Isolate* isolate,
+ int year,
+ int mon,
+ int day,
+ int hour,
+ int min,
+ int sec);
+ virtual ~CJS_Date();
+ void Attach(v8::Local<v8::Value> pDate);
- int GetYear();
- void SetYear(int iYear);
+ int GetYear();
+ void SetYear(int iYear);
- int GetMonth();
- void SetMonth(int iMonth);
+ int GetMonth();
+ void SetMonth(int iMonth);
- int GetDay();
- void SetDay(int iDay);
+ int GetDay();
+ void SetDay(int iDay);
- int GetHours();
- void SetHours(int iHours);
+ int GetHours();
+ void SetHours(int iHours);
- int GetMinutes();
- void SetMinutes(int minutes);
+ int GetMinutes();
+ void SetMinutes(int minutes);
- int GetSeconds();
- void SetSeconds(int seconds);
+ int GetSeconds();
+ void SetSeconds(int seconds);
- operator v8::Local<v8::Value>();
- operator double() const;
+ operator v8::Local<v8::Value>();
+ operator double() const;
- CFX_WideString ToString() const;
+ CFX_WideString ToString() const;
- static double MakeDate(int year, int mon, int mday,int hour, int min, int sec,int ms);
+ static double
+ MakeDate(int year, int mon, int mday, int hour, int min, int sec, int ms);
- FX_BOOL IsValidDate();
+ FX_BOOL IsValidDate();
-protected:
- v8::Local<v8::Value> m_pDate;
- v8::Isolate* m_isolate;
+ protected:
+ v8::Local<v8::Value> m_pDate;
+ v8::Isolate* m_isolate;
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_VALUE_H_
diff --git a/fpdfsdk/include/javascript/PublicMethods.h b/fpdfsdk/include/javascript/PublicMethods.h
index cff9e11479..c5d5ea6d46 100644
--- a/fpdfsdk/include/javascript/PublicMethods.h
+++ b/fpdfsdk/include/javascript/PublicMethods.h
@@ -9,95 +9,177 @@
#include "JS_Define.h"
-class CJS_PublicMethods : public CJS_Object
-{
-public:
- CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_PublicMethods(void){};
+class CJS_PublicMethods : public CJS_Object {
+ public:
+ CJS_PublicMethods(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_PublicMethods(void){};
-public:
- static FX_BOOL AFNumber_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFNumber_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFPercent_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFPercent_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFDate_FormatEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFDate_KeystrokeEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFDate_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFDate_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFTime_FormatEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError); //
- static FX_BOOL AFTime_KeystrokeEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFTime_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFTime_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFSpecial_Format(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFSpecial_Keystroke(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFSpecial_KeystrokeEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);//
- static FX_BOOL AFSimple(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFMakeNumber(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFSimple_Calculate(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFRange_Validate(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFMergeChange(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFParseDateEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- static FX_BOOL AFExtractNums(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+ public:
+ static FX_BOOL AFNumber_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFNumber_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFPercent_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFPercent_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFDate_FormatEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFDate_KeystrokeEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFDate_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFDate_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFTime_FormatEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError); //
+ static FX_BOOL AFTime_KeystrokeEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFTime_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFTime_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFSpecial_Format(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFSpecial_Keystroke(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFSpecial_KeystrokeEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError); //
+ static FX_BOOL AFSimple(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFMakeNumber(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFSimple_Calculate(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFRange_Validate(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFMergeChange(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFParseDateEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static FX_BOOL AFExtractNums(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
-public:
- JS_STATIC_GLOBAL_FUN(AFNumber_Format);
- JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFPercent_Format);
- JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);
- JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFDate_Format);
- JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);
- JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFTime_Format);
- JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFSpecial_Format);
- JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);
- JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);
- JS_STATIC_GLOBAL_FUN(AFSimple);
- JS_STATIC_GLOBAL_FUN(AFMakeNumber);
- JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);
- JS_STATIC_GLOBAL_FUN(AFRange_Validate);
- JS_STATIC_GLOBAL_FUN(AFMergeChange);
- JS_STATIC_GLOBAL_FUN(AFParseDateEx);
- JS_STATIC_GLOBAL_FUN(AFExtractNums);
+ public:
+ JS_STATIC_GLOBAL_FUN(AFNumber_Format);
+ JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFPercent_Format);
+ JS_STATIC_GLOBAL_FUN(AFPercent_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFDate_FormatEx);
+ JS_STATIC_GLOBAL_FUN(AFDate_KeystrokeEx);
+ JS_STATIC_GLOBAL_FUN(AFDate_Format);
+ JS_STATIC_GLOBAL_FUN(AFDate_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFTime_FormatEx);
+ JS_STATIC_GLOBAL_FUN(AFTime_KeystrokeEx);
+ JS_STATIC_GLOBAL_FUN(AFTime_Format);
+ JS_STATIC_GLOBAL_FUN(AFTime_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFSpecial_Format);
+ JS_STATIC_GLOBAL_FUN(AFSpecial_Keystroke);
+ JS_STATIC_GLOBAL_FUN(AFSpecial_KeystrokeEx);
+ JS_STATIC_GLOBAL_FUN(AFSimple);
+ JS_STATIC_GLOBAL_FUN(AFMakeNumber);
+ JS_STATIC_GLOBAL_FUN(AFSimple_Calculate);
+ JS_STATIC_GLOBAL_FUN(AFRange_Validate);
+ JS_STATIC_GLOBAL_FUN(AFMergeChange);
+ JS_STATIC_GLOBAL_FUN(AFParseDateEx);
+ JS_STATIC_GLOBAL_FUN(AFExtractNums);
- JS_STATIC_DECLARE_GLOBAL_FUN();
+ JS_STATIC_DECLARE_GLOBAL_FUN();
-public:
- static int ParseStringInteger(const CFX_WideString & string,int nStart,int & nSkip, int nMaxStep);
- static CFX_WideString ParseStringString(const CFX_WideString& string, int nStart, int& nSkip);
- static double MakeRegularDate(const CFX_WideString & value,const CFX_WideString & format, FX_BOOL& bWrongFormat);
- static CFX_WideString MakeFormatDate(double dDate,const CFX_WideString & format);
- static FX_BOOL ConvertStringToNumber(const FX_WCHAR* swSource, double & dRet, FX_BOOL & bDot);
- static double ParseStringToNumber(const FX_WCHAR* swSource);
- static double ParseNormalDate(const CFX_WideString & value, FX_BOOL& bWrongFormat);
- static double MakeInterDate(CFX_WideString strValue);
- static double ParseNumber(const FX_WCHAR* swSource, FX_BOOL& bAllDigits, FX_BOOL& bDot, FX_BOOL& bSign, FX_BOOL& bKXJS);
+ public:
+ static int ParseStringInteger(const CFX_WideString& string,
+ int nStart,
+ int& nSkip,
+ int nMaxStep);
+ static CFX_WideString ParseStringString(const CFX_WideString& string,
+ int nStart,
+ int& nSkip);
+ static double MakeRegularDate(const CFX_WideString& value,
+ const CFX_WideString& format,
+ FX_BOOL& bWrongFormat);
+ static CFX_WideString MakeFormatDate(double dDate,
+ const CFX_WideString& format);
+ static FX_BOOL ConvertStringToNumber(const FX_WCHAR* swSource,
+ double& dRet,
+ FX_BOOL& bDot);
+ static double ParseStringToNumber(const FX_WCHAR* swSource);
+ static double ParseNormalDate(const CFX_WideString& value,
+ FX_BOOL& bWrongFormat);
+ static double MakeInterDate(CFX_WideString strValue);
+ static double ParseNumber(const FX_WCHAR* swSource,
+ FX_BOOL& bAllDigits,
+ FX_BOOL& bDot,
+ FX_BOOL& bSign,
+ FX_BOOL& bKXJS);
-public:
- static CFX_WideString StrLTrim(const FX_WCHAR* pStr);
- static CFX_WideString StrRTrim(const FX_WCHAR* pStr);
- static CFX_WideString StrTrim(const FX_WCHAR* pStr);
+ public:
+ static CFX_WideString StrLTrim(const FX_WCHAR* pStr);
+ static CFX_WideString StrRTrim(const FX_WCHAR* pStr);
+ static CFX_WideString StrTrim(const FX_WCHAR* pStr);
- static CFX_ByteString StrLTrim(const FX_CHAR* pStr);
- static CFX_ByteString StrRTrim(const FX_CHAR* pStr);
- static CFX_ByteString StrTrim(const FX_CHAR* pStr);
+ static CFX_ByteString StrLTrim(const FX_CHAR* pStr);
+ static CFX_ByteString StrRTrim(const FX_CHAR* pStr);
+ static CFX_ByteString StrTrim(const FX_CHAR* pStr);
- static FX_BOOL IsNumber(const FX_CHAR* string);
- static FX_BOOL IsNumber(const FX_WCHAR* string);
+ static FX_BOOL IsNumber(const FX_CHAR* string);
+ static FX_BOOL IsNumber(const FX_WCHAR* string);
- static FX_BOOL IsDigit(char ch);
- static FX_BOOL IsDigit(wchar_t ch);
- static FX_BOOL IsAlphabetic(wchar_t ch);
- static FX_BOOL IsAlphaNumeric(wchar_t ch);
+ static FX_BOOL IsDigit(char ch);
+ static FX_BOOL IsDigit(wchar_t ch);
+ static FX_BOOL IsAlphabetic(wchar_t ch);
+ static FX_BOOL IsAlphaNumeric(wchar_t ch);
- static FX_BOOL maskSatisfied(wchar_t c_Change,wchar_t c_Mask);
- static FX_BOOL isReservedMaskChar(wchar_t ch);
+ static FX_BOOL maskSatisfied(wchar_t c_Change, wchar_t c_Mask);
+ static FX_BOOL isReservedMaskChar(wchar_t ch);
- static double AF_Simple(const FX_WCHAR* sFuction, double dValue1, double dValue2);
- static CJS_Array AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val);
+ static double AF_Simple(const FX_WCHAR* sFuction,
+ double dValue1,
+ double dValue2);
+ static CJS_Array AF_MakeArrayFromList(v8::Isolate* isolate, CJS_Value val);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_PUBLICMETHODS_H_
diff --git a/fpdfsdk/include/javascript/app.h b/fpdfsdk/include/javascript/app.h
index ac90e62b0d..221a7c1d89 100644
--- a/fpdfsdk/include/javascript/app.h
+++ b/fpdfsdk/include/javascript/app.h
@@ -15,35 +15,33 @@ class CJS_Runtime;
class CJS_Timer;
-class TimerObj : public CJS_EmbedObj
-{
-public:
- TimerObj(CJS_Object* pJSObject);
- virtual ~TimerObj();
-
-public:
- void SetTimer(CJS_Timer* pTimer);
- CJS_Timer* GetTimer() const;
-
-private:
- CJS_Timer* m_pTimer;
-};
+class TimerObj : public CJS_EmbedObj {
+ public:
+ TimerObj(CJS_Object* pJSObject);
+ virtual ~TimerObj();
-class CJS_TimerObj : public CJS_Object
-{
-public:
- CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {}
- virtual ~CJS_TimerObj(){}
+ public:
+ void SetTimer(CJS_Timer* pTimer);
+ CJS_Timer* GetTimer() const;
- DECLARE_JS_CLASS(CJS_TimerObj);
+ private:
+ CJS_Timer* m_pTimer;
};
+class CJS_TimerObj : public CJS_Object {
+ public:
+ CJS_TimerObj(JSFXObject pObject) : CJS_Object(pObject) {}
+ virtual ~CJS_TimerObj() {}
+
+ DECLARE_JS_CLASS(CJS_TimerObj);
+};
// struct APP_MENUITEM_ARRAY;
//
// struct APP_MENUITEM
// {
-// APP_MENUITEM() : oSubMenu(NULL), cName(L""), cReturn(L""), bMarked(false), bEnabled(true)
+// APP_MENUITEM() : oSubMenu(NULL), cName(L""), cReturn(L""),
+// bMarked(false), bEnabled(true)
// {
// }
// CFX_WideString cName;
@@ -103,121 +101,206 @@ public:
// HMENU hMenu;
// };
-class app : public CJS_EmbedObj
-{
-public:
- app(CJS_Object * pJSObject);
- virtual ~app();
-
-public:
- FX_BOOL activeDocs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL formsVersion(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fullscreen(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL language(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL platform(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL runtimeHighlight(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL viewerType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL viewerVariation(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL viewerVersion(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
-
-
- FX_BOOL alert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL beep(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL browseForDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL clearInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL clearTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL execDialog(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL execMenuItem(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL findComponent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL goBack(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL goForward(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL launchURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL mailMsg(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL newFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL newDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL openDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL openFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL popUpMenuEx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL popUpMenu(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL response(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setInterval(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL setTimeOut(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
-
-private:
-// FX_DWORD AppGetTickCount();
- void TimerProc(CJS_Timer* pTimer);
- void RunJsScript(CJS_Runtime * pRuntime,const CFX_WideString & wsScript);
-// void ParsePopupMenuObj(APP_MENUITEM * ppMenuItem,JSObject * pObj);
-// void DeleteMenuItems(APP_MENUITEM_ARRAY * pMenuItems);
-// void AddMenuItem(APP_MENUITEM_ARRAY * pMenuItems, HMENU hMenu, MENUITEMINFO MenuItemInfo);
-// void InitMenuItemInfo(MENUITEMINFO& MenuItemInfo);
-// void DestroyPopUpMenu();
-
-// void ParserMenuItem(APP_MENU* pHead, const CJS_Parameters&params);
-// void AddItemToMenu(APP_MENU* pHead, HMENU hMenu, MENUITEMINFO MenuItemInfo);
-// void DestroyMenuItems(APP_MENU* pHead);
-
-public:
- static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath);
-
-private:
-
- bool m_bCalculate;
- bool m_bRuntimeHighLight;
-
- CFX_ArrayTemplate<CJS_Timer*> m_aTimer;
-// APP_MENU* m_pMenuHead;
-
-public:
-// static CReader_App* s_App;
+class app : public CJS_EmbedObj {
+ public:
+ app(CJS_Object* pJSObject);
+ virtual ~app();
+
+ public:
+ FX_BOOL activeDocs(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL calculate(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL formsVersion(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL fs(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL fullscreen(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL language(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL platform(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL runtimeHighlight(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL viewerType(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL viewerVariation(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL viewerVersion(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+
+ FX_BOOL alert(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL beep(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL browseForDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL clearInterval(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL clearTimeOut(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL execDialog(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL execMenuItem(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL findComponent(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL goBack(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL goForward(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL launchURL(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL mailMsg(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL newFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL newDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL openDoc(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL openFDF(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL popUpMenuEx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL popUpMenu(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL response(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setInterval(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL setTimeOut(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+
+ private:
+ // FX_DWORD AppGetTickCount();
+ void TimerProc(CJS_Timer* pTimer);
+ void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript);
+ // void ParsePopupMenuObj(APP_MENUITEM *
+ //ppMenuItem,JSObject * pObj);
+ // void DeleteMenuItems(APP_MENUITEM_ARRAY *
+ //pMenuItems);
+ // void AddMenuItem(APP_MENUITEM_ARRAY * pMenuItems, HMENU
+ // hMenu, MENUITEMINFO MenuItemInfo);
+ // void InitMenuItemInfo(MENUITEMINFO&
+ // MenuItemInfo);
+ // void DestroyPopUpMenu();
+
+ // void ParserMenuItem(APP_MENU* pHead, const
+ // CJS_Parameters&params);
+ // void AddItemToMenu(APP_MENU* pHead, HMENU hMenu,
+ // MENUITEMINFO MenuItemInfo);
+ // void DestroyMenuItems(APP_MENU*
+ // pHead);
+
+ public:
+ static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath);
+
+ private:
+ bool m_bCalculate;
+ bool m_bRuntimeHighLight;
+
+ CFX_ArrayTemplate<CJS_Timer*> m_aTimer;
+ // APP_MENU* m_pMenuHead;
+
+ public:
+ // static CReader_App* s_App;
};
-class CJS_App : public CJS_Object
-{
-public:
- CJS_App(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_App(void){};
-
- DECLARE_JS_CLASS(CJS_App);
-
- JS_STATIC_PROP(activeDocs, app);
- JS_STATIC_PROP(calculate, app);
- JS_STATIC_PROP(formsVersion, app);
- JS_STATIC_PROP(fs, app);
- JS_STATIC_PROP(fullscreen, app);
- JS_STATIC_PROP(language, app);
- JS_STATIC_PROP(media, app);
- JS_STATIC_PROP(platform, app);
- JS_STATIC_PROP(runtimeHighlight, app);
- JS_STATIC_PROP(viewerType, app);
- JS_STATIC_PROP(viewerVariation, app);
- JS_STATIC_PROP(viewerVersion, app);
-
- JS_STATIC_METHOD(alert, app);
- JS_STATIC_METHOD(beep, app);
- JS_STATIC_METHOD(browseForDoc, app);
- JS_STATIC_METHOD(clearInterval, app);
- JS_STATIC_METHOD(clearTimeOut, app);
- JS_STATIC_METHOD(execDialog, app);
- JS_STATIC_METHOD(execMenuItem, app);
- JS_STATIC_METHOD(findComponent, app);
- JS_STATIC_METHOD(goBack, app);
- JS_STATIC_METHOD(goForward, app);
- JS_STATIC_METHOD(launchURL, app);
- JS_STATIC_METHOD(mailMsg, app);
- JS_STATIC_METHOD(newFDF, app);
- JS_STATIC_METHOD(newDoc, app);
- JS_STATIC_METHOD(openDoc, app);
- JS_STATIC_METHOD(openFDF, app);
- JS_STATIC_METHOD(popUpMenuEx, app);
- JS_STATIC_METHOD(popUpMenu, app);
- JS_STATIC_METHOD(response, app);
- JS_STATIC_METHOD(setInterval, app);
- JS_STATIC_METHOD(setTimeOut, app);
-
+class CJS_App : public CJS_Object {
+ public:
+ CJS_App(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_App(void){};
+
+ DECLARE_JS_CLASS(CJS_App);
+
+ JS_STATIC_PROP(activeDocs, app);
+ JS_STATIC_PROP(calculate, app);
+ JS_STATIC_PROP(formsVersion, app);
+ JS_STATIC_PROP(fs, app);
+ JS_STATIC_PROP(fullscreen, app);
+ JS_STATIC_PROP(language, app);
+ JS_STATIC_PROP(media, app);
+ JS_STATIC_PROP(platform, app);
+ JS_STATIC_PROP(runtimeHighlight, app);
+ JS_STATIC_PROP(viewerType, app);
+ JS_STATIC_PROP(viewerVariation, app);
+ JS_STATIC_PROP(viewerVersion, app);
+
+ JS_STATIC_METHOD(alert, app);
+ JS_STATIC_METHOD(beep, app);
+ JS_STATIC_METHOD(browseForDoc, app);
+ JS_STATIC_METHOD(clearInterval, app);
+ JS_STATIC_METHOD(clearTimeOut, app);
+ JS_STATIC_METHOD(execDialog, app);
+ JS_STATIC_METHOD(execMenuItem, app);
+ JS_STATIC_METHOD(findComponent, app);
+ JS_STATIC_METHOD(goBack, app);
+ JS_STATIC_METHOD(goForward, app);
+ JS_STATIC_METHOD(launchURL, app);
+ JS_STATIC_METHOD(mailMsg, app);
+ JS_STATIC_METHOD(newFDF, app);
+ JS_STATIC_METHOD(newDoc, app);
+ JS_STATIC_METHOD(openDoc, app);
+ JS_STATIC_METHOD(openFDF, app);
+ JS_STATIC_METHOD(popUpMenuEx, app);
+ JS_STATIC_METHOD(popUpMenu, app);
+ JS_STATIC_METHOD(response, app);
+ JS_STATIC_METHOD(setInterval, app);
+ JS_STATIC_METHOD(setTimeOut, app);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_APP_H_
diff --git a/fpdfsdk/include/javascript/color.h b/fpdfsdk/include/javascript/color.h
index df863b552f..45704efa80 100644
--- a/fpdfsdk/include/javascript/color.h
+++ b/fpdfsdk/include/javascript/color.h
@@ -10,71 +10,76 @@
#include "JS_Define.h"
// TODO(tsepez): include CPWL_Color.h once its own IWYU is fixed.
-class color : public CJS_EmbedObj
-{
-public:
- color(CJS_Object* pJSObject);
- virtual ~color(void);
+class color : public CJS_EmbedObj {
+ public:
+ color(CJS_Object* pJSObject);
+ virtual ~color(void);
- FX_BOOL black(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL blue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL cyan(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL dkGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL gray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL green(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL ltGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL magenta(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL red(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL transparent(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL white(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL yellow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL black(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL blue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL cyan(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL dkGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL gray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL green(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL ltGray(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL magenta(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL red(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL transparent(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL white(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL yellow(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL convert(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL equal(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+ FX_BOOL convert(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL equal(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
-public:
- static void ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);
- static void ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);
+ public:
+ static void ConvertPWLColorToArray(const CPWL_Color& color, CJS_Array& array);
+ static void ConvertArrayToPWLColor(CJS_Array& array, CPWL_Color& color);
-private:
- CPWL_Color m_crTransparent;
- CPWL_Color m_crBlack;
- CPWL_Color m_crWhite;
- CPWL_Color m_crRed;
- CPWL_Color m_crGreen;
- CPWL_Color m_crBlue;
- CPWL_Color m_crCyan;
- CPWL_Color m_crMagenta;
- CPWL_Color m_crYellow;
- CPWL_Color m_crDKGray;
- CPWL_Color m_crGray;
- CPWL_Color m_crLTGray;
+ private:
+ CPWL_Color m_crTransparent;
+ CPWL_Color m_crBlack;
+ CPWL_Color m_crWhite;
+ CPWL_Color m_crRed;
+ CPWL_Color m_crGreen;
+ CPWL_Color m_crBlue;
+ CPWL_Color m_crCyan;
+ CPWL_Color m_crMagenta;
+ CPWL_Color m_crYellow;
+ CPWL_Color m_crDKGray;
+ CPWL_Color m_crGray;
+ CPWL_Color m_crLTGray;
};
-class CJS_Color : public CJS_Object
-{
-public:
- CJS_Color(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Color(void){};
+class CJS_Color : public CJS_Object {
+ public:
+ CJS_Color(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Color(void){};
- DECLARE_JS_CLASS(CJS_Color);
+ DECLARE_JS_CLASS(CJS_Color);
- JS_STATIC_PROP(black, color);
- JS_STATIC_PROP(blue, color);
- JS_STATIC_PROP(cyan, color);
- JS_STATIC_PROP(dkGray, color);
- JS_STATIC_PROP(gray, color);
- JS_STATIC_PROP(green, color);
- JS_STATIC_PROP(ltGray, color);
- JS_STATIC_PROP(magenta, color);
- JS_STATIC_PROP(red, color);
- JS_STATIC_PROP(transparent, color);
- JS_STATIC_PROP(white, color);
- JS_STATIC_PROP(yellow, color);
-
- JS_STATIC_METHOD(convert,color);
- JS_STATIC_METHOD(equal,color);
+ JS_STATIC_PROP(black, color);
+ JS_STATIC_PROP(blue, color);
+ JS_STATIC_PROP(cyan, color);
+ JS_STATIC_PROP(dkGray, color);
+ JS_STATIC_PROP(gray, color);
+ JS_STATIC_PROP(green, color);
+ JS_STATIC_PROP(ltGray, color);
+ JS_STATIC_PROP(magenta, color);
+ JS_STATIC_PROP(red, color);
+ JS_STATIC_PROP(transparent, color);
+ JS_STATIC_PROP(white, color);
+ JS_STATIC_PROP(yellow, color);
+ JS_STATIC_METHOD(convert, color);
+ JS_STATIC_METHOD(equal, color);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_COLOR_H_
diff --git a/fpdfsdk/include/javascript/console.h b/fpdfsdk/include/javascript/console.h
index 0cbc291b44..a04d87b007 100644
--- a/fpdfsdk/include/javascript/console.h
+++ b/fpdfsdk/include/javascript/console.h
@@ -9,31 +9,41 @@
#include "JS_Define.h"
-class console : public CJS_EmbedObj
-{
-public:
- console(CJS_Object* pJSObject);
- virtual ~console(void);
-
-public:
- FX_BOOL clear(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL hide(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL println(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL show(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+class console : public CJS_EmbedObj {
+ public:
+ console(CJS_Object* pJSObject);
+ virtual ~console(void);
+
+ public:
+ FX_BOOL clear(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL hide(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL println(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL show(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
};
-class CJS_Console : public CJS_Object
-{
-public:
- CJS_Console(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Console(void){};
+class CJS_Console : public CJS_Object {
+ public:
+ CJS_Console(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Console(void){};
- DECLARE_JS_CLASS(CJS_Console);
+ DECLARE_JS_CLASS(CJS_Console);
- JS_STATIC_METHOD(clear, console);
- JS_STATIC_METHOD(hide, console);
- JS_STATIC_METHOD(println, console);
- JS_STATIC_METHOD(show, console);
+ JS_STATIC_METHOD(clear, console);
+ JS_STATIC_METHOD(hide, console);
+ JS_STATIC_METHOD(println, console);
+ JS_STATIC_METHOD(show, console);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_CONSOLE_H_
diff --git a/fpdfsdk/include/javascript/event.h b/fpdfsdk/include/javascript/event.h
index 91a38ba487..c7c899e69d 100644
--- a/fpdfsdk/include/javascript/event.h
+++ b/fpdfsdk/include/javascript/event.h
@@ -9,64 +9,81 @@
#include "JS_Define.h"
-class event : public CJS_EmbedObj
-{
-public:
- event(CJS_Object * pJSObject);
- virtual ~event(void);
-
-public:
- FX_BOOL change(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL changeEx(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL commitKey(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fieldFull(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL keyDown(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL modifier(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richChange(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richChangeEx(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richValue(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL selEnd(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL selStart(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL shift(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL target(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL targetName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL willCommit(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+class event : public CJS_EmbedObj {
+ public:
+ event(CJS_Object* pJSObject);
+ virtual ~event(void);
+ public:
+ FX_BOOL change(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL changeEx(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL commitKey(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL fieldFull(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL keyDown(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL modifier(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL name(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL rc(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL richChange(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL richChangeEx(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL richValue(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL selEnd(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL selStart(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL shift(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL source(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL target(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL targetName(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL type(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL value(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ FX_BOOL willCommit(IFXJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
};
-class CJS_Event : public CJS_Object
-{
-public:
- CJS_Event(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Event(void){};
+class CJS_Event : public CJS_Object {
+ public:
+ CJS_Event(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Event(void){};
- DECLARE_JS_CLASS(CJS_Event);
+ DECLARE_JS_CLASS(CJS_Event);
- JS_STATIC_PROP(change, event);
- JS_STATIC_PROP(changeEx, event);
- JS_STATIC_PROP(commitKey, event);
- JS_STATIC_PROP(fieldFull, event);
- JS_STATIC_PROP(keyDown, event);
- JS_STATIC_PROP(modifier, event);
- JS_STATIC_PROP(name, event);
- JS_STATIC_PROP(rc, event);
- JS_STATIC_PROP(richChange, event);
- JS_STATIC_PROP(richChangeEx, event);
- JS_STATIC_PROP(richValue, event);
- JS_STATIC_PROP(selEnd, event);
- JS_STATIC_PROP(selStart, event);
- JS_STATIC_PROP(shift, event);
- JS_STATIC_PROP(source, event);
- JS_STATIC_PROP(target, event);
- JS_STATIC_PROP(targetName, event);
- JS_STATIC_PROP(type, event);
- JS_STATIC_PROP(value, event);
- JS_STATIC_PROP(willCommit, event);
+ JS_STATIC_PROP(change, event);
+ JS_STATIC_PROP(changeEx, event);
+ JS_STATIC_PROP(commitKey, event);
+ JS_STATIC_PROP(fieldFull, event);
+ JS_STATIC_PROP(keyDown, event);
+ JS_STATIC_PROP(modifier, event);
+ JS_STATIC_PROP(name, event);
+ JS_STATIC_PROP(rc, event);
+ JS_STATIC_PROP(richChange, event);
+ JS_STATIC_PROP(richChangeEx, event);
+ JS_STATIC_PROP(richValue, event);
+ JS_STATIC_PROP(selEnd, event);
+ JS_STATIC_PROP(selStart, event);
+ JS_STATIC_PROP(shift, event);
+ JS_STATIC_PROP(source, event);
+ JS_STATIC_PROP(target, event);
+ JS_STATIC_PROP(targetName, event);
+ JS_STATIC_PROP(type, event);
+ JS_STATIC_PROP(value, event);
+ JS_STATIC_PROP(willCommit, event);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_EVENT_H_
diff --git a/fpdfsdk/include/javascript/global.h b/fpdfsdk/include/javascript/global.h
index 83e07f67c3..303ac76a3e 100644
--- a/fpdfsdk/include/javascript/global.h
+++ b/fpdfsdk/include/javascript/global.h
@@ -13,77 +13,82 @@ class CJS_GlobalData;
class CJS_GlobalVariableArray;
class CJS_KeyValue;
-struct js_global_data
-{
- js_global_data()
- {
- nType = 0;
- dData = 0;
- bData = FALSE;
- sData = "";
- bPersistent = FALSE;
- bDeleted = FALSE;
- }
-
- ~js_global_data()
- {
- pData.Reset();
- }
- int nType; //0:int 1:bool 2:string 3:obj
- double dData;
- bool bData;
- CFX_ByteString sData;
- v8::Global<v8::Object> pData;
- bool bPersistent;
- bool bDeleted;
+struct js_global_data {
+ js_global_data() {
+ nType = 0;
+ dData = 0;
+ bData = FALSE;
+ sData = "";
+ bPersistent = FALSE;
+ bDeleted = FALSE;
+ }
+
+ ~js_global_data() { pData.Reset(); }
+ int nType; // 0:int 1:bool 2:string 3:obj
+ double dData;
+ bool bData;
+ CFX_ByteString sData;
+ v8::Global<v8::Object> pData;
+ bool bPersistent;
+ bool bDeleted;
};
-class global_alternate : public CJS_EmbedObj
-{
-public:
- global_alternate(CJS_Object* pJSObject);
- virtual ~global_alternate();
-
-public:
- FX_BOOL setPersistent(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
-
-public:
- FX_BOOL QueryProperty(const FX_WCHAR* propname);
- FX_BOOL DoProperty(IFXJS_Context* cc, const FX_WCHAR* propname, CJS_PropValue & vp, CFX_WideString & sError);
- FX_BOOL DelProperty(IFXJS_Context* cc, const FX_WCHAR* propname, CFX_WideString & sError);
-
- void Initial(CPDFDoc_Environment* pApp);
-
-private:
- void UpdateGlobalPersistentVariables();
- void CommitGlobalPersisitentVariables();
- void DestroyGlobalPersisitentVariables();
- FX_BOOL SetGlobalVariables(const FX_CHAR* propname, int nType,
- double dData, bool bData, const CFX_ByteString& sData, JSObject pData, bool bDefaultPersistent);
-
- void ObjectToArray(v8::Local<v8::Object> pObj, CJS_GlobalVariableArray& array);
- void PutObjectProperty(v8::Local<v8::Object> obj, CJS_KeyValue* pData);
-
-private:
- CFX_MapByteStringToPtr m_mapGlobal;
- CFX_WideString m_sFilePath;
- CJS_GlobalData* m_pGlobalData;
- CPDFDoc_Environment* m_pApp;
+class global_alternate : public CJS_EmbedObj {
+ public:
+ global_alternate(CJS_Object* pJSObject);
+ virtual ~global_alternate();
+
+ public:
+ FX_BOOL setPersistent(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+
+ public:
+ FX_BOOL QueryProperty(const FX_WCHAR* propname);
+ FX_BOOL DoProperty(IFXJS_Context* cc,
+ const FX_WCHAR* propname,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ FX_BOOL DelProperty(IFXJS_Context* cc,
+ const FX_WCHAR* propname,
+ CFX_WideString& sError);
+
+ void Initial(CPDFDoc_Environment* pApp);
+
+ private:
+ void UpdateGlobalPersistentVariables();
+ void CommitGlobalPersisitentVariables();
+ void DestroyGlobalPersisitentVariables();
+ FX_BOOL SetGlobalVariables(const FX_CHAR* propname,
+ int nType,
+ double dData,
+ bool bData,
+ const CFX_ByteString& sData,
+ JSObject pData,
+ bool bDefaultPersistent);
+
+ void ObjectToArray(v8::Local<v8::Object> pObj,
+ CJS_GlobalVariableArray& array);
+ void PutObjectProperty(v8::Local<v8::Object> obj, CJS_KeyValue* pData);
+
+ private:
+ CFX_MapByteStringToPtr m_mapGlobal;
+ CFX_WideString m_sFilePath;
+ CJS_GlobalData* m_pGlobalData;
+ CPDFDoc_Environment* m_pApp;
};
+class CJS_Global : public CJS_Object {
+ public:
+ CJS_Global(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Global(void){};
-class CJS_Global : public CJS_Object
-{
-public:
- CJS_Global(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Global(void){};
+ virtual FX_BOOL InitInstance(IFXJS_Context* cc);
- virtual FX_BOOL InitInstance(IFXJS_Context* cc);
-
- DECLARE_SPECIAL_JS_CLASS(CJS_Global);
-
- JS_SPECIAL_STATIC_METHOD(setPersistent, global_alternate, global);
+ DECLARE_SPECIAL_JS_CLASS(CJS_Global);
+ JS_SPECIAL_STATIC_METHOD(setPersistent, global_alternate, global);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_GLOBAL_H_
diff --git a/fpdfsdk/include/javascript/report.h b/fpdfsdk/include/javascript/report.h
index 56f742ce08..a9004fd46a 100644
--- a/fpdfsdk/include/javascript/report.h
+++ b/fpdfsdk/include/javascript/report.h
@@ -9,28 +9,32 @@
#include "JS_Define.h"
-class Report : public CJS_EmbedObj
-{
-public:
- Report(CJS_Object * pJSObject);
- virtual ~Report();
-
-public:
- FX_BOOL save(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL writeText(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
+class Report : public CJS_EmbedObj {
+ public:
+ Report(CJS_Object* pJSObject);
+ virtual ~Report();
+
+ public:
+ FX_BOOL save(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL writeText(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
};
-class CJS_Report : public CJS_Object
-{
-public:
- CJS_Report(JSFXObject pObject) : CJS_Object(pObject){};
- virtual ~CJS_Report(){};
+class CJS_Report : public CJS_Object {
+ public:
+ CJS_Report(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Report(){};
-public:
- DECLARE_JS_CLASS(CJS_Report);
+ public:
+ DECLARE_JS_CLASS(CJS_Report);
- JS_STATIC_METHOD(save, Report)
- JS_STATIC_METHOD(writeText, Report);
+ JS_STATIC_METHOD(save, Report)
+ JS_STATIC_METHOD(writeText, Report);
};
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_REPORT_H_
diff --git a/fpdfsdk/include/javascript/resource.h b/fpdfsdk/include/javascript/resource.h
index 433785984d..80629cf2ae 100644
--- a/fpdfsdk/include/javascript/resource.h
+++ b/fpdfsdk/include/javascript/resource.h
@@ -8,28 +8,28 @@
#define FPDFSDK_INCLUDE_JAVASCRIPT_RESOURCE_H_
#include "../../../core/include/fxcrt/fx_string.h" // For CFX_WideString.
-#include "../fsdk_define.h" // For FX_UINT.
+#include "../fsdk_define.h" // For FX_UINT.
class CJS_Context;
-#define IDS_STRING_JSALERT 25613
-#define IDS_STRING_JSPARAMERROR 25614
+#define IDS_STRING_JSALERT 25613
+#define IDS_STRING_JSPARAMERROR 25614
#define IDS_STRING_JSAFNUMBER_KEYSTROKE 25615
-#define IDS_STRING_JSPARAM_TOOLONG 25617
-#define IDS_STRING_JSPARSEDATE 25618
-#define IDS_STRING_JSRANGE1 25619
-#define IDS_STRING_JSRANGE2 25620
-#define IDS_STRING_JSRANGE3 25621
-#define IDS_STRING_NOTSUPPORT 25627
-#define IDS_STRING_JSBUSY 25628
-#define IDS_STRING_JSEVENT 25629
-#define IDS_STRING_RUN 25630
-#define IDS_STRING_JSPRINT1 25632
-#define IDS_STRING_JSPRINT2 25633
-#define IDS_STRING_JSNOGLOBAL 25635
-#define IDS_STRING_JSREADONLY 25636
-#define IDS_STRING_JSTYPEERROR 25637
-#define IDS_STRING_JSVALUEERROR 25638
+#define IDS_STRING_JSPARAM_TOOLONG 25617
+#define IDS_STRING_JSPARSEDATE 25618
+#define IDS_STRING_JSRANGE1 25619
+#define IDS_STRING_JSRANGE2 25620
+#define IDS_STRING_JSRANGE3 25621
+#define IDS_STRING_NOTSUPPORT 25627
+#define IDS_STRING_JSBUSY 25628
+#define IDS_STRING_JSEVENT 25629
+#define IDS_STRING_RUN 25630
+#define IDS_STRING_JSPRINT1 25632
+#define IDS_STRING_JSPRINT2 25633
+#define IDS_STRING_JSNOGLOBAL 25635
+#define IDS_STRING_JSREADONLY 25636
+#define IDS_STRING_JSTYPEERROR 25637
+#define IDS_STRING_JSVALUEERROR 25638
CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT id);
CFX_WideString JSFormatErrorString(const char* class_name,
diff --git a/fpdfsdk/include/javascript/util.h b/fpdfsdk/include/javascript/util.h
index ca4db349da..2e65bd3f58 100644
--- a/fpdfsdk/include/javascript/util.h
+++ b/fpdfsdk/include/javascript/util.h
@@ -11,40 +11,58 @@
#include "JS_Define.h"
-class util : public CJS_EmbedObj
-{
-public:
- util(CJS_Object * pJSObject);
- virtual ~util(void);
-
-public:
- FX_BOOL printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL printx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
- FX_BOOL byteToChar(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError);
-
-public:
- static void printd(const std::wstring &cFormat,CJS_Date Date,bool bXFAPicture, std::wstring &cPurpose);
- static void printx(const std::string &cFormat,const std::string &cSource, std::string &cPurpose);
- static int ParstDataType(std::wstring* sFormat);
+class util : public CJS_EmbedObj {
+ public:
+ util(CJS_Object* pJSObject);
+ virtual ~util(void);
+
+ public:
+ FX_BOOL printd(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL printf(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL printx(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL scand(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ FX_BOOL byteToChar(IFXJS_Context* cc,
+ const CJS_Parameters& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+
+ public:
+ static void printd(const std::wstring& cFormat,
+ CJS_Date Date,
+ bool bXFAPicture,
+ std::wstring& cPurpose);
+ static void printx(const std::string& cFormat,
+ const std::string& cSource,
+ std::string& cPurpose);
+ static int ParstDataType(std::wstring* sFormat);
};
-class CJS_Util : public CJS_Object
-{
-public:
- CJS_Util(JSFXObject pObject) : CJS_Object(pObject) {};
- virtual ~CJS_Util(void){};
+class CJS_Util : public CJS_Object {
+ public:
+ CJS_Util(JSFXObject pObject) : CJS_Object(pObject){};
+ virtual ~CJS_Util(void){};
- DECLARE_JS_CLASS(CJS_Util);
+ DECLARE_JS_CLASS(CJS_Util);
- JS_STATIC_METHOD(printd, util);
- JS_STATIC_METHOD(printf, util);
- JS_STATIC_METHOD(printx, util);
- JS_STATIC_METHOD(scand, util);
- JS_STATIC_METHOD(byteToChar, util);
+ JS_STATIC_METHOD(printd, util);
+ JS_STATIC_METHOD(printf, util);
+ JS_STATIC_METHOD(printx, util);
+ JS_STATIC_METHOD(scand, util);
+ JS_STATIC_METHOD(byteToChar, util);
};
-int64_t FX_atoi64(const char *nptr);
+int64_t FX_atoi64(const char* nptr);
#endif // FPDFSDK_INCLUDE_JAVASCRIPT_UTIL_H_