OLD | NEW |
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); | 380 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Change, &eParam); |
381 } | 381 } |
382 void CXFA_FFTextEdit::OnTextFull(IFWL_Widget* pWidget) { | 382 void CXFA_FFTextEdit::OnTextFull(IFWL_Widget* pWidget) { |
383 CXFA_EventParam eParam; | 383 CXFA_EventParam eParam; |
384 eParam.m_eType = XFA_EVENT_Full; | 384 eParam.m_eType = XFA_EVENT_Full; |
385 eParam.m_pTarget = m_pDataAcc; | 385 eParam.m_pTarget = m_pDataAcc; |
386 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam); | 386 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam); |
387 } | 387 } |
388 | 388 |
389 FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { | 389 FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { |
390 if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) { | 390 if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) |
391 return TRUE; | 391 return TRUE; |
392 } | 392 return FALSE; |
393 return GetDoc()->GetDocProvider()->CheckWord(GetDoc(), sWord); | |
394 } | |
395 FX_BOOL CXFA_FFTextEdit::GetSuggestWords( | |
396 const CFX_ByteStringC& sWord, | |
397 std::vector<CFX_ByteString>& sSuggest) { | |
398 if (m_pDataAcc->GetUIType() != XFA_Element::TextEdit) { | |
399 return FALSE; | |
400 } | |
401 return GetDoc()->GetDocProvider()->GetSuggestWords(GetDoc(), sWord, sSuggest); | |
402 } | 393 } |
403 | 394 |
404 void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { | 395 void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { |
405 m_pOldDelegate->OnProcessMessage(pMessage); | 396 m_pOldDelegate->OnProcessMessage(pMessage); |
406 } | 397 } |
407 | 398 |
408 void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { | 399 void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { |
409 CXFA_FFField::OnProcessEvent(pEvent); | 400 CXFA_FFField::OnProcessEvent(pEvent); |
410 switch (pEvent->GetClassID()) { | 401 switch (pEvent->GetClassID()) { |
411 case CFWL_EventType::TextChanged: { | 402 case CFWL_EventType::TextChanged: { |
412 CFWL_EvtEdtTextChanged* event = (CFWL_EvtEdtTextChanged*)pEvent; | 403 CFWL_EvtEdtTextChanged* event = (CFWL_EvtEdtTextChanged*)pEvent; |
413 CFX_WideString wsChange; | 404 CFX_WideString wsChange; |
414 OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText); | 405 OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText); |
415 break; | 406 break; |
416 } | 407 } |
417 case CFWL_EventType::TextFull: { | 408 case CFWL_EventType::TextFull: { |
418 OnTextFull(m_pNormalWidget->GetWidget()); | 409 OnTextFull(m_pNormalWidget->GetWidget()); |
419 break; | 410 break; |
420 } | 411 } |
421 case CFWL_EventType::CheckWord: { | 412 case CFWL_EventType::CheckWord: { |
422 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); | 413 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); |
423 CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent; | 414 CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent; |
424 event->bCheckWord = CheckWord(event->bsWord.AsStringC()); | 415 event->bCheckWord = CheckWord(event->bsWord.AsStringC()); |
425 break; | 416 break; |
426 } | 417 } |
427 case CFWL_EventType::GetSuggestedWords: { | 418 case CFWL_EventType::GetSuggestedWords: { |
428 CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent; | 419 CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent; |
429 event->bSuggestWords = GetSuggestWords(event->bsWord.AsStringC(), | 420 event->bSuggestWords = FALSE; |
430 event->bsArraySuggestWords); | |
431 break; | 421 break; |
432 } | 422 } |
433 default: | 423 default: |
434 break; | 424 break; |
435 } | 425 } |
436 m_pOldDelegate->OnProcessEvent(pEvent); | 426 m_pOldDelegate->OnProcessEvent(pEvent); |
437 } | 427 } |
438 | 428 |
439 void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics, | 429 void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics, |
440 const CFX_Matrix* pMatrix) { | 430 const CFX_Matrix* pMatrix) { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 | 782 |
793 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { | 783 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { |
794 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { | 784 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { |
795 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; | 785 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; |
796 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, | 786 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, |
797 event->iDay); | 787 event->iDay); |
798 return; | 788 return; |
799 } | 789 } |
800 CXFA_FFTextEdit::OnProcessEvent(pEvent); | 790 CXFA_FFTextEdit::OnProcessEvent(pEvent); |
801 } | 791 } |
OLD | NEW |