diff options
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.cpp | 26 | ||||
-rw-r--r-- | xfa/fwl/core/cfwl_combobox.h | 6 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffchoicelist.cpp | 20 |
3 files changed, 23 insertions, 29 deletions
diff --git a/xfa/fwl/core/cfwl_combobox.cpp b/xfa/fwl/core/cfwl_combobox.cpp index 2d59b7d5ec..8cc1e18873 100644 --- a/xfa/fwl/core/cfwl_combobox.cpp +++ b/xfa/fwl/core/cfwl_combobox.cpp @@ -252,12 +252,10 @@ void CFWL_ComboBox::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { m_pEdit->SetThemeProvider(pThemeProvider); } -void CFWL_ComboBox::GetTextByIndex(int32_t iIndex, - CFX_WideString& wsText) const { +CFX_WideString CFWL_ComboBox::GetTextByIndex(int32_t iIndex) const { CFWL_ListItem* pItem = static_cast<CFWL_ListItem*>( m_pListBox->GetItem(m_pListBox.get(), iIndex)); - if (pItem) - wsText = pItem->m_wsText; + return pItem ? pItem->m_wsText : L""; } void CFWL_ComboBox::SetCurSel(int32_t iSel) { @@ -314,20 +312,19 @@ void CFWL_ComboBox::OpenDropDownList(bool bActivate) { ShowDropList(bActivate); } -void CFWL_ComboBox::GetBBox(CFX_RectF& rect) const { - if (m_pWidgetMgr->IsFormDisabled()) { - DisForm_GetBBox(rect); - return; - } +CFX_RectF CFWL_ComboBox::GetBBox() const { + if (m_pWidgetMgr->IsFormDisabled()) + return DisForm_GetBBox(); - rect = m_pProperties->m_rtWidget; + CFX_RectF rect = m_pProperties->m_rtWidget; if (!m_pListBox || !IsDropListVisible()) - return; + return rect; CFX_RectF rtList; m_pListBox->GetWidgetRect(rtList, false); rtList.Offset(rect.left, rect.top); rect.Union(rtList); + return rect; } void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, @@ -737,15 +734,16 @@ void CFWL_ComboBox::DisForm_DrawWidget(CFX_Graphics* pGraphics, } } -void CFWL_ComboBox::DisForm_GetBBox(CFX_RectF& rect) const { - rect = m_pProperties->m_rtWidget; +CFX_RectF CFWL_ComboBox::DisForm_GetBBox() const { + CFX_RectF rect = m_pProperties->m_rtWidget; if (!m_pListBox || !DisForm_IsDropListVisible()) - return; + return rect; CFX_RectF rtList; m_pListBox->GetWidgetRect(rtList, false); rtList.Offset(rect.left, rect.top); rect.Union(rtList); + return rect; } void CFWL_ComboBox::DisForm_Layout() { diff --git a/xfa/fwl/core/cfwl_combobox.h b/xfa/fwl/core/cfwl_combobox.h index 812a6d0a29..b10a571b2c 100644 --- a/xfa/fwl/core/cfwl_combobox.h +++ b/xfa/fwl/core/cfwl_combobox.h @@ -68,7 +68,7 @@ class CFWL_ComboBox : public CFWL_Widget { void OnDrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix) override; - void GetTextByIndex(int32_t iIndex, CFX_WideString& wsText) const; + CFX_WideString GetTextByIndex(int32_t iIndex) const; int32_t GetCurSel() const { return m_iCurSel; } void SetCurSel(int32_t iSel); @@ -101,7 +101,7 @@ class CFWL_ComboBox : public CFWL_Widget { void EditDelete() { m_pEdit->ClearText(); } void EditDeSelect() { m_pEdit->ClearSelections(); } - void GetBBox(CFX_RectF& rect) const; + CFX_RectF GetBBox() const; void EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved); void DrawStretchHandler(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); @@ -146,7 +146,7 @@ class CFWL_ComboBox : public CFWL_Widget { void DisForm_Update(); FWL_WidgetHit DisForm_HitTest(FX_FLOAT fx, FX_FLOAT fy); void DisForm_DrawWidget(CFX_Graphics* pGraphics, const CFX_Matrix* pMatrix); - void DisForm_GetBBox(CFX_RectF& rect) const; + CFX_RectF DisForm_GetBBox() const; void DisForm_Layout(); void DisForm_OnProcessMessage(CFWL_Message* pMessage); void DisForm_OnLButtonDown(CFWL_MsgMouse* pMsg); diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index d4cfe07202..e8c364a613 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -227,16 +227,13 @@ bool CXFA_FFComboBox::GetBBox(CFX_RectF& rtBox, } bool CXFA_FFComboBox::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { - if (!m_pNormalWidget) { + if (!m_pNormalWidget) return false; - } - CFX_RectF rtWidget; - ((CFWL_ComboBox*)m_pNormalWidget)->GetBBox(rtWidget); - if (rtWidget.Contains(fx, fy)) { - return true; - } - return false; + return static_cast<CFWL_ComboBox*>(m_pNormalWidget) + ->GetBBox() + .Contains(fx, fy); } + bool CXFA_FFComboBox::LoadWidget() { CFWL_ComboBox* pComboBox = new CFWL_ComboBox(GetFWLApp()); m_pNormalWidget = (CFWL_Widget*)pComboBox; @@ -321,12 +318,11 @@ bool CXFA_FFComboBox::IsDataChanged() { CFX_WideString wsText = pFWLcombobox->GetEditText(); int32_t iCursel = pFWLcombobox->GetCurSel(); if (iCursel >= 0) { - CFX_WideString wsSel; - pFWLcombobox->GetTextByIndex(iCursel, wsSel); - if (wsSel == wsText) { + CFX_WideString wsSel = pFWLcombobox->GetTextByIndex(iCursel); + if (wsSel == wsText) m_pDataAcc->GetChoiceListItem(wsText, iCursel, true); - } } + CFX_WideString wsOldValue; m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Raw); if (wsOldValue != wsText) { |