summaryrefslogtreecommitdiff
path: root/fxjs
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs')
-rw-r--r--fxjs/cjs_document.cpp90
-rw-r--r--fxjs/cjs_document.h2
2 files changed, 46 insertions, 46 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 9899deb593..f682ffd636 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -166,6 +166,7 @@ const JSMethodSpec CJS_Document::MethodSpecs[] = {
{"importAnXFDF", importAnXFDF_static},
{"importTextData", importTextData_static},
{"insertPages", insertPages_static},
+ {"mailDoc", mailDoc_static},
{"mailForm", mailForm_static},
{"print", print_static},
{"removeField", removeField_static},
@@ -174,8 +175,7 @@ const JSMethodSpec CJS_Document::MethodSpecs[] = {
{"removeIcon", removeIcon_static},
{"saveAs", saveAs_static},
{"submitForm", submitForm_static},
- {"syncAnnotScan", syncAnnotScan_static},
- {"mailDoc", mailDoc_static}};
+ {"syncAnnotScan", syncAnnotScan_static}};
int CJS_Document::ObjDefnID = -1;
const char CJS_Document::kName[] = "Document";
@@ -375,6 +375,49 @@ CJS_Result CJS_Document::importTextData(
return CJS_Result::Success();
}
+CJS_Result CJS_Document::mailDoc(
+ CJS_Runtime* pRuntime,
+ const std::vector<v8::Local<v8::Value>>& params) {
+ // TODO(tsepez): Check maximum number of allowed params.
+ size_t nLength = params.size();
+ bool bUI = true;
+ WideString cTo;
+ WideString cCc;
+ WideString cBcc;
+ WideString cSubject;
+ WideString cMsg;
+
+ if (nLength > 0 && params[0]->IsObject()) {
+ v8::Local<v8::Object> pObj = pRuntime->ToObject(params[0]);
+ bUI = pRuntime->ToBoolean(pRuntime->GetObjectProperty(pObj, L"bUI"));
+ cTo = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cTo"));
+ cCc = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cCc"));
+ cBcc = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cBcc"));
+ cSubject =
+ pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cSubject"));
+ cMsg = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cMsg"));
+ } else {
+ if (nLength > 0)
+ bUI = pRuntime->ToBoolean(params[0]);
+ if (nLength > 1)
+ cTo = pRuntime->ToWideString(params[1]);
+ if (nLength > 2)
+ cCc = pRuntime->ToWideString(params[2]);
+ if (nLength > 3)
+ cBcc = pRuntime->ToWideString(params[3]);
+ if (nLength > 4)
+ cSubject = pRuntime->ToWideString(params[4]);
+ if (nLength > 5)
+ cMsg = pRuntime->ToWideString(params[5]);
+ }
+
+ pRuntime->BeginBlock();
+ CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
+ pFormFillEnv->JS_docmailForm(nullptr, 0, bUI, cTo, cSubject, cCc, cBcc, cMsg);
+ pRuntime->EndBlock();
+ return CJS_Result::Success();
+}
+
// exports the form data and mails the resulting fdf file as an attachment to
// all recipients.
// comment: need reader supports
@@ -649,49 +692,6 @@ CJS_Result CJS_Document::set_bookmark_root(CJS_Runtime* pRuntime,
return CJS_Result::Success();
}
-CJS_Result CJS_Document::mailDoc(
- CJS_Runtime* pRuntime,
- const std::vector<v8::Local<v8::Value>>& params) {
- // TODO(tsepez): Check maximum number of allowed params.
- size_t nLength = params.size();
- bool bUI = true;
- WideString cTo;
- WideString cCc;
- WideString cBcc;
- WideString cSubject;
- WideString cMsg;
-
- if (nLength > 0 && params[0]->IsObject()) {
- v8::Local<v8::Object> pObj = pRuntime->ToObject(params[0]);
- bUI = pRuntime->ToBoolean(pRuntime->GetObjectProperty(pObj, L"bUI"));
- cTo = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cTo"));
- cCc = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cCc"));
- cBcc = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cBcc"));
- cSubject =
- pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cSubject"));
- cMsg = pRuntime->ToWideString(pRuntime->GetObjectProperty(pObj, L"cMsg"));
- } else {
- if (nLength > 0)
- bUI = pRuntime->ToBoolean(params[0]);
- if (nLength > 1)
- cTo = pRuntime->ToWideString(params[1]);
- if (nLength > 2)
- cCc = pRuntime->ToWideString(params[2]);
- if (nLength > 3)
- cBcc = pRuntime->ToWideString(params[3]);
- if (nLength > 4)
- cSubject = pRuntime->ToWideString(params[4]);
- if (nLength > 5)
- cMsg = pRuntime->ToWideString(params[5]);
- }
-
- pRuntime->BeginBlock();
- CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
- pFormFillEnv->JS_docmailForm(nullptr, 0, bUI, cTo, cSubject, cCc, cBcc, cMsg);
- pRuntime->EndBlock();
- return CJS_Result::Success();
-}
-
CJS_Result CJS_Document::get_author(CJS_Runtime* pRuntime) {
return getPropertyInternal(pRuntime, "Author");
}
diff --git a/fxjs/cjs_document.h b/fxjs/cjs_document.h
index 5232803989..ed8bcc08c9 100644
--- a/fxjs/cjs_document.h
+++ b/fxjs/cjs_document.h
@@ -99,6 +99,7 @@ class CJS_Document final : public CJS_Object, public Observable<CJS_Document> {
JS_STATIC_METHOD(importAnXFDF, CJS_Document);
JS_STATIC_METHOD(importTextData, CJS_Document);
JS_STATIC_METHOD(insertPages, CJS_Document);
+ JS_STATIC_METHOD(mailDoc, CJS_Document);
JS_STATIC_METHOD(mailForm, CJS_Document);
JS_STATIC_METHOD(print, CJS_Document);
JS_STATIC_METHOD(removeField, CJS_Document);
@@ -108,7 +109,6 @@ class CJS_Document final : public CJS_Object, public Observable<CJS_Document> {
JS_STATIC_METHOD(saveAs, CJS_Document);
JS_STATIC_METHOD(submitForm, CJS_Document);
JS_STATIC_METHOD(syncAnnotScan, CJS_Document);
- JS_STATIC_METHOD(mailDoc, CJS_Document);
private:
static int ObjDefnID;