diff options
Diffstat (limited to 'fpdfsdk/src/pdfwindow')
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp | 4 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Edit.cpp | 16 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_IconList.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Note.cpp | 19 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 15 |
5 files changed, 30 insertions, 26 deletions
diff --git a/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ComboBox.cpp index 6627189bd7..01810ffd7a 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().c_str()); + m_pEdit->SetText(m_pList->GetText()); 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().c_str()); + m_pEdit->ReplaceSel(m_pList->GetText()); 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 f704a67731..1cbbf9a17e 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.c_str()); + m_pEdit->SetText(swText); } void CPWL_Edit::RePosChildWnd() @@ -192,7 +192,7 @@ void CPWL_Edit::PasteText() if (swClipboard.GetLength() > 0) { Clear(); - InsertText(swClipboard.c_str()); + InsertText(swClipboard); } 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().c_str()); + ReplaceSel(sSuggestWords[0].UTF8Decode()); break; case WM_PWLEDIT_SUGGEST + 1: SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos)); - ReplaceSel(sSuggestWords[1].UTF8Decode().c_str()); + ReplaceSel(sSuggestWords[1].UTF8Decode()); break; case WM_PWLEDIT_SUGGEST + 2: SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos)); - ReplaceSel(sSuggestWords[2].UTF8Decode().c_str()); + ReplaceSel(sSuggestWords[2].UTF8Decode()); break; case WM_PWLEDIT_SUGGEST + 3: SetSel(m_pEdit->WordPlaceToWordIndex(wrLatin.BeginPos),m_pEdit->WordPlaceToWordIndex(wrLatin.EndPos)); - ReplaceSel(sSuggestWords[3].UTF8Decode().c_str()); + ReplaceSel(sSuggestWords[3].UTF8Decode()); 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().c_str()); + ReplaceSel(sSuggestWords[4].UTF8Decode()); break; default: break; diff --git a/fpdfsdk/src/pdfwindow/PWL_IconList.cpp b/fpdfsdk/src/pdfwindow/PWL_IconList.cpp index 990f8b893f..1d58a90111 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.c_str()); + m_pText->SetText(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 33d1b3b009..7bc8fad395 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.c_str()); + m_pText->SetText(sText); } 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.c_str()); + m_pEdit->SetText(sText); 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.c_str()); + m_pSubject->SetText(sName); } if (IPWL_NoteNotify* pNotify = GetNoteNotify()) @@ -848,10 +848,11 @@ void CPWL_NoteItem::ResetSubjectName(FX_INT32 nItemIndex) ASSERT(pNote != NULL); CFX_WideString sSubject; - sSubject.Format(pNote->GetReplyString().c_str(), nItemIndex); + sSubject.Format(pNote->GetReplyString(), nItemIndex); if (!m_sAuthor.IsEmpty()) { + sSubject += L" - "; sSubject += m_sAuthor; } @@ -862,12 +863,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.c_str()); + m_pDateTime->SetText(swTime); } this->RePosChildWnd(); @@ -1527,14 +1528,14 @@ void CPWL_Note::SetAuthorName(const CFX_WideString& sName) { if (m_pAuthor) { - m_pAuthor->SetText(sName.c_str()); + m_pAuthor->SetText(sName); 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 b57f8e019d..1de6b56d5e 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -641,8 +641,9 @@ 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); @@ -652,15 +653,16 @@ 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); } @@ -679,8 +681,9 @@ 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); @@ -689,11 +692,11 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CPDF_Rect & rcBBox, pEdit->SetAutoFontSize(TRUE); else pEdit->SetFontSize(fFontSize); - pEdit->Initialize(); - pEdit->SetText(sLabel.c_str()); + pEdit->SetText(sLabel); CPDF_Rect rcLabelContent = pEdit->GetContentRect(); + CPWL_Icon Icon; PWL_CREATEPARAM cp; cp.dwFlags = PWS_VISIBLE; |