summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/Annot.cpp30
-rw-r--r--fpdfsdk/javascript/Annot.h6
-rw-r--r--fpdfsdk/javascript/Document.cpp888
-rw-r--r--fpdfsdk/javascript/Document.h336
-rw-r--r--fpdfsdk/javascript/Field.cpp1150
-rw-r--r--fpdfsdk/javascript/Field.h328
-rw-r--r--fpdfsdk/javascript/Icon.cpp6
-rw-r--r--fpdfsdk/javascript/Icon.h2
-rw-r--r--fpdfsdk/javascript/JS_Define.h24
-rw-r--r--fpdfsdk/javascript/JS_EventHandler.cpp132
-rw-r--r--fpdfsdk/javascript/JS_EventHandler.h116
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.cpp27
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.h8
-rw-r--r--fpdfsdk/javascript/JS_Runtime_Stub.cpp101
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp375
-rw-r--r--fpdfsdk/javascript/PublicMethods.h126
-rw-r--r--fpdfsdk/javascript/app.cpp349
-rw-r--r--fpdfsdk/javascript/app.h168
-rw-r--r--fpdfsdk/javascript/cjs_context.cpp102
-rw-r--r--fpdfsdk/javascript/cjs_context.h93
-rw-r--r--fpdfsdk/javascript/cjs_runtime.cpp16
-rw-r--r--fpdfsdk/javascript/cjs_runtime.h14
-rw-r--r--fpdfsdk/javascript/color.cpp38
-rw-r--r--fpdfsdk/javascript/color.h42
-rw-r--r--fpdfsdk/javascript/console.cpp40
-rw-r--r--fpdfsdk/javascript/console.h26
-rw-r--r--fpdfsdk/javascript/event.cpp190
-rw-r--r--fpdfsdk/javascript/event.h48
-rw-r--r--fpdfsdk/javascript/global.cpp96
-rw-r--r--fpdfsdk/javascript/global.h36
-rw-r--r--fpdfsdk/javascript/ijs_context.h92
-rw-r--r--fpdfsdk/javascript/ijs_runtime.h8
-rw-r--r--fpdfsdk/javascript/report.cpp20
-rw-r--r--fpdfsdk/javascript/report.h16
-rw-r--r--fpdfsdk/javascript/util.cpp77
-rw-r--r--fpdfsdk/javascript/util.h40
36 files changed, 2517 insertions, 2649 deletions
diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp
index 8e6a775dcd..0c16b3b05a 100644
--- a/fpdfsdk/javascript/Annot.cpp
+++ b/fpdfsdk/javascript/Annot.cpp
@@ -37,17 +37,15 @@ Annot::Annot(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
Annot::~Annot() {}
-FX_BOOL Annot::hidden(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Annot::hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CPDFSDK_BAAnnot* baAnnot = ToBAAnnot(m_pAnnot.Get());
if (!baAnnot)
- return FALSE;
+ return false;
if (vp.IsGetting()) {
CPDF_Annot* pPDFAnnot = baAnnot->GetPDFAnnot();
vp << CPDF_Annot::IsAnnotationHidden(pPDFAnnot->GetAnnotDict());
- return TRUE;
+ return true;
}
bool bHidden;
@@ -66,41 +64,37 @@ FX_BOOL Annot::hidden(IJS_Context* cc,
flags |= ANNOTFLAG_PRINT;
}
baAnnot->SetFlags(flags);
- return TRUE;
+ return true;
}
-FX_BOOL Annot::name(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Annot::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CPDFSDK_BAAnnot* baAnnot = ToBAAnnot(m_pAnnot.Get());
if (!baAnnot)
- return FALSE;
+ return false;
if (vp.IsGetting()) {
vp << baAnnot->GetAnnotName();
- return TRUE;
+ return true;
}
CFX_WideString annotName;
vp >> annotName;
baAnnot->SetAnnotName(annotName);
- return TRUE;
+ return true;
}
-FX_BOOL Annot::type(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Annot::type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
CPDFSDK_BAAnnot* baAnnot = ToBAAnnot(m_pAnnot.Get());
if (!baAnnot)
- return FALSE;
+ return false;
vp << CPDF_Annot::AnnotSubtypeToString(baAnnot->GetAnnotSubtype());
- return TRUE;
+ return true;
}
void Annot::SetSDKAnnot(CPDFSDK_BAAnnot* annot) {
diff --git a/fpdfsdk/javascript/Annot.h b/fpdfsdk/javascript/Annot.h
index 291262d18f..39073e6719 100644
--- a/fpdfsdk/javascript/Annot.h
+++ b/fpdfsdk/javascript/Annot.h
@@ -17,9 +17,9 @@ class Annot : public CJS_EmbedObj {
explicit Annot(CJS_Object* pJSObject);
~Annot() override;
- FX_BOOL hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
void SetSDKAnnot(CPDFSDK_BAAnnot* annot);
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index ea489c993b..54761a2647 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -48,14 +48,14 @@ IMPLEMENT_JS_CLASS(CJS_PrintParamsObj, PrintParamsObj)
PrintParamsObj::PrintParamsObj(CJS_Object* pJSObject)
: CJS_EmbedObj(pJSObject) {
- bUI = TRUE;
+ bUI = true;
nStart = 0;
nEnd = 0;
- bSilent = FALSE;
- bShrinkToFit = FALSE;
- bPrintAsImage = FALSE;
- bReverse = FALSE;
- bAnnotations = TRUE;
+ bSilent = false;
+ bShrinkToFit = false;
+ bPrintAsImage = false;
+ bReverse = false;
+ bAnnotations = true;
}
#define MINWIDTH 5.0f
@@ -156,35 +156,35 @@ Document::Document(CJS_Object* pJSObject)
: CJS_EmbedObj(pJSObject),
m_pFormFillEnv(nullptr),
m_cwBaseURL(L""),
- m_bDelay(FALSE) {}
+ m_bDelay(false) {}
Document::~Document() {
}
// the total number of fileds in document.
-FX_BOOL Document::numFields(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::numFields(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
vp << static_cast<int>(pPDFForm->CountFields(CFX_WideString()));
- return TRUE;
+ return true;
}
-FX_BOOL Document::dirty(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::dirty(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (vp.IsGetting()) {
vp << !!m_pFormFillEnv->GetChangeMark();
@@ -197,24 +197,24 @@ FX_BOOL Document::dirty(IJS_Context* cc,
else
m_pFormFillEnv->ClearChangeMark();
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::ADBE(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::ADBE(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsGetting())
vp.GetJSValue()->SetNull(CJS_Runtime::FromContext(cc));
- return TRUE;
+ return true;
}
-FX_BOOL Document::pageNum(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::pageNum(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (vp.IsGetting()) {
if (CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetCurrentView()) {
@@ -234,47 +234,47 @@ FX_BOOL Document::pageNum(IJS_Context* cc,
}
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::addAnnot(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::addAnnot(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::addField(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::addField(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::exportAsText(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::exportAsText(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::exportAsFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::exportAsFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::exportAsXFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::exportAsXFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
// Maps a field object in PDF document to a JavaScript variable
@@ -282,17 +282,17 @@ FX_BOOL Document::exportAsXFDF(IJS_Context* cc,
// note: the paremter cName, this is clue how to treat if the cName is not a
// valiable filed name in this document
-FX_BOOL Document::getField(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getField(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
@@ -301,7 +301,7 @@ FX_BOOL Document::getField(IJS_Context* cc,
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
if (pPDFForm->CountFields(wideName) <= 0) {
vRet.SetNull(pRuntime);
- return TRUE;
+ return true;
}
v8::Local<v8::Object> pFieldObj =
@@ -312,84 +312,84 @@ FX_BOOL Document::getField(IJS_Context* cc,
pField->AttachField(this, wideName);
vRet = CJS_Value(pRuntime, pJSField);
- return TRUE;
+ return true;
}
// Gets the name of the nth field in the document
-FX_BOOL Document::getNthFieldName(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getNthFieldName(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
int nIndex = params[0].ToInt(pRuntime);
if (nIndex < 0) {
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
- return FALSE;
+ return false;
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDF_InterForm* pPDFForm = pInterForm->GetInterForm();
CPDF_FormField* pField = pPDFForm->GetField(nIndex, CFX_WideString());
if (!pField)
- return FALSE;
+ return false;
vRet = CJS_Value(pRuntime, pField->GetFullName().c_str());
- return TRUE;
+ return true;
}
-FX_BOOL Document::importAnFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::importAnFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::importAnXFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::importAnXFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::importTextData(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::importTextData(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
// exports the form data and mails the resulting fdf file as an attachment to
// all recipients.
// comment: need reader supports
-FX_BOOL Document::mailForm(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::mailForm(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) {
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
int iLength = params.size();
- FX_BOOL bUI = iLength > 0 ? params[0].ToBool(pRuntime) : TRUE;
+ bool bUI = iLength > 0 ? params[0].ToBool(pRuntime) : true;
CFX_WideString cTo = iLength > 1 ? params[1].ToCFXWideString(pRuntime) : L"";
CFX_WideString cCc = iLength > 2 ? params[2].ToCFXWideString(pRuntime) : L"";
CFX_WideString cBcc = iLength > 3 ? params[3].ToCFXWideString(pRuntime) : L"";
@@ -400,7 +400,7 @@ FX_BOOL Document::mailForm(IJS_Context* cc,
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CFX_ByteTextBuf textBuf;
if (!pInterForm->ExportFormToFDFTextBuf(textBuf))
- return FALSE;
+ return false;
pRuntime->BeginBlock();
CPDFSDK_FormFillEnvironment* pFormFillEnv = pContext->GetFormFillEnv();
@@ -408,29 +408,29 @@ FX_BOOL Document::mailForm(IJS_Context* cc,
cTo.c_str(), cSubject.c_str(), cCc.c_str(),
cBcc.c_str(), cMsg.c_str());
pRuntime->EndBlock();
- return TRUE;
+ return true;
}
-FX_BOOL Document::print(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::print(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- FX_BOOL bUI = TRUE;
+ bool bUI = true;
int nStart = 0;
int nEnd = 0;
- FX_BOOL bSilent = FALSE;
- FX_BOOL bShrinkToFit = FALSE;
- FX_BOOL bPrintAsImage = FALSE;
- FX_BOOL bReverse = FALSE;
- FX_BOOL bAnnotations = FALSE;
+ bool bSilent = false;
+ bool bShrinkToFit = false;
+ bool bPrintAsImage = false;
+ bool bReverse = false;
+ bool bAnnotations = false;
int nlength = params.size();
if (nlength == 9) {
@@ -475,31 +475,31 @@ FX_BOOL Document::print(IJS_Context* cc,
if (m_pFormFillEnv) {
m_pFormFillEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit,
bPrintAsImage, bReverse, bAnnotations);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
// removes the specified field from the document.
// comment:
// note: if the filed name is not rational, adobe is dumb for it.
-FX_BOOL Document::removeField(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::removeField(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) ||
m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM))) {
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
@@ -508,7 +508,7 @@ FX_BOOL Document::removeField(IJS_Context* cc,
std::vector<CPDFSDK_Widget*> widgets;
pInterForm->GetWidgets(sFieldName, &widgets);
if (widgets.empty())
- return TRUE;
+ return true;
for (CPDFSDK_Widget* pWidget : widgets) {
CFX_FloatRect rcAnnot = pWidget->GetRect();
@@ -534,26 +534,26 @@ FX_BOOL Document::removeField(IJS_Context* cc,
}
m_pFormFillEnv->SetChangeMark();
- return TRUE;
+ return true;
}
// reset filed values within a document.
// comment:
// note: if the fields names r not rational, aodbe is dumb for it.
-FX_BOOL Document::resetForm(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::resetForm(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) ||
m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM) ||
m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM))) {
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
- return FALSE;
+ return false;
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
@@ -561,9 +561,9 @@ FX_BOOL Document::resetForm(IJS_Context* cc,
CJS_Array aName;
if (params.empty()) {
- pPDFForm->ResetForm(TRUE);
+ pPDFForm->ResetForm(true);
m_pFormFillEnv->SetChangeMark();
- return TRUE;
+ return true;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
@@ -588,47 +588,47 @@ FX_BOOL Document::resetForm(IJS_Context* cc,
}
if (!aFields.empty()) {
- pPDFForm->ResetForm(aFields, TRUE, TRUE);
+ pPDFForm->ResetForm(aFields, true, true);
m_pFormFillEnv->SetChangeMark();
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::saveAs(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::saveAs(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::syncAnnotScan(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
-}
-
-FX_BOOL Document::submitForm(IJS_Context* cc,
+bool Document::syncAnnotScan(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
+ return true;
+}
+
+bool Document::submitForm(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
int nSize = params.size();
if (nSize < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
CJS_Array aFields;
CFX_WideString strURL;
- FX_BOOL bFDF = TRUE;
- FX_BOOL bEmpty = FALSE;
+ bool bFDF = true;
+ bool bEmpty = false;
CJS_Value v = params[0];
if (v.GetType() == CJS_Value::VT_string) {
strURL = params[0].ToCFXWideString(pRuntime);
@@ -659,10 +659,10 @@ FX_BOOL Document::submitForm(IJS_Context* cc,
if (aFields.GetLength(pRuntime) == 0 && bEmpty) {
if (pPDFInterForm->CheckRequiredFields(nullptr, true)) {
pRuntime->BeginBlock();
- pInterForm->SubmitForm(strURL, FALSE);
+ pInterForm->SubmitForm(strURL, false);
pRuntime->EndBlock();
}
- return TRUE;
+ return true;
}
std::vector<CPDF_FormField*> fieldObjects;
@@ -686,28 +686,28 @@ FX_BOOL Document::submitForm(IJS_Context* cc,
pInterForm->SubmitFields(strURL, fieldObjects, true, !bFDF);
pRuntime->EndBlock();
}
- return TRUE;
+ return true;
}
void Document::SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
m_pFormFillEnv.Reset(pFormFillEnv);
}
-FX_BOOL Document::bookmarkRoot(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::bookmarkRoot(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::mailDoc(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::mailDoc(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
// TODO(tsepez): Check maximum number of allowed params.
- FX_BOOL bUI = TRUE;
+ bool bUI = true;
CFX_WideString cTo = L"";
CFX_WideString cCc = L"";
CFX_WideString cBcc = L"";
@@ -757,29 +757,29 @@ FX_BOOL Document::mailDoc(IJS_Context* cc,
cCc.c_str(), cBcc.c_str(), cMsg.c_str());
pRuntime->EndBlock();
- return TRUE;
+ return true;
}
-FX_BOOL Document::author(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::author(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
return getPropertyInternal(cc, vp, "Author", sError);
}
-FX_BOOL Document::info(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::info(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CPDF_Dictionary* pDictionary = m_pFormFillEnv->GetPDFDocument()->GetInfo();
if (!pDictionary)
- return FALSE;
+ return false;
CFX_WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author");
CFX_WideString cwTitle = pDictionary->GetUnicodeTextFor("Title");
@@ -820,61 +820,61 @@ FX_BOOL Document::info(IJS_Context* cc,
}
}
vp << pObj;
- return TRUE;
+ return true;
}
-FX_BOOL Document::getPropertyInternal(IJS_Context* cc,
- CJS_PropValue& vp,
- const CFX_ByteString& propName,
- CFX_WideString& sError) {
+bool Document::getPropertyInternal(IJS_Context* cc,
+ CJS_PropValue& vp,
+ const CFX_ByteString& propName,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CPDF_Dictionary* pDictionary = m_pFormFillEnv->GetPDFDocument()->GetInfo();
if (!pDictionary)
- return FALSE;
+ return false;
if (vp.IsGetting()) {
vp << pDictionary->GetUnicodeTextFor(propName);
} else {
if (!m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY)) {
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
- return FALSE;
+ return false;
}
CFX_WideString csProperty;
vp >> csProperty;
pDictionary->SetStringFor(propName, PDF_EncodeText(csProperty));
m_pFormFillEnv->SetChangeMark();
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::creationDate(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::creationDate(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
return getPropertyInternal(cc, vp, "CreationDate", sError);
}
-FX_BOOL Document::creator(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::creator(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
return getPropertyInternal(cc, vp, "Creator", sError);
}
-FX_BOOL Document::delay(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::delay(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (vp.IsGetting()) {
vp << m_bDelay;
} else {
if (!m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY)) {
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
- return FALSE;
+ return false;
}
vp >> m_bDelay;
if (m_bDelay) {
@@ -886,123 +886,121 @@ FX_BOOL Document::delay(IJS_Context* cc,
Field::DoDelay(m_pFormFillEnv.Get(), pData.get());
}
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::keywords(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::keywords(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
return getPropertyInternal(cc, vp, "Keywords", sError);
}
-FX_BOOL Document::modDate(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::modDate(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
return getPropertyInternal(cc, vp, "ModDate", sError);
}
-FX_BOOL Document::producer(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::producer(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
return getPropertyInternal(cc, vp, "Producer", sError);
}
-FX_BOOL Document::subject(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::subject(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
return getPropertyInternal(cc, vp, "Subject", sError);
}
-FX_BOOL Document::title(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::title(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv || !m_pFormFillEnv->GetUnderlyingDocument()) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
return getPropertyInternal(cc, vp, "Title", sError);
}
-FX_BOOL Document::numPages(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::numPages(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
vp << m_pFormFillEnv->GetPageCount();
- return TRUE;
+ return true;
}
-FX_BOOL Document::external(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::external(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
// In Chrome case, should always return true.
if (vp.IsGetting()) {
vp << true;
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::filesize(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::filesize(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
vp << 0;
- return TRUE;
+ return true;
}
-FX_BOOL Document::mouseX(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
-}
-
-FX_BOOL Document::mouseY(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::mouseX(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::URL(IJS_Context* cc,
+bool Document::mouseY(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
+ return true;
+}
+
+bool Document::URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
vp << m_pFormFillEnv->JS_docGetFilePath();
- return TRUE;
+ return true;
}
-FX_BOOL Document::baseURL(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::baseURL(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsGetting()) {
vp << m_cwBaseURL;
} else {
vp >> m_cwBaseURL;
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::calculate(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::calculate(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
if (vp.IsGetting()) {
@@ -1012,19 +1010,19 @@ FX_BOOL Document::calculate(IJS_Context* cc,
vp >> bCalculate;
pInterForm->EnableCalculate(bCalculate);
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::documentFileName(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::documentFileName(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CFX_WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath();
int32_t i = wsFilePath.GetLength() - 1;
@@ -1037,68 +1035,68 @@ FX_BOOL Document::documentFileName(IJS_Context* cc,
} else {
vp << L"";
}
- return TRUE;
+ return true;
}
-FX_BOOL Document::path(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::path(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
vp << app::SysPathToPDFPath(m_pFormFillEnv->JS_docGetFilePath());
- return TRUE;
+ return true;
}
-FX_BOOL Document::pageWindowRect(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::pageWindowRect(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::layout(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::layout(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::addLink(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::addLink(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::closeDoc(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::closeDoc(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::getPageBox(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::getPageBox(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::getAnnot(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getAnnot(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
@@ -1106,7 +1104,7 @@ FX_BOOL Document::getAnnot(IJS_Context* cc,
CFX_WideString swAnnotName = params[1].ToCFXWideString(pRuntime);
CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(nPageNo);
if (!pPageView)
- return FALSE;
+ return false;
CPDFSDK_AnnotIterator annotIterator(pPageView, false);
CPDFSDK_BAAnnot* pSDKBAAnnot = nullptr;
@@ -1119,35 +1117,35 @@ FX_BOOL Document::getAnnot(IJS_Context* cc,
}
if (!pSDKBAAnnot)
- return FALSE;
+ return false;
v8::Local<v8::Object> pObj =
pRuntime->NewFxDynamicObj(CJS_Annot::g_nObjDefnID);
if (pObj.IsEmpty())
- return FALSE;
+ return false;
CJS_Annot* pJS_Annot =
static_cast<CJS_Annot*>(pRuntime->GetObjectPrivate(pObj));
if (!pJS_Annot)
- return FALSE;
+ return false;
Annot* pAnnot = static_cast<Annot*>(pJS_Annot->GetEmbedObject());
if (!pAnnot)
- return FALSE;
+ return false;
pAnnot->SetSDKAnnot(pSDKBAAnnot);
vRet = CJS_Value(pRuntime, pJS_Annot);
- return TRUE;
+ return true;
}
-FX_BOOL Document::getAnnots(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getAnnots(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
@@ -1161,28 +1159,28 @@ FX_BOOL Document::getAnnots(IJS_Context* cc,
for (int i = 0; i < nPageNo; ++i) {
CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(i);
if (!pPageView)
- return FALSE;
+ return false;
CPDFSDK_AnnotIterator annotIterator(pPageView, false);
while (CPDFSDK_Annot* pSDKAnnotCur = annotIterator.Next()) {
CPDFSDK_BAAnnot* pSDKBAAnnot =
static_cast<CPDFSDK_BAAnnot*>(pSDKAnnotCur);
if (!pSDKBAAnnot)
- return FALSE;
+ return false;
v8::Local<v8::Object> pObj =
pRuntime->NewFxDynamicObj(CJS_Annot::g_nObjDefnID);
if (pObj.IsEmpty())
- return FALSE;
+ return false;
CJS_Annot* pJS_Annot =
static_cast<CJS_Annot*>(pRuntime->GetObjectPrivate(pObj));
if (!pJS_Annot)
- return FALSE;
+ return false;
Annot* pAnnot = static_cast<Annot*>(pJS_Annot->GetEmbedObject());
if (!pAnnot)
- return FALSE;
+ return false;
pAnnot->SetSDKAnnot(pSDKBAAnnot);
annots.SetElement(pRuntime, i, CJS_Value(pRuntime, pJS_Annot));
@@ -1190,36 +1188,36 @@ FX_BOOL Document::getAnnots(IJS_Context* cc,
}
vRet = CJS_Value(pRuntime, annots);
- return TRUE;
-}
-
-FX_BOOL Document::getAnnot3D(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- vRet.SetNull(CJS_Runtime::FromContext(cc));
- return TRUE;
-}
-
-FX_BOOL Document::getAnnots3D(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+ return true;
}
-FX_BOOL Document::getOCGs(IJS_Context* cc,
+bool Document::getAnnot3D(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- return TRUE;
+ vRet.SetNull(CJS_Runtime::FromContext(cc));
+ return true;
}
-FX_BOOL Document::getLinks(IJS_Context* cc,
+bool Document::getAnnots3D(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- return TRUE;
+ return true;
+}
+
+bool Document::getOCGs(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
+}
+
+bool Document::getLinks(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) {
@@ -1227,13 +1225,13 @@ bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) {
rect.right >= LinkRect.right && rect.bottom >= LinkRect.bottom);
}
-FX_BOOL Document::addIcon(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::addIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
@@ -1242,38 +1240,38 @@ FX_BOOL Document::addIcon(IJS_Context* cc,
if (params[1].GetType() != CJS_Value::VT_object) {
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
- return FALSE;
+ return false;
}
v8::Local<v8::Object> pJSIcon = params[1].ToV8Object(pRuntime);
if (pRuntime->GetObjDefnID(pJSIcon) != CJS_Icon::g_nObjDefnID) {
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
- return FALSE;
+ return false;
}
CJS_EmbedObj* pEmbedObj = params[1].ToCJSObject(pRuntime)->GetEmbedObject();
if (!pEmbedObj) {
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
- return FALSE;
+ return false;
}
m_Icons.push_back(pdfium::MakeUnique<IconElement>(
swIconName, static_cast<Icon*>(pEmbedObj)));
- return TRUE;
+ return true;
}
-FX_BOOL Document::icons(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Document::icons(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
sError = JSGetStringFromID(IDS_STRING_JSREADONLY);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
if (m_Icons.empty()) {
vp.GetJSValue()->SetNull(pRuntime);
- return TRUE;
+ return true;
}
CJS_Array Icons;
@@ -1283,16 +1281,16 @@ FX_BOOL Document::icons(IJS_Context* cc,
v8::Local<v8::Object> pObj =
pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID);
if (pObj.IsEmpty())
- return FALSE;
+ return false;
CJS_Icon* pJS_Icon =
static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj));
if (!pJS_Icon)
- return FALSE;
+ return false;
Icon* pIcon = static_cast<Icon*>(pJS_Icon->GetEmbedObject());
if (!pIcon)
- return FALSE;
+ return false;
pIcon->SetStream(pIconElement->IconStream->GetStream());
pIcon->SetIconName(pIconElement->IconName);
@@ -1300,20 +1298,20 @@ FX_BOOL Document::icons(IJS_Context* cc,
}
vp << Icons;
- return TRUE;
+ return true;
}
-FX_BOOL Document::getIcon(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (m_Icons.empty())
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime);
@@ -1325,84 +1323,84 @@ FX_BOOL Document::getIcon(IJS_Context* cc,
v8::Local<v8::Object> pObj =
pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID);
if (pObj.IsEmpty())
- return FALSE;
+ return false;
CJS_Icon* pJS_Icon =
static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj));
if (!pJS_Icon)
- return FALSE;
+ return false;
Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
if (!pIcon)
- return FALSE;
+ return false;
pIcon->SetIconName(swIconName);
pIcon->SetStream(pIconElement->IconStream->GetStream());
vRet = CJS_Value(pRuntime, pJS_Icon);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL Document::removeIcon(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::removeIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, no supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::createDataObject(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::createDataObject(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not implemented.
- return TRUE;
+ return true;
}
-FX_BOOL Document::media(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::media(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::calculateNow(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::calculateNow(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (!(m_pFormFillEnv->GetPermissions(FPDFPERM_MODIFY) ||
m_pFormFillEnv->GetPermissions(FPDFPERM_ANNOT_FORM) ||
m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM))) {
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
- return FALSE;
+ return false;
}
m_pFormFillEnv->GetInterForm()->OnCalculate();
- return TRUE;
+ return true;
}
-FX_BOOL Document::Collab(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::Collab(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::getPageNthWord(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getPageNthWord(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) {
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1414,16 +1412,16 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
if (!pDocument)
- return FALSE;
+ return false;
if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) {
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
- return FALSE;
+ return false;
}
CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo);
if (!pPageDict)
- return FALSE;
+ return false;
CPDF_Page page(pDocument, pPageDict, true);
page.ParseContent();
@@ -1448,47 +1446,47 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
}
vRet = CJS_Value(pRuntime, swRet.c_str());
- return TRUE;
+ return true;
}
-FX_BOOL Document::getPageNthWordQuads(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getPageNthWordQuads(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
- return FALSE;
+ return false;
}
-FX_BOOL Document::getPageNumWords(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getPageNumWords(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) {
sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int nPageNo = params.size() > 0 ? params[0].ToInt(pRuntime) : 0;
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) {
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
- return FALSE;
+ return false;
}
CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo);
if (!pPageDict)
- return FALSE;
+ return false;
CPDF_Page page(pDocument, pPageDict, true);
page.ParseContent();
@@ -1500,13 +1498,13 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc,
}
vRet = CJS_Value(pRuntime, nWords);
- return TRUE;
+ return true;
}
-FX_BOOL Document::getPrintParams(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getPrintParams(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
v8::Local<v8::Object> pRetObj =
@@ -1515,7 +1513,7 @@ FX_BOOL Document::getPrintParams(IJS_Context* cc,
// Not implemented yet.
vRet = CJS_Value(pRuntime, pRetObj);
- return TRUE;
+ return true;
}
#define ISLATINWORD(u) (u != 0x20 && u <= 0x28FF)
@@ -1530,7 +1528,7 @@ int Document::CountWords(CPDF_TextObject* pTextObj) {
if (!pFont)
return 0;
- FX_BOOL bIsLatin = FALSE;
+ bool bIsLatin = false;
for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) {
uint32_t charcode = CPDF_Font::kInvalidCharCode;
@@ -1563,7 +1561,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
return L"";
int nWords = 0;
- FX_BOOL bIsLatin = FALSE;
+ bool bIsLatin = false;
for (int i = 0, sz = pTextObj->CountChars(); i < sz; i++) {
uint32_t charcode = CPDF_Font::kInvalidCharCode;
@@ -1590,10 +1588,10 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
return swRet;
}
-FX_BOOL Document::zoom(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::zoom(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
/**
@@ -1606,75 +1604,75 @@ FX_BOOL Document::zoom(IJS_Context* cc,
(refW, ReflowWidth)
*/
-FX_BOOL Document::zoomType(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Document::zoomType(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Document::deletePages(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::deletePages(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, no supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::extractPages(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::extractPages(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::insertPages(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::insertPages(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::replacePages(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::replacePages(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::getURL(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::getURL(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Document::gotoNamedDest(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Document::gotoNamedDest(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!m_pFormFillEnv) {
sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CFX_WideString wideName = params[0].ToCFXWideString(pRuntime);
CFX_ByteString utf8Name = wideName.UTF8Encode();
CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument();
if (!pDocument)
- return FALSE;
+ return false;
CPDF_NameTree nameTree(pDocument, "Dests");
CPDF_Array* destArray = nameTree.LookupNamedDest(pDocument, utf8Name);
if (!destArray)
- return FALSE;
+ return false;
CPDF_Dest dest(destArray);
const CPDF_Array* arrayObject = ToArray(dest.GetObject());
@@ -1696,7 +1694,7 @@ FX_BOOL Document::gotoNamedDest(IJS_Context* cc,
scrollPositionArraySize);
pRuntime->EndBlock();
- return TRUE;
+ return true;
}
void Document::AddDelayData(CJS_DelayData* pData) {
diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h
index 129411a431..227c4284bb 100644
--- a/fpdfsdk/javascript/Document.h
+++ b/fpdfsdk/javascript/Document.h
@@ -22,14 +22,14 @@ class PrintParamsObj : public CJS_EmbedObj {
~PrintParamsObj() override {}
public:
- FX_BOOL bUI;
+ bool bUI;
int nStart;
int nEnd;
- FX_BOOL bSilent;
- FX_BOOL bShrinkToFit;
- FX_BOOL bPrintAsImage;
- FX_BOOL bReverse;
- FX_BOOL bAnnotations;
+ bool bSilent;
+ bool bShrinkToFit;
+ bool bPrintAsImage;
+ bool bReverse;
+ bool bAnnotations;
};
class CJS_PrintParamsObj : public CJS_Object {
@@ -61,215 +61,211 @@ class Document : public CJS_EmbedObj {
explicit Document(CJS_Object* pJSObject);
~Document() override;
- FX_BOOL ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL author(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL baseURL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL bookmarkRoot(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL Collab(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL creationDate(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL creator(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL dirty(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL documentFileName(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL external(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL filesize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL icons(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL info(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL keywords(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL layout(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL modDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL mouseX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL mouseY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numFields(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numPages(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL pageNum(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL pageWindowRect(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL path(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL producer(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL subject(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL title(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL zoom(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL zoomType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool ADBE(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool author(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool baseURL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool bookmarkRoot(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool Collab(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool creationDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool creator(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool dirty(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool documentFileName(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ bool external(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool filesize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool icons(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool info(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool keywords(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool layout(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool modDate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool mouseX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool mouseY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool numFields(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool numPages(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool pageNum(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool pageWindowRect(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ bool path(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool producer(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool subject(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool title(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool zoom(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool zoomType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL addAnnot(IJS_Context* cc,
+ bool addAnnot(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool addField(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool addLink(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool addIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool calculateNow(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool closeDoc(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool createDataObject(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool deletePages(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL addField(IJS_Context* cc,
+ bool exportAsText(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool exportAsFDF(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL addLink(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL addIcon(IJS_Context* cc,
+ bool exportAsXFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool extractPages(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getAnnot(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getAnnots(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getAnnot3D(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL calculateNow(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL closeDoc(IJS_Context* cc,
+ bool getAnnots3D(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL createDataObject(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL deletePages(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL exportAsText(IJS_Context* cc,
+ bool getField(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getLinks(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getNthFieldName(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL exportAsFDF(IJS_Context* cc,
+ bool getOCGs(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getPageBox(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getPageNthWord(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL exportAsXFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL extractPages(IJS_Context* cc,
+ bool getPageNthWordQuads(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getPageNumWords(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL getAnnot(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getAnnots(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getAnnot3D(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getAnnots3D(IJS_Context* cc,
+ bool getPrintParams(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL getField(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getIcon(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getLinks(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getNthFieldName(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getOCGs(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getPageBox(IJS_Context* cc,
+ bool getURL(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool gotoNamedDest(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL getPageNthWord(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getPageNthWordQuads(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getPageNumWords(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getPrintParams(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getURL(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL gotoNamedDest(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL importAnFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL importAnXFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL importTextData(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL insertPages(IJS_Context* cc,
+ bool importAnFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool importAnXFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool importTextData(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL mailForm(IJS_Context* cc,
+ bool insertPages(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL print(IJS_Context* cc,
+ bool mailForm(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL removeField(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL replacePages(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL resetForm(IJS_Context* cc,
+ bool print(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool removeField(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool replacePages(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL saveAs(IJS_Context* cc,
+ bool resetForm(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL submitForm(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL syncAnnotScan(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL mailDoc(IJS_Context* cc,
+ bool saveAs(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool submitForm(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL removeIcon(IJS_Context* cc,
+ bool syncAnnotScan(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool mailDoc(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool removeIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool URL(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv);
CPDFSDK_FormFillEnvironment* GetFormFillEnv() const {
@@ -284,10 +280,10 @@ class Document : public CJS_EmbedObj {
int CountWords(CPDF_TextObject* pTextObj);
CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex);
- FX_BOOL getPropertyInternal(IJS_Context* cc,
- CJS_PropValue& vp,
- const CFX_ByteString& propName,
- CFX_WideString& sError);
+ bool getPropertyInternal(IJS_Context* cc,
+ CJS_PropValue& vp,
+ const CFX_ByteString& propName,
+ CFX_WideString& sError);
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
CFX_WideString m_cwBaseURL;
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index a2118a77c0..4ce1f2e4e8 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -176,8 +176,8 @@ Field::Field(CJS_Object* pJSObject)
m_pJSDoc(nullptr),
m_pFormFillEnv(nullptr),
m_nFormControlIndex(-1),
- m_bCanSet(FALSE),
- m_bDelay(FALSE) {}
+ m_bCanSet(false),
+ m_bDelay(false) {}
Field::~Field() {}
@@ -208,8 +208,8 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed,
strFieldName = strFieldNameParsed.substr(0, iStart);
}
-FX_BOOL Field::AttachField(Document* pDocument,
- const CFX_WideString& csFieldName) {
+bool Field::AttachField(Document* pDocument,
+ const CFX_WideString& csFieldName) {
m_pJSDoc = pDocument;
m_pFormFillEnv.Reset(pDocument->GetFormFillEnv());
m_bCanSet = m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM) ||
@@ -226,17 +226,17 @@ FX_BOOL Field::AttachField(Document* pDocument,
int iControlNo = -1;
ParseFieldName(swFieldNameTemp.c_str(), strFieldName, iControlNo);
if (iControlNo == -1)
- return FALSE;
+ return false;
m_FieldName = strFieldName.c_str();
m_nFormControlIndex = iControlNo;
- return TRUE;
+ return true;
}
m_FieldName = swFieldNameTemp;
m_nFormControlIndex = -1;
- return TRUE;
+ return true;
}
std::vector<CPDF_FormField*> Field::GetFormFields(
@@ -259,9 +259,9 @@ std::vector<CPDF_FormField*> Field::GetFormFields(
void Field::UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormField* pFormField,
- FX_BOOL bChangeMark,
- FX_BOOL bResetAP,
- FX_BOOL bRefresh) {
+ bool bChangeMark,
+ bool bResetAP,
+ bool bRefresh) {
CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm();
if (bResetAP) {
@@ -271,18 +271,18 @@ void Field::UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
int nFieldType = pFormField->GetFieldType();
if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) {
for (CPDFSDK_Annot* pAnnot : widgets) {
- FX_BOOL bFormatted = FALSE;
+ bool bFormatted = false;
CPDFSDK_Annot::ObservedPtr pObserved(pAnnot);
CFX_WideString sValue =
static_cast<CPDFSDK_Widget*>(pObserved.Get())->OnFormat(bFormatted);
if (pObserved) {
static_cast<CPDFSDK_Widget*>(pObserved.Get())
- ->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE);
+ ->ResetAppearance(bFormatted ? &sValue : nullptr, false);
}
}
} else {
for (CPDFSDK_Widget* pWidget : widgets) {
- pWidget->ResetAppearance(nullptr, FALSE);
+ pWidget->ResetAppearance(nullptr, false);
}
}
}
@@ -310,9 +310,9 @@ void Field::UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
void Field::UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormControl* pFormControl,
- FX_BOOL bChangeMark,
- FX_BOOL bResetAP,
- FX_BOOL bRefresh) {
+ bool bChangeMark,
+ bool bResetAP,
+ bool bRefresh) {
ASSERT(pFormControl);
CPDFSDK_InterForm* pForm = pFormFillEnv->GetInterForm();
@@ -323,11 +323,11 @@ void Field::UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv,
int nFieldType = pWidget->GetFieldType();
if (nFieldType == FIELDTYPE_COMBOBOX ||
nFieldType == FIELDTYPE_TEXTFIELD) {
- FX_BOOL bFormatted = FALSE;
+ bool bFormatted = false;
CFX_WideString sValue = pWidget->OnFormat(bFormatted);
- pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, FALSE);
+ pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, false);
} else {
- pWidget->ResetAppearance(nullptr, FALSE);
+ pWidget->ResetAppearance(nullptr, false);
}
}
@@ -350,14 +350,14 @@ CPDFSDK_Widget* Field::GetWidget(CPDFSDK_FormFillEnvironment* pFormFillEnv,
: nullptr;
}
-FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField,
- CFX_WideString csOptLabel) {
+bool Field::ValueIsOccur(CPDF_FormField* pFormField,
+ CFX_WideString csOptLabel) {
for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) {
if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0)
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) {
@@ -371,14 +371,14 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) {
return pFormField->GetControl(m_nFormControlIndex);
}
-FX_BOOL Field::alignment(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::alignment(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
CFX_ByteString alignStr;
vp >> alignStr;
@@ -392,15 +392,15 @@ FX_BOOL Field::alignment(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
switch (pFormControl->GetControlAlignment()) {
case 1:
@@ -417,7 +417,7 @@ FX_BOOL Field::alignment(IJS_Context* cc,
}
}
- return TRUE;
+ return true;
}
void Field::SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -427,14 +427,14 @@ void Field::SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::borderStyle(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::borderStyle(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
CFX_ByteString strType = "";
vp >> strType;
@@ -448,16 +448,16 @@ FX_BOOL Field::borderStyle(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (!pFormField)
- return FALSE;
+ return false;
CPDFSDK_Widget* pWidget = GetWidget(
m_pFormFillEnv.Get(), GetSmartFieldControl(pFormField), false);
if (!pWidget)
- return FALSE;
+ return false;
switch (pWidget->GetBorderStyle()) {
case BorderStyle::SOLID:
@@ -481,7 +481,7 @@ FX_BOOL Field::borderStyle(IJS_Context* cc,
}
}
- return TRUE;
+ return true;
}
void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -508,18 +508,18 @@ void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
GetFormFields(pFormFillEnv, swFieldName);
for (CPDF_FormField* pFormField : FieldArray) {
if (nControlIndex < 0) {
- FX_BOOL bSet = FALSE;
+ bool bSet = false;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
if (CPDFSDK_Widget* pWidget =
GetWidget(pFormFillEnv, pFormField->GetControl(i), false)) {
if (pWidget->GetBorderStyle() != nBorderStyle) {
pWidget->SetBorderStyle(nBorderStyle);
- bSet = TRUE;
+ bSet = true;
}
}
}
if (bSet)
- UpdateFormField(pFormFillEnv, pFormField, TRUE, TRUE, TRUE);
+ UpdateFormField(pFormFillEnv, pFormField, true, true, true);
} else {
if (nControlIndex >= pFormField->CountControls())
return;
@@ -529,7 +529,7 @@ void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
GetWidget(pFormFillEnv, pFormControl, false)) {
if (pWidget->GetBorderStyle() != nBorderStyle) {
pWidget->SetBorderStyle(nBorderStyle);
- UpdateFormControl(pFormFillEnv, pFormControl, TRUE, TRUE, TRUE);
+ UpdateFormControl(pFormFillEnv, pFormControl, true, true, true);
}
}
}
@@ -537,14 +537,14 @@ void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
}
}
-FX_BOOL Field::buttonAlignX(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::buttonAlignX(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -558,15 +558,15 @@ FX_BOOL Field::buttonAlignX(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
CPDF_IconFit IconFit = pFormControl->GetIconFit();
@@ -576,7 +576,7 @@ FX_BOOL Field::buttonAlignX(IJS_Context* cc,
vp << (int32_t)fLeft;
}
- return TRUE;
+ return true;
}
void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -586,14 +586,14 @@ void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::buttonAlignY(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::buttonAlignY(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -607,15 +607,15 @@ FX_BOOL Field::buttonAlignY(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
CPDF_IconFit IconFit = pFormControl->GetIconFit();
@@ -625,7 +625,7 @@ FX_BOOL Field::buttonAlignY(IJS_Context* cc,
vp << (int32_t)fBottom;
}
- return TRUE;
+ return true;
}
void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -635,14 +635,14 @@ void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::buttonFitBounds(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::buttonFitBounds(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -656,20 +656,20 @@ FX_BOOL Field::buttonFitBounds(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
vp << pFormControl->GetIconFit().GetFittingBounds();
}
- return TRUE;
+ return true;
}
void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -679,14 +679,14 @@ void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::buttonPosition(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::buttonPosition(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -700,19 +700,19 @@ FX_BOOL Field::buttonPosition(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
vp << pFormControl->GetTextPosition();
}
- return TRUE;
+ return true;
}
void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -722,14 +722,14 @@ void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::buttonScaleHow(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::buttonScaleHow(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -743,15 +743,15 @@ FX_BOOL Field::buttonScaleHow(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
CPDF_IconFit IconFit = pFormControl->GetIconFit();
if (IconFit.IsProportionalScale())
@@ -760,7 +760,7 @@ FX_BOOL Field::buttonScaleHow(IJS_Context* cc,
vp << (int32_t)1;
}
- return TRUE;
+ return true;
}
void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -770,14 +770,14 @@ void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::buttonScaleWhen(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::buttonScaleWhen(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -791,15 +791,15 @@ FX_BOOL Field::buttonScaleWhen(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
CPDF_IconFit IconFit = pFormControl->GetIconFit();
int ScaleM = IconFit.GetScaleMethod();
@@ -819,7 +819,7 @@ FX_BOOL Field::buttonScaleWhen(IJS_Context* cc,
}
}
- return TRUE;
+ return true;
}
void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -829,14 +829,14 @@ void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::calcOrderIndex(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::calcOrderIndex(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -850,12 +850,12 @@ FX_BOOL Field::calcOrderIndex(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD) {
- return FALSE;
+ return false;
}
CPDFSDK_InterForm* pRDInterForm = m_pFormFillEnv->GetInterForm();
@@ -863,7 +863,7 @@ FX_BOOL Field::calcOrderIndex(IJS_Context* cc,
vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField);
}
- return TRUE;
+ return true;
}
void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -873,14 +873,14 @@ void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::charLimit(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::charLimit(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -894,15 +894,15 @@ FX_BOOL Field::charLimit(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
- return FALSE;
+ return false;
vp << (int32_t)pFormField->GetMaxLen();
}
- return TRUE;
+ return true;
}
void Field::SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -912,14 +912,12 @@ void Field::SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::comb(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::comb(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -933,11 +931,11 @@ FX_BOOL Field::comb(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_COMB)
vp << true;
@@ -945,7 +943,7 @@ FX_BOOL Field::comb(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -955,14 +953,14 @@ void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::commitOnSelChange(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::commitOnSelChange(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -976,12 +974,12 @@ FX_BOOL Field::commitOnSelChange(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
pFormField->GetFieldType() != FIELDTYPE_LISTBOX) {
- return FALSE;
+ return false;
}
if (pFormField->GetFieldFlags() & FIELDFLAG_COMMITONSELCHANGE)
@@ -990,7 +988,7 @@ FX_BOOL Field::commitOnSelChange(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1000,14 +998,14 @@ void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::currentValueIndices(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::currentValueIndices(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
std::vector<uint32_t> array;
if (vp.GetJSValue()->GetType() == CJS_Value::VT_number) {
@@ -1035,12 +1033,12 @@ FX_BOOL Field::currentValueIndices(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
pFormField->GetFieldType() != FIELDTYPE_LISTBOX) {
- return FALSE;
+ return false;
}
if (pFormField->CountSelectedItems() == 1) {
@@ -1057,7 +1055,7 @@ FX_BOOL Field::currentValueIndices(IJS_Context* cc,
}
}
- return TRUE;
+ return true;
}
void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1072,24 +1070,24 @@ void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv,
int nFieldType = pFormField->GetFieldType();
if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_LISTBOX) {
uint32_t dwFieldFlags = pFormField->GetFieldFlags();
- pFormField->ClearSelection(TRUE);
+ pFormField->ClearSelection(true);
for (size_t i = 0; i < array.size(); ++i) {
if (i != 0 && !(dwFieldFlags & (1 << 21)))
break;
if (array[i] < static_cast<uint32_t>(pFormField->CountOptions()) &&
!pFormField->IsItemSelected(array[i])) {
- pFormField->SetItemSelection(array[i], TRUE);
+ pFormField->SetItemSelection(array[i], true);
}
}
- UpdateFormField(pFormFillEnv, pFormField, TRUE, TRUE, TRUE);
+ UpdateFormField(pFormFillEnv, pFormField, true, true, true);
}
}
}
-FX_BOOL Field::defaultStyle(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::defaultStyle(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return false;
}
void Field::SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1098,14 +1096,14 @@ void Field::SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::defaultValue(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::defaultValue(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
CFX_WideString WideStr;
vp >> WideStr;
@@ -1119,17 +1117,17 @@ FX_BOOL Field::defaultValue(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON ||
pFormField->GetFieldType() == FIELDTYPE_SIGNATURE) {
- return FALSE;
+ return false;
}
vp << pFormField->GetDefaultValue();
}
- return TRUE;
+ return true;
}
void Field::SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1139,14 +1137,14 @@ void Field::SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::doNotScroll(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::doNotScroll(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -1160,11 +1158,11 @@ FX_BOOL Field::doNotScroll(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSCROLL)
vp << true;
@@ -1172,7 +1170,7 @@ FX_BOOL Field::doNotScroll(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1182,26 +1180,26 @@ void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::doNotSpellCheck(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::doNotSpellCheck(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD &&
pFormField->GetFieldType() != FIELDTYPE_COMBOBOX) {
- return FALSE;
+ return false;
}
if (pFormField->GetFieldFlags() & FIELDFLAG_DONOTSPELLCHECK)
@@ -1210,10 +1208,10 @@ FX_BOOL Field::doNotSpellCheck(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
-void Field::SetDelay(FX_BOOL bDelay) {
+void Field::SetDelay(bool bDelay) {
m_bDelay = bDelay;
if (!m_bDelay) {
@@ -1222,12 +1220,10 @@ void Field::SetDelay(FX_BOOL bDelay) {
}
}
-FX_BOOL Field::delay(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -1236,15 +1232,15 @@ FX_BOOL Field::delay(IJS_Context* cc,
} else {
vp << m_bDelay;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::display(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::display(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -1258,7 +1254,7 @@ FX_BOOL Field::display(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
ASSERT(pFormField);
@@ -1266,7 +1262,7 @@ FX_BOOL Field::display(IJS_Context* cc,
CPDFSDK_Widget* pWidget =
pInterForm->GetWidget(GetSmartFieldControl(pFormField), true);
if (!pWidget)
- return FALSE;
+ return false;
uint32_t dwFlag = pWidget->GetFlags();
@@ -1285,7 +1281,7 @@ FX_BOOL Field::display(IJS_Context* cc,
}
}
- return TRUE;
+ return true;
}
void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1308,7 +1304,7 @@ void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
}
if (bAnySet)
- UpdateFormField(pFormFillEnv, pFormField, TRUE, FALSE, TRUE);
+ UpdateFormField(pFormFillEnv, pFormField, true, false, true);
} else {
if (nControlIndex >= pFormField->CountControls())
return;
@@ -1319,36 +1315,36 @@ void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl, true);
if (SetWidgetDisplayStatus(pWidget, number))
- UpdateFormControl(pFormFillEnv, pFormControl, TRUE, FALSE, TRUE);
+ UpdateFormControl(pFormFillEnv, pFormControl, true, false, true);
}
}
}
-FX_BOOL Field::doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
+bool Field::doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting()) {
- return FALSE;
+ return false;
}
vp << m_pJSDoc->GetCJSDoc();
- return TRUE;
+ return true;
}
-FX_BOOL Field::editable(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::editable(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_EDIT)
vp << true;
@@ -1356,28 +1352,28 @@ FX_BOOL Field::editable(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::exportValues(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::exportValues(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX &&
pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON) {
- return FALSE;
+ return false;
}
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
if (!vp.GetJSValue()->IsArrayObject())
- return FALSE;
+ return false;
} else {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Array ExportValusArray;
@@ -1390,12 +1386,12 @@ FX_BOOL Field::exportValues(IJS_Context* cc,
}
} else {
if (m_nFormControlIndex >= pFormField->CountControls())
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl =
pFormField->GetControl(m_nFormControlIndex);
if (!pFormControl)
- return FALSE;
+ return false;
ExportValusArray.SetElement(
pRuntime, 0,
@@ -1403,23 +1399,23 @@ FX_BOOL Field::exportValues(IJS_Context* cc,
}
vp << ExportValusArray;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::fileSelect(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::fileSelect(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
- return FALSE;
+ return false;
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -1429,24 +1425,24 @@ FX_BOOL Field::fileSelect(IJS_Context* cc,
else
vp << false;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::fillColor(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::fillColor(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Array crArray;
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
if (!vp.GetJSValue()->IsArrayObject())
- return FALSE;
+ return false;
vp >> crArray;
@@ -1463,7 +1459,7 @@ FX_BOOL Field::fillColor(IJS_Context* cc,
ASSERT(pFormField);
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
int iColorType;
pFormControl->GetBackgroundColor(iColorType);
@@ -1486,14 +1482,14 @@ FX_BOOL Field::fillColor(IJS_Context* cc,
pFormControl->GetOriginalBackgroundColor(2),
pFormControl->GetOriginalBackgroundColor(3));
} else {
- return FALSE;
+ return false;
}
color::ConvertPWLColorToArray(pRuntime, color, &crArray);
vp << crArray;
}
- return TRUE;
+ return true;
}
void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1503,12 +1499,10 @@ void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::hidden(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -1522,7 +1516,7 @@ FX_BOOL Field::hidden(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
ASSERT(pFormField);
@@ -1530,7 +1524,7 @@ FX_BOOL Field::hidden(IJS_Context* cc,
CPDFSDK_Widget* pWidget =
pInterForm->GetWidget(GetSmartFieldControl(pFormField), false);
if (!pWidget)
- return FALSE;
+ return false;
uint32_t dwFlags = pWidget->GetFlags();
@@ -1540,7 +1534,7 @@ FX_BOOL Field::hidden(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1551,14 +1545,14 @@ void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv,
SetDisplay(pFormFillEnv, swFieldName, nControlIndex, display);
}
-FX_BOOL Field::highlight(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::highlight(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
CFX_ByteString strMode;
vp >> strMode;
@@ -1572,15 +1566,15 @@ FX_BOOL Field::highlight(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
int eHM = pFormControl->GetHighlightingMode();
switch (eHM) {
@@ -1602,7 +1596,7 @@ FX_BOOL Field::highlight(IJS_Context* cc,
}
}
- return TRUE;
+ return true;
}
void Field::SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1612,12 +1606,12 @@ void Field::SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::lineWidth(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::lineWidth(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int iWidth;
vp >> iWidth;
@@ -1631,27 +1625,27 @@ FX_BOOL Field::lineWidth(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
ASSERT(pFormField);
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
if (!pFormField->CountControls())
- return FALSE;
+ return false;
CPDFSDK_Widget* pWidget =
pInterForm->GetWidget(pFormField->GetControl(0), false);
if (!pWidget)
- return FALSE;
+ return false;
vp << (int32_t)pWidget->GetBorderWidth();
}
- return TRUE;
+ return true;
}
void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1663,7 +1657,7 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
GetFormFields(pFormFillEnv, swFieldName);
for (CPDF_FormField* pFormField : FieldArray) {
if (nControlIndex < 0) {
- FX_BOOL bSet = FALSE;
+ bool bSet = false;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
ASSERT(pFormControl);
@@ -1672,12 +1666,12 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
pInterForm->GetWidget(pFormControl, false)) {
if (number != pWidget->GetBorderWidth()) {
pWidget->SetBorderWidth(number);
- bSet = TRUE;
+ bSet = true;
}
}
}
if (bSet)
- UpdateFormField(pFormFillEnv, pFormField, TRUE, TRUE, TRUE);
+ UpdateFormField(pFormFillEnv, pFormField, true, true, true);
} else {
if (nControlIndex >= pFormField->CountControls())
return;
@@ -1687,7 +1681,7 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
pInterForm->GetWidget(pFormControl, false)) {
if (number != pWidget->GetBorderWidth()) {
pWidget->SetBorderWidth(number);
- UpdateFormControl(pFormFillEnv, pFormControl, TRUE, TRUE, TRUE);
+ UpdateFormControl(pFormFillEnv, pFormControl, true, true, true);
}
}
}
@@ -1695,14 +1689,14 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv,
}
}
-FX_BOOL Field::multiline(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::multiline(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -1716,11 +1710,11 @@ FX_BOOL Field::multiline(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_MULTILINE)
vp << true;
@@ -1728,7 +1722,7 @@ FX_BOOL Field::multiline(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1738,14 +1732,14 @@ void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::multipleSelection(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::multipleSelection(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -1759,11 +1753,11 @@ FX_BOOL Field::multipleSelection(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_LISTBOX)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_MULTISELECT)
vp << true;
@@ -1771,7 +1765,7 @@ FX_BOOL Field::multipleSelection(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
void Field::SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1781,61 +1775,57 @@ void Field::SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::name(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
vp << m_FieldName;
- return TRUE;
+ return true;
}
-FX_BOOL Field::numItems(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::numItems(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_COMBOBOX &&
pFormField->GetFieldType() != FIELDTYPE_LISTBOX) {
- return FALSE;
+ return false;
}
vp << (int32_t)pFormField->CountOptions();
- return TRUE;
+ return true;
}
-FX_BOOL Field::page(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::page(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (!pFormField)
- return FALSE;
+ return false;
std::vector<CPDFSDK_Widget*> widgets;
m_pFormFillEnv->GetInterForm()->GetWidgets(pFormField, &widgets);
if (widgets.empty()) {
vp << (int32_t)-1;
- return TRUE;
+ return true;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1843,24 +1833,24 @@ FX_BOOL Field::page(IJS_Context* cc,
for (size_t i = 0; i < widgets.size(); ++i) {
CPDFSDK_PageView* pPageView = widgets[i]->GetPageView();
if (!pPageView)
- return FALSE;
+ return false;
PageArray.SetElement(
pRuntime, i, CJS_Value(pRuntime, (int32_t)pPageView->GetPageIndex()));
}
vp << PageArray;
- return TRUE;
+ return true;
}
-FX_BOOL Field::password(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::password(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -1874,11 +1864,11 @@ FX_BOOL Field::password(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_PASSWORD)
vp << true;
@@ -1886,7 +1876,7 @@ FX_BOOL Field::password(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -1896,24 +1886,22 @@ void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::print(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
for (CPDF_FormField* pFormField : FieldArray) {
if (m_nFormControlIndex < 0) {
- FX_BOOL bSet = FALSE;
+ bool bSet = false;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
if (CPDFSDK_Widget* pWidget =
pInterForm->GetWidget(pFormField->GetControl(i), false)) {
@@ -1925,16 +1913,16 @@ FX_BOOL Field::print(IJS_Context* cc,
if (dwFlags != pWidget->GetFlags()) {
pWidget->SetFlags(dwFlags);
- bSet = TRUE;
+ bSet = true;
}
}
}
if (bSet)
- UpdateFormField(m_pFormFillEnv.Get(), pFormField, TRUE, FALSE, TRUE);
+ UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, false, true);
} else {
if (m_nFormControlIndex >= pFormField->CountControls())
- return FALSE;
+ return false;
if (CPDF_FormControl* pFormControl =
pFormField->GetControl(m_nFormControlIndex)) {
if (CPDFSDK_Widget* pWidget =
@@ -1949,7 +1937,7 @@ FX_BOOL Field::print(IJS_Context* cc,
pWidget->SetFlags(dwFlags);
UpdateFormControl(m_pFormFillEnv.Get(),
pFormField->GetControl(m_nFormControlIndex),
- TRUE, FALSE, TRUE);
+ true, false, true);
}
}
}
@@ -1960,7 +1948,7 @@ FX_BOOL Field::print(IJS_Context* cc,
CPDFSDK_Widget* pWidget =
pInterForm->GetWidget(GetSmartFieldControl(pFormField), true);
if (!pWidget)
- return FALSE;
+ return false;
if (pWidget->GetFlags() & ANNOTFLAG_PRINT)
vp << true;
@@ -1968,19 +1956,19 @@ FX_BOOL Field::print(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::radiosInUnison(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::radiosInUnison(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -1988,7 +1976,7 @@ FX_BOOL Field::radiosInUnison(IJS_Context* cc,
} else {
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_RADIOSINUNISON)
vp << true;
@@ -1996,19 +1984,19 @@ FX_BOOL Field::radiosInUnison(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::readonly(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::readonly(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -2021,12 +2009,10 @@ FX_BOOL Field::readonly(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::rect(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::rect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Value Upper_Leftx(pRuntime);
CJS_Value Upper_Lefty(pRuntime);
@@ -2035,9 +2021,9 @@ FX_BOOL Field::rect(IJS_Context* cc,
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
if (!vp.GetJSValue()->IsArrayObject())
- return FALSE;
+ return false;
CJS_Array rcArray;
vp >> rcArray;
@@ -2062,14 +2048,14 @@ FX_BOOL Field::rect(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDFSDK_Widget* pWidget =
pInterForm->GetWidget(GetSmartFieldControl(pFormField), true);
if (!pWidget)
- return FALSE;
+ return false;
CFX_FloatRect crRect = pWidget->GetRect();
Upper_Leftx = CJS_Value(pRuntime, static_cast<int32_t>(crRect.left));
@@ -2084,7 +2070,7 @@ FX_BOOL Field::rect(IJS_Context* cc,
rcArray.SetElement(pRuntime, 3, Lower_Righty);
vp << rcArray;
}
- return TRUE;
+ return true;
}
void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2096,7 +2082,7 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
GetFormFields(pFormFillEnv, swFieldName);
for (CPDF_FormField* pFormField : FieldArray) {
if (nControlIndex < 0) {
- FX_BOOL bSet = FALSE;
+ bool bSet = false;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
ASSERT(pFormControl);
@@ -2113,14 +2099,14 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
if (crRect.left != rcOld.left || crRect.right != rcOld.right ||
crRect.top != rcOld.top || crRect.bottom != rcOld.bottom) {
pWidget->SetRect(crRect);
- bSet = TRUE;
+ bSet = true;
}
}
}
}
if (bSet)
- UpdateFormField(pFormFillEnv, pFormField, TRUE, TRUE, TRUE);
+ UpdateFormField(pFormFillEnv, pFormField, true, true, true);
} else {
if (nControlIndex >= pFormField->CountControls())
return;
@@ -2138,7 +2124,7 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
if (crRect.left != rcOld.left || crRect.right != rcOld.right ||
crRect.top != rcOld.top || crRect.bottom != rcOld.bottom) {
pWidget->SetRect(crRect);
- UpdateFormControl(pFormFillEnv, pFormControl, TRUE, TRUE, TRUE);
+ UpdateFormControl(pFormFillEnv, pFormControl, true, true, true);
}
}
}
@@ -2147,16 +2133,16 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv,
}
}
-FX_BOOL Field::required(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::required(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -2164,7 +2150,7 @@ FX_BOOL Field::required(IJS_Context* cc,
} else {
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_REQUIRED)
vp << true;
@@ -2172,17 +2158,17 @@ FX_BOOL Field::required(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::richText(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::richText(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
bool bVP;
vp >> bVP;
@@ -2193,11 +2179,11 @@ FX_BOOL Field::richText(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_TEXTFIELD)
- return FALSE;
+ return false;
if (pFormField->GetFieldFlags() & FIELDFLAG_RICHTEXT)
vp << true;
@@ -2205,23 +2191,23 @@ FX_BOOL Field::richText(IJS_Context* cc,
vp << false;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::richValue(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Field::richValue(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Field::rotation(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::rotation(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -2235,17 +2221,17 @@ FX_BOOL Field::rotation(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
vp << (int32_t)pFormControl->GetRotation();
}
- return TRUE;
+ return true;
}
void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2255,18 +2241,18 @@ void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::strokeColor(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::strokeColor(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Array crArray;
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
if (!vp.GetJSValue()->IsArrayObject())
- return FALSE;
+ return false;
vp >> crArray;
@@ -2282,12 +2268,12 @@ FX_BOOL Field::strokeColor(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
int iColorType;
pFormControl->GetBorderColor(iColorType);
@@ -2309,13 +2295,13 @@ FX_BOOL Field::strokeColor(IJS_Context* cc,
pFormControl->GetOriginalBorderColor(2),
pFormControl->GetOriginalBorderColor(3));
} else {
- return FALSE;
+ return false;
}
color::ConvertPWLColorToArray(pRuntime, color, &crArray);
vp << crArray;
}
- return TRUE;
+ return true;
}
void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2325,14 +2311,12 @@ void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::style(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::style(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
CFX_ByteString csBCaption;
vp >> csBCaption;
@@ -2346,17 +2330,17 @@ FX_BOOL Field::style(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON &&
pFormField->GetFieldType() != FIELDTYPE_CHECKBOX) {
- return FALSE;
+ return false;
}
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
CFX_WideString csWCaption = pFormControl->GetNormalCaption();
CFX_ByteString csBCaption;
@@ -2384,7 +2368,7 @@ FX_BOOL Field::style(IJS_Context* cc,
vp << csBCaption;
}
- return TRUE;
+ return true;
}
void Field::SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2394,24 +2378,24 @@ void Field::SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::submitName(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool Field::submitName(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Field::textColor(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::textColor(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Array crArray;
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
if (!vp.GetJSValue()->IsArrayObject())
- return FALSE;
+ return false;
vp >> crArray;
@@ -2427,12 +2411,12 @@ FX_BOOL Field::textColor(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
int iColorType;
FX_ARGB color;
@@ -2451,7 +2435,7 @@ FX_BOOL Field::textColor(IJS_Context* cc,
color::ConvertPWLColorToArray(pRuntime, crRet, &crArray);
vp << crArray;
}
- return TRUE;
+ return true;
}
void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2461,19 +2445,19 @@ void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::textFont(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::textFont(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
CFX_ByteString csFontName;
vp >> csFontName;
if (csFontName.IsEmpty())
- return FALSE;
+ return false;
if (m_bDelay) {
AddDelay_String(FP_TEXTFONT, csFontName);
@@ -2484,13 +2468,13 @@ FX_BOOL Field::textFont(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
ASSERT(pFormField);
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
int nFieldType = pFormField->GetFieldType();
@@ -2499,15 +2483,15 @@ FX_BOOL Field::textFont(IJS_Context* cc,
nFieldType == FIELDTYPE_TEXTFIELD) {
CPDF_Font* pFont = pFormControl->GetDefaultControlFont();
if (!pFont)
- return FALSE;
+ return false;
vp << pFont->GetBaseFont();
} else {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
void Field::SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2517,14 +2501,14 @@ void Field::SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::textSize(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::textSize(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int nVP;
vp >> nVP;
@@ -2538,13 +2522,13 @@ FX_BOOL Field::textSize(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
ASSERT(pFormField);
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
CPDF_DefaultAppearance FieldAppearance =
pFormControl->GetDefaultAppearance();
@@ -2556,7 +2540,7 @@ FX_BOOL Field::textSize(IJS_Context* cc,
vp << (int)fFontSize;
}
- return TRUE;
+ return true;
}
void Field::SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2566,15 +2550,13 @@ void Field::SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::type(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
switch (pFormField->GetFieldType()) {
@@ -2607,17 +2589,17 @@ FX_BOOL Field::type(IJS_Context* cc,
break;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::userName(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::userName(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
ASSERT(m_pFormFillEnv);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
CFX_WideString swName;
vp >> swName;
@@ -2631,13 +2613,13 @@ FX_BOOL Field::userName(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
vp << (CFX_WideString)pFormField->GetAlternateName();
}
- return TRUE;
+ return true;
}
void Field::SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2647,14 +2629,12 @@ void Field::SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv,
// Not supported.
}
-FX_BOOL Field::value(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
if (vp.IsSetting()) {
if (!m_bCanSet)
- return FALSE;
+ return false;
std::vector<CFX_WideString> strArray;
if (vp.GetJSValue()->IsArrayObject()) {
@@ -2680,12 +2660,12 @@ FX_BOOL Field::value(IJS_Context* cc,
} else {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
switch (pFormField->GetFieldType()) {
case FIELDTYPE_PUSHBUTTON:
- return FALSE;
+ return false;
case FIELDTYPE_COMBOBOX:
case FIELDTYPE_TEXTFIELD: {
vp << pFormField->GetValue();
@@ -2730,7 +2710,7 @@ FX_BOOL Field::value(IJS_Context* cc,
}
}
vp.GetJSValue()->MaybeCoerceToNumber(pRuntime);
- return TRUE;
+ return true;
}
void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
@@ -2752,33 +2732,33 @@ void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
case FIELDTYPE_TEXTFIELD:
case FIELDTYPE_COMBOBOX:
if (pFormField->GetValue() != strArray[0]) {
- pFormField->SetValue(strArray[0], TRUE);
- UpdateFormField(pFormFillEnv, pFormField, TRUE, FALSE, TRUE);
+ pFormField->SetValue(strArray[0], true);
+ UpdateFormField(pFormFillEnv, pFormField, true, false, true);
}
break;
case FIELDTYPE_CHECKBOX:
case FIELDTYPE_RADIOBUTTON: {
if (pFormField->GetValue() != strArray[0]) {
- pFormField->SetValue(strArray[0], TRUE);
- UpdateFormField(pFormFillEnv, pFormField, TRUE, FALSE, TRUE);
+ pFormField->SetValue(strArray[0], true);
+ UpdateFormField(pFormFillEnv, pFormField, true, false, true);
}
} break;
case FIELDTYPE_LISTBOX: {
- FX_BOOL bModified = FALSE;
+ bool bModified = false;
for (const auto& str : strArray) {
if (!pFormField->IsItemSelected(pFormField->FindOption(str))) {
- bModified = TRUE;
+ bModified = true;
break;
}
}
if (bModified) {
- pFormField->ClearSelection(TRUE);
+ pFormField->ClearSelection(true);
for (const auto& str : strArray) {
int index = pFormField->FindOption(str);
if (!pFormField->IsItemSelected(index))
- pFormField->SetItemSelection(index, TRUE, TRUE);
+ pFormField->SetItemSelection(index, true, true);
}
- UpdateFormField(pFormFillEnv, pFormField, TRUE, FALSE, TRUE);
+ UpdateFormField(pFormFillEnv, pFormField, true, false, true);
}
} break;
default:
@@ -2787,23 +2767,23 @@ void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv,
}
}
-FX_BOOL Field::valueAsString(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::valueAsString(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() == FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
if (pFormField->GetFieldType() == FIELDTYPE_CHECKBOX) {
if (!pFormField->CountControls())
- return FALSE;
+ return false;
if (pFormField->GetControl(0)->IsChecked())
vp << L"Yes";
@@ -2826,16 +2806,16 @@ FX_BOOL Field::valueAsString(IJS_Context* cc,
vp << pFormField->GetValue().c_str();
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::browseForFileToSubmit(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) &&
@@ -2843,17 +2823,17 @@ FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc,
CFX_WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse();
if (!wsFileName.IsEmpty()) {
pFormField->SetValue(wsFileName);
- UpdateFormField(m_pFormFillEnv.Get(), pFormField, TRUE, TRUE, TRUE);
+ UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true);
}
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL Field::buttonGetCaption(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::buttonGetCaption(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int nface = 0;
@@ -2863,15 +2843,15 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc,
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
if (nface == 0)
vRet = CJS_Value(pRuntime, pFormControl->GetNormalCaption().c_str());
@@ -2880,15 +2860,15 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc,
else if (nface == 2)
vRet = CJS_Value(pRuntime, pFormControl->GetRolloverCaption().c_str());
else
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
-FX_BOOL Field::buttonGetIcon(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::buttonGetIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
@@ -2899,19 +2879,19 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc,
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_PUSHBUTTON)
- return FALSE;
+ return false;
CPDF_FormControl* pFormControl = GetSmartFieldControl(pFormField);
if (!pFormControl)
- return FALSE;
+ return false;
v8::Local<v8::Object> pObj =
pRuntime->NewFxDynamicObj(CJS_Icon::g_nObjDefnID);
- ASSERT(pObj.IsEmpty() == FALSE);
+ ASSERT(pObj.IsEmpty() == false);
CJS_Icon* pJS_Icon = static_cast<CJS_Icon*>(pRuntime->GetObjectPrivate(pObj));
Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
@@ -2924,44 +2904,44 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc,
else if (nface == 2)
pIconStream = pFormControl->GetRolloverIcon();
else
- return FALSE;
+ return false;
pIcon->SetStream(pIconStream);
vRet = CJS_Value(pRuntime, pJS_Icon);
- return TRUE;
-}
-
-FX_BOOL Field::buttonImportIcon(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+ return true;
}
-FX_BOOL Field::buttonSetCaption(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::buttonImportIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Field::buttonSetIcon(IJS_Context* cc,
+bool Field::buttonSetCaption(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- return FALSE;
+ return false;
}
-FX_BOOL Field::checkThisBox(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::buttonSetIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
+}
+
+bool Field::checkThisBox(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
int iSize = params.size();
if (iSize < 1)
- return FALSE;
+ return false;
if (!m_bCanSet)
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int nWidget = params[0].ToInt(pRuntime);
@@ -2972,14 +2952,14 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc,
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (pFormField->GetFieldType() != FIELDTYPE_CHECKBOX &&
pFormField->GetFieldType() != FIELDTYPE_RADIOBUTTON)
- return FALSE;
+ return false;
if (nWidget < 0 || nWidget >= pFormField->CountControls())
- return FALSE;
+ return false;
// TODO(weili): Check whether anything special needed for radio button,
// otherwise merge these branches.
if (pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON)
@@ -2987,60 +2967,60 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc,
else
pFormField->CheckControl(nWidget, bCheckit, true);
- UpdateFormField(m_pFormFillEnv.Get(), pFormField, TRUE, TRUE, TRUE);
- return TRUE;
+ UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true);
+ return true;
}
-FX_BOOL Field::clearItems(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool Field::clearItems(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Field::defaultIsChecked(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::defaultIsChecked(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (!m_bCanSet)
- return FALSE;
+ return false;
int iSize = params.size();
if (iSize < 1)
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int nWidget = params[0].ToInt(pRuntime);
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (nWidget < 0 || nWidget >= pFormField->CountControls())
- return FALSE;
+ return false;
vRet = CJS_Value(pRuntime,
pFormField->GetFieldType() == FIELDTYPE_CHECKBOX ||
pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON);
- return TRUE;
+ return true;
}
-FX_BOOL Field::deleteItemAt(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool Field::deleteItemAt(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Field::getArray(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::getArray(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
std::vector<std::unique_ptr<CFX_WideString>> swSort;
for (CPDF_FormField* pFormField : FieldArray) {
@@ -3071,13 +3051,13 @@ FX_BOOL Field::getArray(IJS_Context* cc,
}
vRet = CJS_Value(pRuntime, FormFieldArray);
- return TRUE;
+ return true;
}
-FX_BOOL Field::getItemAt(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::getItemAt(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int iSize = params.size();
@@ -3085,13 +3065,13 @@ FX_BOOL Field::getItemAt(IJS_Context* cc,
if (iSize >= 1)
nIdx = params[0].ToInt(pRuntime);
- FX_BOOL bExport = TRUE;
+ bool bExport = true;
if (iSize >= 2)
bExport = params[1].ToBool(pRuntime);
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if ((pFormField->GetFieldType() == FIELDTYPE_LISTBOX) ||
@@ -3108,30 +3088,30 @@ FX_BOOL Field::getItemAt(IJS_Context* cc,
vRet = CJS_Value(pRuntime, pFormField->GetOptionLabel(nIdx).c_str());
}
} else {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::getLock(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::getLock(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL Field::insertItemAt(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool Field::insertItemAt(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Field::isBoxChecked(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::isBoxChecked(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int nIndex = -1;
@@ -3140,24 +3120,24 @@ FX_BOOL Field::isBoxChecked(IJS_Context* cc,
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (nIndex < 0 || nIndex >= pFormField->CountControls()) {
- return FALSE;
+ return false;
}
vRet = CJS_Value(pRuntime,
((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX ||
pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) &&
pFormField->GetControl(nIndex)->IsChecked() != 0));
- return TRUE;
+ return true;
}
-FX_BOOL Field::isDefaultChecked(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::isDefaultChecked(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int nIndex = -1;
@@ -3166,38 +3146,38 @@ FX_BOOL Field::isDefaultChecked(IJS_Context* cc,
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
if (nIndex < 0 || nIndex >= pFormField->CountControls())
- return FALSE;
+ return false;
vRet = CJS_Value(pRuntime,
((pFormField->GetFieldType() == FIELDTYPE_CHECKBOX ||
pFormField->GetFieldType() == FIELDTYPE_RADIOBUTTON) &&
pFormField->GetControl(nIndex)->IsDefaultChecked() != 0));
- return TRUE;
+ return true;
}
-FX_BOOL Field::setAction(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool Field::setAction(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Field::setFocus(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Field::setFocus(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
- return FALSE;
+ return false;
CPDF_FormField* pFormField = FieldArray[0];
int32_t nCount = pFormField->CountControls();
if (nCount < 1)
- return FALSE;
+ return false;
CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
CPDFSDK_Widget* pWidget = nullptr;
@@ -3208,7 +3188,7 @@ FX_BOOL Field::setFocus(IJS_Context* cc,
UnderlyingFromFPDFPage(m_pFormFillEnv->GetCurrentPage(
m_pFormFillEnv->GetUnderlyingDocument()));
if (!pPage)
- return FALSE;
+ return false;
if (CPDFSDK_PageView* pCurPageView =
m_pFormFillEnv->GetPageView(pPage, true)) {
for (int32_t i = 0; i < nCount; i++) {
@@ -3228,73 +3208,71 @@ FX_BOOL Field::setFocus(IJS_Context* cc,
m_pFormFillEnv->SetFocusAnnot(&pObserved);
}
- return TRUE;
+ return true;
}
-FX_BOOL Field::setItems(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool Field::setItems(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL Field::setLock(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::setLock(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL Field::signatureGetModifications(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::signatureGetModifications(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL Field::signatureGetSeedValue(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::signatureGetSeedValue(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL Field::signatureInfo(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::signatureInfo(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL Field::signatureSetSeedValue(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::signatureSetSeedValue(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL Field::signatureSign(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::signatureSign(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL Field::signatureValidate(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool Field::signatureValidate(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL Field::source(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool Field::source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (vp.IsGetting()) {
vp << (CJS_Object*)nullptr;
}
- return TRUE;
+ return true;
}
void Field::AddDelay_Int(FIELD_PROP prop, int32_t n) {
diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h
index cdff0915b4..d4371ab274 100644
--- a/fpdfsdk/javascript/Field.h
+++ b/fpdfsdk/javascript/Field.h
@@ -77,205 +77,185 @@ class Field : public CJS_EmbedObj {
explicit Field(CJS_Object* pJSObject);
~Field() override;
- FX_BOOL alignment(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL borderStyle(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL buttonAlignX(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL buttonAlignY(IJS_Context* cc,
+ bool alignment(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool borderStyle(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool buttonAlignX(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool buttonAlignY(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool buttonFitBounds(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL buttonFitBounds(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL buttonPosition(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL buttonScaleHow(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL buttonScaleWhen(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL calcOrderIndex(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL charLimit(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL comb(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL commitOnSelChange(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL currentValueIndices(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL defaultStyle(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL defaultValue(IJS_Context* cc,
+ bool buttonPosition(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ bool buttonScaleHow(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ bool buttonScaleWhen(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL doNotScroll(IJS_Context* cc,
+ bool calcOrderIndex(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL doNotSpellCheck(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL display(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL editable(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL exportValues(IJS_Context* cc,
+ bool charLimit(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool comb(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool commitOnSelChange(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ bool currentValueIndices(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ bool defaultStyle(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool defaultValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool doNotScroll(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool doNotSpellCheck(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL fileSelect(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL fillColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL highlight(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL lineWidth(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL multiline(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL multipleSelection(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL numItems(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL page(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL password(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL radiosInUnison(IJS_Context* cc,
+ bool delay(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool display(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool editable(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool exportValues(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool fileSelect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool fillColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool hidden(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool highlight(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool lineWidth(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool multiline(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool multipleSelection(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL readonly(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL required(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richText(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rotation(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL strokeColor(IJS_Context* cc,
+ bool name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool numItems(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool page(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool password(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool print(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool radiosInUnison(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL style(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL submitName(IJS_Context* cc,
+ bool readonly(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool rect(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool required(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool richText(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool rotation(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool strokeColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool style(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool submitName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool textColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool textFont(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool textSize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool userName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool valueAsString(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL textColor(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL textFont(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL textSize(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL userName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL valueAsString(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL browseForFileToSubmit(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL buttonGetCaption(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL buttonGetIcon(IJS_Context* cc,
+ bool browseForFileToSubmit(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool buttonGetCaption(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL buttonImportIcon(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL buttonSetCaption(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL buttonSetIcon(IJS_Context* cc,
+ bool buttonGetIcon(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool buttonImportIcon(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL checkThisBox(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL clearItems(IJS_Context* cc,
+ bool buttonSetCaption(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool buttonSetIcon(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL defaultIsChecked(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL deleteItemAt(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getArray(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL getItemAt(IJS_Context* cc,
+ bool checkThisBox(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL getLock(IJS_Context* cc,
+ bool clearItems(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL insertItemAt(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL isBoxChecked(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL isDefaultChecked(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL setAction(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL setFocus(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL setItems(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL setLock(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL signatureGetModifications(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL signatureGetSeedValue(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL signatureInfo(IJS_Context* cc,
+ bool defaultIsChecked(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL signatureSetSeedValue(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL signatureSign(IJS_Context* cc,
+ bool deleteItemAt(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getArray(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getItemAt(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool getLock(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool insertItemAt(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool isBoxChecked(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool isDefaultChecked(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL signatureValidate(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
+ bool setAction(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool setFocus(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool setItems(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool setLock(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool signatureGetModifications(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool signatureGetSeedValue(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool signatureInfo(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool signatureSetSeedValue(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool signatureSign(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool signatureValidate(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
static void SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& swFieldName,
@@ -417,14 +397,14 @@ class Field : public CJS_EmbedObj {
static void UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormField* pFormField,
- FX_BOOL bChangeMark,
- FX_BOOL bResetAP,
- FX_BOOL bRefresh);
+ bool bChangeMark,
+ bool bResetAP,
+ bool bRefresh);
static void UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormControl* pFormControl,
- FX_BOOL bChangeMark,
- FX_BOOL bResetAP,
- FX_BOOL bRefresh);
+ bool bChangeMark,
+ bool bResetAP,
+ bool bRefresh);
static CPDFSDK_Widget* GetWidget(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormControl* pFormControl,
@@ -436,8 +416,8 @@ class Field : public CJS_EmbedObj {
static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CJS_DelayData* pData);
- FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName);
- void SetDelay(FX_BOOL bDelay);
+ bool AttachField(Document* pDocument, const CFX_WideString& csFieldName);
+ void SetDelay(bool bDelay);
protected:
void ParseFieldName(const std::wstring& strFieldNameParsed,
@@ -446,7 +426,7 @@ class Field : public CJS_EmbedObj {
std::vector<CPDF_FormField*> GetFormFields(
const CFX_WideString& csFieldName) const;
CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField);
- FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
+ bool ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel);
void AddDelay_Int(FIELD_PROP prop, int32_t n);
void AddDelay_Bool(FIELD_PROP prop, bool b);
@@ -465,8 +445,8 @@ class Field : public CJS_EmbedObj {
CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv;
CFX_WideString m_FieldName;
int m_nFormControlIndex;
- FX_BOOL m_bCanSet;
- FX_BOOL m_bDelay;
+ bool m_bCanSet;
+ bool m_bDelay;
};
class CJS_Field : public CJS_Object {
diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp
index 031ec4f63a..94841ef870 100644
--- a/fpdfsdk/javascript/Icon.cpp
+++ b/fpdfsdk/javascript/Icon.cpp
@@ -44,10 +44,10 @@ CFX_WideString Icon::GetIconName() {
return m_swIconName;
}
-FX_BOOL Icon::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
+bool Icon::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
vp << m_swIconName;
- return TRUE;
+ return true;
}
diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h
index f8fa70e076..98a479c148 100644
--- a/fpdfsdk/javascript/Icon.h
+++ b/fpdfsdk/javascript/Icon.h
@@ -16,7 +16,7 @@ class Icon : public CJS_EmbedObj {
explicit Icon(CJS_Object* pJSObject);
~Icon() override;
- FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
void SetStream(CPDF_Stream* pIconStream);
CPDF_Stream* GetStream();
void SetIconName(CFX_WideString name);
diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h
index 1c688d2c11..17dd8e9c70 100644
--- a/fpdfsdk/javascript/JS_Define.h
+++ b/fpdfsdk/javascript/JS_Define.h
@@ -70,8 +70,7 @@ struct JSMethodSpec {
} \
; // NOLINT
-template <class C,
- FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)>
+template <class C, bool (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropGetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -94,8 +93,7 @@ void JSPropGetter(const char* prop_name_string,
info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(pRuntime));
}
-template <class C,
- FX_BOOL (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)>
+template <class C, bool (C::*M)(IJS_Context*, CJS_PropValue&, CFX_WideString&)>
void JSPropSetter(const char* prop_name_string,
const char* class_name_string,
v8::Local<v8::String> property,
@@ -132,10 +130,10 @@ void JSPropSetter(const char* prop_name_string,
}
template <class C,
- FX_BOOL (C::*M)(IJS_Context*,
- const std::vector<CJS_Value>&,
- CJS_Value&,
- CFX_WideString&)>
+ bool (C::*M)(IJS_Context*,
+ const std::vector<CJS_Value>&,
+ CJS_Value&,
+ CFX_WideString&)>
void JSMethod(const char* method_name_string,
const char* class_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -357,7 +355,7 @@ void JSSpecialPropQuery(const char*,
CJS_Object* pJSObj =
static_cast<CJS_Object*>(pRuntime->GetObjectPrivate(info.Holder()));
Alt* pObj = reinterpret_cast<Alt*>(pJSObj->GetEmbedObject());
- FX_BOOL bRet = pObj->QueryProperty(propname.c_str());
+ bool bRet = pObj->QueryProperty(propname.c_str());
info.GetReturnValue().Set(bRet ? 4 : 0);
}
@@ -433,10 +431,10 @@ void JSSpecialPropDel(const char* class_name,
}
}
-template <FX_BOOL (*F)(IJS_Context*,
- const std::vector<CJS_Value>&,
- CJS_Value&,
- CFX_WideString&)>
+template <bool (*F)(IJS_Context*,
+ const std::vector<CJS_Value>&,
+ CJS_Value&,
+ CFX_WideString&)>
void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
CJS_Runtime* pRuntime =
diff --git a/fpdfsdk/javascript/JS_EventHandler.cpp b/fpdfsdk/javascript/JS_EventHandler.cpp
index 27223cfccb..5715cb9217 100644
--- a/fpdfsdk/javascript/JS_EventHandler.cpp
+++ b/fpdfsdk/javascript/JS_EventHandler.cpp
@@ -17,21 +17,21 @@
CJS_EventHandler::CJS_EventHandler(CJS_Context* pContext)
: m_pJSContext(pContext),
m_eEventType(JET_UNKNOWN),
- m_bValid(FALSE),
+ m_bValid(false),
m_pWideStrChange(nullptr),
m_nCommitKey(-1),
- m_bKeyDown(FALSE),
- m_bModifier(FALSE),
- m_bShift(FALSE),
+ m_bKeyDown(false),
+ m_bModifier(false),
+ m_bShift(false),
m_pISelEnd(nullptr),
m_nSelEndDu(0),
m_pISelStart(nullptr),
m_nSelStartDu(0),
- m_bWillCommit(FALSE),
+ m_bWillCommit(false),
m_pValue(nullptr),
- m_bFieldFull(FALSE),
+ m_bFieldFull(false),
m_pbRc(nullptr),
- m_bRcDu(FALSE),
+ m_bRcDu(false),
m_pTargetBookMark(nullptr),
m_pTargetFormFillEnv(nullptr),
m_pTargetAnnot(nullptr) {}
@@ -101,8 +101,8 @@ void CJS_EventHandler::OnPage_OutView(
m_pTargetFormFillEnv = pFormFillEnv;
}
-void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnField_MouseEnter(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) {
Initial(JET_FIELD_MOUSEENTER);
@@ -112,8 +112,8 @@ void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier,
m_strTargetName = pTarget->GetFullName();
}
-void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnField_MouseExit(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) {
Initial(JET_FIELD_MOUSEEXIT);
@@ -122,8 +122,8 @@ void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier,
m_strTargetName = pTarget->GetFullName();
}
-void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnField_MouseDown(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) {
Initial(JET_FIELD_MOUSEDOWN);
m_eEventType = JET_FIELD_MOUSEDOWN;
@@ -133,8 +133,8 @@ void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier,
m_strTargetName = pTarget->GetFullName();
}
-void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnField_MouseUp(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) {
Initial(JET_FIELD_MOUSEUP);
@@ -143,8 +143,8 @@ void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier,
m_strTargetName = pTarget->GetFullName();
}
-void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnField_Focus(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) {
Initial(JET_FIELD_FOCUS);
@@ -155,8 +155,8 @@ void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier,
m_pValue = (CFX_WideString*)&Value;
}
-void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnField_Blur(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) {
Initial(JET_FIELD_BLUR);
@@ -169,16 +169,16 @@ void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier,
void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown,
- FX_BOOL bModifier,
+ bool KeyDown,
+ bool bModifier,
int& nSelEnd,
int& nSelStart,
- FX_BOOL bShift,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit,
- FX_BOOL bFieldFull,
- FX_BOOL& bRc) {
+ bool bWillCommit,
+ bool bFieldFull,
+ bool& bRc) {
Initial(JET_FIELD_KEYSTROKE);
m_nCommitKey = 0;
@@ -198,12 +198,12 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange,
void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown,
- FX_BOOL bModifier,
- FX_BOOL bShift,
+ bool bKeyDown,
+ bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) {
+ bool& bRc) {
Initial(JET_FIELD_VALIDATE);
m_pWideStrChange = &strChange;
@@ -219,7 +219,7 @@ void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange,
void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) {
+ bool& bRc) {
Initial(JET_FIELD_CALCULATE);
if (pSource)
@@ -231,7 +231,7 @@ void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource,
void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit) {
+ bool bWillCommit) {
Initial(JET_FIELD_FORMAT);
m_nCommitKey = 0;
@@ -240,8 +240,8 @@ void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget,
m_bWillCommit = bWillCommit;
}
-void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_Focus(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_FOCUS);
@@ -250,8 +250,8 @@ void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_Blur(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_BLUR);
@@ -260,8 +260,8 @@ void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_Open(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_OPEN);
@@ -270,8 +270,8 @@ void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_Close(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_CLOSE);
@@ -280,8 +280,8 @@ void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_MouseDown(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_MOUSEDOWN);
@@ -290,8 +290,8 @@ void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_MouseUp(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_MOUSEUP);
@@ -300,8 +300,8 @@ void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_MouseEnter(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_MOUSEENTER);
@@ -310,8 +310,8 @@ void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_MouseExit(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_MOUSEEXIT);
@@ -320,8 +320,8 @@ void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_InView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_INVIEW);
@@ -330,8 +330,8 @@ void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier,
m_pTargetAnnot = pScreen;
}
-void CJS_EventHandler::OnScreen_OutView(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_EventHandler::OnScreen_OutView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
Initial(JET_SCREEN_OUTVIEW);
@@ -383,31 +383,31 @@ void CJS_EventHandler::Initial(JS_EVENT_T type) {
m_WideStrChangeDu = L"";
m_WideStrChangeEx = L"";
m_nCommitKey = -1;
- m_bKeyDown = FALSE;
- m_bModifier = FALSE;
- m_bShift = FALSE;
+ m_bKeyDown = false;
+ m_bModifier = false;
+ m_bShift = false;
m_pISelEnd = nullptr;
m_nSelEndDu = 0;
m_pISelStart = nullptr;
m_nSelStartDu = 0;
- m_bWillCommit = FALSE;
+ m_bWillCommit = false;
m_pValue = nullptr;
- m_bFieldFull = FALSE;
+ m_bFieldFull = false;
m_pbRc = nullptr;
- m_bRcDu = FALSE;
+ m_bRcDu = false;
m_pTargetBookMark = nullptr;
m_pTargetFormFillEnv = nullptr;
m_pTargetAnnot = nullptr;
- m_bValid = TRUE;
+ m_bValid = true;
}
void CJS_EventHandler::Destroy() {
- m_bValid = FALSE;
+ m_bValid = false;
}
-FX_BOOL CJS_EventHandler::IsValid() {
+bool CJS_EventHandler::IsValid() {
return m_bValid;
}
@@ -426,15 +426,15 @@ int CJS_EventHandler::CommitKey() {
return m_nCommitKey;
}
-FX_BOOL CJS_EventHandler::FieldFull() {
+bool CJS_EventHandler::FieldFull() {
return m_bFieldFull;
}
-FX_BOOL CJS_EventHandler::KeyDown() {
+bool CJS_EventHandler::KeyDown() {
return m_bKeyDown;
}
-FX_BOOL CJS_EventHandler::Modifier() {
+bool CJS_EventHandler::Modifier() {
return m_bModifier;
}
@@ -564,7 +564,7 @@ const FX_WCHAR* CJS_EventHandler::Type() {
}
}
-FX_BOOL& CJS_EventHandler::Rc() {
+bool& CJS_EventHandler::Rc() {
if (m_pbRc) {
return *m_pbRc;
}
@@ -585,7 +585,7 @@ int& CJS_EventHandler::SelStart() {
return m_nSelStartDu;
}
-FX_BOOL CJS_EventHandler::Shift() {
+bool CJS_EventHandler::Shift() {
return m_bShift;
}
@@ -641,7 +641,7 @@ CFX_WideString& CJS_EventHandler::Value() {
return *m_pValue;
}
-FX_BOOL CJS_EventHandler::WillCommit() {
+bool CJS_EventHandler::WillCommit() {
return m_bWillCommit;
}
diff --git a/fpdfsdk/javascript/JS_EventHandler.h b/fpdfsdk/javascript/JS_EventHandler.h
index 666ef8410d..fb0e637f5f 100644
--- a/fpdfsdk/javascript/JS_EventHandler.h
+++ b/fpdfsdk/javascript/JS_EventHandler.h
@@ -81,78 +81,54 @@ class CJS_EventHandler {
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc);
+ bool& bRc);
void OnField_Format(CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit);
+ bool bWillCommit);
void OnField_Keystroke(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown,
- FX_BOOL bModifier,
+ bool KeyDown,
+ bool bModifier,
int& nSelEnd,
int& nSelStart,
- FX_BOOL bShift,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit,
- FX_BOOL bFieldFull,
- FX_BOOL& bRc);
+ bool bWillCommit,
+ bool bFieldFull,
+ bool& bRc);
void OnField_Validate(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown,
- FX_BOOL bModifier,
- FX_BOOL bShift,
+ bool bKeyDown,
+ bool bModifier,
+ 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,
+ bool& bRc);
+
+ void OnField_MouseDown(bool bModifier, bool bShift, CPDF_FormField* pTarget);
+ void OnField_MouseEnter(bool bModifier, bool bShift, CPDF_FormField* pTarget);
+ void OnField_MouseExit(bool bModifier, bool bShift, CPDF_FormField* pTarget);
+ void OnField_MouseUp(bool bModifier, bool bShift, CPDF_FormField* pTarget);
+ void OnField_Blur(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value);
- void OnField_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_Focus(bool bModifier,
+ 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 OnScreen_Focus(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_Blur(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_Open(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_Close(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseDown(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseUp(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseEnter(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_MouseExit(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_InView(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
+ void OnScreen_OutView(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen);
void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark);
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv);
@@ -166,24 +142,24 @@ class CJS_EventHandler {
public:
void Initial(JS_EVENT_T type);
void Destroy();
- FX_BOOL IsValid();
+ bool IsValid();
CFX_WideString& Change();
CFX_WideString ChangeEx();
int CommitKey();
- FX_BOOL FieldFull();
- FX_BOOL KeyDown();
- FX_BOOL Modifier();
+ bool FieldFull();
+ bool KeyDown();
+ bool Modifier();
const FX_WCHAR* Name();
const FX_WCHAR* Type();
- FX_BOOL& Rc();
+ bool& Rc();
int& SelEnd();
int& SelStart();
- FX_BOOL Shift();
+ bool Shift();
Field* Source();
Field* Target_Field();
CFX_WideString& Value();
- FX_BOOL WillCommit();
+ bool WillCommit();
CFX_WideString TargetName();
JS_EVENT_T EventType() { return m_eEventType; }
@@ -191,7 +167,7 @@ class CJS_EventHandler {
public:
CJS_Context* m_pJSContext;
JS_EVENT_T m_eEventType;
- FX_BOOL m_bValid;
+ bool m_bValid;
CFX_WideString m_strTargetName;
CFX_WideString m_strSourceName;
@@ -199,18 +175,18 @@ class CJS_EventHandler {
CFX_WideString m_WideStrChangeDu;
CFX_WideString m_WideStrChangeEx;
int m_nCommitKey;
- FX_BOOL m_bKeyDown;
- FX_BOOL m_bModifier;
- FX_BOOL m_bShift;
+ bool m_bKeyDown;
+ bool m_bModifier;
+ bool m_bShift;
int* m_pISelEnd;
int m_nSelEndDu;
int* m_pISelStart;
int m_nSelStartDu;
- FX_BOOL m_bWillCommit;
+ bool m_bWillCommit;
CFX_WideString* m_pValue;
- FX_BOOL m_bFieldFull;
- FX_BOOL* m_pbRc;
- FX_BOOL m_bRcDu;
+ bool m_bFieldFull;
+ bool* m_pbRc;
+ bool m_bRcDu;
CPDF_Bookmark* m_pTargetBookMark;
CPDFSDK_FormFillEnvironment* m_pTargetFormFillEnv;
diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp
index 4e3782ec20..580cb466e6 100644
--- a/fpdfsdk/javascript/JS_GlobalData.cpp
+++ b/fpdfsdk/javascript/JS_GlobalData.cpp
@@ -179,32 +179,31 @@ void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) {
m_arrayGlobalData.push_back(std::move(pNewData));
}
-FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent(
- const CFX_ByteString& propname,
- FX_BOOL bPersistent) {
+bool CJS_GlobalData::SetGlobalVariablePersistent(const CFX_ByteString& propname,
+ bool bPersistent) {
CFX_ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
- return FALSE;
+ return false;
CJS_GlobalData_Element* pData = GetGlobalVariable(sPropName);
if (!pData)
- return FALSE;
+ return false;
pData->bPersistent = bPersistent;
- return TRUE;
+ return true;
}
-FX_BOOL CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) {
+bool CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) {
CFX_ByteString sPropName(propname);
if (!TrimPropName(&sPropName))
- return FALSE;
+ return false;
auto iter = FindGlobalVariable(sPropName);
if (iter == m_arrayGlobalData.end())
- return FALSE;
+ return false;
m_arrayGlobalData.erase(iter);
- return TRUE;
+ return true;
}
int32_t CJS_GlobalData::GetSize() const {
@@ -274,13 +273,13 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() {
} break;
}
SetGlobalVariableNumber(sEntry, dData);
- SetGlobalVariablePersistent(sEntry, TRUE);
+ SetGlobalVariablePersistent(sEntry, true);
} break;
case JS_GlobalDataType::BOOLEAN: {
uint16_t wData = *((uint16_t*)p);
p += sizeof(uint16_t);
SetGlobalVariableBoolean(sEntry, (bool)(wData == 1));
- SetGlobalVariablePersistent(sEntry, TRUE);
+ SetGlobalVariablePersistent(sEntry, true);
} break;
case JS_GlobalDataType::STRING: {
uint32_t dwLength = *((uint32_t*)p);
@@ -290,12 +289,12 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() {
break;
SetGlobalVariableString(sEntry, CFX_ByteString(p, dwLength));
- SetGlobalVariablePersistent(sEntry, TRUE);
+ SetGlobalVariablePersistent(sEntry, true);
p += sizeof(char) * dwLength;
} break;
case JS_GlobalDataType::NULLOBJ: {
SetGlobalVariableNull(sEntry);
- SetGlobalVariablePersistent(sEntry, TRUE);
+ SetGlobalVariablePersistent(sEntry, true);
}
case JS_GlobalDataType::OBJECT:
break;
diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h
index 7005134423..c8947cd580 100644
--- a/fpdfsdk/javascript/JS_GlobalData.h
+++ b/fpdfsdk/javascript/JS_GlobalData.h
@@ -21,7 +21,7 @@ class CJS_GlobalData_Element {
~CJS_GlobalData_Element() {}
CJS_KeyValue data;
- FX_BOOL bPersistent;
+ bool bPersistent;
};
class CJS_GlobalData {
@@ -36,9 +36,9 @@ class CJS_GlobalData {
void SetGlobalVariableObject(const CFX_ByteString& propname,
const CJS_GlobalVariableArray& array);
void SetGlobalVariableNull(const CFX_ByteString& propname);
- FX_BOOL SetGlobalVariablePersistent(const CFX_ByteString& propname,
- FX_BOOL bPersistent);
- FX_BOOL DeleteGlobalVariable(const CFX_ByteString& propname);
+ bool SetGlobalVariablePersistent(const CFX_ByteString& propname,
+ bool bPersistent);
+ bool DeleteGlobalVariable(const CFX_ByteString& propname);
int32_t GetSize() const;
CJS_GlobalData_Element* GetAt(int index) const;
diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
index e7853fba7a..1daee4d734 100644
--- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp
+++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp
@@ -16,9 +16,8 @@ class CJS_ContextStub final : public IJS_Context {
~CJS_ContextStub() override {}
// IJS_Context:
- FX_BOOL RunScript(const CFX_WideString& script,
- CFX_WideString* info) override {
- return FALSE;
+ bool RunScript(const CFX_WideString& script, CFX_WideString* info) override {
+ return false;
}
void OnApp_Init() override {}
@@ -33,82 +32,82 @@ class CJS_ContextStub final : public IJS_Context {
void OnPage_Close(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnPage_InView(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
void OnPage_OutView(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
- void OnField_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_MouseDown(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) override {}
- void OnField_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_MouseEnter(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) override {}
- void OnField_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_MouseExit(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) override {}
- void OnField_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_MouseUp(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) override {}
- void OnField_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_Focus(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) override {}
- void OnField_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_Blur(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) override {}
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) override {}
+ bool& bRc) override {}
void OnField_Format(CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit) override {}
+ bool bWillCommit) override {}
void OnField_Keystroke(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown,
- FX_BOOL bModifier,
+ bool KeyDown,
+ bool bModifier,
int& nSelEnd,
int& nSelStart,
- FX_BOOL bShift,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit,
- FX_BOOL bFieldFull,
- FX_BOOL& bRc) override {}
+ bool bWillCommit,
+ bool bFieldFull,
+ bool& bRc) override {}
void OnField_Validate(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown,
- FX_BOOL bModifier,
- FX_BOOL bShift,
+ bool bKeyDown,
+ bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) override {}
- void OnScreen_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+ bool& bRc) override {}
+ void OnScreen_Focus(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_Blur(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_Open(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_Open(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_Close(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_Close(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_MouseDown(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_MouseUp(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_MouseEnter(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_MouseExit(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_InView(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_InView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
- void OnScreen_OutView(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_OutView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override {}
void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override {}
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {}
@@ -139,12 +138,12 @@ class CJS_RuntimeStub final : public IJS_Runtime {
}
#ifdef PDF_ENABLE_XFA
- FX_BOOL GetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override {
- return FALSE;
+ bool GetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override {
+ return false;
}
- FX_BOOL SetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override {
- return FALSE;
+ bool SetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override {
+ return false;
}
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 2310200084..0173bb3ff5 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -335,8 +335,8 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
int nYearSub = 99; // nYear - 2000;
- FX_BOOL bPm = FALSE;
- FX_BOOL bExit = FALSE;
+ bool bPm = false;
+ bool bExit = false;
bool bBadFormat = false;
int i = 0;
@@ -459,13 +459,13 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
switch (c) {
case 'm': {
CFX_WideString sMonth = ParseStringString(value, j, nSkip);
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
for (int m = 0; m < 12; m++) {
if (sMonth.CompareNoCase(months[m]) == 0) {
nMonth = m + 1;
i += 3;
j += nSkip;
- bFind = TRUE;
+ bFind = true;
break;
}
}
@@ -491,7 +491,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
i += 4;
break;
case 'm': {
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
CFX_WideString sMonth = ParseStringString(value, j, nSkip);
sMonth.MakeLower();
@@ -504,7 +504,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
nMonth = m + 1;
i += 4;
j += nSkip;
- bFind = TRUE;
+ bFind = true;
break;
}
}
@@ -523,7 +523,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
} else {
if (j >= value.GetLength() || format.GetAt(i) != value.GetAt(j)) {
bBadFormat = true;
- bExit = TRUE;
+ bExit = true;
}
i++;
j++;
@@ -531,17 +531,17 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
if (oldj == j) {
bBadFormat = true;
- bExit = TRUE;
+ bExit = true;
}
}
break;
default:
if (value.GetLength() <= j) {
- bExit = TRUE;
+ bExit = true;
} else if (format.GetAt(i) != value.GetAt(j)) {
bBadFormat = true;
- bExit = TRUE;
+ bExit = true;
}
i++;
@@ -723,33 +723,33 @@ CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate,
// function AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency,
// bCurrencyPrepend)
-FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
if (params.size() != 6) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& Value = pEvent->Value();
CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
if (strValue.IsEmpty())
- return TRUE;
+ return true;
int iDec = params[0].ToInt(pRuntime);
int iSepStyle = params[1].ToInt(pRuntime);
int iNegStyle = params[2].ToInt(pRuntime);
// params[3] is iCurrStyle, it's not used.
CFX_WideString wstrCurrency = params[4].ToCFXWideString(pRuntime);
- FX_BOOL bCurrencyPrepend = params[5].ToBool(pRuntime);
+ bool bCurrencyPrepend = params[5].ToBool(pRuntime);
if (iDec < 0)
iDec = -iDec;
@@ -888,24 +888,23 @@ FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
}
}
#endif
- return TRUE;
+ return true;
}
// function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency,
// bCurrencyPrepend)
-FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFNumber_Keystroke(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (params.size() < 2)
- return FALSE;
+ return false;
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& val = pEvent->Value();
CFX_WideString& wstrChange = pEvent->Change();
@@ -914,15 +913,15 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
if (pEvent->WillCommit()) {
CFX_WideString swTemp = StrTrim(wstrValue);
if (swTemp.IsEmpty())
- return TRUE;
+ return true;
swTemp.Replace(L",", L".");
if (!IsNumber(swTemp.c_str())) {
- pEvent->Rc() = FALSE;
+ pEvent->Rc() = false;
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
AlertIfPossible(pContext, sError.c_str());
}
- return TRUE; // it happens after the last keystroke and before validating,
+ return true; // it happens after the last keystroke and before validating,
}
CFX_WideString wstrSelected;
@@ -935,9 +934,9 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
if (bHasSign) {
// can't insert "change" in front to sign postion.
if (pEvent->SelStart() == 0) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
}
@@ -951,38 +950,38 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
for (FX_STRSIZE i = 0; i < wstrChange.GetLength(); ++i) {
if (wstrChange[i] == cSep) {
if (bHasSep) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
- bHasSep = TRUE;
+ bHasSep = true;
continue;
}
if (wstrChange[i] == L'-') {
if (bHasSign) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
// sign's position is not correct
if (i != 0) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
if (pEvent->SelStart() != 0) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
- bHasSign = TRUE;
+ bHasSign = true;
continue;
}
if (!FXSYS_iswdigit(wstrChange[i])) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
}
@@ -991,15 +990,14 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
if (pEvent->SelEnd() < wstrValue.GetLength())
wpostfix = wstrValue.Mid(pEvent->SelEnd());
val = wprefix + wstrChange + wpostfix;
- return TRUE;
+ return true;
}
// function AFPercent_Format(nDec, sepStyle)
-FX_BOOL CJS_PublicMethods::AFPercent_Format(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFPercent_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1007,15 +1005,15 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format(
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& Value = pEvent->Value();
CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
if (strValue.IsEmpty())
- return TRUE;
+ return true;
int iDec = params[0].ToInt(pRuntime);
if (iDec < 0)
@@ -1085,10 +1083,10 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format(
strValue += "%";
Value = CFX_WideString::FromLocal(strValue.AsStringC());
#endif
- return TRUE;
+ return true;
}
// AFPercent_Keystroke(nDec, sepStyle)
-FX_BOOL CJS_PublicMethods::AFPercent_Keystroke(
+bool CJS_PublicMethods::AFPercent_Keystroke(
IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
@@ -1097,25 +1095,25 @@ FX_BOOL CJS_PublicMethods::AFPercent_Keystroke(
}
// function AFDate_FormatEx(cFormat)
-FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& val = pEvent->Value();
CFX_WideString strValue = val;
if (strValue.IsEmpty())
- return TRUE;
+ return true;
CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
double dDate = 0.0f;
@@ -1133,11 +1131,11 @@ FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc,
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pContext, swMsg.c_str());
- return FALSE;
+ return false;
}
val = MakeFormatDate(dDate, sFormat);
- return TRUE;
+ return true;
}
double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
@@ -1197,49 +1195,48 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
}
// AFDate_KeystrokeEx(cFormat)
-FX_BOOL CJS_PublicMethods::AFDate_KeystrokeEx(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFDate_KeystrokeEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (params.size() != 1) {
sError = L"AFDate_KeystrokeEx's parameters' size r not correct";
- return FALSE;
+ return false;
}
if (pEvent->WillCommit()) {
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString strValue = pEvent->Value();
if (strValue.IsEmpty())
- return TRUE;
+ return true;
CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
- bool bWrongFormat = FALSE;
+ bool bWrongFormat = false;
double dRet = MakeRegularDate(strValue, sFormat, &bWrongFormat);
if (bWrongFormat || JS_PortIsNan(dRet)) {
CFX_WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pContext, swMsg.c_str());
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFDate_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFDate_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1269,14 +1266,13 @@ FX_BOOL CJS_PublicMethods::AFDate_Format(IJS_Context* cc,
}
// AFDate_KeystrokeEx(cFormat)
-FX_BOOL CJS_PublicMethods::AFDate_Keystroke(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFDate_Keystroke(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1306,13 +1302,13 @@ FX_BOOL CJS_PublicMethods::AFDate_Keystroke(
}
// function AFTime_Format(ptf)
-FX_BOOL CJS_PublicMethods::AFTime_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFTime_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1329,14 +1325,13 @@ FX_BOOL CJS_PublicMethods::AFTime_Format(IJS_Context* cc,
return AFDate_FormatEx(cc, newParams, vRet, sError);
}
-FX_BOOL CJS_PublicMethods::AFTime_Keystroke(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFTime_Keystroke(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1353,36 +1348,34 @@ FX_BOOL CJS_PublicMethods::AFTime_Keystroke(
return AFDate_KeystrokeEx(cc, newParams, vRet, sError);
}
-FX_BOOL CJS_PublicMethods::AFTime_FormatEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFTime_FormatEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
return AFDate_FormatEx(cc, params, vRet, sError);
}
-FX_BOOL CJS_PublicMethods::AFTime_KeystrokeEx(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFTime_KeystrokeEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
return AFDate_KeystrokeEx(cc, params, vRet, sError);
}
// function AFSpecial_Format(psf)
-FX_BOOL CJS_PublicMethods::AFSpecial_Format(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFSpecial_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CFX_WideString wsSource = pEvent->Value();
@@ -1406,11 +1399,11 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format(
}
pEvent->Value() = util::printx(wsFormat, wsSource);
- return TRUE;
+ return true;
}
// function AFSpecial_KeystrokeEx(mask)
-FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
+bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
@@ -1421,20 +1414,20 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& valEvent = pEvent->Value();
CFX_WideString wstrMask = params[0].ToCFXWideString(pRuntime);
if (wstrMask.IsEmpty())
- return TRUE;
+ return true;
if (pEvent->WillCommit()) {
if (valEvent.IsEmpty())
- return TRUE;
+ return true;
FX_STRSIZE iIndexMask = 0;
for (; iIndexMask < valEvent.GetLength(); ++iIndexMask) {
@@ -1446,14 +1439,14 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
(iIndexMask != valEvent.GetLength() && wstrMask.GetLength() != 0)) {
AlertIfPossible(
pContext, JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE).c_str());
- pEvent->Rc() = FALSE;
+ pEvent->Rc() = false;
}
- return TRUE;
+ return true;
}
CFX_WideString& wideChange = pEvent->Change();
if (wideChange.IsEmpty())
- return TRUE;
+ return true;
CFX_WideString wChange = wideChange;
FX_STRSIZE iIndexMask = pEvent->SelStart();
@@ -1462,53 +1455,53 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
if (combined_len > wstrMask.GetLength()) {
AlertIfPossible(pContext,
JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str());
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
if (iIndexMask >= wstrMask.GetLength() && !wChange.IsEmpty()) {
AlertIfPossible(pContext,
JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str());
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
for (FX_STRSIZE i = 0; i < wChange.GetLength(); ++i) {
if (iIndexMask >= wstrMask.GetLength()) {
AlertIfPossible(pContext,
JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str());
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
FX_WCHAR wMask = wstrMask[iIndexMask];
if (!isReservedMaskChar(wMask))
wChange.SetAt(i, wMask);
if (!maskSatisfied(wChange[i], wMask)) {
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
iIndexMask++;
}
wideChange = wChange;
- return TRUE;
+ return true;
}
// function AFSpecial_Keystroke(psf)
-FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke(
+bool CJS_PublicMethods::AFSpecial_Keystroke(
IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
const char* cFormat = "";
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1535,13 +1528,13 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke(
return AFSpecial_KeystrokeEx(cc, params2, vRet, sError);
}
-FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
@@ -1554,7 +1547,7 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
if (pEventHandler->WillCommit()) {
vRet = CJS_Value(pRuntime, swValue.c_str());
- return TRUE;
+ return true;
}
CFX_WideString prefix, postfix;
@@ -1573,16 +1566,16 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
vRet =
CJS_Value(pRuntime, (prefix + pEventHandler->Change() + postfix).c_str());
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFParseDateEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1596,20 +1589,20 @@ FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc,
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible((CJS_Context*)cc, swMsg.c_str());
- return FALSE;
+ return false;
}
vRet = CJS_Value(pRuntime, dDate);
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFSimple(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 3) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1618,16 +1611,16 @@ FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc,
params[1].ToDouble(pRuntime),
params[2].ToDouble(pRuntime))));
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFMakeNumber(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1637,23 +1630,22 @@ FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc,
vRet.MaybeCoerceToNumber(pRuntime);
if (vRet.GetType() != CJS_Value::VT_number)
vRet = CJS_Value(pRuntime, 0);
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFSimple_Calculate(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFSimple_Calculate(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Value params1 = params[1];
if (!params1.IsArrayObject() && params1.GetType() != CJS_Value::VT_string) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
@@ -1734,35 +1726,34 @@ FX_BOOL CJS_PublicMethods::AFSimple_Calculate(
if (pContext->GetEventHandler()->m_pValue)
pContext->GetEventHandler()->Value() = jsValue.ToCFXWideString(pRuntime);
- return TRUE;
+ return true;
}
/* This function validates the current event to ensure that its value is
** within the specified range. */
-FX_BOOL CJS_PublicMethods::AFRange_Validate(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFRange_Validate(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 4) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
if (pEvent->Value().IsEmpty())
- return TRUE;
+ return true;
double dEentValue =
atof(CFX_ByteString::FromUnicode(pEvent->Value()).c_str());
- FX_BOOL bGreaterThan = params[0].ToBool(pRuntime);
+ bool bGreaterThan = params[0].ToBool(pRuntime);
double dGreaterThan = params[1].ToDouble(pRuntime);
- FX_BOOL bLessThan = params[2].ToBool(pRuntime);
+ bool bLessThan = params[2].ToBool(pRuntime);
double dLessThan = params[3].ToDouble(pRuntime);
CFX_WideString swMsg;
@@ -1783,18 +1774,18 @@ FX_BOOL CJS_PublicMethods::AFRange_Validate(
if (!swMsg.IsEmpty()) {
AlertIfPossible(pContext, swMsg.c_str());
- pEvent->Rc() = FALSE;
+ pEvent->Rc() = false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFExtractNums(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFExtractNums(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1828,5 +1819,5 @@ FX_BOOL CJS_PublicMethods::AFExtractNums(IJS_Context* cc,
else
vRet.SetNull(pRuntime);
- return TRUE;
+ return true;
}
diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h
index 67ca082f31..0820c40c3e 100644
--- a/fpdfsdk/javascript/PublicMethods.h
+++ b/fpdfsdk/javascript/PublicMethods.h
@@ -18,94 +18,94 @@ class CJS_PublicMethods : public CJS_Object {
: CJS_Object(pObject) {}
~CJS_PublicMethods() override {}
- static FX_BOOL AFNumber_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFNumber_Keystroke(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFPercent_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFPercent_Keystroke(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFDate_FormatEx(IJS_Context* cc,
+ static bool AFNumber_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFNumber_Keystroke(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- static FX_BOOL AFDate_KeystrokeEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFDate_Format(IJS_Context* cc,
+ static bool AFPercent_Format(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- static FX_BOOL AFDate_Keystroke(IJS_Context* cc,
+ static bool AFPercent_Keystroke(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- static FX_BOOL AFTime_FormatEx(IJS_Context* cc,
+ static bool AFDate_FormatEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFDate_KeystrokeEx(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError); //
- static FX_BOOL AFTime_KeystrokeEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFTime_Format(IJS_Context* cc,
+ CFX_WideString& sError);
+ static bool AFDate_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFDate_Keystroke(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- static FX_BOOL AFTime_Keystroke(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFSpecial_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFSpecial_Keystroke(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFSpecial_KeystrokeEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError); //
- static FX_BOOL AFSimple(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFMakeNumber(IJS_Context* cc,
+ static bool AFTime_FormatEx(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFSimple_Calculate(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFRange_Validate(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- static FX_BOOL AFMergeChange(IJS_Context* cc,
+ CFX_WideString& sError); //
+ static bool AFTime_KeystrokeEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFTime_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFTime_Keystroke(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- static FX_BOOL AFParseDateEx(IJS_Context* cc,
+ static bool AFSpecial_Format(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- static FX_BOOL AFExtractNums(IJS_Context* cc,
+ static bool AFSpecial_Keystroke(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFSpecial_KeystrokeEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError); //
+ static bool AFSimple(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFMakeNumber(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFSimple_Calculate(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFRange_Validate(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
+ static bool AFMergeChange(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFParseDateEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ static bool AFExtractNums(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
JS_STATIC_GLOBAL_FUN(AFNumber_Format);
JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke);
diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp
index 4d79e41f7a..2b40de0423 100644
--- a/fpdfsdk/javascript/app.cpp
+++ b/fpdfsdk/javascript/app.cpp
@@ -209,11 +209,11 @@ app::app(CJS_Object* pJSObject)
app::~app() {
}
-FX_BOOL app::activeDocs(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::activeDocs(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
@@ -231,126 +231,121 @@ FX_BOOL app::activeDocs(IJS_Context* cc,
else
vp.GetJSValue()->SetNull(pRuntime);
- return TRUE;
+ return true;
}
-FX_BOOL app::calculate(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::calculate(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
bool bVP;
vp >> bVP;
- m_bCalculate = (FX_BOOL)bVP;
+ m_bCalculate = (bool)bVP;
CJS_Context* pContext = (CJS_Context*)cc;
- pContext->GetFormFillEnv()
- ->GetInterForm()
- ->EnableCalculate((FX_BOOL)m_bCalculate);
+ pContext->GetFormFillEnv()->GetInterForm()->EnableCalculate(
+ (bool)m_bCalculate);
} else {
vp << (bool)m_bCalculate;
}
- return TRUE;
+ return true;
}
-FX_BOOL app::formsVersion(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::formsVersion(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsGetting()) {
vp << JS_NUM_FORMSVERSION;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL app::viewerType(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::viewerType(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsGetting()) {
vp << JS_STR_VIEWERTYPE;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL app::viewerVariation(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::viewerVariation(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsGetting()) {
vp << JS_STR_VIEWERVARIATION;
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
-FX_BOOL app::viewerVersion(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::viewerVersion(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
#ifdef PDF_ENABLE_XFA
CJS_Context* pJSContext = static_cast<CJS_Context*>(cc);
CPDFXFA_Context* pXFAContext = pJSContext->GetFormFillEnv()->GetXFAContext();
if (pXFAContext->GetDocType() == 1 || pXFAContext->GetDocType() == 2) {
vp << JS_NUM_VIEWERVERSION_XFA;
- return TRUE;
+ return true;
}
#endif // PDF_ENABLE_XFA
vp << JS_NUM_VIEWERVERSION;
- return TRUE;
+ return true;
}
-FX_BOOL app::platform(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
#ifdef PDF_ENABLE_XFA
CPDFSDK_FormFillEnvironment* pFormFillEnv =
static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetFormFillEnv();
if (!pFormFillEnv)
- return FALSE;
+ return false;
CFX_WideString platfrom = pFormFillEnv->GetPlatform();
if (!platfrom.IsEmpty()) {
vp << platfrom;
- return TRUE;
+ return true;
}
#endif
vp << JS_STR_PLATFORM;
- return TRUE;
+ return true;
}
-FX_BOOL app::language(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
#ifdef PDF_ENABLE_XFA
CPDFSDK_FormFillEnvironment* pFormFillEnv =
static_cast<CJS_Context*>(cc)->GetJSRuntime()->GetFormFillEnv();
if (!pFormFillEnv)
- return FALSE;
+ return false;
CFX_WideString language = pFormFillEnv->GetLanguage();
if (!language.IsEmpty()) {
vp << language;
- return TRUE;
+ return true;
}
#endif
vp << JS_STR_LANGUAGE;
- return TRUE;
+ return true;
}
// creates a new fdf object that contains no data
// comment: need reader support
// note:
// CFDF_Document * CPDFSDK_FormFillEnvironment::NewFDF();
-FX_BOOL app::newFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool app::newFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
// opens a specified pdf document and returns its document object
// comment:need reader support
@@ -359,30 +354,30 @@ FX_BOOL app::newFDF(IJS_Context* cc,
// CFDF_Document * CPDFSDK_FormFillEnvironment::OpenFDF(string strPath,bool
// bUserConv);
-FX_BOOL app::openFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool app::openFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL app::alert(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::alert(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
std::vector<CJS_Value> newParams = JS_ExpandKeywordParams(
pRuntime, params, 4, L"cMsg", L"nIcon", L"nType", L"cTitle");
if (newParams[0].GetType() == CJS_Value::VT_unknown) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv();
if (!pFormFillEnv) {
vRet = CJS_Value(pRuntime, 0);
- return TRUE;
+ return true;
}
CFX_WideString swMsg;
@@ -425,48 +420,48 @@ FX_BOOL app::alert(IJS_Context* cc,
vRet = CJS_Value(pRuntime, pFormFillEnv->JS_appAlert(
swMsg.c_str(), swTitle.c_str(), iType, iIcon));
pRuntime->EndBlock();
- return TRUE;
+ return true;
}
-FX_BOOL app::beep(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::beep(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() == 1) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
pRuntime->GetFormFillEnv()->JS_appBeep(params[0].ToInt(pRuntime));
- return TRUE;
+ return true;
}
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
-FX_BOOL app::findComponent(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool app::findComponent(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL app::popUpMenuEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool app::popUpMenuEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL app::fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
- return FALSE;
+bool app::fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
+ return false;
}
-FX_BOOL app::setInterval(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::setInterval(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() > 2 || params.size() == 0) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -474,7 +469,7 @@ FX_BOOL app::setInterval(IJS_Context* cc,
params.size() > 0 ? params[0].ToCFXWideString(pRuntime) : L"";
if (script.IsEmpty()) {
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
- return TRUE;
+ return true;
}
uint32_t dwInterval = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000;
@@ -491,23 +486,23 @@ FX_BOOL app::setInterval(IJS_Context* cc,
pTimerObj->SetTimer(timerRef);
vRet = CJS_Value(pRuntime, pRetObj);
- return TRUE;
+ return true;
}
-FX_BOOL app::setTimeOut(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::setTimeOut(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() > 2 || params.size() == 0) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CFX_WideString script = params[0].ToCFXWideString(pRuntime);
if (script.IsEmpty()) {
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
- return TRUE;
+ return true;
}
uint32_t dwTimeOut = params.size() > 1 ? params[1].ToInt(pRuntime) : 1000;
@@ -526,33 +521,33 @@ FX_BOOL app::setTimeOut(IJS_Context* cc,
pTimerObj->SetTimer(timerRef);
vRet = CJS_Value(pRuntime, pRetObj);
- return TRUE;
+ return true;
}
-FX_BOOL app::clearTimeOut(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::clearTimeOut(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
app::ClearTimerCommon(CJS_Runtime::FromContext(cc), params[0]);
- return TRUE;
+ return true;
}
-FX_BOOL app::clearInterval(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::clearInterval(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
app::ClearTimerCommon(CJS_Runtime::FromContext(cc), params[0]);
- return TRUE;
+ return true;
}
void app::ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param) {
@@ -574,11 +569,11 @@ void app::ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param) {
GlobalTimer::Cancel(pTimerObj->GetTimerID());
}
-FX_BOOL app::execMenuItem(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool app::execMenuItem(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
void app::TimerProc(GlobalTimer* pTimer) {
@@ -601,26 +596,26 @@ void app::RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript) {
}
}
-FX_BOOL app::goBack(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::goBack(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Not supported.
- return TRUE;
+ return true;
}
-FX_BOOL app::goForward(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::goForward(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Not supported.
- return TRUE;
+ return true;
}
-FX_BOOL app::mailMsg(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::mailMsg(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
std::vector<CJS_Value> newParams =
JS_ExpandKeywordParams(pRuntime, params, 6, L"bUI", L"cTo", L"cCc",
@@ -628,7 +623,7 @@ FX_BOOL app::mailMsg(IJS_Context* cc,
if (newParams[0].GetType() == CJS_Value::VT_unknown) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
bool bUI = newParams[0].ToBool(pRuntime);
@@ -639,7 +634,7 @@ FX_BOOL app::mailMsg(IJS_Context* cc,
if (!bUI) {
// cTo parameter required when UI not invoked.
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
}
@@ -665,47 +660,47 @@ FX_BOOL app::mailMsg(IJS_Context* cc,
cSubject.c_str(), cCc.c_str(),
cBcc.c_str(), cMsg.c_str());
pRuntime->EndBlock();
- return TRUE;
+ return true;
}
-FX_BOOL app::launchURL(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::launchURL(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL app::runtimeHighlight(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool app::runtimeHighlight(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (vp.IsSetting()) {
vp >> m_bRuntimeHighLight;
} else {
vp << m_bRuntimeHighLight;
}
- return TRUE;
+ return true;
}
-FX_BOOL app::fullscreen(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return FALSE;
+bool app::fullscreen(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL app::popUpMenu(IJS_Context* cc,
+bool app::popUpMenu(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
+}
+
+bool app::browseForDoc(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- return FALSE;
-}
-
-FX_BOOL app::browseForDoc(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) {
@@ -726,24 +721,24 @@ CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) {
return sRet;
}
-FX_BOOL app::newDoc(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool app::newDoc(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL app::openDoc(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return FALSE;
+bool app::openDoc(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return false;
}
-FX_BOOL app::response(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool app::response(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
std::vector<CJS_Value> newParams =
JS_ExpandKeywordParams(pRuntime, params, 5, L"cQuestion", L"cTitle",
@@ -751,7 +746,7 @@ FX_BOOL app::response(IJS_Context* cc,
if (newParams[0].GetType() == CJS_Value::VT_unknown) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CFX_WideString swQuestion = newParams[0].ToCFXWideString(pRuntime);
@@ -782,7 +777,7 @@ FX_BOOL app::response(IJS_Context* cc,
if (nLengthBytes < 0 || nLengthBytes > MAX_INPUT_BYTES) {
sError = JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG);
- return FALSE;
+ return false;
}
vRet = CJS_Value(pRuntime, CFX_WideString::FromUTF16LE(
@@ -790,16 +785,16 @@ FX_BOOL app::response(IJS_Context* cc,
nLengthBytes / sizeof(uint16_t))
.c_str());
- return TRUE;
+ return true;
}
-FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
- return FALSE;
+bool app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
+ return false;
}
-FX_BOOL app::execDialog(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool app::execDialog(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h
index 1efd34168c..32e2aaf28c 100644
--- a/fpdfsdk/javascript/app.h
+++ b/fpdfsdk/javascript/app.h
@@ -41,117 +41,109 @@ class app : public CJS_EmbedObj {
app(CJS_Object* pJSObject);
~app() override;
- FX_BOOL activeDocs(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL formsVersion(IJS_Context* cc,
+ bool activeDocs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool formsVersion(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool fullscreen(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool runtimeHighlight(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ bool viewerType(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool viewerVariation(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fullscreen(IJS_Context* cc,
+ bool viewerVersion(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError);
- FX_BOOL language(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL platform(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL runtimeHighlight(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL viewerType(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL viewerVariation(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL viewerVersion(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL alert(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL beep(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL browseForDoc(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL clearInterval(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL clearTimeOut(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL execDialog(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL execMenuItem(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL findComponent(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL goBack(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL goForward(IJS_Context* cc,
+ bool alert(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool beep(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool browseForDoc(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL launchURL(IJS_Context* cc,
+ bool clearInterval(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool clearTimeOut(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL mailMsg(IJS_Context* cc,
+ bool execDialog(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL newFDF(IJS_Context* cc,
+ bool execMenuItem(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool findComponent(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool goBack(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool goForward(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL newDoc(IJS_Context* cc,
+ bool launchURL(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL openDoc(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL openFDF(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL popUpMenuEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL popUpMenu(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL response(IJS_Context* cc,
+ bool mailMsg(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool newFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool newDoc(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool openDoc(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool openFDF(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool popUpMenuEx(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL setInterval(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL setTimeOut(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
+ bool popUpMenu(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool response(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool setInterval(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool setTimeOut(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
void TimerProc(GlobalTimer* pTimer);
void CancelProc(GlobalTimer* pTimer);
diff --git a/fpdfsdk/javascript/cjs_context.cpp b/fpdfsdk/javascript/cjs_context.cpp
index 0a34b353b5..e356bdd904 100644
--- a/fpdfsdk/javascript/cjs_context.cpp
+++ b/fpdfsdk/javascript/cjs_context.cpp
@@ -13,7 +13,7 @@
CJS_Context::CJS_Context(CJS_Runtime* pRuntime)
: m_pRuntime(pRuntime),
m_pEventHandler(new CJS_EventHandler(this)),
- m_bBusy(FALSE) {}
+ m_bBusy(false) {}
CJS_Context::~CJS_Context() {}
@@ -21,8 +21,8 @@ CPDFSDK_FormFillEnvironment* CJS_Context::GetFormFillEnv() {
return m_pRuntime->GetFormFillEnv();
}
-FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
- CFX_WideString* info) {
+bool CJS_Context::RunScript(const CFX_WideString& script,
+ CFX_WideString* info) {
v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate());
v8::HandleScope handle_scope(m_pRuntime->GetIsolate());
v8::Local<v8::Context> context = m_pRuntime->NewLocalContext();
@@ -30,16 +30,16 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
if (m_bBusy) {
*info = JSGetStringFromID(IDS_STRING_JSBUSY);
- return FALSE;
+ return false;
}
- m_bBusy = TRUE;
+ m_bBusy = true;
ASSERT(m_pEventHandler->IsValid());
CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(),
m_pEventHandler->EventType());
if (!m_pRuntime->AddEventToSet(event)) {
*info = JSGetStringFromID(IDS_STRING_JSEVENT);
- return FALSE;
+ return false;
}
CFX_WideString sErrorMessage;
@@ -56,7 +56,7 @@ FX_BOOL CJS_Context::RunScript(const CFX_WideString& script,
m_pRuntime->RemoveEventFromSet(event);
m_pEventHandler->Destroy();
- m_bBusy = FALSE;
+ m_bBusy = false;
return nRet >= 0;
}
@@ -106,39 +106,39 @@ void CJS_Context::OnPage_OutView(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
m_pEventHandler->OnPage_OutView(pFormFillEnv);
}
-void CJS_Context::OnField_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnField_MouseDown(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) {
m_pEventHandler->OnField_MouseDown(bModifier, bShift, pTarget);
}
-void CJS_Context::OnField_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnField_MouseEnter(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) {
m_pEventHandler->OnField_MouseEnter(bModifier, bShift, pTarget);
}
-void CJS_Context::OnField_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnField_MouseExit(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) {
m_pEventHandler->OnField_MouseExit(bModifier, bShift, pTarget);
}
-void CJS_Context::OnField_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnField_MouseUp(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) {
m_pEventHandler->OnField_MouseUp(bModifier, bShift, pTarget);
}
-void CJS_Context::OnField_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnField_Focus(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) {
m_pEventHandler->OnField_Focus(bModifier, bShift, pTarget, Value);
}
-void CJS_Context::OnField_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnField_Blur(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) {
m_pEventHandler->OnField_Blur(bModifier, bShift, pTarget, Value);
@@ -147,28 +147,28 @@ void CJS_Context::OnField_Blur(FX_BOOL bModifier,
void CJS_Context::OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) {
+ bool& bRc) {
m_pEventHandler->OnField_Calculate(pSource, pTarget, Value, bRc);
}
void CJS_Context::OnField_Format(CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit) {
+ bool bWillCommit) {
m_pEventHandler->OnField_Format(pTarget, Value, bWillCommit);
}
void CJS_Context::OnField_Keystroke(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown,
- FX_BOOL bModifier,
+ bool bKeyDown,
+ bool bModifier,
int& nSelEnd,
int& nSelStart,
- FX_BOOL bShift,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit,
- FX_BOOL bFieldFull,
- FX_BOOL& bRc) {
+ bool bWillCommit,
+ bool bFieldFull,
+ bool& bRc) {
m_pEventHandler->OnField_Keystroke(
strChange, strChangeEx, bKeyDown, bModifier, nSelEnd, nSelStart, bShift,
pTarget, Value, bWillCommit, bFieldFull, bRc);
@@ -176,72 +176,72 @@ void CJS_Context::OnField_Keystroke(CFX_WideString& strChange,
void CJS_Context::OnField_Validate(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown,
- FX_BOOL bModifier,
- FX_BOOL bShift,
+ bool bKeyDown,
+ bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) {
+ bool& bRc) {
m_pEventHandler->OnField_Validate(strChange, strChangeEx, bKeyDown, bModifier,
bShift, pTarget, Value, bRc);
}
-void CJS_Context::OnScreen_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_Focus(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_Focus(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_Blur(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_Blur(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_Open(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_Open(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_Open(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_Close(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_Close(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_Close(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_MouseDown(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_MouseDown(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_MouseUp(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_MouseUp(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_MouseEnter(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_MouseEnter(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_MouseExit(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_MouseExit(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_InView(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_InView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_InView(bModifier, bShift, pScreen);
}
-void CJS_Context::OnScreen_OutView(FX_BOOL bModifier,
- FX_BOOL bShift,
+void CJS_Context::OnScreen_OutView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) {
m_pEventHandler->OnScreen_OutView(bModifier, bShift, pScreen);
}
diff --git a/fpdfsdk/javascript/cjs_context.h b/fpdfsdk/javascript/cjs_context.h
index b845f8b3d3..95a63ada62 100644
--- a/fpdfsdk/javascript/cjs_context.h
+++ b/fpdfsdk/javascript/cjs_context.h
@@ -23,8 +23,7 @@ class CJS_Context : public IJS_Context {
~CJS_Context() override;
// IJS_Context
- FX_BOOL RunScript(const CFX_WideString& script,
- CFX_WideString* info) override;
+ bool RunScript(const CFX_WideString& script, CFX_WideString* info) override;
void OnApp_Init() override;
void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv,
const CFX_WideString& strTargetName) override;
@@ -37,82 +36,82 @@ class CJS_Context : public IJS_Context {
void OnPage_Close(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnPage_InView(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
void OnPage_OutView(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
- void OnField_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_MouseDown(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) override;
- void OnField_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_MouseEnter(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) override;
- void OnField_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_MouseExit(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) override;
- void OnField_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_MouseUp(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) override;
- void OnField_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_Focus(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) override;
- void OnField_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnField_Blur(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) override;
void OnField_Calculate(CPDF_FormField* pSource,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) override;
+ bool& bRc) override;
void OnField_Format(CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit) override;
+ bool bWillCommit) override;
void OnField_Keystroke(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown,
- FX_BOOL bModifier,
+ bool bKeyDown,
+ bool bModifier,
int& nSelEnd,
int& nSelStart,
- FX_BOOL bShift,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit,
- FX_BOOL bFieldFull,
- FX_BOOL& bRc) override;
+ bool bWillCommit,
+ bool bFieldFull,
+ bool& bRc) override;
void OnField_Validate(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown,
- FX_BOOL bModifier,
- FX_BOOL bShift,
+ bool bKeyDown,
+ bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) override;
- void OnScreen_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+ bool& bRc) override;
+ void OnScreen_Focus(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_Blur(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_Open(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_Open(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_Close(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_Close(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_MouseDown(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_MouseUp(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_MouseEnter(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_MouseExit(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_InView(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_InView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
- void OnScreen_OutView(FX_BOOL bModifier,
- FX_BOOL bShift,
+ void OnScreen_OutView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) override;
void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override;
void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override;
@@ -130,7 +129,7 @@ class CJS_Context : public IJS_Context {
private:
CJS_Runtime* const m_pRuntime;
std::unique_ptr<CJS_EventHandler> m_pEventHandler;
- FX_BOOL m_bBusy;
+ bool m_bBusy;
};
#endif // FPDFSDK_JAVASCRIPT_CJS_CONTEXT_H_
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index ca1c1126ca..f55a59cee6 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -225,8 +225,8 @@ CFX_WideString ChangeObjName(const CFX_WideString& str) {
sRet.Replace(L"_", L".");
return sRet;
}
-FX_BOOL CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
- CFXJSE_Value* pValue) {
+bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
+ CFXJSE_Value* pValue) {
const FX_CHAR* name = utf8Name.c_str();
v8::Isolate::Scope isolate_scope(GetIsolate());
@@ -240,15 +240,15 @@ FX_BOOL CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name,
if (propvalue.IsEmpty()) {
pValue->SetUndefined();
- return FALSE;
+ return false;
}
pValue->ForceSetValue(propvalue);
- return TRUE;
+ return true;
}
-FX_BOOL CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name,
- CFXJSE_Value* pValue) {
+bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name,
+ CFXJSE_Value* pValue) {
if (utf8Name.IsEmpty() || !pValue)
- return FALSE;
+ return false;
const FX_CHAR* name = utf8Name.c_str();
v8::Isolate* pIsolate = GetIsolate();
v8::Isolate::Scope isolate_scope(pIsolate);
@@ -264,6 +264,6 @@ FX_BOOL CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name,
v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString,
utf8Name.GetLength()),
propvalue);
- return TRUE;
+ return true;
}
#endif
diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h
index 1b004ded89..66f08772e1 100644
--- a/fpdfsdk/javascript/cjs_runtime.h
+++ b/fpdfsdk/javascript/cjs_runtime.h
@@ -47,15 +47,15 @@ class CJS_Runtime : public IJS_Runtime,
bool AddEventToSet(const FieldEvent& event);
void RemoveEventFromSet(const FieldEvent& event);
- void BeginBlock() { m_bBlocking = TRUE; }
- void EndBlock() { m_bBlocking = FALSE; }
- FX_BOOL IsBlocking() const { return m_bBlocking; }
+ void BeginBlock() { m_bBlocking = true; }
+ void EndBlock() { m_bBlocking = false; }
+ bool IsBlocking() const { return m_bBlocking; }
#ifdef PDF_ENABLE_XFA
- FX_BOOL GetValueByName(const CFX_ByteStringC& utf8Name,
- CFXJSE_Value* pValue) override;
- FX_BOOL SetValueByName(const CFX_ByteStringC& utf8Name,
- CFXJSE_Value* pValue) override;
+ bool GetValueByName(const CFX_ByteStringC& utf8Name,
+ CFXJSE_Value* pValue) override;
+ bool SetValueByName(const CFX_ByteStringC& utf8Name,
+ CFXJSE_Value* pValue) override;
#endif // PDF_ENABLE_XFA
private:
diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp
index f77d5481dd..882a9035e8 100644
--- a/fpdfsdk/javascript/color.cpp
+++ b/fpdfsdk/javascript/color.cpp
@@ -134,8 +134,8 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
}
#define JS_IMPLEMENT_COLORPROP(prop, var) \
- FX_BOOL color::prop(IJS_Context* cc, CJS_PropValue& vp, \
- CFX_WideString& sError) { \
+ bool color::prop(IJS_Context* cc, CJS_PropValue& vp, \
+ CFX_WideString& sError) { \
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc); \
CJS_Array array; \
if (vp.IsGetting()) { \
@@ -143,10 +143,10 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime,
vp << array; \
} else { \
if (!vp.GetJSValue()->ConvertToArray(pRuntime, array)) \
- return FALSE; \
+ return false; \
ConvertArrayToPWLColor(pRuntime, array, &var); \
} \
- return TRUE; \
+ return true; \
}
JS_IMPLEMENT_COLORPROP(transparent, m_crTransparent)
@@ -162,18 +162,18 @@ JS_IMPLEMENT_COLORPROP(dkGray, m_crDKGray)
JS_IMPLEMENT_COLORPROP(gray, m_crGray)
JS_IMPLEMENT_COLORPROP(ltGray, m_crLTGray)
-FX_BOOL color::convert(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool color::convert(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
int iSize = params.size();
if (iSize < 2)
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Array aSource;
if (!params[0].ConvertToArray(pRuntime, aSource))
- return FALSE;
+ return false;
CPWL_Color crSource;
ConvertArrayToPWLColor(pRuntime, aSource, &crSource);
@@ -197,23 +197,23 @@ FX_BOOL color::convert(IJS_Context* cc,
ConvertPWLColorToArray(pRuntime, crDest, &aDest);
vRet = CJS_Value(pRuntime, aDest);
- return TRUE;
+ return true;
}
-FX_BOOL color::equal(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool color::equal(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() < 2)
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Array array1;
CJS_Array array2;
if (!params[0].ConvertToArray(pRuntime, array1))
- return FALSE;
+ return false;
if (!params[1].ConvertToArray(pRuntime, array2))
- return FALSE;
+ return false;
CPWL_Color color1;
CPWL_Color color2;
@@ -221,5 +221,5 @@ FX_BOOL color::equal(IJS_Context* cc,
ConvertArrayToPWLColor(pRuntime, array2, &color2);
color1.ConvertColorType(color2.nColorType);
vRet = CJS_Value(pRuntime, color1 == color2);
- return TRUE;
+ return true;
}
diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h
index 5c8c99feb6..ab56cac0b6 100644
--- a/fpdfsdk/javascript/color.h
+++ b/fpdfsdk/javascript/color.h
@@ -17,29 +17,27 @@ class color : public CJS_EmbedObj {
color(CJS_Object* pJSObject);
~color() override;
- FX_BOOL black(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL blue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL cyan(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL dkGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL gray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL green(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL ltGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL magenta(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL red(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL transparent(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL white(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL yellow(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool black(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool blue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool cyan(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool dkGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool gray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool green(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool ltGray(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool magenta(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool red(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool transparent(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool white(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool yellow(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL convert(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL equal(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
+ bool convert(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool equal(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
static void ConvertPWLColorToArray(CJS_Runtime* pRuntime,
const CPWL_Color& color,
diff --git a/fpdfsdk/javascript/console.cpp b/fpdfsdk/javascript/console.cpp
index a09fe4db17..0a8c1e05b0 100644
--- a/fpdfsdk/javascript/console.cpp
+++ b/fpdfsdk/javascript/console.cpp
@@ -33,33 +33,33 @@ console::console(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
console::~console() {}
-FX_BOOL console::clear(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool console::clear(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL console::hide(IJS_Context* cc,
+bool console::hide(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
+}
+
+bool console::println(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- return TRUE;
-}
-
-FX_BOOL console::println(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
if (params.size() < 1) {
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
-FX_BOOL console::show(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
- return TRUE;
+bool console::show(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
+ return true;
}
diff --git a/fpdfsdk/javascript/console.h b/fpdfsdk/javascript/console.h
index 589dbc8914..4f18980206 100644
--- a/fpdfsdk/javascript/console.h
+++ b/fpdfsdk/javascript/console.h
@@ -17,22 +17,22 @@ class console : public CJS_EmbedObj {
~console() override;
public:
- FX_BOOL clear(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL hide(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL println(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL show(IJS_Context* cc,
+ bool clear(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool hide(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool println(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError);
+ bool show(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
};
class CJS_Console : public CJS_Object {
diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp
index 880247f249..b4fb951772 100644
--- a/fpdfsdk/javascript/event.cpp
+++ b/fpdfsdk/javascript/event.cpp
@@ -48,9 +48,7 @@ event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {}
event::~event() {}
-FX_BOOL event::change(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::change(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
CFX_WideString& wChange = pEvent->Change();
@@ -60,136 +58,132 @@ FX_BOOL event::change(IJS_Context* cc,
} else {
vp << wChange;
}
- return TRUE;
+ return true;
}
-FX_BOOL event::changeEx(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::changeEx(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
vp << pEvent->ChangeEx();
- return TRUE;
+ return true;
}
-FX_BOOL event::commitKey(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::commitKey(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
vp << pEvent->CommitKey();
- return TRUE;
+ return true;
}
-FX_BOOL event::fieldFull(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::fieldFull(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!vp.IsGetting() &&
wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
- return FALSE;
+ return false;
if (pEvent->FieldFull())
- vp << TRUE;
+ vp << true;
else
- vp << FALSE;
- return TRUE;
+ vp << false;
+ return true;
}
-FX_BOOL event::keyDown(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::keyDown(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (pEvent->KeyDown())
- vp << TRUE;
+ vp << true;
else
- vp << FALSE;
- return TRUE;
+ vp << false;
+ return true;
}
-FX_BOOL event::modifier(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::modifier(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (pEvent->Modifier())
- vp << TRUE;
+ vp << true;
else
- vp << FALSE;
- return TRUE;
+ vp << false;
+ return true;
}
-FX_BOOL event::name(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
vp << pEvent->Name();
- return TRUE;
+ return true;
}
-FX_BOOL event::rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
+bool event::rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- FX_BOOL& bRc = pEvent->Rc();
+ bool& bRc = pEvent->Rc();
if (vp.IsSetting()) {
vp >> bRc;
} else {
vp << bRc;
}
- return TRUE;
-}
-
-FX_BOOL event::richChange(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+ return true;
}
-FX_BOOL event::richChangeEx(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
- return TRUE;
+bool event::richChange(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
+ return true;
}
-FX_BOOL event::richValue(IJS_Context* cc,
+bool event::richChangeEx(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- return TRUE;
+ return true;
}
-FX_BOOL event::selEnd(IJS_Context* cc,
+bool event::richValue(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
+ return true;
+}
+
+bool event::selEnd(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) {
- return TRUE;
+ return true;
}
int& iSelEnd = pEvent->SelEnd();
@@ -198,17 +192,17 @@ FX_BOOL event::selEnd(IJS_Context* cc,
} else {
vp << iSelEnd;
}
- return TRUE;
+ return true;
}
-FX_BOOL event::selStart(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::selStart(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) {
- return TRUE;
+ return true;
}
int& iSelStart = pEvent->SelStart();
if (vp.IsSetting()) {
@@ -216,108 +210,98 @@ FX_BOOL event::selStart(IJS_Context* cc,
} else {
vp << iSelStart;
}
- return TRUE;
+ return true;
}
-FX_BOOL event::shift(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::shift(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (pEvent->Shift())
- vp << TRUE;
+ vp << true;
else
- vp << FALSE;
- return TRUE;
+ vp << false;
+ return true;
}
-FX_BOOL event::source(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
vp << pEvent->Source()->GetJSObject();
- return TRUE;
+ return true;
}
-FX_BOOL event::target(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::target(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
vp << pEvent->Target_Field()->GetJSObject();
- return TRUE;
+ return true;
}
-FX_BOOL event::targetName(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::targetName(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
vp << pEvent->TargetName();
- return TRUE;
+ return true;
}
-FX_BOOL event::type(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
vp << pEvent->Type();
- return TRUE;
+ return true;
}
-FX_BOOL event::value(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0)
- return FALSE;
+ return false;
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& val = pEvent->Value();
if (vp.IsSetting()) {
vp >> val;
} else {
vp << val;
}
- return TRUE;
+ return true;
}
-FX_BOOL event::willCommit(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool event::willCommit(IJS_Context* cc,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
if (!vp.IsGetting())
- return FALSE;
+ return false;
CJS_Context* pContext = (CJS_Context*)cc;
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (pEvent->WillCommit())
- vp << TRUE;
+ vp << true;
else
- vp << FALSE;
- return TRUE;
+ vp << false;
+ return true;
}
diff --git a/fpdfsdk/javascript/event.h b/fpdfsdk/javascript/event.h
index 57b3416bf9..d70b57801e 100644
--- a/fpdfsdk/javascript/event.h
+++ b/fpdfsdk/javascript/event.h
@@ -15,34 +15,26 @@ class event : public CJS_EmbedObj {
~event() override;
public:
- FX_BOOL change(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL changeEx(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL commitKey(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL fieldFull(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL keyDown(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL modifier(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL richChange(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL richChangeEx(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL selEnd(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL selStart(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL shift(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL target(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL targetName(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
- FX_BOOL type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
- FX_BOOL willCommit(IJS_Context* cc,
- CJS_PropValue& vp,
- CFX_WideString& sError);
+ bool change(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool changeEx(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool commitKey(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool fieldFull(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool keyDown(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool modifier(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool richChange(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool richChangeEx(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool richValue(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool selEnd(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool selStart(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool shift(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool source(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool target(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool targetName(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool type(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool value(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
+ bool willCommit(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError);
};
class CJS_Event : public CJS_Object {
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index eb7d2cac19..c2d3586874 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -39,10 +39,10 @@ void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) {
JSGlobalData::JSGlobalData()
: nType(JS_GlobalDataType::NUMBER),
dData(0),
- bData(FALSE),
+ bData(false),
sData(""),
- bPersistent(FALSE),
- bDeleted(FALSE) {}
+ bPersistent(false),
+ bDeleted(false) {}
JSGlobalData::~JSGlobalData() {
pData.Reset();
@@ -62,25 +62,25 @@ void JSGlobalAlternate::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) {
UpdateGlobalPersistentVariables();
}
-FX_BOOL JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) {
+bool JSGlobalAlternate::QueryProperty(const FX_WCHAR* propname) {
return CFX_WideString(propname) != L"setPersistent";
}
-FX_BOOL JSGlobalAlternate::DelProperty(IJS_Context* cc,
- const FX_WCHAR* propname,
- CFX_WideString& sError) {
+bool JSGlobalAlternate::DelProperty(IJS_Context* cc,
+ const FX_WCHAR* propname,
+ CFX_WideString& sError) {
auto it = m_mapGlobal.find(CFX_ByteString::FromUnicode(propname));
if (it == m_mapGlobal.end())
- return FALSE;
+ return false;
- it->second->bDeleted = TRUE;
- return TRUE;
+ it->second->bDeleted = true;
+ return true;
}
-FX_BOOL JSGlobalAlternate::DoProperty(IJS_Context* cc,
- const FX_WCHAR* propname,
- CJS_PropValue& vp,
- CFX_WideString& sError) {
+bool JSGlobalAlternate::DoProperty(IJS_Context* cc,
+ const FX_WCHAR* propname,
+ CJS_PropValue& vp,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
if (vp.IsSetting()) {
CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname);
@@ -89,33 +89,33 @@ FX_BOOL JSGlobalAlternate::DoProperty(IJS_Context* cc,
double dData;
vp >> dData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::NUMBER, dData,
- false, "", v8::Local<v8::Object>(), FALSE);
+ false, "", v8::Local<v8::Object>(), false);
}
case CJS_Value::VT_boolean: {
bool bData;
vp >> bData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::BOOLEAN, 0,
- bData, "", v8::Local<v8::Object>(), FALSE);
+ bData, "", v8::Local<v8::Object>(), false);
}
case CJS_Value::VT_string: {
CFX_ByteString sData;
vp >> sData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0,
- false, sData, v8::Local<v8::Object>(), FALSE);
+ false, sData, v8::Local<v8::Object>(), false);
}
case CJS_Value::VT_object: {
v8::Local<v8::Object> pData;
vp >> pData;
return SetGlobalVariables(sPropName, JS_GlobalDataType::OBJECT, 0,
- false, "", pData, FALSE);
+ false, "", pData, false);
}
case CJS_Value::VT_null: {
return SetGlobalVariables(sPropName, JS_GlobalDataType::NULLOBJ, 0,
- false, "", v8::Local<v8::Object>(), FALSE);
+ false, "", v8::Local<v8::Object>(), false);
}
case CJS_Value::VT_undefined: {
DelProperty(cc, propname, sError);
- return TRUE;
+ return true;
}
default:
break;
@@ -124,46 +124,46 @@ FX_BOOL JSGlobalAlternate::DoProperty(IJS_Context* cc,
auto it = m_mapGlobal.find(CFX_ByteString::FromUnicode(propname));
if (it == m_mapGlobal.end()) {
vp.GetJSValue()->SetNull(pRuntime);
- return TRUE;
+ return true;
}
JSGlobalData* pData = it->second;
if (pData->bDeleted) {
vp.GetJSValue()->SetNull(pRuntime);
- return TRUE;
+ return true;
}
switch (pData->nType) {
case JS_GlobalDataType::NUMBER:
vp << pData->dData;
- return TRUE;
+ return true;
case JS_GlobalDataType::BOOLEAN:
vp << pData->bData;
- return TRUE;
+ return true;
case JS_GlobalDataType::STRING:
vp << pData->sData;
- return TRUE;
+ return true;
case JS_GlobalDataType::OBJECT: {
v8::Local<v8::Object> obj = v8::Local<v8::Object>::New(
vp.GetJSRuntime()->GetIsolate(), pData->pData);
vp << obj;
- return TRUE;
+ return true;
}
case JS_GlobalDataType::NULLOBJ:
vp.GetJSValue()->SetNull(pRuntime);
- return TRUE;
+ return true;
default:
break;
}
}
- return FALSE;
+ return false;
}
-FX_BOOL JSGlobalAlternate::setPersistent(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool JSGlobalAlternate::setPersistent(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -172,12 +172,12 @@ FX_BOOL JSGlobalAlternate::setPersistent(IJS_Context* cc,
JSGlobalData* pData = it->second;
if (!pData->bDeleted) {
pData->bPersistent = params[1].ToBool(pRuntime);
- return TRUE;
+ return true;
}
}
sError = JSGetStringFromID(IDS_STRING_JSNOGLOBAL);
- return FALSE;
+ return false;
}
void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
@@ -359,15 +359,15 @@ void JSGlobalAlternate::DestroyGlobalPersisitentVariables() {
m_mapGlobal.clear();
}
-FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname,
- JS_GlobalDataType nType,
- double dData,
- bool bData,
- const CFX_ByteString& sData,
- v8::Local<v8::Object> pData,
- bool bDefaultPersistent) {
+bool JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname,
+ JS_GlobalDataType nType,
+ double dData,
+ bool bData,
+ const CFX_ByteString& sData,
+ v8::Local<v8::Object> pData,
+ bool bDefaultPersistent) {
if (propname.IsEmpty())
- return FALSE;
+ return false;
auto it = m_mapGlobal.find(propname);
if (it != m_mapGlobal.end()) {
@@ -379,7 +379,7 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname,
pTemp->nType = nType;
}
- pTemp->bDeleted = FALSE;
+ pTemp->bDeleted = false;
switch (nType) {
case JS_GlobalDataType::NUMBER: {
pTemp->dData = dData;
@@ -396,9 +396,9 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname,
case JS_GlobalDataType::NULLOBJ:
break;
default:
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
}
JSGlobalData* pNewData = nullptr;
@@ -434,9 +434,9 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname,
pNewData->bPersistent = bDefaultPersistent;
} break;
default:
- return FALSE;
+ return false;
}
m_mapGlobal[propname] = pNewData;
- return TRUE;
+ return true;
}
diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h
index d5288e38b1..c0eb4447f4 100644
--- a/fpdfsdk/javascript/global.h
+++ b/fpdfsdk/javascript/global.h
@@ -35,31 +35,31 @@ class JSGlobalAlternate : public CJS_EmbedObj {
JSGlobalAlternate(CJS_Object* pJSObject);
~JSGlobalAlternate() override;
- FX_BOOL setPersistent(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL QueryProperty(const FX_WCHAR* propname);
- FX_BOOL DoProperty(IJS_Context* cc,
- const FX_WCHAR* propname,
- CJS_PropValue& vp,
+ bool setPersistent(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
CFX_WideString& sError);
- FX_BOOL DelProperty(IJS_Context* cc,
- const FX_WCHAR* propname,
- CFX_WideString& sError);
+ bool QueryProperty(const FX_WCHAR* propname);
+ bool DoProperty(IJS_Context* cc,
+ const FX_WCHAR* propname,
+ CJS_PropValue& vp,
+ CFX_WideString& sError);
+ bool DelProperty(IJS_Context* cc,
+ const FX_WCHAR* propname,
+ CFX_WideString& sError);
void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv);
private:
void UpdateGlobalPersistentVariables();
void CommitGlobalPersisitentVariables(IJS_Context* cc);
void DestroyGlobalPersisitentVariables();
- FX_BOOL SetGlobalVariables(const CFX_ByteString& propname,
- JS_GlobalDataType nType,
- double dData,
- bool bData,
- const CFX_ByteString& sData,
- v8::Local<v8::Object> pData,
- bool bDefaultPersistent);
+ bool SetGlobalVariables(const CFX_ByteString& propname,
+ JS_GlobalDataType nType,
+ double dData,
+ bool bData,
+ const CFX_ByteString& sData,
+ v8::Local<v8::Object> pData,
+ bool bDefaultPersistent);
void ObjectToArray(IJS_Context* cc,
v8::Local<v8::Object> pObj,
CJS_GlobalVariableArray& array);
diff --git a/fpdfsdk/javascript/ijs_context.h b/fpdfsdk/javascript/ijs_context.h
index 859d09524b..2d2248f539 100644
--- a/fpdfsdk/javascript/ijs_context.h
+++ b/fpdfsdk/javascript/ijs_context.h
@@ -18,8 +18,8 @@ class CPDFSDK_FormFillEnvironment;
// Records the details of an event and triggers JS execution for it.
class IJS_Context {
public:
- virtual FX_BOOL RunScript(const CFX_WideString& script,
- CFX_WideString* info) = 0;
+ virtual bool RunScript(const CFX_WideString& script,
+ CFX_WideString* info) = 0;
virtual void OnApp_Init() = 0;
@@ -36,84 +36,84 @@ class IJS_Context {
virtual void OnPage_InView(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
virtual void OnPage_OutView(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0;
- virtual void OnField_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnField_MouseDown(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnField_MouseEnter(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnField_MouseExit(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) = 0;
- virtual void OnField_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnField_MouseUp(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget) = 0;
- virtual void OnField_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnField_Focus(bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
const CFX_WideString& Value) = 0;
- virtual void OnField_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnField_Blur(bool bModifier,
+ 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;
+ bool& bRc) = 0;
virtual void OnField_Format(CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit) = 0;
+ bool bWillCommit) = 0;
virtual void OnField_Keystroke(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL KeyDown,
- FX_BOOL bModifier,
+ bool KeyDown,
+ bool bModifier,
int& nSelEnd,
int& nSelStart,
- FX_BOOL bShift,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL bWillCommit,
- FX_BOOL bFieldFull,
- FX_BOOL& bRc) = 0;
+ bool bWillCommit,
+ bool bFieldFull,
+ bool& bRc) = 0;
virtual void OnField_Validate(CFX_WideString& strChange,
const CFX_WideString& strChangeEx,
- FX_BOOL bKeyDown,
- FX_BOOL bModifier,
- FX_BOOL bShift,
+ bool bKeyDown,
+ bool bModifier,
+ bool bShift,
CPDF_FormField* pTarget,
CFX_WideString& Value,
- FX_BOOL& bRc) = 0;
+ bool& bRc) = 0;
- virtual void OnScreen_Focus(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_Focus(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Blur(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_Blur(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Open(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_Open(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_Close(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_Close(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseDown(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_MouseDown(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseUp(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_MouseUp(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseEnter(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_MouseEnter(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_MouseExit(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_MouseExit(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_InView(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_InView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
- virtual void OnScreen_OutView(FX_BOOL bModifier,
- FX_BOOL bShift,
+ virtual void OnScreen_OutView(bool bModifier,
+ bool bShift,
CPDFSDK_Annot* pScreen) = 0;
virtual void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) = 0;
diff --git a/fpdfsdk/javascript/ijs_runtime.h b/fpdfsdk/javascript/ijs_runtime.h
index c14ed7e623..027c500ece 100644
--- a/fpdfsdk/javascript/ijs_runtime.h
+++ b/fpdfsdk/javascript/ijs_runtime.h
@@ -35,10 +35,10 @@ class IJS_Runtime {
CFX_WideString* info) = 0;
#ifdef PDF_ENABLE_XFA
- virtual FX_BOOL GetValueByName(const CFX_ByteStringC& utf8Name,
- CFXJSE_Value* pValue) = 0;
- virtual FX_BOOL SetValueByName(const CFX_ByteStringC& utf8Name,
- CFXJSE_Value* pValue) = 0;
+ virtual bool GetValueByName(const CFX_ByteStringC& utf8Name,
+ CFXJSE_Value* pValue) = 0;
+ virtual bool SetValueByName(const CFX_ByteStringC& utf8Name,
+ CFXJSE_Value* pValue) = 0;
#endif // PDF_ENABLE_XFA
protected:
diff --git a/fpdfsdk/javascript/report.cpp b/fpdfsdk/javascript/report.cpp
index 69cc336003..ba6e97d87c 100644
--- a/fpdfsdk/javascript/report.cpp
+++ b/fpdfsdk/javascript/report.cpp
@@ -29,18 +29,18 @@ Report::Report(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
Report::~Report() {}
-FX_BOOL Report::writeText(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Report::writeText(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
-FX_BOOL Report::save(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool Report::save(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
// Unsafe, not supported.
- return TRUE;
+ return true;
}
diff --git a/fpdfsdk/javascript/report.h b/fpdfsdk/javascript/report.h
index 3cd3b3b02c..0773472a94 100644
--- a/fpdfsdk/javascript/report.h
+++ b/fpdfsdk/javascript/report.h
@@ -17,14 +17,14 @@ class Report : public CJS_EmbedObj {
~Report() override;
public:
- FX_BOOL save(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL writeText(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
+ bool save(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool writeText(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
};
class CJS_Report : public CJS_Object {
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index 50c4c56ee9..3967ceb0cb 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -75,7 +75,7 @@ const TbConvert TbConvertTable[] = {
};
int ParseDataType(std::wstring* sFormat) {
- bool bPercent = FALSE;
+ bool bPercent = false;
for (size_t i = 0; i < sFormat->length(); ++i) {
wchar_t c = (*sFormat)[i];
if (c == L'%') {
@@ -114,14 +114,14 @@ util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
util::~util() {}
-FX_BOOL util::printf(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::printf(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int iSize = params.size();
if (iSize < 1)
- return FALSE;
+ return false;
std::wstring c_ConvChar(params[0].ToCFXWideString(pRuntime).c_str());
std::vector<std::wstring> c_strConvers;
int iOffset = 0;
@@ -174,16 +174,16 @@ FX_BOOL util::printf(IJS_Context* cc,
c_strResult.erase(c_strResult.begin());
vRet = CJS_Value(pRuntime, c_strResult.c_str());
- return TRUE;
+ return true;
}
-FX_BOOL util::printd(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::printd(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
int iSize = params.size();
if (iSize < 2)
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Value p1 = params[0];
@@ -191,12 +191,12 @@ FX_BOOL util::printd(IJS_Context* cc,
CJS_Date jsDate;
if (!p2.ConvertToDate(pRuntime, jsDate)) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT1);
- return FALSE;
+ return false;
}
if (!jsDate.IsValidDate(pRuntime)) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT2);
- return FALSE;
+ return false;
}
if (p1.GetType() == CJS_Value::VT_number) {
@@ -224,17 +224,17 @@ FX_BOOL util::printd(IJS_Context* cc,
break;
default:
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
- return FALSE;
+ return false;
}
vRet = CJS_Value(pRuntime, swResult.c_str());
- return TRUE;
+ return true;
}
if (p1.GetType() == CJS_Value::VT_string) {
if (iSize > 2 && params[2].ToBool(pRuntime)) {
sError = JSGetStringFromID(IDS_STRING_JSNOTSUPPORT);
- return FALSE; // currently, it doesn't support XFAPicture.
+ return false; // currently, it doesn't support XFAPicture.
}
// Convert PDF-style format specifiers to wcsftime specifiers. Remove any
@@ -300,21 +300,20 @@ FX_BOOL util::printd(IJS_Context* cc,
wcsftime(buf, 64, cFormat.c_str(), &time);
cFormat = buf;
vRet = CJS_Value(pRuntime, cFormat.c_str());
- return TRUE;
+ return true;
}
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
- return FALSE;
+ return false;
}
-
-FX_BOOL util::printx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::printx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() < 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -322,7 +321,7 @@ FX_BOOL util::printx(IJS_Context* cc,
params[1].ToCFXWideString(pRuntime))
.c_str());
- return TRUE;
+ return true;
}
enum CaseMode { kPreserveCase, kUpperCase, kLowerCase };
@@ -426,14 +425,14 @@ CFX_WideString util::printx(const CFX_WideString& wsFormat,
return wsResult;
}
-FX_BOOL util::scand(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::scand(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int iSize = params.size();
if (iSize < 2)
- return FALSE;
+ return false;
CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
CFX_WideString sDate = params[1].ToCFXWideString(pRuntime);
@@ -448,26 +447,26 @@ FX_BOOL util::scand(IJS_Context* cc,
vRet.SetNull(pRuntime);
}
- return TRUE;
+ return true;
}
-FX_BOOL util::byteToChar(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::byteToChar(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int arg = params[0].ToInt(pRuntime);
if (arg < 0 || arg > 255) {
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
- return FALSE;
+ return false;
}
CFX_WideString wStr(static_cast<FX_WCHAR>(arg));
vRet = CJS_Value(pRuntime, wStr.c_str());
- return TRUE;
+ return true;
}
diff --git a/fpdfsdk/javascript/util.h b/fpdfsdk/javascript/util.h
index 3022efece2..efcf0c8f89 100644
--- a/fpdfsdk/javascript/util.h
+++ b/fpdfsdk/javascript/util.h
@@ -17,26 +17,26 @@ class util : public CJS_EmbedObj {
util(CJS_Object* pJSObject);
~util() override;
- FX_BOOL printd(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL printf(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL printx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL scand(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
- FX_BOOL byteToChar(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError);
+ bool printd(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool printf(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool printx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool scand(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
+ bool byteToChar(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError);
static CFX_WideString printx(const CFX_WideString& cFormat,
const CFX_WideString& cSource);