summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-11 18:09:57 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-11 18:09:57 -0800
commit27e66753c8bd6e664f26d05c1a468dc68be01913 (patch)
tree0006196c2e60225fb571946957f2e77646c6d6e2
parent6e1d6032b7990cdf580c99ff491a1b761ee39ca6 (diff)
downloadpdfium-chromium/2919.tar.xz
IFWL cleanup in the Combo classeschromium/2919chromium/2918
Cleanup visibility and unused methods in the IFWL combo code. Review-Url: https://codereview.chromium.org/2494743002
-rw-r--r--xfa/fwl/core/cfwl_combobox.cpp116
-rw-r--r--xfa/fwl/core/cfwl_combobox.h80
-rw-r--r--xfa/fwl/core/cfwl_listbox.cpp6
-rw-r--r--xfa/fwl/core/cfwl_listbox.h7
-rw-r--r--xfa/fwl/core/ifwl_combobox.cpp163
-rw-r--r--xfa/fwl/core/ifwl_combobox.h79
-rw-r--r--xfa/fwl/core/ifwl_comboboxproxy.cpp4
-rw-r--r--xfa/fwl/core/ifwl_comboboxproxy.h1
-rw-r--r--xfa/fwl/core/ifwl_comboedit.cpp12
-rw-r--r--xfa/fwl/core/ifwl_comboedit.h4
-rw-r--r--xfa/fwl/core/ifwl_combolist.h13
-rw-r--r--xfa/fwl/core/ifwl_listbox.h9
-rw-r--r--xfa/fwl/core/ifwl_widget.h4
13 files changed, 167 insertions, 331 deletions
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp
index 572f4bf949..d59cd4bd12 100644
--- a/xfa/fwl/core/cfwl_combobox.cpp
+++ b/xfa/fwl/core/cfwl_combobox.cpp
@@ -46,16 +46,6 @@ int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText) {
return m_ItemArray.size() - 1;
}
-int32_t CFWL_ComboBox::AddString(const CFX_WideStringC& wsText,
- CFX_DIBitmap* pIcon) {
- std::unique_ptr<CFWL_ListItem> pItem(new CFWL_ListItem);
- pItem->m_wsText = wsText;
- pItem->m_dwStyles = 0;
- pItem->m_pDIB = pIcon;
- m_ItemArray.push_back(std::move(pItem));
- return m_ItemArray.size() - 1;
-}
-
bool CFWL_ComboBox::RemoveAt(int32_t iIndex) {
if (iIndex < 0 || static_cast<size_t>(iIndex) >= m_ItemArray.size()) {
return false;
@@ -68,27 +58,21 @@ void CFWL_ComboBox::RemoveAll() {
m_ItemArray.clear();
}
-int32_t CFWL_ComboBox::CountItems() {
- return CountItems(GetWidget());
-}
-
-FWL_Error CFWL_ComboBox::GetTextByIndex(int32_t iIndex,
- CFX_WideString& wsText) {
+void CFWL_ComboBox::GetTextByIndex(int32_t iIndex,
+ CFX_WideString& wsText) const {
CFWL_ListItem* pItem =
static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iIndex));
- if (!pItem)
- return FWL_Error::Indefinite;
- wsText = pItem->m_wsText;
- return FWL_Error::Succeeded;
+ if (pItem)
+ wsText = pItem->m_wsText;
}
-int32_t CFWL_ComboBox::GetCurSel() {
+int32_t CFWL_ComboBox::GetCurSel() const {
return GetWidget() ? ToComboBox(GetWidget())->GetCurSel() : -1;
}
-FWL_Error CFWL_ComboBox::SetCurSel(int32_t iSel) {
- return GetWidget() ? ToComboBox(GetWidget())->SetCurSel(iSel)
- : FWL_Error::Indefinite;
+void CFWL_ComboBox::SetCurSel(int32_t iSel) {
+ if (GetWidget())
+ ToComboBox(GetWidget())->SetCurSel(iSel);
}
void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
@@ -96,75 +80,15 @@ void CFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
ToComboBox(GetWidget())->SetEditText(wsText);
}
-int32_t CFWL_ComboBox::GetEditTextLength() const {
- return GetWidget() ? ToComboBox(GetWidget())->GetEditTextLength() : 0;
-}
-
-FWL_Error CFWL_ComboBox::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
- return GetWidget()
- ? ToComboBox(GetWidget())->GetEditText(wsText, nStart, nCount)
- : FWL_Error::Indefinite;
-}
-
-FWL_Error CFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
- return GetWidget() ? ToComboBox(GetWidget())->SetEditSelRange(nStart, nCount)
- : FWL_Error::Indefinite;
-}
-
-int32_t CFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
- return GetWidget() ? ToComboBox(GetWidget())->GetEditSelRange(nIndex, nStart)
- : 0;
-}
-
-int32_t CFWL_ComboBox::GetEditLimit() {
- return GetWidget() ? ToComboBox(GetWidget())->GetEditLimit() : 0;
-}
-
-FWL_Error CFWL_ComboBox::SetEditLimit(int32_t nLimit) {
- return GetWidget() ? ToComboBox(GetWidget())->SetEditLimit(nLimit)
- : FWL_Error::Indefinite;
-}
-
-bool CFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) {
- return GetWidget() ? ToComboBox(GetWidget())->EditRedo(pRecord) : false;
-}
-
-bool CFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
- return GetWidget() ? ToComboBox(GetWidget())->EditUndo(pRecord) : false;
-}
-
-FWL_Error CFWL_ComboBox::SetMaxListHeight(FX_FLOAT fMaxHeight) {
- m_fMaxListHeight = fMaxHeight;
- return FWL_Error::Succeeded;
-}
-
-FWL_Error CFWL_ComboBox::SetItemData(int32_t iIndex, void* pData) {
- CFWL_ListItem* pItem =
- static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iIndex));
- if (!pItem)
- return FWL_Error::Indefinite;
- pItem->m_pData = pData;
- return FWL_Error::Succeeded;
-}
-
-void* CFWL_ComboBox::GetItemData(int32_t iIndex) {
- CFWL_ListItem* pItem =
- static_cast<CFWL_ListItem*>(GetItem(m_pIface.get(), iIndex));
- return pItem ? pItem->m_pData : nullptr;
-}
-
-void CFWL_ComboBox::SetListTheme(IFWL_ThemeProvider* pTheme) {
- ToComboBox(GetWidget())->GetListBoxt()->SetThemeProvider(pTheme);
-}
-
-bool CFWL_ComboBox::AfterFocusShowDropList() {
- return ToComboBox(GetWidget())->AfterFocusShowDropList();
+void CFWL_ComboBox::GetEditText(CFX_WideString& wsText,
+ int32_t nStart,
+ int32_t nCount) const {
+ if (GetWidget())
+ ToComboBox(GetWidget())->GetEditText(wsText, nStart, nCount);
}
-FWL_Error CFWL_ComboBox::OpenDropDownList(bool bActivate) {
- return ToComboBox(GetWidget())->OpenDropDownList(bActivate);
+void CFWL_ComboBox::OpenDropDownList(bool bActivate) {
+ ToComboBox(GetWidget())->OpenDropDownList(bActivate);
}
bool CFWL_ComboBox::EditCanUndo() {
@@ -219,9 +143,9 @@ bool CFWL_ComboBox::EditDeSelect() {
return GetWidget() ? ToComboBox(GetWidget())->EditDeSelect() : false;
}
-FWL_Error CFWL_ComboBox::GetBBox(CFX_RectF& rect) {
- return GetWidget() ? ToComboBox(GetWidget())->GetBBox(rect)
- : FWL_Error::Indefinite;
+void CFWL_ComboBox::GetBBox(CFX_RectF& rect) {
+ if (GetWidget())
+ ToComboBox(GetWidget())->GetBBox(rect);
}
void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
@@ -235,12 +159,12 @@ void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
void CFWL_ComboBox::GetCaption(IFWL_Widget* pWidget,
CFX_WideString& wsCaption) {}
-int32_t CFWL_ComboBox::CountItems(const IFWL_Widget* pWidget) {
+int32_t CFWL_ComboBox::CountItems(const IFWL_Widget* pWidget) const {
return m_ItemArray.size();
}
CFWL_ListItem* CFWL_ComboBox::GetItem(const IFWL_Widget* pWidget,
- int32_t nIndex) {
+ int32_t nIndex) const {
if (nIndex < 0 || static_cast<size_t>(nIndex) >= m_ItemArray.size())
return nullptr;
diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h
index 1b6f814722..9361bbf642 100644
--- a/xfa/fwl/core/cfwl_combobox.h
+++ b/xfa/fwl/core/cfwl_combobox.h
@@ -20,54 +20,13 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP {
void Initialize();
- int32_t AddString(const CFX_WideStringC& wsText);
- int32_t AddString(const CFX_WideStringC& wsText, CFX_DIBitmap* pIcon);
- bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range.
- void RemoveAll();
- int32_t CountItems();
- FWL_Error GetTextByIndex(int32_t iIndex, CFX_WideString& wsText);
- int32_t GetCurSel();
- FWL_Error SetCurSel(int32_t iSel);
- void SetEditText(const CFX_WideString& wsText);
- int32_t GetEditTextLength() const;
- FWL_Error GetEditText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
- FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1);
- int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart);
- int32_t GetEditLimit();
- FWL_Error SetEditLimit(int32_t nLimit);
- bool EditRedo(const IFDE_TxtEdtDoRecord* pRecord);
- bool EditUndo(const IFDE_TxtEdtDoRecord* pRecord);
- FWL_Error SetMaxListHeight(FX_FLOAT fMaxHeight);
- FWL_Error SetItemData(int32_t iIndex, void* pData);
- void* GetItemData(int32_t iIndex);
- void SetListTheme(IFWL_ThemeProvider* pTheme);
- bool AfterFocusShowDropList();
- FWL_Error OpenDropDownList(bool bActivate);
-
- bool EditCanUndo();
- bool EditCanRedo();
- bool EditUndo();
- bool EditRedo();
- bool EditCanCopy();
- bool EditCanCut();
- bool EditCanSelectAll();
- bool EditCopy(CFX_WideString& wsCopy);
- bool EditCut(CFX_WideString& wsCut);
- bool EditPaste(const CFX_WideString& wsPaste);
- bool EditSelectAll();
- bool EditDelete();
- bool EditDeSelect();
- FWL_Error GetBBox(CFX_RectF& rect);
- void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
-
// IFWL_DataProvider
void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_ListBoxDP
- int32_t CountItems(const IFWL_Widget* pWidget) override;
- CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
+ int32_t CountItems(const IFWL_Widget* pWidget) const override;
+ CFWL_ListItem* GetItem(const IFWL_Widget* pWidget,
+ int32_t nIndex) const override;
int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override;
bool SetItemIndex(IFWL_Widget* pWidget,
CFWL_ListItem* pItem,
@@ -108,6 +67,39 @@ class CFWL_ComboBox : public CFWL_Widget, public IFWL_ComboBoxDP {
// IFWL_ComboBoxDP
FX_FLOAT GetListHeight(IFWL_Widget* pWidget) override;
+ int32_t AddString(const CFX_WideStringC& wsText);
+
+ bool RemoveAt(int32_t iIndex); // Returns false iff |iIndex| out of range.
+ void RemoveAll();
+
+ void GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) const;
+ int32_t GetCurSel() const;
+ void SetCurSel(int32_t iSel);
+
+ void SetEditText(const CFX_WideString& wsText);
+ void GetEditText(CFX_WideString& wsText,
+ int32_t nStart = 0,
+ int32_t nCount = -1) const;
+
+ void OpenDropDownList(bool bActivate);
+
+ bool EditCanUndo();
+ bool EditCanRedo();
+ bool EditUndo();
+ bool EditRedo();
+ bool EditCanCopy();
+ bool EditCanCut();
+ bool EditCanSelectAll();
+ bool EditCopy(CFX_WideString& wsCopy);
+ bool EditCut(CFX_WideString& wsCut);
+ bool EditPaste(const CFX_WideString& wsPaste);
+ bool EditSelectAll();
+ bool EditDelete();
+ bool EditDeSelect();
+
+ void GetBBox(CFX_RectF& rect);
+ void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
+
private:
std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
FX_FLOAT m_fMaxListHeight;
diff --git a/xfa/fwl/core/cfwl_listbox.cpp b/xfa/fwl/core/cfwl_listbox.cpp
index 5827ac4b26..7dfff9e5d1 100644
--- a/xfa/fwl/core/cfwl_listbox.cpp
+++ b/xfa/fwl/core/cfwl_listbox.cpp
@@ -101,7 +101,7 @@ void CFWL_ListBox::GetScrollPos(FX_FLOAT& fPos, bool bVert) {
ToListBox(GetWidget())->GetScrollPos(fPos, bVert);
}
-int32_t CFWL_ListBox::CountItems() {
+int32_t CFWL_ListBox::CountItems() const {
return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
@@ -123,12 +123,12 @@ void CFWL_ListBox::GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) {
wsCaption = L"";
}
-int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) {
+int32_t CFWL_ListBox::CountItems(const IFWL_Widget* pWidget) const {
return pdfium::CollectionSize<int32_t>(m_ItemArray);
}
CFWL_ListItem* CFWL_ListBox::GetItem(const IFWL_Widget* pWidget,
- int32_t nIndex) {
+ int32_t nIndex) const {
if (nIndex < 0 || nIndex >= CountItems(pWidget))
return nullptr;
diff --git a/xfa/fwl/core/cfwl_listbox.h b/xfa/fwl/core/cfwl_listbox.h
index 0f1d35a21b..f8f3c586f4 100644
--- a/xfa/fwl/core/cfwl_listbox.h
+++ b/xfa/fwl/core/cfwl_listbox.h
@@ -26,8 +26,9 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP {
void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
// IFWL_ListBoxDP:
- int32_t CountItems(const IFWL_Widget* pWidget) override;
- CFWL_ListItem* GetItem(const IFWL_Widget* pWidget, int32_t nIndex) override;
+ int32_t CountItems(const IFWL_Widget* pWidget) const override;
+ CFWL_ListItem* GetItem(const IFWL_Widget* pWidget,
+ int32_t nIndex) const override;
int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) override;
bool SetItemIndex(IFWL_Widget* pWidget,
CFWL_ListItem* pItem,
@@ -81,7 +82,7 @@ class CFWL_ListBox : public CFWL_Widget, public IFWL_ListBoxDP {
uint32_t GetItemStates(CFWL_ListItem* pItem);
private:
- int32_t CountItems();
+ int32_t CountItems() const;
std::vector<std::unique_ptr<CFWL_ListItem>> m_ItemArray;
};
diff --git a/xfa/fwl/core/ifwl_combobox.cpp b/xfa/fwl/core/ifwl_combobox.cpp
index e8534a45f2..6299632e93 100644
--- a/xfa/fwl/core/ifwl_combobox.cpp
+++ b/xfa/fwl/core/ifwl_combobox.cpp
@@ -18,7 +18,6 @@
#include "xfa/fwl/core/ifwl_app.h"
#include "xfa/fwl/core/ifwl_comboboxproxy.h"
#include "xfa/fwl/core/ifwl_comboedit.h"
-#include "xfa/fwl/core/ifwl_combolist.h"
#include "xfa/fwl/core/ifwl_formproxy.h"
#include "xfa/fwl/core/ifwl_themeprovider.h"
@@ -29,8 +28,7 @@ IFWL_ComboBox::IFWL_ComboBox(const IFWL_App* app,
m_bLButtonDown(false),
m_iCurSel(-1),
m_iBtnState(CFWL_PartState_Normal),
- m_fComboFormHandler(0),
- m_bNeedShowList(false) {
+ m_fComboFormHandler(0) {
m_rtClient.Reset();
m_rtBtn.Reset();
m_rtHandler.Reset();
@@ -77,7 +75,7 @@ void IFWL_ComboBox::GetWidgetRect(CFX_RectF& rect, bool bAutoSize) {
rect.height = 16;
}
if (!m_pProperties->m_pThemeProvider) {
- ReSetTheme();
+ ResetTheme();
}
FX_FLOAT* pFWidth = static_cast<FX_FLOAT*>(
GetThemeCapacity(CFWL_WidgetCapacity::ScrollBarWidth));
@@ -117,10 +115,10 @@ void IFWL_ComboBox::Update() {
if (IsLocked()) {
return;
}
- ReSetTheme();
+ ResetTheme();
bool bDropDown = IsDropDownStyle();
if (bDropDown && m_pEdit) {
- ReSetEditAlignment();
+ ResetEditAlignment();
}
if (!m_pProperties->m_pThemeProvider) {
m_pProperties->m_pThemeProvider = GetAvailableTheme();
@@ -170,8 +168,8 @@ void IFWL_ComboBox::DrawWidget(CFX_Graphics* pGraphics,
}
param.m_rtPart = rtTextBk;
if (m_iCurSel >= 0) {
- IFWL_ListBoxDP* pData = static_cast<IFWL_ListBoxDP*>(
- m_pListBox->m_pProperties->m_pDataProvider);
+ IFWL_ListBoxDP* pData =
+ static_cast<IFWL_ListBoxDP*>(m_pListBox->GetDataProvider());
void* p = pData->GetItemData(m_pListBox.get(),
pData->GetItem(m_pListBox.get(), m_iCurSel));
if (p) {
@@ -235,11 +233,11 @@ void IFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
m_pEdit->SetThemeProvider(pThemeProvider);
}
-int32_t IFWL_ComboBox::GetCurSel() {
+int32_t IFWL_ComboBox::GetCurSel() const {
return m_iCurSel;
}
-FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) {
+void IFWL_ComboBox::SetCurSel(int32_t iSel) {
int32_t iCount = m_pListBox->CountItems();
bool bClearSel = iSel < 0 || iSel >= iCount;
bool bDropDown = IsDropDownStyle();
@@ -257,7 +255,6 @@ FWL_Error IFWL_ComboBox::SetCurSel(int32_t iSel) {
m_pEdit->Update();
}
m_iCurSel = bClearSel ? -1 : iSel;
- return FWL_Error::Succeeded;
}
void IFWL_ComboBox::SetStates(uint32_t dwStates, bool bSet) {
@@ -276,83 +273,24 @@ void IFWL_ComboBox::SetEditText(const CFX_WideString& wsText) {
m_pEdit->Update();
}
-int32_t IFWL_ComboBox::GetEditTextLength() const {
- if (!m_pEdit)
- return -1;
- return m_pEdit->GetTextLength();
-}
-
-FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
- int32_t nStart,
- int32_t nCount) const {
+void IFWL_ComboBox::GetEditText(CFX_WideString& wsText,
+ int32_t nStart,
+ int32_t nCount) const {
if (m_pEdit) {
m_pEdit->GetText(wsText, nStart, nCount);
- return FWL_Error::Succeeded;
- }
- if (m_pListBox) {
- IFWL_ComboBoxDP* pData =
- static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
- CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
- m_pListBox->GetItemText(hItem, wsText);
- return FWL_Error::Succeeded;
+ return;
}
- return FWL_Error::Indefinite;
-}
-
-FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) {
- if (!m_pEdit)
- return FWL_Error::Indefinite;
- m_pEdit->ClearSelected();
- m_pEdit->AddSelRange(nStart, nCount);
- return FWL_Error::Succeeded;
-}
-
-int32_t IFWL_ComboBox::GetEditSelRange(int32_t nIndex, int32_t& nStart) {
- if (!m_pEdit)
- return -1;
- return m_pEdit->GetSelRange(nIndex, nStart);
-}
-
-int32_t IFWL_ComboBox::GetEditLimit() {
- if (!m_pEdit)
- return -1;
- return m_pEdit->GetLimit();
-}
-
-FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) {
- if (!m_pEdit)
- return FWL_Error::Indefinite;
- m_pEdit->SetLimit(nLimit);
- return FWL_Error::Succeeded;
-}
-
-bool IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) {
- return m_pEdit && m_pEdit->Redo(pRecord);
-}
-
-bool IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) {
- return m_pEdit && m_pEdit->Undo(pRecord);
-}
-
-IFWL_ListBox* IFWL_ComboBox::GetListBoxt() {
- return m_pListBox.get();
-}
+ if (!m_pListBox)
+ return;
-bool IFWL_ComboBox::AfterFocusShowDropList() {
- if (!m_bNeedShowList) {
- return false;
- }
- if (m_pEdit) {
- MatchEditText();
- }
- ShowDropList(true);
- m_bNeedShowList = false;
- return true;
+ IFWL_ComboBoxDP* pData =
+ static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
+ CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel);
+ m_pListBox->GetItemText(hItem, wsText);
}
-FWL_Error IFWL_ComboBox::OpenDropDownList(bool bActivate) {
+void IFWL_ComboBox::OpenDropDownList(bool bActivate) {
ShowDropList(bActivate);
- return FWL_Error::Succeeded;
}
bool IFWL_ComboBox::EditCanUndo() {
@@ -413,18 +351,18 @@ bool IFWL_ComboBox::EditDeSelect() {
return true;
}
-FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) {
+void IFWL_ComboBox::GetBBox(CFX_RectF& rect) {
if (m_pWidgetMgr->IsFormDisabled()) {
- return DisForm_GetBBox(rect);
+ DisForm_GetBBox(rect);
+ return;
}
rect = m_pProperties->m_rtWidget;
- if (m_pListBox && IsDropListShowed()) {
+ if (m_pListBox && IsDropListVisible()) {
CFX_RectF rtList;
m_pListBox->GetWidgetRect(rtList);
rtList.Offset(rect.left, rect.top);
rect.Union(rtList);
}
- return FWL_Error::Succeeded;
}
void IFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
@@ -456,7 +394,7 @@ void IFWL_ComboBox::ShowDropList(bool bActivate) {
if (m_pWidgetMgr->IsFormDisabled())
return DisForm_ShowDropList(bActivate);
- bool bDropList = IsDropListShowed();
+ bool bDropList = IsDropListVisible();
if (bDropList == bActivate)
return;
if (!m_pComboBoxProxy)
@@ -465,7 +403,7 @@ void IFWL_ComboBox::ShowDropList(bool bActivate) {
m_pComboBoxProxy->Reset();
if (bActivate) {
m_pListBox->ChangeSelected(m_iCurSel);
- ReSetListItemAlignment();
+ ResetListItemAlignment();
uint32_t dwStyleAdd = m_pProperties->m_dwStyleExes &
(FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw);
m_pListBox->ModifyStylesEx(dwStyleAdd, 0);
@@ -519,20 +457,16 @@ void IFWL_ComboBox::ShowDropList(bool bActivate) {
ev.m_pSrcTarget = this;
DispatchEvent(&ev);
m_bLButtonDown = false;
- m_pListBox->m_bNotifyOwner = true;
+ m_pListBox->SetNotifyOwner(true);
SetFocus(true);
}
}
-bool IFWL_ComboBox::IsDropListShowed() {
+bool IFWL_ComboBox::IsDropListVisible() {
return m_pComboBoxProxy &&
!(m_pComboBoxProxy->GetStates() & FWL_WGTSTATE_Invisible);
}
-bool IFWL_ComboBox::IsDropDownStyle() const {
- return m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown;
-}
-
void IFWL_ComboBox::MatchEditText() {
CFX_WideString wsText;
m_pEdit->GetText(wsText);
@@ -540,7 +474,7 @@ void IFWL_ComboBox::MatchEditText() {
if (iMatch != m_iCurSel) {
m_pListBox->ChangeSelected(iMatch);
if (iMatch >= 0) {
- SynchrEditText(iMatch);
+ SyncEditText(iMatch);
}
} else if (iMatch >= 0) {
m_pEdit->SetSelected();
@@ -548,7 +482,7 @@ void IFWL_ComboBox::MatchEditText() {
m_iCurSel = iMatch;
}
-void IFWL_ComboBox::SynchrEditText(int32_t iListItem) {
+void IFWL_ComboBox::SyncEditText(int32_t iListItem) {
CFX_WideString wsText;
IFWL_ComboBoxDP* pData =
static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider);
@@ -591,7 +525,7 @@ void IFWL_ComboBox::Layout() {
}
}
-void IFWL_ComboBox::ReSetTheme() {
+void IFWL_ComboBox::ResetTheme() {
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
if (!pTheme) {
pTheme = GetAvailableTheme();
@@ -603,7 +537,7 @@ void IFWL_ComboBox::ReSetTheme() {
m_pEdit->SetThemeProvider(pTheme);
}
-void IFWL_ComboBox::ReSetEditAlignment() {
+void IFWL_ComboBox::ResetEditAlignment() {
if (!m_pEdit)
return;
uint32_t dwStylExes = m_pProperties->m_dwStyleExes;
@@ -641,7 +575,7 @@ void IFWL_ComboBox::ReSetEditAlignment() {
FWL_STYLEEXT_EDT_VAlignMask);
}
-void IFWL_ComboBox::ReSetListItemAlignment() {
+void IFWL_ComboBox::ResetListItemAlignment() {
if (!m_pListBox)
return;
uint32_t dwStylExes = m_pProperties->m_dwStyleExes;
@@ -727,7 +661,7 @@ void IFWL_ComboBox::DisForm_InitComboEdit() {
}
void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) {
- bool bDropList = DisForm_IsDropListShowed();
+ bool bDropList = DisForm_IsDropListVisible();
if (bDropList == bActivate) {
return;
}
@@ -740,7 +674,7 @@ void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) {
if (iItems < 1) {
return;
}
- ReSetListItemAlignment();
+ ResetListItemAlignment();
pComboList->ChangeSelected(m_iCurSel);
FX_FLOAT fItemHeight = pComboList->CalcItemHeight();
FX_FLOAT fBorder = GetBorderSize();
@@ -772,10 +706,6 @@ void IFWL_ComboBox::DisForm_ShowDropList(bool bActivate) {
Repaint(&rect);
}
-bool IFWL_ComboBox::DisForm_IsDropListShowed() {
- return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible);
-}
-
void IFWL_ComboBox::DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved) {
if (!m_pEdit)
@@ -798,9 +728,9 @@ void IFWL_ComboBox::DisForm_Update() {
return;
}
if (m_pEdit) {
- ReSetEditAlignment();
+ ResetEditAlignment();
}
- ReSetTheme();
+ ResetTheme();
Layout();
}
@@ -812,7 +742,7 @@ FWL_WidgetHit IFWL_ComboBox::DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy) {
return FWL_WidgetHit::Edit;
if (m_rtBtn.Contains(fx, fy))
return FWL_WidgetHit::Client;
- if (DisForm_IsDropListShowed()) {
+ if (DisForm_IsDropListVisible()) {
m_pListBox->GetWidgetRect(rect);
if (rect.Contains(fx, fy))
return FWL_WidgetHit::Client;
@@ -828,7 +758,7 @@ void IFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics,
if (pMatrix) {
mtOrg = *pMatrix;
}
- bool bListShowed = m_pListBox && DisForm_IsDropListShowed();
+ bool bListShowed = m_pListBox && DisForm_IsDropListVisible();
pGraphics->SaveGraphState();
pGraphics->ConcatMatrix(&mtOrg);
if (!m_rtBtn.IsEmpty(0.1f)) {
@@ -859,15 +789,14 @@ void IFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics,
}
}
-FWL_Error IFWL_ComboBox::DisForm_GetBBox(CFX_RectF& rect) {
+void IFWL_ComboBox::DisForm_GetBBox(CFX_RectF& rect) {
rect = m_pProperties->m_rtWidget;
- if (m_pListBox && DisForm_IsDropListShowed()) {
+ if (m_pListBox && DisForm_IsDropListVisible()) {
CFX_RectF rtList;
m_pListBox->GetWidgetRect(rtList);
rtList.Offset(rect.left, rect.top);
rect.Union(rtList);
}
- return FWL_Error::Succeeded;
}
void IFWL_ComboBox::DisForm_Layout() {
@@ -1062,7 +991,7 @@ void IFWL_ComboBox::OnMouseMove(CFWL_MsgMouse* pMsg) {
}
void IFWL_ComboBox::OnMouseLeave(CFWL_MsgMouse* pMsg) {
- if (!IsDropListShowed() &&
+ if (!IsDropListVisible() &&
!((m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) ==
FWL_WGTSTATE_Disabled)) {
m_iBtnState = CFWL_PartState_Normal;
@@ -1117,7 +1046,7 @@ void IFWL_ComboBox::DoSubCtrlKey(CFWL_MsgKey* pMsg) {
}
m_iCurSel = iCurSel;
if (bDropDown && m_pEdit)
- SynchrEditText(m_iCurSel);
+ SyncEditText(m_iCurSel);
else
Repaint(&m_rtClient);
return;
@@ -1164,7 +1093,7 @@ void IFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) {
CFWL_MsgKey* pKey = static_cast<CFWL_MsgKey*>(pMessage);
if (pKey->m_dwCmd == FWL_KeyCommand::KeyUp)
break;
- if (DisForm_IsDropListShowed() &&
+ if (DisForm_IsDropListVisible() &&
pKey->m_dwCmd == FWL_KeyCommand::KeyDown) {
bool bListKey = pKey->m_dwKeyCode == FWL_VKEY_Up ||
pKey->m_dwKeyCode == FWL_VKEY_Down ||
@@ -1186,12 +1115,12 @@ void IFWL_ComboBox::DisForm_OnProcessMessage(CFWL_Message* pMessage) {
}
void IFWL_ComboBox::DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg) {
- bool bDropDown = DisForm_IsDropListShowed();
+ bool bDropDown = DisForm_IsDropListVisible();
CFX_RectF& rtBtn = bDropDown ? m_rtBtn : m_rtClient;
if (!rtBtn.Contains(pMsg->m_fx, pMsg->m_fy))
return;
- if (DisForm_IsDropListShowed()) {
+ if (DisForm_IsDropListVisible()) {
DisForm_ShowDropList(false);
return;
}
@@ -1253,7 +1182,7 @@ void IFWL_ComboBox::DisForm_OnKey(CFWL_MsgKey* pMsg) {
iCurSel++;
}
m_iCurSel = iCurSel;
- SynchrEditText(m_iCurSel);
+ SyncEditText(m_iCurSel);
return;
}
if (m_pEdit)
diff --git a/xfa/fwl/core/ifwl_combobox.h b/xfa/fwl/core/ifwl_combobox.h
index 0b586b424f..8332a793d1 100644
--- a/xfa/fwl/core/ifwl_combobox.h
+++ b/xfa/fwl/core/ifwl_combobox.h
@@ -7,6 +7,7 @@
#ifndef XFA_FWL_CORE_IFWL_COMBOBOX_H_
#define XFA_FWL_CORE_IFWL_COMBOBOX_H_
+#include "xfa/fwl/core/ifwl_combolist.h"
#include "xfa/fwl/core/ifwl_form.h"
#include "xfa/fwl/core/ifwl_listbox.h"
#include "xfa/fxgraphics/cfx_graphics.h"
@@ -15,7 +16,6 @@ class CFWL_WidgetProperties;
class IFWL_ComboBox;
class IFWL_ComboBoxProxy;
class IFWL_ComboEdit;
-class IFWL_ComboList;
class IFWL_FormProxy;
class IFWL_ListBox;
class IFWL_Widget;
@@ -99,22 +99,16 @@ class IFWL_ComboBox : public IFWL_Widget {
void OnDrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix) override;
- int32_t GetCurSel();
- FWL_Error SetCurSel(int32_t iSel);
+ int32_t GetCurSel() const;
+ void SetCurSel(int32_t iSel);
+
void SetEditText(const CFX_WideString& wsText);
- int32_t GetEditTextLength() const;
- FWL_Error GetEditText(CFX_WideString& wsText,
- int32_t nStart = 0,
- int32_t nCount = -1) const;
- FWL_Error SetEditSelRange(int32_t nStart, int32_t nCount = -1);
- int32_t GetEditSelRange(int32_t nIndex, int32_t& nStart);
- int32_t GetEditLimit();
- FWL_Error SetEditLimit(int32_t nLimit);
- bool EditRedo(const IFDE_TxtEdtDoRecord* pRecord);
- bool EditUndo(const IFDE_TxtEdtDoRecord* pRecord);
- IFWL_ListBox* GetListBoxt();
- bool AfterFocusShowDropList();
- FWL_Error OpenDropDownList(bool bActivate);
+ void GetEditText(CFX_WideString& wsText,
+ int32_t nStart = 0,
+ int32_t nCount = -1) const;
+
+ void OpenDropDownList(bool bActivate);
+
bool EditCanUndo();
bool EditCanRedo();
bool EditUndo();
@@ -128,39 +122,57 @@ class IFWL_ComboBox : public IFWL_Widget {
bool EditSelectAll();
bool EditDelete();
bool EditDeSelect();
- FWL_Error GetBBox(CFX_RectF& rect);
+
+ void GetBBox(CFX_RectF& rect);
void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved);
void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix);
- bool IsDropListShowed();
+ bool IsDropListVisible();
+
void ShowDropList(bool bActivate);
IFWL_ComboEdit* GetComboEdit() const { return m_pEdit.get(); }
+
void ProcessSelChanged(bool bLButtonUp);
int32_t GetCurrentSelection() const { return m_iCurSel; }
- protected:
+ private:
FX_FLOAT GetListHeight();
- bool IsDropDownStyle() const;
+ bool IsDropDownStyle() const {
+ return !!(m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown);
+ }
void MatchEditText();
- void SynchrEditText(int32_t iListItem);
+ void SyncEditText(int32_t iListItem);
void Layout();
- void ReSetTheme();
- void ReSetEditAlignment();
- void ReSetListItemAlignment();
+ void ResetTheme();
+ void ResetEditAlignment();
+ void ResetListItemAlignment();
void InitProxyForm();
void DisForm_InitComboList();
void DisForm_InitComboEdit();
void DisForm_ShowDropList(bool bActivate);
- bool DisForm_IsDropListShowed();
+ bool DisForm_IsDropListVisible() const {
+ return !(m_pListBox->GetStates() & FWL_WGTSTATE_Invisible);
+ }
void DisForm_ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved);
void DisForm_Update();
FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy);
void DisForm_DrawWidget(CFX_Graphics* pGraphics,
const CFX_Matrix* pMatrix = nullptr);
- FWL_Error DisForm_GetBBox(CFX_RectF& rect);
+ void DisForm_GetBBox(CFX_RectF& rect);
void DisForm_Layout();
+ void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true);
+ void OnLButtonDown(CFWL_MsgMouse* pMsg);
+ void OnLButtonUp(CFWL_MsgMouse* pMsg);
+ void OnMouseMove(CFWL_MsgMouse* pMsg);
+ void OnMouseLeave(CFWL_MsgMouse* pMsg);
+ void OnKey(CFWL_MsgKey* pMsg);
+ void DoSubCtrlKey(CFWL_MsgKey* pMsg);
+ void DisForm_OnProcessMessage(CFWL_Message* pMessage);
+ void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg);
+ void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet = true);
+ void DisForm_OnKey(CFWL_MsgKey* pMsg);
CFX_RectF m_rtClient;
CFX_RectF m_rtContent;
@@ -177,21 +189,6 @@ class IFWL_ComboBox : public IFWL_Widget {
int32_t m_iBtnState;
FX_FLOAT m_fComboFormHandler;
FX_FLOAT m_fItemHeight;
- bool m_bNeedShowList;
-
- private:
- void OnFocusChanged(CFWL_Message* pMsg, bool bSet = true);
- void OnLButtonDown(CFWL_MsgMouse* pMsg);
- void OnLButtonUp(CFWL_MsgMouse* pMsg);
- void OnMouseMove(CFWL_MsgMouse* pMsg);
- void OnMouseLeave(CFWL_MsgMouse* pMsg);
- void OnKey(CFWL_MsgKey* pMsg);
- void DoSubCtrlKey(CFWL_MsgKey* pMsg);
- void DisForm_OnProcessMessage(CFWL_Message* pMessage);
- void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg);
- void DisForm_OnFocusChanged(CFWL_Message* pMsg, bool bSet = true);
- void DisForm_OnKey(CFWL_MsgKey* pMsg);
-
};
#endif // XFA_FWL_CORE_IFWL_COMBOBOX_H_
diff --git a/xfa/fwl/core/ifwl_comboboxproxy.cpp b/xfa/fwl/core/ifwl_comboboxproxy.cpp
index c8d1f793c6..e7ce1bd77d 100644
--- a/xfa/fwl/core/ifwl_comboboxproxy.cpp
+++ b/xfa/fwl/core/ifwl_comboboxproxy.cpp
@@ -36,8 +36,6 @@ void IFWL_ComboBoxProxy::OnProcessMessage(CFWL_Message* pMessage) {
case FWL_MouseCommand::LeftButtonUp:
OnLButtonUp(pMsg);
break;
- case FWL_MouseCommand::Move:
- break;
default:
break;
}
@@ -97,7 +95,7 @@ void IFWL_ComboBoxProxy::OnLButtonUp(CFWL_MsgMouse* pMsg) {
GetWidgetRect(rect);
rect.left = rect.top = 0;
if (!rect.Contains(pMsg->m_fx, pMsg->m_fy) &&
- m_pComboBox->IsDropListShowed()) {
+ m_pComboBox->IsDropListVisible()) {
m_pComboBox->ShowDropList(false);
}
} else {
diff --git a/xfa/fwl/core/ifwl_comboboxproxy.h b/xfa/fwl/core/ifwl_comboboxproxy.h
index f6da41299f..ec048fed16 100644
--- a/xfa/fwl/core/ifwl_comboboxproxy.h
+++ b/xfa/fwl/core/ifwl_comboboxproxy.h
@@ -34,7 +34,6 @@ class IFWL_ComboBoxProxy : public IFWL_FormProxy {
bool m_bLButtonDown;
bool m_bLButtonUpSelf;
-
IFWL_ComboBox* m_pComboBox;
};
diff --git a/xfa/fwl/core/ifwl_comboedit.cpp b/xfa/fwl/core/ifwl_comboedit.cpp
index 2a7ac904e1..0896ba76df 100644
--- a/xfa/fwl/core/ifwl_comboedit.cpp
+++ b/xfa/fwl/core/ifwl_comboedit.cpp
@@ -24,12 +24,8 @@ void IFWL_ComboEdit::ClearSelected() {
void IFWL_ComboEdit::SetSelected() {
FlagFocus(true);
- EndCaret();
- AddSelRange(0);
-}
-
-void IFWL_ComboEdit::EndCaret() {
GetTxtEdtEngine()->MoveCaretPos(MC_End);
+ AddSelRange(0);
}
void IFWL_ComboEdit::FlagFocus(bool bSet) {
@@ -41,10 +37,6 @@ void IFWL_ComboEdit::FlagFocus(bool bSet) {
}
}
-void IFWL_ComboEdit::SetComboBoxFocus(bool bSet) {
- m_pOuter->SetFocus(bSet);
-}
-
void IFWL_ComboEdit::OnProcessMessage(CFWL_Message* pMessage) {
if (!pMessage)
return;
@@ -66,7 +58,7 @@ void IFWL_ComboEdit::OnProcessMessage(CFWL_Message* pMessage) {
if ((pMsg->m_dwCmd == FWL_MouseCommand::LeftButtonDown) &&
((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == 0)) {
SetSelected();
- SetComboBoxFocus(true);
+ m_pOuter->SetFocus(true);
}
break;
}
diff --git a/xfa/fwl/core/ifwl_comboedit.h b/xfa/fwl/core/ifwl_comboedit.h
index f50a7258dd..c7d2e1072e 100644
--- a/xfa/fwl/core/ifwl_comboedit.h
+++ b/xfa/fwl/core/ifwl_comboedit.h
@@ -24,11 +24,9 @@ class IFWL_ComboEdit : public IFWL_Edit {
void ClearSelected();
void SetSelected();
- void EndCaret();
void FlagFocus(bool bSet);
- protected:
- void SetComboBoxFocus(bool bSet);
+ private:
IFWL_ComboBox* m_pOuter;
};
diff --git a/xfa/fwl/core/ifwl_combolist.h b/xfa/fwl/core/ifwl_combolist.h
index 6c380f4f07..64ffbba647 100644
--- a/xfa/fwl/core/ifwl_combolist.h
+++ b/xfa/fwl/core/ifwl_combolist.h
@@ -21,23 +21,24 @@ class IFWL_ComboList : public IFWL_ListBox {
void OnProcessMessage(CFWL_Message* pMessage) override;
int32_t MatchItem(const CFX_WideString& wsMatch);
+
void ChangeSelected(int32_t iSel);
int32_t CountItems();
- void GetItemRect(int32_t nIndex, CFX_RectF& rtItem);
- void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy);
- void SetFocus(bool bSet);
-
- bool m_bNotifyOwner;
- friend class IFWL_ComboBox;
+ void SetFocus(bool bSet);
+ void SetNotifyOwner(bool notify) { m_bNotifyOwner = notify; }
private:
+ void GetItemRect(int32_t nIndex, CFX_RectF& rtItem);
+ void ClientToOuter(FX_FLOAT& fx, FX_FLOAT& fy);
void OnDropListFocusChanged(CFWL_Message* pMsg, bool bSet);
int32_t OnDropListMouseMove(CFWL_MsgMouse* pMsg);
int32_t OnDropListLButtonDown(CFWL_MsgMouse* pMsg);
int32_t OnDropListLButtonUp(CFWL_MsgMouse* pMsg);
int32_t OnDropListKey(CFWL_MsgKey* pKey);
void OnDropListKeyDown(CFWL_MsgKey* pKey);
+
+ bool m_bNotifyOwner;
};
#endif // XFA_FWL_CORE_IFWL_COMBOLIST_H_
diff --git a/xfa/fwl/core/ifwl_listbox.h b/xfa/fwl/core/ifwl_listbox.h
index 608a7d9372..32865c116e 100644
--- a/xfa/fwl/core/ifwl_listbox.h
+++ b/xfa/fwl/core/ifwl_listbox.h
@@ -51,9 +51,9 @@ FWL_EVENT_DEF(CFWL_EvtLtbDrawItem,
class IFWL_ListBoxDP : public IFWL_DataProvider {
public:
- virtual int32_t CountItems(const IFWL_Widget* pWidget) = 0;
+ virtual int32_t CountItems(const IFWL_Widget* pWidget) const = 0;
virtual CFWL_ListItem* GetItem(const IFWL_Widget* pWidget,
- int32_t nIndex) = 0;
+ int32_t nIndex) const = 0;
virtual int32_t GetItemIndex(IFWL_Widget* pWidget, CFWL_ListItem* pItem) = 0;
virtual bool SetItemIndex(IFWL_Widget* pWidget,
CFWL_ListItem* pItem,
@@ -119,15 +119,16 @@ class IFWL_ListBox : public IFWL_Widget {
void GetItemText(CFWL_ListItem* hItem, CFX_WideString& wsText);
void GetScrollPos(FX_FLOAT& fPos, bool bVert = true);
+ FX_FLOAT GetItemHeight() const { return m_fItemHeight; }
+ FX_FLOAT CalcItemHeight();
+
protected:
CFWL_ListItem* GetItem(CFWL_ListItem* hItem, uint32_t dwKeyCode);
void SetSelection(CFWL_ListItem* hStart, CFWL_ListItem* hEnd, bool bSelected);
CFWL_ListItem* GetItemAtPoint(FX_FLOAT fx, FX_FLOAT fy);
bool ScrollToVisible(CFWL_ListItem* hItem);
- FX_FLOAT CalcItemHeight();
void InitScrollBar(bool bVert = true);
bool IsShowScrollBar(bool bVert);
- FX_FLOAT GetItemHeight() const { return m_fItemHeight; }
IFWL_ScrollBar* GetVertScrollBar() const { return m_pVertScrollBar.get(); }
const CFX_RectF& GetRTClient() const { return m_rtClient; }
diff --git a/xfa/fwl/core/ifwl_widget.h b/xfa/fwl/core/ifwl_widget.h
index d1284b1c92..36c587b3ea 100644
--- a/xfa/fwl/core/ifwl_widget.h
+++ b/xfa/fwl/core/ifwl_widget.h
@@ -111,6 +111,10 @@ class IFWL_Widget : public IFWL_WidgetDelegate {
return m_pProperties->m_pThemeProvider;
}
+ IFWL_DataProvider* GetDataProvider() const {
+ return m_pProperties->m_pDataProvider;
+ }
+
void SetDelegate(IFWL_WidgetDelegate* delegate) { m_pDelegate = delegate; }
IFWL_WidgetDelegate* GetDelegate() {
return m_pDelegate ? m_pDelegate : this;