| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_DOCUMENT_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_DOCUMENT_H_ |
| 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_DOCUMENT_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_DOCUMENT_H_ |
| 9 | 9 |
| 10 #include "JS_Define.h" | 10 #include "JS_Define.h" |
| 11 | 11 |
| 12 class PrintParamsObj : public CJS_EmbedObj | 12 class PrintParamsObj : public CJS_EmbedObj { |
| 13 { | 13 public: |
| 14 public: | 14 PrintParamsObj(CJS_Object* pJSObject); |
| 15 » PrintParamsObj(CJS_Object* pJSObject); | 15 virtual ~PrintParamsObj() {} |
| 16 » virtual ~PrintParamsObj(){} | 16 |
| 17 | 17 public: |
| 18 public: | 18 FX_BOOL bUI; |
| 19 » FX_BOOL bUI; | 19 int nStart; |
| 20 » int nStart; | 20 int nEnd; |
| 21 » int nEnd; | 21 FX_BOOL bSilent; |
| 22 » FX_BOOL bSilent; | 22 FX_BOOL bShrinkToFit; |
| 23 » FX_BOOL bShrinkToFit; | 23 FX_BOOL bPrintAsImage; |
| 24 » FX_BOOL bPrintAsImage; | 24 FX_BOOL bReverse; |
| 25 » FX_BOOL bReverse; | 25 FX_BOOL bAnnotations; |
| 26 » FX_BOOL bAnnotations; | 26 }; |
| 27 }; | 27 |
| 28 | 28 class CJS_PrintParamsObj : public CJS_Object { |
| 29 class CJS_PrintParamsObj : public CJS_Object | 29 public: |
| 30 { | 30 CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {} |
| 31 public: | 31 virtual ~CJS_PrintParamsObj() {} |
| 32 » CJS_PrintParamsObj(JSFXObject pObject) : CJS_Object(pObject) {} | 32 |
| 33 » virtual ~CJS_PrintParamsObj(){} | 33 DECLARE_JS_CLASS(CJS_PrintParamsObj); |
| 34 | 34 }; |
| 35 » DECLARE_JS_CLASS(CJS_PrintParamsObj); | |
| 36 }; | |
| 37 | |
| 38 | 35 |
| 39 class Icon; | 36 class Icon; |
| 40 class Field; | 37 class Field; |
| 41 | 38 |
| 42 struct IconElement | 39 struct IconElement { |
| 43 { | 40 IconElement() : IconName(L""), NextIcon(NULL), IconStream(NULL) {} |
| 44 » IconElement() : IconName(L""), NextIcon(NULL), IconStream(NULL) {} | 41 virtual ~IconElement() {} |
| 45 » virtual ~IconElement() | 42 CFX_WideString IconName; |
| 46 » { | 43 IconElement* NextIcon; |
| 47 » } | 44 Icon* IconStream; |
| 48 » CFX_WideString» IconName; | 45 }; |
| 49 » IconElement*» NextIcon; | 46 |
| 50 » Icon*» » » IconStream; | 47 class IconTree { |
| 51 }; | 48 public: |
| 52 | 49 IconTree() : m_pHead(NULL), m_pEnd(NULL), m_iLength(0) {} |
| 53 class IconTree | 50 |
| 54 { | 51 virtual ~IconTree() {} |
| 55 public: | 52 |
| 56 » IconTree():m_pHead(NULL), m_pEnd(NULL), m_iLength(0) | 53 public: |
| 57 » { | 54 void InsertIconElement(IconElement* pNewIcon); |
| 58 | 55 void DeleteIconTree(); |
| 59 » } | 56 int GetLength(); |
| 60 | 57 IconElement* operator[](int iIndex); |
| 61 » virtual ~IconTree() | 58 |
| 62 » { | 59 private: |
| 63 » } | 60 IconElement* m_pHead; |
| 64 | 61 IconElement* m_pEnd; |
| 65 public: | 62 int m_iLength; |
| 66 » void» » » InsertIconElement(IconElement* pNewIcon); | |
| 67 » void» » » DeleteIconTree(); | |
| 68 » int» » » » GetLength(); | |
| 69 » IconElement*» operator[](int iIndex); | |
| 70 | |
| 71 private: | |
| 72 » IconElement*» m_pHead; | |
| 73 » IconElement*» m_pEnd; | |
| 74 » int» » » » m_iLength; | |
| 75 }; | 63 }; |
| 76 | 64 |
| 77 struct CJS_DelayData; | 65 struct CJS_DelayData; |
| 78 struct CJS_DelayAnnot; | 66 struct CJS_DelayAnnot; |
| 79 struct CJS_AnnotObj; | 67 struct CJS_AnnotObj; |
| 80 | 68 |
| 81 class Document : public CJS_EmbedObj | 69 class Document : public CJS_EmbedObj { |
| 82 { | 70 public: |
| 83 public: | 71 Document(CJS_Object* pJSObject); |
| 84 Document(CJS_Object* pJSObject); | 72 virtual ~Document(); |
| 85 virtual ~Document(); | 73 |
| 86 | 74 public: |
| 87 public: | 75 FX_BOOL ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 88 FX_BOOL ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r); | 76 FX_BOOL author(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 89 FX_BOOL author(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror); | 77 FX_BOOL baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 90 FX_BOOL baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror); | 78 FX_BOOL bookmarkRoot(IFXJS_Context* cc, |
| 91 FX_BOOL bookmarkRoot(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStrin
g& sError); | 79 CJS_PropValue& vp, |
| 92 FX_BOOL calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError); | 80 CFX_WideString& sError); |
| 93 FX_BOOL Collab(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror); | 81 FX_BOOL calculate(IFXJS_Context* cc, |
| 94 FX_BOOL creationDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStrin
g& sError); | 82 CJS_PropValue& vp, |
| 95 FX_BOOL creator(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror); | 83 CFX_WideString& sError); |
| 96 FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or); | 84 FX_BOOL Collab(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 97 FX_BOOL dirty(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or); | 85 FX_BOOL creationDate(IFXJS_Context* cc, |
| 98 FX_BOOL documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideS
tring& sError); | 86 CJS_PropValue& vp, |
| 99 FX_BOOL external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error); | 87 CFX_WideString& sError); |
| 100 FX_BOOL filesize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error); | 88 FX_BOOL creator(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 101 FX_BOOL icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or); | 89 FX_BOOL delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 102 FX_BOOL info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r); | 90 FX_BOOL dirty(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 103 FX_BOOL keywords(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error); | 91 FX_BOOL documentFileName(IFXJS_Context* cc, |
| 104 FX_BOOL layout(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror); | 92 CJS_PropValue& vp, |
| 105 FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or); | 93 CFX_WideString& sError); |
| 106 FX_BOOL modDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror); | 94 FX_BOOL external(IFXJS_Context* cc, |
| 107 FX_BOOL mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror); | 95 CJS_PropValue& vp, |
| 108 FX_BOOL mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror); | 96 CFX_WideString& sError); |
| 109 FX_BOOL numFields(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError); | 97 FX_BOOL filesize(IFXJS_Context* cc, |
| 110 FX_BOOL numPages(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error); | 98 CJS_PropValue& vp, |
| 111 FX_BOOL pageNum(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror); | 99 CFX_WideString& sError); |
| 112 FX_BOOL pageWindowRect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr
ing& sError); | 100 FX_BOOL icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 113 FX_BOOL path(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r); | 101 FX_BOOL info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 114 FX_BOOL producer(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error); | 102 FX_BOOL keywords(IFXJS_Context* cc, |
| 115 FX_BOOL subject(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror); | 103 CJS_PropValue& vp, |
| 116 FX_BOOL title(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErr
or); | 104 CFX_WideString& sError); |
| 117 FX_BOOL zoom(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sErro
r); | 105 FX_BOOL layout(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 118 FX_BOOL zoomType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error); | 106 FX_BOOL media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 119 | 107 FX_BOOL modDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 120 FX_BOOL addAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError); | 108 FX_BOOL mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 121 FX_BOOL addField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError); | 109 FX_BOOL mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 122 FX_BOOL addLink(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError); | 110 FX_BOOL numFields(IFXJS_Context* cc, |
| 123 FX_BOOL addIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError); | 111 CJS_PropValue& vp, |
| 124 FX_BOOL calculateNow(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError); | 112 CFX_WideString& sError); |
| 125 FX_BOOL closeDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError); | 113 FX_BOOL numPages(IFXJS_Context* cc, |
| 126 FX_BOOL createDataObject(IFXJS_Context* cc, const CJS_Parameters& params
, CJS_Value& vRet, CFX_WideString& sError); | 114 CJS_PropValue& vp, |
| 127 FX_BOOL deletePages(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError); | 115 CFX_WideString& sError); |
| 128 FX_BOOL exportAsText(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError); | 116 FX_BOOL pageNum(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 129 FX_BOOL exportAsFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError); | 117 FX_BOOL pageWindowRect(IFXJS_Context* cc, |
| 130 FX_BOOL exportAsXFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError); | 118 CJS_PropValue& vp, |
| 131 FX_BOOL extractPages(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError); | 119 CFX_WideString& sError); |
| 132 FX_BOOL getAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError); | 120 FX_BOOL path(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 133 FX_BOOL getAnnots(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError); | 121 FX_BOOL producer(IFXJS_Context* cc, |
| 134 FX_BOOL getAnnot3D(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError); | 122 CJS_PropValue& vp, |
| 135 FX_BOOL getAnnots3D(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError); | 123 CFX_WideString& sError); |
| 136 FX_BOOL getField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError); | 124 FX_BOOL subject(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 137 FX_BOOL getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError); | 125 FX_BOOL title(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 138 FX_BOOL getLinks(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError); | 126 FX_BOOL zoom(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
| 139 FX_BOOL getNthFieldName(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError); | 127 FX_BOOL zoomType(IFXJS_Context* cc, |
| 140 FX_BOOL getOCGs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError); | 128 CJS_PropValue& vp, |
| 141 FX_BOOL getPageBox(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError); | 129 CFX_WideString& sError); |
| 142 FX_BOOL getPageNthWord(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError); | 130 |
| 143 FX_BOOL getPageNthWordQuads(IFXJS_Context* cc, const CJS_Parameters& par
ams, CJS_Value& vRet, CFX_WideString& sError); | 131 FX_BOOL addAnnot(IFXJS_Context* cc, |
| 144 FX_BOOL getPageNumWords(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError); | 132 const CJS_Parameters& params, |
| 145 FX_BOOL getPrintParams(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError); | 133 CJS_Value& vRet, |
| 146 FX_BOOL getURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, CFX_WideString& sError); | 134 CFX_WideString& sError); |
| 147 FX_BOOL importAnFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError); | 135 FX_BOOL addField(IFXJS_Context* cc, |
| 148 FX_BOOL importAnXFDF(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError); | 136 const CJS_Parameters& params, |
| 149 FX_BOOL importTextData(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError); | 137 CJS_Value& vRet, |
| 150 FX_BOOL insertPages(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError); | 138 CFX_WideString& sError); |
| 151 FX_BOOL mailForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError); | 139 FX_BOOL addLink(IFXJS_Context* cc, |
| 152 FX_BOOL print(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value
& vRet, CFX_WideString& sError); | 140 const CJS_Parameters& params, |
| 153 FX_BOOL removeField(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError); | 141 CJS_Value& vRet, |
| 154 FX_BOOL replacePages(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError); | 142 CFX_WideString& sError); |
| 155 FX_BOOL resetForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError); | 143 FX_BOOL addIcon(IFXJS_Context* cc, |
| 156 FX_BOOL saveAs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Valu
e& vRet, CFX_WideString& sError); | 144 const CJS_Parameters& params, |
| 157 FX_BOOL submitForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError); | 145 CJS_Value& vRet, |
| 158 FX_BOOL mailDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError); | 146 CFX_WideString& sError); |
| 159 FX_BOOL removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError); | 147 FX_BOOL calculateNow(IFXJS_Context* cc, |
| 160 | 148 const CJS_Parameters& params, |
| 161 public: | 149 CJS_Value& vRet, |
| 162 void AttachDoc(CPDFSDK_Document* pDoc
); | 150 CFX_WideString& sError); |
| 163 CPDFSDK_Document* GetReaderDoc(); | 151 FX_BOOL closeDoc(IFXJS_Context* cc, |
| 164 static FX_BOOL ExtractFileName(CPDFSDK_Document
* pDoc, CFX_ByteString& strFileName); | 152 const CJS_Parameters& params, |
| 165 static FX_BOOL ExtractFolderName(CPDFSDK_Docume
nt* pDoc, CFX_ByteString& strFolderName); | 153 CJS_Value& vRet, |
| 166 void AddDelayData(CJS_DelayData* pDat
a); | 154 CFX_WideString& sError); |
| 167 void DoFieldDelay(const CFX_WideStrin
g& sFieldName, int nControlIndex); | 155 FX_BOOL createDataObject(IFXJS_Context* cc, |
| 168 void AddDelayAnnotData(CJS_AnnotObj *
pData); | 156 const CJS_Parameters& params, |
| 169 void DoAnnotDelay(); | 157 CJS_Value& vRet, |
| 170 void SetIsolate(v8::Isolate* isolate)
{m_isolate = isolate;} | 158 CFX_WideString& sError); |
| 171 CJS_Document* GetCJSDoc() const; | 159 FX_BOOL deletePages(IFXJS_Context* cc, |
| 172 | 160 const CJS_Parameters& params, |
| 173 private: | 161 CJS_Value& vRet, |
| 174 CFX_WideString ReversalStr(CFX_WideString cbFro
m); | 162 CFX_WideString& sError); |
| 175 CFX_WideString CutString(CFX_WideString cbFrom)
; | 163 FX_BOOL exportAsText(IFXJS_Context* cc, |
| 176 bool IsEnclosedInRect(CFX_FloatRect r
ect, CFX_FloatRect LinkRect); | 164 const CJS_Parameters& params, |
| 177 int CountWords(CPDF_TextObject* pTex
tObj); | 165 CJS_Value& vRet, |
| 178 CFX_WideString GetObjWordStr(CPDF_TextObject* p
TextObj, int nWordIndex); | 166 CFX_WideString& sError); |
| 179 FX_BOOL ParserParams(JSObject *pObj,CJS_
AnnotObj& annotobj); | 167 FX_BOOL exportAsFDF(IFXJS_Context* cc, |
| 180 | 168 const CJS_Parameters& params, |
| 181 v8::Isolate* m_isolate; | 169 CJS_Value& vRet, |
| 182 IconTree* m_pIconTree; | 170 CFX_WideString& sError); |
| 183 CPDFSDK_Document* m_pDocument; | 171 FX_BOOL exportAsXFDF(IFXJS_Context* cc, |
| 184 CFX_WideString m_cwBaseURL; | 172 const CJS_Parameters& params, |
| 185 bool m_bDelay; | 173 CJS_Value& vRet, |
| 186 CFX_ArrayTemplate<CJS_DelayData*> m_DelayData; | 174 CFX_WideString& sError); |
| 187 CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData; | 175 FX_BOOL extractPages(IFXJS_Context* cc, |
| 188 }; | 176 const CJS_Parameters& params, |
| 189 | 177 CJS_Value& vRet, |
| 190 class CJS_Document : public CJS_Object | 178 CFX_WideString& sError); |
| 191 { | 179 FX_BOOL getAnnot(IFXJS_Context* cc, |
| 192 public: | 180 const CJS_Parameters& params, |
| 193 CJS_Document(JSFXObject pObject) : CJS_Object(pObject) {}; | 181 CJS_Value& vRet, |
| 194 virtual ~CJS_Document(){}; | 182 CFX_WideString& sError); |
| 195 | 183 FX_BOOL getAnnots(IFXJS_Context* cc, |
| 196 virtual FX_BOOL InitInstance(IFXJS_Context* cc); | 184 const CJS_Parameters& params, |
| 197 | 185 CJS_Value& vRet, |
| 198 DECLARE_JS_CLASS(CJS_Document); | 186 CFX_WideString& sError); |
| 199 | 187 FX_BOOL getAnnot3D(IFXJS_Context* cc, |
| 200 JS_STATIC_PROP(ADBE, Document); | 188 const CJS_Parameters& params, |
| 201 JS_STATIC_PROP(author, Document); | 189 CJS_Value& vRet, |
| 202 JS_STATIC_PROP(baseURL, Document); | 190 CFX_WideString& sError); |
| 203 JS_STATIC_PROP(bookmarkRoot, Document); | 191 FX_BOOL getAnnots3D(IFXJS_Context* cc, |
| 204 JS_STATIC_PROP(calculate, Document); | 192 const CJS_Parameters& params, |
| 205 JS_STATIC_PROP(Collab, Document); | 193 CJS_Value& vRet, |
| 206 JS_STATIC_PROP(creationDate, Document); | 194 CFX_WideString& sError); |
| 207 JS_STATIC_PROP(creator, Document); | 195 FX_BOOL getField(IFXJS_Context* cc, |
| 208 JS_STATIC_PROP(delay, Document); | 196 const CJS_Parameters& params, |
| 209 JS_STATIC_PROP(dirty, Document); | 197 CJS_Value& vRet, |
| 210 JS_STATIC_PROP(documentFileName, Document); | 198 CFX_WideString& sError); |
| 211 JS_STATIC_PROP(external, Document); | 199 FX_BOOL getIcon(IFXJS_Context* cc, |
| 212 JS_STATIC_PROP(filesize, Document); | 200 const CJS_Parameters& params, |
| 213 JS_STATIC_PROP(icons, Document); | 201 CJS_Value& vRet, |
| 214 JS_STATIC_PROP(info, Document); | 202 CFX_WideString& sError); |
| 215 JS_STATIC_PROP(keywords, Document); | 203 FX_BOOL getLinks(IFXJS_Context* cc, |
| 216 JS_STATIC_PROP(layout, Document); | 204 const CJS_Parameters& params, |
| 217 JS_STATIC_PROP(media, Document); | 205 CJS_Value& vRet, |
| 218 JS_STATIC_PROP(modDate, Document); | 206 CFX_WideString& sError); |
| 219 JS_STATIC_PROP(mouseX, Document); | 207 FX_BOOL getNthFieldName(IFXJS_Context* cc, |
| 220 JS_STATIC_PROP(mouseY, Document); | 208 const CJS_Parameters& params, |
| 221 JS_STATIC_PROP(numFields, Document); | 209 CJS_Value& vRet, |
| 222 JS_STATIC_PROP(numPages, Document); | 210 CFX_WideString& sError); |
| 223 JS_STATIC_PROP(pageNum, Document); | 211 FX_BOOL getOCGs(IFXJS_Context* cc, |
| 224 JS_STATIC_PROP(pageWindowRect, Document); | 212 const CJS_Parameters& params, |
| 225 JS_STATIC_PROP(path, Document); | 213 CJS_Value& vRet, |
| 226 JS_STATIC_PROP(producer, Document); | 214 CFX_WideString& sError); |
| 227 JS_STATIC_PROP(subject, Document); | 215 FX_BOOL getPageBox(IFXJS_Context* cc, |
| 228 JS_STATIC_PROP(title, Document); | 216 const CJS_Parameters& params, |
| 229 JS_STATIC_PROP(zoom, Document); | 217 CJS_Value& vRet, |
| 230 JS_STATIC_PROP(zoomType, Document); | 218 CFX_WideString& sError); |
| 231 | 219 FX_BOOL getPageNthWord(IFXJS_Context* cc, |
| 232 JS_STATIC_METHOD(addAnnot,Document); | 220 const CJS_Parameters& params, |
| 233 JS_STATIC_METHOD(addField, Document); | 221 CJS_Value& vRet, |
| 234 JS_STATIC_METHOD(addLink, Document); | 222 CFX_WideString& sError); |
| 235 JS_STATIC_METHOD(addIcon, Document); | 223 FX_BOOL getPageNthWordQuads(IFXJS_Context* cc, |
| 236 JS_STATIC_METHOD(calculateNow, Document); | 224 const CJS_Parameters& params, |
| 237 JS_STATIC_METHOD(closeDoc, Document); | 225 CJS_Value& vRet, |
| 238 JS_STATIC_METHOD(createDataObject, Document); | 226 CFX_WideString& sError); |
| 239 JS_STATIC_METHOD(deletePages, Document); | 227 FX_BOOL getPageNumWords(IFXJS_Context* cc, |
| 240 JS_STATIC_METHOD(exportAsText, Document); | 228 const CJS_Parameters& params, |
| 241 JS_STATIC_METHOD(exportAsFDF, Document); | 229 CJS_Value& vRet, |
| 242 JS_STATIC_METHOD(exportAsXFDF, Document); | 230 CFX_WideString& sError); |
| 243 JS_STATIC_METHOD(extractPages, Document); | 231 FX_BOOL getPrintParams(IFXJS_Context* cc, |
| 244 JS_STATIC_METHOD(getAnnot, Document); | 232 const CJS_Parameters& params, |
| 245 JS_STATIC_METHOD(getAnnots, Document); | 233 CJS_Value& vRet, |
| 246 JS_STATIC_METHOD(getAnnot3D, Document); | 234 CFX_WideString& sError); |
| 247 JS_STATIC_METHOD(getAnnots3D, Document); | 235 FX_BOOL getURL(IFXJS_Context* cc, |
| 248 JS_STATIC_METHOD(getField, Document); | 236 const CJS_Parameters& params, |
| 249 JS_STATIC_METHOD(getIcon, Document); | 237 CJS_Value& vRet, |
| 250 JS_STATIC_METHOD(getLinks, Document); | 238 CFX_WideString& sError); |
| 251 JS_STATIC_METHOD(getNthFieldName, Document); | 239 FX_BOOL importAnFDF(IFXJS_Context* cc, |
| 252 JS_STATIC_METHOD(getOCGs, Document); | 240 const CJS_Parameters& params, |
| 253 JS_STATIC_METHOD(getPageBox, Document); | 241 CJS_Value& vRet, |
| 254 JS_STATIC_METHOD(getPageNthWord, Document); | 242 CFX_WideString& sError); |
| 255 JS_STATIC_METHOD(getPageNthWordQuads, Document); | 243 FX_BOOL importAnXFDF(IFXJS_Context* cc, |
| 256 JS_STATIC_METHOD(getPageNumWords, Document); | 244 const CJS_Parameters& params, |
| 257 JS_STATIC_METHOD(getPrintParams, Document); | 245 CJS_Value& vRet, |
| 258 JS_STATIC_METHOD(getURL, Document); | 246 CFX_WideString& sError); |
| 259 JS_STATIC_METHOD(importAnFDF, Document); | 247 FX_BOOL importTextData(IFXJS_Context* cc, |
| 260 JS_STATIC_METHOD(importAnXFDF, Document); | 248 const CJS_Parameters& params, |
| 261 JS_STATIC_METHOD(importTextData, Document); | 249 CJS_Value& vRet, |
| 262 JS_STATIC_METHOD(insertPages, Document); | 250 CFX_WideString& sError); |
| 263 JS_STATIC_METHOD(mailForm, Document); | 251 FX_BOOL insertPages(IFXJS_Context* cc, |
| 264 JS_STATIC_METHOD(print, Document); | 252 const CJS_Parameters& params, |
| 265 JS_STATIC_METHOD(removeField, Document); | 253 CJS_Value& vRet, |
| 266 JS_STATIC_METHOD(replacePages, Document); | 254 CFX_WideString& sError); |
| 267 JS_STATIC_METHOD(removeIcon, Document); | 255 FX_BOOL mailForm(IFXJS_Context* cc, |
| 268 JS_STATIC_METHOD(resetForm, Document); | 256 const CJS_Parameters& params, |
| 269 JS_STATIC_METHOD(saveAs, Document); | 257 CJS_Value& vRet, |
| 270 JS_STATIC_METHOD(submitForm, Document); | 258 CFX_WideString& sError); |
| 271 JS_STATIC_METHOD(mailDoc, Document); | 259 FX_BOOL print(IFXJS_Context* cc, |
| 260 const CJS_Parameters& params, |
| 261 CJS_Value& vRet, |
| 262 CFX_WideString& sError); |
| 263 FX_BOOL removeField(IFXJS_Context* cc, |
| 264 const CJS_Parameters& params, |
| 265 CJS_Value& vRet, |
| 266 CFX_WideString& sError); |
| 267 FX_BOOL replacePages(IFXJS_Context* cc, |
| 268 const CJS_Parameters& params, |
| 269 CJS_Value& vRet, |
| 270 CFX_WideString& sError); |
| 271 FX_BOOL resetForm(IFXJS_Context* cc, |
| 272 const CJS_Parameters& params, |
| 273 CJS_Value& vRet, |
| 274 CFX_WideString& sError); |
| 275 FX_BOOL saveAs(IFXJS_Context* cc, |
| 276 const CJS_Parameters& params, |
| 277 CJS_Value& vRet, |
| 278 CFX_WideString& sError); |
| 279 FX_BOOL submitForm(IFXJS_Context* cc, |
| 280 const CJS_Parameters& params, |
| 281 CJS_Value& vRet, |
| 282 CFX_WideString& sError); |
| 283 FX_BOOL mailDoc(IFXJS_Context* cc, |
| 284 const CJS_Parameters& params, |
| 285 CJS_Value& vRet, |
| 286 CFX_WideString& sError); |
| 287 FX_BOOL removeIcon(IFXJS_Context* cc, |
| 288 const CJS_Parameters& params, |
| 289 CJS_Value& vRet, |
| 290 CFX_WideString& sError); |
| 291 |
| 292 public: |
| 293 void AttachDoc(CPDFSDK_Document* pDoc); |
| 294 CPDFSDK_Document* GetReaderDoc(); |
| 295 static FX_BOOL ExtractFileName(CPDFSDK_Document* pDoc, |
| 296 CFX_ByteString& strFileName); |
| 297 static FX_BOOL ExtractFolderName(CPDFSDK_Document* pDoc, |
| 298 CFX_ByteString& strFolderName); |
| 299 void AddDelayData(CJS_DelayData* pData); |
| 300 void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex); |
| 301 void AddDelayAnnotData(CJS_AnnotObj* pData); |
| 302 void DoAnnotDelay(); |
| 303 void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; } |
| 304 CJS_Document* GetCJSDoc() const; |
| 305 |
| 306 private: |
| 307 CFX_WideString ReversalStr(CFX_WideString cbFrom); |
| 308 CFX_WideString CutString(CFX_WideString cbFrom); |
| 309 bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect); |
| 310 int CountWords(CPDF_TextObject* pTextObj); |
| 311 CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); |
| 312 FX_BOOL ParserParams(JSObject* pObj, CJS_AnnotObj& annotobj); |
| 313 |
| 314 v8::Isolate* m_isolate; |
| 315 IconTree* m_pIconTree; |
| 316 CPDFSDK_Document* m_pDocument; |
| 317 CFX_WideString m_cwBaseURL; |
| 318 bool m_bDelay; |
| 319 CFX_ArrayTemplate<CJS_DelayData*> m_DelayData; |
| 320 CFX_ArrayTemplate<CJS_AnnotObj*> m_DelayAnnotData; |
| 321 }; |
| 322 |
| 323 class CJS_Document : public CJS_Object { |
| 324 public: |
| 325 CJS_Document(JSFXObject pObject) : CJS_Object(pObject){}; |
| 326 virtual ~CJS_Document(){}; |
| 327 |
| 328 virtual FX_BOOL InitInstance(IFXJS_Context* cc); |
| 329 |
| 330 DECLARE_JS_CLASS(CJS_Document); |
| 331 |
| 332 JS_STATIC_PROP(ADBE, Document); |
| 333 JS_STATIC_PROP(author, Document); |
| 334 JS_STATIC_PROP(baseURL, Document); |
| 335 JS_STATIC_PROP(bookmarkRoot, Document); |
| 336 JS_STATIC_PROP(calculate, Document); |
| 337 JS_STATIC_PROP(Collab, Document); |
| 338 JS_STATIC_PROP(creationDate, Document); |
| 339 JS_STATIC_PROP(creator, Document); |
| 340 JS_STATIC_PROP(delay, Document); |
| 341 JS_STATIC_PROP(dirty, Document); |
| 342 JS_STATIC_PROP(documentFileName, Document); |
| 343 JS_STATIC_PROP(external, Document); |
| 344 JS_STATIC_PROP(filesize, Document); |
| 345 JS_STATIC_PROP(icons, Document); |
| 346 JS_STATIC_PROP(info, Document); |
| 347 JS_STATIC_PROP(keywords, Document); |
| 348 JS_STATIC_PROP(layout, Document); |
| 349 JS_STATIC_PROP(media, Document); |
| 350 JS_STATIC_PROP(modDate, Document); |
| 351 JS_STATIC_PROP(mouseX, Document); |
| 352 JS_STATIC_PROP(mouseY, Document); |
| 353 JS_STATIC_PROP(numFields, Document); |
| 354 JS_STATIC_PROP(numPages, Document); |
| 355 JS_STATIC_PROP(pageNum, Document); |
| 356 JS_STATIC_PROP(pageWindowRect, Document); |
| 357 JS_STATIC_PROP(path, Document); |
| 358 JS_STATIC_PROP(producer, Document); |
| 359 JS_STATIC_PROP(subject, Document); |
| 360 JS_STATIC_PROP(title, Document); |
| 361 JS_STATIC_PROP(zoom, Document); |
| 362 JS_STATIC_PROP(zoomType, Document); |
| 363 |
| 364 JS_STATIC_METHOD(addAnnot, Document); |
| 365 JS_STATIC_METHOD(addField, Document); |
| 366 JS_STATIC_METHOD(addLink, Document); |
| 367 JS_STATIC_METHOD(addIcon, Document); |
| 368 JS_STATIC_METHOD(calculateNow, Document); |
| 369 JS_STATIC_METHOD(closeDoc, Document); |
| 370 JS_STATIC_METHOD(createDataObject, Document); |
| 371 JS_STATIC_METHOD(deletePages, Document); |
| 372 JS_STATIC_METHOD(exportAsText, Document); |
| 373 JS_STATIC_METHOD(exportAsFDF, Document); |
| 374 JS_STATIC_METHOD(exportAsXFDF, Document); |
| 375 JS_STATIC_METHOD(extractPages, Document); |
| 376 JS_STATIC_METHOD(getAnnot, Document); |
| 377 JS_STATIC_METHOD(getAnnots, Document); |
| 378 JS_STATIC_METHOD(getAnnot3D, Document); |
| 379 JS_STATIC_METHOD(getAnnots3D, Document); |
| 380 JS_STATIC_METHOD(getField, Document); |
| 381 JS_STATIC_METHOD(getIcon, Document); |
| 382 JS_STATIC_METHOD(getLinks, Document); |
| 383 JS_STATIC_METHOD(getNthFieldName, Document); |
| 384 JS_STATIC_METHOD(getOCGs, Document); |
| 385 JS_STATIC_METHOD(getPageBox, Document); |
| 386 JS_STATIC_METHOD(getPageNthWord, Document); |
| 387 JS_STATIC_METHOD(getPageNthWordQuads, Document); |
| 388 JS_STATIC_METHOD(getPageNumWords, Document); |
| 389 JS_STATIC_METHOD(getPrintParams, Document); |
| 390 JS_STATIC_METHOD(getURL, Document); |
| 391 JS_STATIC_METHOD(importAnFDF, Document); |
| 392 JS_STATIC_METHOD(importAnXFDF, Document); |
| 393 JS_STATIC_METHOD(importTextData, Document); |
| 394 JS_STATIC_METHOD(insertPages, Document); |
| 395 JS_STATIC_METHOD(mailForm, Document); |
| 396 JS_STATIC_METHOD(print, Document); |
| 397 JS_STATIC_METHOD(removeField, Document); |
| 398 JS_STATIC_METHOD(replacePages, Document); |
| 399 JS_STATIC_METHOD(removeIcon, Document); |
| 400 JS_STATIC_METHOD(resetForm, Document); |
| 401 JS_STATIC_METHOD(saveAs, Document); |
| 402 JS_STATIC_METHOD(submitForm, Document); |
| 403 JS_STATIC_METHOD(mailDoc, Document); |
| 272 }; | 404 }; |
| 273 | 405 |
| 274 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_DOCUMENT_H_ | 406 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_DOCUMENT_H_ |
| OLD | NEW |