From f7a7d7e07396c3a0fae617ed8f15f29fd491bc3a Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 27 Apr 2015 11:31:26 -0700 Subject: Revert "Kill operator LPCWSTR from CFX_WideString()." This reverts commit 15a62973b9b89c3e229cc0ab501c45967f91b325. Reason for revert: broke build on windows, mac. I must have missed some platform-specific conversions. TBR=brucedawson@chromium.org Review URL: https://codereview.chromium.org/1108883002 --- fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 17 +++++++++++------ fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 2 +- fpdfsdk/src/formfiller/FFL_ListBox.cpp | 6 ++++-- fpdfsdk/src/formfiller/FFL_TextField.cpp | 9 +++++---- 4 files changed, 21 insertions(+), 13 deletions(-) (limited to 'fpdfsdk/src/formfiller') diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index 012ed4a730..9e58c952aa 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -77,23 +77,28 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVie pWnd->AttachFFLData(this); pWnd->Create(cp); + ASSERT(m_pApp != NULL); CFFL_IFormFiller* pFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pFormFiller); + ASSERT(m_pWidget != NULL); FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0); + CFX_WideString swText; + if (nCurSel < 0) swText = m_pWidget->GetValue(); else swText = m_pWidget->GetOptionLabel(nCurSel); - + for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); iAddString(m_pWidget->GetOptionLabel(i).c_str()); + pWnd->AddString(m_pWidget->GetOptionLabel(i)); } - + pWnd->SetSelect(nCurSel); - pWnd->SetText(swText.c_str()); + pWnd->SetText(swText); + return pWnd; } @@ -240,7 +245,7 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAc if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) { pEdit->SetSel(fa.nSelStart, fa.nSelEnd); - pEdit->ReplaceSel(fa.sChange.c_str()); + pEdit->ReplaceSel(fa.sChange); } } break; @@ -292,7 +297,7 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) { if (CPWL_Edit* pEdit = (CPWL_Edit*)*pComboBox) { - pEdit->SetText(m_State.sValue.c_str()); + pEdit->SetText(m_State.sValue); pEdit->SetSel(m_State.nStart, m_State.nEnd); } } diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index 1656ba5c5d..2b21e13cfc 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -973,7 +973,7 @@ void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage if (bFormated) { - pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), TRUE); + pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue, TRUE); pInterForm->UpdateField(pWidget->GetFormField()); } diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp index dffd17538f..87ae552a66 100644 --- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp @@ -76,9 +76,11 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); pWnd->SetFillerNotify(pIFormFiller); + ASSERT(m_pWidget != NULL); + for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); iAddString(m_pWidget->GetOptionLabel(i).c_str()); - + pWnd->AddString(m_pWidget->GetOptionLabel(i)); + if (pWnd->HasFlag(PLBS_MULTIPLESEL)) { m_OriginSelections.RemoveAll(); diff --git a/fpdfsdk/src/formfiller/FFL_TextField.cpp b/fpdfsdk/src/formfiller/FFL_TextField.cpp index f488fac6ae..f45d95364d 100644 --- a/fpdfsdk/src/formfiller/FFL_TextField.cpp +++ b/fpdfsdk/src/formfiller/FFL_TextField.cpp @@ -129,8 +129,9 @@ CPWL_Wnd* CFFL_TextField::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageVi pWnd->SetLimitChar(nMaxLen); } } - - pWnd->SetText(swValue.c_str()); + + pWnd->SetText(swValue); + return pWnd; } @@ -250,7 +251,7 @@ void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AA { pEdit->SetFocus(); pEdit->SetSel(fa.nSelStart, fa.nSelEnd); - pEdit->ReplaceSel(fa.sChange.c_str()); + pEdit->ReplaceSel(fa.sChange); } break; default: @@ -291,7 +292,7 @@ void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, TRUE)) { - pWnd->SetText(m_State.sValue.c_str()); + pWnd->SetText(m_State.sValue); pWnd->SetSel(m_State.nStart, m_State.nEnd); } } -- cgit v1.2.3