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

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

Issue 1943413002: Convert FWL_ERR into an enum class. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@bcdattribute
Patch Set: Created 4 years, 7 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_fftextedit.h ('k') | xfa/fxfa/app/xfa_fwladapter.h » ('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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 return ((CFWL_Edit*)m_pNormalWidget)->Paste(wsPaste); 325 return ((CFWL_Edit*)m_pNormalWidget)->Paste(wsPaste);
326 } 326 }
327 FX_BOOL CXFA_FFTextEdit::SelectAll() { 327 FX_BOOL CXFA_FFTextEdit::SelectAll() {
328 int32_t nCount = ((CFWL_Edit*)m_pNormalWidget)->GetTextLength(); 328 int32_t nCount = ((CFWL_Edit*)m_pNormalWidget)->GetTextLength();
329 return ((CFWL_Edit*)m_pNormalWidget)->AddSelRange(0, nCount); 329 return ((CFWL_Edit*)m_pNormalWidget)->AddSelRange(0, nCount);
330 } 330 }
331 FX_BOOL CXFA_FFTextEdit::Delete() { 331 FX_BOOL CXFA_FFTextEdit::Delete() {
332 return ((CFWL_Edit*)m_pNormalWidget)->Delete(); 332 return ((CFWL_Edit*)m_pNormalWidget)->Delete();
333 } 333 }
334 FX_BOOL CXFA_FFTextEdit::DeSelect() { 334 FX_BOOL CXFA_FFTextEdit::DeSelect() {
335 return ((CFWL_Edit*)m_pNormalWidget)->ClearSelections(); 335 return ((CFWL_Edit*)m_pNormalWidget)->ClearSelections() ==
336 FWL_Error::Succeeded;
336 } 337 }
337 FX_BOOL CXFA_FFTextEdit::GetSuggestWords( 338 FX_BOOL CXFA_FFTextEdit::GetSuggestWords(
338 CFX_PointF pointf, 339 CFX_PointF pointf,
339 std::vector<CFX_ByteString>& sSuggest) { 340 std::vector<CFX_ByteString>& sSuggest) {
340 if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) { 341 if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) {
341 return FALSE; 342 return FALSE;
342 } 343 }
343 FWLToClient(pointf.x, pointf.y); 344 FWLToClient(pointf.x, pointf.y);
344 return ((CFWL_Edit*)m_pNormalWidget)->GetSuggestWords(pointf, sSuggest); 345 return ((CFWL_Edit*)m_pNormalWidget)->GetSuggestWords(pointf, sSuggest);
345 } 346 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord); 394 return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord);
394 } 395 }
395 FX_BOOL CXFA_FFTextEdit::GetSuggestWords( 396 FX_BOOL CXFA_FFTextEdit::GetSuggestWords(
396 const CFX_ByteStringC& sWord, 397 const CFX_ByteStringC& sWord,
397 std::vector<CFX_ByteString>& sSuggest) { 398 std::vector<CFX_ByteString>& sSuggest) {
398 if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) { 399 if (m_pDataAcc->GetUIType() != XFA_ELEMENT_TextEdit) {
399 return FALSE; 400 return FALSE;
400 } 401 }
401 return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest); 402 return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest);
402 } 403 }
403 int32_t CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { 404
404 return m_pOldDelegate->OnProcessMessage(pMessage); 405 void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) {
406 m_pOldDelegate->OnProcessMessage(pMessage);
405 } 407 }
406 408
407 FWL_ERR CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { 409 void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) {
408 CXFA_FFField::OnProcessEvent(pEvent); 410 CXFA_FFField::OnProcessEvent(pEvent);
409 switch (pEvent->GetClassID()) { 411 switch (pEvent->GetClassID()) {
410 case CFWL_EventType::TextChanged: { 412 case CFWL_EventType::TextChanged: {
411 CFWL_EvtEdtTextChanged* event = (CFWL_EvtEdtTextChanged*)pEvent; 413 CFWL_EvtEdtTextChanged* event = (CFWL_EvtEdtTextChanged*)pEvent;
412 CFX_WideString wsChange; 414 CFX_WideString wsChange;
413 OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText); 415 OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText);
414 break; 416 break;
415 } 417 }
416 case CFWL_EventType::TextFull: { 418 case CFWL_EventType::TextFull: {
417 OnTextFull(m_pNormalWidget->GetWidget()); 419 OnTextFull(m_pNormalWidget->GetWidget());
418 break; 420 break;
419 } 421 }
420 case CFWL_EventType::CheckWord: { 422 case CFWL_EventType::CheckWord: {
421 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); 423 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
422 CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent; 424 CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent;
423 event->bCheckWord = CheckWord(event->bsWord.AsStringC()); 425 event->bCheckWord = CheckWord(event->bsWord.AsStringC());
424 break; 426 break;
425 } 427 }
426 case CFWL_EventType::GetSuggestedWords: { 428 case CFWL_EventType::GetSuggestedWords: {
427 CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent; 429 CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent;
428 event->bSuggestWords = GetSuggestWords(event->bsWord.AsStringC(), 430 event->bSuggestWords = GetSuggestWords(event->bsWord.AsStringC(),
429 event->bsArraySuggestWords); 431 event->bsArraySuggestWords);
430 break; 432 break;
431 } 433 }
432 default: 434 default:
433 break; 435 break;
434 } 436 }
435 return m_pOldDelegate->OnProcessEvent(pEvent); 437 m_pOldDelegate->OnProcessEvent(pEvent);
436 } 438 }
437 439
438 FWL_ERR CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics, 440 void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics,
439 const CFX_Matrix* pMatrix) { 441 const CFX_Matrix* pMatrix) {
440 return m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); 442 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix);
441 } 443 }
444
442 CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, 445 CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView,
443 CXFA_WidgetAcc* pDataAcc) 446 CXFA_WidgetAcc* pDataAcc)
444 : CXFA_FFTextEdit(pPageView, pDataAcc) {} 447 : CXFA_FFTextEdit(pPageView, pDataAcc) {}
445 CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {} 448 CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {}
446 FX_BOOL CXFA_FFNumericEdit::LoadWidget() { 449 FX_BOOL CXFA_FFNumericEdit::LoadWidget() {
447 CFWL_Edit* pWidget = CFWL_Edit::Create(); 450 CFWL_Edit* pWidget = CFWL_Edit::Create();
448 pWidget->Initialize(); 451 pWidget->Initialize();
449 m_pNormalWidget = (CFWL_Widget*)pWidget; 452 m_pNormalWidget = (CFWL_Widget*)pWidget;
450 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 453 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
451 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL); 454 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL);
(...skipping 27 matching lines...) Expand all
479 pWidget->SetLimit(iNumCells); 482 pWidget->SetLimit(iNumCells);
480 } 483 }
481 dwExtendedStyle |= GetAlignment(); 484 dwExtendedStyle |= GetAlignment();
482 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || 485 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open ||
483 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { 486 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) {
484 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; 487 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly;
485 } 488 }
486 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); 489 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF);
487 } 490 }
488 491
489 FWL_ERR CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { 492 void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) {
490 if (pEvent->GetClassID() == CFWL_EventType::Validate) { 493 if (pEvent->GetClassID() == CFWL_EventType::Validate) {
491 CFWL_EvtEdtValidate* event = (CFWL_EvtEdtValidate*)pEvent; 494 CFWL_EvtEdtValidate* event = (CFWL_EvtEdtValidate*)pEvent;
492 CFX_WideString wsChange = event->wsInsert; 495 CFX_WideString wsChange = event->wsInsert;
493 event->bValidate = OnValidate(m_pNormalWidget->GetWidget(), wsChange); 496 event->bValidate = OnValidate(m_pNormalWidget->GetWidget(), wsChange);
494 return event->bValidate; 497 return;
495 } 498 }
496 return CXFA_FFTextEdit::OnProcessEvent(pEvent); 499 CXFA_FFTextEdit::OnProcessEvent(pEvent);
497 } 500 }
498 501
499 FX_BOOL CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget, 502 FX_BOOL CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget,
500 CFX_WideString& wsText) { 503 CFX_WideString& wsText) {
501 CFX_WideString wsPattern; 504 CFX_WideString wsPattern;
502 m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit); 505 m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit);
503 if (!wsPattern.IsEmpty()) { 506 if (!wsPattern.IsEmpty()) {
504 return TRUE; 507 return TRUE;
505 } 508 }
506 int32_t iLeads = 0; 509 int32_t iLeads = 0;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 pDateTime->SetEditText(wsDate); 784 pDateTime->SetEditText(wsDate);
782 pDateTime->Update(); 785 pDateTime->Update();
783 GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL); 786 GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL);
784 CXFA_EventParam eParam; 787 CXFA_EventParam eParam;
785 eParam.m_eType = XFA_EVENT_Change; 788 eParam.m_eType = XFA_EVENT_Change;
786 eParam.m_pTarget = m_pDataAcc; 789 eParam.m_pTarget = m_pDataAcc;
787 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw); 790 m_pDataAcc->GetValue(eParam.m_wsNewText, XFA_VALUEPICTURE_Raw);
788 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); 791 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam);
789 } 792 }
790 793
791 FWL_ERR CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { 794 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
792 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { 795 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) {
793 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; 796 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent;
794 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, 797 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth,
795 event->iDay); 798 event->iDay);
796 return TRUE; 799 return;
797 } 800 }
798 return CXFA_FFTextEdit::OnProcessEvent(pEvent); 801 CXFA_FFTextEdit::OnProcessEvent(pEvent);
799 } 802 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_fftextedit.h ('k') | xfa/fxfa/app/xfa_fwladapter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698