summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-02 14:37:54 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-02 14:37:55 -0700
commit4cf551577856f89103e162edc761def44ffb96fc (patch)
tree452684db6c2dd2b9aa697415ff4b752e59123b77 /fpdfsdk/javascript/app.cpp
parent66bd67023f747c489d7144aaf4ca6222c686cd26 (diff)
downloadpdfium-4cf551577856f89103e162edc761def44ffb96fc.tar.xz
Remove FX_BOOL from fpdfsdk.
Review-Url: https://codereview.chromium.org/2453683011
Diffstat (limited to 'fpdfsdk/javascript/app.cpp')
-rw-r--r--fpdfsdk/javascript/app.cpp349
1 files changed, 172 insertions, 177 deletions
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;
}