| Index: fpdfsdk/javascript/Document.cpp
|
| diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
|
| index ea489c993bd1e80bd856f96ec63bf232631352d5..54761a2647f4e605f0099b8c1165767a7f107bf6 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) {
|
|
|