summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-23 10:49:33 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-23 10:49:33 -0800
commit7c47e1d3172ce6f625b93be50aac2ebf86a45d0c (patch)
treebb7beae7637635cd0c631f015411a63fd2892486 /xfa
parent7172b71a005c181e9f103ac0e19f6675bf3bc8e8 (diff)
downloadpdfium-7c47e1d3172ce6f625b93be50aac2ebf86a45d0c.tar.xz
Remove DataProvider from CFWL_WidgetPropertieschromium/2931chromium/2930
This CL removes the generic DataProvider code from CFWL_WidgetProperties and adds the specific providers to the two classes that require them. Review-Url: https://codereview.chromium.org/2527683002
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fwl/core/cfwl_barcode.cpp7
-rw-r--r--xfa/fwl/core/cfwl_checkbox.cpp7
-rw-r--r--xfa/fwl/core/cfwl_combobox.cpp2
-rw-r--r--xfa/fwl/core/cfwl_combobox.h2
-rw-r--r--xfa/fwl/core/cfwl_datetimepicker.cpp2
-rw-r--r--xfa/fwl/core/cfwl_datetimepicker.h3
-rw-r--r--xfa/fwl/core/cfwl_listbox.cpp2
-rw-r--r--xfa/fwl/core/cfwl_listbox.h5
-rw-r--r--xfa/fwl/core/cfwl_picturebox.cpp2
-rw-r--r--xfa/fwl/core/cfwl_picturebox.h3
-rw-r--r--xfa/fwl/core/cfwl_pushbutton.cpp2
-rw-r--r--xfa/fwl/core/cfwl_pushbutton.h3
-rw-r--r--xfa/fwl/core/cfwl_widgetproperties.cpp5
-rw-r--r--xfa/fwl/core/cfwl_widgetproperties.h2
-rw-r--r--xfa/fwl/core/ifwl_barcode.cpp36
-rw-r--r--xfa/fwl/core/ifwl_barcode.h7
-rw-r--r--xfa/fwl/core/ifwl_checkbox.cpp16
-rw-r--r--xfa/fwl/core/ifwl_checkbox.h7
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp10
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.cpp2
-rw-r--r--xfa/fwl/core/ifwl_datetimepicker.h3
-rw-r--r--xfa/fwl/core/ifwl_picturebox.cpp3
-rw-r--r--xfa/fwl/core/ifwl_spinbutton.cpp7
-rw-r--r--xfa/fwl/core/ifwl_widget.cpp4
-rw-r--r--xfa/fwl/core/ifwl_widget.h3
25 files changed, 59 insertions, 86 deletions
diff --git a/xfa/fwl/core/cfwl_barcode.cpp b/xfa/fwl/core/cfwl_barcode.cpp
index 97249c92cf..49e417ea9c 100644
--- a/xfa/fwl/core/cfwl_barcode.cpp
+++ b/xfa/fwl/core/cfwl_barcode.cpp
@@ -7,6 +7,7 @@
#include "xfa/fwl/core/cfwl_barcode.h"
#include <memory>
+#include <utility>
#include "third_party/base/ptr_util.h"
@@ -26,8 +27,10 @@ CFWL_Barcode::~CFWL_Barcode() {}
void CFWL_Barcode::Initialize() {
ASSERT(!m_pIface);
- m_pIface = pdfium::MakeUnique<IFWL_Barcode>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
+ auto iface = pdfium::MakeUnique<IFWL_Barcode>(
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>());
+ iface->SetDataProvider(this);
+ m_pIface = std::move(iface);
CFWL_Widget::Initialize();
}
diff --git a/xfa/fwl/core/cfwl_checkbox.cpp b/xfa/fwl/core/cfwl_checkbox.cpp
index 0e757c326a..5053d2f934 100644
--- a/xfa/fwl/core/cfwl_checkbox.cpp
+++ b/xfa/fwl/core/cfwl_checkbox.cpp
@@ -7,6 +7,7 @@
#include "xfa/fwl/core/cfwl_checkbox.h"
#include <memory>
+#include <utility>
#include "third_party/base/ptr_util.h"
#include "xfa/fwl/core/fwl_error.h"
@@ -19,8 +20,10 @@ CFWL_CheckBox::~CFWL_CheckBox() {}
void CFWL_CheckBox::Initialize() {
ASSERT(!m_pIface);
- m_pIface = pdfium::MakeUnique<IFWL_CheckBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
+ auto iface = pdfium::MakeUnique<IFWL_CheckBox>(
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>());
+ iface->SetDataProvider(this);
+ m_pIface = std::move(iface);
CFWL_Widget::Initialize();
}
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp
index 7eb04b5118..532f49fdd2 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -29,7 +29,7 @@ void CFWL_ComboBox::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_ComboBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>());
CFWL_Widget::Initialize();
}
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h
index a670ef22cb..7b6f43419b 100644
--- a/xfa/fwl/core/cfwl_combobox.h
+++ b/xfa/fwl/core/cfwl_combobox.h
@@ -13,7 +13,7 @@
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/ifwl_combobox.h"
-class CFWL_ComboBox : public CFWL_Widget, public IFWL_Widget::DataProvider {
+class CFWL_ComboBox : public CFWL_Widget {
public:
explicit CFWL_ComboBox(const CFWL_App* pApp);
~CFWL_ComboBox() override;
diff --git a/xfa/fwl/core/cfwl_datetimepicker.cpp b/xfa/fwl/core/cfwl_datetimepicker.cpp
index a1d628d692..98aae94fc3 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/core/cfwl_datetimepicker.cpp
@@ -30,7 +30,7 @@ void CFWL_DateTimePicker::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_DateTimePicker>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>());
CFWL_Widget::Initialize();
}
diff --git a/xfa/fwl/core/cfwl_datetimepicker.h b/xfa/fwl/core/cfwl_datetimepicker.h
index 67d0ff1163..08e092e12a 100644
--- a/xfa/fwl/core/cfwl_datetimepicker.h
+++ b/xfa/fwl/core/cfwl_datetimepicker.h
@@ -10,8 +10,7 @@
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/ifwl_datetimepicker.h"
-class CFWL_DateTimePicker : public CFWL_Widget,
- public IFWL_Widget::DataProvider {
+class CFWL_DateTimePicker : public CFWL_Widget {
public:
explicit CFWL_DateTimePicker(const CFWL_App* pApp);
~CFWL_DateTimePicker() override;
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index bf7798978a..784bf24de8 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -29,7 +29,7 @@ void CFWL_ListBox::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_ListBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this), nullptr);
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), nullptr);
CFWL_Widget::Initialize();
}
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index 941cbfb408..36d13bd2ce 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -10,12 +10,11 @@
#include <memory>
#include <vector>
+#include "xfa/fwl/core/cfwl_listitem.h"
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/fwl_error.h"
-#include "xfa/fwl/core/ifwl_listbox.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBox::DataProvider {
+class CFWL_ListBox : public CFWL_Widget {
public:
explicit CFWL_ListBox(const CFWL_App* pApp);
~CFWL_ListBox() override;
diff --git a/xfa/fwl/core/cfwl_picturebox.cpp b/xfa/fwl/core/cfwl_picturebox.cpp
index c1a331a89f..af0cb86514 100644
--- a/xfa/fwl/core/cfwl_picturebox.cpp
+++ b/xfa/fwl/core/cfwl_picturebox.cpp
@@ -18,7 +18,7 @@ void CFWL_PictureBox::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_PictureBox>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>());
CFWL_Widget::Initialize();
}
diff --git a/xfa/fwl/core/cfwl_picturebox.h b/xfa/fwl/core/cfwl_picturebox.h
index e23a6ab2da..a7b3f1ff9d 100644
--- a/xfa/fwl/core/cfwl_picturebox.h
+++ b/xfa/fwl/core/cfwl_picturebox.h
@@ -9,9 +9,8 @@
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/ifwl_picturebox.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-class CFWL_PictureBox : public CFWL_Widget, public IFWL_Widget::DataProvider {
+class CFWL_PictureBox : public CFWL_Widget {
public:
explicit CFWL_PictureBox(const CFWL_App* pApp);
~CFWL_PictureBox() override;
diff --git a/xfa/fwl/core/cfwl_pushbutton.cpp b/xfa/fwl/core/cfwl_pushbutton.cpp
index 33c669822a..5fddff0c64 100644
--- a/xfa/fwl/core/cfwl_pushbutton.cpp
+++ b/xfa/fwl/core/cfwl_pushbutton.cpp
@@ -18,7 +18,7 @@ void CFWL_PushButton::Initialize() {
ASSERT(!m_pIface);
m_pIface = pdfium::MakeUnique<IFWL_PushButton>(
- m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>(this));
+ m_pApp, pdfium::MakeUnique<CFWL_WidgetProperties>());
CFWL_Widget::Initialize();
}
diff --git a/xfa/fwl/core/cfwl_pushbutton.h b/xfa/fwl/core/cfwl_pushbutton.h
index be8c5ebc43..66fa406fe9 100644
--- a/xfa/fwl/core/cfwl_pushbutton.h
+++ b/xfa/fwl/core/cfwl_pushbutton.h
@@ -9,9 +9,8 @@
#include "xfa/fwl/core/cfwl_widget.h"
#include "xfa/fwl/core/ifwl_pushbutton.h"
-#include "xfa/fwl/core/ifwl_widget.h"
-class CFWL_PushButton : public CFWL_Widget, public IFWL_Widget::DataProvider {
+class CFWL_PushButton : public CFWL_Widget {
public:
explicit CFWL_PushButton(const CFWL_App*);
~CFWL_PushButton() override;
diff --git a/xfa/fwl/core/cfwl_widgetproperties.cpp b/xfa/fwl/core/cfwl_widgetproperties.cpp
index 409b7f5211..6e0330012c 100644
--- a/xfa/fwl/core/cfwl_widgetproperties.cpp
+++ b/xfa/fwl/core/cfwl_widgetproperties.cpp
@@ -7,15 +7,10 @@
#include "xfa/fwl/core/cfwl_widgetproperties.h"
CFWL_WidgetProperties::CFWL_WidgetProperties()
- : CFWL_WidgetProperties(nullptr) {}
-
-CFWL_WidgetProperties::CFWL_WidgetProperties(
- IFWL_Widget::DataProvider* dataProvider)
: m_dwStyles(FWL_WGTSTYLE_Child),
m_dwStyleExes(0),
m_dwStates(0),
m_pThemeProvider(nullptr),
- m_pDataProvider(dataProvider),
m_pParent(nullptr),
m_pOwner(nullptr) {
m_rtWidget.Set(0, 0, 0, 0);
diff --git a/xfa/fwl/core/cfwl_widgetproperties.h b/xfa/fwl/core/cfwl_widgetproperties.h
index 5b2a602c6d..c8746f57d8 100644
--- a/xfa/fwl/core/cfwl_widgetproperties.h
+++ b/xfa/fwl/core/cfwl_widgetproperties.h
@@ -18,7 +18,6 @@ class IFWL_Widget;
class CFWL_WidgetProperties {
public:
CFWL_WidgetProperties();
- explicit CFWL_WidgetProperties(IFWL_Widget::DataProvider* dataProvider);
~CFWL_WidgetProperties();
CFX_RectF m_rtWidget;
@@ -26,7 +25,6 @@ class CFWL_WidgetProperties {
uint32_t m_dwStyleExes;
uint32_t m_dwStates;
IFWL_ThemeProvider* m_pThemeProvider;
- IFWL_Widget::DataProvider* m_pDataProvider;
IFWL_Widget* m_pParent;
IFWL_Widget* m_pOwner;
};
diff --git a/xfa/fwl/core/ifwl_barcode.cpp b/xfa/fwl/core/ifwl_barcode.cpp
index d5ab17f66b..b4cd13a6c1 100644
--- a/xfa/fwl/core/ifwl_barcode.cpp
+++ b/xfa/fwl/core/ifwl_barcode.cpp
@@ -66,10 +66,6 @@ void IFWL_Barcode::GenerateBarcodeImageCache() {
m_dwStatus = 0;
CreateBarcodeEngine();
- IFWL_Barcode::DataProvider* pData =
- static_cast<IFWL_Barcode::DataProvider*>(m_pProperties->m_pDataProvider);
- if (!pData)
- return;
if (!m_pBarcodeEngine)
return;
@@ -98,33 +94,35 @@ void IFWL_Barcode::GenerateBarcodeImageCache() {
m_pBarcodeEngine->SetHeight(int32_t(GetRTClient().height));
m_pBarcodeEngine->SetWidth(int32_t(GetRTClient().width));
- uint32_t dwAttributeMask = pData->GetBarcodeAttributeMask();
+ uint32_t dwAttributeMask = m_pDataProvider->GetBarcodeAttributeMask();
if (dwAttributeMask & FWL_BCDATTRIBUTE_CHARENCODING)
- m_pBarcodeEngine->SetCharEncoding(pData->GetCharEncoding());
+ m_pBarcodeEngine->SetCharEncoding(m_pDataProvider->GetCharEncoding());
if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEHEIGHT)
- m_pBarcodeEngine->SetModuleHeight(pData->GetModuleHeight());
+ m_pBarcodeEngine->SetModuleHeight(m_pDataProvider->GetModuleHeight());
if (dwAttributeMask & FWL_BCDATTRIBUTE_MODULEWIDTH)
- m_pBarcodeEngine->SetModuleWidth(pData->GetModuleWidth());
+ m_pBarcodeEngine->SetModuleWidth(m_pDataProvider->GetModuleWidth());
if (dwAttributeMask & FWL_BCDATTRIBUTE_DATALENGTH)
- m_pBarcodeEngine->SetDataLength(pData->GetDataLength());
+ m_pBarcodeEngine->SetDataLength(m_pDataProvider->GetDataLength());
if (dwAttributeMask & FWL_BCDATTRIBUTE_CALCHECKSUM)
- m_pBarcodeEngine->SetCalChecksum(pData->GetCalChecksum());
+ m_pBarcodeEngine->SetCalChecksum(m_pDataProvider->GetCalChecksum());
if (dwAttributeMask & FWL_BCDATTRIBUTE_PRINTCHECKSUM)
- m_pBarcodeEngine->SetPrintChecksum(pData->GetPrintChecksum());
+ m_pBarcodeEngine->SetPrintChecksum(m_pDataProvider->GetPrintChecksum());
if (dwAttributeMask & FWL_BCDATTRIBUTE_TEXTLOCATION)
- m_pBarcodeEngine->SetTextLocation(pData->GetTextLocation());
+ m_pBarcodeEngine->SetTextLocation(m_pDataProvider->GetTextLocation());
if (dwAttributeMask & FWL_BCDATTRIBUTE_WIDENARROWRATIO)
- m_pBarcodeEngine->SetWideNarrowRatio(pData->GetWideNarrowRatio());
+ m_pBarcodeEngine->SetWideNarrowRatio(m_pDataProvider->GetWideNarrowRatio());
if (dwAttributeMask & FWL_BCDATTRIBUTE_STARTCHAR)
- m_pBarcodeEngine->SetStartChar(pData->GetStartChar());
+ m_pBarcodeEngine->SetStartChar(m_pDataProvider->GetStartChar());
if (dwAttributeMask & FWL_BCDATTRIBUTE_ENDCHAR)
- m_pBarcodeEngine->SetEndChar(pData->GetEndChar());
+ m_pBarcodeEngine->SetEndChar(m_pDataProvider->GetEndChar());
if (dwAttributeMask & FWL_BCDATTRIBUTE_VERSION)
- m_pBarcodeEngine->SetVersion(pData->GetVersion());
- if (dwAttributeMask & FWL_BCDATTRIBUTE_ECLEVEL)
- m_pBarcodeEngine->SetErrorCorrectionLevel(pData->GetErrorCorrectionLevel());
+ m_pBarcodeEngine->SetVersion(m_pDataProvider->GetVersion());
+ if (dwAttributeMask & FWL_BCDATTRIBUTE_ECLEVEL) {
+ m_pBarcodeEngine->SetErrorCorrectionLevel(
+ m_pDataProvider->GetErrorCorrectionLevel());
+ }
if (dwAttributeMask & FWL_BCDATTRIBUTE_TRUNCATED)
- m_pBarcodeEngine->SetTruncated(pData->GetTruncated());
+ m_pBarcodeEngine->SetTruncated(m_pDataProvider->GetTruncated());
int32_t errorCode = 0;
m_dwStatus = m_pBarcodeEngine->Encode(wsText.AsStringC(), true, errorCode)
diff --git a/xfa/fwl/core/ifwl_barcode.h b/xfa/fwl/core/ifwl_barcode.h
index 2a4c9d7fd2..7c6f346708 100644
--- a/xfa/fwl/core/ifwl_barcode.h
+++ b/xfa/fwl/core/ifwl_barcode.h
@@ -40,7 +40,7 @@ enum FWL_BCDAttribute {
class IFWL_Barcode : public IFWL_Edit {
public:
- class DataProvider : public IFWL_Widget::DataProvider {
+ class DataProvider {
public:
virtual BC_CHAR_ENCODING GetCharEncoding() const = 0;
virtual int32_t GetModuleHeight() const = 0;
@@ -75,11 +75,16 @@ class IFWL_Barcode : public IFWL_Edit {
void SetType(BC_TYPE type);
bool IsProtectedType() const;
+ void SetDataProvider(IFWL_Barcode::DataProvider* provider) {
+ m_pDataProvider = provider;
+ }
+
private:
void GenerateBarcodeImageCache();
void CreateBarcodeEngine();
std::unique_ptr<CFX_Barcode> m_pBarcodeEngine;
+ IFWL_Barcode::DataProvider* m_pDataProvider; // Not owned.
uint32_t m_dwStatus;
BC_TYPE m_type;
};
diff --git a/xfa/fwl/core/ifwl_checkbox.cpp b/xfa/fwl/core/ifwl_checkbox.cpp
index 5268aceee7..b33eaa6559 100644
--- a/xfa/fwl/core/ifwl_checkbox.cpp
+++ b/xfa/fwl/core/ifwl_checkbox.cpp
@@ -57,8 +57,6 @@ void IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
if (!m_pProperties->m_pThemeProvider)
return;
- if (!m_pProperties->m_pDataProvider)
- return;
CFX_SizeF sz = CalcTextSize(
L"Check box", m_pProperties->m_pThemeProvider,
@@ -66,9 +64,7 @@ void IFWL_CheckBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
rect.Set(0, 0, sz.x, sz.y);
rect.Inflate(kCaptionMargin, kCaptionMargin);
- IFWL_CheckBox::DataProvider* pData =
- static_cast<IFWL_CheckBox::DataProvider*>(m_pProperties->m_pDataProvider);
- FX_FLOAT fCheckBox = pData->GetBoxSize(this);
+ FX_FLOAT fCheckBox = m_pDataProvider->GetBoxSize(this);
rect.width += fCheckBox;
rect.height = std::max(rect.height, fCheckBox);
IFWL_Widget::GetWidgetRect(rect, true);
@@ -117,9 +113,6 @@ void IFWL_CheckBox::DrawWidget(CFX_Graphics* pGraphics,
param.m_rtPart = m_rtBox;
pTheme->DrawBackground(&param);
- if (!m_pProperties->m_pDataProvider)
- return;
-
CFWL_ThemeText textParam;
textParam.m_pWidget = this;
textParam.m_iPart = CFWL_Part::Caption;
@@ -157,15 +150,10 @@ void IFWL_CheckBox::Layout() {
FXSYS_round(m_pProperties->m_rtWidget.height);
GetClientRect(m_rtClient);
- if (!m_pProperties->m_pDataProvider)
- return;
-
FX_FLOAT fBoxTop = m_rtClient.top;
FX_FLOAT fClientBottom = m_rtClient.bottom();
- IFWL_CheckBox::DataProvider* pData =
- static_cast<IFWL_CheckBox::DataProvider*>(m_pProperties->m_pDataProvider);
- FX_FLOAT fCheckBox = pData->GetBoxSize(this);
+ FX_FLOAT fCheckBox = m_pDataProvider->GetBoxSize(this);
switch (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_VLayoutMask) {
case FWL_STYLEEXT_CKB_Top:
break;
diff --git a/xfa/fwl/core/ifwl_checkbox.h b/xfa/fwl/core/ifwl_checkbox.h
index 8d777fc0f5..3a5b83cb5b 100644
--- a/xfa/fwl/core/ifwl_checkbox.h
+++ b/xfa/fwl/core/ifwl_checkbox.h
@@ -50,7 +50,7 @@ class IFWL_Widget;
class IFWL_CheckBox : public IFWL_Widget {
public:
- class DataProvider : public IFWL_Widget::DataProvider {
+ class DataProvider {
public:
virtual FX_FLOAT GetBoxSize(IFWL_Widget* pWidget) = 0;
};
@@ -70,6 +70,10 @@ class IFWL_CheckBox : public IFWL_Widget {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) override;
+ void SetDataProvider(IFWL_CheckBox::DataProvider* pProvider) {
+ m_pDataProvider = pProvider;
+ }
+
private:
void SetCheckState(int32_t iCheck);
void Layout();
@@ -83,6 +87,7 @@ class IFWL_CheckBox : public IFWL_Widget {
void OnMouseLeave();
void OnKeyDown(CFWL_MsgKey* pMsg);
+ IFWL_CheckBox::DataProvider* m_pDataProvider; // Not owned.
CFX_RectF m_rtClient;
CFX_RectF m_rtBox;
CFX_RectF m_rtCaption;
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index 19d1c3f87f..7917b4eabf 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -50,14 +50,14 @@ IFWL_ComboBox::IFWL_ComboBox(const CFWL_App* app,
return;
}
- auto prop =
- pdfium::MakeUnique<CFWL_WidgetProperties>(m_pProperties->m_pDataProvider);
+ auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>();
prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
prop->m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_ListItemIconText)
prop->m_dwStyleExes |= FWL_STYLEEXT_LTB_Icon;
+ m_pListBox =
+ pdfium::MakeUnique<IFWL_ComboList>(m_pOwnerApp, std::move(prop), this);
- m_pListBox.reset(new IFWL_ComboList(m_pOwnerApp, std::move(prop), this));
if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
m_pEdit.reset(new IFWL_ComboEdit(
m_pOwnerApp, pdfium::MakeUnique<CFWL_WidgetProperties>(), this));
@@ -590,13 +590,11 @@ void IFWL_ComboBox::DisForm_InitComboList() {
if (m_pListBox)
return;
- auto prop =
- pdfium::MakeUnique<CFWL_WidgetProperties>(m_pProperties->m_pDataProvider);
+ auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>();
prop->m_pParent = this;
prop->m_dwStyles = FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
prop->m_dwStates = FWL_WGTSTATE_Invisible;
prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
-
m_pListBox =
pdfium::MakeUnique<IFWL_ComboList>(m_pOwnerApp, std::move(prop), this);
}
diff --git a/xfa/fwl/core/ifwl_datetimepicker.cpp b/xfa/fwl/core/ifwl_datetimepicker.cpp
index 1a7cf2c06c..f97e95579c 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.cpp
+++ b/xfa/fwl/core/ifwl_datetimepicker.cpp
@@ -41,7 +41,7 @@ IFWL_DateTimePicker::IFWL_DateTimePicker(
m_pProperties->m_dwStyleExes = FWL_STYLEEXT_DTP_ShortDateFormat;
- auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>(this);
+ auto monthProp = pdfium::MakeUnique<CFWL_WidgetProperties>();
monthProp->m_dwStyles = FWL_WGTSTYLE_Popup | FWL_WGTSTYLE_Border;
monthProp->m_dwStates = FWL_WGTSTATE_Invisible;
monthProp->m_pParent = this;
diff --git a/xfa/fwl/core/ifwl_datetimepicker.h b/xfa/fwl/core/ifwl_datetimepicker.h
index 3b0dc39b1d..7d73002d20 100644
--- a/xfa/fwl/core/ifwl_datetimepicker.h
+++ b/xfa/fwl/core/ifwl_datetimepicker.h
@@ -35,8 +35,7 @@
class IFWL_DateTimeEdit;
class IFWL_FormProxy;
-class IFWL_DateTimePicker : public IFWL_Widget,
- public IFWL_Widget::DataProvider {
+class IFWL_DateTimePicker : public IFWL_Widget {
public:
explicit IFWL_DateTimePicker(
const CFWL_App* app,
diff --git a/xfa/fwl/core/ifwl_picturebox.cpp b/xfa/fwl/core/ifwl_picturebox.cpp
index 3cffa52970..9a3fbf3067 100644
--- a/xfa/fwl/core/ifwl_picturebox.cpp
+++ b/xfa/fwl/core/ifwl_picturebox.cpp
@@ -35,8 +35,7 @@ void IFWL_PictureBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
}
rect.Set(0, 0, 0, 0);
- if (!m_pProperties->m_pDataProvider)
- return;
+
IFWL_Widget::GetWidgetRect(rect, true);
}
diff --git a/xfa/fwl/core/ifwl_spinbutton.cpp b/xfa/fwl/core/ifwl_spinbutton.cpp
index 39da43ec0d..d4b790afe9 100644
--- a/xfa/fwl/core/ifwl_spinbutton.cpp
+++ b/xfa/fwl/core/ifwl_spinbutton.cpp
@@ -221,8 +221,6 @@ void IFWL_SpinButton::OnLButtonDown(CFWL_MsgMouse* pMsg) {
m_bLButtonDwn = true;
SetGrab(true);
SetFocus(true);
- if (!m_pProperties->m_pDataProvider)
- return;
bool bUpPress =
(m_rtUpButton.Contains(pMsg->m_fx, pMsg->m_fy) && IsButtonEnabled(true));
@@ -274,8 +272,6 @@ void IFWL_SpinButton::OnLButtonUp(CFWL_MsgMouse* pMsg) {
}
void IFWL_SpinButton::OnMouseMove(CFWL_MsgMouse* pMsg) {
- if (!m_pProperties->m_pDataProvider)
- return;
if (m_bLButtonDwn)
return;
@@ -351,9 +347,6 @@ void IFWL_SpinButton::OnMouseLeave(CFWL_MsgMouse* pMsg) {
}
void IFWL_SpinButton::OnKeyDown(CFWL_MsgKey* pMsg) {
- if (!m_pProperties->m_pDataProvider)
- return;
-
bool bUp =
pMsg->m_dwKeyCode == FWL_VKEY_Up || pMsg->m_dwKeyCode == FWL_VKEY_Left;
bool bDown =
diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp
index a44ad975cf..dca89c9c94 100644
--- a/xfa/fwl/core/ifwl_widget.cpp
+++ b/xfa/fwl/core/ifwl_widget.cpp
@@ -285,10 +285,6 @@ IFWL_ThemeProvider* IFWL_Widget::GetThemeProvider() const {
return m_pProperties->m_pThemeProvider;
}
-IFWL_Widget::DataProvider* IFWL_Widget::GetDataProvider() const {
- return m_pProperties->m_pDataProvider;
-}
-
void IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
m_pProperties->m_pThemeProvider = pThemeProvider;
}
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index 7d2faf00e9..056a0c861e 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -64,8 +64,6 @@ enum class FWL_Type;
class IFWL_Widget : public IFWL_WidgetDelegate {
public:
- class DataProvider {};
-
~IFWL_Widget() override;
virtual FWL_Type GetClassID() const = 0;
@@ -108,7 +106,6 @@ class IFWL_Widget : public IFWL_WidgetDelegate {
void TransformTo(IFWL_Widget* pWidget, FX_FLOAT& fx, FX_FLOAT& fy);
void GetMatrix(CFX_Matrix& matrix, bool bGlobal = false);
IFWL_ThemeProvider* GetThemeProvider() const;
- IFWL_Widget::DataProvider* GetDataProvider() const;
void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; }
IFWL_WidgetDelegate* GetDelegate() {