From 275e260a6cd4a8e506ba974feb85ebcd926c1739 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Mon, 18 Sep 2017 14:23:18 -0400 Subject: Convert string class names Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez Commit-Queue: Ryan Harrison --- fpdfsdk/javascript/Annot.cpp | 12 +- fpdfsdk/javascript/Annot.h | 6 +- fpdfsdk/javascript/Document.cpp | 261 +++++++++-------- fpdfsdk/javascript/Document.h | 186 ++++++------ fpdfsdk/javascript/Field.cpp | 319 ++++++++++----------- fpdfsdk/javascript/Field.h | 308 +++++++++----------- fpdfsdk/javascript/Icon.cpp | 4 +- fpdfsdk/javascript/Icon.h | 8 +- fpdfsdk/javascript/JS_Define.h | 44 ++- fpdfsdk/javascript/JS_EventHandler.cpp | 36 +-- fpdfsdk/javascript/JS_EventHandler.h | 44 +-- fpdfsdk/javascript/JS_GlobalData.cpp | 44 +-- fpdfsdk/javascript/JS_GlobalData.h | 26 +- fpdfsdk/javascript/JS_KeyValue.h | 4 +- fpdfsdk/javascript/JS_Runtime_Stub.cpp | 33 ++- fpdfsdk/javascript/JS_Value.cpp | 27 +- fpdfsdk/javascript/JS_Value.h | 16 +- fpdfsdk/javascript/PublicMethods.cpp | 217 +++++++------- fpdfsdk/javascript/PublicMethods.h | 66 +++-- fpdfsdk/javascript/app.cpp | 116 ++++---- fpdfsdk/javascript/app.h | 82 +++--- fpdfsdk/javascript/cjs_event_context.cpp | 29 +- fpdfsdk/javascript/cjs_event_context.h | 26 +- fpdfsdk/javascript/cjs_runtime.cpp | 11 +- fpdfsdk/javascript/cjs_runtime.h | 9 +- fpdfsdk/javascript/color.cpp | 40 ++- fpdfsdk/javascript/color.h | 30 +- fpdfsdk/javascript/console.cpp | 8 +- fpdfsdk/javascript/console.h | 8 +- fpdfsdk/javascript/event.cpp | 50 ++-- fpdfsdk/javascript/event.h | 60 ++-- fpdfsdk/javascript/global.cpp | 33 ++- fpdfsdk/javascript/global.h | 16 +- fpdfsdk/javascript/ijs_event_context.h | 27 +- fpdfsdk/javascript/ijs_runtime.h | 7 +- fpdfsdk/javascript/public_methods_embeddertest.cpp | 2 +- fpdfsdk/javascript/report.cpp | 4 +- fpdfsdk/javascript/report.h | 4 +- fpdfsdk/javascript/resource.cpp | 12 +- fpdfsdk/javascript/resource.h | 8 +- fpdfsdk/javascript/util.cpp | 28 +- fpdfsdk/javascript/util.h | 14 +- 42 files changed, 1063 insertions(+), 1222 deletions(-) (limited to 'fpdfsdk/javascript') diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp index 41c71ec411..9cc5d0ff1a 100644 --- a/fpdfsdk/javascript/Annot.cpp +++ b/fpdfsdk/javascript/Annot.cpp @@ -37,7 +37,7 @@ Annot::~Annot() {} bool Annot::hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsGetting()) { if (!m_pAnnot) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); @@ -71,9 +71,7 @@ bool Annot::hidden(CJS_Runtime* pRuntime, return true; } -bool Annot::name(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Annot::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (vp.IsGetting()) { if (!m_pAnnot) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); @@ -83,7 +81,7 @@ bool Annot::name(CJS_Runtime* pRuntime, return true; } - CFX_WideString annotName; + WideString annotName; vp >> annotName; // May invalidate m_pAnnot. if (!m_pAnnot) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); @@ -94,9 +92,7 @@ bool Annot::name(CJS_Runtime* pRuntime, return true; } -bool Annot::type(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Annot::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; diff --git a/fpdfsdk/javascript/Annot.h b/fpdfsdk/javascript/Annot.h index d9757fa514..d70f96a179 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; - bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); void SetSDKAnnot(CPDFSDK_BAAnnot* annot); diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 77f67b5c8f..0c611c1211 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -164,7 +164,7 @@ Document::~Document() { // the total number of fileds in document. bool Document::numFields(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -175,13 +175,13 @@ bool Document::numFields(CJS_Runtime* pRuntime, } CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); - vp << static_cast(pPDFForm->CountFields(CFX_WideString())); + vp << static_cast(pPDFForm->CountFields(WideString())); return true; } bool Document::dirty(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -202,7 +202,7 @@ bool Document::dirty(CJS_Runtime* pRuntime, bool Document::ADBE(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsGetting()) vp.GetJSValue()->SetNull(pRuntime); @@ -211,7 +211,7 @@ bool Document::ADBE(CJS_Runtime* pRuntime, bool Document::pageNum(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -237,7 +237,7 @@ bool Document::pageNum(CJS_Runtime* pRuntime, bool Document::addAnnot(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Not supported. return true; } @@ -245,7 +245,7 @@ bool Document::addAnnot(CJS_Runtime* pRuntime, bool Document::addField(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Not supported. return true; } @@ -253,7 +253,7 @@ bool Document::addField(CJS_Runtime* pRuntime, bool Document::exportAsText(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -261,7 +261,7 @@ bool Document::exportAsText(CJS_Runtime* pRuntime, bool Document::exportAsFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -269,7 +269,7 @@ bool Document::exportAsFDF(CJS_Runtime* pRuntime, bool Document::exportAsXFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -277,7 +277,7 @@ bool Document::exportAsXFDF(CJS_Runtime* pRuntime, bool Document::getField(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() < 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -286,7 +286,7 @@ bool Document::getField(CJS_Runtime* pRuntime, sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; } - CFX_WideString wideName = params[0].ToCFXWideString(pRuntime); + WideString wideName = params[0].ToCFXWideString(pRuntime); CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); if (pPDFForm->CountFields(wideName) <= 0) { @@ -311,7 +311,7 @@ bool Document::getField(CJS_Runtime* pRuntime, bool Document::getNthFieldName(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -327,7 +327,7 @@ bool Document::getNthFieldName(CJS_Runtime* pRuntime, } CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); - CPDF_FormField* pField = pPDFForm->GetField(nIndex, CFX_WideString()); + CPDF_FormField* pField = pPDFForm->GetField(nIndex, WideString()); if (!pField) return false; @@ -338,7 +338,7 @@ bool Document::getNthFieldName(CJS_Runtime* pRuntime, bool Document::importAnFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -346,7 +346,7 @@ bool Document::importAnFDF(CJS_Runtime* pRuntime, bool Document::importAnXFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -354,7 +354,7 @@ bool Document::importAnXFDF(CJS_Runtime* pRuntime, bool Document::importTextData(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -365,7 +365,7 @@ bool Document::importTextData(CJS_Runtime* pRuntime, bool Document::mailForm(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -376,14 +376,13 @@ bool Document::mailForm(CJS_Runtime* pRuntime, } int iLength = params.size(); 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""; - CFX_WideString cSubject = - iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L""; - CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L""; + WideString cTo = iLength > 1 ? params[1].ToCFXWideString(pRuntime) : L""; + WideString cCc = iLength > 2 ? params[2].ToCFXWideString(pRuntime) : L""; + WideString cBcc = iLength > 3 ? params[3].ToCFXWideString(pRuntime) : L""; + WideString cSubject = iLength > 4 ? params[4].ToCFXWideString(pRuntime) : L""; + WideString cMsg = iLength > 5 ? params[5].ToCFXWideString(pRuntime) : L""; CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); - CFX_ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf(); + ByteString sTextBuf = pInterForm->ExportFormToFDFTextBuf(); if (sTextBuf.GetLength() == 0) return false; @@ -404,7 +403,7 @@ bool Document::mailForm(CJS_Runtime* pRuntime, bool Document::print(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -472,7 +471,7 @@ bool Document::print(CJS_Runtime* pRuntime, bool Document::removeField(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -486,7 +485,7 @@ bool Document::removeField(CJS_Runtime* pRuntime, sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); return false; } - CFX_WideString sFieldName = params[0].ToCFXWideString(pRuntime); + WideString sFieldName = params[0].ToCFXWideString(pRuntime); CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); std::vector widgets; pInterForm->GetWidgets(sFieldName, &widgets); @@ -531,7 +530,7 @@ bool Document::removeField(CJS_Runtime* pRuntime, bool Document::resetForm(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -566,7 +565,7 @@ bool Document::resetForm(CJS_Runtime* pRuntime, for (int i = 0, isz = aName.GetLength(pRuntime); i < isz; ++i) { CJS_Value valElement(pRuntime); aName.GetElement(pRuntime, i, valElement); - CFX_WideString swVal = valElement.ToCFXWideString(pRuntime); + WideString swVal = valElement.ToCFXWideString(pRuntime); for (int j = 0, jsz = pPDFForm->CountFields(swVal); j < jsz; ++j) aFields.push_back(pPDFForm->GetField(j, swVal)); } @@ -582,7 +581,7 @@ bool Document::resetForm(CJS_Runtime* pRuntime, bool Document::saveAs(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -590,14 +589,14 @@ bool Document::saveAs(CJS_Runtime* pRuntime, bool Document::syncAnnotScan(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::submitForm(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { int nSize = params.size(); if (nSize < 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); @@ -609,7 +608,7 @@ bool Document::submitForm(CJS_Runtime* pRuntime, } CJS_Array aFields; - CFX_WideString strURL; + WideString strURL; bool bFDF = true; bool bEmpty = false; CJS_Value v = params[0]; @@ -653,7 +652,7 @@ bool Document::submitForm(CJS_Runtime* pRuntime, CJS_Value valName(pRuntime); aFields.GetElement(pRuntime, i, valName); - CFX_WideString sName = valName.ToCFXWideString(pRuntime); + WideString sName = valName.ToCFXWideString(pRuntime); CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); for (int j = 0, jsz = pPDFForm->CountFields(sName); j < jsz; ++j) { CPDF_FormField* pField = pPDFForm->GetField(j, sName); @@ -678,21 +677,21 @@ void Document::SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv) { bool Document::bookmarkRoot(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::mailDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // TODO(tsepez): Check maximum number of allowed params. bool bUI = true; - CFX_WideString cTo = L""; - CFX_WideString cCc = L""; - CFX_WideString cBcc = L""; - CFX_WideString cSubject = L""; - CFX_WideString cMsg = L""; + WideString cTo = L""; + WideString cCc = L""; + WideString cBcc = L""; + WideString cSubject = L""; + WideString cMsg = L""; if (params.size() >= 1) bUI = params[0].ToBool(pRuntime); @@ -739,13 +738,13 @@ bool Document::mailDoc(CJS_Runtime* pRuntime, bool Document::author(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return getPropertyInternal(pRuntime, vp, "Author", sError); } bool Document::info(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -758,46 +757,46 @@ bool Document::info(CJS_Runtime* pRuntime, if (!pDictionary) return false; - CFX_WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author"); - CFX_WideString cwTitle = pDictionary->GetUnicodeTextFor("Title"); - CFX_WideString cwSubject = pDictionary->GetUnicodeTextFor("Subject"); - CFX_WideString cwKeywords = pDictionary->GetUnicodeTextFor("Keywords"); - CFX_WideString cwCreator = pDictionary->GetUnicodeTextFor("Creator"); - CFX_WideString cwProducer = pDictionary->GetUnicodeTextFor("Producer"); - CFX_WideString cwCreationDate = - pDictionary->GetUnicodeTextFor("CreationDate"); - CFX_WideString cwModDate = pDictionary->GetUnicodeTextFor("ModDate"); - CFX_WideString cwTrapped = pDictionary->GetUnicodeTextFor("Trapped"); + WideString cwAuthor = pDictionary->GetUnicodeTextFor("Author"); + WideString cwTitle = pDictionary->GetUnicodeTextFor("Title"); + WideString cwSubject = pDictionary->GetUnicodeTextFor("Subject"); + WideString cwKeywords = pDictionary->GetUnicodeTextFor("Keywords"); + WideString cwCreator = pDictionary->GetUnicodeTextFor("Creator"); + WideString cwProducer = pDictionary->GetUnicodeTextFor("Producer"); + WideString cwCreationDate = pDictionary->GetUnicodeTextFor("CreationDate"); + WideString cwModDate = pDictionary->GetUnicodeTextFor("ModDate"); + WideString cwTrapped = pDictionary->GetUnicodeTextFor("Trapped"); v8::Local pObj = pRuntime->NewFxDynamicObj(-1); pRuntime->PutObjectProperty(pObj, L"Author", - pRuntime->NewString(cwAuthor.AsStringC())); + pRuntime->NewString(cwAuthor.AsStringView())); pRuntime->PutObjectProperty(pObj, L"Title", - pRuntime->NewString(cwTitle.AsStringC())); + pRuntime->NewString(cwTitle.AsStringView())); pRuntime->PutObjectProperty(pObj, L"Subject", - pRuntime->NewString(cwSubject.AsStringC())); + pRuntime->NewString(cwSubject.AsStringView())); pRuntime->PutObjectProperty(pObj, L"Keywords", - pRuntime->NewString(cwKeywords.AsStringC())); + pRuntime->NewString(cwKeywords.AsStringView())); pRuntime->PutObjectProperty(pObj, L"Creator", - pRuntime->NewString(cwCreator.AsStringC())); + pRuntime->NewString(cwCreator.AsStringView())); pRuntime->PutObjectProperty(pObj, L"Producer", - pRuntime->NewString(cwProducer.AsStringC())); - pRuntime->PutObjectProperty(pObj, L"CreationDate", - pRuntime->NewString(cwCreationDate.AsStringC())); + pRuntime->NewString(cwProducer.AsStringView())); + pRuntime->PutObjectProperty( + pObj, L"CreationDate", + pRuntime->NewString(cwCreationDate.AsStringView())); pRuntime->PutObjectProperty(pObj, L"ModDate", - pRuntime->NewString(cwModDate.AsStringC())); + pRuntime->NewString(cwModDate.AsStringView())); pRuntime->PutObjectProperty(pObj, L"Trapped", - pRuntime->NewString(cwTrapped.AsStringC())); + pRuntime->NewString(cwTrapped.AsStringView())); // It's to be compatible to non-standard info dictionary. for (const auto& it : *pDictionary) { - const CFX_ByteString& bsKey = it.first; + const ByteString& bsKey = it.first; CPDF_Object* pValueObj = it.second.get(); - CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey.AsStringC()); + WideString wsKey = WideString::FromUTF8(bsKey.AsStringView()); if (pValueObj->IsString() || pValueObj->IsName()) { pRuntime->PutObjectProperty( pObj, wsKey, - pRuntime->NewString(pValueObj->GetUnicodeText().AsStringC())); + pRuntime->NewString(pValueObj->GetUnicodeText().AsStringView())); } else if (pValueObj->IsNumber()) { pRuntime->PutObjectProperty(pObj, wsKey, pRuntime->NewNumber(pValueObj->GetNumber())); @@ -812,8 +811,8 @@ bool Document::info(CJS_Runtime* pRuntime, bool Document::getPropertyInternal(CJS_Runtime* pRuntime, CJS_PropValue& vp, - const CFX_ByteString& propName, - CFX_WideString& sError) { + const ByteString& propName, + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -829,7 +828,7 @@ bool Document::getPropertyInternal(CJS_Runtime* pRuntime, sError = JSGetStringFromID(IDS_STRING_JSNOPERMISSION); return false; } - CFX_WideString csProperty; + WideString csProperty; vp >> csProperty; pDictionary->SetNewFor(propName, PDF_EncodeText(csProperty), false); @@ -840,19 +839,19 @@ bool Document::getPropertyInternal(CJS_Runtime* pRuntime, bool Document::creationDate(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return getPropertyInternal(pRuntime, vp, "CreationDate", sError); } bool Document::creator(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return getPropertyInternal(pRuntime, vp, "Creator", sError); } bool Document::delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -880,31 +879,31 @@ bool Document::delay(CJS_Runtime* pRuntime, bool Document::keywords(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return getPropertyInternal(pRuntime, vp, "Keywords", sError); } bool Document::modDate(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return getPropertyInternal(pRuntime, vp, "ModDate", sError); } bool Document::producer(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return getPropertyInternal(pRuntime, vp, "Producer", sError); } bool Document::subject(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return getPropertyInternal(pRuntime, vp, "Subject", sError); } bool Document::title(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv || !m_pFormFillEnv->GetUnderlyingDocument()) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -914,7 +913,7 @@ bool Document::title(CJS_Runtime* pRuntime, bool Document::numPages(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -929,7 +928,7 @@ bool Document::numPages(CJS_Runtime* pRuntime, bool Document::external(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { // In Chrome case, should always return true. if (vp.IsGetting()) { vp << true; @@ -939,7 +938,7 @@ bool Document::external(CJS_Runtime* pRuntime, bool Document::filesize(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -950,19 +949,19 @@ bool Document::filesize(CJS_Runtime* pRuntime, bool Document::mouseX(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::mouseY(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::URL(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -977,7 +976,7 @@ bool Document::URL(CJS_Runtime* pRuntime, bool Document::baseURL(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsGetting()) { vp << m_cwBaseURL; } else { @@ -988,7 +987,7 @@ bool Document::baseURL(CJS_Runtime* pRuntime, bool Document::calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -1006,7 +1005,7 @@ bool Document::calculate(CJS_Runtime* pRuntime, bool Document::documentFileName(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -1015,7 +1014,7 @@ bool Document::documentFileName(CJS_Runtime* pRuntime, sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; } - CFX_WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath(); + WideString wsFilePath = m_pFormFillEnv->JS_docGetFilePath(); FX_STRSIZE i = wsFilePath.GetLength(); for (; i > 0; i--) { if (wsFilePath[i - 1] == L'\\' || wsFilePath[i - 1] == L'/') @@ -1032,7 +1031,7 @@ bool Document::documentFileName(CJS_Runtime* pRuntime, bool Document::path(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -1047,41 +1046,41 @@ bool Document::path(CJS_Runtime* pRuntime, bool Document::pageWindowRect(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::layout(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::addLink(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::closeDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::getPageBox(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::getAnnot(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1091,7 +1090,7 @@ bool Document::getAnnot(CJS_Runtime* pRuntime, return false; } int nPageNo = params[0].ToInt(pRuntime); - CFX_WideString swAnnotName = params[1].ToCFXWideString(pRuntime); + WideString swAnnotName = params[1].ToCFXWideString(pRuntime); CPDFSDK_PageView* pPageView = m_pFormFillEnv->GetPageView(nPageNo); if (!pPageView) return false; @@ -1125,7 +1124,7 @@ bool Document::getAnnot(CJS_Runtime* pRuntime, bool Document::getAnnots(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -1166,7 +1165,7 @@ bool Document::getAnnots(CJS_Runtime* pRuntime, bool Document::getAnnot3D(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { vRet.SetNull(pRuntime); return true; } @@ -1174,21 +1173,21 @@ bool Document::getAnnot3D(CJS_Runtime* pRuntime, bool Document::getAnnots3D(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::getOCGs(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::getLinks(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } @@ -1200,13 +1199,13 @@ bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) { bool Document::addIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; } - CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime); + WideString swIconName = params[0].ToCFXWideString(pRuntime); if (params[1].GetType() != CJS_Value::VT_object) { sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR); return false; @@ -1229,7 +1228,7 @@ bool Document::addIcon(CJS_Runtime* pRuntime, bool Document::icons(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -1261,13 +1260,13 @@ bool Document::icons(CJS_Runtime* pRuntime, bool Document::getIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; } - CFX_WideString swIconName = params[0].ToCFXWideString(pRuntime); + WideString swIconName = params[0].ToCFXWideString(pRuntime); auto it = std::find(m_IconNames.begin(), m_IconNames.end(), swIconName); if (it == m_IconNames.end()) return false; @@ -1287,7 +1286,7 @@ bool Document::getIcon(CJS_Runtime* pRuntime, bool Document::removeIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, no supported. return true; } @@ -1295,21 +1294,21 @@ bool Document::removeIcon(CJS_Runtime* pRuntime, bool Document::createDataObject(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not implemented. return true; } bool Document::media(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::calculateNow(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -1326,14 +1325,14 @@ bool Document::calculateNow(CJS_Runtime* pRuntime, bool Document::Collab(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::getPageNthWord(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -1366,7 +1365,7 @@ bool Document::getPageNthWord(CJS_Runtime* pRuntime, page.ParseContent(); int nWords = 0; - CFX_WideString swRet; + WideString swRet; for (auto& pPageObj : *page.GetPageObjectList()) { if (pPageObj->IsText()) { CPDF_TextObject* pTextObj = pPageObj->AsText(); @@ -1391,7 +1390,7 @@ bool Document::getPageNthWord(CJS_Runtime* pRuntime, bool Document::getPageNthWordQuads(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -1406,7 +1405,7 @@ bool Document::getPageNthWordQuads(CJS_Runtime* pRuntime, bool Document::getPageNumWords(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_pFormFillEnv) { sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; @@ -1442,7 +1441,7 @@ bool Document::getPageNumWords(CJS_Runtime* pRuntime, bool Document::getPrintParams(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { v8::Local pRetObj = pRuntime->NewFxDynamicObj(CJS_PrintParamsObj::g_nObjDefnID); if (pRetObj.IsEmpty()) @@ -1473,7 +1472,7 @@ int Document::CountWords(CPDF_TextObject* pTextObj) { float kerning; pTextObj->GetCharInfo(i, &charcode, &kerning); - CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode); + WideString swUnicode = pFont->UnicodeFromCharCode(charcode); uint16_t unicode = 0; if (swUnicode.GetLength() > 0) @@ -1490,9 +1489,8 @@ int Document::CountWords(CPDF_TextObject* pTextObj) { return nWords; } -CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, - int nWordIndex) { - CFX_WideString swRet; +WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex) { + WideString swRet; CPDF_Font* pFont = pTextObj->GetFont(); if (!pFont) @@ -1506,7 +1504,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, float kerning; pTextObj->GetCharInfo(i, &charcode, &kerning); - CFX_WideString swUnicode = pFont->UnicodeFromCharCode(charcode); + WideString swUnicode = pFont->UnicodeFromCharCode(charcode); uint16_t unicode = 0; if (swUnicode.GetLength() > 0) @@ -1528,7 +1526,7 @@ CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj, bool Document::zoom(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } @@ -1544,14 +1542,14 @@ bool Document::zoom(CJS_Runtime* pRuntime, bool Document::zoomType(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Document::deletePages(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, no supported. return true; } @@ -1559,7 +1557,7 @@ bool Document::deletePages(CJS_Runtime* pRuntime, bool Document::extractPages(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -1567,7 +1565,7 @@ bool Document::extractPages(CJS_Runtime* pRuntime, bool Document::insertPages(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -1575,7 +1573,7 @@ bool Document::insertPages(CJS_Runtime* pRuntime, bool Document::replacePages(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -1583,7 +1581,7 @@ bool Document::replacePages(CJS_Runtime* pRuntime, bool Document::getURL(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -1591,7 +1589,7 @@ bool Document::getURL(CJS_Runtime* pRuntime, bool Document::gotoNamedDest(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1600,7 +1598,7 @@ bool Document::gotoNamedDest(CJS_Runtime* pRuntime, sError = JSGetStringFromID(IDS_STRING_JSBADOBJECT); return false; } - CFX_WideString wideName = params[0].ToCFXWideString(pRuntime); + WideString wideName = params[0].ToCFXWideString(pRuntime); CPDF_Document* pDocument = m_pFormFillEnv->GetPDFDocument(); if (!pDocument) return false; @@ -1629,8 +1627,7 @@ void Document::AddDelayData(CJS_DelayData* pData) { m_DelayData.push_back(std::unique_ptr(pData)); } -void Document::DoFieldDelay(const CFX_WideString& sFieldName, - int nControlIndex) { +void Document::DoFieldDelay(const WideString& sFieldName, int nControlIndex) { std::vector> DelayDataForFieldAndControlIndex; auto iter = m_DelayData.begin(); while (iter != m_DelayData.end()) { diff --git a/fpdfsdk/javascript/Document.h b/fpdfsdk/javascript/Document.h index 91ca778c79..3cec9fa4bc 100644 --- a/fpdfsdk/javascript/Document.h +++ b/fpdfsdk/javascript/Document.h @@ -50,265 +50,239 @@ class Document : public CJS_EmbedObj { explicit Document(CJS_Object* pJSObject); ~Document() override; - bool ADBE(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool author(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool baseURL(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + bool ADBE(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool author(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool baseURL(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool bookmarkRoot(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool calculate(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool Collab(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + WideString& sError); + bool calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool Collab(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool creationDate(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool creator(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool dirty(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + WideString& sError); + bool creator(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool dirty(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool documentFileName(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool external(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool filesize(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool icons(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool info(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool keywords(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool layout(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool modDate(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool mouseX(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool mouseY(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool numFields(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool numPages(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool pageNum(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); + bool external(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool filesize(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool icons(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool info(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool keywords(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool layout(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool modDate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool mouseX(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool mouseY(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool numFields(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool numPages(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool pageNum(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool pageWindowRect(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool path(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool producer(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool subject(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool title(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool zoom(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool zoomType(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); + bool path(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool producer(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool subject(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool title(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool zoom(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool zoomType(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool addAnnot(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool addField(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool addLink(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool addIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool calculateNow(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool closeDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool createDataObject(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool deletePages(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool exportAsText(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool exportAsFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool exportAsXFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool extractPages(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getAnnot(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getAnnots(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getAnnot3D(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getAnnots3D(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getField(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getLinks(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getNthFieldName(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getOCGs(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getPageBox(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getPageNthWord(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getPageNthWordQuads(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getPageNumWords(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getPrintParams(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getURL(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool gotoNamedDest(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool importAnFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool importAnXFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool importTextData(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool insertPages(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool mailForm(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool print(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool removeField(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool replacePages(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool resetForm(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool saveAs(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool submitForm(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool syncAnnotScan(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool mailDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool removeIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); - bool URL(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + WideString& sError); + bool URL(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); void SetFormFillEnv(CPDFSDK_FormFillEnvironment* pFormFillEnv); CPDFSDK_FormFillEnvironment* GetFormFillEnv() const { return m_pFormFillEnv.Get(); } void AddDelayData(CJS_DelayData* pData); - void DoFieldDelay(const CFX_WideString& sFieldName, int nControlIndex); + void DoFieldDelay(const WideString& sFieldName, int nControlIndex); CJS_Document* GetCJSDoc() const; private: bool IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect); int CountWords(CPDF_TextObject* pTextObj); - CFX_WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); + WideString GetObjWordStr(CPDF_TextObject* pTextObj, int nWordIndex); bool getPropertyInternal(CJS_Runtime* pRuntime, CJS_PropValue& vp, - const CFX_ByteString& propName, - CFX_WideString& sError); + const ByteString& propName, + WideString& sError); CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; - CFX_WideString m_cwBaseURL; + WideString m_cwBaseURL; std::list> m_DelayData; // Needs to be a std::list for iterator stability. - std::list m_IconNames; + std::list m_IconNames; bool m_bDelay; }; diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 32d44774ff..fa5d478555 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -163,9 +163,7 @@ JSMethodSpec CJS_Field::MethodSpecs[] = { IMPLEMENT_JS_CLASS(CJS_Field, Field) -CJS_DelayData::CJS_DelayData(FIELD_PROP prop, - int idx, - const CFX_WideString& name) +CJS_DelayData::CJS_DelayData(FIELD_PROP prop, int idx, const WideString& name) : eProp(prop), nControlIndex(idx), sFieldName(name) {} CJS_DelayData::~CJS_DelayData() {} @@ -210,8 +208,7 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed, strFieldName = strFieldNameParsed.substr(0, iStart); } -bool Field::AttachField(Document* pDocument, - const CFX_WideString& csFieldName) { +bool Field::AttachField(Document* pDocument, const WideString& csFieldName) { m_pJSDoc = pDocument; m_pFormFillEnv.Reset(pDocument->GetFormFillEnv()); m_bCanSet = m_pFormFillEnv->GetPermissions(FPDFPERM_FILL_FORM) || @@ -220,7 +217,7 @@ bool Field::AttachField(Document* pDocument, CPDFSDK_InterForm* pRDInterForm = m_pFormFillEnv->GetInterForm(); CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm(); - CFX_WideString swFieldNameTemp = csFieldName; + WideString swFieldNameTemp = csFieldName; swFieldNameTemp.Replace(L"..", L"."); if (pInterForm->CountFields(swFieldNameTemp) <= 0) { @@ -243,7 +240,7 @@ bool Field::AttachField(Document* pDocument, std::vector Field::GetFormFields( CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& csFieldName) { + const WideString& csFieldName) { std::vector fields; CPDFSDK_InterForm* pReaderInterForm = pFormFillEnv->GetInterForm(); CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm(); @@ -255,7 +252,7 @@ std::vector Field::GetFormFields( } std::vector Field::GetFormFields( - const CFX_WideString& csFieldName) const { + const WideString& csFieldName) const { return Field::GetFormFields(m_pFormFillEnv.Get(), csFieldName); } @@ -275,8 +272,8 @@ void Field::UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv, for (auto& pObserved : widgets) { if (pObserved) { bool bFormatted = false; - CFX_WideString sValue = static_cast(pObserved.Get()) - ->OnFormat(bFormatted); + WideString sValue = static_cast(pObserved.Get()) + ->OnFormat(bFormatted); if (pObserved) { // Not redundant, may be clobbered by OnFormat. static_cast(pObserved.Get()) ->ResetAppearance(bFormatted ? &sValue : nullptr, false); @@ -332,7 +329,7 @@ void Field::UpdateFormControl(CPDFSDK_FormFillEnvironment* pFormFillEnv, if (nFieldType == FIELDTYPE_COMBOBOX || nFieldType == FIELDTYPE_TEXTFIELD) { bool bFormatted = false; - CFX_WideString sValue = pWidget->OnFormat(bFormatted); + WideString sValue = pWidget->OnFormat(bFormatted); pWidget->ResetAppearance(bFormatted ? &sValue : nullptr, false); } else { pWidget->ResetAppearance(nullptr, false); @@ -356,8 +353,7 @@ CPDFSDK_Widget* Field::GetWidget(CPDFSDK_FormFillEnvironment* pFormFillEnv, return pInterForm ? pInterForm->GetWidget(pFormControl) : nullptr; } -bool Field::ValueIsOccur(CPDF_FormField* pFormField, - CFX_WideString csOptLabel) { +bool Field::ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel) { for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) { if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0) return true; @@ -379,14 +375,14 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) { bool Field::alignment(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) return false; - CFX_ByteString alignStr; + ByteString alignStr; vp >> alignStr; if (m_bDelay) { @@ -427,22 +423,22 @@ bool Field::alignment(CJS_Runtime* pRuntime, } void Field::SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string) { + const ByteString& string) { // Not supported. } bool Field::borderStyle(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) return false; - CFX_ByteString strType = ""; + ByteString strType = ""; vp >> strType; if (m_bDelay) { @@ -491,9 +487,9 @@ bool Field::borderStyle(CJS_Runtime* pRuntime, } void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string) { + const ByteString& string) { ASSERT(pFormFillEnv); BorderStyle nBorderStyle = BorderStyle::SOLID; @@ -544,7 +540,7 @@ void Field::SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::buttonAlignX(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -585,7 +581,7 @@ bool Field::buttonAlignX(CJS_Runtime* pRuntime, } void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. @@ -593,7 +589,7 @@ void Field::SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::buttonAlignY(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -634,7 +630,7 @@ bool Field::buttonAlignY(CJS_Runtime* pRuntime, } void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. @@ -642,7 +638,7 @@ void Field::SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::buttonFitBounds(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -678,7 +674,7 @@ bool Field::buttonFitBounds(CJS_Runtime* pRuntime, } void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b) { // Not supported. @@ -686,7 +682,7 @@ void Field::SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::buttonPosition(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -721,7 +717,7 @@ bool Field::buttonPosition(CJS_Runtime* pRuntime, } void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. @@ -729,7 +725,7 @@ void Field::SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::buttonScaleHow(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -769,7 +765,7 @@ bool Field::buttonScaleHow(CJS_Runtime* pRuntime, } void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. @@ -777,7 +773,7 @@ void Field::SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::buttonScaleWhen(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -828,7 +824,7 @@ bool Field::buttonScaleWhen(CJS_Runtime* pRuntime, } void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. @@ -836,7 +832,7 @@ void Field::SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::calcOrderIndex(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -872,7 +868,7 @@ bool Field::calcOrderIndex(CJS_Runtime* pRuntime, } void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. @@ -880,7 +876,7 @@ void Field::SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::charLimit(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -911,15 +907,13 @@ bool Field::charLimit(CJS_Runtime* pRuntime, } void Field::SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. } -bool Field::comb(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -954,7 +948,7 @@ bool Field::comb(CJS_Runtime* pRuntime, } void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b) { // Not supported. @@ -962,7 +956,7 @@ void Field::SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::commitOnSelChange(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -999,7 +993,7 @@ bool Field::commitOnSelChange(CJS_Runtime* pRuntime, } void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b) { // Not supported. @@ -1007,7 +1001,7 @@ void Field::SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::currentValueIndices(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) return false; @@ -1064,7 +1058,7 @@ bool Field::currentValueIndices(CJS_Runtime* pRuntime, } void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const std::vector& array) { ASSERT(pFormFillEnv); @@ -1091,26 +1085,26 @@ void Field::SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::defaultStyle(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return false; } void Field::SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex) { // Not supported. } bool Field::defaultValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) return false; - CFX_WideString WideStr; + WideString WideStr; vp >> WideStr; if (m_bDelay) { @@ -1136,15 +1130,15 @@ bool Field::defaultValue(CJS_Runtime* pRuntime, } void Field::SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_WideString& string) { + const WideString& string) { // Not supported. } bool Field::doNotScroll(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -1179,7 +1173,7 @@ bool Field::doNotScroll(CJS_Runtime* pRuntime, } void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b) { // Not supported. @@ -1187,7 +1181,7 @@ void Field::SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::doNotSpellCheck(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -1227,7 +1221,7 @@ void Field::SetDelay(bool bDelay) { bool Field::delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsSetting()) { vp << m_bDelay; return true; @@ -1243,7 +1237,7 @@ bool Field::delay(CJS_Runtime* pRuntime, bool Field::display(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) return false; @@ -1288,7 +1282,7 @@ bool Field::display(CJS_Runtime* pRuntime, } void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); @@ -1323,9 +1317,7 @@ void Field::SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv, } } -bool Field::doc(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (!vp.IsGetting()) return false; @@ -1335,7 +1327,7 @@ bool Field::doc(CJS_Runtime* pRuntime, bool Field::editable(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) return false; @@ -1358,7 +1350,7 @@ bool Field::editable(CJS_Runtime* pRuntime, bool Field::exportValues(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return false; @@ -1398,7 +1390,7 @@ bool Field::exportValues(CJS_Runtime* pRuntime, bool Field::fileSelect(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return false; @@ -1421,7 +1413,7 @@ bool Field::fileSelect(CJS_Runtime* pRuntime, bool Field::fillColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CJS_Array crArray; std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) @@ -1481,7 +1473,7 @@ bool Field::fillColor(CJS_Runtime* pRuntime, } void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const CFX_Color& color) { // Not supported. @@ -1489,7 +1481,7 @@ void Field::SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) return false; @@ -1526,7 +1518,7 @@ bool Field::hidden(CJS_Runtime* pRuntime, } void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b) { int display = b ? 1 /*Hidden*/ : 0 /*Visible*/; @@ -1535,13 +1527,13 @@ void Field::SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::highlight(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) return false; - CFX_ByteString strMode; + ByteString strMode; vp >> strMode; if (m_bDelay) { @@ -1586,15 +1578,15 @@ bool Field::highlight(CJS_Runtime* pRuntime, } void Field::SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string) { + const ByteString& string) { // Not supported. } bool Field::lineWidth(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) return false; @@ -1633,7 +1625,7 @@ bool Field::lineWidth(CJS_Runtime* pRuntime, } void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); @@ -1673,7 +1665,7 @@ void Field::SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::multiline(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -1708,7 +1700,7 @@ bool Field::multiline(CJS_Runtime* pRuntime, } void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b) { // Not supported. @@ -1716,7 +1708,7 @@ void Field::SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::multipleSelection(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) @@ -1745,15 +1737,13 @@ bool Field::multipleSelection(CJS_Runtime* pRuntime, } void Field::SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b) { // Not supported. } -bool Field::name(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (!vp.IsGetting()) return false; @@ -1767,7 +1757,7 @@ bool Field::name(CJS_Runtime* pRuntime, bool Field::numItems(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -1785,9 +1775,7 @@ bool Field::numItems(CJS_Runtime* pRuntime, return true; } -bool Field::page(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::page(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (!vp.IsGetting()) { sError = JSGetStringFromID(IDS_STRING_JSREADONLY); return false; @@ -1832,7 +1820,7 @@ bool Field::page(CJS_Runtime* pRuntime, bool Field::password(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -1863,7 +1851,7 @@ bool Field::password(CJS_Runtime* pRuntime, } void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b) { // Not supported. @@ -1871,7 +1859,7 @@ void Field::SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::print(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) @@ -1942,7 +1930,7 @@ bool Field::print(CJS_Runtime* pRuntime, bool Field::radiosInUnison(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return false; @@ -1965,7 +1953,7 @@ bool Field::radiosInUnison(CJS_Runtime* pRuntime, bool Field::readonly(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return false; @@ -1982,9 +1970,7 @@ bool Field::readonly(CJS_Runtime* pRuntime, return true; } -bool Field::rect(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { CJS_Value Upper_Leftx(pRuntime); CJS_Value Upper_Lefty(pRuntime); CJS_Value Lower_Rightx(pRuntime); @@ -2045,7 +2031,7 @@ bool Field::rect(CJS_Runtime* pRuntime, } void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const CFX_FloatRect& rect) { CPDFSDK_InterForm* pInterForm = pFormFillEnv->GetInterForm(); @@ -2104,7 +2090,7 @@ void Field::SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::required(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return false; @@ -2127,7 +2113,7 @@ bool Field::required(CJS_Runtime* pRuntime, bool Field::richText(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -2156,13 +2142,13 @@ bool Field::richText(CJS_Runtime* pRuntime, bool Field::richValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Field::rotation(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -2193,7 +2179,7 @@ bool Field::rotation(CJS_Runtime* pRuntime, } void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. @@ -2201,7 +2187,7 @@ void Field::SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::strokeColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CJS_Array crArray; if (vp.IsSetting()) { @@ -2259,7 +2245,7 @@ bool Field::strokeColor(CJS_Runtime* pRuntime, } void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const CFX_Color& color) { // Not supported. @@ -2267,14 +2253,14 @@ void Field::SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::style(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) return false; - CFX_ByteString csBCaption; + ByteString csBCaption; vp >> csBCaption; if (m_bDelay) { @@ -2299,8 +2285,8 @@ bool Field::style(CJS_Runtime* pRuntime, if (!pFormControl) return false; - CFX_WideString csWCaption = pFormControl->GetNormalCaption(); - CFX_ByteString csBCaption; + WideString csWCaption = pFormControl->GetNormalCaption(); + ByteString csBCaption; switch (csWCaption[0]) { case L'l': @@ -2327,21 +2313,21 @@ bool Field::style(CJS_Runtime* pRuntime, } void Field::SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string) { + const ByteString& string) { // Not supported. } bool Field::submitName(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Field::textColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CJS_Array crArray; if (vp.IsSetting()) { @@ -2395,7 +2381,7 @@ bool Field::textColor(CJS_Runtime* pRuntime, } void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const CFX_Color& color) { // Not supported. @@ -2403,14 +2389,14 @@ void Field::SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::textFont(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) return false; - CFX_ByteString csFontName; + ByteString csFontName; vp >> csFontName; if (csFontName.IsEmpty()) return false; @@ -2447,15 +2433,15 @@ bool Field::textFont(CJS_Runtime* pRuntime, } void Field::SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string) { + const ByteString& string) { // Not supported. } bool Field::textSize(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { @@ -2490,15 +2476,13 @@ bool Field::textSize(CJS_Runtime* pRuntime, } void Field::SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number) { // Not supported. } -bool Field::type(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Field::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (!vp.IsGetting()) return false; @@ -2541,14 +2525,14 @@ bool Field::type(CJS_Runtime* pRuntime, bool Field::userName(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { ASSERT(m_pFormFillEnv); if (vp.IsSetting()) { if (!m_bCanSet) return false; - CFX_WideString swName; + WideString swName; vp >> swName; if (m_bDelay) { @@ -2568,20 +2552,20 @@ bool Field::userName(CJS_Runtime* pRuntime, } void Field::SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_WideString& string) { + const WideString& string) { // Not supported. } bool Field::value(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { if (!m_bCanSet) return false; - std::vector strArray; + std::vector strArray; if (vp.GetJSValue()->IsArrayObject()) { CJS_Array ValueArray; vp.GetJSValue()->ConvertToArray(pRuntime, ValueArray); @@ -2591,7 +2575,7 @@ bool Field::value(CJS_Runtime* pRuntime, strArray.push_back(ElementValue.ToCFXWideString(pRuntime)); } } else { - CFX_WideString swValue; + WideString swValue; vp >> swValue; strArray.push_back(swValue); } @@ -2660,9 +2644,9 @@ bool Field::value(CJS_Runtime* pRuntime, } void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const std::vector& strArray) { + const std::vector& strArray) { ASSERT(pFormFillEnv); if (strArray.empty()) return; @@ -2715,7 +2699,7 @@ void Field::SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, bool Field::valueAsString(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -2758,7 +2742,7 @@ bool Field::valueAsString(CJS_Runtime* pRuntime, bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return false; @@ -2766,7 +2750,7 @@ bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime, CPDF_FormField* pFormField = FieldArray[0]; if ((pFormField->GetFieldFlags() & FIELDFLAG_FILESELECT) && (pFormField->GetFieldType() == FIELDTYPE_TEXTFIELD)) { - CFX_WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse(); + WideString wsFileName = m_pFormFillEnv->JS_fieldBrowse(); if (!wsFileName.IsEmpty()) { pFormField->SetValue(wsFileName); UpdateFormField(m_pFormFillEnv.Get(), pFormField, true, true, true); @@ -2779,7 +2763,7 @@ bool Field::browseForFileToSubmit(CJS_Runtime* pRuntime, bool Field::buttonGetCaption(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { int nface = 0; int iSize = params.size(); if (iSize >= 1) @@ -2812,7 +2796,7 @@ bool Field::buttonGetCaption(CJS_Runtime* pRuntime, bool Field::buttonGetIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() >= 1) { int nFace = params[0].ToInt(pRuntime); if (nFace < 0 || nFace > 2) @@ -2844,28 +2828,28 @@ bool Field::buttonGetIcon(CJS_Runtime* pRuntime, bool Field::buttonImportIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Field::buttonSetCaption(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::buttonSetIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::checkThisBox(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { int iSize = params.size(); if (iSize < 1) return false; @@ -2902,14 +2886,14 @@ bool Field::checkThisBox(CJS_Runtime* pRuntime, bool Field::clearItems(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Field::defaultIsChecked(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (!m_bCanSet) return false; @@ -2936,28 +2920,27 @@ bool Field::defaultIsChecked(CJS_Runtime* pRuntime, bool Field::deleteItemAt(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Field::getArray(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return false; - std::vector> swSort; + std::vector> swSort; for (CPDF_FormField* pFormField : FieldArray) { - swSort.push_back(std::unique_ptr( - new CFX_WideString(pFormField->GetFullName()))); + swSort.push_back( + std::unique_ptr(new WideString(pFormField->GetFullName()))); } - std::sort( - swSort.begin(), swSort.end(), - [](const std::unique_ptr& p1, - const std::unique_ptr& p2) { return *p1 < *p2; }); + std::sort(swSort.begin(), swSort.end(), + [](const std::unique_ptr& p1, + const std::unique_ptr& p2) { return *p1 < *p2; }); CJS_Array FormFieldArray; @@ -2982,7 +2965,7 @@ bool Field::getArray(CJS_Runtime* pRuntime, bool Field::getItemAt(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { int iSize = params.size(); int nIdx = -1; if (iSize >= 1) @@ -3002,7 +2985,7 @@ bool Field::getItemAt(CJS_Runtime* pRuntime, if (nIdx == -1 || nIdx > pFormField->CountOptions()) nIdx = pFormField->CountOptions() - 1; if (bExport) { - CFX_WideString strval = pFormField->GetOptionValue(nIdx); + WideString strval = pFormField->GetOptionValue(nIdx); if (strval.IsEmpty()) vRet = CJS_Value(pRuntime, pFormField->GetOptionLabel(nIdx).c_str()); else @@ -3020,21 +3003,21 @@ bool Field::getItemAt(CJS_Runtime* pRuntime, bool Field::getLock(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::insertItemAt(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Field::isBoxChecked(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { int nIndex = -1; if (params.size() >= 1) nIndex = params[0].ToInt(pRuntime); @@ -3058,7 +3041,7 @@ bool Field::isBoxChecked(CJS_Runtime* pRuntime, bool Field::isDefaultChecked(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { int nIndex = -1; if (params.size() >= 1) nIndex = params[0].ToInt(pRuntime); @@ -3081,14 +3064,14 @@ bool Field::isDefaultChecked(CJS_Runtime* pRuntime, bool Field::setAction(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Field::setFocus(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { std::vector FieldArray = GetFormFields(m_FieldName); if (FieldArray.empty()) return false; @@ -3133,62 +3116,62 @@ bool Field::setFocus(CJS_Runtime* pRuntime, bool Field::setItems(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool Field::setLock(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::signatureGetModifications(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::signatureGetSeedValue(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::signatureInfo(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::signatureSetSeedValue(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::signatureSign(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::signatureValidate(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool Field::source(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsGetting()) { vp << (CJS_Object*)nullptr; } @@ -3210,14 +3193,14 @@ void Field::AddDelay_Bool(FIELD_PROP prop, bool b) { m_pJSDoc->AddDelayData(pNewData); } -void Field::AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string) { +void Field::AddDelay_String(FIELD_PROP prop, const ByteString& string) { CJS_DelayData* pNewData = new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName); pNewData->string = string; m_pJSDoc->AddDelayData(pNewData); } -void Field::AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string) { +void Field::AddDelay_WideString(FIELD_PROP prop, const WideString& string) { CJS_DelayData* pNewData = new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName); pNewData->widestring = string; @@ -3247,7 +3230,7 @@ void Field::AddDelay_WordArray(FIELD_PROP prop, } void Field::AddDelay_WideStringArray(FIELD_PROP prop, - const std::vector& array) { + const std::vector& array) { CJS_DelayData* pNewData = new CJS_DelayData(prop, m_nFormControlIndex, m_FieldName); pNewData->widestringarray = array; @@ -3397,7 +3380,7 @@ void Field::DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv, void Field::AddField(CPDFSDK_FormFillEnvironment* pFormFillEnv, int nPageIndex, int nFieldType, - const CFX_WideString& sName, + const WideString& sName, const CFX_FloatRect& rcCoords) { // Not supported. } diff --git a/fpdfsdk/javascript/Field.h b/fpdfsdk/javascript/Field.h index 1c8d6beac1..2ca1da4491 100644 --- a/fpdfsdk/javascript/Field.h +++ b/fpdfsdk/javascript/Field.h @@ -56,20 +56,20 @@ enum FIELD_PROP { }; struct CJS_DelayData { - CJS_DelayData(FIELD_PROP prop, int idx, const CFX_WideString& name); + CJS_DelayData(FIELD_PROP prop, int idx, const WideString& name); ~CJS_DelayData(); FIELD_PROP eProp; int nControlIndex; - CFX_WideString sFieldName; + WideString sFieldName; int32_t num; bool b; - CFX_ByteString string; - CFX_WideString widestring; + ByteString string; + WideString widestring; CFX_FloatRect rect; CFX_Color color; std::vector wordarray; - std::vector widestringarray; + std::vector widestringarray; }; class Field : public CJS_EmbedObj { @@ -77,380 +77,338 @@ class Field : public CJS_EmbedObj { explicit Field(CJS_Object* pJSObject); ~Field() override; - bool alignment(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + bool alignment(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool borderStyle(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool buttonAlignX(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool buttonAlignY(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool buttonFitBounds(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool buttonPosition(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool buttonScaleHow(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool buttonScaleWhen(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool calcOrderIndex(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool charLimit(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + WideString& sError); + bool charLimit(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool comb(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool commitOnSelChange(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool currentValueIndices(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool defaultStyle(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool defaultValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool doNotScroll(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool doNotSpellCheck(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool display(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool editable(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); + bool delay(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool display(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool doc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool editable(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool exportValues(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool fileSelect(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool fillColor(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool highlight(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool lineWidth(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool multiline(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); + bool fileSelect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool fillColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool hidden(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool highlight(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool lineWidth(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool multiline(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool multipleSelection(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool numItems(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool page(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool password(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool print(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + WideString& sError); + bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool numItems(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool page(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool password(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool print(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool radiosInUnison(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool readonly(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool required(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool richText(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool richValue(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool rotation(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); + bool readonly(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool rect(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool required(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool richText(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool richValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool rotation(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool strokeColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool style(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool submitName(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool textColor(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool textFont(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool textSize(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool userName(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + WideString& sError); + bool style(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool submitName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool textColor(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool textFont(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool textSize(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool userName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool valueAsString(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + WideString& sError); + bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool browseForFileToSubmit(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool buttonGetCaption(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool buttonGetIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool buttonImportIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool buttonSetCaption(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool buttonSetIcon(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool checkThisBox(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool clearItems(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool defaultIsChecked(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool deleteItemAt(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getArray(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getItemAt(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool getLock(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool insertItemAt(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool isBoxChecked(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool isDefaultChecked(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool setAction(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool setFocus(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool setItems(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool setLock(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool signatureGetModifications(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool signatureGetSeedValue(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool signatureInfo(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool signatureSetSeedValue(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool signatureSign(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool signatureValidate(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static void SetAlignment(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string); + const ByteString& string); static void SetBorderStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string); + const ByteString& string); static void SetButtonAlignX(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetButtonAlignY(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetButtonFitBounds(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b); static void SetButtonPosition(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetButtonScaleHow(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetButtonScaleWhen(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetCalcOrderIndex(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetCharLimit(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetComb(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b); static void SetCommitOnSelChange(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b); static void SetCurrentValueIndices(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const std::vector& array); static void SetDefaultStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex); static void SetDefaultValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_WideString& string); + const WideString& string); static void SetDoNotScroll(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b); static void SetDisplay(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetFillColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const CFX_Color& color); static void SetHidden(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b); static void SetHighlight(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string); + const ByteString& string); static void SetLineWidth(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetMultiline(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b); static void SetMultipleSelection(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b); static void SetPassword(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, bool b); static void SetRect(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const CFX_FloatRect& rect); static void SetRotation(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetStrokeColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const CFX_Color& color); static void SetStyle(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string); + const ByteString& string); static void SetTextColor(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, const CFX_Color& color); static void SetTextFont(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_ByteString& string); + const ByteString& string); static void SetTextSize(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, int number); static void SetUserName(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const CFX_WideString& string); + const WideString& string); static void SetValue(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& swFieldName, + const WideString& swFieldName, int nControlIndex, - const std::vector& strArray); + const std::vector& strArray); static void AddField(CPDFSDK_FormFillEnvironment* pFormFillEnv, int nPageIndex, int nFieldType, - const CFX_WideString& sName, + const WideString& sName, const CFX_FloatRect& rcCoords); static void UpdateFormField(CPDFSDK_FormFillEnvironment* pFormFillEnv, @@ -468,12 +426,12 @@ class Field : public CJS_EmbedObj { CPDF_FormControl* pFormControl); static std::vector GetFormFields( CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& csFieldName); + const WideString& csFieldName); static void DoDelay(CPDFSDK_FormFillEnvironment* pFormFillEnv, CJS_DelayData* pData); - bool AttachField(Document* pDocument, const CFX_WideString& csFieldName); + bool AttachField(Document* pDocument, const WideString& csFieldName); void SetDelay(bool bDelay); protected: @@ -481,26 +439,26 @@ class Field : public CJS_EmbedObj { std::wstring& strFieldName, int& iControlNo); std::vector GetFormFields( - const CFX_WideString& csFieldName) const; + const WideString& csFieldName) const; CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField); - bool ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel); + bool ValueIsOccur(CPDF_FormField* pFormField, WideString csOptLabel); void AddDelay_Int(FIELD_PROP prop, int32_t n); void AddDelay_Bool(FIELD_PROP prop, bool b); - void AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string); - void AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string); + void AddDelay_String(FIELD_PROP prop, const ByteString& string); + void AddDelay_WideString(FIELD_PROP prop, const WideString& string); void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect); void AddDelay_Color(FIELD_PROP prop, const CFX_Color& color); void AddDelay_WordArray(FIELD_PROP prop, const std::vector& array); void AddDelay_WideStringArray(FIELD_PROP prop, - const std::vector& array); + const std::vector& array); void DoDelay(); public: Document* m_pJSDoc; CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; - CFX_WideString m_FieldName; + WideString m_FieldName; int m_nFormControlIndex; bool m_bCanSet; bool m_bDelay; diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp index fa2f92f3c9..47781dd83a 100644 --- a/fpdfsdk/javascript/Icon.cpp +++ b/fpdfsdk/javascript/Icon.cpp @@ -25,9 +25,7 @@ Icon::Icon(CJS_Object* pJSObject) Icon::~Icon() {} -bool Icon::name(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool Icon::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (!vp.IsGetting()) return false; diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h index 5580678fd5..e856ee9e51 100644 --- a/fpdfsdk/javascript/Icon.h +++ b/fpdfsdk/javascript/Icon.h @@ -16,12 +16,12 @@ class Icon : public CJS_EmbedObj { explicit Icon(CJS_Object* pJSObject); ~Icon() override; - bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - CFX_WideString GetIconName() const { return m_swIconName; } - void SetIconName(CFX_WideString name) { m_swIconName = name; } + bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + WideString GetIconName() const { return m_swIconName; } + void SetIconName(WideString name) { m_swIconName = name; } private: - CFX_WideString m_swIconName; + WideString m_swIconName; }; class CJS_Icon : public CJS_Object { diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h index f360e8f6b9..470a8fe40c 100644 --- a/fpdfsdk/javascript/JS_Define.h +++ b/fpdfsdk/javascript/JS_Define.h @@ -34,7 +34,7 @@ struct JSMethodSpec { v8::FunctionCallback pMethodCall; }; -template +template void JSPropGetter(const char* prop_name_string, const char* class_name_string, v8::Local property, @@ -48,7 +48,7 @@ void JSPropGetter(const char* prop_name_string, if (!pJSObj) return; C* pObj = reinterpret_cast(pJSObj->GetEmbedObject()); - CFX_WideString sError; + WideString sError; CJS_PropValue value(pRuntime); value.StartGetting(); if (!(pObj->*M)(pRuntime, value, sError)) { @@ -59,7 +59,7 @@ void JSPropGetter(const char* prop_name_string, info.GetReturnValue().Set(value.GetJSValue()->ToV8Value(pRuntime)); } -template +template void JSPropSetter(const char* prop_name_string, const char* class_name_string, v8::Local property, @@ -74,7 +74,7 @@ void JSPropSetter(const char* prop_name_string, if (!pJSObj) return; C* pObj = reinterpret_cast(pJSObj->GetEmbedObject()); - CFX_WideString sError; + WideString sError; CJS_PropValue propValue(pRuntime, CJS_Value(pRuntime, value)); propValue.StartSetting(); if (!(pObj->*M)(pRuntime, propValue, sError)) { @@ -101,7 +101,7 @@ template &, CJS_Value&, - CFX_WideString&)> + WideString&)> void JSMethod(const char* method_name_string, const char* class_name_string, const v8::FunctionCallbackInfo& info) { @@ -118,7 +118,7 @@ void JSMethod(const char* method_name_string, if (!pJSObj) return; C* pObj = reinterpret_cast(pJSObj->GetEmbedObject()); - CFX_WideString sError; + WideString sError; CJS_Value valueRes(pRuntime); if (!(pObj->*M)(pRuntime, parameters, valueRes, sError)) { pRuntime->Error( @@ -325,8 +325,8 @@ void JSSpecialPropQuery(const char*, Alt* pObj = reinterpret_cast(pJSObj->GetEmbedObject()); v8::String::Utf8Value utf8_value(property); - CFX_WideString propname = CFX_WideString::FromUTF8( - CFX_ByteStringC(*utf8_value, utf8_value.length())); + WideString propname = + WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length())); bool bRet = pObj->QueryProperty(propname.c_str()); info.GetReturnValue().Set(bRet ? 4 : 0); } @@ -347,9 +347,9 @@ void JSSpecialPropGet(const char* class_name, Alt* pObj = reinterpret_cast(pJSObj->GetEmbedObject()); v8::String::Utf8Value utf8_value(property); - CFX_WideString propname = CFX_WideString::FromUTF8( - CFX_ByteStringC(*utf8_value, utf8_value.length())); - CFX_WideString sError; + WideString propname = + WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length())); + WideString sError; CJS_PropValue value(pRuntime); value.StartGetting(); if (!pObj->DoProperty(pRuntime, propname.c_str(), value, sError)) { @@ -376,9 +376,9 @@ void JSSpecialPropPut(const char* class_name, Alt* pObj = reinterpret_cast(pJSObj->GetEmbedObject()); v8::String::Utf8Value utf8_value(property); - CFX_WideString propname = CFX_WideString::FromUTF8( - CFX_ByteStringC(*utf8_value, utf8_value.length())); - CFX_WideString sError; + WideString propname = + WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length())); + WideString sError; CJS_PropValue PropValue(pRuntime, CJS_Value(pRuntime, value)); PropValue.StartSetting(); if (!pObj->DoProperty(pRuntime, propname.c_str(), PropValue, sError)) { @@ -402,20 +402,18 @@ void JSSpecialPropDel(const char* class_name, Alt* pObj = reinterpret_cast(pJSObj->GetEmbedObject()); v8::String::Utf8Value utf8_value(property); - CFX_WideString propname = CFX_WideString::FromUTF8( - CFX_ByteStringC(*utf8_value, utf8_value.length())); - CFX_WideString sError; + WideString propname = + WideString::FromUTF8(ByteStringView(*utf8_value, utf8_value.length())); + WideString sError; if (!pObj->DelProperty(pRuntime, propname.c_str(), sError)) { - CFX_ByteString cbName; + ByteString cbName; cbName.Format("%s.%s", class_name, "DelProperty"); // Probably a missing call to JSFX_Error(). } } -template &, - CJS_Value&, - CFX_WideString&)> +template &, CJS_Value&, WideString&)> void JSGlobalFunc(const char* func_name_string, const v8::FunctionCallbackInfo& info) { CJS_Runtime* pRuntime = @@ -427,7 +425,7 @@ void JSGlobalFunc(const char* func_name_string, parameters.push_back(CJS_Value(pRuntime, info[i])); } CJS_Value valueRes(pRuntime); - CFX_WideString sError; + WideString sError; if (!(*F)(pRuntime, parameters, valueRes, sError)) { pRuntime->Error(JSFormatErrorString(func_name_string, nullptr, sError)); return; diff --git a/fpdfsdk/javascript/JS_EventHandler.cpp b/fpdfsdk/javascript/JS_EventHandler.cpp index a63b7a82fe..670d43ef7c 100644 --- a/fpdfsdk/javascript/JS_EventHandler.cpp +++ b/fpdfsdk/javascript/JS_EventHandler.cpp @@ -43,7 +43,7 @@ void CJS_EventHandler::OnApp_Init() { } void CJS_EventHandler::OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName) { + const WideString& strTargetName) { Initial(JET_DOC_OPEN); m_pTargetFormFillEnv.Reset(pFormFillEnv); m_strTargetName = strTargetName; @@ -146,36 +146,36 @@ void CJS_EventHandler::OnField_MouseUp(bool bModifier, void CJS_EventHandler::OnField_Focus(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) { + const WideString& Value) { Initial(JET_FIELD_FOCUS); m_bModifier = bModifier; m_bShift = bShift; m_strTargetName = pTarget->GetFullName(); - m_pValue = (CFX_WideString*)&Value; + m_pValue = (WideString*)&Value; } void CJS_EventHandler::OnField_Blur(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) { + const WideString& Value) { Initial(JET_FIELD_BLUR); m_bModifier = bModifier; m_bShift = bShift; m_strTargetName = pTarget->GetFullName(); - m_pValue = (CFX_WideString*)&Value; + m_pValue = (WideString*)&Value; } -void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, +void CJS_EventHandler::OnField_Keystroke(WideString& strChange, + const WideString& strChangeEx, bool KeyDown, bool bModifier, int& nSelEnd, int& nSelStart, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit, bool bFieldFull, bool& bRc) { @@ -196,13 +196,13 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange, m_bFieldFull = bFieldFull; } -void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, +void CJS_EventHandler::OnField_Validate(WideString& strChange, + const WideString& strChangeEx, bool bKeyDown, bool bModifier, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) { Initial(JET_FIELD_VALIDATE); @@ -218,7 +218,7 @@ void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) { Initial(JET_FIELD_CALCULATE); @@ -230,7 +230,7 @@ void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, } void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit) { Initial(JET_FIELD_FORMAT); @@ -351,7 +351,7 @@ void CJS_EventHandler::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) { void CJS_EventHandler::OnMenu_Exec( CPDFSDK_FormFillEnvironment* pTargetFormFillEnv, - const CFX_WideString& strTargetName) { + const WideString& strTargetName) { Initial(JET_MENU_EXEC); m_pTargetFormFillEnv.Reset(pTargetFormFillEnv); m_strTargetName = strTargetName; @@ -408,14 +408,14 @@ bool CJS_EventHandler::IsValid() { return m_bValid; } -CFX_WideString& CJS_EventHandler::Change() { +WideString& CJS_EventHandler::Change() { if (m_pWideStrChange) { return *m_pWideStrChange; } return m_WideStrChangeDu; } -CFX_WideString CJS_EventHandler::ChangeEx() { +WideString CJS_EventHandler::ChangeEx() { return m_WideStrChangeEx; } @@ -640,7 +640,7 @@ Field* CJS_EventHandler::Target_Field() { return pField; } -CFX_WideString& CJS_EventHandler::Value() { +WideString& CJS_EventHandler::Value() { return *m_pValue; } @@ -648,6 +648,6 @@ bool CJS_EventHandler::WillCommit() { return m_bWillCommit; } -CFX_WideString CJS_EventHandler::TargetName() { +WideString CJS_EventHandler::TargetName() { return m_strTargetName; } diff --git a/fpdfsdk/javascript/JS_EventHandler.h b/fpdfsdk/javascript/JS_EventHandler.h index 82d9d6a93b..8273b41cc5 100644 --- a/fpdfsdk/javascript/JS_EventHandler.h +++ b/fpdfsdk/javascript/JS_EventHandler.h @@ -67,7 +67,7 @@ class CJS_EventHandler { void OnApp_Init(); void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName); + const WideString& strTargetName); void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv); void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv); void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv); @@ -81,30 +81,30 @@ class CJS_EventHandler { void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc); void OnField_Format(CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit); - void OnField_Keystroke(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + void OnField_Keystroke(WideString& strChange, + const WideString& strChangeEx, bool KeyDown, bool bModifier, int& nSelEnd, int& nSelStart, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit, bool bFieldFull, bool& bRc); - void OnField_Validate(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + void OnField_Validate(WideString& strChange, + const WideString& strChangeEx, bool bKeyDown, bool bModifier, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc); void OnField_MouseDown(bool bModifier, bool bShift, CPDF_FormField* pTarget); @@ -114,11 +114,11 @@ class CJS_EventHandler { void OnField_Blur(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value); + const WideString& Value); void OnField_Focus(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value); + const WideString& Value); void OnScreen_Focus(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); void OnScreen_Blur(bool bModifier, bool bShift, CPDFSDK_Annot* pScreen); @@ -135,7 +135,7 @@ class CJS_EventHandler { void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv); void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName); + const WideString& strTargetName); void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv); void OnConsole_Exec(); void OnExternal_Exec(); @@ -145,8 +145,8 @@ class CJS_EventHandler { void Destroy(); bool IsValid(); - CFX_WideString& Change(); - CFX_WideString ChangeEx(); + WideString& Change(); + WideString ChangeEx(); int CommitKey(); bool FieldFull(); bool KeyDown(); @@ -159,9 +159,9 @@ class CJS_EventHandler { bool Shift(); Field* Source(); Field* Target_Field(); - CFX_WideString& Value(); + WideString& Value(); bool WillCommit(); - CFX_WideString TargetName(); + WideString TargetName(); JS_EVENT_T EventType() { return m_eEventType; } @@ -170,11 +170,11 @@ class CJS_EventHandler { JS_EVENT_T m_eEventType; bool m_bValid; - CFX_WideString m_strTargetName; - CFX_WideString m_strSourceName; - CFX_UnownedPtr m_pWideStrChange; - CFX_WideString m_WideStrChangeDu; - CFX_WideString m_WideStrChangeEx; + WideString m_strTargetName; + WideString m_strSourceName; + CFX_UnownedPtr m_pWideStrChange; + WideString m_WideStrChangeDu; + WideString m_WideStrChangeEx; int m_nCommitKey; bool m_bKeyDown; bool m_bModifier; @@ -184,7 +184,7 @@ class CJS_EventHandler { int* m_pISelStart; int m_nSelStartDu; bool m_bWillCommit; - CFX_UnownedPtr m_pValue; + CFX_UnownedPtr m_pValue; bool m_bFieldFull; bool* m_pbRc; bool m_bRcDu; diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp index 14202646c5..ce3ce68fb3 100644 --- a/fpdfsdk/javascript/JS_GlobalData.cpp +++ b/fpdfsdk/javascript/JS_GlobalData.cpp @@ -32,7 +32,7 @@ const uint8_t JS_RC4KEY[] = { 0xf8, 0x77, 0xd5, 0xa3}; // Returns true if non-empty, setting sPropName -bool TrimPropName(CFX_ByteString* sPropName) { +bool TrimPropName(ByteString* sPropName) { sPropName->TrimLeft(); sPropName->TrimRight(); return sPropName->GetLength() != 0; @@ -69,7 +69,7 @@ CJS_GlobalData::~CJS_GlobalData() { } CJS_GlobalData::iterator CJS_GlobalData::FindGlobalVariable( - const CFX_ByteString& propname) { + const ByteString& propname) { for (auto it = m_arrayGlobalData.begin(); it != m_arrayGlobalData.end(); ++it) { if ((*it)->data.sKey == propname) @@ -79,7 +79,7 @@ CJS_GlobalData::iterator CJS_GlobalData::FindGlobalVariable( } CJS_GlobalData::const_iterator CJS_GlobalData::FindGlobalVariable( - const CFX_ByteString& propname) const { + const ByteString& propname) const { for (auto it = m_arrayGlobalData.begin(); it != m_arrayGlobalData.end(); ++it) { if ((*it)->data.sKey == propname) @@ -89,14 +89,14 @@ CJS_GlobalData::const_iterator CJS_GlobalData::FindGlobalVariable( } CJS_GlobalData_Element* CJS_GlobalData::GetGlobalVariable( - const CFX_ByteString& propname) { + const ByteString& propname) { auto iter = FindGlobalVariable(propname); return iter != m_arrayGlobalData.end() ? iter->get() : nullptr; } -void CJS_GlobalData::SetGlobalVariableNumber(const CFX_ByteString& propname, +void CJS_GlobalData::SetGlobalVariableNumber(const ByteString& propname, double dData) { - CFX_ByteString sPropName(propname); + ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return; @@ -112,9 +112,9 @@ void CJS_GlobalData::SetGlobalVariableNumber(const CFX_ByteString& propname, m_arrayGlobalData.push_back(std::move(pNewData)); } -void CJS_GlobalData::SetGlobalVariableBoolean(const CFX_ByteString& propname, +void CJS_GlobalData::SetGlobalVariableBoolean(const ByteString& propname, bool bData) { - CFX_ByteString sPropName(propname); + ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return; @@ -130,9 +130,9 @@ void CJS_GlobalData::SetGlobalVariableBoolean(const CFX_ByteString& propname, m_arrayGlobalData.push_back(std::move(pNewData)); } -void CJS_GlobalData::SetGlobalVariableString(const CFX_ByteString& propname, - const CFX_ByteString& sData) { - CFX_ByteString sPropName(propname); +void CJS_GlobalData::SetGlobalVariableString(const ByteString& propname, + const ByteString& sData) { + ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return; @@ -149,9 +149,9 @@ void CJS_GlobalData::SetGlobalVariableString(const CFX_ByteString& propname, } void CJS_GlobalData::SetGlobalVariableObject( - const CFX_ByteString& propname, + const ByteString& propname, const CJS_GlobalVariableArray& array) { - CFX_ByteString sPropName(propname); + ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return; @@ -167,8 +167,8 @@ void CJS_GlobalData::SetGlobalVariableObject( m_arrayGlobalData.push_back(std::move(pNewData)); } -void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) { - CFX_ByteString sPropName(propname); +void CJS_GlobalData::SetGlobalVariableNull(const ByteString& propname) { + ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return; @@ -182,9 +182,9 @@ void CJS_GlobalData::SetGlobalVariableNull(const CFX_ByteString& propname) { m_arrayGlobalData.push_back(std::move(pNewData)); } -bool CJS_GlobalData::SetGlobalVariablePersistent(const CFX_ByteString& propname, +bool CJS_GlobalData::SetGlobalVariablePersistent(const ByteString& propname, bool bPersistent) { - CFX_ByteString sPropName(propname); + ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return false; @@ -196,8 +196,8 @@ bool CJS_GlobalData::SetGlobalVariablePersistent(const CFX_ByteString& propname, return true; } -bool CJS_GlobalData::DeleteGlobalVariable(const CFX_ByteString& propname) { - CFX_ByteString sPropName(propname); +bool CJS_GlobalData::DeleteGlobalVariable(const ByteString& propname) { + ByteString sPropName(propname); if (!TrimPropName(&sPropName)) return false; @@ -254,7 +254,7 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() { if (p + dwNameLen > pBuffer + nLength) break; - CFX_ByteString sEntry = CFX_ByteString(p, dwNameLen); + ByteString sEntry = ByteString(p, dwNameLen); p += sizeof(char) * dwNameLen; JS_GlobalDataType wDataType = @@ -291,7 +291,7 @@ void CJS_GlobalData::LoadGlobalPersistentVariables() { if (p + dwLength > pBuffer + nLength) break; - SetGlobalVariableString(sEntry, CFX_ByteString(p, dwLength)); + SetGlobalVariableString(sEntry, ByteString(p, dwLength)); SetGlobalVariablePersistent(sEntry, true); p += sizeof(char) * dwLength; } break; @@ -353,7 +353,7 @@ void CJS_GlobalData::WriteFileBuffer(const wchar_t* sFilePath, // UnSupport. } -void CJS_GlobalData::MakeByteString(const CFX_ByteString& name, +void CJS_GlobalData::MakeByteString(const ByteString& name, CJS_KeyValue* pData, CFX_BinaryBuf& sData) { switch (pData->nType) { diff --git a/fpdfsdk/javascript/JS_GlobalData.h b/fpdfsdk/javascript/JS_GlobalData.h index 24e68c2ba6..249bca6a74 100644 --- a/fpdfsdk/javascript/JS_GlobalData.h +++ b/fpdfsdk/javascript/JS_GlobalData.h @@ -29,16 +29,16 @@ class CJS_GlobalData { static CJS_GlobalData* GetRetainedInstance(CPDFSDK_FormFillEnvironment* pApp); void Release(); - void SetGlobalVariableNumber(const CFX_ByteString& propname, double dData); - void SetGlobalVariableBoolean(const CFX_ByteString& propname, bool bData); - void SetGlobalVariableString(const CFX_ByteString& propname, - const CFX_ByteString& sData); - void SetGlobalVariableObject(const CFX_ByteString& propname, + void SetGlobalVariableNumber(const ByteString& propname, double dData); + void SetGlobalVariableBoolean(const ByteString& propname, bool bData); + void SetGlobalVariableString(const ByteString& propname, + const ByteString& sData); + void SetGlobalVariableObject(const ByteString& propname, const CJS_GlobalVariableArray& array); - void SetGlobalVariableNull(const CFX_ByteString& propname); - bool SetGlobalVariablePersistent(const CFX_ByteString& propname, + void SetGlobalVariableNull(const ByteString& propname); + bool SetGlobalVariablePersistent(const ByteString& propname, bool bPersistent); - bool DeleteGlobalVariable(const CFX_ByteString& propname); + bool DeleteGlobalVariable(const ByteString& propname); int32_t GetSize() const; CJS_GlobalData_Element* GetAt(int index) const; @@ -55,9 +55,9 @@ class CJS_GlobalData { void LoadGlobalPersistentVariables(); void SaveGlobalPersisitentVariables(); - CJS_GlobalData_Element* GetGlobalVariable(const CFX_ByteString& sPropname); - iterator FindGlobalVariable(const CFX_ByteString& sPropname); - const_iterator FindGlobalVariable(const CFX_ByteString& sPropname) const; + CJS_GlobalData_Element* GetGlobalVariable(const ByteString& sPropname); + iterator FindGlobalVariable(const ByteString& sPropname); + const_iterator FindGlobalVariable(const ByteString& sPropname) const; void LoadFileBuffer(const wchar_t* sFilePath, uint8_t*& pBuffer, @@ -65,13 +65,13 @@ class CJS_GlobalData { void WriteFileBuffer(const wchar_t* sFilePath, const char* pBuffer, int32_t nLength); - void MakeByteString(const CFX_ByteString& name, + void MakeByteString(const ByteString& name, CJS_KeyValue* pData, CFX_BinaryBuf& sData); size_t m_RefCount; std::vector> m_arrayGlobalData; - CFX_WideString m_sFilePath; + WideString m_sFilePath; }; #endif // FPDFSDK_JAVASCRIPT_JS_GLOBALDATA_H_ diff --git a/fpdfsdk/javascript/JS_KeyValue.h b/fpdfsdk/javascript/JS_KeyValue.h index 9fc71802ef..63669358a4 100644 --- a/fpdfsdk/javascript/JS_KeyValue.h +++ b/fpdfsdk/javascript/JS_KeyValue.h @@ -35,11 +35,11 @@ class CJS_KeyValue { CJS_KeyValue(); ~CJS_KeyValue(); - CFX_ByteString sKey; + ByteString sKey; JS_GlobalDataType nType; double dData; bool bData; - CFX_ByteString sData; + ByteString sData; CJS_GlobalVariableArray objData; }; diff --git a/fpdfsdk/javascript/JS_Runtime_Stub.cpp b/fpdfsdk/javascript/JS_Runtime_Stub.cpp index 73a38fcfa6..068031f450 100644 --- a/fpdfsdk/javascript/JS_Runtime_Stub.cpp +++ b/fpdfsdk/javascript/JS_Runtime_Stub.cpp @@ -17,13 +17,13 @@ class CJS_EventContextStub final : public IJS_EventContext { ~CJS_EventContextStub() override {} // IJS_EventContext: - bool RunScript(const CFX_WideString& script, CFX_WideString* info) override { + bool RunScript(const WideString& script, WideString* info) override { return false; } void OnApp_Init() override {} void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName) override {} + const WideString& strTargetName) override {} void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} @@ -48,37 +48,37 @@ class CJS_EventContextStub final : public IJS_EventContext { void OnField_Focus(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) override {} + const WideString& Value) override {} void OnField_Blur(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) override {} + const WideString& Value) override {} void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) override {} void OnField_Format(CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit) override {} - void OnField_Keystroke(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + void OnField_Keystroke(WideString& strChange, + const WideString& strChangeEx, bool KeyDown, bool bModifier, int& nSelEnd, int& nSelStart, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit, bool bFieldFull, bool& bRc) override {} - void OnField_Validate(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + void OnField_Validate(WideString& strChange, + const WideString& strChangeEx, bool bKeyDown, bool bModifier, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) override {} void OnScreen_Focus(bool bModifier, bool bShift, @@ -113,7 +113,7 @@ class CJS_EventContextStub final : public IJS_EventContext { void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override {} void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString&) override {} + const WideString&) override {} void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) override {} void OnConsole_Exec() override {} void OnExternal_Exec() override {} @@ -138,17 +138,16 @@ class CJS_RuntimeStub final : public IJS_Runtime { } #ifdef PDF_ENABLE_XFA - bool GetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override { + bool GetValueByName(const ByteStringView&, CFXJSE_Value*) override { return false; } - bool SetValueByName(const CFX_ByteStringC&, CFXJSE_Value*) override { + bool SetValueByName(const ByteStringView&, CFXJSE_Value*) override { return false; } #endif // PDF_ENABLE_XFA - int ExecuteScript(const CFX_WideString& script, - CFX_WideString* info) override { + int ExecuteScript(const WideString& script, WideString* info) override { return 0; } diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp index e52d7d1a0f..1a27d22270 100644 --- a/fpdfsdk/javascript/JS_Value.cpp +++ b/fpdfsdk/javascript/JS_Value.cpp @@ -200,7 +200,7 @@ CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const wchar_t* pWstr) : m_pValue(pRuntime->NewString(pWstr)) {} CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const char* pStr) - : m_pValue(pRuntime->NewString(CFX_WideString::FromLocal(pStr).c_str())) {} + : m_pValue(pRuntime->NewString(WideString::FromLocal(pStr).c_str())) {} CJS_Value::CJS_Value(CJS_Runtime* pRuntime, const CJS_Array& array) : m_pValue(array.ToV8Array(pRuntime)) {} @@ -245,12 +245,12 @@ v8::Local CJS_Value::ToV8Object(CJS_Runtime* pRuntime) const { return pRuntime->ToObject(m_pValue); } -CFX_WideString CJS_Value::ToCFXWideString(CJS_Runtime* pRuntime) const { +WideString CJS_Value::ToCFXWideString(CJS_Runtime* pRuntime) const { return pRuntime->ToWideString(m_pValue); } -CFX_ByteString CJS_Value::ToCFXByteString(CJS_Runtime* pRuntime) const { - return CFX_ByteString::FromUnicode(ToCFXWideString(pRuntime)); +ByteString CJS_Value::ToCFXByteString(CJS_Runtime* pRuntime) const { + return ByteString::FromUnicode(ToCFXWideString(pRuntime)); } v8::Local CJS_Value::ToV8Value(CJS_Runtime* pRuntime) const { @@ -268,7 +268,7 @@ void CJS_Value::SetNull(CJS_Runtime* pRuntime) { void CJS_Value::MaybeCoerceToNumber(CJS_Runtime* pRuntime) { bool bAllowNaN = false; if (GetType() == VT_string) { - CFX_ByteString bstr = ToCFXByteString(pRuntime); + ByteString bstr = ToCFXByteString(pRuntime); if (bstr.GetLength() == 0) return; if (bstr == "NaN") @@ -398,12 +398,12 @@ void CJS_PropValue::operator>>(v8::Local& ppObj) const { ppObj = m_Value.ToV8Object(m_pJSRuntime.Get()); } -void CJS_PropValue::operator<<(CFX_ByteString str) { +void CJS_PropValue::operator<<(ByteString str) { ASSERT(!m_bIsSetting); m_Value = CJS_Value(m_pJSRuntime.Get(), str.c_str()); } -void CJS_PropValue::operator>>(CFX_ByteString& str) const { +void CJS_PropValue::operator>>(ByteString& str) const { ASSERT(m_bIsSetting); str = m_Value.ToCFXByteString(m_pJSRuntime.Get()); } @@ -413,12 +413,12 @@ void CJS_PropValue::operator<<(const wchar_t* str) { m_Value = CJS_Value(m_pJSRuntime.Get(), str); } -void CJS_PropValue::operator>>(CFX_WideString& wide_string) const { +void CJS_PropValue::operator>>(WideString& wide_string) const { ASSERT(m_bIsSetting); wide_string = m_Value.ToCFXWideString(m_pJSRuntime.Get()); } -void CJS_PropValue::operator<<(CFX_WideString wide_string) { +void CJS_PropValue::operator<<(WideString wide_string) { ASSERT(!m_bIsSetting); m_Value = CJS_Value(m_pJSRuntime.Get(), wide_string.c_str()); } @@ -588,9 +588,8 @@ double CJS_Date::ToDouble(CJS_Runtime* pRuntime) const { return !m_pDate.IsEmpty() ? pRuntime->ToDouble(m_pDate) : 0.0; } -CFX_WideString CJS_Date::ToString(CJS_Runtime* pRuntime) const { - return !m_pDate.IsEmpty() ? pRuntime->ToWideString(m_pDate) - : CFX_WideString(); +WideString CJS_Date::ToString(CJS_Runtime* pRuntime) const { + return !m_pDate.IsEmpty() ? pRuntime->ToWideString(m_pDate) : WideString(); } v8::Local CJS_Date::ToV8Date(CJS_Runtime* pRuntime) const { @@ -634,7 +633,7 @@ int JS_GetSecFromTime(double dt) { return (int)Mod(floor(dt / 1000), 60); } -double JS_DateParse(const CFX_WideString& str) { +double JS_DateParse(const WideString& str) { v8::Isolate* pIsolate = v8::Isolate::GetCurrent(); v8::Isolate::Scope isolate_scope(pIsolate); v8::HandleScope scope(pIsolate); @@ -659,7 +658,7 @@ double JS_DateParse(const CFX_WideString& str) { const int argc = 1; v8::Local timeStr = CJS_Runtime::CurrentRuntimeFromIsolate(pIsolate)->NewString( - str.AsStringC()); + str.AsStringView()); v8::Local argv[argc] = {timeStr}; v = funC->Call(context, context->Global(), argc, argv).ToLocalChecked(); if (v->IsNumber()) { diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h index 2c0be3592c..1d430ee06c 100644 --- a/fpdfsdk/javascript/JS_Value.h +++ b/fpdfsdk/javascript/JS_Value.h @@ -59,8 +59,8 @@ class CJS_Value { double ToDouble(CJS_Runtime* pRuntime) const; float ToFloat(CJS_Runtime* pRuntime) const; CJS_Object* ToCJSObject(CJS_Runtime* pRuntime) const; - CFX_WideString ToCFXWideString(CJS_Runtime* pRuntime) const; - CFX_ByteString ToCFXByteString(CJS_Runtime* pRuntime) const; + WideString ToCFXWideString(CJS_Runtime* pRuntime) const; + ByteString ToCFXByteString(CJS_Runtime* pRuntime) const; v8::Local ToV8Object(CJS_Runtime* pRuntime) const; v8::Local ToV8Array(CJS_Runtime* pRuntime) const; v8::Local ToV8Value(CJS_Runtime* pRuntime) const; @@ -102,10 +102,10 @@ class CJS_PropValue { void operator>>(CJS_Object*& ppObj) const; void operator<<(CJS_Document* pJsDoc); void operator>>(CJS_Document*& ppJsDoc) const; - void operator<<(CFX_ByteString); - void operator>>(CFX_ByteString&) const; - void operator<<(CFX_WideString); - void operator>>(CFX_WideString&) const; + void operator<<(ByteString); + void operator>>(ByteString&) const; + void operator<<(WideString); + void operator>>(WideString&) const; void operator<<(const wchar_t* c_string); void operator<<(v8::Local); void operator>>(v8::Local&) const; @@ -179,7 +179,7 @@ class CJS_Date { v8::Local ToV8Date(CJS_Runtime* pRuntime) const; double ToDouble(CJS_Runtime* pRuntime) const; - CFX_WideString ToString(CJS_Runtime* pRuntime) const; + WideString ToString(CJS_Runtime* pRuntime) const; protected: v8::Local m_pDate; @@ -192,7 +192,7 @@ int JS_GetDayFromTime(double dt); int JS_GetHourFromTime(double dt); int JS_GetMinFromTime(double dt); int JS_GetSecFromTime(double dt); -double JS_DateParse(const CFX_WideString& str); +double JS_DateParse(const WideString& str); double JS_MakeDay(int nYear, int nMonth, int nDay); double JS_MakeTime(int nHour, int nMin, int nSec, int nMs); double JS_MakeDate(double day, double time); diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 970bbd2c75..ba42c3ecbc 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -70,15 +70,15 @@ const wchar_t* const fullmonths[] = {L"January", L"February", L"March", L"July", L"August", L"September", L"October", L"November", L"December"}; -CFX_ByteString StrTrim(const CFX_ByteString& pStr) { - CFX_ByteString result(pStr); +ByteString StrTrim(const ByteString& pStr) { + ByteString result(pStr); result.TrimLeft(' '); result.TrimRight(' '); return result; } -CFX_WideString StrTrim(const CFX_WideString& pStr) { - CFX_WideString result(pStr); +WideString StrTrim(const WideString& pStr) { + WideString result(pStr); result.TrimLeft(' '); result.TrimRight(' '); return result; @@ -91,10 +91,10 @@ void AlertIfPossible(CJS_EventContext* pContext, const wchar_t* swMsg) { } #if _FX_OS_ != _FX_ANDROID_ -CFX_ByteString CalculateString(double dValue, - int iDec, - int* iDec2, - bool* bNegative) { +ByteString CalculateString(double dValue, + int iDec, + int* iDec2, + bool* bNegative) { *bNegative = dValue < 0; if (*bNegative) dValue = -dValue; @@ -109,14 +109,14 @@ CFX_ByteString CalculateString(double dValue, size_t iDecimalPos = stringValue.find("."); *iDec2 = iDecimalPos == std::string::npos ? stringValue.size() : static_cast(iDecimalPos); - return CFX_ByteString(stringValue.c_str()); + return ByteString(stringValue.c_str()); } #endif } // namespace -bool CJS_PublicMethods::IsNumber(const CFX_WideString& str) { - CFX_WideString sTrim = StrTrim(str); +bool CJS_PublicMethods::IsNumber(const WideString& str) { + WideString sTrim = StrTrim(str); const wchar_t* pTrim = sTrim.c_str(); const wchar_t* p = pTrim; bool bDot = false; @@ -194,8 +194,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime, val.ConvertToArray(pRuntime, StrArray); return StrArray; } - CFX_WideString wsStr = val.ToCFXWideString(pRuntime); - CFX_ByteString t = CFX_ByteString::FromUnicode(wsStr); + WideString wsStr = val.ToCFXWideString(pRuntime); + ByteString t = ByteString::FromUnicode(wsStr); const char* p = t.c_str(); int ch = ','; @@ -204,9 +204,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime, while (*p) { const char* pTemp = strchr(p, ch); if (!pTemp) { - StrArray.SetElement( - pRuntime, nIndex, - CJS_Value(pRuntime, StrTrim(CFX_ByteString(p)).c_str())); + StrArray.SetElement(pRuntime, nIndex, + CJS_Value(pRuntime, StrTrim(ByteString(p)).c_str())); break; } @@ -214,9 +213,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime, strncpy(pSub, p, pTemp - p); *(pSub + (pTemp - p)) = '\0'; - StrArray.SetElement( - pRuntime, nIndex, - CJS_Value(pRuntime, StrTrim(CFX_ByteString(pSub)).c_str())); + StrArray.SetElement(pRuntime, nIndex, + CJS_Value(pRuntime, StrTrim(ByteString(pSub)).c_str())); delete[] pSub; nIndex++; @@ -225,7 +223,7 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime, return StrArray; } -int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& str, +int CJS_PublicMethods::ParseStringInteger(const WideString& str, FX_STRSIZE nStart, FX_STRSIZE& nSkip, FX_STRSIZE nMaxStep) { @@ -248,10 +246,10 @@ int CJS_PublicMethods::ParseStringInteger(const CFX_WideString& str, return nRet; } -CFX_WideString CJS_PublicMethods::ParseStringString(const CFX_WideString& str, - FX_STRSIZE nStart, - FX_STRSIZE& nSkip) { - CFX_WideString swRet; +WideString CJS_PublicMethods::ParseStringString(const WideString& str, + FX_STRSIZE nStart, + FX_STRSIZE& nSkip) { + WideString swRet; nSkip = 0; for (FX_STRSIZE i = nStart, sz = str.GetLength(); i < sz; i++) { wchar_t c = str[i]; @@ -265,7 +263,7 @@ CFX_WideString CJS_PublicMethods::ParseStringString(const CFX_WideString& str, return swRet; } -double CJS_PublicMethods::ParseNormalDate(const CFX_WideString& value, +double CJS_PublicMethods::ParseNormalDate(const WideString& value, bool* bWrongFormat) { double dt = JS_GetDateTime(); @@ -340,13 +338,13 @@ double CJS_PublicMethods::ParseNormalDate(const CFX_WideString& value, return dt; } - CFX_WideString swTemp; + WideString swTemp; swTemp.Format(L"%d/%d/%d %d:%d:%d", nMonth, nDay, nYear, nHour, nMin, nSec); return JS_DateParse(swTemp); } -double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, - const CFX_WideString& format, +double CJS_PublicMethods::MakeRegularDate(const WideString& value, + const WideString& format, bool* bWrongFormat) { double dt = JS_GetDateTime(); @@ -485,7 +483,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, } else if (remaining == 2 || format[i + 3] != c) { switch (c) { case 'm': { - CFX_WideString sMonth = ParseStringString(value, j, nSkip); + WideString sMonth = ParseStringString(value, j, nSkip); bool bFind = false; for (int m = 0; m < 12; m++) { if (sMonth.CompareNoCase(months[m]) == 0) { @@ -520,11 +518,11 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, case 'm': { bool bFind = false; - CFX_WideString sMonth = ParseStringString(value, j, nSkip); + WideString sMonth = ParseStringString(value, j, nSkip); sMonth.MakeLower(); for (int m = 0; m < 12; m++) { - CFX_WideString sFullMonths = fullmonths[m]; + WideString sFullMonths = fullmonths[m]; sFullMonths.MakeLower(); if (sFullMonths.Contains(sMonth.c_str())) { @@ -617,9 +615,9 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value, return dRet; } -CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate, - const CFX_WideString& format) { - CFX_WideString sRet = L"", sPart = L""; +WideString CJS_PublicMethods::MakeFormatDate(double dDate, + const WideString& format) { + WideString sRet = L"", sPart = L""; int nYear = JS_GetYearFromTime(dDate); int nMonth = JS_GetMonthFromTime(dDate) + 1; @@ -753,7 +751,7 @@ CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate, bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { #if _FX_OS_ != _FX_ANDROID_ if (params.size() != 6) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); @@ -765,8 +763,8 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - CFX_WideString& Value = pEvent->Value(); - CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value)); + WideString& Value = pEvent->Value(); + ByteString strValue = StrTrim(ByteString::FromUnicode(Value)); if (strValue.IsEmpty()) return true; @@ -774,7 +772,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* 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); + WideString wstrCurrency = params[4].ToCFXWideString(pRuntime); bool bCurrencyPrepend = params[5].ToBool(pRuntime); if (iDec < 0) @@ -825,7 +823,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime, } // Processing currency string - Value = CFX_WideString::FromLocal(strValue.AsStringC()); + Value = WideString::FromLocal(strValue.AsStringView()); if (bCurrencyPrepend) Value = wstrCurrency + Value; @@ -900,7 +898,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() < 2) return false; @@ -909,12 +907,12 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - CFX_WideString& val = pEvent->Value(); - CFX_WideString& wstrChange = pEvent->Change(); - CFX_WideString wstrValue = val; + WideString& val = pEvent->Value(); + WideString& wstrChange = pEvent->Change(); + WideString wstrValue = val; if (pEvent->WillCommit()) { - CFX_WideString swTemp = StrTrim(wstrValue); + WideString swTemp = StrTrim(wstrValue); if (swTemp.IsEmpty()) return true; @@ -927,7 +925,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime, return true; // it happens after the last keystroke and before validating, } - CFX_WideString wstrSelected; + WideString wstrSelected; if (pEvent->SelStart() != -1) { wstrSelected = wstrValue.Mid(pEvent->SelStart(), pEvent->SelEnd() - pEvent->SelStart()); @@ -981,8 +979,8 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime, } } - CFX_WideString wprefix = wstrValue.Left(pEvent->SelStart()); - CFX_WideString wpostfix; + WideString wprefix = wstrValue.Left(pEvent->SelStart()); + WideString wpostfix; if (pEvent->SelEnd() >= 0 && static_cast(pEvent->SelEnd()) < wstrValue.GetLength()) wpostfix = wstrValue.Right(wstrValue.GetLength() - @@ -995,7 +993,7 @@ bool CJS_PublicMethods::AFNumber_Keystroke(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { #if _FX_OS_ != _FX_ANDROID_ if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); @@ -1007,8 +1005,8 @@ bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - CFX_WideString& Value = pEvent->Value(); - CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value)); + WideString& Value = pEvent->Value(); + ByteString strValue = StrTrim(ByteString::FromUnicode(Value)); if (strValue.IsEmpty()) return true; @@ -1078,7 +1076,7 @@ bool CJS_PublicMethods::AFPercent_Format(CJS_Runtime* pRuntime, if (iNegative) strValue = "-" + strValue; strValue += "%"; - Value = CFX_WideString::FromLocal(strValue.AsStringC()); + Value = WideString::FromLocal(strValue.AsStringView()); #endif return true; } @@ -1087,7 +1085,7 @@ bool CJS_PublicMethods::AFPercent_Keystroke( CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return AFNumber_Keystroke(pRuntime, params, vRet, sError); } @@ -1095,7 +1093,7 @@ bool CJS_PublicMethods::AFPercent_Keystroke( bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1106,12 +1104,12 @@ bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - CFX_WideString& val = pEvent->Value(); - CFX_WideString strValue = val; + WideString& val = pEvent->Value(); + WideString strValue = val; if (strValue.IsEmpty()) return true; - CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime); + WideString sFormat = params[0].ToCFXWideString(pRuntime); double dDate = 0.0f; if (strValue.Contains(L"GMT")) { @@ -1123,7 +1121,7 @@ bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime, } if (std::isnan(dDate)) { - CFX_WideString swMsg; + WideString swMsg; swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(), sFormat.c_str()); AlertIfPossible(pContext, swMsg.c_str()); @@ -1134,9 +1132,9 @@ bool CJS_PublicMethods::AFDate_FormatEx(CJS_Runtime* pRuntime, return true; } -double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) { - std::vector wsArray; - CFX_WideString sTemp = L""; +double CJS_PublicMethods::MakeInterDate(const WideString& strValue) { + std::vector wsArray; + WideString sTemp = L""; for (const auto& c : strValue) { if (c == L' ' || c == L':') { wsArray.push_back(sTemp); @@ -1176,11 +1174,11 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) { else if (sTemp.Compare(L"Dec") == 0) nMonth = 12; - int nDay = FX_atof(wsArray[2].AsStringC()); - int nHour = FX_atof(wsArray[3].AsStringC()); - int nMin = FX_atof(wsArray[4].AsStringC()); - int nSec = FX_atof(wsArray[5].AsStringC()); - int nYear = FX_atof(wsArray[7].AsStringC()); + int nDay = FX_atof(wsArray[2].AsStringView()); + int nHour = FX_atof(wsArray[3].AsStringView()); + int nMin = FX_atof(wsArray[4].AsStringView()); + int nSec = FX_atof(wsArray[5].AsStringView()); + int nYear = FX_atof(wsArray[7].AsStringView()); double dRet = JS_MakeDate(JS_MakeDay(nYear, nMonth - 1, nDay), JS_MakeTime(nHour, nMin, nSec, 0)); if (std::isnan(dRet)) @@ -1193,7 +1191,7 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) { bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = L"AFDate_KeystrokeEx's parameters' size r not correct"; return false; @@ -1205,15 +1203,15 @@ bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - CFX_WideString strValue = pEvent->Value(); + WideString strValue = pEvent->Value(); if (strValue.IsEmpty()) return true; - CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime); + WideString sFormat = params[0].ToCFXWideString(pRuntime); bool bWrongFormat = false; double dRet = MakeRegularDate(strValue, sFormat, &bWrongFormat); if (bWrongFormat || std::isnan(dRet)) { - CFX_WideString swMsg; + WideString swMsg; swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(), sFormat.c_str()); AlertIfPossible(pContext, swMsg.c_str()); @@ -1227,7 +1225,7 @@ bool CJS_PublicMethods::AFDate_KeystrokeEx(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1261,7 +1259,7 @@ bool CJS_PublicMethods::AFDate_Format(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1295,7 +1293,7 @@ bool CJS_PublicMethods::AFDate_Keystroke(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFTime_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1316,7 +1314,7 @@ bool CJS_PublicMethods::AFTime_Format(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFTime_Keystroke(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1337,14 +1335,14 @@ bool CJS_PublicMethods::AFTime_Keystroke(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFTime_FormatEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return AFDate_FormatEx(pRuntime, params, vRet, sError); } bool CJS_PublicMethods::AFTime_KeystrokeEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return AFDate_KeystrokeEx(pRuntime, params, vRet, sError); } @@ -1352,7 +1350,7 @@ bool CJS_PublicMethods::AFTime_KeystrokeEx(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFSpecial_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1363,8 +1361,8 @@ bool CJS_PublicMethods::AFSpecial_Format(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - CFX_WideString wsSource = pEvent->Value(); - CFX_WideString wsFormat; + WideString wsSource = pEvent->Value(); + WideString wsFormat; switch (params[0].ToInt(pRuntime)) { case 0: wsFormat = L"99999"; @@ -1392,7 +1390,7 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx( CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() < 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1403,8 +1401,8 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx( if (!pEvent->m_pValue) return false; - CFX_WideString& valEvent = pEvent->Value(); - CFX_WideString wstrMask = params[0].ToCFXWideString(pRuntime); + WideString& valEvent = pEvent->Value(); + WideString wstrMask = params[0].ToCFXWideString(pRuntime); if (wstrMask.IsEmpty()) return true; @@ -1427,11 +1425,11 @@ bool CJS_PublicMethods::AFSpecial_KeystrokeEx( return true; } - CFX_WideString& wideChange = pEvent->Change(); + WideString& wideChange = pEvent->Change(); if (wideChange.IsEmpty()) return true; - CFX_WideString wChange = wideChange; + WideString wChange = wideChange; FX_STRSIZE iIndexMask = pEvent->SelStart(); FX_STRSIZE combined_len = valEvent.GetLength() + wChange.GetLength() + pEvent->SelStart() - pEvent->SelEnd(); @@ -1475,7 +1473,7 @@ bool CJS_PublicMethods::AFSpecial_Keystroke( CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1513,7 +1511,7 @@ bool CJS_PublicMethods::AFSpecial_Keystroke( bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1522,7 +1520,7 @@ bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime, CJS_EventHandler* pEventHandler = pRuntime->GetCurrentEventContext()->GetEventHandler(); - CFX_WideString swValue; + WideString swValue; if (pEventHandler->m_pValue) swValue = pEventHandler->Value(); @@ -1531,7 +1529,7 @@ bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime, return true; } - CFX_WideString prefix, postfix; + WideString prefix, postfix; if (pEventHandler->SelStart() >= 0) prefix = swValue.Left(pEventHandler->SelStart()); @@ -1553,17 +1551,17 @@ bool CJS_PublicMethods::AFMergeChange(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFParseDateEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; } - CFX_WideString sValue = params[0].ToCFXWideString(pRuntime); - CFX_WideString sFormat = params[1].ToCFXWideString(pRuntime); + WideString sValue = params[0].ToCFXWideString(pRuntime); + WideString sFormat = params[1].ToCFXWideString(pRuntime); double dDate = MakeRegularDate(sValue, sFormat, nullptr); if (std::isnan(dDate)) { - CFX_WideString swMsg; + WideString swMsg; swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(), sFormat.c_str()); AlertIfPossible(pRuntime->GetCurrentEventContext(), swMsg.c_str()); @@ -1577,7 +1575,7 @@ bool CJS_PublicMethods::AFParseDateEx(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFSimple(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 3) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1594,13 +1592,13 @@ bool CJS_PublicMethods::AFSimple(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFMakeNumber(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; } - CFX_WideString ws = params[0].ToCFXWideString(pRuntime); + WideString ws = params[0].ToCFXWideString(pRuntime); ws.Replace(L",", L"."); vRet = CJS_Value(pRuntime, ws.c_str()); vRet.MaybeCoerceToNumber(pRuntime); @@ -1612,7 +1610,7 @@ bool CJS_PublicMethods::AFMakeNumber(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1628,7 +1626,7 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime, pRuntime->GetFormFillEnv()->GetInterForm(); CPDF_InterForm* pInterForm = pReaderInterForm->GetInterForm(); - CFX_WideString sFunction = params[0].ToCFXWideString(pRuntime); + WideString sFunction = params[0].ToCFXWideString(pRuntime); double dValue = wcscmp(sFunction.c_str(), L"PRD") == 0 ? 1.0 : 0.0; CJS_Array FieldNameArray = AF_MakeArrayFromList(pRuntime, params1); @@ -1637,7 +1635,7 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime, for (int i = 0, isz = FieldNameArray.GetLength(pRuntime); i < isz; i++) { CJS_Value jsValue(pRuntime); FieldNameArray.GetElement(pRuntime, i, jsValue); - CFX_WideString wsFieldName = jsValue.ToCFXWideString(pRuntime); + WideString wsFieldName = jsValue.ToCFXWideString(pRuntime); for (int j = 0, jsz = pInterForm->CountFields(wsFieldName); j < jsz; j++) { if (CPDF_FormField* pFormField = pInterForm->GetField(j, wsFieldName)) { @@ -1645,10 +1643,10 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime, switch (pFormField->GetFieldType()) { case FIELDTYPE_TEXTFIELD: case FIELDTYPE_COMBOBOX: { - CFX_WideString trimmed = pFormField->GetValue(); + WideString trimmed = pFormField->GetValue(); trimmed.TrimRight(); trimmed.TrimLeft(); - dTemp = FX_atof(trimmed.AsStringC()); + dTemp = FX_atof(trimmed.AsStringView()); } break; case FIELDTYPE_PUSHBUTTON: { dTemp = 0.0; @@ -1659,10 +1657,10 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime, for (int c = 0, csz = pFormField->CountControls(); c < csz; c++) { if (CPDF_FormControl* pFormCtrl = pFormField->GetControl(c)) { if (pFormCtrl->IsChecked()) { - CFX_WideString trimmed = pFormCtrl->GetExportValue(); + WideString trimmed = pFormCtrl->GetExportValue(); trimmed.TrimRight(); trimmed.TrimLeft(); - dTemp = FX_atof(trimmed.AsStringC()); + dTemp = FX_atof(trimmed.AsStringView()); break; } } @@ -1670,10 +1668,10 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime, } break; case FIELDTYPE_LISTBOX: { if (pFormField->CountSelectedItems() <= 1) { - CFX_WideString trimmed = pFormField->GetValue(); + WideString trimmed = pFormField->GetValue(); trimmed.TrimRight(); trimmed.TrimLeft(); - dTemp = FX_atof(trimmed.AsStringC()); + dTemp = FX_atof(trimmed.AsStringView()); } } break; default: @@ -1711,7 +1709,7 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 4) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1724,13 +1722,12 @@ bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime, if (pEvent->Value().IsEmpty()) return true; - double dEentValue = - atof(CFX_ByteString::FromUnicode(pEvent->Value()).c_str()); + double dEentValue = atof(ByteString::FromUnicode(pEvent->Value()).c_str()); bool bGreaterThan = params[0].ToBool(pRuntime); double dGreaterThan = params[1].ToDouble(pRuntime); bool bLessThan = params[2].ToBool(pRuntime); double dLessThan = params[3].ToDouble(pRuntime); - CFX_WideString swMsg; + WideString swMsg; if (bGreaterThan && bLessThan) { if (dEentValue < dGreaterThan || dEentValue > dLessThan) @@ -1757,17 +1754,17 @@ bool CJS_PublicMethods::AFRange_Validate(CJS_Runtime* pRuntime, bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; } - CFX_WideString str = params[0].ToCFXWideString(pRuntime); + WideString str = params[0].ToCFXWideString(pRuntime); if (str.GetLength() > 0 && (str[0] == L'.' || str[0] == L',')) str = L"0" + str; - CFX_WideString sPart; + WideString sPart; CJS_Array nums; int nIndex = 0; for (const auto& wc : str) { diff --git a/fpdfsdk/javascript/PublicMethods.h b/fpdfsdk/javascript/PublicMethods.h index c373f51322..365df3e5dc 100644 --- a/fpdfsdk/javascript/PublicMethods.h +++ b/fpdfsdk/javascript/PublicMethods.h @@ -21,91 +21,91 @@ class CJS_PublicMethods : public CJS_Object { static bool AFNumber_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFNumber_Keystroke(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFPercent_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFPercent_Keystroke(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFDate_FormatEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFDate_KeystrokeEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFDate_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFDate_Keystroke(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFTime_FormatEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); // + WideString& sError); // static bool AFTime_KeystrokeEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFTime_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFTime_Keystroke(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFSpecial_Format(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFSpecial_Keystroke(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFSpecial_KeystrokeEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); // + WideString& sError); // static bool AFSimple(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFMakeNumber(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFSimple_Calculate(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFRange_Validate(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFMergeChange(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFParseDateEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static bool AFExtractNums(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); JS_STATIC_GLOBAL_FUN(AFNumber_Format); JS_STATIC_GLOBAL_FUN(AFNumber_Keystroke); @@ -132,23 +132,21 @@ class CJS_PublicMethods : public CJS_Object { JS_STATIC_DECLARE_GLOBAL_FUN(); - static int ParseStringInteger(const CFX_WideString& string, + static int ParseStringInteger(const WideString& string, FX_STRSIZE nStart, FX_STRSIZE& nSkip, FX_STRSIZE nMaxStep); - static CFX_WideString ParseStringString(const CFX_WideString& string, - FX_STRSIZE nStart, - FX_STRSIZE& nSkip); - static double MakeRegularDate(const CFX_WideString& value, - const CFX_WideString& format, + static WideString ParseStringString(const WideString& string, + FX_STRSIZE nStart, + FX_STRSIZE& nSkip); + static double MakeRegularDate(const WideString& value, + const WideString& format, bool* bWrongFormat); - static CFX_WideString MakeFormatDate(double dDate, - const CFX_WideString& format); - static double ParseNormalDate(const CFX_WideString& value, - bool* bWrongFormat); - static double MakeInterDate(const CFX_WideString& value); + static WideString MakeFormatDate(double dDate, const WideString& format); + static double ParseNormalDate(const WideString& value, bool* bWrongFormat); + static double MakeInterDate(const WideString& value); - static bool IsNumber(const CFX_WideString& str); + static bool IsNumber(const WideString& str); static bool maskSatisfied(wchar_t c_Change, wchar_t c_Mask); static bool isReservedMaskChar(wchar_t ch); diff --git a/fpdfsdk/javascript/app.cpp b/fpdfsdk/javascript/app.cpp index 246db66234..3c0f9af286 100644 --- a/fpdfsdk/javascript/app.cpp +++ b/fpdfsdk/javascript/app.cpp @@ -28,7 +28,7 @@ class GlobalTimer { CPDFSDK_FormFillEnvironment* pFormFillEnv, CJS_Runtime* pRuntime, int nType, - const CFX_WideString& script, + const WideString& script, uint32_t dwElapse, uint32_t dwTimeOut); ~GlobalTimer(); @@ -40,7 +40,7 @@ class GlobalTimer { uint32_t GetTimeOut() const { return m_dwTimeOut; } int GetTimerID() const { return m_nTimerID; } CJS_Runtime* GetRuntime() const { return m_pRuntime.Get(); } - CFX_WideString GetJScript() const { return m_swJScript; } + WideString GetJScript() const { return m_swJScript; } private: using TimerMap = std::map; @@ -53,7 +53,7 @@ class GlobalTimer { // data const int m_nType; // 0:Interval; 1:TimeOut const uint32_t m_dwTimeOut; - const CFX_WideString m_swJScript; + const WideString m_swJScript; CJS_Runtime::ObservedPtr m_pRuntime; CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; }; @@ -62,7 +62,7 @@ GlobalTimer::GlobalTimer(app* pObj, CPDFSDK_FormFillEnvironment* pFormFillEnv, CJS_Runtime* pRuntime, int nType, - const CFX_WideString& script, + const WideString& script, uint32_t dwElapse, uint32_t dwTimeOut) : m_nTimerID(0), @@ -209,7 +209,7 @@ app::~app() { bool app::activeDocs(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -230,7 +230,7 @@ bool app::activeDocs(CJS_Runtime* pRuntime, bool app::calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { bool bVP; vp >> bVP; @@ -244,7 +244,7 @@ bool app::calculate(CJS_Runtime* pRuntime, bool app::formsVersion(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsGetting()) { vp << JS_NUM_FORMSVERSION; return true; @@ -255,7 +255,7 @@ bool app::formsVersion(CJS_Runtime* pRuntime, bool app::viewerType(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsGetting()) { vp << JS_STR_VIEWERTYPE; return true; @@ -266,7 +266,7 @@ bool app::viewerType(CJS_Runtime* pRuntime, bool app::viewerVariation(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsGetting()) { vp << JS_STR_VIEWERVARIATION; return true; @@ -277,7 +277,7 @@ bool app::viewerVariation(CJS_Runtime* pRuntime, bool app::viewerVersion(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; #ifdef PDF_ENABLE_XFA @@ -294,14 +294,14 @@ bool app::viewerVersion(CJS_Runtime* pRuntime, bool app::platform(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; #ifdef PDF_ENABLE_XFA CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv(); if (!pFormFillEnv) return false; - CFX_WideString platfrom = pFormFillEnv->GetPlatform(); + WideString platfrom = pFormFillEnv->GetPlatform(); if (!platfrom.IsEmpty()) { vp << platfrom; return true; @@ -313,14 +313,14 @@ bool app::platform(CJS_Runtime* pRuntime, bool app::language(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; #ifdef PDF_ENABLE_XFA CPDFSDK_FormFillEnvironment* pFormFillEnv = pRuntime->GetFormFillEnv(); if (!pFormFillEnv) return false; - CFX_WideString language = pFormFillEnv->GetLanguage(); + WideString language = pFormFillEnv->GetLanguage(); if (!language.IsEmpty()) { vp << language; return true; @@ -337,7 +337,7 @@ bool app::language(CJS_Runtime* pRuntime, bool app::newFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } // opens a specified pdf document and returns its document object @@ -350,14 +350,14 @@ bool app::newFDF(CJS_Runtime* pRuntime, bool app::openFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool app::alert(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { std::vector newParams = JS_ExpandKeywordParams( pRuntime, params, 4, L"cMsg", L"nIcon", L"nType", L"cTitle"); @@ -372,7 +372,7 @@ bool app::alert(CJS_Runtime* pRuntime, return true; } - CFX_WideString swMsg; + WideString swMsg; if (newParams[0].GetType() == CJS_Value::VT_object) { CJS_Array carray; if (newParams[0].ConvertToArray(pRuntime, carray)) { @@ -400,7 +400,7 @@ bool app::alert(CJS_Runtime* pRuntime, if (newParams[2].GetType() != CJS_Value::VT_unknown) iType = newParams[2].ToInt(pRuntime); - CFX_WideString swTitle; + WideString swTitle; if (newParams[3].GetType() != CJS_Value::VT_unknown) swTitle = newParams[3].ToCFXWideString(pRuntime); else @@ -418,7 +418,7 @@ bool app::alert(CJS_Runtime* pRuntime, bool app::beep(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() == 1) { pRuntime->GetFormFillEnv()->JS_appBeep(params[0].ToInt(pRuntime)); return true; @@ -431,31 +431,31 @@ bool app::beep(CJS_Runtime* pRuntime, bool app::findComponent(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool app::popUpMenuEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } -bool app::fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError) { +bool app::fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { return false; } bool app::setInterval(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() > 2 || params.size() == 0) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; } - CFX_WideString script = + WideString script = params.size() > 0 ? params[0].ToCFXWideString(pRuntime) : L""; if (script.IsEmpty()) { sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE); @@ -485,13 +485,13 @@ bool app::setInterval(CJS_Runtime* pRuntime, bool app::setTimeOut(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() > 2 || params.size() == 0) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; } - CFX_WideString script = params[0].ToCFXWideString(pRuntime); + WideString script = params[0].ToCFXWideString(pRuntime); if (script.IsEmpty()) { sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE); return true; @@ -519,7 +519,7 @@ bool app::setTimeOut(CJS_Runtime* pRuntime, bool app::clearTimeOut(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -532,7 +532,7 @@ bool app::clearTimeOut(CJS_Runtime* pRuntime, bool app::clearInterval(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -564,7 +564,7 @@ void app::ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param) { bool app::execMenuItem(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } @@ -578,11 +578,11 @@ void app::CancelProc(GlobalTimer* pTimer) { m_Timers.erase(pdfium::FakeUniquePtr(pTimer)); } -void app::RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript) { +void app::RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript) { if (!pRuntime->IsBlocking()) { IJS_EventContext* pContext = pRuntime->NewEventContext(); pContext->OnExternal_Exec(); - CFX_WideString wtInfo; + WideString wtInfo; pContext->RunScript(wsScript, &wtInfo); pRuntime->ReleaseEventContext(pContext); } @@ -591,7 +591,7 @@ void app::RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript) { bool app::goBack(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Not supported. return true; } @@ -599,7 +599,7 @@ bool app::goBack(CJS_Runtime* pRuntime, bool app::goForward(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Not supported. return true; } @@ -607,7 +607,7 @@ bool app::goForward(CJS_Runtime* pRuntime, bool app::mailMsg(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { std::vector newParams = JS_ExpandKeywordParams(pRuntime, params, 6, L"bUI", L"cTo", L"cCc", L"cBcc", L"cSubject", L"cMsg"); @@ -618,7 +618,7 @@ bool app::mailMsg(CJS_Runtime* pRuntime, } bool bUI = newParams[0].ToBool(pRuntime); - CFX_WideString cTo; + WideString cTo; if (newParams[1].GetType() != CJS_Value::VT_unknown) { cTo = newParams[1].ToCFXWideString(pRuntime); } else { @@ -629,19 +629,19 @@ bool app::mailMsg(CJS_Runtime* pRuntime, } } - CFX_WideString cCc; + WideString cCc; if (newParams[2].GetType() != CJS_Value::VT_unknown) cCc = newParams[2].ToCFXWideString(pRuntime); - CFX_WideString cBcc; + WideString cBcc; if (newParams[3].GetType() != CJS_Value::VT_unknown) cBcc = newParams[3].ToCFXWideString(pRuntime); - CFX_WideString cSubject; + WideString cSubject; if (newParams[4].GetType() != CJS_Value::VT_unknown) cSubject = newParams[4].ToCFXWideString(pRuntime); - CFX_WideString cMsg; + WideString cMsg; if (newParams[5].GetType() != CJS_Value::VT_unknown) cMsg = newParams[5].ToCFXWideString(pRuntime); @@ -656,14 +656,14 @@ bool app::mailMsg(CJS_Runtime* pRuntime, bool app::launchURL(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } bool app::runtimeHighlight(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { vp >> m_bRuntimeHighLight; } else { @@ -674,27 +674,27 @@ bool app::runtimeHighlight(CJS_Runtime* pRuntime, bool app::fullscreen(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return false; } bool app::popUpMenu(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool app::browseForDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } -CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) { - CFX_WideString sRet = L"/"; +WideString app::SysPathToPDFPath(const WideString& sOldPath) { + WideString sRet = L"/"; for (const wchar_t& c : sOldPath) { if (c != L':') sRet += (c == L'\\') ? L'/' : c; @@ -705,21 +705,21 @@ CFX_WideString app::SysPathToPDFPath(const CFX_WideString& sOldPath) { bool app::newDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool app::openDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return false; } bool app::response(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { std::vector newParams = JS_ExpandKeywordParams(pRuntime, params, 5, L"cQuestion", L"cTitle", L"cDefault", L"bPassword", L"cLabel"); @@ -728,13 +728,13 @@ bool app::response(CJS_Runtime* pRuntime, sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; } - CFX_WideString swQuestion = newParams[0].ToCFXWideString(pRuntime); + WideString swQuestion = newParams[0].ToCFXWideString(pRuntime); - CFX_WideString swTitle = L"PDF"; + WideString swTitle = L"PDF"; if (newParams[1].GetType() != CJS_Value::VT_unknown) swTitle = newParams[1].ToCFXWideString(pRuntime); - CFX_WideString swDefault; + WideString swDefault; if (newParams[2].GetType() != CJS_Value::VT_unknown) swDefault = newParams[2].ToCFXWideString(pRuntime); @@ -742,7 +742,7 @@ bool app::response(CJS_Runtime* pRuntime, if (newParams[3].GetType() != CJS_Value::VT_unknown) bPassword = newParams[3].ToBool(pRuntime); - CFX_WideString swLabel; + WideString swLabel; if (newParams[4].GetType() != CJS_Value::VT_unknown) swLabel = newParams[4].ToCFXWideString(pRuntime); @@ -757,7 +757,7 @@ bool app::response(CJS_Runtime* pRuntime, return false; } - vRet = CJS_Value(pRuntime, CFX_WideString::FromUTF16LE( + vRet = CJS_Value(pRuntime, WideString::FromUTF16LE( reinterpret_cast(pBuff.data()), nLengthBytes / sizeof(uint16_t)) .c_str()); @@ -765,15 +765,13 @@ bool app::response(CJS_Runtime* pRuntime, return true; } -bool app::media(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool app::media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { return false; } bool app::execDialog(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h index 0a2cfdb58e..e77c8cd57b 100644 --- a/fpdfsdk/javascript/app.h +++ b/fpdfsdk/javascript/app.h @@ -41,132 +41,120 @@ class app : public CJS_EmbedObj { explicit app(CJS_Object* pJSObject); ~app() override; - bool activeDocs(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool calculate(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + bool activeDocs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool formsVersion(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool fullscreen(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool language(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool platform(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); + bool fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool fullscreen(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool language(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool platform(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool runtimeHighlight(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool viewerType(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); + bool viewerType(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool viewerVariation(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool viewerVersion(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool alert(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool beep(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool browseForDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool clearInterval(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool clearTimeOut(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool execDialog(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool execMenuItem(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool findComponent(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool goBack(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool goForward(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool launchURL(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool mailMsg(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool newFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool newDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool openDoc(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool openFDF(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool popUpMenuEx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool popUpMenu(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool response(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool setInterval(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool setTimeOut(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); void TimerProc(GlobalTimer* pTimer); void CancelProc(GlobalTimer* pTimer); - static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); + static WideString SysPathToPDFPath(const WideString& sOldPath); private: // CJS_EmbedObj - void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); + void RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript); void ClearTimerCommon(CJS_Runtime* pRuntime, const CJS_Value& param); diff --git a/fpdfsdk/javascript/cjs_event_context.cpp b/fpdfsdk/javascript/cjs_event_context.cpp index 9537ac984e..b820bc309b 100644 --- a/fpdfsdk/javascript/cjs_event_context.cpp +++ b/fpdfsdk/javascript/cjs_event_context.cpp @@ -24,8 +24,7 @@ CPDFSDK_FormFillEnvironment* CJS_EventContext::GetFormFillEnv() { return m_pRuntime->GetFormFillEnv(); } -bool CJS_EventContext::RunScript(const CFX_WideString& script, - CFX_WideString* info) { +bool CJS_EventContext::RunScript(const WideString& script, WideString* info) { v8::Isolate::Scope isolate_scope(m_pRuntime->GetIsolate()); v8::HandleScope handle_scope(m_pRuntime->GetIsolate()); v8::Local context = m_pRuntime->NewLocalContext(); @@ -47,7 +46,7 @@ bool CJS_EventContext::RunScript(const CFX_WideString& script, return false; } - CFX_WideString sErrorMessage; + WideString sErrorMessage; int nRet = 0; if (script.GetLength() > 0) nRet = m_pRuntime->ExecuteScript(script.c_str(), &sErrorMessage); @@ -67,7 +66,7 @@ void CJS_EventContext::OnApp_Init() { } void CJS_EventContext::OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName) { + const WideString& strTargetName) { m_pEventHandler->OnDoc_Open(pFormFillEnv, strTargetName); } @@ -141,39 +140,39 @@ void CJS_EventContext::OnField_MouseUp(bool bModifier, void CJS_EventContext::OnField_Focus(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) { + const WideString& Value) { m_pEventHandler->OnField_Focus(bModifier, bShift, pTarget, Value); } void CJS_EventContext::OnField_Blur(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) { + const WideString& Value) { m_pEventHandler->OnField_Blur(bModifier, bShift, pTarget, Value); } void CJS_EventContext::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) { m_pEventHandler->OnField_Calculate(pSource, pTarget, Value, bRc); } void CJS_EventContext::OnField_Format(CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit) { m_pEventHandler->OnField_Format(pTarget, Value, bWillCommit); } -void CJS_EventContext::OnField_Keystroke(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, +void CJS_EventContext::OnField_Keystroke(WideString& strChange, + const WideString& strChangeEx, bool bKeyDown, bool bModifier, int& nSelEnd, int& nSelStart, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit, bool bFieldFull, bool& bRc) { @@ -182,13 +181,13 @@ void CJS_EventContext::OnField_Keystroke(CFX_WideString& strChange, pTarget, Value, bWillCommit, bFieldFull, bRc); } -void CJS_EventContext::OnField_Validate(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, +void CJS_EventContext::OnField_Validate(WideString& strChange, + const WideString& strChangeEx, bool bKeyDown, bool bModifier, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) { m_pEventHandler->OnField_Validate(strChange, strChangeEx, bKeyDown, bModifier, bShift, pTarget, Value, bRc); @@ -276,6 +275,6 @@ void CJS_EventContext::OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) { } void CJS_EventContext::OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName) { + const WideString& strTargetName) { m_pEventHandler->OnMenu_Exec(pFormFillEnv, strTargetName); } diff --git a/fpdfsdk/javascript/cjs_event_context.h b/fpdfsdk/javascript/cjs_event_context.h index 715bd9462b..a27bbd73af 100644 --- a/fpdfsdk/javascript/cjs_event_context.h +++ b/fpdfsdk/javascript/cjs_event_context.h @@ -24,10 +24,10 @@ class CJS_EventContext : public IJS_EventContext { ~CJS_EventContext() override; // IJS_EventContext - bool RunScript(const CFX_WideString& script, CFX_WideString* info) override; + bool RunScript(const WideString& script, WideString* info) override; void OnApp_Init() override; void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName) override; + const WideString& strTargetName) override; void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; @@ -52,37 +52,37 @@ class CJS_EventContext : public IJS_EventContext { void OnField_Focus(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) override; + const WideString& Value) override; void OnField_Blur(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) override; + const WideString& Value) override; void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) override; void OnField_Format(CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit) override; - void OnField_Keystroke(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + void OnField_Keystroke(WideString& strChange, + const WideString& strChangeEx, bool bKeyDown, bool bModifier, int& nSelEnd, int& nSelStart, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit, bool bFieldFull, bool& bRc) override; - void OnField_Validate(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + void OnField_Validate(WideString& strChange, + const WideString& strChangeEx, bool bKeyDown, bool bModifier, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) override; void OnScreen_Focus(bool bModifier, bool bShift, @@ -117,7 +117,7 @@ class CJS_EventContext : public IJS_EventContext { void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override; void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName) override; + const WideString& strTargetName) override; void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) override; void OnConsole_Exec() override; void OnExternal_Exec() override; diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp index 515bdcb65f..720a15b4bd 100644 --- a/fpdfsdk/javascript/cjs_runtime.cpp +++ b/fpdfsdk/javascript/cjs_runtime.cpp @@ -193,8 +193,7 @@ CPDFSDK_FormFillEnvironment* CJS_Runtime::GetFormFillEnv() const { return m_pFormFillEnv.Get(); } -int CJS_Runtime::ExecuteScript(const CFX_WideString& script, - CFX_WideString* info) { +int CJS_Runtime::ExecuteScript(const WideString& script, WideString* info) { FXJSErr error = {}; int nRet = Execute(script, &error); if (nRet < 0) { @@ -213,13 +212,13 @@ void CJS_Runtime::RemoveEventFromSet(const FieldEvent& event) { } #ifdef PDF_ENABLE_XFA -CFX_WideString ChangeObjName(const CFX_WideString& str) { - CFX_WideString sRet = str; +WideString ChangeObjName(const WideString& str) { + WideString sRet = str; sRet.Replace(L"_", L"."); return sRet; } -bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, +bool CJS_Runtime::GetValueByName(const ByteStringView& utf8Name, CFXJSE_Value* pValue) { v8::Isolate::Scope isolate_scope(GetIsolate()); v8::HandleScope handle_scope(GetIsolate()); @@ -236,7 +235,7 @@ bool CJS_Runtime::GetValueByName(const CFX_ByteStringC& utf8Name, return true; } -bool CJS_Runtime::SetValueByName(const CFX_ByteStringC& utf8Name, +bool CJS_Runtime::SetValueByName(const ByteStringView& utf8Name, CFXJSE_Value* pValue) { if (utf8Name.IsEmpty() || !pValue) return false; diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h index bfbc52b116..39919957f8 100644 --- a/fpdfsdk/javascript/cjs_runtime.h +++ b/fpdfsdk/javascript/cjs_runtime.h @@ -25,7 +25,7 @@ class CJS_Runtime : public IJS_Runtime, public CFXJS_Engine, public CFX_Observable { public: - using FieldEvent = std::pair; + using FieldEvent = std::pair; static CJS_Runtime* CurrentRuntimeFromIsolate(v8::Isolate* pIsolate); @@ -36,8 +36,7 @@ class CJS_Runtime : public IJS_Runtime, IJS_EventContext* NewEventContext() override; void ReleaseEventContext(IJS_EventContext* pContext) override; CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override; - int ExecuteScript(const CFX_WideString& script, - CFX_WideString* info) override; + int ExecuteScript(const WideString& script, WideString* info) override; CJS_EventContext* GetCurrentEventContext() const; @@ -50,9 +49,9 @@ class CJS_Runtime : public IJS_Runtime, bool IsBlocking() const { return m_bBlocking; } #ifdef PDF_ENABLE_XFA - bool GetValueByName(const CFX_ByteStringC& utf8Name, + bool GetValueByName(const ByteStringView& utf8Name, CFXJSE_Value* pValue) override; - bool SetValueByName(const CFX_ByteStringC& utf8Name, + bool SetValueByName(const ByteStringView& utf8Name, CFXJSE_Value* pValue) override; #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/javascript/color.cpp b/fpdfsdk/javascript/color.cpp index 7bf3cc9c6f..574c81a3c0 100644 --- a/fpdfsdk/javascript/color.cpp +++ b/fpdfsdk/javascript/color.cpp @@ -91,7 +91,7 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime, CJS_Value value(pRuntime); array.GetElement(pRuntime, 0, value); - CFX_ByteString sSpace = value.ToCFXByteString(pRuntime); + ByteString sSpace = value.ToCFXByteString(pRuntime); double d1 = 0; double d2 = 0; @@ -132,73 +132,65 @@ void color::ConvertArrayToPWLColor(CJS_Runtime* pRuntime, bool color::transparent(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crTransparent); } bool color::black(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crBlack); } bool color::white(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crWhite); } -bool color::red(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool color::red(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crRed); } bool color::green(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crGreen); } -bool color::blue(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool color::blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crBlue); } -bool color::cyan(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool color::cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crCyan); } bool color::magenta(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crMagenta); } bool color::yellow(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crYellow); } bool color::dkGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crDKGray); } -bool color::gray(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool color::gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crGray); } bool color::ltGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return PropertyHelper(pRuntime, vp, &m_crLTGray); } @@ -221,7 +213,7 @@ bool color::PropertyHelper(CJS_Runtime* pRuntime, bool color::convert(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { int iSize = params.size(); if (iSize < 2) return false; @@ -233,7 +225,7 @@ bool color::convert(CJS_Runtime* pRuntime, CFX_Color crSource; ConvertArrayToPWLColor(pRuntime, aSource, &crSource); - CFX_ByteString sDestSpace = params[1].ToCFXByteString(pRuntime); + ByteString sDestSpace = params[1].ToCFXByteString(pRuntime); int nColorType = COLORTYPE_TRANSPARENT; if (sDestSpace == "T") { @@ -257,7 +249,7 @@ bool color::convert(CJS_Runtime* pRuntime, bool color::equal(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() < 2) return false; diff --git a/fpdfsdk/javascript/color.h b/fpdfsdk/javascript/color.h index 5d6a65790c..5e1e871064 100644 --- a/fpdfsdk/javascript/color.h +++ b/fpdfsdk/javascript/color.h @@ -17,31 +17,29 @@ class color : public CJS_EmbedObj { explicit color(CJS_Object* pJSObject); ~color() override; - bool black(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool dkGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool green(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool ltGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool magenta(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool red(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + bool black(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool blue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool cyan(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool dkGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool gray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool green(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool ltGray(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool magenta(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool red(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool transparent(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool white(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool yellow(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); + WideString& sError); + bool white(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool yellow(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool convert(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool equal(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); static void ConvertPWLColorToArray(CJS_Runtime* pRuntime, const CFX_Color& color, diff --git a/fpdfsdk/javascript/console.cpp b/fpdfsdk/javascript/console.cpp index e9d130820f..4f0fd43ac4 100644 --- a/fpdfsdk/javascript/console.cpp +++ b/fpdfsdk/javascript/console.cpp @@ -33,21 +33,21 @@ console::~console() {} bool console::clear(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool console::hide(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } bool console::println(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() < 1) { return false; } @@ -57,6 +57,6 @@ bool console::println(CJS_Runtime* pRuntime, bool console::show(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { return true; } diff --git a/fpdfsdk/javascript/console.h b/fpdfsdk/javascript/console.h index a7e4d8ed9b..4680220a81 100644 --- a/fpdfsdk/javascript/console.h +++ b/fpdfsdk/javascript/console.h @@ -20,19 +20,19 @@ class console : public CJS_EmbedObj { bool clear(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool hide(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool println(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool show(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); }; class CJS_Console : public CJS_Object { diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp index 2b00cbc10e..efc704da94 100644 --- a/fpdfsdk/javascript/event.cpp +++ b/fpdfsdk/javascript/event.cpp @@ -48,10 +48,10 @@ event::~event() {} bool event::change(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - CFX_WideString& wChange = pEvent->Change(); + WideString& wChange = pEvent->Change(); if (vp.IsSetting()) { if (vp.GetJSValue()->GetType() == CJS_Value::VT_string) vp >> wChange; @@ -63,7 +63,7 @@ bool event::change(CJS_Runtime* pRuntime, bool event::changeEx(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -76,7 +76,7 @@ bool event::changeEx(CJS_Runtime* pRuntime, bool event::commitKey(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -89,7 +89,7 @@ bool event::commitKey(CJS_Runtime* pRuntime, bool event::fieldFull(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -103,7 +103,7 @@ bool event::fieldFull(CJS_Runtime* pRuntime, bool event::keyDown(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -116,7 +116,7 @@ bool event::keyDown(CJS_Runtime* pRuntime, bool event::modifier(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -127,9 +127,7 @@ bool event::modifier(CJS_Runtime* pRuntime, return true; } -bool event::name(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (!vp.IsGetting()) return false; @@ -140,9 +138,7 @@ bool event::name(CJS_Runtime* pRuntime, return true; } -bool event::rc(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -157,25 +153,25 @@ bool event::rc(CJS_Runtime* pRuntime, bool event::richChange(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool event::richChangeEx(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool event::richValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { return true; } bool event::selEnd(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -193,7 +189,7 @@ bool event::selEnd(CJS_Runtime* pRuntime, bool event::selStart(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -211,7 +207,7 @@ bool event::selStart(CJS_Runtime* pRuntime, bool event::shift(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -224,7 +220,7 @@ bool event::shift(CJS_Runtime* pRuntime, bool event::source(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -237,7 +233,7 @@ bool event::source(CJS_Runtime* pRuntime, bool event::target(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -250,7 +246,7 @@ bool event::target(CJS_Runtime* pRuntime, bool event::targetName(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; @@ -261,9 +257,7 @@ bool event::targetName(CJS_Runtime* pRuntime, return true; } -bool event::type(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError) { +bool event::type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError) { if (!vp.IsGetting()) return false; @@ -276,7 +270,7 @@ bool event::type(CJS_Runtime* pRuntime, bool event::value(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -286,7 +280,7 @@ bool event::value(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - CFX_WideString& val = pEvent->Value(); + WideString& val = pEvent->Value(); if (vp.IsSetting()) vp >> val; else @@ -297,7 +291,7 @@ bool event::value(CJS_Runtime* pRuntime, bool event::willCommit(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (!vp.IsGetting()) return false; diff --git a/fpdfsdk/javascript/event.h b/fpdfsdk/javascript/event.h index 2be8a0adb2..857423784e 100644 --- a/fpdfsdk/javascript/event.h +++ b/fpdfsdk/javascript/event.h @@ -15,48 +15,28 @@ class event : public CJS_EmbedObj { ~event() override; public: - bool change(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool changeEx(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool commitKey(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool fieldFull(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool keyDown(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool modifier(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool richChange(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + bool change(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool changeEx(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool commitKey(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool fieldFull(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool keyDown(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool modifier(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool name(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool rc(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool richChange(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); bool richChangeEx(CJS_Runtime* pRuntime, CJS_PropValue& vp, - CFX_WideString& sError); - bool richValue(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool selEnd(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool selStart(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool shift(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool target(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool targetName(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); - bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, CFX_WideString& sError); - bool willCommit(CJS_Runtime* pRuntime, - CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); + bool richValue(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool selEnd(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool selStart(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool shift(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool source(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool target(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool targetName(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool type(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool value(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); + bool willCommit(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError); }; class CJS_Event : public CJS_Object { diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp index 8dcddf4339..9827b2aae7 100644 --- a/fpdfsdk/javascript/global.cpp +++ b/fpdfsdk/javascript/global.cpp @@ -62,13 +62,13 @@ void JSGlobalAlternate::Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv) { } bool JSGlobalAlternate::QueryProperty(const wchar_t* propname) { - return CFX_WideString(propname) != L"setPersistent"; + return WideString(propname) != L"setPersistent"; } bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime, const wchar_t* propname, - CFX_WideString& sError) { - auto it = m_MapGlobal.find(CFX_ByteString::FromUnicode(propname)); + WideString& sError) { + auto it = m_MapGlobal.find(ByteString::FromUnicode(propname)); if (it == m_MapGlobal.end()) return false; @@ -79,9 +79,9 @@ bool JSGlobalAlternate::DelProperty(CJS_Runtime* pRuntime, bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime, const wchar_t* propname, CJS_PropValue& vp, - CFX_WideString& sError) { + WideString& sError) { if (vp.IsSetting()) { - CFX_ByteString sPropName = CFX_ByteString::FromUnicode(propname); + ByteString sPropName = ByteString::FromUnicode(propname); switch (vp.GetJSValue()->GetType()) { case CJS_Value::VT_number: { double dData; @@ -96,7 +96,7 @@ bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime, bData, "", v8::Local(), false); } case CJS_Value::VT_string: { - CFX_ByteString sData; + ByteString sData; vp >> sData; return SetGlobalVariables(sPropName, JS_GlobalDataType::STRING, 0, false, sData, v8::Local(), false); @@ -119,7 +119,7 @@ bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime, break; } } else { - auto it = m_MapGlobal.find(CFX_ByteString::FromUnicode(propname)); + auto it = m_MapGlobal.find(ByteString::FromUnicode(propname)); if (it == m_MapGlobal.end()) { vp.GetJSValue()->SetNull(pRuntime); return true; @@ -158,7 +158,7 @@ bool JSGlobalAlternate::DoProperty(CJS_Runtime* pRuntime, bool JSGlobalAlternate::setPersistent(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() != 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -202,7 +202,7 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() { pData->bPersistent == 1); pRuntime->PutObjectProperty( m_pJSObject->ToV8Object(), pData->data.sKey.UTF8Decode(), - pRuntime->NewString(pData->data.sData.UTF8Decode().AsStringC())); + pRuntime->NewString(pData->data.sData.UTF8Decode().AsStringView())); break; case JS_GlobalDataType::OBJECT: { v8::Local pObj = pRuntime->NewFxDynamicObj(-1); @@ -229,7 +229,7 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() { void JSGlobalAlternate::CommitGlobalPersisitentVariables( CJS_Runtime* pRuntime) { for (const auto& iter : m_MapGlobal) { - CFX_ByteString name = iter.first; + ByteString name = iter.first; JSGlobalData* pData = iter.second.get(); if (pData->bDeleted) { m_pGlobalData->DeleteGlobalVariable(name); @@ -267,9 +267,9 @@ void JSGlobalAlternate::CommitGlobalPersisitentVariables( void JSGlobalAlternate::ObjectToArray(CJS_Runtime* pRuntime, v8::Local pObj, CJS_GlobalVariableArray& array) { - std::vector pKeyList = pRuntime->GetObjectPropertyNames(pObj); + std::vector pKeyList = pRuntime->GetObjectPropertyNames(pObj); for (const auto& ws : pKeyList) { - CFX_ByteString sKey = ws.UTF8Encode(); + ByteString sKey = ws.UTF8Encode(); v8::Local v = pRuntime->GetObjectProperty(pObj, ws); switch (CJS_Value::GetValueType(v)) { case CJS_Value::VT_number: { @@ -287,8 +287,7 @@ void JSGlobalAlternate::ObjectToArray(CJS_Runtime* pRuntime, array.Add(pObjElement); } break; case CJS_Value::VT_string: { - CFX_ByteString sValue = - CJS_Value(pRuntime, v).ToCFXByteString(pRuntime); + ByteString sValue = CJS_Value(pRuntime, v).ToCFXByteString(pRuntime); CJS_KeyValue* pObjElement = new CJS_KeyValue; pObjElement->nType = JS_GlobalDataType::STRING; pObjElement->sKey = sKey; @@ -333,7 +332,7 @@ void JSGlobalAlternate::PutObjectProperty(v8::Local pObj, case JS_GlobalDataType::STRING: pRuntime->PutObjectProperty( pObj, pObjData->sKey.UTF8Decode(), - pRuntime->NewString(pObjData->sData.UTF8Decode().AsStringC())); + pRuntime->NewString(pObjData->sData.UTF8Decode().AsStringView())); break; case JS_GlobalDataType::OBJECT: { v8::Local pNewObj = pRuntime->NewFxDynamicObj(-1); @@ -355,11 +354,11 @@ void JSGlobalAlternate::DestroyGlobalPersisitentVariables() { m_MapGlobal.clear(); } -bool JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname, +bool JSGlobalAlternate::SetGlobalVariables(const ByteString& propname, JS_GlobalDataType nType, double dData, bool bData, - const CFX_ByteString& sData, + const ByteString& sData, v8::Local pData, bool bDefaultPersistent) { if (propname.IsEmpty()) diff --git a/fpdfsdk/javascript/global.h b/fpdfsdk/javascript/global.h index 364313c972..5005b2aeed 100644 --- a/fpdfsdk/javascript/global.h +++ b/fpdfsdk/javascript/global.h @@ -25,7 +25,7 @@ struct JSGlobalData { JS_GlobalDataType nType; double dData; bool bData; - CFX_ByteString sData; + ByteString sData; v8::Global pData; bool bPersistent; bool bDeleted; @@ -39,26 +39,26 @@ class JSGlobalAlternate : public CJS_EmbedObj { bool setPersistent(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool QueryProperty(const wchar_t* propname); bool DoProperty(CJS_Runtime* pRuntime, const wchar_t* propname, CJS_PropValue& vp, - CFX_WideString& sError); + WideString& sError); bool DelProperty(CJS_Runtime* pRuntime, const wchar_t* propname, - CFX_WideString& sError); + WideString& sError); void Initial(CPDFSDK_FormFillEnvironment* pFormFillEnv); private: void UpdateGlobalPersistentVariables(); void CommitGlobalPersisitentVariables(CJS_Runtime* pRuntime); void DestroyGlobalPersisitentVariables(); - bool SetGlobalVariables(const CFX_ByteString& propname, + bool SetGlobalVariables(const ByteString& propname, JS_GlobalDataType nType, double dData, bool bData, - const CFX_ByteString& sData, + const ByteString& sData, v8::Local pData, bool bDefaultPersistent); void ObjectToArray(CJS_Runtime* pRuntime, @@ -66,8 +66,8 @@ class JSGlobalAlternate : public CJS_EmbedObj { CJS_GlobalVariableArray& array); void PutObjectProperty(v8::Local obj, CJS_KeyValue* pData); - std::map> m_MapGlobal; - CFX_WideString m_sFilePath; + std::map> m_MapGlobal; + WideString m_sFilePath; CJS_GlobalData* m_pGlobalData; CPDFSDK_FormFillEnvironment::ObservedPtr m_pFormFillEnv; }; diff --git a/fpdfsdk/javascript/ijs_event_context.h b/fpdfsdk/javascript/ijs_event_context.h index 8428072cdd..5d2d712e96 100644 --- a/fpdfsdk/javascript/ijs_event_context.h +++ b/fpdfsdk/javascript/ijs_event_context.h @@ -20,13 +20,12 @@ class CPDFSDK_FormFillEnvironment; // may trigger new events on top of one another. class IJS_EventContext { public: - virtual bool RunScript(const CFX_WideString& script, - CFX_WideString* info) = 0; + virtual bool RunScript(const WideString& script, WideString* info) = 0; virtual void OnApp_Init() = 0; virtual void OnDoc_Open(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& strTargetName) = 0; + const WideString& strTargetName) = 0; virtual void OnDoc_WillPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0; virtual void OnDoc_DidPrint(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0; virtual void OnDoc_WillSave(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0; @@ -53,38 +52,38 @@ class IJS_EventContext { virtual void OnField_Focus(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) = 0; + const WideString& Value) = 0; virtual void OnField_Blur(bool bModifier, bool bShift, CPDF_FormField* pTarget, - const CFX_WideString& Value) = 0; + const WideString& Value) = 0; virtual void OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) = 0; virtual void OnField_Format(CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit) = 0; - virtual void OnField_Keystroke(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + virtual void OnField_Keystroke(WideString& strChange, + const WideString& strChangeEx, bool KeyDown, bool bModifier, int& nSelEnd, int& nSelStart, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool bWillCommit, bool bFieldFull, bool& bRc) = 0; - virtual void OnField_Validate(CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + virtual void OnField_Validate(WideString& strChange, + const WideString& strChangeEx, bool bKeyDown, bool bModifier, bool bShift, CPDF_FormField* pTarget, - CFX_WideString& Value, + WideString& Value, bool& bRc) = 0; virtual void OnScreen_Focus(bool bModifier, @@ -122,7 +121,7 @@ class IJS_EventContext { virtual void OnLink_MouseUp(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0; virtual void OnMenu_Exec(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString&) = 0; + const WideString&) = 0; virtual void OnBatchExec(CPDFSDK_FormFillEnvironment* pFormFillEnv) = 0; virtual void OnConsole_Exec() = 0; virtual void OnExternal_Exec() = 0; diff --git a/fpdfsdk/javascript/ijs_runtime.h b/fpdfsdk/javascript/ijs_runtime.h index babc41842c..a21ce809ac 100644 --- a/fpdfsdk/javascript/ijs_runtime.h +++ b/fpdfsdk/javascript/ijs_runtime.h @@ -28,13 +28,12 @@ class IJS_Runtime { virtual IJS_EventContext* NewEventContext() = 0; virtual void ReleaseEventContext(IJS_EventContext* pContext) = 0; virtual CPDFSDK_FormFillEnvironment* GetFormFillEnv() const = 0; - virtual int ExecuteScript(const CFX_WideString& script, - CFX_WideString* info) = 0; + virtual int ExecuteScript(const WideString& script, WideString* info) = 0; #ifdef PDF_ENABLE_XFA - virtual bool GetValueByName(const CFX_ByteStringC& utf8Name, + virtual bool GetValueByName(const ByteStringView& utf8Name, CFXJSE_Value* pValue) = 0; - virtual bool SetValueByName(const CFX_ByteStringC& utf8Name, + virtual bool SetValueByName(const ByteStringView& utf8Name, CFXJSE_Value* pValue) = 0; #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/javascript/public_methods_embeddertest.cpp b/fpdfsdk/javascript/public_methods_embeddertest.cpp index 24793667b0..f6af01f4c1 100644 --- a/fpdfsdk/javascript/public_methods_embeddertest.cpp +++ b/fpdfsdk/javascript/public_methods_embeddertest.cpp @@ -103,7 +103,7 @@ TEST_F(PublicMethodsEmbedderTest, MakeFormatDate) { v8::Isolate::Scope isolate_scope(isolate()); v8::HandleScope handle_scope(isolate()); v8::Context::Scope context_scope(GetV8Context()); - CFX_WideString formatted_date; + WideString formatted_date; // 1968-06-25 formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"ddmmyy"); diff --git a/fpdfsdk/javascript/report.cpp b/fpdfsdk/javascript/report.cpp index c9c986d195..45509437a3 100644 --- a/fpdfsdk/javascript/report.cpp +++ b/fpdfsdk/javascript/report.cpp @@ -29,7 +29,7 @@ Report::~Report() {} bool Report::writeText(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } @@ -37,7 +37,7 @@ bool Report::writeText(CJS_Runtime* pRuntime, bool Report::save(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { // Unsafe, not supported. return true; } diff --git a/fpdfsdk/javascript/report.h b/fpdfsdk/javascript/report.h index c66db80fd1..0f040c6c4e 100644 --- a/fpdfsdk/javascript/report.h +++ b/fpdfsdk/javascript/report.h @@ -20,11 +20,11 @@ class Report : public CJS_EmbedObj { bool save(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool writeText(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); }; class CJS_Report : public CJS_Object { diff --git a/fpdfsdk/javascript/resource.cpp b/fpdfsdk/javascript/resource.cpp index 6113c54338..8ca5b2a3b7 100644 --- a/fpdfsdk/javascript/resource.cpp +++ b/fpdfsdk/javascript/resource.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/javascript/resource.h" -CFX_WideString JSGetStringFromID(uint32_t id) { +WideString JSGetStringFromID(uint32_t id) { switch (id) { case IDS_STRING_JSALERT: return L"Alert"; @@ -54,13 +54,13 @@ CFX_WideString JSGetStringFromID(uint32_t id) { } } -CFX_WideString JSFormatErrorString(const char* class_name, - const char* property_name, - const CFX_WideString& details) { - CFX_WideString result = CFX_WideString::FromLocal(class_name); +WideString JSFormatErrorString(const char* class_name, + const char* property_name, + const WideString& details) { + WideString result = WideString::FromLocal(class_name); if (property_name) { result += L"."; - result += CFX_WideString::FromLocal(property_name); + result += WideString::FromLocal(property_name); } result += L": "; result += details; diff --git a/fpdfsdk/javascript/resource.h b/fpdfsdk/javascript/resource.h index af7788ff7d..3891918259 100644 --- a/fpdfsdk/javascript/resource.h +++ b/fpdfsdk/javascript/resource.h @@ -32,9 +32,9 @@ class CJS_EventContext; #define IDS_STRING_JSNOPERMISSION 25639 #define IDS_STRING_JSBADOBJECT 25640 -CFX_WideString JSGetStringFromID(uint32_t id); -CFX_WideString JSFormatErrorString(const char* class_name, - const char* property_name, - const CFX_WideString& details); +WideString JSGetStringFromID(uint32_t id); +WideString JSFormatErrorString(const char* class_name, + const char* property_name, + const WideString& details); #endif // FPDFSDK_JAVASCRIPT_RESOURCE_H_ diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp index e00f9e1560..04f1eb36cd 100644 --- a/fpdfsdk/javascript/util.cpp +++ b/fpdfsdk/javascript/util.cpp @@ -76,7 +76,7 @@ util::~util() {} bool util::printf(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { const size_t iSize = params.size(); if (iSize < 1) return false; @@ -111,7 +111,7 @@ bool util::printf(CJS_Runtime* pRuntime, continue; } - CFX_WideString strSegment; + WideString strSegment; switch (ParseDataType(&c_strFormat)) { case UTIL_INT: strSegment.Format(c_strFormat.c_str(), params[iIndex].ToInt(pRuntime)); @@ -139,7 +139,7 @@ bool util::printf(CJS_Runtime* pRuntime, bool util::printd(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { const size_t iSize = params.size(); if (iSize < 2) return false; @@ -158,7 +158,7 @@ bool util::printd(CJS_Runtime* pRuntime, } if (p1.GetType() == CJS_Value::VT_number) { - CFX_WideString swResult; + WideString swResult; switch (p1.ToInt(pRuntime)) { case 0: swResult.Format(L"D:%04d%02d%02d%02d%02d%02d", jsDate.GetYear(pRuntime), @@ -231,7 +231,7 @@ bool util::printd(CJS_Runtime* pRuntime, }; for (size_t i = 0; i < FX_ArraySize(cTableAd); ++i) { - CFX_WideString sValue; + WideString sValue; sValue.Format(L"%d", cTableAd[i].iValue); int iStart = 0; @@ -271,7 +271,7 @@ bool util::printd(CJS_Runtime* pRuntime, bool util::printx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() < 2) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -294,9 +294,9 @@ static wchar_t TranslateCase(wchar_t input, CaseMode eMode) { return input; } -CFX_WideString util::printx(const CFX_WideString& wsFormat, - const CFX_WideString& wsSource) { - CFX_WideString wsResult; +WideString util::printx(const WideString& wsFormat, + const WideString& wsSource) { + WideString wsResult; FX_STRSIZE iSourceIdx = 0; FX_STRSIZE iFormatIdx = 0; CaseMode eCaseMode = kPreserveCase; @@ -385,12 +385,12 @@ CFX_WideString util::printx(const CFX_WideString& wsFormat, bool util::scand(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() < 2) return false; - CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime); - CFX_WideString sDate = params[1].ToCFXWideString(pRuntime); + WideString sFormat = params[0].ToCFXWideString(pRuntime); + WideString sDate = params[1].ToCFXWideString(pRuntime); double dDate = JS_GetDateTime(); if (sDate.GetLength() > 0) { dDate = CJS_PublicMethods::MakeRegularDate(sDate, sFormat, nullptr); @@ -408,7 +408,7 @@ bool util::scand(CJS_Runtime* pRuntime, bool util::byteToChar(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError) { + WideString& sError) { if (params.size() < 1) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -420,7 +420,7 @@ bool util::byteToChar(CJS_Runtime* pRuntime, return false; } - CFX_WideString wStr(static_cast(arg)); + WideString wStr(static_cast(arg)); vRet = CJS_Value(pRuntime, wStr.c_str()); return true; } diff --git a/fpdfsdk/javascript/util.h b/fpdfsdk/javascript/util.h index 60fa631dad..ba46e4f6c7 100644 --- a/fpdfsdk/javascript/util.h +++ b/fpdfsdk/javascript/util.h @@ -25,26 +25,26 @@ class util : public CJS_EmbedObj { bool printd(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool printf(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool printx(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool scand(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); bool byteToChar(CJS_Runtime* pRuntime, const std::vector& params, CJS_Value& vRet, - CFX_WideString& sError); + WideString& sError); - static CFX_WideString printx(const CFX_WideString& cFormat, - const CFX_WideString& cSource); + static WideString printx(const WideString& cFormat, + const WideString& cSource); private: friend class CJS_Util_ParseDataType_Test; -- cgit v1.2.3