summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/pdfwindow
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-04-27 11:22:20 -0700
committerTom Sepez <tsepez@chromium.org>2015-04-27 11:22:20 -0700
commit15a62973b9b89c3e229cc0ab501c45967f91b325 (patch)
treed95505963de5d8640fb85067639b6fdaf159d1b6 /fpdfsdk/src/pdfwindow
parentef25d9995e494bd596ffea8fb8c09c2e48daa9a0 (diff)
downloadpdfium-15a62973b9b89c3e229cc0ab501c45967f91b325.tar.xz
Kill operator LPCWSTR from CFX_WideString().
This involves adding some explicit c_str() calls. Doing so flagged PDF_EncodeText() and FindOptionValue() as having suboptimal signatures, in that we are often throwing away a perfectly fine length and recomputing it. R=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1101933003
Diffstat (limited to 'fpdfsdk/src/pdfwindow')
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp4
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Edit.cpp16
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_IconList.cpp2
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Note.cpp19
-rw-r--r--fpdfsdk/src/pdfwindow/PWL_Utils.cpp15
5 files changed, 26 insertions, 30 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp
index 01810ffd7a..6627189bd7 100644
--- a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp
@@ -266,7 +266,7 @@ void CPWL_ComboBox::SetSelect(FX_INT32 nItemIndex)
if (m_pList)
m_pList->Select(nItemIndex);
- m_pEdit->SetText(m_pList->GetText());
+ m_pEdit->SetText(m_pList->GetText().c_str());
m_nSelectItem = nItemIndex;
}
@@ -638,7 +638,7 @@ void CPWL_ComboBox::SetSelectText()
{
CFX_WideString swText = m_pList->GetText();
m_pEdit->SelectAll();
- m_pEdit->ReplaceSel(m_pList->GetText());
+ m_pEdit->ReplaceSel(m_pList->GetText().c_str());
m_pEdit->SelectAll();
m_nSelectItem = m_pList->GetCurSel();
diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
index 1cbbf9a17e..f704a67731 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp
@@ -78,7 +78,7 @@ void CPWL_Edit::SetText(FX_LPCWSTR csText)
}
}
- m_pEdit->SetText(swText);
+ m_pEdit->SetText(swText.c_str());
}
void CPWL_Edit::RePosChildWnd()
@@ -192,7 +192,7 @@ void CPWL_Edit::PasteText()
if (swClipboard.GetLength() > 0)
{
Clear();
- InsertText(swClipboard);
+ InsertText(swClipboard.c_str());
}
if (m_pFillerNotify)
@@ -682,23 +682,23 @@ FX_BOOL CPWL_Edit::OnRButtonUp(const CPDF_Point & point, FX_DWORD nFlag)
break;
case WM_PWLEDIT_SUGGEST + 0:
SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[0].UTF8Decode());
+ ReplaceSel(sSuggestWords[0].UTF8Decode().c_str());
break;
case WM_PWLEDIT_SUGGEST + 1:
SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[1].UTF8Decode());
+ ReplaceSel(sSuggestWords[1].UTF8Decode().c_str());
break;
case WM_PWLEDIT_SUGGEST + 2:
SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[2].UTF8Decode());
+ ReplaceSel(sSuggestWords[2].UTF8Decode().c_str());
break;
case WM_PWLEDIT_SUGGEST + 3:
SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[3].UTF8Decode());
+ ReplaceSel(sSuggestWords[3].UTF8Decode().c_str());
break;
- case WM_PWLEDIT_SUGGEST + 4:
+ case WM_PWLEDIT_SUGGEST + 4:
SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos));
- ReplaceSel(sSuggestWords[4].UTF8Decode());
+ ReplaceSel(sSuggestWords[4].UTF8Decode().c_str());
break;
default:
break;
diff --git a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp
index 1d58a90111..990f8b893f 100644
--- a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp
@@ -107,7 +107,7 @@ void CPWL_IconList_Item::SetIcon(FX_INT32 nIconIndex)
void CPWL_IconList_Item::SetText(const CFX_WideString& str)
{
- m_pText->SetText(str);
+ m_pText->SetText(str.c_str());
}
CFX_WideString CPWL_IconList_Item::GetText() const
diff --git a/fpdfsdk/src/pdfwindow/PWL_Note.cpp b/fpdfsdk/src/pdfwindow/PWL_Note.cpp
index 7bc8fad395..33d1b3b009 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Note.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Note.cpp
@@ -82,7 +82,7 @@ void CPWL_Note_Options::CreateChildWnd(const PWL_CREATEPARAM & cp)
void CPWL_Note_Options::SetText(const CFX_WideString& sText)
{
- m_pText->SetText(sText);
+ m_pText->SetText(sText.c_str());
}
void CPWL_Note_Options::DrawThisAppearance(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device)
@@ -443,9 +443,9 @@ void CPWL_Note_Contents::SetText(const CFX_WideString& sText)
if (m_pEdit)
{
m_pEdit->EnableNotify(FALSE);
- m_pEdit->SetText(sText);
+ m_pEdit->SetText(sText.c_str());
m_pEdit->EnableNotify(TRUE);
- OnNotify(m_pEdit, PNM_NOTEEDITCHANGED, 0, 0);
+ OnNotify(m_pEdit, PNM_NOTEEDITCHANGED, 0, 0);
}
}
@@ -811,7 +811,7 @@ void CPWL_NoteItem::SetSubjectName(const CFX_WideString& sName)
{
if (m_pSubject)
{
- m_pSubject->SetText(sName);
+ m_pSubject->SetText(sName.c_str());
}
if (IPWL_NoteNotify* pNotify = GetNoteNotify())
@@ -848,11 +848,10 @@ void CPWL_NoteItem::ResetSubjectName(FX_INT32 nItemIndex)
ASSERT(pNote != NULL);
CFX_WideString sSubject;
- sSubject.Format(pNote->GetReplyString(), nItemIndex);
+ sSubject.Format(pNote->GetReplyString().c_str(), nItemIndex);
if (!m_sAuthor.IsEmpty())
{
-
sSubject += L" - ";
sSubject += m_sAuthor;
}
@@ -863,12 +862,12 @@ void CPWL_NoteItem::ResetSubjectName(FX_INT32 nItemIndex)
void CPWL_NoteItem::SetDateTime(FX_SYSTEMTIME time)
{
m_dtNote = time;
-
+
CFX_WideString swTime;
swTime.Format(L"%04d-%02d-%02d %02d:%02d:%02d", time.wYear, time.wMonth, time.wDay, time.wHour, time.wMinute, time.wSecond);
if (m_pDateTime)
{
- m_pDateTime->SetText(swTime);
+ m_pDateTime->SetText(swTime.c_str());
}
this->RePosChildWnd();
@@ -1528,14 +1527,14 @@ void CPWL_Note::SetAuthorName(const CFX_WideString& sName)
{
if (m_pAuthor)
{
- m_pAuthor->SetText(sName);
+ m_pAuthor->SetText(sName.c_str());
RePosChildWnd();
}
if (IPWL_NoteNotify* pNotify = GetNoteNotify())
{
pNotify->OnSetAuthorName(this);
- }
+ }
}
CFX_WideString CPWL_Note::GetAuthorName() const
diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
index 1de6b56d5e..b57f8e019d 100644
--- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp
@@ -641,9 +641,8 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo
CFX_ByteTextBuf sRet;
if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
- {
+ {
pEdit->SetFontMap(pFontMap);
-
pEdit->SetPlateRect(rcBBox);
pEdit->SetAlignmentH(nAlignmentH);
pEdit->SetAlignmentV(nAlignmentV);
@@ -653,16 +652,15 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CPDF_Rect & rcBBox,IFX_Edit_Fo
pEdit->SetAutoFontSize(TRUE);
else
pEdit->SetFontSize(fFontSize);
+
pEdit->Initialize();
+ pEdit->SetText(sText.c_str());
- pEdit->SetText(sText);
-
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit, CPDF_Point(0.0f,0.0f));
if (sEdit.GetLength() > 0)
{
sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";
}
-
IFX_Edit::DelEdit(pEdit);
}
@@ -681,9 +679,8 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,
const FX_FLOAT fAutoFontScale = 1.0f / 3.0f;
if (IFX_Edit * pEdit = IFX_Edit::NewEdit())
- {
+ {
pEdit->SetFontMap(pFontMap);
-
pEdit->SetAlignmentH(1);
pEdit->SetAlignmentV(1);
pEdit->SetMultiLine(FALSE);
@@ -692,11 +689,11 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox,
pEdit->SetAutoFontSize(TRUE);
else
pEdit->SetFontSize(fFontSize);
+
pEdit->Initialize();
- pEdit->SetText(sLabel);
+ pEdit->SetText(sLabel.c_str());
CPDF_Rect rcLabelContent = pEdit->GetContentRect();
-
CPWL_Icon Icon;
PWL_CREATEPARAM cp;
cp.dwFlags = PWS_VISIBLE;