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/cba_annotiterator.cpp | 2 +- fpdfsdk/cfx_systemhandler.cpp | 8 +- fpdfsdk/cfx_systemhandler.h | 4 +- fpdfsdk/cpdfsdk_annothandlermgr.cpp | 7 +- fpdfsdk/cpdfsdk_annothandlermgr.h | 5 +- fpdfsdk/cpdfsdk_baannot.cpp | 18 +- fpdfsdk/cpdfsdk_baannot.h | 12 +- fpdfsdk/cpdfsdk_baannothandler.cpp | 6 +- fpdfsdk/cpdfsdk_baannothandler.h | 5 +- fpdfsdk/cpdfsdk_datetime.cpp | 22 +- fpdfsdk/cpdfsdk_datetime.h | 8 +- fpdfsdk/cpdfsdk_formfillenvironment.cpp | 98 +++---- fpdfsdk/cpdfsdk_formfillenvironment.h | 24 +- fpdfsdk/cpdfsdk_interform.cpp | 67 +++-- fpdfsdk/cpdfsdk_interform.h | 25 +- fpdfsdk/cpdfsdk_pageview.cpp | 6 +- fpdfsdk/cpdfsdk_pageview.h | 4 +- fpdfsdk/cpdfsdk_widget.cpp | 36 +-- fpdfsdk/cpdfsdk_widget.h | 20 +- fpdfsdk/cpdfsdk_widgethandler.cpp | 8 +- fpdfsdk/cpdfsdk_widgethandler.h | 5 +- fpdfsdk/cpdfsdk_xfawidgethandler.cpp | 7 +- fpdfsdk/cpdfsdk_xfawidgethandler.h | 5 +- fpdfsdk/formfiller/cba_fontmap.cpp | 27 +- fpdfsdk/formfiller/cba_fontmap.h | 18 +- fpdfsdk/formfiller/cffl_combobox.cpp | 12 +- fpdfsdk/formfiller/cffl_combobox.h | 4 +- fpdfsdk/formfiller/cffl_formfiller.cpp | 8 +- fpdfsdk/formfiller/cffl_formfiller.h | 4 +- fpdfsdk/formfiller/cffl_interactiveformfiller.cpp | 14 +- fpdfsdk/formfiller/cffl_interactiveformfiller.h | 8 +- fpdfsdk/formfiller/cffl_textfield.cpp | 10 +- fpdfsdk/formfiller/cffl_textfield.h | 2 +- fpdfsdk/fpdf_ext.cpp | 20 +- fpdfsdk/fpdf_flatten.cpp | 26 +- fpdfsdk/fpdf_structtree.cpp | 4 +- fpdfsdk/fpdf_structtree_embeddertest.cpp | 8 +- fpdfsdk/fpdf_sysfontinfo.cpp | 8 +- fpdfsdk/fpdf_transformpage.cpp | 10 +- fpdfsdk/fpdfannot.cpp | 2 +- fpdfsdk/fpdfattachment.cpp | 27 +- fpdfsdk/fpdfdoc.cpp | 16 +- fpdfsdk/fpdfdoc_embeddertest.cpp | 57 ++-- fpdfsdk/fpdfedit_embeddertest.cpp | 4 +- fpdfsdk/fpdfeditimg.cpp | 2 +- fpdfsdk/fpdfeditpage.cpp | 2 +- fpdfsdk/fpdfedittext.cpp | 19 +- fpdfsdk/fpdfformfill.cpp | 34 +-- fpdfsdk/fpdfformfill_embeddertest.cpp | 5 +- fpdfsdk/fpdfppo.cpp | 20 +- fpdfsdk/fpdftext.cpp | 16 +- fpdfsdk/fpdfview.cpp | 24 +- fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | 48 ++-- fpdfsdk/fpdfxfa/cpdfxfa_context.h | 40 +-- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp | 103 ++++--- fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h | 28 +- fpdfsdk/fsdk_actionhandler.cpp | 42 +-- fpdfsdk/fsdk_actionhandler.h | 10 +- fpdfsdk/fsdk_define.h | 4 +- fpdfsdk/fsdk_filewriteadapter.cpp | 2 +- fpdfsdk/fsdk_filewriteadapter.h | 2 +- fpdfsdk/ipdfsdk_annothandler.h | 4 +- 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 +- fpdfsdk/pdfsdk_fieldaction.h | 6 +- fpdfsdk/pwl/cpwl_appstream.cpp | 293 ++++++++++--------- fpdfsdk/pwl/cpwl_appstream.h | 20 +- fpdfsdk/pwl/cpwl_button.cpp | 2 +- fpdfsdk/pwl/cpwl_button.h | 2 +- fpdfsdk/pwl/cpwl_caret.cpp | 2 +- fpdfsdk/pwl/cpwl_caret.h | 2 +- fpdfsdk/pwl/cpwl_combo_box.cpp | 16 +- fpdfsdk/pwl/cpwl_combo_box.h | 12 +- fpdfsdk/pwl/cpwl_edit.cpp | 20 +- fpdfsdk/pwl/cpwl_edit.h | 10 +- fpdfsdk/pwl/cpwl_edit_ctrl.cpp | 8 +- fpdfsdk/pwl/cpwl_edit_ctrl.h | 6 +- fpdfsdk/pwl/cpwl_edit_impl.cpp | 38 +-- fpdfsdk/pwl/cpwl_edit_impl.h | 28 +- fpdfsdk/pwl/cpwl_font_map.cpp | 52 ++-- fpdfsdk/pwl/cpwl_font_map.h | 35 ++- fpdfsdk/pwl/cpwl_icon.cpp | 6 +- fpdfsdk/pwl/cpwl_icon.h | 2 +- fpdfsdk/pwl/cpwl_list_box.cpp | 10 +- fpdfsdk/pwl/cpwl_list_box.h | 6 +- fpdfsdk/pwl/cpwl_list_impl.cpp | 12 +- fpdfsdk/pwl/cpwl_list_impl.h | 12 +- fpdfsdk/pwl/cpwl_scroll_bar.cpp | 4 +- fpdfsdk/pwl/cpwl_scroll_bar.h | 4 +- fpdfsdk/pwl/cpwl_special_button.cpp | 6 +- fpdfsdk/pwl/cpwl_special_button.h | 6 +- fpdfsdk/pwl/cpwl_wnd.cpp | 8 +- fpdfsdk/pwl/cpwl_wnd.h | 6 +- 133 files changed, 1916 insertions(+), 2099 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/cba_annotiterator.cpp b/fpdfsdk/cba_annotiterator.cpp index 3e35ff8294..d1c9599cf6 100644 --- a/fpdfsdk/cba_annotiterator.cpp +++ b/fpdfsdk/cba_annotiterator.cpp @@ -34,7 +34,7 @@ CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView, m_pPageView(pPageView), m_nAnnotSubtype(nAnnotSubtype) { CPDF_Page* pPDFPage = m_pPageView->GetPDFPage(); - CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetStringFor("Tabs"); + ByteString sTabs = pPDFPage->m_pFormDict->GetStringFor("Tabs"); if (sTabs == "R") m_eTabOrder = ROW; else if (sTabs == "C") diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp index c8b1ef4b04..9534d7bd19 100644 --- a/fpdfsdk/cfx_systemhandler.cpp +++ b/fpdfsdk/cfx_systemhandler.cpp @@ -89,7 +89,7 @@ void CFX_SystemHandler::SetCursor(int32_t nCursorType) { m_pFormFillEnv->SetCursor(nCursorType); } -bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) { +bool CFX_SystemHandler::FindNativeTrueTypeFont(ByteString sFontFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); if (!pFontMgr) return false; @@ -102,11 +102,11 @@ bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) { pFontMapper->LoadInstalledFonts(); for (const auto& font : pFontMapper->m_InstalledTTFonts) { - if (font.Compare(sFontFaceName.AsStringC())) + if (font.Compare(sFontFaceName.AsStringView())) return true; } for (const auto& fontPair : pFontMapper->m_LocalizedTTFonts) { - if (fontPair.first.Compare(sFontFaceName.AsStringC())) + if (fontPair.first.Compare(sFontFaceName.AsStringView())) return true; } return false; @@ -114,7 +114,7 @@ bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) { CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF( CPDF_Document* pDoc, - CFX_ByteString sFontFaceName, + ByteString sFontFaceName, uint8_t nCharset) { if (!pDoc) return nullptr; diff --git a/fpdfsdk/cfx_systemhandler.h b/fpdfsdk/cfx_systemhandler.h index c52630533f..a2ad02438e 100644 --- a/fpdfsdk/cfx_systemhandler.h +++ b/fpdfsdk/cfx_systemhandler.h @@ -58,9 +58,9 @@ class CFX_SystemHandler { void OutputSelectedRect(CFFL_FormFiller* pFormFiller, CFX_FloatRect& rect); bool IsSelectionImplemented() const; void SetCursor(int32_t nCursorType); - bool FindNativeTrueTypeFont(CFX_ByteString sFontFaceName); + bool FindNativeTrueTypeFont(ByteString sFontFaceName); CPDF_Font* AddNativeTrueTypeFontToPDF(CPDF_Document* pDoc, - CFX_ByteString sFontFaceName, + ByteString sFontFaceName, uint8_t nCharset); int32_t SetTimer(int32_t uElapse, TimerCallback lpTimerFunc); diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp index a1ac14cc69..2966b4d19b 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -76,14 +76,13 @@ void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) { GetAnnotHandler(pAnnot)->OnLoad(pAnnot); } -CFX_WideString CPDFSDK_AnnotHandlerMgr::Annot_GetSelectedText( +WideString CPDFSDK_AnnotHandlerMgr::Annot_GetSelectedText( CPDFSDK_Annot* pAnnot) { return GetAnnotHandler(pAnnot)->GetSelectedText(pAnnot); } -void CPDFSDK_AnnotHandlerMgr::Annot_ReplaceSelection( - CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) { +void CPDFSDK_AnnotHandlerMgr::Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot, + const WideString& text) { GetAnnotHandler(pAnnot)->ReplaceSelection(pAnnot, text); } diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.h b/fpdfsdk/cpdfsdk_annothandlermgr.h index 32f8b4a526..21ccb3a2fb 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.h +++ b/fpdfsdk/cpdfsdk_annothandlermgr.h @@ -42,9 +42,8 @@ class CPDFSDK_AnnotHandlerMgr { void Annot_OnCreate(CPDFSDK_Annot* pAnnot); void Annot_OnLoad(CPDFSDK_Annot* pAnnot); - CFX_WideString Annot_GetSelectedText(CPDFSDK_Annot* pAnnot); - void Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text); + WideString Annot_GetSelectedText(CPDFSDK_Annot* pAnnot); + void Annot_ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text); IPDFSDK_AnnotHandler* GetAnnotHandler(CPDFSDK_Annot* pAnnot) const; void Annot_OnDraw(CPDFSDK_PageView* pPageView, diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index 9f21d3c7e4..711d228ec3 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp @@ -101,7 +101,7 @@ void CPDFSDK_BAAnnot::ClearCachedAP() { m_pAnnot->ClearCachedAP(); } -void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) { +void CPDFSDK_BAAnnot::SetContents(const WideString& sContents) { if (sContents.IsEmpty()) { m_pAnnot->GetAnnotDict()->RemoveFor("Contents"); } else { @@ -110,11 +110,11 @@ void CPDFSDK_BAAnnot::SetContents(const CFX_WideString& sContents) { } } -CFX_WideString CPDFSDK_BAAnnot::GetContents() const { +WideString CPDFSDK_BAAnnot::GetContents() const { return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("Contents"); } -void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) { +void CPDFSDK_BAAnnot::SetAnnotName(const WideString& sName) { if (sName.IsEmpty()) { m_pAnnot->GetAnnotDict()->RemoveFor("NM"); } else { @@ -123,13 +123,13 @@ void CPDFSDK_BAAnnot::SetAnnotName(const CFX_WideString& sName) { } } -CFX_WideString CPDFSDK_BAAnnot::GetAnnotName() const { +WideString CPDFSDK_BAAnnot::GetAnnotName() const { return m_pAnnot->GetAnnotDict()->GetUnicodeTextFor("NM"); } void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) { CPDFSDK_DateTime dt(st); - CFX_ByteString str = dt.ToPDFDateTimeString(); + ByteString str = dt.ToPDFDateTimeString(); if (str.IsEmpty()) m_pAnnot->GetAnnotDict()->RemoveFor("M"); else @@ -138,7 +138,7 @@ void CPDFSDK_BAAnnot::SetModifiedDate(const FX_SYSTEMTIME& st) { FX_SYSTEMTIME CPDFSDK_BAAnnot::GetModifiedDate() const { FX_SYSTEMTIME systime; - CFX_ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M"); + ByteString str = m_pAnnot->GetAnnotDict()->GetStringFor("M"); CPDFSDK_DateTime dt(str); dt.ToSystemTime(systime); return systime; @@ -153,14 +153,14 @@ uint32_t CPDFSDK_BAAnnot::GetFlags() const { return m_pAnnot->GetAnnotDict()->GetIntegerFor("F"); } -void CPDFSDK_BAAnnot::SetAppState(const CFX_ByteString& str) { +void CPDFSDK_BAAnnot::SetAppState(const ByteString& str) { if (str.IsEmpty()) m_pAnnot->GetAnnotDict()->RemoveFor("AS"); else m_pAnnot->GetAnnotDict()->SetNewFor("AS", str, false); } -CFX_ByteString CPDFSDK_BAAnnot::GetAppState() const { +ByteString CPDFSDK_BAAnnot::GetAppState() const { return m_pAnnot->GetAnnotDict()->GetStringFor("AS"); } @@ -225,7 +225,7 @@ void CPDFSDK_BAAnnot::SetBorderStyle(BorderStyle nStyle) { BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const { CPDF_Dictionary* pBSDict = m_pAnnot->GetAnnotDict()->GetDictFor("BS"); if (pBSDict) { - CFX_ByteString sBorderStyle = pBSDict->GetStringFor("S", "S"); + ByteString sBorderStyle = pBSDict->GetStringFor("S", "S"); if (sBorderStyle == "S") return BorderStyle::SOLID; if (sBorderStyle == "D") diff --git a/fpdfsdk/cpdfsdk_baannot.h b/fpdfsdk/cpdfsdk_baannot.h index 3b60b1b1b8..1d71585a35 100644 --- a/fpdfsdk/cpdfsdk_baannot.h +++ b/fpdfsdk/cpdfsdk_baannot.h @@ -38,11 +38,11 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot { CPDF_Dictionary* GetAPDict() const; - void SetContents(const CFX_WideString& sContents); - CFX_WideString GetContents() const; + void SetContents(const WideString& sContents); + WideString GetContents() const; - void SetAnnotName(const CFX_WideString& sName); - CFX_WideString GetAnnotName() const; + void SetAnnotName(const WideString& sName); + WideString GetAnnotName() const; void SetModifiedDate(const FX_SYSTEMTIME& st); FX_SYSTEMTIME GetModifiedDate() const; @@ -50,8 +50,8 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot { void SetFlags(uint32_t nFlags); uint32_t GetFlags() const; - void SetAppState(const CFX_ByteString& str); - CFX_ByteString GetAppState() const; + void SetAppState(const ByteString& str); + ByteString GetAppState() const; void SetStructParent(int key); int GetStructParent() const; diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp index 6cf399a04a..027527ec5f 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.cpp +++ b/fpdfsdk/cpdfsdk_baannothandler.cpp @@ -193,12 +193,12 @@ CFX_FloatRect CPDFSDK_BAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView, return pAnnot->GetRect(); } -CFX_WideString CPDFSDK_BAAnnotHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) { - return CFX_WideString(); +WideString CPDFSDK_BAAnnotHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) { + return WideString(); } void CPDFSDK_BAAnnotHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) {} + const WideString& text) {} bool CPDFSDK_BAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, diff --git a/fpdfsdk/cpdfsdk_baannothandler.h b/fpdfsdk/cpdfsdk_baannothandler.h index 2ed9ed8334..7bf8034a54 100644 --- a/fpdfsdk/cpdfsdk_baannothandler.h +++ b/fpdfsdk/cpdfsdk_baannothandler.h @@ -36,9 +36,8 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler { void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; - CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override; - void ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) override; + WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override; + void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override; bool HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, const CFX_PointF& point) override; diff --git a/fpdfsdk/cpdfsdk_datetime.cpp b/fpdfsdk/cpdfsdk_datetime.cpp index d2653fca74..ce22cae12f 100644 --- a/fpdfsdk/cpdfsdk_datetime.cpp +++ b/fpdfsdk/cpdfsdk_datetime.cpp @@ -63,7 +63,7 @@ CPDFSDK_DateTime::CPDFSDK_DateTime() { ResetDateTime(); } -CPDFSDK_DateTime::CPDFSDK_DateTime(const CFX_ByteString& dtStr) { +CPDFSDK_DateTime::CPDFSDK_DateTime(const ByteString& dtStr) { ResetDateTime(); FromPDFDateTimeString(dtStr); } @@ -129,7 +129,7 @@ time_t CPDFSDK_DateTime::ToTime_t() const { } CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( - const CFX_ByteString& dtStr) { + const ByteString& dtStr) { int strLength = dtStr.GetLength(); if (strLength <= 0) return *this; @@ -263,34 +263,34 @@ CPDFSDK_DateTime& CPDFSDK_DateTime::FromPDFDateTimeString( return *this; } -CFX_ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { - CFX_ByteString str1; +ByteString CPDFSDK_DateTime::ToCommonDateTimeString() { + ByteString str1; str1.Format("%04d-%02u-%02u %02u:%02u:%02u ", m_year, m_month, m_day, m_hour, m_minute, m_second); if (m_tzHour < 0) str1 += "-"; else str1 += "+"; - CFX_ByteString str2; + ByteString str2; str2.Format("%02d:%02u", std::abs(static_cast(m_tzHour)), m_tzMinute); return str1 + str2; } -CFX_ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { - CFX_ByteString dtStr; +ByteString CPDFSDK_DateTime::ToPDFDateTimeString() { + ByteString dtStr; char tempStr[32]; memset(tempStr, 0, sizeof(tempStr)); FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "D:%04d%02u%02u%02u%02u%02u", m_year, m_month, m_day, m_hour, m_minute, m_second); - dtStr = CFX_ByteString(tempStr); + dtStr = ByteString(tempStr); if (m_tzHour < 0) - dtStr += CFX_ByteString("-"); + dtStr += ByteString("-"); else - dtStr += CFX_ByteString("+"); + dtStr += ByteString("+"); memset(tempStr, 0, sizeof(tempStr)); FXSYS_snprintf(tempStr, sizeof(tempStr) - 1, "%02d'%02u'", std::abs(static_cast(m_tzHour)), m_tzMinute); - dtStr += CFX_ByteString(tempStr); + dtStr += ByteString(tempStr); return dtStr; } diff --git a/fpdfsdk/cpdfsdk_datetime.h b/fpdfsdk/cpdfsdk_datetime.h index 6b612b27bc..08d43cc200 100644 --- a/fpdfsdk/cpdfsdk_datetime.h +++ b/fpdfsdk/cpdfsdk_datetime.h @@ -18,16 +18,16 @@ class CPDFSDK_DateTime { public: CPDFSDK_DateTime(); - explicit CPDFSDK_DateTime(const CFX_ByteString& dtStr); + explicit CPDFSDK_DateTime(const ByteString& dtStr); explicit CPDFSDK_DateTime(const FX_SYSTEMTIME& st); CPDFSDK_DateTime(const CPDFSDK_DateTime& datetime); bool operator==(const CPDFSDK_DateTime& datetime) const; bool operator!=(const CPDFSDK_DateTime& datetime) const; - CPDFSDK_DateTime& FromPDFDateTimeString(const CFX_ByteString& dtStr); - CFX_ByteString ToCommonDateTimeString(); - CFX_ByteString ToPDFDateTimeString(); + CPDFSDK_DateTime& FromPDFDateTimeString(const ByteString& dtStr); + ByteString ToCommonDateTimeString(); + ByteString ToPDFDateTimeString(); void ToSystemTime(FX_SYSTEMTIME& st); time_t ToTime_t() const; CPDFSDK_DateTime ToGMT() const; diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index a258026a7d..300a742809 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -24,7 +24,7 @@ namespace { // NOTE: |bsUTF16LE| must outlive the use of the result. Care must be taken // since modifying the result would impact |bsUTF16LE|. -FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) { +FPDF_WIDESTRING AsFPDFWideString(ByteString* bsUTF16LE) { return reinterpret_cast( bsUTF16LE->GetBuffer(bsUTF16LE->GetLength())); } @@ -69,8 +69,8 @@ int CPDFSDK_FormFillEnvironment::JS_appAlert(const wchar_t* Msg, !m_pInfo->m_pJsPlatform->app_alert) { return -1; } - CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode(); - CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode(); + ByteString bsMsg = WideString(Msg).UTF16LE_Encode(); + ByteString bsTitle = WideString(Title).UTF16LE_Encode(); return m_pInfo->m_pJsPlatform->app_alert( m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsMsg), AsFPDFWideString(&bsTitle), Type, Icon); @@ -87,10 +87,10 @@ int CPDFSDK_FormFillEnvironment::JS_appResponse(const wchar_t* Question, !m_pInfo->m_pJsPlatform->app_response) { return -1; } - CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode(); - CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode(); - CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode(); - CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode(); + ByteString bsQuestion = WideString(Question).UTF16LE_Encode(); + ByteString bsTitle = WideString(Title).UTF16LE_Encode(); + ByteString bsDefault = WideString(Default).UTF16LE_Encode(); + ByteString bsLabel = WideString(cLabel).UTF16LE_Encode(); return m_pInfo->m_pJsPlatform->app_response( m_pInfo->m_pJsPlatform, AsFPDFWideString(&bsQuestion), AsFPDFWideString(&bsTitle), AsFPDFWideString(&bsDefault), @@ -105,44 +105,44 @@ void CPDFSDK_FormFillEnvironment::JS_appBeep(int nType) { m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); } -CFX_WideString CPDFSDK_FormFillEnvironment::JS_fieldBrowse() { +WideString CPDFSDK_FormFillEnvironment::JS_fieldBrowse() { if (!m_pInfo || !m_pInfo->m_pJsPlatform || !m_pInfo->m_pJsPlatform->Field_browse) { - return CFX_WideString(); + return WideString(); } const int nRequiredLen = m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, nullptr, 0); if (nRequiredLen <= 0) - return CFX_WideString(); + return WideString(); std::vector pBuff(nRequiredLen); const int nActualLen = m_pInfo->m_pJsPlatform->Field_browse( m_pInfo->m_pJsPlatform, pBuff.data(), nRequiredLen); if (nActualLen <= 0 || nActualLen > nRequiredLen) - return CFX_WideString(); + return WideString(); pBuff.resize(nActualLen); - return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff)); + return WideString::FromLocal(ByteStringView(pBuff)); } -CFX_WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() { +WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() { if (!m_pInfo || !m_pInfo->m_pJsPlatform || !m_pInfo->m_pJsPlatform->Doc_getFilePath) { - return CFX_WideString(); + return WideString(); } const int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( m_pInfo->m_pJsPlatform, nullptr, 0); if (nRequiredLen <= 0) - return CFX_WideString(); + return WideString(); std::vector pBuff(nRequiredLen); const int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath( m_pInfo->m_pJsPlatform, pBuff.data(), nRequiredLen); if (nActualLen <= 0 || nActualLen > nRequiredLen) - return CFX_WideString(); + return WideString(); pBuff.resize(nActualLen); - return CFX_WideString::FromLocal(CFX_ByteStringC(pBuff)); + return WideString::FromLocal(ByteStringView(pBuff)); } void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData, @@ -152,7 +152,7 @@ void CPDFSDK_FormFillEnvironment::JS_docSubmitForm(void* formData, !m_pInfo->m_pJsPlatform->Doc_submitForm) { return; } - CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode(); + ByteString bsDestination = WideString(URL).UTF16LE_Encode(); m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPlatform, formData, length, AsFPDFWideString(&bsDestination)); @@ -170,11 +170,11 @@ void CPDFSDK_FormFillEnvironment::JS_docmailForm(void* mailData, !m_pInfo->m_pJsPlatform->Doc_mail) { return; } - CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode(); - CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode(); - CFX_ByteString bsCC = CFX_WideString(CC).UTF16LE_Encode(); - CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode(); - CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode(); + ByteString bsTo = WideString(To).UTF16LE_Encode(); + ByteString bsSubject = WideString(Subject).UTF16LE_Encode(); + ByteString bsCC = WideString(CC).UTF16LE_Encode(); + ByteString bsBcc = WideString(BCC).UTF16LE_Encode(); + ByteString bsMsg = WideString(Msg).UTF16LE_Encode(); m_pInfo->m_pJsPlatform->Doc_mail( m_pInfo->m_pJsPlatform, mailData, length, bUI, AsFPDFWideString(&bsTo), AsFPDFWideString(&bsSubject), AsFPDFWideString(&bsCC), @@ -350,30 +350,30 @@ void CPDFSDK_FormFillEnvironment::SetCurrentPage(CPDFXFA_Context* document, m_pInfo->FFI_SetCurrentPage(m_pInfo, document, iCurPage); } -CFX_WideString CPDFSDK_FormFillEnvironment::GetPlatform() { +WideString CPDFSDK_FormFillEnvironment::GetPlatform() { if (!m_pInfo || !m_pInfo->FFI_GetPlatform) - return CFX_WideString(); + return WideString(); int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, nullptr, 0); if (nRequiredLen <= 0) - return CFX_WideString(); + return WideString(); std::vector pBuff(nRequiredLen); int nActualLen = m_pInfo->FFI_GetPlatform(m_pInfo, pBuff.data(), nRequiredLen); if (nActualLen <= 0 || nActualLen > nRequiredLen) - return CFX_WideString(); + return WideString(); - return CFX_WideString::FromUTF16LE(reinterpret_cast(pBuff.data()), - nActualLen / sizeof(uint16_t)); + return WideString::FromUTF16LE(reinterpret_cast(pBuff.data()), + nActualLen / sizeof(uint16_t)); } void CPDFSDK_FormFillEnvironment::GotoURL(CPDFXFA_Context* document, - const CFX_WideStringC& wsURL) { + const WideStringView& wsURL) { if (!m_pInfo || !m_pInfo->FFI_GotoURL) return; - CFX_ByteString bsTo = CFX_WideString(wsURL).UTF16LE_Encode(); + ByteString bsTo = WideString(wsURL).UTF16LE_Encode(); FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(wsURL.GetLength()); m_pInfo->FFI_GotoURL(m_pInfo, document, pTo); bsTo.ReleaseBuffer(bsTo.GetStringLength()); @@ -446,7 +446,7 @@ CPDFSDK_FormFillEnvironment::DownloadFromURL(const wchar_t* url) { if (!m_pInfo || !m_pInfo->FFI_DownloadFromURL) return nullptr; - CFX_ByteString bstrURL = CFX_WideString(url).UTF16LE_Encode(); + ByteString bstrURL = WideString(url).UTF16LE_Encode(); FPDF_WIDESTRING wsURL = (FPDF_WIDESTRING)bstrURL.GetBuffer(bstrURL.GetLength()); @@ -454,7 +454,7 @@ CPDFSDK_FormFillEnvironment::DownloadFromURL(const wchar_t* url) { return MakeSeekableStream(fileHandler); } -CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL( +WideString CPDFSDK_FormFillEnvironment::PostRequestURL( const wchar_t* wsURL, const wchar_t* wsData, const wchar_t* wsContentType, @@ -463,21 +463,21 @@ CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL( if (!m_pInfo || !m_pInfo->FFI_PostRequestURL) return L""; - CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); + ByteString bsURL = WideString(wsURL).UTF16LE_Encode(); FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); - CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode(); + ByteString bsData = WideString(wsData).UTF16LE_Encode(); FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength()); - CFX_ByteString bsContentType = CFX_WideString(wsContentType).UTF16LE_Encode(); + ByteString bsContentType = WideString(wsContentType).UTF16LE_Encode(); FPDF_WIDESTRING contentType = (FPDF_WIDESTRING)bsContentType.GetBuffer(bsContentType.GetLength()); - CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode(); + ByteString bsEncode = WideString(wsEncode).UTF16LE_Encode(); FPDF_WIDESTRING encode = (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); - CFX_ByteString bsHeader = CFX_WideString(wsHeader).UTF16LE_Encode(); + ByteString bsHeader = WideString(wsHeader).UTF16LE_Encode(); FPDF_WIDESTRING header = (FPDF_WIDESTRING)bsHeader.GetBuffer(bsHeader.GetLength()); @@ -486,7 +486,7 @@ CFX_WideString CPDFSDK_FormFillEnvironment::PostRequestURL( m_pInfo->FFI_PostRequestURL(m_pInfo, URL, data, contentType, encode, header, &response); - CFX_WideString wsRet = CFX_WideString::FromUTF16LE( + WideString wsRet = WideString::FromUTF16LE( (FPDF_WIDESTRING)response.str, response.len / sizeof(FPDF_WIDESTRING)); FPDF_BStr_Clear(&response); @@ -499,35 +499,35 @@ FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(const wchar_t* wsURL, if (!m_pInfo || !m_pInfo->FFI_PutRequestURL) return false; - CFX_ByteString bsURL = CFX_WideString(wsURL).UTF16LE_Encode(); + ByteString bsURL = WideString(wsURL).UTF16LE_Encode(); FPDF_WIDESTRING URL = (FPDF_WIDESTRING)bsURL.GetBuffer(bsURL.GetLength()); - CFX_ByteString bsData = CFX_WideString(wsData).UTF16LE_Encode(); + ByteString bsData = WideString(wsData).UTF16LE_Encode(); FPDF_WIDESTRING data = (FPDF_WIDESTRING)bsData.GetBuffer(bsData.GetLength()); - CFX_ByteString bsEncode = CFX_WideString(wsEncode).UTF16LE_Encode(); + ByteString bsEncode = WideString(wsEncode).UTF16LE_Encode(); FPDF_WIDESTRING encode = (FPDF_WIDESTRING)bsEncode.GetBuffer(bsEncode.GetLength()); return m_pInfo->FFI_PutRequestURL(m_pInfo, URL, data, encode); } -CFX_WideString CPDFSDK_FormFillEnvironment::GetLanguage() { +WideString CPDFSDK_FormFillEnvironment::GetLanguage() { if (!m_pInfo || !m_pInfo->FFI_GetLanguage) - return CFX_WideString(); + return WideString(); int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, nullptr, 0); if (nRequiredLen <= 0) - return CFX_WideString(); + return WideString(); std::vector pBuff(nRequiredLen); int nActualLen = m_pInfo->FFI_GetLanguage(m_pInfo, pBuff.data(), nRequiredLen); if (nActualLen <= 0 || nActualLen > nRequiredLen) - return CFX_WideString(); + return WideString(); - return CFX_WideString::FromUTF16LE(reinterpret_cast(pBuff.data()), - nActualLen / sizeof(uint16_t)); + return WideString::FromUTF16LE(reinterpret_cast(pBuff.data()), + nActualLen / sizeof(uint16_t)); } void CPDFSDK_FormFillEnvironment::PageEvent(int iPageCount, @@ -583,7 +583,7 @@ void CPDFSDK_FormFillEnvironment::ProcJavascriptFun() { CPDF_DocJSActions docJS(pPDFDoc); int iCount = docJS.CountJSActions(); for (int i = 0; i < iCount; i++) { - CFX_WideString csJSName; + WideString csJSName; CPDF_Action jsAction = docJS.GetJSActionAndName(i, &csJSName); GetActionHandler()->DoAction_JavaScript(jsAction, csJSName, this); } diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.h b/fpdfsdk/cpdfsdk_formfillenvironment.h index c9937405bb..9e3c92561b 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.h +++ b/fpdfsdk/cpdfsdk_formfillenvironment.h @@ -133,10 +133,10 @@ class CPDFSDK_FormFillEnvironment void SetCurrentPage(CPDFXFA_Context* document, int iCurPage); // TODO(dsinclair): This should probably change to PDFium? - CFX_WideString FFI_GetAppName() const { return CFX_WideString(L"Acrobat"); } + WideString FFI_GetAppName() const { return WideString(L"Acrobat"); } - CFX_WideString GetPlatform(); - void GotoURL(CPDFXFA_Context* document, const CFX_WideStringC& wsURL); + WideString GetPlatform(); + void GotoURL(CPDFXFA_Context* document, const WideStringView& wsURL); void GetPageViewRect(CPDFXFA_Page* page, FS_RECTF& dstRect); bool PopupMenu(CPDFXFA_Page* page, FPDF_WIDGET hWidget, @@ -157,15 +157,15 @@ class CPDFSDK_FormFillEnvironment FPDF_WIDESTRING wsURL, const char* mode); CFX_RetainPtr DownloadFromURL(const wchar_t* url); - CFX_WideString PostRequestURL(const wchar_t* wsURL, - const wchar_t* wsData, - const wchar_t* wsContentType, - const wchar_t* wsEncode, - const wchar_t* wsHeader); + WideString PostRequestURL(const wchar_t* wsURL, + const wchar_t* wsData, + const wchar_t* wsContentType, + const wchar_t* wsEncode, + const wchar_t* wsHeader); FPDF_BOOL PutRequestURL(const wchar_t* wsURL, const wchar_t* wsData, const wchar_t* wsEncode); - CFX_WideString GetLanguage(); + WideString GetLanguage(); void PageEvent(int iPageCount, uint32_t dwEventType) const; #else // PDF_ENABLE_XFA @@ -184,8 +184,8 @@ class CPDFSDK_FormFillEnvironment void* response, int length); void JS_appBeep(int nType); - CFX_WideString JS_fieldBrowse(); - CFX_WideString JS_docGetFilePath(); + WideString JS_fieldBrowse(); + WideString JS_docGetFilePath(); void JS_docSubmitForm(void* formData, int length, const wchar_t* URL); void JS_docmailForm(void* mailData, int length, @@ -206,7 +206,7 @@ class CPDFSDK_FormFillEnvironment void JS_docgotoPage(int nPageNum); bool IsJSInitiated() const { return m_pInfo && m_pInfo->m_pJsPlatform; } - CFX_ByteString GetAppName() const { return ""; } + ByteString GetAppName() const { return ""; } CFX_SystemHandler* GetSysHandler() const { return m_pSysHandler.get(); } FPDF_FORMFILLINFO* GetFormFillInfo() const { return m_pInfo; } diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index b60529df5d..fd0dffadba 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -117,7 +117,7 @@ CPDFSDK_Widget* CPDFSDK_InterForm::GetWidget(CPDF_FormControl* pControl) const { } void CPDFSDK_InterForm::GetWidgets( - const CFX_WideString& sFieldName, + const WideString& sFieldName, std::vector* widgets) const { for (int i = 0, sz = m_pInterForm->CountFields(sFieldName); i < sz; ++i) { CPDF_FormField* pFormField = m_pInterForm->GetField(i, sFieldName); @@ -250,17 +250,17 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { if (!action.GetDict()) continue; - CFX_WideString csJS = action.GetJavaScript(); + WideString csJS = action.GetJavaScript(); if (csJS.IsEmpty()) continue; IJS_EventContext* pContext = pRuntime->NewEventContext(); - CFX_WideString sOldValue = pField->GetValue(); - CFX_WideString sValue = sOldValue; + WideString sOldValue = pField->GetValue(); + WideString sValue = sOldValue; bool bRC = true; pContext->OnField_Calculate(pFormField, pField, sValue, bRC); - CFX_WideString sInfo; + WideString sInfo; bool bRet = pContext->RunScript(csJS, &sInfo); pRuntime->ReleaseEventContext(pContext); if (bRet && bRC && sValue.Compare(sOldValue) != 0) @@ -269,9 +269,9 @@ void CPDFSDK_InterForm::OnCalculate(CPDF_FormField* pFormField) { m_bBusy = false; } -CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, - bool& bFormatted) { - CFX_WideString sValue = pFormField->GetValue(); +WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, + bool& bFormatted) { + WideString sValue = pFormField->GetValue(); if (!m_pFormFillEnv->IsJSInitiated()) { bFormatted = false; return sValue; @@ -291,13 +291,13 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, if (aAction.GetDict() && aAction.ActionExist(CPDF_AAction::Format)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::Format); if (action.GetDict()) { - CFX_WideString script = action.GetJavaScript(); + WideString script = action.GetJavaScript(); if (!script.IsEmpty()) { - CFX_WideString Value = sValue; + WideString Value = sValue; IJS_EventContext* pContext = pRuntime->NewEventContext(); pContext->OnField_Format(pFormField, Value, true); - CFX_WideString sInfo; + WideString sInfo; bool bRet = pContext->RunScript(script, &sInfo); pRuntime->ReleaseEventContext(pContext); if (bRet) { @@ -311,7 +311,7 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, } void CPDFSDK_InterForm::ResetFieldAppearance(CPDF_FormField* pFormField, - const CFX_WideString* sValue, + const WideString* sValue, bool bValueChanged) { for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); @@ -339,7 +339,7 @@ void CPDFSDK_InterForm::UpdateField(CPDF_FormField* pFormField) { } bool CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, - const CFX_WideString& csValue) { + const WideString& csValue) { CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::KeyStroke)) return true; @@ -359,7 +359,7 @@ bool CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, } bool CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, - const CFX_WideString& csValue) { + const WideString& csValue) { CPDF_AAction aAction = pFormField->GetAdditionalAction(); if (!aAction.GetDict() || !aAction.ActionExist(CPDF_AAction::Validate)) return true; @@ -412,7 +412,7 @@ bool CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) { } bool CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { - CFX_WideString sDestination = action.GetFilePath(); + WideString sDestination = action.GetFilePath(); if (sDestination.IsEmpty()) return false; @@ -436,11 +436,11 @@ bool CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) { return SubmitForm(sDestination, false); } -bool CPDFSDK_InterForm::SubmitFields(const CFX_WideString& csDestination, +bool CPDFSDK_InterForm::SubmitFields(const WideString& csDestination, const std::vector& fields, bool bIncludeOrExclude, bool bUrlEncoded) { - CFX_ByteString textBuf = ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude); + ByteString textBuf = ExportFieldsToFDFTextBuf(fields, bIncludeOrExclude); FX_STRSIZE nBufSize = textBuf.GetLength(); if (nBufSize == 0) @@ -485,12 +485,12 @@ bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, CPDF_Dictionary* pField = pFields->GetDictAt(i); if (!pField) continue; - CFX_WideString name; + WideString name; name = pField->GetUnicodeTextFor("T"); - CFX_ByteString name_b = CFX_ByteString::FromUnicode(name); - CFX_ByteString csBValue = pField->GetStringFor("V"); - CFX_WideString csWValue = PDF_DecodeText(csBValue); - CFX_ByteString csValue_b = CFX_ByteString::FromUnicode(csWValue); + ByteString name_b = ByteString::FromUnicode(name); + ByteString csBValue = pField->GetStringFor("V"); + WideString csWValue = PDF_DecodeText(csBValue); + ByteString csValue_b = ByteString::FromUnicode(csWValue); fdfEncodedData << name_b.GetBuffer(name_b.GetLength()); name_b.ReleaseBuffer(name_b.GetStringLength()); @@ -510,21 +510,20 @@ bool CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, return true; } -CFX_ByteString CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( +ByteString CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( const std::vector& fields, bool bIncludeOrExclude) { std::unique_ptr pFDF = m_pInterForm->ExportToFDF( m_pFormFillEnv->JS_docGetFilePath(), fields, bIncludeOrExclude, false); - return pFDF ? pFDF->WriteToString() : CFX_ByteString(); + return pFDF ? pFDF->WriteToString() : ByteString(); } -CFX_WideString CPDFSDK_InterForm::GetTemporaryFileName( - const CFX_WideString& sFileExt) { +WideString CPDFSDK_InterForm::GetTemporaryFileName(const WideString& sFileExt) { return L""; } -bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, +bool CPDFSDK_InterForm::SubmitForm(const WideString& sDestination, bool bUrlEncoded) { if (sDestination.IsEmpty()) return false; @@ -537,7 +536,7 @@ bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, if (!pFDFDoc) return false; - CFX_ByteString fdfBuffer = pFDFDoc->WriteToString(); + ByteString fdfBuffer = pFDFDoc->WriteToString(); FX_STRSIZE nBufSize = fdfBuffer.GetLength(); if (nBufSize == 0) @@ -562,11 +561,11 @@ bool CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, return true; } -CFX_ByteString CPDFSDK_InterForm::ExportFormToFDFTextBuf() { +ByteString CPDFSDK_InterForm::ExportFormToFDFTextBuf() { std::unique_ptr pFDF = m_pInterForm->ExportToFDF(m_pFormFillEnv->JS_docGetFilePath(), false); - return pFDF ? pFDF->WriteToString() : CFX_ByteString(); + return pFDF ? pFDF->WriteToString() : ByteString(); } bool CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { @@ -593,7 +592,7 @@ std::vector CPDFSDK_InterForm::GetFieldFromObjects( std::vector fields; for (CPDF_Object* pObject : objects) { if (pObject && pObject->IsString()) { - CFX_WideString csName = pObject->GetUnicodeText(); + WideString csName = pObject->GetUnicodeText(); CPDF_FormField* pField = m_pInterForm->GetField(0, csName); if (pField) fields.push_back(pField); @@ -603,7 +602,7 @@ std::vector CPDFSDK_InterForm::GetFieldFromObjects( } int CPDFSDK_InterForm::BeforeValueChange(CPDF_FormField* pField, - const CFX_WideString& csValue) { + const WideString& csValue) { int nType = pField->GetFieldType(); if (nType != FIELDTYPE_COMBOBOX && nType != FIELDTYPE_TEXTFIELD) return 0; @@ -625,14 +624,14 @@ void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) { if (nType == FIELDTYPE_COMBOBOX || nType == FIELDTYPE_TEXTFIELD) { OnCalculate(pField); bool bFormatted = false; - CFX_WideString sValue = OnFormat(pField, bFormatted); + WideString sValue = OnFormat(pField, bFormatted); ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, true); UpdateField(pField); } } int CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField, - const CFX_WideString& csValue) { + const WideString& csValue) { if (pField->GetFieldType() != FIELDTYPE_LISTBOX) return 0; diff --git a/fpdfsdk/cpdfsdk_interform.h b/fpdfsdk/cpdfsdk_interform.h index b031345158..e14589ec59 100644 --- a/fpdfsdk/cpdfsdk_interform.h +++ b/fpdfsdk/cpdfsdk_interform.h @@ -43,7 +43,7 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { CPDFSDK_Widget* GetSibling(CPDFSDK_Widget* pWidget, bool bNext) const; CPDFSDK_Widget* GetWidget(CPDF_FormControl* pControl) const; - void GetWidgets(const CFX_WideString& sFieldName, + void GetWidgets(const WideString& sFieldName, std::vector* widgets) const; void GetWidgets(CPDF_FormField* pField, std::vector* widgets) const; @@ -65,14 +65,13 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { void SynchronizeField(CPDF_FormField* pFormField, bool bSynchronizeElse); #endif // PDF_ENABLE_XFA - bool OnKeyStrokeCommit(CPDF_FormField* pFormField, - const CFX_WideString& csValue); - bool OnValidate(CPDF_FormField* pFormField, const CFX_WideString& csValue); + bool OnKeyStrokeCommit(CPDF_FormField* pFormField, const WideString& csValue); + bool OnValidate(CPDF_FormField* pFormField, const WideString& csValue); void OnCalculate(CPDF_FormField* pFormField = nullptr); - CFX_WideString OnFormat(CPDF_FormField* pFormField, bool& bFormatted); + WideString OnFormat(CPDF_FormField* pFormField, bool& bFormatted); void ResetFieldAppearance(CPDF_FormField* pFormField, - const CFX_WideString* sValue, + const WideString* sValue, bool bValueChanged); void UpdateField(CPDF_FormField* pFormField); @@ -84,16 +83,16 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { std::vector GetFieldFromObjects( const std::vector& objects) const; bool IsValidField(CPDF_Dictionary* pFieldDict); - bool SubmitFields(const CFX_WideString& csDestination, + bool SubmitFields(const WideString& csDestination, const std::vector& fields, bool bIncludeOrExclude, bool bUrlEncoded); - bool SubmitForm(const CFX_WideString& sDestination, bool bUrlEncoded); - CFX_ByteString ExportFormToFDFTextBuf(); - CFX_ByteString ExportFieldsToFDFTextBuf( + bool SubmitForm(const WideString& sDestination, bool bUrlEncoded); + ByteString ExportFormToFDFTextBuf(); + ByteString ExportFieldsToFDFTextBuf( const std::vector& fields, bool bIncludeOrExclude); - CFX_WideString GetTemporaryFileName(const CFX_WideString& sFileExt); + WideString GetTemporaryFileName(const WideString& sFileExt); bool IsNeedHighLight(int nFieldType); void RemoveAllHighLight(); @@ -105,10 +104,10 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { private: // IPDF_FormNotify: int BeforeValueChange(CPDF_FormField* pField, - const CFX_WideString& csValue) override; + const WideString& csValue) override; void AfterValueChange(CPDF_FormField* pField) override; int BeforeSelectionChange(CPDF_FormField* pField, - const CFX_WideString& csValue) override; + const WideString& csValue) override; void AfterSelectionChange(CPDF_FormField* pField) override; void AfterCheckedStatusChange(CPDF_FormField* pField) override; int BeforeFormReset(CPDF_InterForm* pForm) override; diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp index 5bdd720596..f22d575150 100644 --- a/fpdfsdk/cpdfsdk_pageview.cpp +++ b/fpdfsdk/cpdfsdk_pageview.cpp @@ -241,17 +241,17 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetAnnotByXFAWidget(CXFA_FFWidget* hWidget) { } #endif // PDF_ENABLE_XFA -CFX_WideString CPDFSDK_PageView::GetSelectedText() { +WideString CPDFSDK_PageView::GetSelectedText() { if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); return pAnnotHandlerMgr->Annot_GetSelectedText(pAnnot); } - return CFX_WideString(); + return WideString(); } -void CPDFSDK_PageView::ReplaceSelection(const CFX_WideString& text) { +void CPDFSDK_PageView::ReplaceSelection(const WideString& text) { if (CPDFSDK_Annot* pAnnot = GetFocusAnnot()) { CPDFSDK_AnnotHandlerMgr* pAnnotHandlerMgr = m_pFormFillEnv->GetAnnotHandlerMgr(); diff --git a/fpdfsdk/cpdfsdk_pageview.h b/fpdfsdk/cpdfsdk_pageview.h index 00e90d73e8..b86f30512f 100644 --- a/fpdfsdk/cpdfsdk_pageview.h +++ b/fpdfsdk/cpdfsdk_pageview.h @@ -61,8 +61,8 @@ class CPDFSDK_PageView final : public CPDF_Page::View { return m_pFormFillEnv.Get(); } - CFX_WideString GetSelectedText(); - void ReplaceSelection(const CFX_WideString& text); + WideString GetSelectedText(); + void ReplaceSelection(const WideString& text); bool OnFocus(const CFX_PointF& point, uint32_t nFlag); bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag); diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 0183f587cf..a859dcd374 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -75,7 +75,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const { if (pContext->GetDocType() == XFA_DocType::Static) { if (!m_hMixXFAWidget) { if (CXFA_FFDocView* pDocView = pContext->GetXFADocView()) { - CFX_WideString sName; + WideString sName; if (GetFieldType() == FIELDTYPE_RADIOBUTTON) { sName = GetAnnotName(); if (sName.IsEmpty()) @@ -102,7 +102,7 @@ CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() { if (!pDocView) return nullptr; - CFX_WideString sName = GetName(); + WideString sName = GetName(); return !sName.IsEmpty() ? pDocView->GetWidgetByName(sName, nullptr) : nullptr; } @@ -377,7 +377,7 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, } case FIELDTYPE_TEXTFIELD: { if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { - CFX_WideString sValue; + WideString sValue; pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); pFormField->SetValue(sValue, true); } @@ -409,7 +409,7 @@ void CPDFSDK_Widget::SynchronizeXFAValue(CXFA_FFDocView* pXFADocView, } } - CFX_WideString sValue; + WideString sValue; pWidgetAcc->GetValue(sValue, XFA_VALUEPICTURE_Display); pFormField->SetValue(sValue, true); } @@ -432,7 +432,7 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(false); i < sz; i++) { - CFX_WideString swText; + WideString swText; pWidgetAcc->GetChoiceListItem(swText, i, false); pFormField->InsertOption(swText, i, true); @@ -447,7 +447,7 @@ void CPDFSDK_Widget::SynchronizeXFAItems(CXFA_FFDocView* pXFADocView, if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { for (int i = 0, sz = pWidgetAcc->CountChoiceListItems(false); i < sz; i++) { - CFX_WideString swText; + WideString swText; pWidgetAcc->GetChoiceListItem(swText, i, false); pFormField->InsertOption(swText, i, false); @@ -552,7 +552,7 @@ int CPDFSDK_Widget::GetRotate() const { } #ifdef PDF_ENABLE_XFA -CFX_WideString CPDFSDK_Widget::GetName() const { +WideString CPDFSDK_Widget::GetName() const { CPDF_FormField* pFormField = GetFormField(); return pFormField->GetFullName(); } @@ -607,28 +607,28 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) const { } #ifdef PDF_ENABLE_XFA -CFX_WideString CPDFSDK_Widget::GetValue(bool bDisplay) const { +WideString CPDFSDK_Widget::GetValue(bool bDisplay) const { if (CXFA_FFWidget* hWidget = GetMixXFAWidget()) { if (CXFA_WidgetAcc* pWidgetAcc = hWidget->GetDataAcc()) { - CFX_WideString sValue; + WideString sValue; pWidgetAcc->GetValue( sValue, bDisplay ? XFA_VALUEPICTURE_Display : XFA_VALUEPICTURE_Edit); return sValue; } } #else -CFX_WideString CPDFSDK_Widget::GetValue() const { +WideString CPDFSDK_Widget::GetValue() const { #endif // PDF_ENABLE_XFA CPDF_FormField* pFormField = GetFormField(); return pFormField->GetValue(); } -CFX_WideString CPDFSDK_Widget::GetDefaultValue() const { +WideString CPDFSDK_Widget::GetDefaultValue() const { CPDF_FormField* pFormField = GetFormField(); return pFormField->GetDefaultValue(); } -CFX_WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { +WideString CPDFSDK_Widget::GetOptionLabel(int nIndex) const { CPDF_FormField* pFormField = GetFormField(); return pFormField->GetOptionLabel(nIndex); } @@ -692,7 +692,7 @@ void CPDFSDK_Widget::SetCheck(bool bChecked, bool bNotify) { #endif // PDF_ENABLE_XFA } -void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, bool bNotify) { +void CPDFSDK_Widget::SetValue(const WideString& sValue, bool bNotify) { CPDF_FormField* pFormField = GetFormField(); pFormField->SetValue(sValue, bNotify); #ifdef PDF_ENABLE_XFA @@ -701,7 +701,7 @@ void CPDFSDK_Widget::SetValue(const CFX_WideString& sValue, bool bNotify) { #endif // PDF_ENABLE_XFA } -void CPDFSDK_Widget::SetDefaultValue(const CFX_WideString& sValue) {} +void CPDFSDK_Widget::SetDefaultValue(const WideString& sValue) {} void CPDFSDK_Widget::SetOptionSelection(int index, bool bSelected, bool bNotify) { @@ -742,7 +742,7 @@ void CPDFSDK_Widget::ResetAppearance(bool bValueChanged) { case FIELDTYPE_TEXTFIELD: case FIELDTYPE_COMBOBOX: { bool bFormatted = false; - CFX_WideString sValue = OnFormat(bFormatted); + WideString sValue = OnFormat(bFormatted); ResetAppearance(bFormatted ? &sValue : nullptr, true); break; } @@ -753,7 +753,7 @@ void CPDFSDK_Widget::ResetAppearance(bool bValueChanged) { } #endif // PDF_ENABLE_XFA -void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue, +void CPDFSDK_Widget::ResetAppearance(const WideString* sValue, bool bValueChanged) { SetAppModified(); @@ -786,7 +786,7 @@ void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue, m_pAnnot->ClearCachedAP(); } -CFX_WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) { +WideString CPDFSDK_Widget::OnFormat(bool& bFormatted) { CPDF_FormField* pFormField = GetFormField(); ASSERT(pFormField); return m_pInterForm->OnFormat(pFormField, bFormatted); @@ -1042,7 +1042,7 @@ CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT) { return CPDF_Action(); } -CFX_WideString CPDFSDK_Widget::GetAlternateName() const { +WideString CPDFSDK_Widget::GetAlternateName() const { CPDF_FormField* pFormField = GetFormField(); return pFormField->GetAlternateName(); } diff --git a/fpdfsdk/cpdfsdk_widget.h b/fpdfsdk/cpdfsdk_widget.h index d33413afae..5b2411e170 100644 --- a/fpdfsdk/cpdfsdk_widget.h +++ b/fpdfsdk/cpdfsdk_widget.h @@ -82,12 +82,12 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { int GetSelectedIndex(int nIndex) const; #ifndef PDF_ENABLE_XFA - CFX_WideString GetValue() const; + WideString GetValue() const; #else - CFX_WideString GetValue(bool bDisplay = true) const; + WideString GetValue(bool bDisplay = true) const; #endif // PDF_ENABLE_XFA - CFX_WideString GetDefaultValue() const; - CFX_WideString GetOptionLabel(int nIndex) const; + WideString GetDefaultValue() const; + WideString GetOptionLabel(int nIndex) const; int CountOptions() const; bool IsOptionSelected(int nIndex) const; int GetTopVisibleIndex() const; @@ -95,13 +95,13 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { int GetAlignment() const; int GetMaxLen() const; #ifdef PDF_ENABLE_XFA - CFX_WideString GetName() const; + WideString GetName() const; #endif // PDF_ENABLE_XFA - CFX_WideString GetAlternateName() const; + WideString GetAlternateName() const; void SetCheck(bool bChecked, bool bNotify); - void SetValue(const CFX_WideString& sValue, bool bNotify); - void SetDefaultValue(const CFX_WideString& sValue); + void SetValue(const WideString& sValue, bool bNotify); + void SetDefaultValue(const WideString& sValue); void SetOptionSelection(int index, bool bSelected, bool bNotify); void ClearSelection(bool bNotify); void SetTopVisibleIndex(int index); @@ -109,10 +109,10 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { #ifdef PDF_ENABLE_XFA void ResetAppearance(bool bValueChanged); #endif // PDF_ENABLE_XFA - void ResetAppearance(const CFX_WideString* sValue, bool bValueChanged); + void ResetAppearance(const WideString* sValue, bool bValueChanged); void ResetFieldAppearance(bool bValueChanged); void UpdateField(); - CFX_WideString OnFormat(bool& bFormatted); + WideString OnFormat(bool& bFormatted); bool OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp index d20d29af67..ab37141ba2 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.cpp +++ b/fpdfsdk/cpdfsdk_widgethandler.cpp @@ -231,7 +231,7 @@ void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) { if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { bool bFormatted = false; CPDFSDK_Annot::ObservedPtr pObserved(pWidget); - CFX_WideString sValue = pWidget->OnFormat(bFormatted); + WideString sValue = pWidget->OnFormat(bFormatted); if (!pObserved) return; @@ -280,15 +280,15 @@ CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, return CFX_FloatRect(); } -CFX_WideString CPDFSDK_WidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) { +WideString CPDFSDK_WidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) { if (!pAnnot->IsSignatureWidget() && m_pFormFiller) return m_pFormFiller->GetSelectedText(pAnnot); - return CFX_WideString(); + return WideString(); } void CPDFSDK_WidgetHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) { + const WideString& text) { if (!pAnnot->IsSignatureWidget() && m_pFormFiller) m_pFormFiller->ReplaceSelection(pAnnot, text); } diff --git a/fpdfsdk/cpdfsdk_widgethandler.h b/fpdfsdk/cpdfsdk_widgethandler.h index 82a9380ced..d83c98f255 100644 --- a/fpdfsdk/cpdfsdk_widgethandler.h +++ b/fpdfsdk/cpdfsdk_widgethandler.h @@ -37,9 +37,8 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler { void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; - CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override; - void ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) override; + WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override; + void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override; bool HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, const CFX_PointF& point) override; diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp index e9c99721b7..b5c52a89cc 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp @@ -99,15 +99,14 @@ CFX_FloatRect CPDFSDK_XFAWidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, // TODO(bug 840): Implement so selected text can be obtained from XFA // fields. -CFX_WideString CPDFSDK_XFAWidgetHandler::GetSelectedText( - CPDFSDK_Annot* pAnnot) { - return CFX_WideString(); +WideString CPDFSDK_XFAWidgetHandler::GetSelectedText(CPDFSDK_Annot* pAnnot) { + return WideString(); } // TODO(bug 840): Implement so text can be inserted into and deleted from XFA // fields. void CPDFSDK_XFAWidgetHandler::ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) {} + const WideString& text) {} bool CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.h b/fpdfsdk/cpdfsdk_xfawidgethandler.h index e1f7661cf6..e26472d69c 100644 --- a/fpdfsdk/cpdfsdk_xfawidgethandler.h +++ b/fpdfsdk/cpdfsdk_xfawidgethandler.h @@ -32,9 +32,8 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler { void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override; CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) override; - CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override; - void ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) override; + WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override; + void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override; bool HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, const CFX_PointF& point) override; diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index c3ab2b8f56..625ce469c7 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -68,7 +68,7 @@ void CBA_FontMap::Initialize() { } void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont, - const CFX_ByteString& sFontName) { + const ByteString& sFontName) { ASSERT(pFont); if (m_pDefaultFont) @@ -83,7 +83,7 @@ void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont, AddFontData(m_pDefaultFont.Get(), m_sDefaultFontName, nCharset); } -CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias, +CPDF_Font* CBA_FontMap::FindFontSameCharset(ByteString* sFontAlias, int32_t nCharset) { if (m_pAnnotDict->GetStringFor("Subtype") != "Widget") return nullptr; @@ -109,7 +109,7 @@ CPDF_Document* CBA_FontMap::GetDocument() { } CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, - CFX_ByteString* sFontAlias, + ByteString* sFontAlias, int32_t nCharset) { if (!pResDict) return nullptr; @@ -121,7 +121,7 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, CPDF_Document* pDocument = GetDocument(); CPDF_Font* pFind = nullptr; for (const auto& it : *pFonts) { - const CFX_ByteString& csKey = it.first; + const ByteString& csKey = it.first; if (!it.second) continue; @@ -145,13 +145,12 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, return pFind; } -void CBA_FontMap::AddedFont(CPDF_Font* pFont, - const CFX_ByteString& sFontAlias) { +void CBA_FontMap::AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) { AddFontToAnnotDict(pFont, sFontAlias); } void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, - const CFX_ByteString& sAlias) { + const ByteString& sAlias) { if (!pFont) return; @@ -194,7 +193,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, } } -CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) { +CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(ByteString* sAlias) { CPDF_Dictionary* pAcroFormDict = nullptr; const bool bWidget = (m_pAnnotDict->GetStringFor("Subtype") == "Widget"); if (bWidget) { @@ -203,7 +202,7 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) { pAcroFormDict = pRootDict->GetDictFor("AcroForm"); } - CFX_ByteString sDA; + ByteString sDA; CPDF_Object* pObj = FPDF_GetFieldAttr(m_pAnnotDict.Get(), "DA"); if (pObj) sDA = pObj->GetString(); @@ -211,17 +210,17 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) { if (bWidget) { if (sDA.IsEmpty()) { pObj = FPDF_GetFieldAttr(pAcroFormDict, "DA"); - sDA = pObj ? pObj->GetString() : CFX_ByteString(); + sDA = pObj ? pObj->GetString() : ByteString(); } } if (sDA.IsEmpty()) return nullptr; - CPDF_SimpleParser syntax(sDA.AsStringC()); + CPDF_SimpleParser syntax(sDA.AsStringView()); syntax.FindTagParamFromStart("Tf", 2); - CFX_ByteString sFontName(syntax.GetWord()); - CFX_ByteString sDecodedFontName = PDF_NameDecode(sFontName); + ByteString sFontName(syntax.GetWord()); + ByteString sDecodedFontName = PDF_NameDecode(sFontName); *sAlias = sDecodedFontName.Right(sDecodedFontName.GetLength() - 1); CPDF_Dictionary* pFontDict = nullptr; @@ -243,7 +242,7 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString* sAlias) { return pFontDict ? m_pDocument->LoadFont(pFontDict) : nullptr; } -void CBA_FontMap::SetAPType(const CFX_ByteString& sAPType) { +void CBA_FontMap::SetAPType(const ByteString& sAPType) { m_sAPType = sAPType; Reset(); diff --git a/fpdfsdk/formfiller/cba_fontmap.h b/fpdfsdk/formfiller/cba_fontmap.h index 7eb7d4e19c..807cb65f4f 100644 --- a/fpdfsdk/formfiller/cba_fontmap.h +++ b/fpdfsdk/formfiller/cba_fontmap.h @@ -19,28 +19,28 @@ class CBA_FontMap : public CPWL_FontMap { ~CBA_FontMap() override; void Reset(); - void SetDefaultFont(CPDF_Font* pFont, const CFX_ByteString& sFontName); - void SetAPType(const CFX_ByteString& sAPType); + void SetDefaultFont(CPDF_Font* pFont, const ByteString& sFontName); + void SetAPType(const ByteString& sAPType); private: // CPWL_FontMap: void Initialize() override; CPDF_Document* GetDocument() override; - CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias, + CPDF_Font* FindFontSameCharset(ByteString* sFontAlias, int32_t nCharset) override; - void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias) override; + void AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) override; CPDF_Font* FindResFontSameCharset(CPDF_Dictionary* pResDict, - CFX_ByteString* sFontAlias, + ByteString* sFontAlias, int32_t nCharset); - CPDF_Font* GetAnnotDefaultFont(CFX_ByteString* csNameTag); - void AddFontToAnnotDict(CPDF_Font* pFont, const CFX_ByteString& sAlias); + CPDF_Font* GetAnnotDefaultFont(ByteString* csNameTag); + void AddFontToAnnotDict(CPDF_Font* pFont, const ByteString& sAlias); CFX_UnownedPtr m_pDocument; CFX_UnownedPtr m_pAnnotDict; CFX_UnownedPtr m_pDefaultFont; - CFX_ByteString m_sDefaultFontName; - CFX_ByteString m_sAPType; + ByteString m_sDefaultFontName; + ByteString m_sAPType; }; #endif // FPDFSDK_FORMFILLER_CBA_FONTMAP_H_ diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index aeb31f5b88..ab34a650c5 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -52,7 +52,7 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) { pWnd->SetFillerNotify(pFormFiller); int32_t nCurSel = m_pWidget->GetSelectedIndex(0); - CFX_WideString swText; + WideString swText; if (nCurSel < 0) swText = m_pWidget->GetValue(); else @@ -94,7 +94,7 @@ void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { if (!pWnd) return; - CFX_WideString swText = pWnd->GetText(); + WideString swText = pWnd->GetText(); int32_t nCurSel = pWnd->GetSelect(); bool bSetValue = false; @@ -235,15 +235,15 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Edit* pEdit) { pEdit->SetCharSet(FX_CHARSET_ChineseSimplified); pEdit->SetReadyToInput(); - CFX_WideString wsText = pEdit->GetText(); + WideString wsText = pEdit->GetText(); int nCharacters = wsText.GetLength(); - CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); + ByteString bsUTFText = wsText.UTF16LE_Encode(); auto* pBuffer = reinterpret_cast(bsUTFText.c_str()); m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true); } -CFX_WideString CFFL_ComboBox::GetSelectExportText() { - CFX_WideString swRet; +WideString CFFL_ComboBox::GetSelectExportText() { + WideString swRet; int nExport = -1; CPDFSDK_PageView* pPageView = GetCurPageView(true); diff --git a/fpdfsdk/formfiller/cffl_combobox.h b/fpdfsdk/formfiller/cffl_combobox.h index dc8441d1cd..bdc0934862 100644 --- a/fpdfsdk/formfiller/cffl_combobox.h +++ b/fpdfsdk/formfiller/cffl_combobox.h @@ -16,7 +16,7 @@ struct FFL_ComboBoxState { int nIndex; int nStart; int nEnd; - CFX_WideString sValue; + WideString sValue; }; class CFFL_ComboBox : public CFFL_TextObject, @@ -50,7 +50,7 @@ class CFFL_ComboBox : public CFFL_TextObject, void OnSetFocus(CPWL_Edit* pEdit) override; private: - CFX_WideString GetSelectExportText(); + WideString GetSelectExportText(); FFL_ComboBoxState m_State; }; diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index fd569c7201..2c6138b92b 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -233,19 +233,19 @@ bool CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, return pWnd && pWnd->OnChar(nChar, nFlags); } -CFX_WideString CFFL_FormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) { +WideString CFFL_FormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) { if (!IsValid()) - return CFX_WideString(); + return WideString(); CPDFSDK_PageView* pPageView = GetCurPageView(true); ASSERT(pPageView); CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false); - return pWnd ? pWnd->GetSelectedText() : CFX_WideString(); + return pWnd ? pWnd->GetSelectedText() : WideString(); } void CFFL_FormFiller::ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) { + const WideString& text) { if (!IsValid()) return; diff --git a/fpdfsdk/formfiller/cffl_formfiller.h b/fpdfsdk/formfiller/cffl_formfiller.h index e9c2c551d2..8078d35519 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.h +++ b/fpdfsdk/formfiller/cffl_formfiller.h @@ -75,8 +75,8 @@ class CFFL_FormFiller : public CPWL_Wnd::ProviderIface, uint32_t nFlags); virtual bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags); - CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot); - void ReplaceSelection(CPDFSDK_Annot* pAnnot, const CFX_WideString& text); + WideString GetSelectedText(CPDFSDK_Annot* pAnnot); + void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text); void SetFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag); void KillFocusForAnnot(CPDFSDK_Annot* pAnnot, uint32_t nFlag); diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp index 989539fad3..3625e9db38 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.cpp @@ -516,15 +516,14 @@ void CFFL_InteractiveFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) { UnRegisterFormFiller(pAnnot); } -CFX_WideString CFFL_InteractiveFormFiller::GetSelectedText( - CPDFSDK_Annot* pAnnot) { +WideString CFFL_InteractiveFormFiller::GetSelectedText(CPDFSDK_Annot* pAnnot) { ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false); - return pFormFiller ? pFormFiller->GetSelectedText(pAnnot) : CFX_WideString(); + return pFormFiller ? pFormFiller->GetSelectedText(pAnnot) : WideString(); } void CFFL_InteractiveFormFiller::ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) { + const WideString& text) { ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false); if (!pFormFiller) @@ -690,8 +689,7 @@ void CFFL_InteractiveFormFiller::OnFormat(CPDFSDK_Annot::ObservedPtr* pAnnot, CPDFSDK_InterForm* pInterForm = pPageView->GetFormFillEnv()->GetInterForm(); bool bFormatted = false; - CFX_WideString sValue = - pInterForm->OnFormat(pWidget->GetFormField(), bFormatted); + WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bFormatted); if (!(*pAnnot)) return; @@ -857,8 +855,8 @@ bool CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, std::pair CFFL_InteractiveFormFiller::OnBeforeKeyStroke( CPWL_Wnd::PrivateData* pAttached, - CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + WideString& strChange, + const WideString& strChangeEx, int nSelStart, int nSelEnd, bool bKeyDown, diff --git a/fpdfsdk/formfiller/cffl_interactiveformfiller.h b/fpdfsdk/formfiller/cffl_interactiveformfiller.h index 0982f1d92b..553cbe8f1d 100644 --- a/fpdfsdk/formfiller/cffl_interactiveformfiller.h +++ b/fpdfsdk/formfiller/cffl_interactiveformfiller.h @@ -83,8 +83,8 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { CFFL_FormFiller* GetFormFiller(CPDFSDK_Annot* pAnnot, bool bRegister); void RemoveFormFiller(CPDFSDK_Annot* pAnnot); - CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot); - void ReplaceSelection(CPDFSDK_Annot* pAnnot, const CFX_WideString& text); + WideString GetSelectedText(CPDFSDK_Annot* pAnnot); + void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text); static bool IsVisible(CPDFSDK_Widget* pWidget); static bool IsReadOnly(CPDFSDK_Widget* pWidget); @@ -133,8 +133,8 @@ class CFFL_InteractiveFormFiller : public IPWL_Filler_Notify { float* fPopupRet) override; // Returns {bRC, bExit}. std::pair OnBeforeKeyStroke(CPWL_Wnd::PrivateData* pAttached, - CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + WideString& strChange, + const WideString& strChangeEx, int nSelStart, int nSelEnd, bool bKeyDown, diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index 8bf0825245..76434a5216 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -74,7 +74,7 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) { pWnd->SetFillerNotify(m_pFormFillEnv->GetInteractiveFormFiller()); int32_t nMaxLen = m_pWidget->GetMaxLen(); - CFX_WideString swValue = m_pWidget->GetValue(); + WideString swValue = m_pWidget->GetValue(); if (nMaxLen > 0) { if (pWnd->HasFlag(PES_CHARARRAY)) { @@ -136,8 +136,8 @@ void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) { if (!pWnd) return; - CFX_WideString sOldValue = m_pWidget->GetValue(); - CFX_WideString sNewValue = pWnd->GetText(); + WideString sOldValue = m_pWidget->GetValue(); + WideString sNewValue = pWnd->GetText(); m_pWidget->SetValue(sNewValue, false); m_pWidget->ResetFieldAppearance(true); @@ -239,9 +239,9 @@ void CFFL_TextField::OnSetFocus(CPWL_Edit* pEdit) { pEdit->SetCharSet(FX_CHARSET_ChineseSimplified); pEdit->SetReadyToInput(); - CFX_WideString wsText = pEdit->GetText(); + WideString wsText = pEdit->GetText(); int nCharacters = wsText.GetLength(); - CFX_ByteString bsUTFText = wsText.UTF16LE_Encode(); + ByteString bsUTFText = wsText.UTF16LE_Encode(); auto* pBuffer = reinterpret_cast(bsUTFText.c_str()); m_pFormFillEnv->OnSetFieldInputFocus(pBuffer, nCharacters, true); } diff --git a/fpdfsdk/formfiller/cffl_textfield.h b/fpdfsdk/formfiller/cffl_textfield.h index 2a99413398..49ffc0fc33 100644 --- a/fpdfsdk/formfiller/cffl_textfield.h +++ b/fpdfsdk/formfiller/cffl_textfield.h @@ -21,7 +21,7 @@ struct FFL_TextFieldState { int nStart; int nEnd; - CFX_WideString sValue; + WideString sValue; }; class CFFL_TextField : public CFFL_TextObject, diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index 676f701106..1e39f2b2c9 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -52,7 +52,7 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT); } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) { const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); - CFX_ByteString cbString; + ByteString cbString; if (pAnnotDict->KeyExist("IT")) cbString = pAnnotDict->GetStringFor("IT"); if (cbString.Compare("Img") != 0) @@ -67,7 +67,7 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT); } else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) { const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict(); - CFX_ByteString cbString; + ByteString cbString; if (pAnnotDict->KeyExist("FT")) cbString = pAnnotDict->GetStringFor("FT"); if (cbString.Compare("Sig") == 0) @@ -75,18 +75,18 @@ void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) { } } -bool CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) { +bool CheckSharedForm(const CXML_Element* pElement, ByteString cbName) { int count = pElement->CountAttrs(); int i = 0; for (i = 0; i < count; i++) { - CFX_ByteString space; - CFX_ByteString name; - CFX_WideString value; + ByteString space; + ByteString name; + WideString value; pElement->GetAttrByIndex(i, &space, &name, &value); if (space == "xmlns" && name == "adhocwf" && value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") { CXML_Element* pVersion = - pElement->GetElement("adhocwf", cbName.AsStringC(), 0); + pElement->GetElement("adhocwf", cbName.AsStringView(), 0); if (!pVersion) continue; CXML_Content* pContent = ToContent(pVersion->GetChild(0)); @@ -127,7 +127,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { // Portfolios and Packages const CPDF_Dictionary* pRootDict = pDoc->GetRoot(); if (pRootDict) { - CFX_ByteString cbString; + ByteString cbString; if (pRootDict->KeyExist("Collection")) { FPDF_UnSupportError(FPDF_UNSP_DOC_PORTABLECOLLECTION); return; @@ -143,7 +143,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayFor("Names") : nullptr; if (pArray) { for (size_t i = 0; i < pArray->GetCount(); i++) { - CFX_ByteString cbStr = pArray->GetStringAt(i); + ByteString cbStr = pArray->GetStringAt(i); if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) { FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); return; @@ -181,7 +181,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFDoc_GetPageMode(FPDF_DOCUMENT document) { if (!pName) return PAGEMODE_USENONE; - CFX_ByteString strPageMode = pName->GetString(); + ByteString strPageMode = pName->GetString(); if (strPageMode.IsEmpty() || strPageMode.EqualNoCase("UseNone")) return PAGEMODE_USENONE; if (strPageMode.EqualNoCase("UseOutlines")) diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index b8e84c8cc4..a276e3a368 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -97,7 +97,7 @@ int ParserAnnots(CPDF_Document* pSourceDoc, if (!pAnnotDic) continue; - CFX_ByteString sSubtype = pAnnotDic->GetStringFor("Subtype"); + ByteString sSubtype = pAnnotDic->GetStringFor("Subtype"); if (sSubtype == "Popup") continue; @@ -168,18 +168,18 @@ CFX_FloatRect CalculateRect(std::vector* pRectArray) { return rcRet; } -uint32_t NewIndirectContentsStream(const CFX_ByteString& key, +uint32_t NewIndirectContentsStream(const ByteString& key, CPDF_Document* pDocument) { CPDF_Stream* pNewContents = pDocument->NewIndirect( nullptr, 0, pdfium::MakeUnique(pDocument->GetByteStringPool())); - CFX_ByteString sStream; + ByteString sStream; sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()); pNewContents->SetData(sStream.raw_str(), sStream.GetLength()); return pNewContents->GetObjNum(); } -void SetPageContents(const CFX_ByteString& key, +void SetPageContents(const ByteString& key, CPDF_Dictionary* pPage, CPDF_Document* pDocument) { CPDF_Array* pContentsArray = nullptr; @@ -199,9 +199,9 @@ void SetPageContents(const CFX_ByteString& key, pContentsArray = pDocument->NewIndirect(); auto pAcc = pdfium::MakeRetain(pContentsStream); pAcc->LoadAllData(); - CFX_ByteString sStream = "q\n"; - CFX_ByteString sBody = - CFX_ByteString((const char*)pAcc->GetData(), pAcc->GetSize()); + ByteString sStream = "q\n"; + ByteString sBody = + ByteString((const char*)pAcc->GetData(), pAcc->GetSize()); sStream = sStream + sBody + "\nQ"; pContentsStream->SetDataAndRemoveFilter(sStream.raw_str(), sStream.GetLength()); @@ -299,10 +299,10 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { if (!pPageXObject) pPageXObject = pRes->SetNewFor("XObject"); - CFX_ByteString key; + ByteString key; int nStreams = pdfium::CollectionSize(ObjectArray); if (nStreams > 0) { - CFX_ByteString sKey; + ByteString sKey; int i = 0; while (i < INT_MAX) { sKey.Format("FFT%d", i); @@ -336,7 +336,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { CFX_FloatRect rcAnnot = pAnnotDic->GetRectFor("Rect"); rcAnnot.Normalize(); - CFX_ByteString sAnnotState = pAnnotDic->GetStringFor("AS"); + ByteString sAnnotState = pAnnotDic->GetStringFor("AS"); CPDF_Dictionary* pAnnotAP = pAnnotDic->GetDictFor("AP"); if (!pAnnotAP) continue; @@ -392,17 +392,17 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { if (!pXObject) pXObject = pNewXORes->SetNewFor("XObject"); - CFX_ByteString sFormName; + ByteString sFormName; sFormName.Format("F%d", i); pXObject->SetNewFor(sFormName, pDocument, pObj->GetObjNum()); auto pAcc = pdfium::MakeRetain(pNewXObject); pAcc->LoadAllData(); - CFX_ByteString sStream(pAcc->GetData(), pAcc->GetSize()); + ByteString sStream(pAcc->GetData(), pAcc->GetSize()); CFX_Matrix matrix = pAPDic->GetMatrixFor("Matrix"); CFX_Matrix m = GetMatrix(rcAnnot, rcStream, matrix); - CFX_ByteString sTemp; + ByteString sTemp; sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, sFormName.c_str()); sStream += sTemp; diff --git a/fpdfsdk/fpdf_structtree.cpp b/fpdfsdk/fpdf_structtree.cpp index a6bf60d0df..b1fca65015 100644 --- a/fpdfsdk/fpdf_structtree.cpp +++ b/fpdfsdk/fpdf_structtree.cpp @@ -22,13 +22,13 @@ CPDF_StructElement* ToStructTreeElement(FPDF_STRUCTELEMENT struct_element) { return static_cast(struct_element); } -unsigned long WideStringToBuffer(const CFX_WideString& str, +unsigned long WideStringToBuffer(const WideString& str, void* buffer, unsigned long buflen) { if (str.IsEmpty()) return 0; - CFX_ByteString encodedStr = str.UTF16LE_Encode(); + ByteString encodedStr = str.UTF16LE_Encode(); const unsigned long len = encodedStr.GetLength(); if (buffer && len <= buflen) memcpy(buffer, encodedStr.c_str(), len); diff --git a/fpdfsdk/fpdf_structtree_embeddertest.cpp b/fpdfsdk/fpdf_structtree_embeddertest.cpp index 43a4d0159f..05b77fc0f7 100644 --- a/fpdfsdk/fpdf_structtree_embeddertest.cpp +++ b/fpdfsdk/fpdf_structtree_embeddertest.cpp @@ -57,8 +57,8 @@ TEST_F(FPDFStructTreeEmbeddertest, GetAltText) { ASSERT_EQ(24U, FPDF_StructElement_GetAltText(gchild_element, buffer, sizeof(buffer))); const wchar_t kExpected[] = L"Black Image"; - EXPECT_EQ(CFX_WideString(kExpected), - CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected))); + EXPECT_EQ(WideString(kExpected), + WideString::FromUTF16LE(buffer, FXSYS_len(kExpected))); ASSERT_EQ(1, FPDF_StructElement_CountChildren(gchild_element)); FPDF_STRUCTELEMENT ggchild_element = @@ -91,8 +91,8 @@ TEST_F(FPDFStructTreeEmbeddertest, GetType) { ASSERT_EQ(18U, FPDF_StructElement_GetType(element, buffer, sizeof(buffer))); const wchar_t kExpected[] = L"Document"; - EXPECT_EQ(CFX_WideString(kExpected), - CFX_WideString::FromUTF16LE(buffer, FXSYS_len(kExpected))); + EXPECT_EQ(WideString(kExpected), + WideString::FromUTF16LE(buffer, FXSYS_len(kExpected))); FPDF_StructTree_Close(struct_tree); FPDF_ClosePage(page); diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp index 92c99373cf..875f3fd992 100644 --- a/fpdfsdk/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/fpdf_sysfontinfo.cpp @@ -73,7 +73,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size); } - bool GetFaceName(void* hFont, CFX_ByteString* name) override { + bool GetFaceName(void* hFont, ByteString* name) override { if (!m_pInfo->GetFaceName) return false; uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0); @@ -81,7 +81,7 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { return false; char* buffer = FX_Alloc(char, size); size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); - *name = CFX_ByteString(buffer, size); + *name = ByteString(buffer, size); FX_Free(buffer); return true; } @@ -167,7 +167,7 @@ static unsigned long DefaultGetFaceName(struct _FPDF_SYSFONTINFO* pThis, void* hFont, char* buffer, unsigned long buf_size) { - CFX_ByteString name; + ByteString name; auto* pDefault = static_cast(pThis); if (!pDefault->m_pFontInfo->GetFaceName(hFont, &name)) return 0; @@ -175,7 +175,7 @@ static unsigned long DefaultGetFaceName(struct _FPDF_SYSFONTINFO* pThis, return name.GetLength() + 1; strncpy(buffer, name.c_str(), - (name.GetLength() + 1) * sizeof(CFX_ByteString::CharType)); + (name.GetLength() + 1) * sizeof(ByteString::CharType)); return name.GetLength() + 1; } diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index 93df594618..94807718e1 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -25,7 +25,7 @@ namespace { void SetBoundingBox(CPDF_Page* page, - const CFX_ByteString& key, + const ByteString& key, float left, float bottom, float right, @@ -38,7 +38,7 @@ void SetBoundingBox(CPDF_Page* page, } bool GetBoundingBox(CPDF_Page* page, - const CFX_ByteString& key, + const ByteString& key, float* left, float* bottom, float* right, @@ -111,12 +111,12 @@ FPDFPage_TransFormWithClip(FPDF_PAGE page, CFX_FloatRect rect(clipRect->left, clipRect->bottom, clipRect->right, clipRect->top); rect.Normalize(); - CFX_ByteString bsClipping; + ByteString bsClipping; bsClipping.Format("%f %f %f %f re W* n ", rect.left, rect.bottom, rect.Width(), rect.Height()); textBuf << bsClipping; - CFX_ByteString bsMatix; + ByteString bsMatix; bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, matrix->c, matrix->d, matrix->e, matrix->f); textBuf << bsMatix; @@ -248,7 +248,7 @@ void OutputPath(std::ostringstream& buf, CPDF_Path path) { return; } - CFX_ByteString temp; + ByteString temp; for (size_t i = 0; i < pPoints.size(); i++) { buf << pPoints[i].m_Point.x << " " << pPoints[i].m_Point.y; FXPT_TYPE point_type = pPoints[i].m_Type; diff --git a/fpdfsdk/fpdfannot.cpp b/fpdfsdk/fpdfannot.cpp index 95f0f44af9..e08a3bf17f 100644 --- a/fpdfsdk/fpdfannot.cpp +++ b/fpdfsdk/fpdfannot.cpp @@ -483,7 +483,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_SetColor(FPDF_ANNOTATION annot, pAnnotDict->SetNewFor("CA", A / 255.f); // Set the color of the annotation. - CFX_ByteString key = type == FPDFANNOT_COLORTYPE_InteriorColor ? "IC" : "C"; + ByteString key = type == FPDFANNOT_COLORTYPE_InteriorColor ? "IC" : "C"; CPDF_Array* pColor = pAnnotDict->GetArrayFor(key); if (pColor) pColor->Clear(); diff --git a/fpdfsdk/fpdfattachment.cpp b/fpdfsdk/fpdfattachment.cpp index d984cf8910..7402114756 100644 --- a/fpdfsdk/fpdfattachment.cpp +++ b/fpdfsdk/fpdfattachment.cpp @@ -25,24 +25,23 @@ namespace { constexpr char kChecksumKey[] = "CheckSum"; -CFX_ByteString CFXByteStringHexDecode(const CFX_ByteString& bsHex) { +ByteString CFXByteStringHexDecode(const ByteString& bsHex) { uint8_t* result = nullptr; uint32_t size = 0; HexDecode(bsHex.raw_str(), bsHex.GetLength(), &result, &size); - CFX_ByteString bsDecoded(result, size); + ByteString bsDecoded(result, size); FX_Free(result); return bsDecoded; } -CFX_ByteString GenerateMD5Base16(const void* contents, - const unsigned long len) { +ByteString GenerateMD5Base16(const void* contents, const unsigned long len) { uint8_t digest[16]; CRYPT_MD5Generate(reinterpret_cast(contents), len, digest); char buf[32]; for (int i = 0; i < 16; ++i) FXSYS_IntToTwoHexChars(digest[i], &buf[i * 2]); - return CFX_ByteString(buf, 32); + return ByteString(buf, 32); } } // namespace @@ -59,8 +58,8 @@ FPDFDoc_GetAttachmentCount(FPDF_DOCUMENT document) { FPDF_EXPORT FPDF_ATTACHMENT FPDF_CALLCONV FPDFDoc_AddAttachment(FPDF_DOCUMENT document, FPDF_WIDESTRING name) { CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); - CFX_WideString wsName = - CFX_WideString::FromUTF16LE(name, CFX_WideString::WStringLength(name)); + WideString wsName = + WideString::FromUTF16LE(name, WideString::WStringLength(name)); if (!pDoc || wsName.IsEmpty()) return nullptr; @@ -110,7 +109,7 @@ FPDFDoc_GetAttachment(FPDF_DOCUMENT document, int index) { if (static_cast(index) >= nameTree.GetCount()) return nullptr; - CFX_WideString csName; + WideString csName; return nameTree.LookupValueAndName(index, &csName); } @@ -171,8 +170,8 @@ FPDFAttachment_SetStringValue(FPDF_ATTACHMENT attachment, if (!pParamsDict) return false; - CFX_ByteString bsKey = key; - CFX_ByteString bsValue = CFXByteStringFromFPDFWideString(value); + ByteString bsKey = key; + ByteString bsValue = CFXByteStringFromFPDFWideString(value); bool bEncodedAsHex = bsKey == kChecksumKey; if (bEncodedAsHex) bsValue = CFXByteStringHexDecode(bsValue); @@ -194,12 +193,12 @@ FPDFAttachment_GetStringValue(FPDF_ATTACHMENT attachment, if (!pParamsDict) return 0; - CFX_ByteString bsKey = key; - CFX_WideString value = pParamsDict->GetUnicodeTextFor(bsKey); + ByteString bsKey = key; + WideString value = pParamsDict->GetUnicodeTextFor(bsKey); if (bsKey == kChecksumKey && !value.IsEmpty()) { CPDF_String* stringValue = pParamsDict->GetObjectFor(bsKey)->AsString(); if (stringValue->IsHex()) { - CFX_ByteString encoded = PDF_EncodeString(stringValue->GetString(), true); + ByteString encoded = PDF_EncodeString(stringValue->GetString(), true); value = CPDF_String(nullptr, encoded, false).GetUnicodeText(); } } @@ -233,7 +232,7 @@ FPDFAttachment_SetFile(FPDF_ATTACHMENT attachment, // Set the creation date of the new attachment in the dictionary. CFX_DateTime dateTime; dateTime.Now(); - CFX_ByteString bsDateTime; + ByteString bsDateTime; bsDateTime.Format("D:%d%02d%02d%02d%02d%02d", dateTime.GetYear(), dateTime.GetMonth(), dateTime.GetDay(), dateTime.GetHour(), dateTime.GetMinute(), dateTime.GetSecond()); diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index f73336a94f..c3910b2883 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -24,7 +24,7 @@ namespace { CPDF_Bookmark FindBookmark(const CPDF_BookmarkTree& tree, CPDF_Bookmark bookmark, - const CFX_WideString& title, + const WideString& title, std::set* visited) { // Return if already checked to avoid circular calling. if (pdfium::ContainsKey(*visited, bookmark.GetDict())) @@ -91,7 +91,7 @@ FPDFBookmark_GetTitle(FPDF_BOOKMARK pDict, void* buffer, unsigned long buflen) { if (!pDict) return 0; CPDF_Bookmark bookmark(ToDictionary(static_cast(pDict))); - CFX_WideString title = bookmark.GetTitle(); + WideString title = bookmark.GetTitle(); return Utf16EncodeMaybeCopyAndReturnLength(title, buffer, buflen); } @@ -103,8 +103,8 @@ FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_WIDESTRING title) { if (!pDoc) return nullptr; CPDF_BookmarkTree tree(pDoc); - FX_STRSIZE len = CFX_WideString::WStringLength(title); - CFX_WideString encodedTitle = CFX_WideString::FromUTF16LE(title, len); + FX_STRSIZE len = WideString::WStringLength(title); + WideString encodedTitle = WideString::FromUTF16LE(title, len); std::set visited; return FindBookmark(tree, CPDF_Bookmark(), encodedTitle, &visited).GetDict(); } @@ -174,7 +174,7 @@ FPDFAction_GetFilePath(FPDF_ACTION pDict, void* buffer, unsigned long buflen) { return 0; CPDF_Action action(ToDictionary(static_cast(pDict))); - CFX_ByteString path = action.GetFilePath().UTF8Encode(); + ByteString path = action.GetFilePath().UTF8Encode(); unsigned long len = path.GetLength() + 1; if (buffer && len <= buflen) memcpy(buffer, path.c_str(), len); @@ -192,7 +192,7 @@ FPDFAction_GetURIPath(FPDF_DOCUMENT document, if (!pDoc) return 0; CPDF_Action action(ToDictionary(static_cast(pDict))); - CFX_ByteString path = action.GetURI(pDoc); + ByteString path = action.GetURI(pDoc); unsigned long len = path.GetLength() + 1; if (buffer && len <= buflen) memcpy(buffer, path.c_str(), len); @@ -390,7 +390,7 @@ FPDF_EXPORT unsigned long FPDF_CALLCONV FPDF_GetMetaText(FPDF_DOCUMENT document, const CPDF_Dictionary* pInfo = pDoc->GetInfo(); if (!pInfo) return 0; - CFX_WideString text = pInfo->GetUnicodeTextFor(tag); + WideString text = pInfo->GetUnicodeTextFor(tag); return Utf16EncodeMaybeCopyAndReturnLength(text, buffer, buflen); } @@ -404,7 +404,7 @@ FPDF_GetPageLabel(FPDF_DOCUMENT document, // CPDF_PageLabel can deal with NULL |document|. CPDF_PageLabel label(CPDFDocumentFromFPDFDocument(document)); - CFX_WideString str; + WideString str; if (!label.GetLabel(page_index, &str)) return 0; return Utf16EncodeMaybeCopyAndReturnLength(str, buffer, buflen); diff --git a/fpdfsdk/fpdfdoc_embeddertest.cpp b/fpdfsdk/fpdfdoc_embeddertest.cpp index b44a8ecc80..5db610e030 100644 --- a/fpdfsdk/fpdfdoc_embeddertest.cpp +++ b/fpdfsdk/fpdfdoc_embeddertest.cpp @@ -125,16 +125,14 @@ TEST_F(FPDFDocEmbeddertest, Bookmarks) { FPDF_BOOKMARK child = FPDFBookmark_GetFirstChild(document(), nullptr); EXPECT_TRUE(child); EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(L"A Good Beginning"), - CFX_WideString::FromUTF16LE(buf, 16)); + EXPECT_EQ(WideString(L"A Good Beginning"), WideString::FromUTF16LE(buf, 16)); EXPECT_EQ(nullptr, FPDFBookmark_GetFirstChild(document(), child)); FPDF_BOOKMARK sibling = FPDFBookmark_GetNextSibling(document(), child); EXPECT_TRUE(sibling); EXPECT_EQ(28u, FPDFBookmark_GetTitle(sibling, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(L"A Good Ending"), - CFX_WideString::FromUTF16LE(buf, 13)); + EXPECT_EQ(WideString(L"A Good Ending"), WideString::FromUTF16LE(buf, 13)); EXPECT_EQ(nullptr, FPDFBookmark_GetNextSibling(document(), sibling)); } @@ -152,8 +150,7 @@ TEST_F(FPDFDocEmbeddertest, FindBookmarks) { // Check that the string matches. unsigned short buf[128]; EXPECT_EQ(34u, FPDFBookmark_GetTitle(child, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(L"A Good Beginning"), - CFX_WideString::FromUTF16LE(buf, 16)); + EXPECT_EQ(WideString(L"A Good Beginning"), WideString::FromUTF16LE(buf, 16)); // Check that it is them same as the one returned by GetFirstChild. EXPECT_EQ(child, FPDFBookmark_GetFirstChild(document(), nullptr)); @@ -201,19 +198,19 @@ TEST_F(FPDFDocEmbeddertest, GetMetaText) { constexpr wchar_t kExpectedCreator[] = L"Microsoft Word"; ASSERT_EQ(30u, FPDF_GetMetaText(document(), "Creator", buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedCreator), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreator))); + EXPECT_EQ(WideString(kExpectedCreator), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreator))); constexpr wchar_t kExpectedCreationDate[] = L"D:20160411190039+00'00'"; ASSERT_EQ(48u, FPDF_GetMetaText(document(), "CreationDate", buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedCreationDate), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreationDate))); + EXPECT_EQ(WideString(kExpectedCreationDate), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedCreationDate))); constexpr wchar_t kExpectedModDate[] = L"D:20160411190039+00'00'"; ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedModDate), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate))); + EXPECT_EQ(WideString(kExpectedModDate), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate))); } TEST_F(FPDFDocEmbeddertest, GetMetaTextSameObjectNumber) { @@ -225,8 +222,8 @@ TEST_F(FPDFDocEmbeddertest, GetMetaTextSameObjectNumber) { unsigned short buf[128]; constexpr wchar_t kExpectedModDate[] = L"D:20170612232940-04'00'"; ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedModDate), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate))); + EXPECT_EQ(WideString(kExpectedModDate), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate))); } TEST_F(FPDFDocEmbeddertest, GetMetaTextInAttachmentFile) { @@ -236,8 +233,8 @@ TEST_F(FPDFDocEmbeddertest, GetMetaTextInAttachmentFile) { unsigned short buf[128]; constexpr wchar_t kExpectedModDate[] = L"D:20170712214448-07'00'"; ASSERT_EQ(48u, FPDF_GetMetaText(document(), "ModDate", buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedModDate), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate))); + EXPECT_EQ(WideString(kExpectedModDate), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedModDate))); } TEST_F(FPDFDocEmbeddertest, NoPageLabels) { @@ -257,38 +254,38 @@ TEST_F(FPDFDocEmbeddertest, GetPageLabels) { const wchar_t kExpectedPageLabel0[] = L"i"; ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 0, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedPageLabel0), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel0))); + EXPECT_EQ(WideString(kExpectedPageLabel0), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel0))); const wchar_t kExpectedPageLabel1[] = L"ii"; ASSERT_EQ(6u, FPDF_GetPageLabel(document(), 1, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedPageLabel1), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel1))); + EXPECT_EQ(WideString(kExpectedPageLabel1), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel1))); const wchar_t kExpectedPageLabel2[] = L"1"; ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 2, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedPageLabel2), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel2))); + EXPECT_EQ(WideString(kExpectedPageLabel2), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel2))); const wchar_t kExpectedPageLabel3[] = L"2"; ASSERT_EQ(4u, FPDF_GetPageLabel(document(), 3, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedPageLabel3), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel3))); + EXPECT_EQ(WideString(kExpectedPageLabel3), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel3))); const wchar_t kExpectedPageLabel4[] = L"zzA"; ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 4, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedPageLabel4), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel4))); + EXPECT_EQ(WideString(kExpectedPageLabel4), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel4))); const wchar_t kExpectedPageLabel5[] = L"zzB"; ASSERT_EQ(8u, FPDF_GetPageLabel(document(), 5, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedPageLabel5), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel5))); + EXPECT_EQ(WideString(kExpectedPageLabel5), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel5))); const wchar_t kExpectedPageLabel6[] = L""; ASSERT_EQ(2u, FPDF_GetPageLabel(document(), 6, buf, sizeof(buf))); - EXPECT_EQ(CFX_WideString(kExpectedPageLabel6), - CFX_WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel6))); + EXPECT_EQ(WideString(kExpectedPageLabel6), + WideString::FromUTF16LE(buf, FXSYS_len(kExpectedPageLabel6))); ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 7, buf, sizeof(buf))); ASSERT_EQ(0u, FPDF_GetPageLabel(document(), 8, buf, sizeof(buf))); diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp index faf6d97adf..ca2a457147 100644 --- a/fpdfsdk/fpdfedit_embeddertest.cpp +++ b/fpdfsdk/fpdfedit_embeddertest.cpp @@ -64,8 +64,8 @@ class FPDFEditEmbeddertest : public EmbedderTest { EXPECT_TRUE(font_desc->KeyExist("Descent")); EXPECT_TRUE(font_desc->KeyExist("CapHeight")); EXPECT_TRUE(font_desc->KeyExist("StemV")); - CFX_ByteString present("FontFile"); - CFX_ByteString absent("FontFile2"); + ByteString present("FontFile"); + ByteString absent("FontFile2"); if (font_type == FPDF_FONT_TRUETYPE) std::swap(present, absent); EXPECT_TRUE(font_desc->KeyExist(present)); diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp index 5e3191635e..7036aa2ffd 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -244,7 +244,7 @@ FPDFImageObj_GetImageFilter(FPDF_PAGEOBJECT image_object, CPDF_PageObject* pObj = CPDFPageObjectFromFPDFPageObject(image_object); CPDF_Object* pFilter = pObj->AsImage()->GetImage()->GetDict()->GetDirectObjectFor("Filter"); - CFX_ByteString bsFilter; + ByteString bsFilter; if (pFilter->IsName()) bsFilter = pFilter->AsName()->GetString(); else diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 79155e52d5..26f4424d10 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -100,7 +100,7 @@ FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_CreateNewDocument() { pDoc->CreateNewDoc(); time_t currentTime; - CFX_ByteString DateStr; + ByteString DateStr; if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) { if (time(¤tTime) != -1) { tm* pTM = localtime(¤tTime); diff --git a/fpdfsdk/fpdfedittext.cpp b/fpdfsdk/fpdfedittext.cpp index 38f7cc2562..2ac32b82a3 100644 --- a/fpdfsdk/fpdfedittext.cpp +++ b/fpdfsdk/fpdfedittext.cpp @@ -28,7 +28,7 @@ namespace { CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc, - const CFX_ByteString& font_name, + const ByteString& font_name, CFX_Font* pFont, const uint8_t* data, uint32_t size, @@ -71,8 +71,7 @@ CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc, CPDF_Stream* pStream = pDoc->NewIndirect(); pStream->SetData(data, size); - CFX_ByteString fontFile = - font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2"; + ByteString fontFile = font_type == FPDF_FONT_TYPE1 ? "FontFile" : "FontFile2"; fontDesc->SetNewFor(fontFile, pDoc, pStream->GetObjNum()); return fontDesc; } @@ -243,7 +242,7 @@ void* LoadSimpleFont(CPDF_Document* pDoc, fontDict->SetNewFor("Type", "Font"); fontDict->SetNewFor( "Subtype", font_type == FPDF_FONT_TYPE1 ? "Type1" : "TrueType"); - CFX_ByteString name = pFont->GetFaceName(); + ByteString name = pFont->GetFaceName(); if (name.IsEmpty()) name = "Unnamed"; fontDict->SetNewFor("BaseFont", name); @@ -286,9 +285,9 @@ void* LoadCompositeFont(CPDF_Document* pDoc, fontDict->SetNewFor("Type", "Font"); fontDict->SetNewFor("Subtype", "Type0"); // TODO(npm): Get the correct encoding, if it's not identity. - CFX_ByteString encoding = "Identity-H"; + ByteString encoding = "Identity-H"; fontDict->SetNewFor("Encoding", encoding); - CFX_ByteString name = pFont->GetFaceName(); + ByteString name = pFont->GetFaceName(); if (name.IsEmpty()) name = "Unnamed"; fontDict->SetNewFor( @@ -404,7 +403,7 @@ FPDFPageObj_NewTextObj(FPDF_DOCUMENT document, if (!pDoc) return nullptr; - CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc, CFX_ByteStringC(font)); + CPDF_Font* pFont = CPDF_Font::GetStockFont(pDoc, ByteStringView(font)); if (!pFont) return nullptr; @@ -421,9 +420,9 @@ FPDFText_SetText(FPDF_PAGEOBJECT text_object, FPDF_WIDESTRING text) { if (!pTextObj) return false; - FX_STRSIZE len = CFX_WideString::WStringLength(text); - CFX_WideString encodedText = CFX_WideString::FromUTF16LE(text, len); - CFX_ByteString byteText; + FX_STRSIZE len = WideString::WStringLength(text); + WideString encodedText = WideString::FromUTF16LE(text, len); + ByteString byteText; for (wchar_t wc : encodedText) { pTextObj->GetFont()->AppendChar( &byteText, pTextObj->GetFont()->CharCodeFromUnicode(wc)); diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 1b5cc483a8..77cba50c7c 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -66,11 +66,11 @@ CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle, } #ifdef PDF_ENABLE_XFA -std::vector* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) { - return static_cast*>(handle); +std::vector* FromFPDFStringHandle(FPDF_STRINGHANDLE handle) { + return static_cast*>(handle); } -FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector* strings) { +FPDF_STRINGHANDLE ToFPDFStringHandle(std::vector* strings) { return static_cast(strings); } #endif // PDF_ENABLE_XFA @@ -387,8 +387,8 @@ FORM_GetSelectedText(FPDF_FORMHANDLE hHandle, if (!pPageView) return 0; - CFX_WideString wide_str_form_text = pPageView->GetSelectedText(); - CFX_ByteString encoded_form_text = wide_str_form_text.UTF16LE_Encode(); + WideString wide_str_form_text = pPageView->GetSelectedText(); + ByteString encoded_form_text = wide_str_form_text.UTF16LE_Encode(); unsigned long form_text_len = encoded_form_text.GetLength(); if (buffer && buflen >= form_text_len) @@ -404,8 +404,8 @@ FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle, if (!pPageView) return; - FX_STRSIZE len = CFX_WideString::WStringLength(wsText); - CFX_WideString wide_str_text = CFX_WideString::FromUTF16LE(wsText, len); + FX_STRSIZE len = WideString::WStringLength(wsText); + WideString wide_str_text = WideString::FromUTF16LE(wsText, len); pPageView->ReplaceSelection(wide_str_text); } @@ -500,10 +500,10 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Copy(FPDF_DOCUMENT document, pContext->GetDocType() != XFA_DocType::Static) return; - CFX_WideString wsCpText; + WideString wsCpText; static_cast(hWidget)->Copy(wsCpText); - CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); + ByteString bsCpText = wsCpText.UTF16LE_Encode(); uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); if (!wsText) { *size = len; @@ -532,10 +532,10 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Cut(FPDF_DOCUMENT document, pContext->GetDocType() != XFA_DocType::Static) return; - CFX_WideString wsCpText; + WideString wsCpText; static_cast(hWidget)->Cut(wsCpText); - CFX_ByteString bsCpText = wsCpText.UTF16LE_Encode(); + ByteString bsCpText = wsCpText.UTF16LE_Encode(); uint32_t len = bsCpText.GetLength() / sizeof(unsigned short); if (!wsText) { *size = len; @@ -564,7 +564,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_Widget_Paste(FPDF_DOCUMENT document, pContext->GetDocType() != XFA_DocType::Static) return; - CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size); + WideString wstr = WideString::FromUTF16LE(wsText, size); static_cast(hWidget)->Paste(wstr); } @@ -585,7 +585,7 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, CFX_PointF ptPopup; ptPopup.x = x; ptPopup.y = y; - CFX_ByteStringC bs(bsText); + ByteStringView bs(bsText); static_cast(hWidget)->ReplaceSpellCheckWord(ptPopup, bs); } @@ -606,7 +606,7 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, CFX_PointF ptPopup; ptPopup.x = x; ptPopup.y = y; - auto sSuggestWords = pdfium::MakeUnique>(); + auto sSuggestWords = pdfium::MakeUnique>(); static_cast(hWidget)->GetSuggestWords(ptPopup, sSuggestWords.get()); @@ -616,7 +616,7 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, FPDF_EXPORT int FPDF_CALLCONV FPDF_StringHandleCounts(FPDF_STRINGHANDLE sHandle) { - std::vector* sSuggestWords = FromFPDFStringHandle(sHandle); + std::vector* sSuggestWords = FromFPDFStringHandle(sHandle); return sSuggestWords ? pdfium::CollectionSize(*sSuggestWords) : -1; } @@ -632,7 +632,7 @@ FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE sHandle, if (index < 0 || index >= count) return false; - std::vector* sSuggestWords = FromFPDFStringHandle(sHandle); + std::vector* sSuggestWords = FromFPDFStringHandle(sHandle); uint32_t len = (*sSuggestWords)[index].GetLength(); if (!bsText) { *size = len; @@ -658,7 +658,7 @@ FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, if (!stringHandle || !bsText || size == 0) return false; - FromFPDFStringHandle(stringHandle)->push_back(CFX_ByteString(bsText, size)); + FromFPDFStringHandle(stringHandle)->push_back(ByteString(bsText, size)); return true; } #endif // PDF_ENABLE_XFA diff --git a/fpdfsdk/fpdfformfill_embeddertest.cpp b/fpdfsdk/fpdfformfill_embeddertest.cpp index 56e166252e..2597b37160 100644 --- a/fpdfsdk/fpdfformfill_embeddertest.cpp +++ b/fpdfsdk/fpdfformfill_embeddertest.cpp @@ -106,7 +106,7 @@ class FPDFFormFillInteractiveEmbeddertest : public FPDFFormFillEmbeddertest { FORM_OnLButtonUp(form_handle(), page_, 0, end.x, end.y); } - void CheckSelection(const CFX_WideStringC& expected_string) { + void CheckSelection(const WideStringView& expected_string) { // Calculate expected length for selected text. int num_chars = expected_string.GetLength(); @@ -121,8 +121,7 @@ class FPDFFormFillInteractiveEmbeddertest : public FPDFFormFillEmbeddertest { EXPECT_EQ(expected_length, FORM_GetSelectedText(form_handle(), page_, buf.data(), sel_text_len)); - EXPECT_EQ(expected_string, - CFX_WideString::FromUTF16LE(buf.data(), num_chars)); + EXPECT_EQ(expected_string, WideString::FromUTF16LE(buf.data(), num_chars)); } private: diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index d08de020bb..230fd14fc8 100644 --- a/fpdfsdk/fpdfppo.cpp +++ b/fpdfsdk/fpdfppo.cpp @@ -26,7 +26,7 @@ namespace { CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict, - const CFX_ByteString& bsSrcTag) { + const ByteString& bsSrcTag) { if (!pDict || bsSrcTag.IsEmpty()) return nullptr; if (!pDict->KeyExist("Parent") || !pDict->KeyExist("Type")) @@ -58,7 +58,7 @@ CPDF_Object* PageDictGetInheritableTag(CPDF_Dictionary* pDict, bool CopyInheritable(CPDF_Dictionary* pCurPageDict, CPDF_Dictionary* pSrcPageDict, - const CFX_ByteString& key) { + const ByteString& key) { if (pCurPageDict->KeyExist(key)) return true; @@ -70,7 +70,7 @@ bool CopyInheritable(CPDF_Dictionary* pCurPageDict, return true; } -bool ParserPageRangeString(CFX_ByteString rangstring, +bool ParserPageRangeString(ByteString rangstring, std::vector* pageArray, int nCount) { if (rangstring.IsEmpty()) @@ -78,13 +78,13 @@ bool ParserPageRangeString(CFX_ByteString rangstring, rangstring.Remove(' '); FX_STRSIZE nLength = rangstring.GetLength(); - CFX_ByteString cbCompareString("0123456789-,"); + ByteString cbCompareString("0123456789-,"); for (FX_STRSIZE i = 0; i < nLength; ++i) { if (!cbCompareString.Contains(rangstring[i])) return false; } - CFX_ByteString cbMidRange; + ByteString cbMidRange; FX_STRSIZE nStringFrom = 0; pdfium::Optional nStringTo = 0; while (nStringTo < nLength) { @@ -165,7 +165,7 @@ bool CPDF_PageOrganizer::PDFDocInit() { pDocInfoDict->SetNewFor("Producer", "PDFium", false); - CFX_ByteString cbRootType = pNewRoot->GetStringFor("Type", ""); + ByteString cbRootType = pNewRoot->GetStringFor("Type", ""); if (cbRootType.IsEmpty()) pNewRoot->SetNewFor("Type", "Catalog"); @@ -178,7 +178,7 @@ bool CPDF_PageOrganizer::PDFDocInit() { pNewPages->GetObjNum()); } - CFX_ByteString cbPageType = pNewPages->GetStringFor("Type", ""); + ByteString cbPageType = pNewPages->GetStringFor("Type", ""); if (cbPageType.IsEmpty()) pNewPages->SetNewFor("Type", "Pages"); @@ -205,7 +205,7 @@ bool CPDF_PageOrganizer::ExportPage(const std::vector& pageNums, // Clone the page dictionary for (const auto& it : *pSrcPageDict) { - const CFX_ByteString& cbSrcKeyStr = it.first; + const ByteString& cbSrcKeyStr = it.first; if (cbSrcKeyStr == "Type" || cbSrcKeyStr == "Parent") continue; @@ -271,7 +271,7 @@ bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, CPDF_Dictionary* pDict = pObj->AsDictionary(); auto it = pDict->begin(); while (it != pDict->end()) { - const CFX_ByteString& key = it->first; + const ByteString& key = it->first; CPDF_Object* pNextObj = it->second.get(); ++it; if (key == "Parent" || key == "Prev" || key == "First") @@ -330,7 +330,7 @@ uint32_t CPDF_PageOrganizer::GetNewObjId(ObjectNumberMap* pObjNumberMap, std::unique_ptr pClone = pDirect->Clone(); if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) { if (pDictClone->KeyExist("Type")) { - CFX_ByteString strType = pDictClone->GetStringFor("Type"); + ByteString strType = pDictClone->GetStringFor("Type"); if (!FXSYS_stricmp(strType.c_str(), "Pages")) return 4; if (!FXSYS_stricmp(strType.c_str(), "Page")) diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp index 5b68da4eee..9742974c3a 100644 --- a/fpdfsdk/fpdftext.cpp +++ b/fpdfsdk/fpdftext.cpp @@ -171,7 +171,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page, if (start >= textpage->CountChars()) return 0; - CFX_WideString str = textpage->GetPageText(start, count - 1); + WideString str = textpage->GetPageText(start, count - 1); if (str.GetLength() <= 0) return 0; @@ -180,7 +180,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetText(FPDF_TEXTPAGE text_page, // UFT16LE_Encode doesn't handle surrogate pairs properly, so it is expected // the number of items to stay the same. - CFX_ByteString cbUTF16str = str.UTF16LE_Encode(); + ByteString cbUTF16str = str.UTF16LE_Encode(); ASSERT(cbUTF16str.GetLength() / kBytesPerCharacter <= static_cast(count)); memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()), @@ -229,12 +229,12 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, CPDF_TextPage* textpage = CPDFTextPageFromFPDFTextPage(text_page); CFX_FloatRect rect((float)left, (float)bottom, (float)right, (float)top); - CFX_WideString str = textpage->GetTextByRect(rect); + WideString str = textpage->GetTextByRect(rect); if (buflen <= 0 || !buffer) return str.GetLength(); - CFX_ByteString cbUTF16Str = str.UTF16LE_Encode(); + ByteString cbUTF16Str = str.UTF16LE_Encode(); int len = cbUTF16Str.GetLength() / sizeof(unsigned short); int size = buflen > len ? len : buflen; memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)), @@ -256,8 +256,8 @@ FPDFText_FindStart(FPDF_TEXTPAGE text_page, CPDF_TextPageFind* textpageFind = new CPDF_TextPageFind(CPDFTextPageFromFPDFTextPage(text_page)); - FX_STRSIZE len = CFX_WideString::WStringLength(findwhat); - textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags, + FX_STRSIZE len = WideString::WStringLength(findwhat); + textpageFind->FindFirst(WideString::FromUTF16LE(findwhat, len), flags, start_index >= 0 ? pdfium::Optional(start_index) : pdfium::Optional()); @@ -330,12 +330,12 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFLink_GetURL(FPDF_PAGELINK link_page, int link_index, unsigned short* buffer, int buflen) { - CFX_WideString wsUrl(L""); + WideString wsUrl(L""); if (link_page && link_index >= 0) { CPDF_LinkExtract* pageLink = CPDFLinkExtractFromFPDFPageLink(link_page); wsUrl = pageLink->GetURL(link_index); } - CFX_ByteString cbUTF16URL = wsUrl.UTF16LE_Encode(); + ByteString cbUTF16URL = wsUrl.UTF16LE_Encode(); int required = cbUTF16URL.GetLength() / sizeof(unsigned short); if (!buffer || buflen <= 0) return required; diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 0aaafe8afb..8bca376cdf 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -348,9 +348,9 @@ CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment) { return static_cast(attachment); } -CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) { - return CFX_WideString::FromUTF16LE(wide_string, - CFX_WideString::WStringLength(wide_string)) +ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string) { + return WideString::FromUTF16LE(wide_string, + WideString::WStringLength(wide_string)) .UTF8Encode(); } @@ -358,10 +358,10 @@ CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap) { return static_cast(bitmap); } -unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text, +unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text, void* buffer, unsigned long buflen) { - CFX_ByteString encoded_text = text.UTF16LE_Encode(); + ByteString encoded_text = text.UTF16LE_Encode(); unsigned long len = encoded_text.GetLength(); if (buffer && len <= buflen) memcpy(buffer, encoded_text.c_str(), len); @@ -380,7 +380,7 @@ unsigned long DecodeStreamMaybeCopyAndReturnLength(const CPDF_Stream* stream, // Decode the stream if one or more stream filters are specified. uint8_t* decoded_data = nullptr; uint32_t decoded_len = 0; - CFX_ByteString dummy_last_decoder; + ByteString dummy_last_decoder; CPDF_Dictionary* dummy_last_param; if (PDF_DataDecode(data, len, dict, dict->GetIntegerFor("DL"), false, &decoded_data, &decoded_len, &dummy_last_decoder, @@ -1313,7 +1313,7 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document) { if (!pDoc) return DuplexUndefined; CPDF_ViewerPreferences viewRef(pDoc); - CFX_ByteString duplex = viewRef.Duplex(); + ByteString duplex = viewRef.Duplex(); if ("Simplex" == duplex) return Simplex; if ("DuplexFlipShortEdge" == duplex) @@ -1333,7 +1333,7 @@ FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, return 0; CPDF_ViewerPreferences viewRef(pDoc); - CFX_ByteString bsVal; + ByteString bsVal; if (!viewRef.GenericName(key, &bsVal)) return 0; @@ -1375,7 +1375,7 @@ FPDF_GetNamedDestByName(FPDF_DOCUMENT document, FPDF_BYTESTRING name) { return nullptr; CPDF_NameTree name_tree(pDoc, "Dests"); - return name_tree.LookupNamedDest(pDoc, PDF_DecodeText(CFX_ByteString(name))); + return name_tree.LookupNamedDest(pDoc, PDF_DecodeText(ByteString(name))); } #ifdef PDF_ENABLE_XFA @@ -1450,7 +1450,7 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document, return nullptr; CPDF_Object* pDestObj = nullptr; - CFX_WideString wsName; + WideString wsName; CPDF_NameTree nameTree(pDoc, "Dests"); int count = nameTree.GetCount(); if (index >= count) { @@ -1465,7 +1465,7 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document, index -= count; int i = 0; - CFX_ByteString bsName; + ByteString bsName; for (const auto& it : *pDest) { bsName = it.first; pDestObj = it.second.get(); @@ -1489,7 +1489,7 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document, if (!pDestObj->IsArray()) return nullptr; - CFX_ByteString utf16Name = wsName.UTF16LE_Encode(); + ByteString utf16Name = wsName.UTF16LE_Encode(); int len = utf16Name.GetLength(); if (!buffer) { *buflen = len; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp index 1032d49edc..8779c44186 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp @@ -219,19 +219,19 @@ v8::Isolate* CPDFXFA_Context::GetJSERuntime() const { return runtime->GetIsolate(); } -CFX_WideString CPDFXFA_Context::GetAppTitle() const { +WideString CPDFXFA_Context::GetAppTitle() const { return L"PDFium"; } -CFX_WideString CPDFXFA_Context::GetAppName() { +WideString CPDFXFA_Context::GetAppName() { return m_pFormFillEnv ? m_pFormFillEnv->FFI_GetAppName() : L""; } -CFX_WideString CPDFXFA_Context::GetLanguage() { +WideString CPDFXFA_Context::GetLanguage() { return m_pFormFillEnv ? m_pFormFillEnv->GetLanguage() : L""; } -CFX_WideString CPDFXFA_Context::GetPlatform() { +WideString CPDFXFA_Context::GetPlatform() { return m_pFormFillEnv ? m_pFormFillEnv->GetPlatform() : L""; } @@ -240,8 +240,8 @@ void CPDFXFA_Context::Beep(uint32_t dwType) { m_pFormFillEnv->JS_appBeep(dwType); } -int32_t CPDFXFA_Context::MsgBox(const CFX_WideString& wsMessage, - const CFX_WideString& wsTitle, +int32_t CPDFXFA_Context::MsgBox(const WideString& wsMessage, + const WideString& wsTitle, uint32_t dwIconType, uint32_t dwButtonType) { if (!m_pFormFillEnv) @@ -292,12 +292,12 @@ int32_t CPDFXFA_Context::MsgBox(const CFX_WideString& wsMessage, return XFA_IDYes; } -CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion, - const CFX_WideString& wsTitle, - const CFX_WideString& wsDefaultAnswer, - bool bMark) { +WideString CPDFXFA_Context::Response(const WideString& wsQuestion, + const WideString& wsTitle, + const WideString& wsDefaultAnswer, + bool bMark) { if (!m_pFormFillEnv) - return CFX_WideString(); + return WideString(); int nLength = 2048; std::vector pBuff(nLength); @@ -305,27 +305,27 @@ CFX_WideString CPDFXFA_Context::Response(const CFX_WideString& wsQuestion, wsDefaultAnswer.c_str(), nullptr, bMark, pBuff.data(), nLength); if (nLength <= 0) - return CFX_WideString(); + return WideString(); nLength = std::min(2046, nLength); pBuff[nLength] = 0; pBuff[nLength + 1] = 0; - return CFX_WideString::FromUTF16LE(reinterpret_cast(pBuff.data()), - nLength / sizeof(uint16_t)); + return WideString::FromUTF16LE(reinterpret_cast(pBuff.data()), + nLength / sizeof(uint16_t)); } CFX_RetainPtr CPDFXFA_Context::DownloadURL( - const CFX_WideString& wsURL) { + const WideString& wsURL) { return m_pFormFillEnv ? m_pFormFillEnv->DownloadFromURL(wsURL.c_str()) : nullptr; } -bool CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL, - const CFX_WideString& wsData, - const CFX_WideString& wsContentType, - const CFX_WideString& wsEncode, - const CFX_WideString& wsHeader, - CFX_WideString& wsResponse) { +bool CPDFXFA_Context::PostRequestURL(const WideString& wsURL, + const WideString& wsData, + const WideString& wsContentType, + const WideString& wsEncode, + const WideString& wsHeader, + WideString& wsResponse) { if (!m_pFormFillEnv) return false; @@ -335,9 +335,9 @@ bool CPDFXFA_Context::PostRequestURL(const CFX_WideString& wsURL, return true; } -bool CPDFXFA_Context::PutRequestURL(const CFX_WideString& wsURL, - const CFX_WideString& wsData, - const CFX_WideString& wsEncode) { +bool CPDFXFA_Context::PutRequestURL(const WideString& wsURL, + const WideString& wsData, + const WideString& wsEncode) { return m_pFormFillEnv && m_pFormFillEnv->PutRequestURL(wsURL.c_str(), wsData.c_str(), wsEncode.c_str()); diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.h b/fpdfsdk/fpdfxfa/cpdfxfa_context.h index 586e12d5be..a0f90ab37b 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.h @@ -56,31 +56,31 @@ class CPDFXFA_Context : public IXFA_AppProvider { void ClearChangeMark(); // IFXA_AppProvider: - CFX_WideString GetLanguage() override; - CFX_WideString GetPlatform() override; - CFX_WideString GetAppName() override; - CFX_WideString GetAppTitle() const override; + WideString GetLanguage() override; + WideString GetPlatform() override; + WideString GetAppName() override; + WideString GetAppTitle() const override; void Beep(uint32_t dwType) override; - int32_t MsgBox(const CFX_WideString& wsMessage, - const CFX_WideString& wsTitle, + int32_t MsgBox(const WideString& wsMessage, + const WideString& wsTitle, uint32_t dwIconType, uint32_t dwButtonType) override; - CFX_WideString Response(const CFX_WideString& wsQuestion, - const CFX_WideString& wsTitle, - const CFX_WideString& wsDefaultAnswer, - bool bMark) override; + WideString Response(const WideString& wsQuestion, + const WideString& wsTitle, + const WideString& wsDefaultAnswer, + bool bMark) override; CFX_RetainPtr DownloadURL( - const CFX_WideString& wsURL) override; - bool PostRequestURL(const CFX_WideString& wsURL, - const CFX_WideString& wsData, - const CFX_WideString& wsContentType, - const CFX_WideString& wsEncode, - const CFX_WideString& wsHeader, - CFX_WideString& wsResponse) override; - bool PutRequestURL(const CFX_WideString& wsURL, - const CFX_WideString& wsData, - const CFX_WideString& wsEncode) override; + const WideString& wsURL) override; + bool PostRequestURL(const WideString& wsURL, + const WideString& wsData, + const WideString& wsContentType, + const WideString& wsEncode, + const WideString& wsHeader, + WideString& wsResponse) override; + bool PutRequestURL(const WideString& wsURL, + const WideString& wsData, + const WideString& wsEncode) override; IFWL_AdapterTimerMgr* GetTimerMgr() override; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 65379254f0..b4dc3f1ed0 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -379,8 +379,7 @@ void CPDFXFA_DocEnvironment::SetCalculationsEnabled(CXFA_FFDoc* hDoc, } } -void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, - CFX_WideString& wsTitle) { +void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, WideString& wsTitle) { if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc()) return; @@ -388,13 +387,13 @@ void CPDFXFA_DocEnvironment::GetTitle(CXFA_FFDoc* hDoc, if (!pInfoDict) return; - CFX_ByteString csTitle = pInfoDict->GetStringFor("Title"); + ByteString csTitle = pInfoDict->GetStringFor("Title"); wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); csTitle.ReleaseBuffer(csTitle.GetLength()); } void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc, - const CFX_WideString& wsTitle) { + const WideString& wsTitle) { if (hDoc != m_pContext->GetXFADoc() || !m_pContext->GetPDFDoc()) return; @@ -404,7 +403,7 @@ void CPDFXFA_DocEnvironment::SetTitle(CXFA_FFDoc* hDoc, } void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, - const CFX_WideString& wsFilePath, + const WideString& wsFilePath, bool bXDP) { if (hDoc != m_pContext->GetXFADoc()) return; @@ -419,14 +418,14 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, return; int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; - CFX_ByteString bs = wsFilePath.UTF16LE_Encode(); + ByteString bs = wsFilePath.UTF16LE_Encode(); if (wsFilePath.IsEmpty()) { if (!pFormFillEnv->GetFormFillInfo() || !pFormFillEnv->GetFormFillInfo()->m_pJsPlatform) { return; } - CFX_WideString filepath = pFormFillEnv->JS_fieldBrowse(); + WideString filepath = pFormFillEnv->JS_fieldBrowse(); bs = filepath.UTF16LE_Encode(); } int len = bs.GetLength(); @@ -439,7 +438,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, CFX_RetainPtr fileWrite = MakeSeekableStream(pFileHandler); - CFX_ByteString content; + ByteString content; if (fileType == FXFA_SAVEAS_XML) { content = "\r\n"; fileWrite->WriteBlock(content.c_str(), fileWrite->GetSize(), @@ -485,10 +484,10 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, continue; } if (i == size - 1) { - CFX_WideString wPath = CFX_WideString::FromUTF16LE( + WideString wPath = WideString::FromUTF16LE( reinterpret_cast(bs.c_str()), bs.GetLength() / sizeof(unsigned short)); - CFX_ByteString bPath = wPath.UTF8Encode(); + ByteString bPath = wPath.UTF8Encode(); const char* szFormat = "\n"; content.Format(szFormat, bPath.c_str()); @@ -505,7 +504,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, } void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, - const CFX_WideString& bsURL) { + const WideString& bsURL) { if (hDoc != m_pContext->GetXFADoc()) return; @@ -516,7 +515,7 @@ void CPDFXFA_DocEnvironment::GotoURL(CXFA_FFDoc* hDoc, if (!pFormFillEnv) return; - CFX_WideStringC str(bsURL.c_str()); + WideStringView str(bsURL.c_str()); pFormFillEnv->GotoURL(m_pContext.Get(), str); } @@ -644,9 +643,9 @@ bool CPDFXFA_DocEnvironment::OnBeforeNotifySubmit() { if (!pFormFillEnv) return false; - CFX_WideString ws; + WideString ws; ws.FromLocal(IDS_XFA_Validate_Input); - CFX_ByteString bs = ws.UTF16LE_Encode(); + ByteString bs = ws.UTF16LE_Encode(); int len = bs.GetLength(); pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len), (FPDF_WIDESTRING)L"", 0, 1); @@ -700,12 +699,12 @@ bool CPDFXFA_DocEnvironment::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { CFX_RetainPtr CPDFXFA_DocEnvironment::OpenLinkedFile( CXFA_FFDoc* hDoc, - const CFX_WideString& wsLink) { + const WideString& wsLink) { CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); if (!pFormFillEnv) return nullptr; - CFX_ByteString bs = wsLink.UTF16LE_Encode(); + ByteString bs = wsLink.UTF16LE_Encode(); int len = bs.GetLength(); FPDF_FILEHANDLER* pFileHandler = pFormFillEnv->OpenFile(0, (FPDF_WIDESTRING)bs.GetBuffer(len), "rb"); @@ -723,7 +722,7 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, if (!m_pContext->GetXFADocView()) return false; - CFX_ByteString content; + ByteString content; CPDFSDK_FormFillEnvironment* pFormFillEnv = m_pContext->GetFormFillEnv(); if (!pFormFillEnv) return false; @@ -808,7 +807,7 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, return true; } -void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent, +void CPDFXFA_DocEnvironment::ToXFAContentFlags(WideString csSrcContent, FPDF_DWORD& flag) { if (csSrcContent.Contains(L" config ")) flag |= FXFA_CONFIG; @@ -830,19 +829,19 @@ void CPDFXFA_DocEnvironment::ToXFAContentFlags(CFX_WideString csSrcContent, } } -bool CPDFXFA_DocEnvironment::MailToInfo(CFX_WideString& csURL, - CFX_WideString& csToAddress, - CFX_WideString& csCCAddress, - CFX_WideString& csBCCAddress, - CFX_WideString& csSubject, - CFX_WideString& csMsg) { - CFX_WideString srcURL = csURL; +bool CPDFXFA_DocEnvironment::MailToInfo(WideString& csURL, + WideString& csToAddress, + WideString& csCCAddress, + WideString& csBCCAddress, + WideString& csSubject, + WideString& csMsg) { + WideString srcURL = csURL; srcURL.TrimLeft(); if (srcURL.Left(7).CompareNoCase(L"mailto:") != 0) return false; auto pos = srcURL.Find(L'?'); - CFX_WideString tmp; + WideString tmp; if (!pos.has_value()) { pos = srcURL.Find(L'@'); if (!pos.has_value()) @@ -903,13 +902,13 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, if (!pFormFillEnv) return false; - CFX_WideStringC csURLC; + WideStringView csURLC; submit.GetSubmitTarget(csURLC); - CFX_WideString csURL(csURLC); + WideString csURL(csURLC); if (csURL.IsEmpty()) { - CFX_WideString ws; + WideString ws; ws.FromLocal("Submit cancelled."); - CFX_ByteString bs = ws.UTF16LE_Encode(); + ByteString bs = ws.UTF16LE_Encode(); int len = bs.GetLength(); pFormFillEnv->Alert((FPDF_WIDESTRING)bs.GetBuffer(len), (FPDF_WIDESTRING)L"", 0, 4); @@ -921,13 +920,13 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, int fileFlag = -1; switch (submit.GetSubmitFormat()) { case XFA_ATTRIBUTEENUM_Xdp: { - CFX_WideStringC csContentC; + WideStringView csContentC; submit.GetSubmitXDPContent(csContentC); - CFX_WideString csContent; + WideString csContent; csContent = csContentC; csContent.TrimLeft(); csContent.TrimRight(); - CFX_WideString space; + WideString space; space.FromLocal(" "); csContent = space + csContent + space; FPDF_DWORD flag = 0; @@ -958,20 +957,20 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, if (!pFileHandler) return false; if (csURL.Left(7).CompareNoCase(L"mailto:") == 0) { - CFX_WideString csToAddress; - CFX_WideString csCCAddress; - CFX_WideString csBCCAddress; - CFX_WideString csSubject; - CFX_WideString csMsg; + WideString csToAddress; + WideString csCCAddress; + WideString csBCCAddress; + WideString csSubject; + WideString csMsg; if (!MailToInfo(csURL, csToAddress, csCCAddress, csBCCAddress, csSubject, csMsg)) { return false; } - CFX_ByteString bsTo = CFX_WideString(csToAddress).UTF16LE_Encode(); - CFX_ByteString bsCC = CFX_WideString(csCCAddress).UTF16LE_Encode(); - CFX_ByteString bsBcc = CFX_WideString(csBCCAddress).UTF16LE_Encode(); - CFX_ByteString bsSubject = CFX_WideString(csSubject).UTF16LE_Encode(); - CFX_ByteString bsMsg = CFX_WideString(csMsg).UTF16LE_Encode(); + ByteString bsTo = WideString(csToAddress).UTF16LE_Encode(); + ByteString bsCC = WideString(csCCAddress).UTF16LE_Encode(); + ByteString bsBcc = WideString(csBCCAddress).UTF16LE_Encode(); + ByteString bsSubject = WideString(csSubject).UTF16LE_Encode(); + ByteString bsMsg = WideString(csMsg).UTF16LE_Encode(); FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength()); FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength()); FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength()); @@ -986,8 +985,8 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, bsMsg.ReleaseBuffer(bsMsg.GetStringLength()); } else { // HTTP or FTP - CFX_WideString ws; - CFX_ByteString bs = csURL.UTF16LE_Encode(); + WideString ws; + ByteString bs = csURL.UTF16LE_Encode(); int len = bs.GetLength(); pFormFillEnv->UploadTo(pFileHandler, fileFlag, (FPDF_WIDESTRING)bs.GetBuffer(len)); @@ -996,10 +995,9 @@ bool CPDFXFA_DocEnvironment::SubmitDataInternal(CXFA_FFDoc* hDoc, return true; } -bool CPDFXFA_DocEnvironment::SetGlobalProperty( - CXFA_FFDoc* hDoc, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pValue) { +bool CPDFXFA_DocEnvironment::SetGlobalProperty(CXFA_FFDoc* hDoc, + const ByteStringView& szPropName, + CFXJSE_Value* pValue) { if (hDoc != m_pContext->GetXFADoc()) return false; if (!m_pContext->GetFormFillEnv() || @@ -1013,10 +1011,9 @@ bool CPDFXFA_DocEnvironment::SetGlobalProperty( return bRet; } -bool CPDFXFA_DocEnvironment::GetGlobalProperty( - CXFA_FFDoc* hDoc, - const CFX_ByteStringC& szPropName, - CFXJSE_Value* pValue) { +bool CPDFXFA_DocEnvironment::GetGlobalProperty(CXFA_FFDoc* hDoc, + const ByteStringView& szPropName, + CFXJSE_Value* pValue) { if (hDoc != m_pContext->GetXFADoc()) return false; if (!m_pContext->GetFormFillEnv() || diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h index 90bc6dea04..e6a0f926af 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.h @@ -49,12 +49,12 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { void SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) override; bool IsCalculationsEnabled(CXFA_FFDoc* hDoc) override; void SetCalculationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override; - void GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) override; - void SetTitle(CXFA_FFDoc* hDoc, const CFX_WideString& wsTitle) override; + void GetTitle(CXFA_FFDoc* hDoc, WideString& wsTitle) override; + void SetTitle(CXFA_FFDoc* hDoc, const WideString& wsTitle) override; void ExportData(CXFA_FFDoc* hDoc, - const CFX_WideString& wsFilePath, + const WideString& wsFilePath, bool bXDP) override; - void GotoURL(CXFA_FFDoc* hDoc, const CFX_WideString& bsURL) override; + void GotoURL(CXFA_FFDoc* hDoc, const WideString& bsURL) override; bool IsValidationsEnabled(CXFA_FFDoc* hDoc) override; void SetValidationsEnabled(CXFA_FFDoc* hDoc, bool bEnabled) override; void SetFocusWidget(CXFA_FFDoc* hDoc, CXFA_FFWidget* hWidget) override; @@ -79,32 +79,32 @@ class CPDFXFA_DocEnvironment : public IXFA_DocEnvironment { bool SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) override; bool GetGlobalProperty(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue) override; bool SetGlobalProperty(CXFA_FFDoc* hDoc, - const CFX_ByteStringC& szPropName, + const ByteStringView& szPropName, CFXJSE_Value* pValue) override; CFX_RetainPtr OpenLinkedFile( CXFA_FFDoc* hDoc, - const CFX_WideString& wsLink) override; + const WideString& wsLink) override; private: bool OnBeforeNotifySubmit(); void OnAfterNotifySubmit(); bool NotifySubmit(bool bPrevOrPost); bool SubmitDataInternal(CXFA_FFDoc* hDoc, CXFA_Submit submit); - bool MailToInfo(CFX_WideString& csURL, - CFX_WideString& csToAddress, - CFX_WideString& csCCAddress, - CFX_WideString& csBCCAddress, - CFX_WideString& csSubject, - CFX_WideString& csMsg); + bool MailToInfo(WideString& csURL, + WideString& csToAddress, + WideString& csCCAddress, + WideString& csBCCAddress, + WideString& csSubject, + WideString& csMsg); bool ExportSubmitFile(FPDF_FILEHANDLER* ppFileHandler, int fileType, FPDF_DWORD encodeType, FPDF_DWORD flag); - void ToXFAContentFlags(CFX_WideString csSrcContent, FPDF_DWORD& flag); + void ToXFAContentFlags(WideString csSrcContent, FPDF_DWORD& flag); CFX_UnownedPtr const m_pContext; }; diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp index 776a1714cd..ea7d2c3a08 100644 --- a/fpdfsdk/fsdk_actionhandler.cpp +++ b/fpdfsdk/fsdk_actionhandler.cpp @@ -29,10 +29,10 @@ bool CPDFSDK_ActionHandler::DoAction_DocOpen( bool CPDFSDK_ActionHandler::DoAction_JavaScript( const CPDF_Action& JsAction, - CFX_WideString csJSName, + WideString csJSName, CPDFSDK_FormFillEnvironment* pFormFillEnv) { if (JsAction.GetType() == CPDF_Action::JavaScript) { - CFX_WideString swJS = JsAction.GetJavaScript(); + WideString swJS = JsAction.GetJavaScript(); if (!swJS.IsEmpty()) { RunDocumentOpenJavaScript(pFormFillEnv, csJSName, swJS); return true; @@ -51,7 +51,7 @@ bool CPDFSDK_ActionHandler::DoAction_FieldJavaScript( ASSERT(pFormFillEnv); if (pFormFillEnv->IsJSInitiated() && JsAction.GetType() == CPDF_Action::JavaScript) { - CFX_WideString swJS = JsAction.GetJavaScript(); + WideString swJS = JsAction.GetJavaScript(); if (!swJS.IsEmpty()) { RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS); return true; @@ -125,7 +125,7 @@ bool CPDFSDK_ActionHandler::ExecuteDocumentOpenAction( ASSERT(pFormFillEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pFormFillEnv->IsJSInitiated()) { - CFX_WideString swJS = action.GetJavaScript(); + WideString swJS = action.GetJavaScript(); if (!swJS.IsEmpty()) { RunDocumentOpenJavaScript(pFormFillEnv, L"", swJS); } @@ -156,13 +156,13 @@ bool CPDFSDK_ActionHandler::ExecuteLinkAction( ASSERT(pFormFillEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pFormFillEnv->IsJSInitiated()) { - CFX_WideString swJS = action.GetJavaScript(); + WideString swJS = action.GetJavaScript(); if (!swJS.IsEmpty()) { IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); IJS_EventContext* pContext = pRuntime->NewEventContext(); pContext->OnLink_MouseUp(pFormFillEnv); - CFX_WideString csInfo; + WideString csInfo; bool bRet = pContext->RunScript(swJS, &csInfo); pRuntime->ReleaseEventContext(pContext); if (!bRet) { @@ -197,7 +197,7 @@ bool CPDFSDK_ActionHandler::ExecuteDocumentPageAction( ASSERT(pFormFillEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pFormFillEnv->IsJSInitiated()) { - CFX_WideString swJS = action.GetJavaScript(); + WideString swJS = action.GetJavaScript(); if (!swJS.IsEmpty()) { RunDocumentPageJavaScript(pFormFillEnv, type, swJS); } @@ -244,7 +244,7 @@ bool CPDFSDK_ActionHandler::ExecuteFieldAction( ASSERT(pFormFillEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pFormFillEnv->IsJSInitiated()) { - CFX_WideString swJS = action.GetJavaScript(); + WideString swJS = action.GetJavaScript(); if (!swJS.IsEmpty()) { RunFieldJavaScript(pFormFillEnv, pFormField, type, data, swJS); if (!IsValidField(pFormFillEnv, pFormField->GetFieldDict())) @@ -280,11 +280,11 @@ bool CPDFSDK_ActionHandler::ExecuteScreenAction( ASSERT(pFormFillEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pFormFillEnv->IsJSInitiated()) { - CFX_WideString swJS = action.GetJavaScript(); + WideString swJS = action.GetJavaScript(); if (!swJS.IsEmpty()) { IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); IJS_EventContext* pContext = pRuntime->NewEventContext(); - CFX_WideString csInfo; + WideString csInfo; bool bRet = pContext->RunScript(swJS, &csInfo); pRuntime->ReleaseEventContext(pContext); if (!bRet) { @@ -319,13 +319,13 @@ bool CPDFSDK_ActionHandler::ExecuteBookMark( ASSERT(pFormFillEnv); if (action.GetType() == CPDF_Action::JavaScript) { if (pFormFillEnv->IsJSInitiated()) { - CFX_WideString swJS = action.GetJavaScript(); + WideString swJS = action.GetJavaScript(); if (!swJS.IsEmpty()) { IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); IJS_EventContext* pContext = pRuntime->NewEventContext(); pContext->OnBookmark_MouseUp(pBookmark); - CFX_WideString csInfo; + WideString csInfo; bool bRet = pContext->RunScript(swJS, &csInfo); pRuntime->ReleaseEventContext(pContext); if (!bRet) { @@ -444,7 +444,7 @@ void CPDFSDK_ActionHandler::DoAction_URI( const CPDF_Action& action) { ASSERT(action.GetDict()); - CFX_ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument()); + ByteString sURI = action.GetURI(pFormFillEnv->GetPDFDocument()); pFormFillEnv->DoURIAction(sURI.c_str()); } @@ -453,7 +453,7 @@ void CPDFSDK_ActionHandler::DoAction_Named( const CPDF_Action& action) { ASSERT(action.GetDict()); - CFX_ByteString csName = action.GetNamedAction(); + ByteString csName = action.GetNamedAction(); pFormFillEnv->ExecuteNamedAction(csName.c_str()); } @@ -466,7 +466,7 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript( CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, - const CFX_WideString& script) { + const WideString& script) { ASSERT(type != CPDF_AAction::Calculate); ASSERT(type != CPDF_AAction::Format); @@ -509,7 +509,7 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript( break; } - CFX_WideString csInfo; + WideString csInfo; bool bRet = pContext->RunScript(script, &csInfo); pRuntime->ReleaseEventContext(pContext); if (!bRet) { @@ -519,13 +519,13 @@ void CPDFSDK_ActionHandler::RunFieldJavaScript( void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& sScriptName, - const CFX_WideString& script) { + const WideString& sScriptName, + const WideString& script) { IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); IJS_EventContext* pContext = pRuntime->NewEventContext(); pContext->OnDoc_Open(pFormFillEnv, sScriptName); - CFX_WideString csInfo; + WideString csInfo; bool bRet = pContext->RunScript(script, &csInfo); pRuntime->ReleaseEventContext(pContext); if (!bRet) { @@ -536,7 +536,7 @@ void CPDFSDK_ActionHandler::RunDocumentOpenJavaScript( void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_AAction::AActionType type, - const CFX_WideString& script) { + const WideString& script) { IJS_Runtime* pRuntime = pFormFillEnv->GetJSRuntime(); IJS_EventContext* pContext = pRuntime->NewEventContext(); switch (type) { @@ -572,7 +572,7 @@ void CPDFSDK_ActionHandler::RunDocumentPageJavaScript( break; } - CFX_WideString csInfo; + WideString csInfo; bool bRet = pContext->RunScript(script, &csInfo); pRuntime->ReleaseEventContext(pContext); if (!bRet) { diff --git a/fpdfsdk/fsdk_actionhandler.h b/fpdfsdk/fsdk_actionhandler.h index 1c8dedefd7..7457b4ed91 100644 --- a/fpdfsdk/fsdk_actionhandler.h +++ b/fpdfsdk/fsdk_actionhandler.h @@ -26,7 +26,7 @@ class CPDFSDK_ActionHandler { bool DoAction_DocOpen(const CPDF_Action& action, CPDFSDK_FormFillEnvironment* pFormFillEnv); bool DoAction_JavaScript(const CPDF_Action& JsAction, - CFX_WideString csJSName, + WideString csJSName, CPDFSDK_FormFillEnvironment* pFormFillEnv); bool DoAction_Page(const CPDF_Action& action, enum CPDF_AAction::AActionType eType, @@ -86,15 +86,15 @@ class CPDFSDK_ActionHandler { CPDFSDK_FormFillEnvironment* pFormFillEnv); void RunDocumentPageJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_AAction::AActionType type, - const CFX_WideString& script); + const WideString& script); void RunDocumentOpenJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv, - const CFX_WideString& sScriptName, - const CFX_WideString& script); + const WideString& sScriptName, + const WideString& script); void RunFieldJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_FormField* pFormField, CPDF_AAction::AActionType type, PDFSDK_FieldAction& data, - const CFX_WideString& script); + const WideString& script); bool IsValidField(CPDFSDK_FormFillEnvironment* pFormFillEnv, CPDF_Dictionary* pFieldDict); diff --git a/fpdfsdk/fsdk_define.h b/fpdfsdk/fsdk_define.h index 91efc27f1a..e58ddb1a49 100644 --- a/fpdfsdk/fsdk_define.h +++ b/fpdfsdk/fsdk_define.h @@ -70,11 +70,11 @@ CPDF_PageObject* CPDFPageObjectFromFPDFPageObject(FPDF_PAGEOBJECT page_object); CPDF_Object* CPDFObjectFromFPDFAttachment(FPDF_ATTACHMENT attachment); -CFX_ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string); +ByteString CFXByteStringFromFPDFWideString(FPDF_WIDESTRING wide_string); CFX_DIBitmap* CFXBitmapFromFPDFBitmap(FPDF_BITMAP bitmap); -unsigned long Utf16EncodeMaybeCopyAndReturnLength(const CFX_WideString& text, +unsigned long Utf16EncodeMaybeCopyAndReturnLength(const WideString& text, void* buffer, unsigned long buflen); diff --git a/fpdfsdk/fsdk_filewriteadapter.cpp b/fpdfsdk/fsdk_filewriteadapter.cpp index 50394c3286..fad058fb54 100644 --- a/fpdfsdk/fsdk_filewriteadapter.cpp +++ b/fpdfsdk/fsdk_filewriteadapter.cpp @@ -17,6 +17,6 @@ bool FSDK_FileWriteAdapter::WriteBlock(const void* data, size_t size) { return fileWriteStruct_->WriteBlock(fileWriteStruct_, data, size) != 0; } -bool FSDK_FileWriteAdapter::WriteString(const CFX_ByteStringC& str) { +bool FSDK_FileWriteAdapter::WriteString(const ByteStringView& str) { return WriteBlock(str.unterminated_c_str(), str.GetLength()); } diff --git a/fpdfsdk/fsdk_filewriteadapter.h b/fpdfsdk/fsdk_filewriteadapter.h index f2c3a534bf..5e9eaabea6 100644 --- a/fpdfsdk/fsdk_filewriteadapter.h +++ b/fpdfsdk/fsdk_filewriteadapter.h @@ -17,7 +17,7 @@ class FSDK_FileWriteAdapter : public IFX_WriteStream { friend CFX_RetainPtr pdfium::MakeRetain(Args&&... args); bool WriteBlock(const void* data, size_t size) override; - bool WriteString(const CFX_ByteStringC& str) override; + bool WriteString(const ByteStringView& str) override; private: explicit FSDK_FileWriteAdapter(FPDF_FILEWRITE* fileWriteStruct); diff --git a/fpdfsdk/ipdfsdk_annothandler.h b/fpdfsdk/ipdfsdk_annothandler.h index b7f7cbe7f8..bffeac658b 100644 --- a/fpdfsdk/ipdfsdk_annothandler.h +++ b/fpdfsdk/ipdfsdk_annothandler.h @@ -35,9 +35,9 @@ class IPDFSDK_AnnotHandler { virtual void ReleaseAnnot(CPDFSDK_Annot* pAnnot) = 0; virtual CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot) = 0; - virtual CFX_WideString GetSelectedText(CPDFSDK_Annot* pAnnot) = 0; + virtual WideString GetSelectedText(CPDFSDK_Annot* pAnnot) = 0; virtual void ReplaceSelection(CPDFSDK_Annot* pAnnot, - const CFX_WideString& text) = 0; + const WideString& text) = 0; virtual bool HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, const CFX_PointF& point) = 0; 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; diff --git a/fpdfsdk/pdfsdk_fieldaction.h b/fpdfsdk/pdfsdk_fieldaction.h index 4ee56ac3f6..aec5dcaa27 100644 --- a/fpdfsdk/pdfsdk_fieldaction.h +++ b/fpdfsdk/pdfsdk_fieldaction.h @@ -25,12 +25,12 @@ struct PDFSDK_FieldAction { bool bModifier; bool bShift; int nCommitKey; - CFX_WideString sChange; - CFX_WideString sChangeEx; + WideString sChange; + WideString sChangeEx; bool bKeyDown; int nSelEnd; int nSelStart; - CFX_WideString sValue; + WideString sValue; bool bWillCommit; bool bFieldFull; bool bRC; diff --git a/fpdfsdk/pwl/cpwl_appstream.cpp b/fpdfsdk/pwl/cpwl_appstream.cpp index c7188ada07..6a19efb906 100644 --- a/fpdfsdk/pwl/cpwl_appstream.cpp +++ b/fpdfsdk/pwl/cpwl_appstream.cpp @@ -79,8 +79,8 @@ const char kTextEndOperator[] = "ET"; class AutoClosedCommand { public: AutoClosedCommand(std::ostringstream* stream, - CFX_ByteString open, - CFX_ByteString close) + ByteString open, + ByteString close) : stream_(stream), close_(close) { *stream_ << open << "\n"; } @@ -89,7 +89,7 @@ class AutoClosedCommand { private: std::ostringstream* stream_; - CFX_ByteString close_; + ByteString close_; }; class AutoClosedQCommand : public AutoClosedCommand { @@ -99,8 +99,8 @@ class AutoClosedQCommand : public AutoClosedCommand { ~AutoClosedQCommand() override {} }; -CFX_ByteString GetColorAppStream(const CFX_Color& color, - const bool& bFillOrStroke) { +ByteString GetColorAppStream(const CFX_Color& color, + const bool& bFillOrStroke) { std::ostringstream sColorStream; switch (color.nColorType) { @@ -125,10 +125,10 @@ CFX_ByteString GetColorAppStream(const CFX_Color& color, break; } - return CFX_ByteString(sColorStream); + return ByteString(sColorStream); } -CFX_ByteString GetAP_Check(const CFX_FloatRect& crBBox) { +ByteString GetAP_Check(const CFX_FloatRect& crBBox) { const float fWidth = crBBox.right - crBBox.left; const float fHeight = crBBox.top - crBBox.bottom; @@ -174,10 +174,10 @@ CFX_ByteString GetAP_Check(const CFX_FloatRect& crBBox) { << pts[nNext][0].y << " " << kCurveToOperator << "\n"; } - return CFX_ByteString(csAP); + return ByteString(csAP); } -CFX_ByteString GetAP_Circle(const CFX_FloatRect& crBBox) { +ByteString GetAP_Circle(const CFX_FloatRect& crBBox) { std::ostringstream csAP; float fWidth = crBBox.right - crBBox.left; @@ -218,10 +218,10 @@ CFX_ByteString GetAP_Circle(const CFX_FloatRect& crBBox) { << pt1.y - py * FX_BEZIER << " " << pt1.x << " " << pt1.y << " " << kCurveToOperator << "\n"; - return CFX_ByteString(csAP); + return ByteString(csAP); } -CFX_ByteString GetAP_Cross(const CFX_FloatRect& crBBox) { +ByteString GetAP_Cross(const CFX_FloatRect& crBBox) { std::ostringstream csAP; csAP << crBBox.left << " " << crBBox.top << " " << kMoveToOperator << "\n"; @@ -230,10 +230,10 @@ CFX_ByteString GetAP_Cross(const CFX_FloatRect& crBBox) { csAP << crBBox.left << " " << crBBox.bottom << " " << kMoveToOperator << "\n"; csAP << crBBox.right << " " << crBBox.top << " " << kLineToOperator << "\n"; - return CFX_ByteString(csAP); + return ByteString(csAP); } -CFX_ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) { +ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) { std::ostringstream csAP; float fWidth = crBBox.right - crBBox.left; @@ -250,10 +250,10 @@ CFX_ByteString GetAP_Diamond(const CFX_FloatRect& crBBox) { csAP << pt4.x << " " << pt4.y << " " << kLineToOperator << "\n"; csAP << pt1.x << " " << pt1.y << " " << kLineToOperator << "\n"; - return CFX_ByteString(csAP); + return ByteString(csAP); } -CFX_ByteString GetAP_Square(const CFX_FloatRect& crBBox) { +ByteString GetAP_Square(const CFX_FloatRect& crBBox) { std::ostringstream csAP; csAP << crBBox.left << " " << crBBox.top << " " << kMoveToOperator << "\n"; @@ -263,10 +263,10 @@ CFX_ByteString GetAP_Square(const CFX_FloatRect& crBBox) { csAP << crBBox.left << " " << crBBox.bottom << " " << kLineToOperator << "\n"; csAP << crBBox.left << " " << crBBox.top << " " << kLineToOperator << "\n"; - return CFX_ByteString(csAP); + return ByteString(csAP); } -CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox) { +ByteString GetAP_Star(const CFX_FloatRect& crBBox) { std::ostringstream csAP; float fRadius = (crBBox.top - crBBox.bottom) / (1 + (float)cos(FX_PI / 5.0f)); @@ -292,10 +292,10 @@ CFX_ByteString GetAP_Star(const CFX_FloatRect& crBBox) { csAP << px[nNext] << " " << py[nNext] << " " << kLineToOperator << "\n"; } - return CFX_ByteString(csAP); + return ByteString(csAP); } -CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) { +ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) { std::ostringstream csAP; float fWidth = crBBox.right - crBBox.left; @@ -328,44 +328,44 @@ CFX_ByteString GetAP_HalfCircle(const CFX_FloatRect& crBBox, float fRotate) { << pt3.y + py * FX_BEZIER << " " << pt3.x << " " << pt3.y << " " << kCurveToOperator << "\n"; - return CFX_ByteString(csAP); + return ByteString(csAP); } -CFX_ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox, - const CFX_Color& crText) { +ByteString GetAppStream_Check(const CFX_FloatRect& rcBBox, + const CFX_Color& crText) { std::ostringstream sAP; { AutoClosedQCommand q(&sAP); sAP << GetColorAppStream(crText, true) << GetAP_Check(rcBBox) << kFillOperator << "\n"; } - return CFX_ByteString(sAP); + return ByteString(sAP); } -CFX_ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox, - const CFX_Color& crText) { +ByteString GetAppStream_Circle(const CFX_FloatRect& rcBBox, + const CFX_Color& crText) { std::ostringstream sAP; { AutoClosedQCommand q(&sAP); sAP << GetColorAppStream(crText, true) << GetAP_Circle(rcBBox) << kFillOperator << "\n"; } - return CFX_ByteString(sAP); + return ByteString(sAP); } -CFX_ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox, - const CFX_Color& crText) { +ByteString GetAppStream_Cross(const CFX_FloatRect& rcBBox, + const CFX_Color& crText) { std::ostringstream sAP; { AutoClosedQCommand q(&sAP); sAP << GetColorAppStream(crText, false) << GetAP_Cross(rcBBox) << kStrokeOperator << "\n"; } - return CFX_ByteString(sAP); + return ByteString(sAP); } -CFX_ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox, - const CFX_Color& crText) { +ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox, + const CFX_Color& crText) { std::ostringstream sAP; { AutoClosedQCommand q(&sAP); @@ -373,51 +373,51 @@ CFX_ByteString GetAppStream_Diamond(const CFX_FloatRect& rcBBox, << GetColorAppStream(crText, true) << GetAP_Diamond(rcBBox) << kFillOperator << "\n"; } - return CFX_ByteString(sAP); + return ByteString(sAP); } -CFX_ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox, - const CFX_Color& crText) { +ByteString GetAppStream_Square(const CFX_FloatRect& rcBBox, + const CFX_Color& crText) { std::ostringstream sAP; { AutoClosedQCommand q(&sAP); sAP << GetColorAppStream(crText, true) << GetAP_Square(rcBBox) << kFillOperator << "\n"; } - return CFX_ByteString(sAP); + return ByteString(sAP); } -CFX_ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox, - const CFX_Color& crText) { +ByteString GetAppStream_Star(const CFX_FloatRect& rcBBox, + const CFX_Color& crText) { std::ostringstream sAP; { AutoClosedQCommand q(&sAP); sAP << GetColorAppStream(crText, true) << GetAP_Star(rcBBox) << kFillOperator << "\n"; } - return CFX_ByteString(sAP); + return ByteString(sAP); } -CFX_ByteString GetCircleFillAppStream(const CFX_FloatRect& rect, - const CFX_Color& color) { +ByteString GetCircleFillAppStream(const CFX_FloatRect& rect, + const CFX_Color& color) { std::ostringstream sAppStream; - CFX_ByteString sColor = GetColorAppStream(color, true); + ByteString sColor = GetColorAppStream(color, true); if (sColor.GetLength() > 0) { AutoClosedQCommand q(&sAppStream); sAppStream << sColor << GetAP_Circle(rect) << kFillOperator << "\n"; } - return CFX_ByteString(sAppStream); + return ByteString(sAppStream); } -CFX_ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect, - float fWidth, - const CFX_Color& color, - const CFX_Color& crLeftTop, - const CFX_Color& crRightBottom, - BorderStyle nStyle, - const CPWL_Dash& dash) { +ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect, + float fWidth, + const CFX_Color& color, + const CFX_Color& crLeftTop, + const CFX_Color& crRightBottom, + BorderStyle nStyle, + const CPWL_Dash& dash) { std::ostringstream sAppStream; - CFX_ByteString sColor; + ByteString sColor; if (fWidth > 0.0f) { AutoClosedQCommand q(&sAppStream); @@ -502,12 +502,12 @@ CFX_ByteString GetCircleBorderAppStream(const CFX_FloatRect& rect, } break; } } - return CFX_ByteString(sAppStream); + return ByteString(sAppStream); } -CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox, - CheckStyle nStyle, - const CFX_Color& crText) { +ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox, + CheckStyle nStyle, + const CFX_Color& crText) { CFX_FloatRect rcCenter = rcBBox.GetCenterSquare(); switch (nStyle) { default: @@ -530,9 +530,9 @@ CFX_ByteString GetCheckBoxAppStream(const CFX_FloatRect& rcBBox, } } -CFX_ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox, - CheckStyle nStyle, - const CFX_Color& crText) { +ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox, + CheckStyle nStyle, + const CFX_Color& crText) { CFX_FloatRect rcCenter = rcBBox.GetCenterSquare(); switch (nStyle) { default: @@ -555,33 +555,33 @@ CFX_ByteString GetRadioButtonAppStream(const CFX_FloatRect& rcBBox, } } -CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, - int32_t nFontIndex, - float fFontSize) { +ByteString GetFontSetString(IPVT_FontMap* pFontMap, + int32_t nFontIndex, + float fFontSize) { if (!pFontMap) - return CFX_ByteString(); + return ByteString(); - CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); + ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); if (sFontAlias.GetLength() <= 0 || fFontSize <= 0) - return CFX_ByteString(); + return ByteString(); std::ostringstream sRet; sRet << "/" << sFontAlias << " " << fFontSize << " " << kSetTextFontAndSizeOperator << "\n"; - return CFX_ByteString(sRet); + return ByteString(sRet); } -CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) { +ByteString GetWordRenderString(const ByteString& strWords) { if (strWords.GetLength() > 0) { return PDF_EncodeString(strWords, false) + " " + kShowTextOperator + "\n"; } - return CFX_ByteString(); + return ByteString(); } -CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit, - const CFX_PointF& ptOffset, - bool bContinuous, - uint16_t SubWord) { +ByteString GetEditAppStream(CPWL_EditImpl* pEdit, + const CFX_PointF& ptOffset, + bool bContinuous, + uint16_t SubWord) { CPWL_EditImpl_Iterator* pIterator = pEdit->GetIterator(); pIterator->SetAt(0); @@ -597,7 +597,7 @@ CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit, if (bContinuous) { if (place.LineCmp(oldplace) != 0) { if (sWords.tellp() > 0) { - sEditStream << GetWordRenderString(CFX_ByteString(sWords)); + sEditStream << GetWordRenderString(ByteString(sWords)); sWords.str(""); } @@ -624,7 +624,7 @@ CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit, if (pIterator->GetWord(word)) { if (word.nFontIndex != nCurFontIndex) { if (sWords.tellp() > 0) { - sEditStream << GetWordRenderString(CFX_ByteString(sWords)); + sEditStream << GetWordRenderString(ByteString(sWords)); sWords.str(""); } sEditStream << GetFontSetString(pEdit->GetFontMap(), word.nFontIndex, @@ -661,7 +661,7 @@ CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit, } if (sWords.tellp() > 0) { - sEditStream << GetWordRenderString(CFX_ByteString(sWords)); + sEditStream << GetWordRenderString(ByteString(sWords)); sWords.str(""); } @@ -681,14 +681,14 @@ CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit, sAppStream << sEditStream.str(); } - return CFX_ByteString(sAppStream); + return ByteString(sAppStream); } -CFX_ByteString GenerateIconAppStream(CPDF_IconFit& fit, - CPDF_Stream* pIconStream, - const CFX_FloatRect& rcIcon) { +ByteString GenerateIconAppStream(CPDF_IconFit& fit, + CPDF_Stream* pIconStream, + const CFX_FloatRect& rcIcon) { if (rcIcon.IsEmpty() || !pIconStream) - return CFX_ByteString(); + return ByteString(); CPWL_Icon icon; CPWL_Wnd::CreateParams cp; @@ -698,9 +698,9 @@ CFX_ByteString GenerateIconAppStream(CPDF_IconFit& fit, icon.SetPDFStream(pIconStream); icon.Move(rcIcon, false, false); - CFX_ByteString sAlias = icon.GetImageAlias(); + ByteString sAlias = icon.GetImageAlias(); if (sAlias.GetLength() <= 0) - return CFX_ByteString(); + return ByteString(); CFX_FloatRect rcPlate = icon.GetClientRect(); CFX_Matrix mt = icon.GetImageMatrix().GetInverse(); @@ -732,17 +732,17 @@ CFX_ByteString GenerateIconAppStream(CPDF_IconFit& fit, } icon.Destroy(); - return CFX_ByteString(str); + return ByteString(str); } -CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, - IPVT_FontMap* pFontMap, - CPDF_Stream* pIconStream, - CPDF_IconFit& IconFit, - const CFX_WideString& sLabel, - const CFX_Color& crText, - float fFontSize, - ButtonStyle nLayOut) { +ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, + IPVT_FontMap* pFontMap, + CPDF_Stream* pIconStream, + CPDF_IconFit& IconFit, + const WideString& sLabel, + const CFX_Color& crText, + float fFontSize, + ButtonStyle nLayOut) { const float fAutoFontScale = 1.0f / 3.0f; auto pEdit = pdfium::MakeUnique(); @@ -902,7 +902,7 @@ CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, if (!rcLabel.IsEmpty()) { pEdit->SetPlateRect(rcLabel); - CFX_ByteString sEdit = + ByteString sEdit = GetEditAppStream(pEdit.get(), CFX_PointF(0.0f, 0.0f), true, 0); if (sEdit.GetLength() > 0) { AutoClosedCommand bt(&sTemp, kTextBeginOperator, kTextEndOperator); @@ -911,7 +911,7 @@ CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, } if (sTemp.tellp() <= 0) - return CFX_ByteString(); + return ByteString(); std::ostringstream sAppStream; { @@ -923,18 +923,18 @@ CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, << kEndPathNoFillOrStrokeOperator << "\n"; sAppStream << sTemp.str().c_str(); } - return CFX_ByteString(sAppStream); + return ByteString(sAppStream); } -CFX_ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect, - float fWidth, - const CFX_Color& color, - const CFX_Color& crLeftTop, - const CFX_Color& crRightBottom, - BorderStyle nStyle, - const CPWL_Dash& dash) { +ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect, + float fWidth, + const CFX_Color& color, + const CFX_Color& crLeftTop, + const CFX_Color& crRightBottom, + BorderStyle nStyle, + const CPWL_Dash& dash) { std::ostringstream sAppStream; - CFX_ByteString sColor; + ByteString sColor; float fLeft = rect.left; float fRight = rect.right; @@ -1044,12 +1044,12 @@ CFX_ByteString GetBorderAppStreamInternal(const CFX_FloatRect& rect, } } - return CFX_ByteString(sAppStream); + return ByteString(sAppStream); } -CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { +ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { if (rcBBox.IsEmpty()) - return CFX_ByteString(); + return ByteString(); std::ostringstream sAppStream; { @@ -1087,13 +1087,13 @@ CFX_ByteString GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { << kLineToOperator << " " << kFillOperator << "\n"; } - return CFX_ByteString(sAppStream); + return ByteString(sAppStream); } -CFX_ByteString GetRectFillAppStream(const CFX_FloatRect& rect, - const CFX_Color& color) { +ByteString GetRectFillAppStream(const CFX_FloatRect& rect, + const CFX_Color& color) { std::ostringstream sAppStream; - CFX_ByteString sColor = GetColorAppStream(color, true); + ByteString sColor = GetColorAppStream(color, true); if (sColor.GetLength() > 0) { AutoClosedQCommand q(&sAppStream); sAppStream << sColor << rect.left << " " << rect.bottom << " " @@ -1101,7 +1101,7 @@ CFX_ByteString GetRectFillAppStream(const CFX_FloatRect& rect, << kAppendRectOperator << " " << kFillOperator << "\n"; } - return CFX_ByteString(sAppStream); + return ByteString(sAppStream); } } // namespace @@ -1177,7 +1177,7 @@ void CPWL_AppStream::SetAsPushButton() { CFX_FloatRect rcClient = rcWindow.GetDeflated(fBorderWidth, fBorderWidth); CFX_Color crText(COLORTYPE_GRAY, 0); - CFX_ByteString csNameTag; + ByteString csNameTag; CPDF_DefaultAppearance da = pControl->GetDefaultAppearance(); if (da.HasColor()) { da.GetColor(iColorType, fc); @@ -1187,10 +1187,10 @@ void CPWL_AppStream::SetAsPushButton() { if (da.HasFont()) csNameTag = da.GetFont(&fFontSize); - CFX_WideString csWCaption; - CFX_WideString csNormalCaption; - CFX_WideString csRolloverCaption; - CFX_WideString csDownCaption; + WideString csWCaption; + WideString csNormalCaption; + WideString csRolloverCaption; + WideString csDownCaption; if (pControl->HasMKEntry("CA")) csNormalCaption = pControl->GetNormalCaption(); @@ -1240,7 +1240,7 @@ void CPWL_AppStream::SetAsPushButton() { widget_->GetInterForm()->GetFormFillEnv()->GetSysHandler()); font_map.SetAPType("N"); - CFX_ByteString csAP = + ByteString csAP = GetRectFillAppStream(rcWindow, crBackground) + GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder) + @@ -1359,7 +1359,7 @@ void CPWL_AppStream::SetAsCheckBox() { } CheckStyle nStyle = CheckStyle::kCheck; - CFX_WideString csWCaption = pControl->GetNormalCaption(); + WideString csWCaption = pControl->GetNormalCaption(); if (csWCaption.GetLength() > 0) { switch (csWCaption[0]) { case L'l': @@ -1383,12 +1383,12 @@ void CPWL_AppStream::SetAsCheckBox() { } } - CFX_ByteString csAP_N_ON = + ByteString csAP_N_ON = GetRectFillAppStream(rcWindow, crBackground) + GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder); - CFX_ByteString csAP_N_OFF = csAP_N_ON; + ByteString csAP_N_OFF = csAP_N_ON; switch (nBorderStyle) { case BorderStyle::BEVELED: { @@ -1406,12 +1406,12 @@ void CPWL_AppStream::SetAsCheckBox() { break; } - CFX_ByteString csAP_D_ON = + ByteString csAP_D_ON = GetRectFillAppStream(rcWindow, crBackground - 0.25f) + GetBorderAppStreamInternal(rcWindow, fBorderWidth, crBorder, crLeftTop, crRightBottom, nBorderStyle, dsBorder); - CFX_ByteString csAP_D_OFF = csAP_D_ON; + ByteString csAP_D_OFF = csAP_D_ON; csAP_N_ON += GetCheckBoxAppStream(rcClient, nStyle, crText); csAP_D_ON += GetCheckBoxAppStream(rcClient, nStyle, crText); @@ -1422,7 +1422,7 @@ void CPWL_AppStream::SetAsCheckBox() { Write("D", csAP_D_ON, pControl->GetCheckedAPState()); Write("D", csAP_D_OFF, "Off"); - CFX_ByteString csAS = widget_->GetAppState(); + ByteString csAS = widget_->GetAppState(); if (csAS.IsEmpty()) widget_->SetAppState("Off"); } @@ -1475,7 +1475,7 @@ void CPWL_AppStream::SetAsRadioButton() { } CheckStyle nStyle = CheckStyle::kCircle; - CFX_WideString csWCaption = pControl->GetNormalCaption(); + WideString csWCaption = pControl->GetNormalCaption(); if (csWCaption.GetLength() > 0) { switch (csWCaption[0]) { case L'8': @@ -1499,7 +1499,7 @@ void CPWL_AppStream::SetAsRadioButton() { } } - CFX_ByteString csAP_N_ON; + ByteString csAP_N_ON; CFX_FloatRect rcCenter = rcWindow.GetCenterSquare().GetDeflated(1.0f, 1.0f); if (nStyle == CheckStyle::kCircle) { if (nBorderStyle == BorderStyle::BEVELED) { @@ -1521,7 +1521,7 @@ void CPWL_AppStream::SetAsRadioButton() { crRightBottom, nBorderStyle, dsBorder); } - CFX_ByteString csAP_N_OFF = csAP_N_ON; + ByteString csAP_N_OFF = csAP_N_ON; switch (nBorderStyle) { case BorderStyle::BEVELED: { @@ -1539,7 +1539,7 @@ void CPWL_AppStream::SetAsRadioButton() { break; } - CFX_ByteString csAP_D_ON; + ByteString csAP_D_ON; if (nStyle == CheckStyle::kCircle) { CFX_Color crBK = crBackground - 0.25f; @@ -1563,7 +1563,7 @@ void CPWL_AppStream::SetAsRadioButton() { crRightBottom, nBorderStyle, dsBorder); } - CFX_ByteString csAP_D_OFF = csAP_D_ON; + ByteString csAP_D_OFF = csAP_D_ON; csAP_N_ON += GetRadioButtonAppStream(rcClient, nStyle, crText); csAP_D_ON += GetRadioButtonAppStream(rcClient, nStyle, crText); @@ -1574,12 +1574,12 @@ void CPWL_AppStream::SetAsRadioButton() { Write("D", csAP_D_ON, pControl->GetCheckedAPState()); Write("D", csAP_D_OFF, "Off"); - CFX_ByteString csAS = widget_->GetAppState(); + ByteString csAS = widget_->GetAppState(); if (csAS.IsEmpty()) widget_->SetAppState("Off"); } -void CPWL_AppStream::SetAsComboBox(const CFX_WideString* sValue) { +void CPWL_AppStream::SetAsComboBox(const WideString* sValue) { CPDF_FormControl* pControl = widget_->GetFormControl(); CPDF_FormField* pField = pControl->GetField(); std::ostringstream sBody; @@ -1623,7 +1623,7 @@ void CPWL_AppStream::SetAsComboBox(const CFX_WideString* sValue) { } CFX_FloatRect rcContent = pEdit->GetContentRect(); - CFX_ByteString sEdit = GetEditAppStream(pEdit.get(), CFX_PointF(), true, 0); + ByteString sEdit = GetEditAppStream(pEdit.get(), CFX_PointF(), true, 0); if (sEdit.GetLength() > 0) { sBody << "/Tx "; AutoClosedCommand bmc(&sBody, kMarkedSequenceBeginOperator, @@ -1645,7 +1645,7 @@ void CPWL_AppStream::SetAsComboBox(const CFX_WideString* sValue) { sBody << GetDropButtonAppStream(rcButton); Write("N", - GetBackgroundAppStream() + GetBorderAppStream() + CFX_ByteString(sBody), + GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sBody), ""); } @@ -1729,11 +1729,11 @@ void CPWL_AppStream::SetAsListBox() { << sList.str(); } Write("N", - GetBackgroundAppStream() + GetBorderAppStream() + CFX_ByteString(sBody), + GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sBody), ""); } -void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) { +void CPWL_AppStream::SetAsTextField(const WideString* sValue) { CPDF_FormControl* pControl = widget_->GetFormControl(); CPDF_FormField* pField = pControl->GetField(); std::ostringstream sBody; @@ -1771,7 +1771,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) { float fFontSize = widget_->GetFontSize(); #ifdef PDF_ENABLE_XFA - CFX_WideString sValueTmp; + WideString sValueTmp; if (!sValue && widget_->GetMixXFAWidget()) { sValueTmp = widget_->GetValue(true); sValue = &sValueTmp; @@ -1802,7 +1802,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) { pEdit->SetText(sValue ? *sValue : pField->GetValue()); CFX_FloatRect rcContent = pEdit->GetContentRect(); - CFX_ByteString sEdit = + ByteString sEdit = GetEditAppStream(pEdit.get(), CFX_PointF(), !bCharArray, subWord); if (sEdit.GetLength() > 0) { @@ -1828,7 +1828,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) { if (bCharArray) { switch (widget_->GetBorderStyle()) { case BorderStyle::SOLID: { - CFX_ByteString sColor = + ByteString sColor = GetColorAppStream(widget_->GetBorderPWLColor(), false); if (sColor.GetLength() > 0) { AutoClosedQCommand q(&sLines); @@ -1851,7 +1851,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) { break; } case BorderStyle::DASH: { - CFX_ByteString sColor = + ByteString sColor = GetColorAppStream(widget_->GetBorderPWLColor(), false); if (sColor.GetLength() > 0) { CPWL_Dash dsBorder = CPWL_Dash(3, 3, 0); @@ -1880,16 +1880,15 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) { } Write("N", - GetBackgroundAppStream() + GetBorderAppStream() + - CFX_ByteString(sLines) + CFX_ByteString(sBody), + GetBackgroundAppStream() + GetBorderAppStream() + ByteString(sLines) + + ByteString(sBody), ""); } -void CPWL_AppStream::AddImage(const CFX_ByteString& sAPType, - CPDF_Stream* pImage) { +void CPWL_AppStream::AddImage(const ByteString& sAPType, CPDF_Stream* pImage) { CPDF_Stream* pStream = dict_->GetStreamFor(sAPType); CPDF_Dictionary* pStreamDict = pStream->GetDict(); - CFX_ByteString sImageAlias = "IMG"; + ByteString sImageAlias = "IMG"; if (CPDF_Dictionary* pImageDict = pImage->GetDict()) { sImageAlias = pImageDict->GetStringFor("Name"); @@ -1908,9 +1907,9 @@ void CPWL_AppStream::AddImage(const CFX_ByteString& sAPType, pImage->GetObjNum()); } -void CPWL_AppStream::Write(const CFX_ByteString& sAPType, - const CFX_ByteString& sContents, - const CFX_ByteString& sAPState) { +void CPWL_AppStream::Write(const ByteString& sAPType, + const ByteString& sContents, + const ByteString& sAPState) { CPDF_Stream* pStream = nullptr; CPDF_Dictionary* pParentDict = nullptr; if (sAPState.IsEmpty()) { @@ -1947,19 +1946,19 @@ void CPWL_AppStream::Write(const CFX_ByteString& sAPType, sContents.GetLength()); } -void CPWL_AppStream::Remove(const CFX_ByteString& sAPType) { +void CPWL_AppStream::Remove(const ByteString& sAPType) { dict_->RemoveFor(sAPType); } -CFX_ByteString CPWL_AppStream::GetBackgroundAppStream() const { +ByteString CPWL_AppStream::GetBackgroundAppStream() const { CFX_Color crBackground = widget_->GetFillPWLColor(); if (crBackground.nColorType != COLORTYPE_TRANSPARENT) return GetRectFillAppStream(widget_->GetRotatedRect(), crBackground); - return CFX_ByteString(); + return ByteString(); } -CFX_ByteString CPWL_AppStream::GetBorderAppStream() const { +ByteString CPWL_AppStream::GetBorderAppStream() const { CFX_FloatRect rcWindow = widget_->GetRotatedRect(); CFX_Color crBorder = widget_->GetBorderPWLColor(); CFX_Color crBackground = widget_->GetFillPWLColor(); diff --git a/fpdfsdk/pwl/cpwl_appstream.h b/fpdfsdk/pwl/cpwl_appstream.h index 2043c7b0d7..d73e3aa0a7 100644 --- a/fpdfsdk/pwl/cpwl_appstream.h +++ b/fpdfsdk/pwl/cpwl_appstream.h @@ -22,19 +22,19 @@ class CPWL_AppStream { void SetAsPushButton(); void SetAsCheckBox(); void SetAsRadioButton(); - void SetAsComboBox(const CFX_WideString* sValue); + void SetAsComboBox(const WideString* sValue); void SetAsListBox(); - void SetAsTextField(const CFX_WideString* sValue); + void SetAsTextField(const WideString* sValue); private: - void AddImage(const CFX_ByteString& sAPType, CPDF_Stream* pImage); - void Write(const CFX_ByteString& sAPType, - const CFX_ByteString& sContents, - const CFX_ByteString& sAPState); - void Remove(const CFX_ByteString& sAPType); - - CFX_ByteString GetBackgroundAppStream() const; - CFX_ByteString GetBorderAppStream() const; + void AddImage(const ByteString& sAPType, CPDF_Stream* pImage); + void Write(const ByteString& sAPType, + const ByteString& sContents, + const ByteString& sAPState); + void Remove(const ByteString& sAPType); + + ByteString GetBackgroundAppStream() const; + ByteString GetBorderAppStream() const; CFX_UnownedPtr widget_; CFX_UnownedPtr dict_; diff --git a/fpdfsdk/pwl/cpwl_button.cpp b/fpdfsdk/pwl/cpwl_button.cpp index fc0479be2c..5c06a98fa6 100644 --- a/fpdfsdk/pwl/cpwl_button.cpp +++ b/fpdfsdk/pwl/cpwl_button.cpp @@ -11,7 +11,7 @@ CPWL_Button::CPWL_Button() : m_bMouseDown(false) {} CPWL_Button::~CPWL_Button() {} -CFX_ByteString CPWL_Button::GetClassName() const { +ByteString CPWL_Button::GetClassName() const { return "CPWL_Button"; } diff --git a/fpdfsdk/pwl/cpwl_button.h b/fpdfsdk/pwl/cpwl_button.h index f26ae1c1f3..70f5ef1908 100644 --- a/fpdfsdk/pwl/cpwl_button.h +++ b/fpdfsdk/pwl/cpwl_button.h @@ -15,7 +15,7 @@ class CPWL_Button : public CPWL_Wnd { ~CPWL_Button() override; // CPWL_Wnd - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; diff --git a/fpdfsdk/pwl/cpwl_caret.cpp b/fpdfsdk/pwl/cpwl_caret.cpp index 3d05961601..b1040bc2e3 100644 --- a/fpdfsdk/pwl/cpwl_caret.cpp +++ b/fpdfsdk/pwl/cpwl_caret.cpp @@ -19,7 +19,7 @@ CPWL_Caret::CPWL_Caret() : m_bFlash(false), m_fWidth(0.4f), m_nDelay(0) {} CPWL_Caret::~CPWL_Caret() {} -CFX_ByteString CPWL_Caret::GetClassName() const { +ByteString CPWL_Caret::GetClassName() const { return "CPWL_Caret"; } diff --git a/fpdfsdk/pwl/cpwl_caret.h b/fpdfsdk/pwl/cpwl_caret.h index 32034708a7..fb0fa8978c 100644 --- a/fpdfsdk/pwl/cpwl_caret.h +++ b/fpdfsdk/pwl/cpwl_caret.h @@ -15,7 +15,7 @@ class CPWL_Caret : public CPWL_Wnd { ~CPWL_Caret() override; // CPWL_Wnd - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; void DrawThisAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) override; void InvalidateRect(CFX_FloatRect* pRect) override; diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp index 03651949b2..5bb9124931 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.cpp +++ b/fpdfsdk/pwl/cpwl_combo_box.cpp @@ -147,7 +147,7 @@ CPWL_ComboBox::CPWL_ComboBox() {} CPWL_ComboBox::~CPWL_ComboBox() {} -CFX_ByteString CPWL_ComboBox::GetClassName() const { +ByteString CPWL_ComboBox::GetClassName() const { return "CPWL_ComboBox"; } @@ -177,31 +177,31 @@ void CPWL_ComboBox::KillFocus() { CPWL_Wnd::KillFocus(); } -CFX_WideString CPWL_ComboBox::GetSelectedText() { +WideString CPWL_ComboBox::GetSelectedText() { if (m_pEdit) return m_pEdit->GetSelectedText(); - return CFX_WideString(); + return WideString(); } -void CPWL_ComboBox::ReplaceSelection(const CFX_WideString& text) { +void CPWL_ComboBox::ReplaceSelection(const WideString& text) { if (m_pEdit) m_pEdit->ReplaceSelection(text); } -CFX_WideString CPWL_ComboBox::GetText() const { +WideString CPWL_ComboBox::GetText() const { if (m_pEdit) { return m_pEdit->GetText(); } - return CFX_WideString(); + return WideString(); } -void CPWL_ComboBox::SetText(const CFX_WideString& text) { +void CPWL_ComboBox::SetText(const WideString& text) { if (m_pEdit) m_pEdit->SetText(text); } -void CPWL_ComboBox::AddString(const CFX_WideString& str) { +void CPWL_ComboBox::AddString(const WideString& str) { if (m_pList) m_pList->AddString(str); } diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h index b431191452..c9fa2cda4b 100644 --- a/fpdfsdk/pwl/cpwl_combo_box.h +++ b/fpdfsdk/pwl/cpwl_combo_box.h @@ -50,7 +50,7 @@ class CPWL_ComboBox : public CPWL_Wnd { CPWL_Edit* GetEdit() const { return m_pEdit.Get(); } // CPWL_Wnd: - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; void OnDestroy() override; bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override; @@ -62,14 +62,14 @@ class CPWL_ComboBox : public CPWL_Wnd { CFX_FloatRect GetFocusRect() const override; void SetFocus() override; void KillFocus() override; - CFX_WideString GetSelectedText() override; - void ReplaceSelection(const CFX_WideString& text) override; + WideString GetSelectedText() override; + void ReplaceSelection(const WideString& text) override; void SetFillerNotify(IPWL_Filler_Notify* pNotify); - CFX_WideString GetText() const; - void SetText(const CFX_WideString& text); - void AddString(const CFX_WideString& str); + WideString GetText() const; + void SetText(const WideString& text); + void AddString(const WideString& str); int32_t GetSelect() const; void SetSelect(int32_t nItemIndex); diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp index 8fbafd0ca0..c71dbe4be0 100644 --- a/fpdfsdk/pwl/cpwl_edit.cpp +++ b/fpdfsdk/pwl/cpwl_edit.cpp @@ -35,18 +35,18 @@ CPWL_Edit::~CPWL_Edit() { ASSERT(!m_bFocus); } -CFX_ByteString CPWL_Edit::GetClassName() const { +ByteString CPWL_Edit::GetClassName() const { return PWL_CLASSNAME_EDIT; } -void CPWL_Edit::SetText(const CFX_WideString& csText) { - CFX_WideString swText = csText; +void CPWL_Edit::SetText(const WideString& csText) { + WideString swText = csText; if (!HasFlag(PES_RICH)) { m_pEdit->SetText(swText); return; } - CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); + ByteString sValue = ByteString::FromUnicode(swText); std::unique_ptr pXML( CXML_Element::Parse(sValue.c_str(), sValue.GetLength())); if (!pXML) { @@ -62,7 +62,7 @@ void CPWL_Edit::SetText(const CFX_WideString& csText) { if (!pSubElement || !pSubElement->GetTagName().EqualNoCase("p")) continue; - CFX_WideString swSection; + WideString swSection; int nSubChild = pSubElement->CountChildren(); for (int32_t j = 0; j < nSubChild; j++) { CXML_Content* pSubContent = ToContent(pSubElement->GetChild(j)); @@ -443,7 +443,7 @@ void CPWL_Edit::SetLimitChar(int32_t nLimitChar) { m_pEdit->SetLimitChar(nLimitChar); } -void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) { +void CPWL_Edit::ReplaceSel(const WideString& wsText) { m_pEdit->ClearSelection(); m_pEdit->InsertText(wsText, FX_CHARSET_Default); } @@ -463,8 +463,8 @@ bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (nChar == FWL_VKEY_Delete) { if (m_pFillerNotify) { - CFX_WideString strChange; - CFX_WideString strChangeEx; + WideString strChange; + WideString strChangeEx; int nSelStart = 0; int nSelEnd = 0; @@ -532,7 +532,7 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { if (!IsCTRLpressed(nFlag)) { if (m_pFillerNotify) { - CFX_WideString swChange; + WideString swChange; int nSelStart = 0; int nSelEnd = 0; @@ -550,7 +550,7 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { break; } - CFX_WideString strChangeEx; + WideString strChangeEx; std::tie(bRC, bExit) = m_pFillerNotify->OnBeforeKeyStroke( GetAttachedData(), swChange, strChangeEx, nSelStart, nSelEnd, true, nFlag); diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h index 3e8de04b47..d61b94730e 100644 --- a/fpdfsdk/pwl/cpwl_edit.h +++ b/fpdfsdk/pwl/cpwl_edit.h @@ -27,8 +27,8 @@ class IPWL_Filler_Notify { float* fPopupRet) = 0; virtual std::pair OnBeforeKeyStroke( CPWL_Wnd::PrivateData* pAttached, - CFX_WideString& strChange, - const CFX_WideString& strChangeEx, + WideString& strChange, + const WideString& strChangeEx, int nSelStart, int nSelEnd, bool bKeyDown, @@ -47,7 +47,7 @@ class CPWL_Edit : public CPWL_EditCtrl { ~CPWL_Edit() override; // CPWL_EditCtrl - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; void OnCreated() override; void RePosChildWnd() override; CFX_FloatRect GetClientRect() const override; @@ -80,8 +80,8 @@ class CPWL_Edit : public CPWL_EditCtrl { void CutText(); - void SetText(const CFX_WideString& csText); - void ReplaceSel(const CFX_WideString& csText); + void SetText(const WideString& csText); + void ReplaceSel(const WideString& csText); bool IsTextFull() const; diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp index 7baaaa8ca5..f0fc408771 100644 --- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp @@ -52,14 +52,14 @@ void CPWL_EditCtrl::SetCursor() { } } -CFX_WideString CPWL_EditCtrl::GetSelectedText() { +WideString CPWL_EditCtrl::GetSelectedText() { if (m_pEdit) return m_pEdit->GetSelectedText(); - return CFX_WideString(); + return WideString(); } -void CPWL_EditCtrl::ReplaceSelection(const CFX_WideString& text) { +void CPWL_EditCtrl::ReplaceSelection(const WideString& text) { if (!m_pEdit) return; @@ -338,7 +338,7 @@ void CPWL_EditCtrl::SetCaret(bool bVisible, } } -CFX_WideString CPWL_EditCtrl::GetText() const { +WideString CPWL_EditCtrl::GetText() const { return m_pEdit->GetText(); } diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.h b/fpdfsdk/pwl/cpwl_edit_ctrl.h index eb4470f734..37ac320d8f 100644 --- a/fpdfsdk/pwl/cpwl_edit_ctrl.h +++ b/fpdfsdk/pwl/cpwl_edit_ctrl.h @@ -25,7 +25,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { CPWL_EditCtrl(); ~CPWL_EditCtrl() override; - CFX_WideString GetText() const; + WideString GetText() const; void SetSelection(int32_t nStartChar, int32_t nEndChar); void GetSelection(int32_t& nStartChar, int32_t& nEndChar) const; void ClearSelection(); @@ -60,8 +60,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { void SetFontSize(float fFontSize) override; float GetFontSize() const override; void SetCursor() override; - CFX_WideString GetSelectedText() override; - void ReplaceSelection(const CFX_WideString& text) override; + WideString GetSelectedText() override; + void ReplaceSelection(const WideString& text) override; void SetCaret(bool bVisible, const CFX_PointF& ptHead, diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp index c44301f212..c65199955b 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp @@ -43,7 +43,7 @@ void DrawTextString(CFX_RenderDevice* pDevice, CPDF_Font* pFont, float fFontSize, const CFX_Matrix& mtUser2Device, - const CFX_ByteString& str, + const ByteString& str, FX_ARGB crTextFill, int32_t nHorzScale) { if (!pFont) @@ -394,7 +394,7 @@ void CFXEU_Delete::Undo() { CFXEU_Clear::CFXEU_Clear(CPWL_EditImpl* pEdit, const CPVT_WordRange& wrSel, - const CFX_WideString& swText) + const WideString& swText) : m_pEdit(pEdit), m_wrSel(wrSel), m_swText(swText) { ASSERT(m_pEdit); } @@ -417,7 +417,7 @@ void CFXEU_Clear::Undo() { CFXEU_InsertText::CFXEU_InsertText(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, - const CFX_WideString& swText, + const WideString& swText, int32_t charset) : m_pEdit(pEdit), m_wpOld(wpOldPlace), @@ -526,7 +526,7 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, DrawTextString( pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device, - CFX_ByteString(sTextBuf), crOldFill, nHorzScale); + ByteString(sTextBuf), crOldFill, nHorzScale); sTextBuf.str(""); } @@ -553,7 +553,7 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, DrawTextString(pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device, - CFX_ByteString(sTextBuf), crOldFill, nHorzScale); + ByteString(sTextBuf), crOldFill, nHorzScale); } } @@ -736,8 +736,8 @@ CPVT_WordPlace CPWL_EditImpl::GetCaretWordPlace() const { return m_wpCaret; } -CFX_WideString CPWL_EditImpl::GetText() const { - CFX_WideString swRet; +WideString CPWL_EditImpl::GetText() const { + WideString swRet; if (!m_pVT->IsValid()) return swRet; @@ -757,8 +757,8 @@ CFX_WideString CPWL_EditImpl::GetText() const { return swRet; } -CFX_WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const { - CFX_WideString swRet; +WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const { + WideString swRet; if (!m_pVT->IsValid()) return swRet; @@ -783,7 +783,7 @@ CFX_WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const { return swRet; } -CFX_WideString CPWL_EditImpl::GetSelectedText() const { +WideString CPWL_EditImpl::GetSelectedText() const { return GetRangeText(m_SelState.ConvertToWordRange()); } @@ -802,7 +802,7 @@ CPVT_WordRange CPWL_EditImpl::GetSelectWordRange() const { return m_SelState.ConvertToWordRange(); } -void CPWL_EditImpl::SetText(const CFX_WideString& sText) { +void CPWL_EditImpl::SetText(const WideString& sText) { Empty(); DoInsertText(CPVT_WordPlace(0, 0, -1), sText, FX_CHARSET_Default); Paint(); @@ -828,7 +828,7 @@ bool CPWL_EditImpl::ClearSelection() { return Clear(true, true); } -bool CPWL_EditImpl::InsertText(const CFX_WideString& sText, int32_t charset) { +bool CPWL_EditImpl::InsertText(const WideString& sText, int32_t charset) { return InsertText(sText, charset, true, true); } @@ -1702,7 +1702,7 @@ bool CPWL_EditImpl::Clear(bool bAddUndo, bool bPaint) { return true; } -bool CPWL_EditImpl::InsertText(const CFX_WideString& sText, +bool CPWL_EditImpl::InsertText(const WideString& sText, int32_t charset, bool bAddUndo, bool bPaint) { @@ -1836,7 +1836,7 @@ void CPWL_EditImpl::EnableUndo(bool bUndo) { } CPVT_WordPlace CPWL_EditImpl::DoInsertText(const CPVT_WordPlace& place, - const CFX_WideString& sText, + const WideString& sText, int32_t charset) { CPVT_WordPlace wp = place; @@ -1877,15 +1877,15 @@ void CPWL_EditImpl::AddEditUndoItem( m_Undo.AddItem(std::move(pEditUndoItem)); } -CFX_ByteString CPWL_EditImpl::GetPDFWordString(int32_t nFontIndex, - uint16_t Word, - uint16_t SubWord) { +ByteString CPWL_EditImpl::GetPDFWordString(int32_t nFontIndex, + uint16_t Word, + uint16_t SubWord) { IPVT_FontMap* pFontMap = GetFontMap(); CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex); if (!pPDFFont) - return CFX_ByteString(); + return ByteString(); - CFX_ByteString sWord; + ByteString sWord; if (SubWord > 0) { Word = SubWord; } else { diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h index 177a0524f4..a63b22cd10 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.h +++ b/fpdfsdk/pwl/cpwl_edit_impl.h @@ -233,7 +233,7 @@ class CFXEU_Clear : public IFX_Edit_UndoItem { public: CFXEU_Clear(CPWL_EditImpl* pEdit, const CPVT_WordRange& wrSel, - const CFX_WideString& swText); + const WideString& swText); ~CFXEU_Clear() override; // IFX_Edit_UndoItem: @@ -244,7 +244,7 @@ class CFXEU_Clear : public IFX_Edit_UndoItem { CFX_UnownedPtr m_pEdit; CPVT_WordRange m_wrSel; - CFX_WideString m_swText; + WideString m_swText; }; class CFXEU_InsertText : public IFX_Edit_UndoItem { @@ -252,7 +252,7 @@ class CFXEU_InsertText : public IFX_Edit_UndoItem { CFXEU_InsertText(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, - const CFX_WideString& swText, + const WideString& swText, int32_t charset); ~CFXEU_InsertText() override; @@ -265,7 +265,7 @@ class CFXEU_InsertText : public IFX_Edit_UndoItem { CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; - CFX_WideString m_swText; + WideString m_swText; int32_t m_nCharset; }; @@ -323,27 +323,27 @@ class CPWL_EditImpl { void OnVK_RIGHT(bool bShift, bool bCtrl); void OnVK_HOME(bool bShift, bool bCtrl); void OnVK_END(bool bShift, bool bCtrl); - void SetText(const CFX_WideString& sText); + void SetText(const WideString& sText); bool InsertWord(uint16_t word, int32_t charset); bool InsertReturn(); bool Backspace(); bool Delete(); bool ClearSelection(); - bool InsertText(const CFX_WideString& sText, int32_t charset); + bool InsertText(const WideString& sText, int32_t charset); bool Redo(); bool Undo(); CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const; int32_t GetCaret() const; CPVT_WordPlace GetCaretWordPlace() const; - CFX_WideString GetSelectedText() const; - CFX_WideString GetText() const; + WideString GetSelectedText() const; + WideString GetText() const; float GetFontSize() const; uint16_t GetPasswordChar() const; CFX_PointF GetScrollPos() const; int32_t GetCharArray() const; CFX_FloatRect GetContentRect() const; - CFX_WideString GetRangeText(const CPVT_WordRange& range) const; + WideString GetRangeText(const CPVT_WordRange& range) const; int32_t GetHorzScale() const; float GetCharSpace() const; void SetSelection(int32_t nStartChar, int32_t nEndChar); @@ -366,15 +366,15 @@ class CPWL_EditImpl { bool Empty(); CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, - const CFX_WideString& sText, + const WideString& sText, int32_t charset); int32_t GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset); int32_t GetTotalLines() const; - CFX_ByteString GetPDFWordString(int32_t nFontIndex, - uint16_t Word, - uint16_t SubWord); + ByteString GetPDFWordString(int32_t nFontIndex, + uint16_t Word, + uint16_t SubWord); private: friend class CPWL_EditImpl_Iterator; @@ -408,7 +408,7 @@ class CPWL_EditImpl { bool Backspace(bool bAddUndo, bool bPaint); bool Delete(bool bAddUndo, bool bPaint); bool Clear(bool bAddUndo, bool bPaint); - bool InsertText(const CFX_WideString& sText, + bool InsertText(const WideString& sText, int32_t charset, bool bAddUndo, bool bPaint); diff --git a/fpdfsdk/pwl/cpwl_font_map.cpp b/fpdfsdk/pwl/cpwl_font_map.cpp index 862973541a..94d5fb8518 100644 --- a/fpdfsdk/pwl/cpwl_font_map.cpp +++ b/fpdfsdk/pwl/cpwl_font_map.cpp @@ -66,11 +66,11 @@ CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) { return nullptr; } -CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) { +ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) { if (pdfium::IndexInBounds(m_Data, nFontIndex) && m_Data[nFontIndex]) return m_Data[nFontIndex]->sFontName; - return CFX_ByteString(); + return ByteString(); } bool CPWL_FontMap::KnowWord(int32_t nFontIndex, uint16_t word) { @@ -122,15 +122,15 @@ int32_t CPWL_FontMap::CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) { return word < 0xFF ? word : -1; } -CFX_ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) { +ByteString CPWL_FontMap::GetNativeFontName(int32_t nCharset) { for (const auto& pData : m_NativeFont) { if (pData && pData->nCharset == nCharset) return pData->sFontName; } - CFX_ByteString sNew = GetNativeFont(nCharset); + ByteString sNew = GetNativeFont(nCharset); if (sNew.IsEmpty()) - return CFX_ByteString(); + return ByteString(); auto pNewData = pdfium::MakeUnique(); pNewData->nCharset = nCharset; @@ -148,7 +148,7 @@ void CPWL_FontMap::Initialize() { GetFontIndex(kDefaultFontName, FX_CHARSET_ANSI, false); } -bool CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) { +bool CPWL_FontMap::IsStandardFont(const ByteString& sFontName) { for (size_t i = 0; i < FX_ArraySize(g_sDEStandardFontName); ++i) { if (sFontName == g_sDEStandardFontName[i]) return true; @@ -157,8 +157,7 @@ bool CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) { return false; } -int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName, - int32_t nCharset) { +int32_t CPWL_FontMap::FindFont(const ByteString& sFontName, int32_t nCharset) { int32_t i = 0; for (const auto& pData : m_Data) { if (pData && @@ -171,17 +170,17 @@ int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName, return -1; } -int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, +int32_t CPWL_FontMap::GetFontIndex(const ByteString& sFontName, int32_t nCharset, bool bFind) { int32_t nFontIndex = FindFont(EncodeFontAlias(sFontName, nCharset), nCharset); if (nFontIndex >= 0) return nFontIndex; - CFX_ByteString sAlias; + ByteString sAlias; CPDF_Font* pFont = bFind ? FindFontSameCharset(&sAlias, nCharset) : nullptr; if (!pFont) { - CFX_ByteString sTemp = sFontName; + ByteString sTemp = sFontName; pFont = AddFontToDocument(GetDocument(), sTemp, nCharset); sAlias = EncodeFontAlias(sTemp, nCharset); } @@ -189,13 +188,13 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, return AddFontData(pFont, sAlias, nCharset); } -CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString* sFontAlias, +CPDF_Font* CPWL_FontMap::FindFontSameCharset(ByteString* sFontAlias, int32_t nCharset) { return nullptr; } int32_t CPWL_FontMap::AddFontData(CPDF_Font* pFont, - const CFX_ByteString& sFontAlias, + const ByteString& sFontAlias, int32_t nCharset) { auto pNewData = pdfium::MakeUnique(); pNewData->pFont = pFont; @@ -205,22 +204,21 @@ int32_t CPWL_FontMap::AddFontData(CPDF_Font* pFont, return pdfium::CollectionSize(m_Data) - 1; } -void CPWL_FontMap::AddedFont(CPDF_Font* pFont, - const CFX_ByteString& sFontAlias) {} +void CPWL_FontMap::AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias) {} -CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) { +ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) { if (nCharset == FX_CHARSET_Default) nCharset = GetNativeCharset(); - CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset); + ByteString sFontName = GetDefaultFontByCharset(nCharset); if (!m_pSystemHandler->FindNativeTrueTypeFont(sFontName)) - return CFX_ByteString(); + return ByteString(); return sFontName; } CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc, - CFX_ByteString& sFontName, + ByteString& sFontName, uint8_t nCharset) { if (IsStandardFont(sFontName)) return AddStandardFont(pDoc, sFontName); @@ -229,7 +227,7 @@ CPDF_Font* CPWL_FontMap::AddFontToDocument(CPDF_Document* pDoc, } CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc, - CFX_ByteString& sFontName) { + ByteString& sFontName) { if (!pDoc) return nullptr; @@ -246,7 +244,7 @@ CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc, } CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, - CFX_ByteString& sFontName, + ByteString& sFontName, uint8_t nCharset) { if (!pDoc) return nullptr; @@ -260,15 +258,15 @@ CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, nCharset); } -CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName, - int32_t nCharset) { - CFX_ByteString sPostfix; +ByteString CPWL_FontMap::EncodeFontAlias(const ByteString& sFontName, + int32_t nCharset) { + ByteString sPostfix; sPostfix.Format("_%02X", nCharset); return EncodeFontAlias(sFontName) + sPostfix; } -CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName) { - CFX_ByteString sRet = sFontName; +ByteString CPWL_FontMap::EncodeFontAlias(const ByteString& sFontName) { + ByteString sRet = sFontName; sRet.Remove(' '); return sRet; } @@ -349,7 +347,7 @@ const FPDF_CharsetFontMap CPWL_FontMap::defaultTTFMap[] = { {FX_CHARSET_MSWin_Arabic, "Arial"}, {-1, nullptr}}; -CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) { +ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) { int i = 0; while (defaultTTFMap[i].charset != -1) { if (nCharset == defaultTTFMap[i].charset) diff --git a/fpdfsdk/pwl/cpwl_font_map.h b/fpdfsdk/pwl/cpwl_font_map.h index 9872779c95..5336949399 100644 --- a/fpdfsdk/pwl/cpwl_font_map.h +++ b/fpdfsdk/pwl/cpwl_font_map.h @@ -21,12 +21,12 @@ class CFX_SystemHandler; struct CPWL_FontMap_Data { CPDF_Font* pFont; int32_t nCharset; - CFX_ByteString sFontName; + ByteString sFontName; }; struct CPWL_FontMap_Native { int32_t nCharset; - CFX_ByteString sFontName; + ByteString sFontName; }; class CPWL_FontMap : public IPVT_FontMap { @@ -36,7 +36,7 @@ class CPWL_FontMap : public IPVT_FontMap { // IPVT_FontMap CPDF_Font* GetPDFFont(int32_t nFontIndex) override; - CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override; + ByteString GetPDFFontAlias(int32_t nFontIndex) override; int32_t GetWordFontIndex(uint16_t word, int32_t nCharset, int32_t nFontIndex) override; @@ -45,47 +45,46 @@ class CPWL_FontMap : public IPVT_FontMap { const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; static int32_t GetNativeCharset(); - CFX_ByteString GetNativeFontName(int32_t nCharset); + ByteString GetNativeFontName(int32_t nCharset); - static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset); + static ByteString GetDefaultFontByCharset(int32_t nCharset); static const FPDF_CharsetFontMap defaultTTFMap[]; protected: virtual void Initialize(); virtual CPDF_Document* GetDocument(); - virtual CPDF_Font* FindFontSameCharset(CFX_ByteString* sFontAlias, + virtual CPDF_Font* FindFontSameCharset(ByteString* sFontAlias, int32_t nCharset); - virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); + virtual void AddedFont(CPDF_Font* pFont, const ByteString& sFontAlias); bool KnowWord(int32_t nFontIndex, uint16_t word); void Empty(); - int32_t GetFontIndex(const CFX_ByteString& sFontName, + int32_t GetFontIndex(const ByteString& sFontName, int32_t nCharset, bool bFind); int32_t AddFontData(CPDF_Font* pFont, - const CFX_ByteString& sFontAlias, + const ByteString& sFontAlias, int32_t nCharset = FX_CHARSET_Default); - CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, - int32_t nCharset); - CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName); + ByteString EncodeFontAlias(const ByteString& sFontName, int32_t nCharset); + ByteString EncodeFontAlias(const ByteString& sFontName); std::vector> m_Data; std::vector> m_NativeFont; private: - int32_t FindFont(const CFX_ByteString& sFontName, + int32_t FindFont(const ByteString& sFontName, int32_t nCharset = FX_CHARSET_Default); - CFX_ByteString GetNativeFont(int32_t nCharset); + ByteString GetNativeFont(int32_t nCharset); CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, - CFX_ByteString& sFontName, + ByteString& sFontName, uint8_t nCharset); - bool IsStandardFont(const CFX_ByteString& sFontName); - CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); + bool IsStandardFont(const ByteString& sFontName); + CPDF_Font* AddStandardFont(CPDF_Document* pDoc, ByteString& sFontName); CPDF_Font* AddSystemFont(CPDF_Document* pDoc, - CFX_ByteString& sFontName, + ByteString& sFontName, uint8_t nCharset); std::unique_ptr m_pPDFDoc; diff --git a/fpdfsdk/pwl/cpwl_icon.cpp b/fpdfsdk/pwl/cpwl_icon.cpp index 8a2e31da6a..e7669b3d20 100644 --- a/fpdfsdk/pwl/cpwl_icon.cpp +++ b/fpdfsdk/pwl/cpwl_icon.cpp @@ -37,12 +37,12 @@ CFX_Matrix CPWL_Icon::GetImageMatrix() { return CFX_Matrix(); } -CFX_ByteString CPWL_Icon::GetImageAlias() { +ByteString CPWL_Icon::GetImageAlias() { if (!m_pPDFStream) - return CFX_ByteString(); + return ByteString(); if (CPDF_Dictionary* pDict = m_pPDFStream->GetDict()) return pDict->GetStringFor("Name"); - return CFX_ByteString(); + return ByteString(); } std::pair CPWL_Icon::GetIconPosition() { diff --git a/fpdfsdk/pwl/cpwl_icon.h b/fpdfsdk/pwl/cpwl_icon.h index 2607e56890..e2f792b9d5 100644 --- a/fpdfsdk/pwl/cpwl_icon.h +++ b/fpdfsdk/pwl/cpwl_icon.h @@ -28,7 +28,7 @@ class CPWL_Icon : public CPWL_Wnd { std::pair GetImageOffset(); CFX_Matrix GetImageMatrix(); - CFX_ByteString GetImageAlias(); + ByteString GetImageAlias(); private: // left, bottom diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp index 4090e792e4..b5c629392b 100644 --- a/fpdfsdk/pwl/cpwl_list_box.cpp +++ b/fpdfsdk/pwl/cpwl_list_box.cpp @@ -72,7 +72,7 @@ CPWL_ListBox::CPWL_ListBox() CPWL_ListBox::~CPWL_ListBox() {} -CFX_ByteString CPWL_ListBox::GetClassName() const { +ByteString CPWL_ListBox::GetClassName() const { return "CPWL_ListBox"; } @@ -260,8 +260,8 @@ bool CPWL_ListBox::OnNotifySelectionChanged(bool bKeyDown, uint32_t nFlag) { if (!m_pFillerNotify) return false; - CFX_WideString swChange = GetText(); - CFX_WideString strChangeEx; + WideString swChange = GetText(); + WideString strChangeEx; int nSelStart = 0; int nSelEnd = swChange.GetLength(); bool bRC; @@ -282,11 +282,11 @@ CFX_FloatRect CPWL_ListBox::GetFocusRect() const { return CPWL_Wnd::GetFocusRect(); } -void CPWL_ListBox::AddString(const CFX_WideString& str) { +void CPWL_ListBox::AddString(const WideString& str) { m_pList->AddString(str); } -CFX_WideString CPWL_ListBox::GetText() const { +WideString CPWL_ListBox::GetText() const { return m_pList->GetText(); } diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h index f620ec1050..1e028f7299 100644 --- a/fpdfsdk/pwl/cpwl_list_box.h +++ b/fpdfsdk/pwl/cpwl_list_box.h @@ -44,7 +44,7 @@ class CPWL_ListBox : public CPWL_Wnd { ~CPWL_ListBox() override; // CPWL_Wnd - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; void OnCreated() override; void OnDestroy() override; void DrawThisAppearance(CFX_RenderDevice* pDevice, @@ -66,11 +66,11 @@ class CPWL_ListBox : public CPWL_Wnd { void SetFontSize(float fFontSize) override; float GetFontSize() const override; - virtual CFX_WideString GetText() const; + virtual WideString GetText() const; bool OnNotifySelectionChanged(bool bKeyDown, uint32_t nFlag); - void AddString(const CFX_WideString& str); + void AddString(const WideString& str); void SetTopVisibleIndex(int32_t nItemIndex); void ScrollToListItem(int32_t nItemIndex); void ResetContent(); diff --git a/fpdfsdk/pwl/cpwl_list_impl.cpp b/fpdfsdk/pwl/cpwl_list_impl.cpp index 94e0606941..da455d06cb 100644 --- a/fpdfsdk/pwl/cpwl_list_impl.cpp +++ b/fpdfsdk/pwl/cpwl_list_impl.cpp @@ -29,7 +29,7 @@ void CPWL_ListCtrl::Item::SetFontMap(IPVT_FontMap* pFontMap) { m_pEdit->SetFontMap(pFontMap); } -void CPWL_ListCtrl::Item::SetText(const CFX_WideString& text) { +void CPWL_ListCtrl::Item::SetText(const WideString& text) { m_pEdit->SetText(text); } @@ -49,7 +49,7 @@ uint16_t CPWL_ListCtrl::Item::GetFirstChar() const { return word.Word; } -CFX_WideString CPWL_ListCtrl::Item::GetText() const { +WideString CPWL_ListCtrl::Item::GetText() const { return m_pEdit->GetText(); } @@ -310,7 +310,7 @@ CFX_FloatRect CPWL_ListCtrl::GetItemRectInternal(int32_t nIndex) const { return InnerToOuter(rcItem); } -void CPWL_ListCtrl::AddString(const CFX_WideString& str) { +void CPWL_ListCtrl::AddString(const WideString& str) { AddItem(str); ReArrange(GetCount() - 1); } @@ -551,13 +551,13 @@ int32_t CPWL_ListCtrl::GetItemIndex(const CFX_PointF& point) const { return -1; } -CFX_WideString CPWL_ListCtrl::GetText() const { +WideString CPWL_ListCtrl::GetText() const { if (IsMultipleSel()) return GetItemText(m_nCaretIndex); return GetItemText(m_nSelItem); } -void CPWL_ListCtrl::AddItem(const CFX_WideString& str) { +void CPWL_ListCtrl::AddItem(const WideString& str) { auto pListItem = pdfium::MakeUnique(); pListItem->SetFontMap(m_pFontMap.Get()); pListItem->SetFontSize(m_fFontSize); @@ -630,7 +630,7 @@ bool CPWL_ListCtrl::IsValid(int32_t nItemIndex) const { return pdfium::IndexInBounds(m_ListItems, nItemIndex); } -CFX_WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const { +WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const { if (pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex]) return m_ListItems[nIndex]->GetText(); return L""; diff --git a/fpdfsdk/pwl/cpwl_list_impl.h b/fpdfsdk/pwl/cpwl_list_impl.h index 9bb0d2969c..18ca0a3a15 100644 --- a/fpdfsdk/pwl/cpwl_list_impl.h +++ b/fpdfsdk/pwl/cpwl_list_impl.h @@ -68,13 +68,13 @@ class CPWL_ListCtrl { CFX_FloatRect GetContentRect() const; int32_t GetItemIndex(const CFX_PointF& point) const; - void AddString(const CFX_WideString& str); + void AddString(const WideString& str); void SetTopItem(int32_t nIndex); void Select(int32_t nItemIndex); void SetCaret(int32_t nItemIndex); void Empty(); void Cancel(); - CFX_WideString GetText() const; + WideString GetText() const; void SetFontMap(IPVT_FontMap* pFontMap) { m_pFontMap = pFontMap; } void SetFontSize(float fFontSize) { m_fFontSize = fFontSize; } @@ -102,9 +102,9 @@ class CPWL_ListCtrl { void SetRect(const CFX_FloatRect& rect) { m_rcListItem = rect; } void SetSelect(bool bSelected) { m_bSelected = bSelected; } - void SetText(const CFX_WideString& text); + void SetText(const WideString& text); void SetFontSize(float fFontSize); - CFX_WideString GetText() const; + WideString GetText() const; CFX_FloatRect GetRect() const { return m_rcListItem; } bool IsSelected() const { return m_bSelected; } @@ -142,8 +142,8 @@ class CPWL_ListCtrl { bool IsItemVisible(int32_t nItemIndex) const; void SetScrollInfo(); void SetScrollPosY(float fy); - void AddItem(const CFX_WideString& str); - CFX_WideString GetItemText(int32_t nIndex) const; + void AddItem(const WideString& str); + WideString GetItemText(int32_t nIndex) const; void SetItemSelect(int32_t nItemIndex, bool bSelected); int32_t GetLastSelected() const; CFX_PointF GetBTPoint() const { diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp index 15247293a0..e50f778943 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp +++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp @@ -127,7 +127,7 @@ CPWL_SBButton::CPWL_SBButton(PWL_SCROLLBAR_TYPE eScrollBarType, CPWL_SBButton::~CPWL_SBButton() {} -CFX_ByteString CPWL_SBButton::GetClassName() const { +ByteString CPWL_SBButton::GetClassName() const { return "CPWL_SBButton"; } @@ -325,7 +325,7 @@ CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType) CPWL_ScrollBar::~CPWL_ScrollBar() {} -CFX_ByteString CPWL_ScrollBar::GetClassName() const { +ByteString CPWL_ScrollBar::GetClassName() const { return "CPWL_ScrollBar"; } diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h index 44c72cbbe2..48aef16e38 100644 --- a/fpdfsdk/pwl/cpwl_scroll_bar.h +++ b/fpdfsdk/pwl/cpwl_scroll_bar.h @@ -49,7 +49,7 @@ class CPWL_SBButton : public CPWL_Wnd { ~CPWL_SBButton() override; // CPWL_Wnd - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; void DrawThisAppearance(CFX_RenderDevice* pDevice, const CFX_Matrix& mtUser2Device) override; @@ -121,7 +121,7 @@ class CPWL_ScrollBar : public CPWL_Wnd { ~CPWL_ScrollBar() override; // CPWL_Wnd: - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; void OnCreate(CreateParams* pParamsToAdjust) override; void OnDestroy() override; void RePosChildWnd() override; diff --git a/fpdfsdk/pwl/cpwl_special_button.cpp b/fpdfsdk/pwl/cpwl_special_button.cpp index 53f7f2c1d0..ddca67e5d1 100644 --- a/fpdfsdk/pwl/cpwl_special_button.cpp +++ b/fpdfsdk/pwl/cpwl_special_button.cpp @@ -12,7 +12,7 @@ CPWL_PushButton::CPWL_PushButton() {} CPWL_PushButton::~CPWL_PushButton() {} -CFX_ByteString CPWL_PushButton::GetClassName() const { +ByteString CPWL_PushButton::GetClassName() const { return "CPWL_PushButton"; } @@ -25,7 +25,7 @@ CPWL_CheckBox::CPWL_CheckBox() : m_bChecked(false) {} CPWL_CheckBox::~CPWL_CheckBox() {} -CFX_ByteString CPWL_CheckBox::GetClassName() const { +ByteString CPWL_CheckBox::GetClassName() const { return "CPWL_CheckBox"; } @@ -54,7 +54,7 @@ CPWL_RadioButton::CPWL_RadioButton() : m_bChecked(false) {} CPWL_RadioButton::~CPWL_RadioButton() {} -CFX_ByteString CPWL_RadioButton::GetClassName() const { +ByteString CPWL_RadioButton::GetClassName() const { return "CPWL_RadioButton"; } diff --git a/fpdfsdk/pwl/cpwl_special_button.h b/fpdfsdk/pwl/cpwl_special_button.h index b499542795..076b5298ed 100644 --- a/fpdfsdk/pwl/cpwl_special_button.h +++ b/fpdfsdk/pwl/cpwl_special_button.h @@ -15,7 +15,7 @@ class CPWL_PushButton : public CPWL_Button { ~CPWL_PushButton() override; // CPWL_Button - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; CFX_FloatRect GetFocusRect() const override; }; @@ -25,7 +25,7 @@ class CPWL_CheckBox : public CPWL_Button { ~CPWL_CheckBox() override; // CPWL_Button - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; @@ -42,7 +42,7 @@ class CPWL_RadioButton : public CPWL_Button { ~CPWL_RadioButton() override; // CPWL_Button - CFX_ByteString GetClassName() const override; + ByteString GetClassName() const override; bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override; bool OnChar(uint16_t nChar, uint32_t nFlag) override; diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp index 401fed3f9c..1c1512e296 100644 --- a/fpdfsdk/pwl/cpwl_wnd.cpp +++ b/fpdfsdk/pwl/cpwl_wnd.cpp @@ -146,7 +146,7 @@ CPWL_Wnd::~CPWL_Wnd() { ASSERT(!m_bCreated); } -CFX_ByteString CPWL_Wnd::GetClassName() const { +ByteString CPWL_Wnd::GetClassName() const { return "CPWL_Wnd"; } @@ -361,11 +361,11 @@ PWL_IMPLEMENT_MOUSE_METHOD(OnRButtonUp) PWL_IMPLEMENT_MOUSE_METHOD(OnMouseMove) #undef PWL_IMPLEMENT_MOUSE_METHOD -CFX_WideString CPWL_Wnd::GetSelectedText() { - return CFX_WideString(); +WideString CPWL_Wnd::GetSelectedText() { + return WideString(); } -void CPWL_Wnd::ReplaceSelection(const CFX_WideString& text) {} +void CPWL_Wnd::ReplaceSelection(const WideString& text) {} bool CPWL_Wnd::OnMouseWheel(short zDelta, const CFX_PointF& point, diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h index 2fd5077a86..17ed06450a 100644 --- a/fpdfsdk/pwl/cpwl_wnd.h +++ b/fpdfsdk/pwl/cpwl_wnd.h @@ -152,7 +152,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { CPWL_Wnd(); ~CPWL_Wnd() override; - virtual CFX_ByteString GetClassName() const; + virtual ByteString GetClassName() const; virtual void InvalidateRect(CFX_FloatRect* pRect); virtual bool OnKeyDown(uint16_t nChar, uint32_t nFlag); @@ -179,8 +179,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable { virtual void SetFontSize(float fFontSize); virtual float GetFontSize() const; - virtual CFX_WideString GetSelectedText(); - virtual void ReplaceSelection(const CFX_WideString& text); + virtual WideString GetSelectedText(); + virtual void ReplaceSelection(const WideString& text); virtual CFX_FloatRect GetFocusRect() const; virtual CFX_FloatRect GetClientRect() const; -- cgit v1.2.3