Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(396)

Side by Side Diff: xfa/fxfa/app/xfa_fftextedit.cpp

Issue 1862123003: Rename both As{Byte,Wide}StringC() helpers to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, fix new usage. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/app/xfa_ffpageview.cpp ('k') | xfa/fxfa/app/xfa_ffwidget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/app/xfa_fftextedit.h" 7 #include "xfa/fxfa/app/xfa_fftextedit.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 if (pAppProvider) { 194 if (pAppProvider) {
195 CFX_WideString wsTitle; 195 CFX_WideString wsTitle;
196 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); 196 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle);
197 CFX_WideString wsMessage; 197 CFX_WideString wsMessage;
198 CFX_WideString wsError; 198 CFX_WideString wsError;
199 pAppProvider->LoadString(XFA_IDS_ValidateNumberError, wsError); 199 pAppProvider->LoadString(XFA_IDS_ValidateNumberError, wsError);
200 CFX_WideString wsSomField; 200 CFX_WideString wsSomField;
201 pAcc->GetNode()->GetSOMExpression(wsSomField); 201 pAcc->GetNode()->GetSOMExpression(wsSomField);
202 wsMessage.Format(wsError, (const FX_WCHAR*)wsText, 202 wsMessage.Format(wsError, (const FX_WCHAR*)wsText,
203 (const FX_WCHAR*)wsSomField); 203 (const FX_WCHAR*)wsSomField);
204 pAppProvider->MsgBox(wsMessage.AsWideStringC(), wsTitle.AsWideStringC(), 204 pAppProvider->MsgBox(wsMessage.AsStringC(), wsTitle.AsStringC(),
205 XFA_MBICON_Error, XFA_MB_OK); 205 XFA_MBICON_Error, XFA_MB_OK);
206 } 206 }
207 } 207 }
208 } 208 }
209 FX_BOOL CXFA_FFTextEdit::IsDataChanged() { 209 FX_BOOL CXFA_FFTextEdit::IsDataChanged() {
210 return (m_dwStatus & XFA_WIDGETSTATUS_TextEditValueChanged) != 0; 210 return (m_dwStatus & XFA_WIDGETSTATUS_TextEditValueChanged) != 0;
211 } 211 }
212 uint32_t CXFA_FFTextEdit::GetAlignment() { 212 uint32_t CXFA_FFTextEdit::GetAlignment() {
213 uint32_t dwExtendedStyle = 0; 213 uint32_t dwExtendedStyle = 0;
214 if (CXFA_Para para = m_pDataAcc->GetPara()) { 214 if (CXFA_Para para = m_pDataAcc->GetPara()) {
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText); 414 OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText);
415 break; 415 break;
416 } 416 }
417 case FWL_EVTHASH_EDT_TextFull: { 417 case FWL_EVTHASH_EDT_TextFull: {
418 OnTextFull(m_pNormalWidget->GetWidget()); 418 OnTextFull(m_pNormalWidget->GetWidget());
419 break; 419 break;
420 } 420 }
421 case FWL_EVTHASH_EDT_CheckWord: { 421 case FWL_EVTHASH_EDT_CheckWord: {
422 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); 422 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
423 CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent; 423 CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent;
424 event->bCheckWord = CheckWord(event->bsWord.AsByteStringC()); 424 event->bCheckWord = CheckWord(event->bsWord.AsStringC());
425 break; 425 break;
426 } 426 }
427 case FWL_EVTHASH_EDT_GetSuggestWords: { 427 case FWL_EVTHASH_EDT_GetSuggestWords: {
428 CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent; 428 CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent;
429 event->bSuggestWords = GetSuggestWords(event->bsWord.AsByteStringC(), 429 event->bSuggestWords = GetSuggestWords(event->bsWord.AsStringC(),
430 event->bsArraySuggestWords); 430 event->bsArraySuggestWords);
431 break; 431 break;
432 } 432 }
433 default: {} 433 default: {}
434 } 434 }
435 return m_pOldDelegate->OnProcessEvent(pEvent); 435 return m_pOldDelegate->OnProcessEvent(pEvent);
436 } 436 }
437 FWL_ERR CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics, 437 FWL_ERR CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics,
438 const CFX_Matrix* pMatrix) { 438 const CFX_Matrix* pMatrix) {
439 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); 439 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 pWidget->Initialize(); 587 pWidget->Initialize();
588 m_pNormalWidget = (CFWL_Widget*)pWidget; 588 m_pNormalWidget = (CFWL_Widget*)pWidget;
589 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 589 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
590 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL); 590 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL);
591 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 591 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
592 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 592 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
593 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 593 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
594 m_pNormalWidget->LockUpdate(); 594 m_pNormalWidget->LockUpdate();
595 CFX_WideString wsText; 595 CFX_WideString wsText;
596 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 596 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
597 pWidget->SetEditText(wsText.AsWideStringC()); 597 pWidget->SetEditText(wsText.AsStringC());
598 if (CXFA_Value value = m_pDataAcc->GetFormValue()) { 598 if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
599 switch (value.GetChildValueClassID()) { 599 switch (value.GetChildValueClassID()) {
600 case XFA_ELEMENT_Date: { 600 case XFA_ELEMENT_Date: {
601 if (!wsText.IsEmpty()) { 601 if (!wsText.IsEmpty()) {
602 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); 602 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
603 CFX_Unitime date = lcValue.GetDate(); 603 CFX_Unitime date = lcValue.GetDate();
604 if ((FX_UNITIME)date != 0) { 604 if ((FX_UNITIME)date != 0) {
605 pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); 605 pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
606 } 606 }
607 } 607 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() { 687 FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() {
688 if (!m_pNormalWidget) { 688 if (!m_pNormalWidget) {
689 return FALSE; 689 return FALSE;
690 } 690 }
691 XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display; 691 XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
692 if (IsFocused()) { 692 if (IsFocused()) {
693 eType = XFA_VALUEPICTURE_Edit; 693 eType = XFA_VALUEPICTURE_Edit;
694 } 694 }
695 CFX_WideString wsText; 695 CFX_WideString wsText;
696 m_pDataAcc->GetValue(wsText, eType); 696 m_pDataAcc->GetValue(wsText, eType);
697 ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC()); 697 ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText.AsStringC());
698 if (IsFocused() && !wsText.IsEmpty()) { 698 if (IsFocused() && !wsText.IsEmpty()) {
699 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); 699 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
700 CFX_Unitime date = lcValue.GetDate(); 700 CFX_Unitime date = lcValue.GetDate();
701 if (lcValue.IsValid()) { 701 if (lcValue.IsValid()) {
702 if ((FX_UNITIME)date != 0) { 702 if ((FX_UNITIME)date != 0) {
703 ((CFWL_DateTimePicker*)m_pNormalWidget) 703 ((CFWL_DateTimePicker*)m_pNormalWidget)
704 ->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); 704 ->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
705 } 705 }
706 } 706 }
707 } 707 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 CFX_WideString wsPicture; 770 CFX_WideString wsPicture;
771 m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit); 771 m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
772 CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr()); 772 CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr());
773 CFX_Unitime dt; 773 CFX_Unitime dt;
774 dt.Set(iYear, iMonth, iDay); 774 dt.Set(iYear, iMonth, iDay);
775 date.SetDate(dt); 775 date.SetDate(dt);
776 CFX_WideString wsDate; 776 CFX_WideString wsDate;
777 date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), 777 date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
778 XFA_VALUEPICTURE_Edit); 778 XFA_VALUEPICTURE_Edit);
779 CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget; 779 CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget;
780 pDateTime->SetEditText(wsDate.AsWideStringC()); 780 pDateTime->SetEditText(wsDate.AsStringC());
781 pDateTime->Update(); 781 pDateTime->Update();
782 GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL); 782 GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL);
783 CXFA_EventParam eParam; 783 CXFA_EventParam eParam;
784 eParam.m_eType = XFA_EVENT_Change; 784 eParam.m_eType = XFA_EVENT_Change;
785 eParam.m_pTarget = m_pDataAcc; 785 eParam.m_pTarget = m_pDataAcc;
786 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); 786 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw);
787 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); 787 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
788 } 788 }
789 FWL_ERR CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { 789 FWL_ERR CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
790 uint32_t dwEventID = pEvent->GetClassID(); 790 uint32_t dwEventID = pEvent->GetClassID();
791 if (dwEventID == FWL_EVTHASH_DTP_SelectChanged) { 791 if (dwEventID == FWL_EVTHASH_DTP_SelectChanged) {
792 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; 792 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent;
793 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, 793 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth,
794 event->iDay); 794 event->iDay);
795 return TRUE; 795 return TRUE;
796 } else { 796 } else {
797 return CXFA_FFTextEdit::OnProcessEvent(pEvent); 797 return CXFA_FFTextEdit::OnProcessEvent(pEvent);
798 } 798 }
799 } 799 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffpageview.cpp ('k') | xfa/fxfa/app/xfa_ffwidget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698