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 |
11 #include "xfa/fwl/core/cfwl_datetimepicker.h" | 11 #include "xfa/fwl/core/cfwl_datetimepicker.h" |
12 #include "xfa/fwl/core/cfwl_edit.h" | 12 #include "xfa/fwl/core/cfwl_edit.h" |
| 13 #include "xfa/fwl/core/cfwl_evtcheckword.h" |
| 14 #include "xfa/fwl/core/cfwl_evttextchanged.h" |
| 15 #include "xfa/fwl/core/cfwl_evtvalidate.h" |
13 #include "xfa/fwl/core/cfwl_msgkillfocus.h" | 16 #include "xfa/fwl/core/cfwl_msgkillfocus.h" |
14 #include "xfa/fwl/core/cfwl_msgmouse.h" | 17 #include "xfa/fwl/core/cfwl_msgmouse.h" |
15 #include "xfa/fwl/core/cfwl_msgsetfocus.h" | 18 #include "xfa/fwl/core/cfwl_msgsetfocus.h" |
16 #include "xfa/fwl/core/fwl_noteimp.h" | 19 #include "xfa/fwl/core/fwl_noteimp.h" |
17 #include "xfa/fwl/core/ifwl_edit.h" | |
18 #include "xfa/fxfa/app/xfa_fffield.h" | 20 #include "xfa/fxfa/app/xfa_fffield.h" |
19 #include "xfa/fxfa/app/xfa_fwladapter.h" | 21 #include "xfa/fxfa/app/xfa_fwladapter.h" |
20 #include "xfa/fxfa/app/xfa_textlayout.h" | 22 #include "xfa/fxfa/app/xfa_textlayout.h" |
21 #include "xfa/fxfa/cxfa_eventparam.h" | 23 #include "xfa/fxfa/cxfa_eventparam.h" |
22 #include "xfa/fxfa/parser/xfa_localevalue.h" | 24 #include "xfa/fxfa/parser/xfa_localevalue.h" |
23 #include "xfa/fxfa/xfa_ffapp.h" | 25 #include "xfa/fxfa/xfa_ffapp.h" |
24 #include "xfa/fxfa/xfa_ffdoc.h" | 26 #include "xfa/fxfa/xfa_ffdoc.h" |
25 #include "xfa/fxfa/xfa_ffdocview.h" | 27 #include "xfa/fxfa/xfa_ffdocview.h" |
26 #include "xfa/fxfa/xfa_ffpageview.h" | 28 #include "xfa/fxfa/xfa_ffpageview.h" |
27 #include "xfa/fxfa/xfa_ffwidget.h" | 29 #include "xfa/fxfa/xfa_ffwidget.h" |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 } | 333 } |
332 | 334 |
333 void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { | 335 void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { |
334 m_pOldDelegate->OnProcessMessage(pMessage); | 336 m_pOldDelegate->OnProcessMessage(pMessage); |
335 } | 337 } |
336 | 338 |
337 void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { | 339 void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { |
338 CXFA_FFField::OnProcessEvent(pEvent); | 340 CXFA_FFField::OnProcessEvent(pEvent); |
339 switch (pEvent->GetClassID()) { | 341 switch (pEvent->GetClassID()) { |
340 case CFWL_EventType::TextChanged: { | 342 case CFWL_EventType::TextChanged: { |
341 CFWL_EvtEdtTextChanged* event = (CFWL_EvtEdtTextChanged*)pEvent; | 343 CFWL_EvtTextChanged* event = static_cast<CFWL_EvtTextChanged*>(pEvent); |
342 CFX_WideString wsChange; | 344 CFX_WideString wsChange; |
343 OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText); | 345 OnTextChanged(m_pNormalWidget->GetWidget(), wsChange, event->wsPrevText); |
344 break; | 346 break; |
345 } | 347 } |
346 case CFWL_EventType::TextFull: { | 348 case CFWL_EventType::TextFull: { |
347 OnTextFull(m_pNormalWidget->GetWidget()); | 349 OnTextFull(m_pNormalWidget->GetWidget()); |
348 break; | 350 break; |
349 } | 351 } |
350 case CFWL_EventType::CheckWord: { | 352 case CFWL_EventType::CheckWord: { |
351 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); | 353 CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged"); |
352 CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent; | 354 CFWL_EvtCheckWord* event = static_cast<CFWL_EvtCheckWord*>(pEvent); |
353 event->bCheckWord = CheckWord(event->bsWord.AsStringC()); | 355 event->bCheckWord = CheckWord(event->bsWord.AsStringC()); |
354 break; | 356 break; |
355 } | 357 } |
356 default: | 358 default: |
357 break; | 359 break; |
358 } | 360 } |
359 m_pOldDelegate->OnProcessEvent(pEvent); | 361 m_pOldDelegate->OnProcessEvent(pEvent); |
360 } | 362 } |
361 | 363 |
362 void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics, | 364 void CXFA_FFTextEdit::OnDrawWidget(CFX_Graphics* pGraphics, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 dwExtendedStyle |= GetAlignment(); | 412 dwExtendedStyle |= GetAlignment(); |
411 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || | 413 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || |
412 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 414 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
413 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; | 415 dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; |
414 } | 416 } |
415 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); | 417 m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); |
416 } | 418 } |
417 | 419 |
418 void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { | 420 void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { |
419 if (pEvent->GetClassID() == CFWL_EventType::Validate) { | 421 if (pEvent->GetClassID() == CFWL_EventType::Validate) { |
420 CFWL_EvtEdtValidate* event = (CFWL_EvtEdtValidate*)pEvent; | 422 CFWL_EvtValidate* event = static_cast<CFWL_EvtValidate*>(pEvent); |
421 CFX_WideString wsChange = event->wsInsert; | 423 event->bValidate = |
422 event->bValidate = OnValidate(m_pNormalWidget->GetWidget(), wsChange); | 424 OnValidate(m_pNormalWidget->GetWidget(), event->wsInsert); |
423 return; | 425 return; |
424 } | 426 } |
425 CXFA_FFTextEdit::OnProcessEvent(pEvent); | 427 CXFA_FFTextEdit::OnProcessEvent(pEvent); |
426 } | 428 } |
427 | 429 |
428 bool CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget, | 430 bool CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget, |
429 CFX_WideString& wsText) { | 431 CFX_WideString& wsText) { |
430 CFX_WideString wsPattern; | 432 CFX_WideString wsPattern; |
431 m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit); | 433 m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit); |
432 if (!wsPattern.IsEmpty()) { | 434 if (!wsPattern.IsEmpty()) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 | 686 |
685 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { | 687 void CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { |
686 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { | 688 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { |
687 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; | 689 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; |
688 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, | 690 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, |
689 event->iDay); | 691 event->iDay); |
690 return; | 692 return; |
691 } | 693 } |
692 CXFA_FFTextEdit::OnProcessEvent(pEvent); | 694 CXFA_FFTextEdit::OnProcessEvent(pEvent); |
693 } | 695 } |
OLD | NEW |