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

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

Issue 1921853006: More FWL interface cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
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_ffpushbutton.cpp ('k') | xfa/fxfa/app/xfa_fwltheme.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
11 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" 11 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h"
12 #include "xfa/fwl/basewidget/ifwl_edit.h" 12 #include "xfa/fwl/basewidget/ifwl_edit.h"
13 #include "xfa/fwl/core/cfwl_message.h" 13 #include "xfa/fwl/core/cfwl_message.h"
14 #include "xfa/fwl/core/ifwl_notedriver.h" 14 #include "xfa/fwl/core/fwl_noteimp.h"
15 #include "xfa/fwl/lightwidget/cfwl_datetimepicker.h" 15 #include "xfa/fwl/lightwidget/cfwl_datetimepicker.h"
16 #include "xfa/fwl/lightwidget/cfwl_edit.h" 16 #include "xfa/fwl/lightwidget/cfwl_edit.h"
17 #include "xfa/fxfa/app/xfa_fffield.h" 17 #include "xfa/fxfa/app/xfa_fffield.h"
18 #include "xfa/fxfa/app/xfa_fwladapter.h" 18 #include "xfa/fxfa/app/xfa_fwladapter.h"
19 #include "xfa/fxfa/app/xfa_textlayout.h" 19 #include "xfa/fxfa/app/xfa_textlayout.h"
20 #include "xfa/fxfa/include/xfa_ffapp.h" 20 #include "xfa/fxfa/include/xfa_ffapp.h"
21 #include "xfa/fxfa/include/xfa_ffdoc.h" 21 #include "xfa/fxfa/include/xfa_ffdoc.h"
22 #include "xfa/fxfa/include/xfa_ffdocview.h" 22 #include "xfa/fxfa/include/xfa_ffdocview.h"
23 #include "xfa/fxfa/include/xfa_ffpageview.h" 23 #include "xfa/fxfa/include/xfa_ffpageview.h"
24 #include "xfa/fxfa/include/xfa_ffwidget.h" 24 #include "xfa/fxfa/include/xfa_ffwidget.h"
25 #include "xfa/fxfa/parser/xfa_localevalue.h" 25 #include "xfa/fxfa/parser/xfa_localevalue.h"
26 26
27 CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView, 27 CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView,
28 CXFA_WidgetAcc* pDataAcc) 28 CXFA_WidgetAcc* pDataAcc)
29 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) {} 29 : CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(NULL) {}
30 CXFA_FFTextEdit::~CXFA_FFTextEdit() { 30 CXFA_FFTextEdit::~CXFA_FFTextEdit() {
31 if (m_pNormalWidget) { 31 if (m_pNormalWidget) {
32 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 32 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
33 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 33 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
34 pNoteDriver->UnregisterEventTarget(pWidget); 34 pNoteDriver->UnregisterEventTarget(pWidget);
35 } 35 }
36 } 36 }
37 FX_BOOL CXFA_FFTextEdit::LoadWidget() { 37 FX_BOOL CXFA_FFTextEdit::LoadWidget() {
38 CFWL_Edit* pFWLEdit = CFWL_Edit::Create(); 38 CFWL_Edit* pFWLEdit = CFWL_Edit::Create();
39 pFWLEdit->Initialize(); 39 pFWLEdit->Initialize();
40 m_pNormalWidget = pFWLEdit; 40 m_pNormalWidget = pFWLEdit;
41 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget(); 41 IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
42 m_pNormalWidget->SetPrivateData(pWidget, this, NULL); 42 m_pNormalWidget->SetPrivateData(pWidget, this, NULL);
43 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 43 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
44 pNoteDriver->RegisterEventTarget(pWidget, pWidget); 44 pNoteDriver->RegisterEventTarget(pWidget, pWidget);
45 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 45 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
46 m_pNormalWidget->LockUpdate(); 46 m_pNormalWidget->LockUpdate();
47 UpdateWidgetProperty(); 47 UpdateWidgetProperty();
48 CFX_WideString wsText; 48 CFX_WideString wsText;
49 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 49 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
50 pFWLEdit->SetText(wsText); 50 pFWLEdit->SetText(wsText);
51 m_pNormalWidget->UnlockUpdate(); 51 m_pNormalWidget->UnlockUpdate();
52 return CXFA_FFField::LoadWidget(); 52 return CXFA_FFField::LoadWidget();
53 } 53 }
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, 442 CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView,
443 CXFA_WidgetAcc* pDataAcc) 443 CXFA_WidgetAcc* pDataAcc)
444 : CXFA_FFTextEdit(pPageView, pDataAcc) {} 444 : CXFA_FFTextEdit(pPageView, pDataAcc) {}
445 CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {} 445 CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {}
446 FX_BOOL CXFA_FFNumericEdit::LoadWidget() { 446 FX_BOOL CXFA_FFNumericEdit::LoadWidget() {
447 CFWL_Edit* pWidget = CFWL_Edit::Create(); 447 CFWL_Edit* pWidget = CFWL_Edit::Create();
448 pWidget->Initialize(); 448 pWidget->Initialize();
449 m_pNormalWidget = (CFWL_Widget*)pWidget; 449 m_pNormalWidget = (CFWL_Widget*)pWidget;
450 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 450 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
451 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL); 451 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL);
452 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 452 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
453 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 453 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
454 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 454 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
455 m_pNormalWidget->LockUpdate(); 455 m_pNormalWidget->LockUpdate();
456 CFX_WideString wsText; 456 CFX_WideString wsText;
457 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 457 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
458 pWidget->SetText(wsText); 458 pWidget->SetText(wsText);
459 UpdateWidgetProperty(); 459 UpdateWidgetProperty();
460 m_pNormalWidget->UnlockUpdate(); 460 m_pNormalWidget->UnlockUpdate();
461 return CXFA_FFField::LoadWidget(); 461 return CXFA_FFField::LoadWidget();
462 } 462 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, 516 CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView,
517 CXFA_WidgetAcc* pDataAcc) 517 CXFA_WidgetAcc* pDataAcc)
518 : CXFA_FFTextEdit(pPageView, pDataAcc) {} 518 : CXFA_FFTextEdit(pPageView, pDataAcc) {}
519 CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {} 519 CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {}
520 FX_BOOL CXFA_FFPasswordEdit::LoadWidget() { 520 FX_BOOL CXFA_FFPasswordEdit::LoadWidget() {
521 CFWL_Edit* pWidget = CFWL_Edit::Create(); 521 CFWL_Edit* pWidget = CFWL_Edit::Create();
522 pWidget->Initialize(); 522 pWidget->Initialize();
523 m_pNormalWidget = (CFWL_Widget*)pWidget; 523 m_pNormalWidget = (CFWL_Widget*)pWidget;
524 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 524 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
525 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL); 525 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL);
526 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 526 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
527 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 527 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
528 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 528 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
529 m_pNormalWidget->LockUpdate(); 529 m_pNormalWidget->LockUpdate();
530 CFX_WideString wsText; 530 CFX_WideString wsText;
531 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 531 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
532 pWidget->SetText(wsText); 532 pWidget->SetText(wsText);
533 UpdateWidgetProperty(); 533 UpdateWidgetProperty();
534 m_pNormalWidget->UnlockUpdate(); 534 m_pNormalWidget->UnlockUpdate();
535 return CXFA_FFField::LoadWidget(); 535 return CXFA_FFField::LoadWidget();
536 } 536 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 return TRUE; 582 return TRUE;
583 } 583 }
584 return FALSE; 584 return FALSE;
585 } 585 }
586 FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { 586 FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() {
587 CFWL_DateTimePicker* pWidget = CFWL_DateTimePicker::Create(); 587 CFWL_DateTimePicker* pWidget = CFWL_DateTimePicker::Create();
588 pWidget->Initialize(); 588 pWidget->Initialize();
589 m_pNormalWidget = (CFWL_Widget*)pWidget; 589 m_pNormalWidget = (CFWL_Widget*)pWidget;
590 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget(); 590 IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
591 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL); 591 m_pNormalWidget->SetPrivateData(pIWidget, this, NULL);
592 IFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver(); 592 CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
593 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget); 593 pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
594 m_pOldDelegate = m_pNormalWidget->SetDelegate(this); 594 m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
595 m_pNormalWidget->LockUpdate(); 595 m_pNormalWidget->LockUpdate();
596 CFX_WideString wsText; 596 CFX_WideString wsText;
597 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); 597 m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display);
598 pWidget->SetEditText(wsText); 598 pWidget->SetEditText(wsText);
599 if (CXFA_Value value = m_pDataAcc->GetFormValue()) { 599 if (CXFA_Value value = m_pDataAcc->GetFormValue()) {
600 switch (value.GetChildValueClassID()) { 600 switch (value.GetChildValueClassID()) {
601 case XFA_ELEMENT_Date: { 601 case XFA_ELEMENT_Date: {
602 if (!wsText.IsEmpty()) { 602 if (!wsText.IsEmpty()) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 790
791 FWL_ERR CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) { 791 FWL_ERR CXFA_FFDateTimeEdit::OnProcessEvent(CFWL_Event* pEvent) {
792 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) { 792 if (pEvent->GetClassID() == CFWL_EventType::SelectChanged) {
793 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent; 793 CFWL_Event_DtpSelectChanged* event = (CFWL_Event_DtpSelectChanged*)pEvent;
794 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth, 794 OnSelectChanged(m_pNormalWidget->GetWidget(), event->iYear, event->iMonth,
795 event->iDay); 795 event->iDay);
796 return TRUE; 796 return TRUE;
797 } 797 }
798 return CXFA_FFTextEdit::OnProcessEvent(pEvent); 798 return CXFA_FFTextEdit::OnProcessEvent(pEvent);
799 } 799 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffpushbutton.cpp ('k') | xfa/fxfa/app/xfa_fwltheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698