summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-18 14:23:18 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-18 18:40:16 +0000
commit275e260a6cd4a8e506ba974feb85ebcd926c1739 (patch)
tree2029b9158ec044764ceff122fe5fb5d0a3f123d1 /fpdfsdk/formfiller
parent450fbeaaabf1ab340c1018de2e58f1950657517e (diff)
downloadpdfium-275e260a6cd4a8e506ba974feb85ebcd926c1739.tar.xz
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 <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/formfiller')
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp27
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.h18
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.cpp12
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.h4
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp8
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.h4
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.cpp14
-rw-r--r--fpdfsdk/formfiller/cffl_interactiveformfiller.h8
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp10
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.h2
10 files changed, 52 insertions, 55 deletions
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<CPDF_Document> m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> m_pAnnotDict;
CFX_UnownedPtr<CPDF_Font> 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<const unsigned short*>(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<bool, bool> 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<bool, bool> 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<const unsigned short*>(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,