summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fwl/cfwl_checkbox.cpp15
-rw-r--r--xfa/fwl/cfwl_combobox.cpp274
-rw-r--r--xfa/fwl/cfwl_datetimeedit.cpp15
-rw-r--r--xfa/fwl/cfwl_datetimepicker.cpp127
-rw-r--r--xfa/fwl/cfwl_edit.cpp13
-rw-r--r--xfa/fwl/cfwl_monthcalendar.cpp42
-rw-r--r--xfa/fwl/cfwl_notedriver.cpp51
-rw-r--r--xfa/fwl/cfwl_widget.cpp65
-rw-r--r--xfa/fwl/cfwl_widgetmgr.cpp80
-rw-r--r--xfa/fwl/cfwl_widgetmgr.h5
10 files changed, 54 insertions, 633 deletions
diff --git a/xfa/fwl/cfwl_checkbox.cpp b/xfa/fwl/cfwl_checkbox.cpp
index 7e78efae63..290e59daae 100644
--- a/xfa/fwl/cfwl_checkbox.cpp
+++ b/xfa/fwl/cfwl_checkbox.cpp
@@ -179,21 +179,6 @@ void CFWL_CheckBox::NextStates() {
if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CKB_RadioButton) {
if ((m_pProperties->m_dwStates & FWL_STATE_CKB_CheckMask) ==
FWL_STATE_CKB_Unchecked) {
- CFWL_WidgetMgr* pWidgetMgr = GetOwnerApp()->GetWidgetMgr();
- if (!pWidgetMgr->IsFormDisabled()) {
- std::vector<CFWL_Widget*> radioarr =
- pWidgetMgr->GetSameGroupRadioButton(this);
- for (auto* pWidget : radioarr) {
- CFWL_CheckBox* pCheckBox = static_cast<CFWL_CheckBox*>(pWidget);
- if (pCheckBox != this &&
- pCheckBox->GetStates() & FWL_STATE_CKB_Checked) {
- pCheckBox->SetCheckState(0);
- m_pWidgetMgr->RepaintWidget(
- pCheckBox, CFX_RectF(0, 0, pCheckBox->GetWidgetRect().Size()));
- break;
- }
- }
- }
m_pProperties->m_dwStates |= FWL_STATE_CKB_Checked;
}
} else {
diff --git a/xfa/fwl/cfwl_combobox.cpp b/xfa/fwl/cfwl_combobox.cpp
index 20134a830b..c60c27497f 100644
--- a/xfa/fwl/cfwl_combobox.cpp
+++ b/xfa/fwl/cfwl_combobox.cpp
@@ -40,27 +40,8 @@ CFWL_ComboBox::CFWL_ComboBox(const CFWL_App* app)
m_rtBtn.Reset();
m_rtHandler.Reset();
- if (m_pWidgetMgr->IsFormDisabled()) {
- DisForm_InitComboList();
- DisForm_InitComboEdit();
- return;
- }
-
- auto prop = pdfium::MakeUnique<CFWL_WidgetProperties>();
- prop->m_pThemeProvider = m_pProperties->m_pThemeProvider;
- prop->m_dwStyles |= FWL_WGTSTYLE_Border | FWL_WGTSTYLE_VScroll;
- m_pListBox = pdfium::MakeUnique<CFWL_ComboList>(m_pOwnerApp.Get(),
- std::move(prop), this);
-
- if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_CMB_DropDown) && !m_pEdit) {
- m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>(
- m_pOwnerApp.Get(), pdfium::MakeUnique<CFWL_WidgetProperties>(), this);
- m_pEdit->SetOuter(this);
- }
- if (m_pEdit)
- m_pEdit->SetParent(this);
-
- SetStates(m_pProperties->m_dwStates);
+ DisForm_InitComboList();
+ DisForm_InitComboEdit();
}
CFWL_ComboBox::~CFWL_ComboBox() {}
@@ -83,118 +64,20 @@ void CFWL_ComboBox::RemoveAll() {
void CFWL_ComboBox::ModifyStylesEx(uint32_t dwStylesExAdded,
uint32_t dwStylesExRemoved) {
- if (m_pWidgetMgr->IsFormDisabled()) {
- DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
- return;
- }
-
- bool bAddDropDown = !!(dwStylesExAdded & FWL_STYLEEXT_CMB_DropDown);
- bool bRemoveDropDown = !!(dwStylesExRemoved & FWL_STYLEEXT_CMB_DropDown);
- if (bAddDropDown && !m_pEdit) {
- m_pEdit = pdfium::MakeUnique<CFWL_ComboEdit>(
- m_pOwnerApp.Get(), pdfium::MakeUnique<CFWL_WidgetProperties>(),
- nullptr);
- m_pEdit->SetOuter(this);
- m_pEdit->SetParent(this);
- } else if (bRemoveDropDown && m_pEdit) {
- m_pEdit->SetStates(FWL_WGTSTATE_Invisible);
- }
- CFWL_Widget::ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
+ DisForm_ModifyStylesEx(dwStylesExAdded, dwStylesExRemoved);
}
void CFWL_ComboBox::Update() {
- if (m_pWidgetMgr->IsFormDisabled()) {
- DisForm_Update();
- return;
- }
- if (IsLocked())
- return;
-
- ResetTheme();
- if (IsDropDownStyle() && m_pEdit)
- ResetEditAlignment();
- if (!m_pProperties->m_pThemeProvider)
- m_pProperties->m_pThemeProvider = GetAvailableTheme();
-
- Layout();
+ DisForm_Update();
}
FWL_WidgetHit CFWL_ComboBox::HitTest(const CFX_PointF& point) {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_HitTest(point);
- return CFWL_Widget::HitTest(point);
+ return DisForm_HitTest(point);
}
void CFWL_ComboBox::DrawWidget(CXFA_Graphics* pGraphics,
const CFX_Matrix& matrix) {
- if (m_pWidgetMgr->IsFormDisabled()) {
- DisForm_DrawWidget(pGraphics, &matrix);
- return;
- }
-
- if (!pGraphics)
- return;
- if (!m_pProperties->m_pThemeProvider)
- return;
-
- IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
- if (HasBorder())
- DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix);
-
- if (!IsDropDownStyle()) {
- CFX_RectF rtTextBk(m_rtClient);
- rtTextBk.width -= m_rtBtn.width;
-
- CFWL_ThemeBackground param;
- param.m_pWidget = this;
- param.m_iPart = CFWL_Part::Background;
- param.m_pGraphics = pGraphics;
- param.m_matrix.Concat(matrix);
- param.m_rtPart = rtTextBk;
-
- if (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled) {
- param.m_dwStates = CFWL_PartState_Disabled;
- } else if ((m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) &&
- (m_iCurSel >= 0)) {
- param.m_dwStates = CFWL_PartState_Selected;
- } else {
- param.m_dwStates = CFWL_PartState_Normal;
- }
- pTheme->DrawBackground(&param);
-
- if (m_iCurSel >= 0) {
- if (!m_pListBox)
- return;
-
- CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
-
- CFWL_ThemeText theme_text;
- theme_text.m_pWidget = this;
- theme_text.m_iPart = CFWL_Part::Caption;
- theme_text.m_dwStates = m_iBtnState;
- theme_text.m_pGraphics = pGraphics;
- theme_text.m_matrix.Concat(matrix);
- theme_text.m_rtPart = rtTextBk;
- theme_text.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused)
- ? CFWL_PartState_Selected
- : CFWL_PartState_Normal;
- theme_text.m_wsText = hItem ? hItem->GetText() : L"";
- theme_text.m_dwTTOStyles.single_line_ = true;
- theme_text.m_iTTOAlign = FDE_TextAlignment::kCenterLeft;
- pTheme->DrawText(&theme_text);
- }
- }
-
- CFWL_ThemeBackground param;
- param.m_pWidget = this;
- param.m_iPart = CFWL_Part::DropDownButton;
- param.m_dwStates = (m_pProperties->m_dwStates & FWL_WGTSTATE_Disabled)
- ? CFWL_PartState_Disabled
- : m_iBtnState;
- param.m_pGraphics = pGraphics;
- param.m_matrix.Concat(matrix);
- param.m_rtPart = m_rtBtn;
- pTheme->DrawBackground(&param);
+ DisForm_DrawWidget(pGraphics, &matrix);
}
void CFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
@@ -268,17 +151,7 @@ void CFWL_ComboBox::OpenDropDownList(bool bActivate) {
}
CFX_RectF CFWL_ComboBox::GetBBox() const {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_GetBBox();
-
- CFX_RectF rect = m_pProperties->m_rtWidget;
- if (!m_pListBox || !IsDropListVisible())
- return rect;
-
- CFX_RectF rtList = m_pListBox->GetWidgetRect();
- rtList.Offset(rect.left, rect.top);
- rect.Union(rtList);
- return rect;
+ return DisForm_GetBBox();
}
void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded,
@@ -301,50 +174,7 @@ void CFWL_ComboBox::DrawStretchHandler(CXFA_Graphics* pGraphics,
}
void CFWL_ComboBox::ShowDropList(bool bActivate) {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_ShowDropList(bActivate);
- if (IsDropListVisible() == bActivate)
- return;
- if (!m_pComboBoxProxy)
- InitProxyForm();
-
- m_pComboBoxProxy->Reset();
- if (!bActivate) {
- m_pComboBoxProxy->EndDoModal();
-
- m_bLButtonDown = false;
- m_pListBox->SetNotifyOwner(true);
- SetFocus(true);
- return;
- }
-
- m_pListBox->ChangeSelected(m_iCurSel);
- ResetListItemAlignment();
-
- uint32_t dwStyleAdd = m_pProperties->m_dwStyleExes &
- (FWL_STYLEEXT_CMB_Sort | FWL_STYLEEXT_CMB_OwnerDraw);
- m_pListBox->ModifyStylesEx(dwStyleAdd, 0);
- m_rtList = m_pListBox->GetAutosizedWidgetRect();
-
- CFX_RectF rtAnchor(0, 0, m_pProperties->m_rtWidget.width,
- m_pProperties->m_rtWidget.height);
-
- m_rtList.width = std::max(m_rtList.width, m_rtClient.width);
- m_rtProxy = m_rtList;
-
- GetPopupPos(0, m_rtProxy.height, rtAnchor, &m_rtProxy);
-
- m_pComboBoxProxy->SetWidgetRect(m_rtProxy);
- m_pComboBoxProxy->Update();
- m_pListBox->SetWidgetRect(m_rtList);
- m_pListBox->Update();
-
- CFWL_Event ev(CFWL_Event::Type::PreDropDown, this);
- DispatchEvent(&ev);
-
- m_pListBox->SetFocus(true);
- m_pComboBoxProxy->DoModal();
- m_pListBox->SetFocus(false);
+ return DisForm_ShowDropList(bActivate);
}
void CFWL_ComboBox::MatchEditText() {
@@ -368,31 +198,7 @@ void CFWL_ComboBox::SyncEditText(int32_t iListItem) {
}
void CFWL_ComboBox::Layout() {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_Layout();
-
- m_rtClient = GetClientRect();
- IFWL_ThemeProvider* theme = GetAvailableTheme();
- if (!theme)
- return;
-
- float fBtn = theme->GetScrollBarWidth();
- m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top, fBtn,
- m_rtClient.height);
- if (!IsDropDownStyle() || !m_pEdit)
- return;
-
- CFX_RectF rtEdit(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn,
- m_rtClient.height);
- m_pEdit->SetWidgetRect(rtEdit);
-
- if (m_iCurSel >= 0) {
- CFWL_ListItem* hItem = m_pListBox->GetItem(this, m_iCurSel);
- m_pEdit->LockUpdate();
- m_pEdit->SetText(hItem ? hItem->GetText() : L"");
- m_pEdit->UnlockUpdate();
- }
- m_pEdit->Update();
+ return DisForm_Layout();
}
void CFWL_ComboBox::ResetTheme() {
@@ -697,48 +503,7 @@ void CFWL_ComboBox::DisForm_Layout() {
}
void CFWL_ComboBox::OnProcessMessage(CFWL_Message* pMessage) {
- if (m_pWidgetMgr->IsFormDisabled()) {
- DisForm_OnProcessMessage(pMessage);
- return;
- }
- if (!pMessage)
- return;
-
- switch (pMessage->GetType()) {
- case CFWL_Message::Type::SetFocus:
- OnFocusChanged(pMessage, true);
- break;
- case CFWL_Message::Type::KillFocus:
- OnFocusChanged(pMessage, false);
- break;
- case CFWL_Message::Type::Mouse: {
- CFWL_MessageMouse* pMsg = static_cast<CFWL_MessageMouse*>(pMessage);
- switch (pMsg->m_dwCmd) {
- case FWL_MouseCommand::LeftButtonDown:
- OnLButtonDown(pMsg);
- break;
- case FWL_MouseCommand::LeftButtonUp:
- OnLButtonUp(pMsg);
- break;
- case FWL_MouseCommand::Move:
- OnMouseMove(pMsg);
- break;
- case FWL_MouseCommand::Leave:
- OnMouseLeave(pMsg);
- break;
- default:
- break;
- }
- break;
- }
- case CFWL_Message::Type::Key:
- OnKey(static_cast<CFWL_MessageKey*>(pMessage));
- break;
- default:
- break;
- }
-
- CFWL_Widget::OnProcessMessage(pMessage);
+ DisForm_OnProcessMessage(pMessage);
}
void CFWL_ComboBox::OnProcessEvent(CFWL_Event* pEvent) {
@@ -1019,21 +784,6 @@ void CFWL_ComboBox::GetPopupPos(float fMinHeight,
float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF* pPopupRect) {
- if (m_pWidgetMgr->IsFormDisabled()) {
- m_pWidgetMgr->GetAdapterPopupPos(this, fMinHeight, fMaxHeight, rtAnchor,
- pPopupRect);
- return;
- }
-
- CFX_PointF point = TransformTo(nullptr, CFX_PointF());
- float fPopupHeight =
- pdfium::clamp(pPopupRect->height, fMinHeight, fMaxHeight);
- float fPopupWidth = std::max(rtAnchor.width, pPopupRect->width);
- float fPopupBottom = rtAnchor.bottom() + fPopupHeight;
- float fPopupTop = (fPopupBottom + point.y > 0.0f)
- ? rtAnchor.top - fPopupHeight
- : rtAnchor.bottom();
-
- *pPopupRect = CFX_RectF(rtAnchor.left, fPopupTop, fPopupWidth, fPopupHeight);
- pPopupRect->Offset(point.x, point.y);
+ m_pWidgetMgr->GetAdapterPopupPos(this, fMinHeight, fMaxHeight, rtAnchor,
+ pPopupRect);
}
diff --git a/xfa/fwl/cfwl_datetimeedit.cpp b/xfa/fwl/cfwl_datetimeedit.cpp
index f1ddbb1afb..ae7cd1ed96 100644
--- a/xfa/fwl/cfwl_datetimeedit.cpp
+++ b/xfa/fwl/cfwl_datetimeedit.cpp
@@ -21,22 +21,11 @@ CFWL_DateTimeEdit::CFWL_DateTimeEdit(
: CFWL_Edit(app, std::move(properties), pOuter) {}
void CFWL_DateTimeEdit::OnProcessMessage(CFWL_Message* pMessage) {
- if (m_pWidgetMgr->IsFormDisabled()) {
- DisForm_OnProcessMessage(pMessage);
- return;
- }
-
- CFWL_Message::Type type = pMessage->GetType();
- if (type == CFWL_Message::Type::SetFocus ||
- type == CFWL_Message::Type::KillFocus) {
- CFWL_Widget* pOuter = GetOuter();
- pOuter->GetDelegate()->OnProcessMessage(pMessage);
- }
+ DisForm_OnProcessMessage(pMessage);
}
void CFWL_DateTimeEdit::DisForm_OnProcessMessage(CFWL_Message* pMessage) {
- if (!m_pWidgetMgr->IsFormDisabled() ||
- pMessage->GetType() != CFWL_Message::Type::Mouse) {
+ if (pMessage->GetType() != CFWL_Message::Type::Mouse) {
CFWL_Edit::OnProcessMessage(pMessage);
return;
}
diff --git a/xfa/fwl/cfwl_datetimepicker.cpp b/xfa/fwl/cfwl_datetimepicker.cpp
index 66e55dea9c..94d1d939b8 100644
--- a/xfa/fwl/cfwl_datetimepicker.cpp
+++ b/xfa/fwl/cfwl_datetimepicker.cpp
@@ -64,53 +64,11 @@ FWL_Type CFWL_DateTimePicker::GetClassID() const {
}
void CFWL_DateTimePicker::Update() {
- if (m_pWidgetMgr->IsFormDisabled()) {
- DisForm_Update();
- return;
- }
- if (m_iLock)
- return;
- if (!m_pProperties->m_pThemeProvider)
- m_pProperties->m_pThemeProvider = GetAvailableTheme();
-
- m_pEdit->SetThemeProvider(m_pProperties->m_pThemeProvider);
- m_rtClient = GetClientRect();
-
- IFWL_ThemeProvider* theme = GetAvailableTheme();
- if (!theme)
- return;
-
- float fBtn = theme->GetScrollBarWidth();
- m_rtBtn = CFX_RectF(m_rtClient.right() - fBtn, m_rtClient.top, fBtn - 1,
- m_rtClient.height - 1);
-
- CFX_RectF rtEdit(m_rtClient.left, m_rtClient.top, m_rtClient.width - fBtn,
- m_rtClient.height);
- m_pEdit->SetWidgetRect(rtEdit);
- ResetEditAlignment();
- m_pEdit->Update();
- if (!(m_pMonthCal->GetThemeProvider()))
- m_pMonthCal->SetThemeProvider(m_pProperties->m_pThemeProvider);
-
- CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
- CFX_RectF rtPopUp(rtMonthCal.left, rtMonthCal.top + kDateTimePickerHeight,
- rtMonthCal.width, rtMonthCal.height);
- m_pMonthCal->SetWidgetRect(rtPopUp);
- m_pMonthCal->Update();
- return;
+ DisForm_Update();
}
FWL_WidgetHit CFWL_DateTimePicker::HitTest(const CFX_PointF& point) {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_HitTest(point);
- if (m_rtClient.Contains(point))
- return FWL_WidgetHit::Client;
- if (IsMonthCalendarVisible()) {
- CFX_RectF rect = m_pMonthCal->GetWidgetRect();
- if (rect.Contains(point))
- return FWL_WidgetHit::Client;
- }
- return FWL_WidgetHit::Unknown;
+ return DisForm_HitTest(point);
}
void CFWL_DateTimePicker::DrawWidget(CXFA_Graphics* pGraphics,
@@ -125,10 +83,7 @@ void CFWL_DateTimePicker::DrawWidget(CXFA_Graphics* pGraphics,
DrawBorder(pGraphics, CFWL_Part::Border, pTheme, matrix);
if (!m_rtBtn.IsEmpty())
DrawDropDownButton(pGraphics, pTheme, &matrix);
- if (m_pWidgetMgr->IsFormDisabled()) {
- DisForm_DrawWidget(pGraphics, &matrix);
- return;
- }
+ DisForm_DrawWidget(pGraphics, &matrix);
}
void CFWL_DateTimePicker::SetThemeProvider(IFWL_ThemeProvider* pTP) {
@@ -176,17 +131,7 @@ WideString CFWL_DateTimePicker::GetEditText() const {
}
CFX_RectF CFWL_DateTimePicker::GetBBox() const {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_GetBBox();
-
- CFX_RectF rect = m_pProperties->m_rtWidget;
- if (!IsMonthCalendarVisible())
- return rect;
-
- CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
- rtMonth.Offset(m_pProperties->m_rtWidget.left, m_pProperties->m_rtWidget.top);
- rect.Union(rtMonth);
- return rect;
+ return DisForm_GetBBox();
}
void CFWL_DateTimePicker::ModifyEditStylesEx(uint32_t dwStylesExAdded,
@@ -225,41 +170,11 @@ WideString CFWL_DateTimePicker::FormatDateString(int32_t iYear,
}
void CFWL_DateTimePicker::ShowMonthCalendar(bool bActivate) {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_ShowMonthCalendar(bActivate);
- if (IsMonthCalendarVisible() == bActivate)
- return;
- if (!m_pForm)
- InitProxyForm();
-
- if (!bActivate) {
- m_pForm->EndDoModal();
- return;
- }
-
- CFX_RectF rtMonth = m_pMonthCal->GetWidgetRect();
-
- CFX_RectF rtAnchor(0, 0, m_pProperties->m_rtWidget.width,
- m_pProperties->m_rtWidget.height);
- GetPopupPos(0, rtMonth.height, rtAnchor, &rtMonth);
- m_pForm->SetWidgetRect(rtMonth);
-
- rtMonth.left = rtMonth.top = 0;
- if (bActivate)
- m_pMonthCal->RemoveStates(FWL_WGTSTATE_Invisible);
- else
- m_pMonthCal->SetStates(FWL_WGTSTATE_Invisible);
- m_pMonthCal->SetWidgetRect(rtMonth);
- m_pMonthCal->Update();
- m_pForm->DoModal();
+ return DisForm_ShowMonthCalendar(bActivate);
}
bool CFWL_DateTimePicker::IsMonthCalendarVisible() const {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_IsMonthCalendarVisible();
- if (!m_pForm)
- return false;
- return !(m_pForm->GetStates() & FWL_WGTSTATE_Invisible);
+ return DisForm_IsMonthCalendarVisible();
}
void CFWL_DateTimePicker::ResetEditAlignment() {
@@ -519,20 +434,7 @@ void CFWL_DateTimePicker::OnDrawWidget(CXFA_Graphics* pGraphics,
void CFWL_DateTimePicker::OnFocusChanged(CFWL_Message* pMsg, bool bSet) {
if (!pMsg)
return;
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_OnFocusChanged(pMsg, bSet);
-
- if (bSet) {
- m_pProperties->m_dwStates |= (FWL_WGTSTATE_Focused);
- RepaintRect(m_rtClient);
- } else {
- m_pProperties->m_dwStates &= ~(FWL_WGTSTATE_Focused);
- RepaintRect(m_rtClient);
- }
- if (pMsg->m_pSrcTarget == m_pMonthCal.get() && IsMonthCalendarVisible()) {
- ShowMonthCalendar(false);
- }
- RepaintRect(m_rtClient);
+ DisForm_OnFocusChanged(pMsg, bSet);
}
void CFWL_DateTimePicker::OnLButtonDown(CFWL_MessageMouse* pMsg) {
@@ -609,17 +511,6 @@ void CFWL_DateTimePicker::GetPopupPos(float fMinHeight,
float fMaxHeight,
const CFX_RectF& rtAnchor,
CFX_RectF* pPopupRect) {
- if (m_pWidgetMgr->IsFormDisabled()) {
- m_pWidgetMgr->GetAdapterPopupPos(this, fMinHeight, fMaxHeight, rtAnchor,
- pPopupRect);
- return;
- }
-
- CFX_PointF point = TransformTo(nullptr, CFX_PointF());
- float fPopupTop = (rtAnchor.bottom() + point.y > 0.0f)
- ? rtAnchor.top - pPopupRect->height
- : rtAnchor.bottom();
- *pPopupRect = CFX_RectF(rtAnchor.left, fPopupTop, pPopupRect->width,
- pPopupRect->height);
- pPopupRect->Offset(point.x, point.y);
+ m_pWidgetMgr->GetAdapterPopupPos(this, fMinHeight, fMaxHeight, rtAnchor,
+ pPopupRect);
}
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index dd7bcfae3a..7872369853 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -153,8 +153,6 @@ void CFWL_Edit::DrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) {
return;
IFWL_ThemeProvider* pTheme = m_pProperties->m_pThemeProvider;
- if (!m_pWidgetMgr->IsFormDisabled())
- DrawTextBk(pGraphics, pTheme, &matrix);
DrawContent(pGraphics, pTheme, &matrix);
if (HasBorder())
@@ -1275,17 +1273,6 @@ void CFWL_Edit::OnChar(CFWL_MessageKey* pMsg) {
}
break;
default: {
- if (!m_pWidgetMgr->IsFormDisabled()) {
- if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_Number) {
- if (((pMsg->m_dwKeyCode < FWL_VKEY_0) &&
- (pMsg->m_dwKeyCode != 0x2E && pMsg->m_dwKeyCode != 0x2D)) ||
- pMsg->m_dwKeyCode > FWL_VKEY_9) {
- break;
- }
- if (!ValidateNumberChar(c))
- break;
- }
- }
if (pMsg->m_dwFlags & kEditingModifier)
break;
diff --git a/xfa/fwl/cfwl_monthcalendar.cpp b/xfa/fwl/cfwl_monthcalendar.cpp
index f2bd845a19..9ee6d6670c 100644
--- a/xfa/fwl/cfwl_monthcalendar.cpp
+++ b/xfa/fwl/cfwl_monthcalendar.cpp
@@ -765,47 +765,7 @@ void CFWL_MonthCalendar::OnLButtonDown(CFWL_MessageMouse* pMsg) {
}
void CFWL_MonthCalendar::OnLButtonUp(CFWL_MessageMouse* pMsg) {
- if (m_pWidgetMgr->IsFormDisabled())
- return DisForm_OnLButtonUp(pMsg);
-
- if (m_rtLBtn.Contains(pMsg->m_pos)) {
- m_iLBtnPartStates = 0;
- RepaintRect(m_rtLBtn);
- return;
- }
- if (m_rtRBtn.Contains(pMsg->m_pos)) {
- m_iRBtnPartStates = 0;
- RepaintRect(m_rtRBtn);
- return;
- }
- if (m_rtToday.Contains(pMsg->m_pos))
- return;
-
- int32_t iOldSel = 0;
- if (!m_arrSelDays.empty())
- iOldSel = m_arrSelDays[0];
-
- int32_t iCurSel = GetDayAtPoint(pMsg->m_pos);
- CFWL_DateTimePicker* pIPicker = static_cast<CFWL_DateTimePicker*>(m_pOuter);
- if (iCurSel > 0) {
- DATEINFO* lpDatesInfo = m_arrDates[iCurSel - 1].get();
- CFX_RectF rtInvalidate(lpDatesInfo->rect);
- if (iOldSel > 0 && iOldSel <= pdfium::CollectionSize<int32_t>(m_arrDates)) {
- lpDatesInfo = m_arrDates[iOldSel - 1].get();
- rtInvalidate.Union(lpDatesInfo->rect);
- }
- AddSelDay(iCurSel);
- if (!m_pOuter)
- return;
-
- pIPicker->ProcessSelChanged(m_iCurYear, m_iCurMonth, iCurSel);
- pIPicker->ShowMonthCalendar(false);
- } else if (m_bFlag &&
- (!CFX_RectF(0, 0, pIPicker->GetFormProxy()->GetWidgetRect().Size())
- .Contains(pMsg->m_pos))) {
- pIPicker->ShowMonthCalendar(false);
- }
- m_bFlag = false;
+ return DisForm_OnLButtonUp(pMsg);
}
void CFWL_MonthCalendar::DisForm_OnLButtonUp(CFWL_MessageMouse* pMsg) {
diff --git a/xfa/fwl/cfwl_notedriver.cpp b/xfa/fwl/cfwl_notedriver.cpp
index 9a19f4b8a7..f585625882 100644
--- a/xfa/fwl/cfwl_notedriver.cpp
+++ b/xfa/fwl/cfwl_notedriver.cpp
@@ -185,11 +185,7 @@ CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() const {
}
void CFWL_NoteDriver::ProcessMessage(std::unique_ptr<CFWL_Message> pMessage) {
- CFWL_WidgetMgr* pWidgetMgr =
- pMessage->m_pDstTarget->GetOwnerApp()->GetWidgetMgr();
- CFWL_Widget* pMessageForm = pWidgetMgr->IsFormDisabled()
- ? pMessage->m_pDstTarget
- : GetMessageForm(pMessage->m_pDstTarget);
+ CFWL_Widget* pMessageForm = pMessage->m_pDstTarget;
if (!pMessageForm)
return;
@@ -239,50 +235,15 @@ bool CFWL_NoteDriver::DispatchMessage(CFWL_Message* pMessage,
bool CFWL_NoteDriver::DoSetFocus(CFWL_Message* pMessage,
CFWL_Widget* pMessageForm) {
- CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
- if (pWidgetMgr->IsFormDisabled()) {
- m_pFocus = pMessage->m_pDstTarget;
- return true;
- }
-
- CFWL_Widget* pWidget = pMessage->m_pDstTarget;
- if (!pWidget)
- return false;
-
- CFWL_Form* pForm = static_cast<CFWL_Form*>(pWidget);
- CFWL_Widget* pSubFocus = pForm->GetSubFocus();
- if (pSubFocus && ((pSubFocus->GetStates() & FWL_WGTSTATE_Focused) == 0)) {
- pMessage->m_pDstTarget = pSubFocus;
- if (m_pFocus != pMessage->m_pDstTarget) {
- m_pFocus = pMessage->m_pDstTarget;
- return true;
- }
- }
- return false;
+ m_pFocus = pMessage->m_pDstTarget;
+ return true;
}
bool CFWL_NoteDriver::DoKillFocus(CFWL_Message* pMessage,
CFWL_Widget* pMessageForm) {
- CFWL_WidgetMgr* pWidgetMgr = pMessageForm->GetOwnerApp()->GetWidgetMgr();
- if (pWidgetMgr->IsFormDisabled()) {
- if (m_pFocus == pMessage->m_pDstTarget)
- m_pFocus = nullptr;
- return true;
- }
-
- CFWL_Form* pForm = static_cast<CFWL_Form*>(pMessage->m_pDstTarget);
- if (!pForm)
- return false;
-
- CFWL_Widget* pSubFocus = pForm->GetSubFocus();
- if (pSubFocus && (pSubFocus->GetStates() & FWL_WGTSTATE_Focused)) {
- pMessage->m_pDstTarget = pSubFocus;
- if (m_pFocus == pMessage->m_pDstTarget) {
- m_pFocus = nullptr;
- return true;
- }
- }
- return false;
+ if (m_pFocus == pMessage->m_pDstTarget)
+ m_pFocus = nullptr;
+ return true;
}
bool CFWL_NoteDriver::DoKey(CFWL_Message* pMessage, CFWL_Widget* pMessageForm) {
diff --git a/xfa/fwl/cfwl_widget.cpp b/xfa/fwl/cfwl_widget.cpp
index e891cd1cbb..f7ba040866 100644
--- a/xfa/fwl/cfwl_widget.cpp
+++ b/xfa/fwl/cfwl_widget.cpp
@@ -161,44 +161,15 @@ FWL_WidgetHit CFWL_Widget::HitTest(const CFX_PointF& point) {
CFX_PointF CFWL_Widget::TransformTo(CFWL_Widget* pWidget,
const CFX_PointF& point) {
- if (m_pWidgetMgr->IsFormDisabled()) {
- CFX_SizeF szOffset;
- if (IsParent(pWidget)) {
- szOffset = GetOffsetFromParent(pWidget);
- } else {
- szOffset = pWidget->GetOffsetFromParent(this);
- szOffset.width = -szOffset.width;
- szOffset.height = -szOffset.height;
- }
- return point + CFX_PointF(szOffset.width, szOffset.height);
+ CFX_SizeF szOffset;
+ if (IsParent(pWidget)) {
+ szOffset = GetOffsetFromParent(pWidget);
+ } else {
+ szOffset = pWidget->GetOffsetFromParent(this);
+ szOffset.width = -szOffset.width;
+ szOffset.height = -szOffset.height;
}
-
- CFX_PointF ret = point;
- CFWL_Widget* parent = GetParent();
- if (parent)
- ret = GetMatrix().Transform(ret + GetWidgetRect().TopLeft());
-
- CFWL_Widget* form1 = m_pWidgetMgr->GetSystemFormWidget(this);
- if (!form1)
- return ret;
-
- if (!pWidget)
- return ret + form1->GetWidgetRect().TopLeft();
-
- CFWL_Widget* form2 = m_pWidgetMgr->GetSystemFormWidget(pWidget);
- if (!form2)
- return ret;
- if (form1 != form2) {
- ret += form1->GetWidgetRect().TopLeft();
- ret -= form2->GetWidgetRect().TopLeft();
- }
-
- parent = pWidget->GetParent();
- if (!parent)
- return ret;
-
- return pWidget->GetMatrix().GetInverse().Transform(ret) -
- pWidget->GetWidgetRect().TopLeft();
+ return point + CFX_PointF(szOffset.width, szOffset.height);
}
CFX_Matrix CFWL_Widget::GetMatrix() {
@@ -349,25 +320,7 @@ void CFWL_Widget::CalcTextRect(const WideString& wsText,
pTheme->CalcTextRect(&calPart, pRect);
}
-void CFWL_Widget::SetFocus(bool bFocus) {
- if (m_pWidgetMgr->IsFormDisabled())
- return;
-
- const CFWL_App* pApp = GetOwnerApp();
- if (!pApp)
- return;
-
- CFWL_NoteDriver* pDriver =
- static_cast<CFWL_NoteDriver*>(pApp->GetNoteDriver());
- if (!pDriver)
- return;
-
- CFWL_Widget* curFocus = pDriver->GetFocus();
- if (bFocus && curFocus != this)
- pDriver->SetFocus(this);
- else if (!bFocus && curFocus == this)
- pDriver->SetFocus(nullptr);
-}
+void CFWL_Widget::SetFocus(bool bFocus) {}
void CFWL_Widget::SetGrab(bool bSet) {
const CFWL_App* pApp = GetOwnerApp();
diff --git a/xfa/fwl/cfwl_widgetmgr.cpp b/xfa/fwl/cfwl_widgetmgr.cpp
index 32b275cd2e..2aab88bcb0 100644
--- a/xfa/fwl/cfwl_widgetmgr.cpp
+++ b/xfa/fwl/cfwl_widgetmgr.cpp
@@ -29,8 +29,7 @@ struct FWL_NEEDREPAINTHITDATA {
} // namespace
CFWL_WidgetMgr::CFWL_WidgetMgr(CXFA_FFApp* pAdapterNative)
- : m_dwCapability(FWL_WGTMGR_DisableForm),
- m_pAdapter(pAdapterNative->GetFWLAdapterWidgetMgr()) {
+ : m_pAdapter(pAdapterNative->GetFWLAdapterWidgetMgr()) {
ASSERT(m_pAdapter);
m_mapWidgetItem[nullptr] = pdfium::MakeUnique<Item>();
#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_
@@ -147,24 +146,13 @@ void CFWL_WidgetMgr::RepaintWidget(CFWL_Widget* pWidget,
CFWL_Widget* pNative = pWidget;
CFX_RectF transformedRect = rect;
- if (IsFormDisabled()) {
- CFWL_Widget* pOuter = pWidget->GetOuter();
- while (pOuter) {
- CFX_RectF rtTemp = pNative->GetWidgetRect();
- transformedRect.left += rtTemp.left;
- transformedRect.top += rtTemp.top;
- pNative = pOuter;
- pOuter = pOuter->GetOuter();
- }
- } else if (!IsAbleNative(pWidget)) {
- pNative = GetSystemFormWidget(pWidget);
- if (!pNative)
- return;
-
- CFX_PointF pos = pWidget->TransformTo(
- pNative, CFX_PointF(transformedRect.left, transformedRect.top));
- transformedRect.left = pos.x;
- transformedRect.top = pos.y;
+ CFWL_Widget* pOuter = pWidget->GetOuter();
+ while (pOuter) {
+ CFX_RectF rtTemp = pNative->GetWidgetRect();
+ transformedRect.left += rtTemp.left;
+ transformedRect.top += rtTemp.top;
+ pNative = pOuter;
+ pOuter = pOuter->GetOuter();
}
AddRedrawCounts(pNative);
m_pAdapter->RepaintWidget(pNative);
@@ -403,10 +391,7 @@ void CFWL_WidgetMgr::OnProcessMessageToForm(CFWL_Message* pMessage) {
if (!pNoteDriver)
return;
- if (IsFormDisabled())
- pNoteDriver->ProcessMessage(pMessage->Clone());
- else
- pNoteDriver->QueueMessage(pMessage->Clone());
+ pNoteDriver->ProcessMessage(pMessage->Clone());
#if (_FX_OS_ == _FX_OS_MACOSX_)
CFWL_NoteLoop* pTopLoop = pNoteDriver->GetTopLoop();
@@ -424,26 +409,10 @@ void CFWL_WidgetMgr::OnDrawWidget(CFWL_Widget* pWidget,
CFX_RectF clipCopy(0, 0, pWidget->GetWidgetRect().Size());
CFX_RectF clipBounds;
-#if _FX_OS_ == _FX_OS_MACOSX_
- if (IsFormDisabled()) {
-#endif // _FX_OS_ == _FX_OS_MACOSX_
-
- pWidget->GetDelegate()->OnDrawWidget(pGraphics, matrix);
- clipBounds = pGraphics->GetClipRect();
- clipCopy = clipBounds;
-
-#if _FX_OS_ == _FX_OS_MACOSX_
- } else {
- clipBounds = CFX_RectF(matrix.a, matrix.b, matrix.c, matrix.d);
- // FIXME: const cast
- CFX_Matrix* pMatrixHack = const_cast<CFX_Matrix*>(&matrix);
- pMatrixHack->SetIdentity();
- pWidget->GetDelegate()->OnDrawWidget(pGraphics, *pMatrixHack);
- }
-#endif // _FX_OS_ == _FX_OS_MACOSX_
+ pWidget->GetDelegate()->OnDrawWidget(pGraphics, matrix);
+ clipBounds = pGraphics->GetClipRect();
+ clipCopy = clipBounds;
- if (!IsFormDisabled())
- clipBounds.Intersect(pWidget->GetClientRect());
if (!clipBounds.IsEmpty())
DrawChild(pWidget, clipBounds, pGraphics, &matrix);
@@ -458,7 +427,6 @@ void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent,
if (!parent)
return;
- bool bFormDisable = IsFormDisabled();
CFWL_Widget* pNextChild = GetFirstChildWidget(parent);
while (pNextChild) {
CFWL_Widget* child = pNextChild;
@@ -472,33 +440,15 @@ void CFWL_WidgetMgr::DrawChild(CFWL_Widget* parent,
CFX_Matrix widgetMatrix;
CFX_RectF clipBounds(rtWidget);
- if (!bFormDisable)
- widgetMatrix = child->GetMatrix();
if (pMatrix)
widgetMatrix.Concat(*pMatrix);
- if (!bFormDisable) {
- CFX_PointF pos = widgetMatrix.Transform(clipBounds.TopLeft());
- clipBounds.left = pos.x;
- clipBounds.top = pos.y;
- clipBounds.Intersect(rtClip);
- if (clipBounds.IsEmpty())
- continue;
-
- pGraphics->SaveGraphState();
- pGraphics->SetClipRect(clipBounds);
- }
widgetMatrix.Translate(rtWidget.left, rtWidget.top, true);
- if (IFWL_WidgetDelegate* pDelegate = child->GetDelegate()) {
- if (IsFormDisabled() || IsNeedRepaint(child, &widgetMatrix, rtClip))
- pDelegate->OnDrawWidget(pGraphics, widgetMatrix);
- }
- if (!bFormDisable)
- pGraphics->RestoreGraphState();
+ if (IFWL_WidgetDelegate* pDelegate = child->GetDelegate())
+ pDelegate->OnDrawWidget(pGraphics, widgetMatrix);
- DrawChild(child, clipBounds, pGraphics,
- bFormDisable ? &widgetMatrix : pMatrix);
+ DrawChild(child, clipBounds, pGraphics, &widgetMatrix);
child = GetNextSiblingWidget(child);
}
}
diff --git a/xfa/fwl/cfwl_widgetmgr.h b/xfa/fwl/cfwl_widgetmgr.h
index 8a6e974447..536dce9d2b 100644
--- a/xfa/fwl/cfwl_widgetmgr.h
+++ b/xfa/fwl/cfwl_widgetmgr.h
@@ -56,10 +56,6 @@ class CFWL_WidgetMgr {
CFWL_Widget* GetDefaultButton(CFWL_Widget* pParent) const;
void AddRedrawCounts(CFWL_Widget* pWidget);
- bool IsFormDisabled() const {
- return !!(m_dwCapability & FWL_WGTMGR_DisableForm);
- }
-
void GetAdapterPopupPos(CFWL_Widget* pWidget,
float fMinHeight,
float fMaxHeight,
@@ -111,7 +107,6 @@ class CFWL_WidgetMgr {
bool IsAbleNative(CFWL_Widget* pWidget) const;
- uint32_t m_dwCapability;
std::map<CFWL_Widget*, std::unique_ptr<Item>> m_mapWidgetItem;
UnownedPtr<CXFA_FWLAdapterWidgetMgr> const m_pAdapter;
#if _FX_PLATFORM_ == _FX_PLATFORM_WINDOWS_