summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/app/xfa_ffapp.cpp6
-rw-r--r--xfa/fxfa/app/xfa_ffbarcode.cpp8
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp9
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp18
-rw-r--r--xfa/fxfa/app/xfa_ffdoc.cpp3
-rw-r--r--xfa/fxfa/app/xfa_ffimageedit.cpp9
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp6
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp33
-rw-r--r--xfa/fxfa/app/xfa_ffwidget.cpp5
-rw-r--r--xfa/fxfa/xfa_ffapp.h3
-rw-r--r--xfa/fxfa/xfa_ffwidget.h2
11 files changed, 65 insertions, 37 deletions
diff --git a/xfa/fxfa/app/xfa_ffapp.cpp b/xfa/fxfa/app/xfa_ffapp.cpp
index 06cad02253..0924fb9e05 100644
--- a/xfa/fxfa/app/xfa_ffapp.cpp
+++ b/xfa/fxfa/app/xfa_ffapp.cpp
@@ -10,6 +10,7 @@
#include <utility>
#include "xfa/fgas/font/fgas_stdfontmgr.h"
+#include "xfa/fwl/core/fwl_noteimp.h"
#include "xfa/fwl/core/cfwl_widgetmgr.h"
#include "xfa/fxfa/app/xfa_fwladapter.h"
#include "xfa/fxfa/app/xfa_fwltheme.h"
@@ -73,7 +74,6 @@ CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider)
: m_pProvider(pProvider),
m_pWidgetMgrDelegate(nullptr),
m_pFWLApp(new IFWL_App(this)) {
- FWL_SetApp(m_pFWLApp.get());
CXFA_TimeZoneProvider::Create();
}
@@ -147,3 +147,7 @@ CXFA_FWLAdapterWidgetMgr* CXFA_FFApp::GetWidgetMgr(
IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() const {
return m_pProvider->GetTimerMgr();
}
+
+void CXFA_FFApp::ClearEventTargets() {
+ m_pFWLApp->GetNoteDriver()->ClearEventTargets(FALSE);
+}
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp
index 6a5478049b..e684d9c8b9 100644
--- a/xfa/fxfa/app/xfa_ffbarcode.cpp
+++ b/xfa/fxfa/app/xfa_ffbarcode.cpp
@@ -119,15 +119,17 @@ XFA_LPCBARCODETYPEENUMINFO XFA_GetBarcodeTypeByName(
CXFA_FFBarcode::CXFA_FFBarcode(CXFA_FFPageView* pPageView,
CXFA_WidgetAcc* pDataAcc)
: CXFA_FFTextEdit(pPageView, pDataAcc) {}
+
CXFA_FFBarcode::~CXFA_FFBarcode() {}
+
FX_BOOL CXFA_FFBarcode::LoadWidget() {
- CFWL_Barcode* pFWLBarcode = new CFWL_Barcode;
- pFWLBarcode->Initialize();
+ CFWL_Barcode* pFWLBarcode = new CFWL_Barcode(GetFWLApp());
+ pFWLBarcode->Initialize(nullptr);
m_pNormalWidget = pFWLBarcode;
m_pNormalWidget->SetLayoutItem(this);
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index cde99183d7..7756506975 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -23,14 +23,17 @@ CXFA_FFCheckButton::CXFA_FFCheckButton(CXFA_FFPageView* pPageView,
: CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {
m_rtCheckBox.Set(0, 0, 0, 0);
}
+
CXFA_FFCheckButton::~CXFA_FFCheckButton() {}
+
FX_BOOL CXFA_FFCheckButton::LoadWidget() {
- CFWL_CheckBox* pCheckBox = new CFWL_CheckBox;
- pCheckBox->Initialize();
+ CFWL_CheckBox* pCheckBox = new CFWL_CheckBox(GetFWLApp());
+ pCheckBox->Initialize(nullptr);
m_pNormalWidget = pCheckBox;
m_pNormalWidget->SetLayoutItem(this);
+
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
if (m_pDataAcc->IsRadioButton()) {
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 699f890d52..26efee94b1 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -22,22 +22,25 @@
CXFA_FFListBox::CXFA_FFListBox(CXFA_FFPageView* pPageView,
CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {}
+
CXFA_FFListBox::~CXFA_FFListBox() {
if (m_pNormalWidget) {
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->UnregisterEventTarget(pWidget);
}
}
+
FX_BOOL CXFA_FFListBox::LoadWidget() {
- CFWL_ListBox* pListBox = new CFWL_ListBox;
- pListBox->Initialize();
+ CFWL_ListBox* pListBox = new CFWL_ListBox(GetFWLApp());
+ pListBox->Initialize(nullptr);
pListBox->ModifyStyles(FWL_WGTSTYLE_VScroll | FWL_WGTSTYLE_NoBackground,
0xFFFFFFFF);
m_pNormalWidget = (CFWL_Widget*)pListBox;
m_pNormalWidget->SetLayoutItem(this);
+
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
@@ -227,12 +230,13 @@ FX_BOOL CXFA_FFComboBox::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
return FALSE;
}
FX_BOOL CXFA_FFComboBox::LoadWidget() {
- CFWL_ComboBox* pComboBox = new CFWL_ComboBox;
- pComboBox->Initialize();
+ CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp());
+ pComboBox->Initialize(nullptr);
m_pNormalWidget = (CFWL_Widget*)pComboBox;
m_pNormalWidget->SetLayoutItem(this);
+
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp
index 494091b2f9..cfb5e9fc47 100644
--- a/xfa/fxfa/app/xfa_ffdoc.cpp
+++ b/xfa/fxfa/app/xfa_ffdoc.cpp
@@ -359,8 +359,7 @@ FX_BOOL CXFA_FFDoc::CloseDoc() {
delete pair.second.pDibSource;
m_HashToDibDpiMap.clear();
-
- FWL_GetApp()->GetNoteDriver()->ClearEventTargets(FALSE);
+ m_pApp->ClearEventTargets();
return TRUE;
}
void CXFA_FFDoc::SetDocType(uint32_t dwType) {
diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp
index da56d3e052..e8dd6fde79 100644
--- a/xfa/fxfa/app/xfa_ffimageedit.cpp
+++ b/xfa/fxfa/app/xfa_ffimageedit.cpp
@@ -23,14 +23,13 @@ CXFA_FFImageEdit::~CXFA_FFImageEdit() {
CXFA_FFImageEdit::UnloadWidget();
}
FX_BOOL CXFA_FFImageEdit::LoadWidget() {
- CFWL_PictureBox* pPictureBox = new CFWL_PictureBox;
- if (pPictureBox) {
- pPictureBox->Initialize();
- }
+ CFWL_PictureBox* pPictureBox = new CFWL_PictureBox(GetFWLApp());
+ pPictureBox->Initialize(nullptr);
m_pNormalWidget = pPictureBox;
m_pNormalWidget->SetLayoutItem(this);
+
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
m_pOldDelegate = pPictureBox->SetDelegate(this);
CXFA_FFField::LoadWidget();
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index a7f0c46792..0b00a7b12b 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -52,14 +52,14 @@ void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS,
}
FX_BOOL CXFA_FFPushButton::LoadWidget() {
ASSERT(!m_pNormalWidget);
- CFWL_PushButton* pPushButton = new CFWL_PushButton;
- pPushButton->Initialize();
+ CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp());
+ pPushButton->Initialize(nullptr);
m_pOldDelegate = pPushButton->SetDelegate(this);
m_pNormalWidget = pPushButton;
m_pNormalWidget->SetLayoutItem(this);
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
m_pNormalWidget->LockUpdate();
UpdateWidgetProperty();
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index eb2a55898d..8bb6ea4c03 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -27,20 +27,23 @@
CXFA_FFTextEdit::CXFA_FFTextEdit(CXFA_FFPageView* pPageView,
CXFA_WidgetAcc* pDataAcc)
: CXFA_FFField(pPageView, pDataAcc), m_pOldDelegate(nullptr) {}
+
CXFA_FFTextEdit::~CXFA_FFTextEdit() {
if (m_pNormalWidget) {
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->UnregisterEventTarget(pWidget);
}
}
+
FX_BOOL CXFA_FFTextEdit::LoadWidget() {
- CFWL_Edit* pFWLEdit = new CFWL_Edit;
- pFWLEdit->Initialize();
+ CFWL_Edit* pFWLEdit = new CFWL_Edit(GetFWLApp());
+ pFWLEdit->Initialize(nullptr);
m_pNormalWidget = pFWLEdit;
m_pNormalWidget->SetLayoutItem(this);
+
IFWL_Widget* pWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pWidget, pWidget);
m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
@@ -436,12 +439,13 @@ CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView,
: CXFA_FFTextEdit(pPageView, pDataAcc) {}
CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {}
FX_BOOL CXFA_FFNumericEdit::LoadWidget() {
- CFWL_Edit* pWidget = new CFWL_Edit;
- pWidget->Initialize();
+ CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp());
+ pWidget->Initialize(nullptr);
m_pNormalWidget = pWidget;
+
IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
m_pNormalWidget->SetLayoutItem(this);
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
@@ -508,14 +512,17 @@ FX_BOOL CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget,
CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView,
CXFA_WidgetAcc* pDataAcc)
: CXFA_FFTextEdit(pPageView, pDataAcc) {}
+
CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {}
+
FX_BOOL CXFA_FFPasswordEdit::LoadWidget() {
- CFWL_Edit* pWidget = new CFWL_Edit;
- pWidget->Initialize();
+ CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp());
+ pWidget->Initialize(nullptr);
m_pNormalWidget = pWidget;
m_pNormalWidget->SetLayoutItem(this);
+
IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
@@ -576,12 +583,12 @@ FX_BOOL CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) {
return FALSE;
}
FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() {
- CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker;
- pWidget->Initialize();
+ CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp());
+ pWidget->Initialize(nullptr);
m_pNormalWidget = pWidget;
m_pNormalWidget->SetLayoutItem(this);
IFWL_Widget* pIWidget = m_pNormalWidget->GetWidget();
- CFWL_NoteDriver* pNoteDriver = FWL_GetApp()->GetNoteDriver();
+ CFWL_NoteDriver* pNoteDriver = pIWidget->GetOwnerApp()->GetNoteDriver();
pNoteDriver->RegisterEventTarget(pIWidget, pIWidget);
m_pOldDelegate = m_pNormalWidget->SetDelegate(this);
m_pNormalWidget->LockUpdate();
diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp
index c0c559aaf5..a21fbcab62 100644
--- a/xfa/fxfa/app/xfa_ffwidget.cpp
+++ b/xfa/fxfa/app/xfa_ffwidget.cpp
@@ -44,6 +44,11 @@ CXFA_FFPageView* CXFA_FFWidget::GetPageView() {
void CXFA_FFWidget::SetPageView(CXFA_FFPageView* pPageView) {
m_pPageView = pPageView;
}
+
+const IFWL_App* CXFA_FFWidget::GetFWLApp() {
+ return GetPageView()->GetDocView()->GetDoc()->GetApp()->GetFWLApp();
+}
+
void CXFA_FFWidget::GetWidgetRect(CFX_RectF& rtWidget) {
if ((m_dwStatus & XFA_WidgetStatus_RectCached) == 0) {
m_dwStatus |= XFA_WidgetStatus_RectCached;
diff --git a/xfa/fxfa/xfa_ffapp.h b/xfa/fxfa/xfa_ffapp.h
index 543d78c2ee..7d4893e827 100644
--- a/xfa/fxfa/xfa_ffapp.h
+++ b/xfa/fxfa/xfa_ffapp.h
@@ -56,12 +56,15 @@ class CXFA_FFApp {
CXFA_FWLTheme* GetFWLTheme();
IXFA_AppProvider* GetAppProvider() const { return m_pProvider; }
+ const IFWL_App* GetFWLApp() const { return m_pFWLApp.get(); }
IFWL_AdapterTimerMgr* GetTimerMgr() const;
CXFA_FontMgr* GetXFAFontMgr() const;
CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const {
return m_pWidgetMgrDelegate;
}
+ void ClearEventTargets();
+
protected:
std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler;
IXFA_AppProvider* const m_pProvider;
diff --git a/xfa/fxfa/xfa_ffwidget.h b/xfa/fxfa/xfa_ffwidget.h
index 1a09ad1fbd..c8c954d8b9 100644
--- a/xfa/fxfa/xfa_ffwidget.h
+++ b/xfa/fxfa/xfa_ffwidget.h
@@ -11,6 +11,7 @@
#include "core/fxcodec/fx_codec_def.h"
#include "core/fxge/cfx_graphstatedata.h"
+#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fxfa/fxfa.h"
#include "xfa/fxfa/parser/cxfa_contentlayoutitem.h"
@@ -123,6 +124,7 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem {
FX_BOOL IsLayoutRectEmpty();
CXFA_FFWidget* GetParent();
FX_BOOL IsAncestorOf(CXFA_FFWidget* pWidget);
+ const IFWL_App* GetFWLApp();
protected:
virtual FX_BOOL PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy);