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

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

Issue 1857073002: Make down-conversion explicit from CFX_Widetring to CFX_WideStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: String argument type 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, wsTitle, XFA_MBICON_Error, XFA_MB_OK); 204 pAppProvider->MsgBox(wsMessage.AsWideStringC(), wsTitle.AsWideStringC(),
205 XFA_MBICON_Error, XFA_MB_OK);
205 } 206 }
206 } 207 }
207 } 208 }
208 FX_BOOL CXFA_FFTextEdit::IsDataChanged() { 209 FX_BOOL CXFA_FFTextEdit::IsDataChanged() {
209 return (m_dwStatus & XFA_WIDGETSTATUS_TextEditValueChanged) != 0; 210 return (m_dwStatus & XFA_WIDGETSTATUS_TextEditValueChanged) != 0;
210 } 211 }
211 uint32_t CXFA_FFTextEdit::GetAlignment() { 212 uint32_t CXFA_FFTextEdit::GetAlignment() {
212 uint32_t dwExtendedStyle = 0; 213 uint32_t dwExtendedStyle = 0;
213 if (CXFA_Para para = m_pDataAcc->GetPara()) { 214 if (CXFA_Para para = m_pDataAcc->GetPara()) {
214 int32_t iHorz = para.GetHorizontalAlign(); 215 int32_t iHorz = para.GetHorizontalAlign();
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 pWidget->Initialize(); 587 pWidget->Initialize();
587 m_pNormalWidget = (CFWL_Widget*)pWidget; 588 m_pNormalWidget = (CFWL_Widget*)pWidget;
588 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 589 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
589 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL); 590 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL);
590 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 591 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
591 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 592 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
592 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 593 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
593 m_pNormalWidget->LockUpdate(); 594 m_pNormalWidget->LockUpdate();
594 CFX_WideString wsText; 595 CFX_WideString wsText;
595 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 596 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
596 pWidget->SetEditText(wsText); 597 pWidget->SetEditText(wsText.AsWideStringC());
597 if (CXFA_Value value = m_pDataAcc->GetFormValue()) { 598 if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
598 switch (value.GetChildValueClassID()) { 599 switch (value.GetChildValueClassID()) {
599 case XFA_ELEMENT_Date: { 600 case XFA_ELEMENT_Date: {
600 if (!wsText.IsEmpty()) { 601 if (!wsText.IsEmpty()) {
601 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); 602 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
602 CFX_Unitime date = lcValue.GetDate(); 603 CFX_Unitime date = lcValue.GetDate();
603 if ((FX_UNITIME)date != 0) { 604 if ((FX_UNITIME)date != 0) {
604 pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); 605 pWidget->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
605 } 606 }
606 } 607 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() { 687 FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() {
687 if (!m_pNormalWidget) { 688 if (!m_pNormalWidget) {
688 return FALSE; 689 return FALSE;
689 } 690 }
690 XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display; 691 XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display;
691 if (IsFocused()) { 692 if (IsFocused()) {
692 eType = XFA_VALUEPICTURE_Edit; 693 eType = XFA_VALUEPICTURE_Edit;
693 } 694 }
694 CFX_WideString wsText; 695 CFX_WideString wsText;
695 m_pDataAcc->GetValue(wsText, eType); 696 m_pDataAcc->GetValue(wsText, eType);
696 ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText); 697 ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC());
697 if (IsFocused() && !wsText.IsEmpty()) { 698 if (IsFocused() && !wsText.IsEmpty()) {
698 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); 699 CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc);
699 CFX_Unitime date = lcValue.GetDate(); 700 CFX_Unitime date = lcValue.GetDate();
700 if (lcValue.IsValid()) { 701 if (lcValue.IsValid()) {
701 if ((FX_UNITIME)date != 0) { 702 if ((FX_UNITIME)date != 0) {
702 ((CFWL_DateTimePicker*)m_pNormalWidget) 703 ((CFWL_DateTimePicker*)m_pNormalWidget)
703 ->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay()); 704 ->SetCurSel(date.GetYear(), date.GetMonth(), date.GetDay());
704 } 705 }
705 } 706 }
706 } 707 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 CFX_WideString wsPicture; 770 CFX_WideString wsPicture;
770 m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit); 771 m_pDataAcc->GetPictureContent(wsPicture, XFA_VALUEPICTURE_Edit);
771 CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr()); 772 CXFA_LocaleValue date(XFA_VT_DATE, GetDoc()->GetXFADoc()->GetLocalMgr());
772 CFX_Unitime dt; 773 CFX_Unitime dt;
773 dt.Set(iYear, iMonth, iDay); 774 dt.Set(iYear, iMonth, iDay);
774 date.SetDate(dt); 775 date.SetDate(dt);
775 CFX_WideString wsDate; 776 CFX_WideString wsDate;
776 date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), 777 date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(),
777 XFA_VALUEPICTURE_Edit); 778 XFA_VALUEPICTURE_Edit);
778 CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget; 779 CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget;
779 pDateTime->SetEditText(wsDate); 780 pDateTime->SetEditText(wsDate.AsWideStringC());
780 pDateTime->Update(); 781 pDateTime->Update();
781 GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL); 782 GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL);
782 CXFA_EventParam eParam; 783 CXFA_EventParam eParam;
783 eParam.m_eType = XFA_EVENT_Change; 784 eParam.m_eType = XFA_EVENT_Change;
784 eParam.m_pTarget = m_pDataAcc; 785 eParam.m_pTarget = m_pDataAcc;
785 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); 786 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw);
786 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); 787 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
787 } 788 }
788 FWL_ERR CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { 789 FWL_ERR CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
789 uint32_t dwEventID = pEvent->GetClassID(); 790 uint32_t dwEventID = pEvent->GetClassID();
790 if (dwEventID == FWL_EVTHASH_DTP_SelectChanged) { 791 if (dwEventID == FWL_EVTHASH_DTP_SelectChanged) {
791 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; 792 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent;
792 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, 793 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth,
793 event->iDay); 794 event->iDay);
794 return TRUE; 795 return TRUE;
795 } else { 796 } else {
796 return CXFA_FFTextEdit::OnProcessEvent(pEvent); 797 return CXFA_FFTextEdit::OnProcessEvent(pEvent);
797 } 798 }
798 } 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