diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-13 13:59:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-20 20:24:16 +0200 |
commit | 68d161c6803654f4ce816af7e79371a2d3497b4f (patch) | |
tree | 97cc8e55906b91ac966d7b1c09bdfcf51e8480f9 /reportdesign | |
parent | 96536d92e8026cebfde11e5539ee90471d0e7933 (diff) |
weld ComboBoxControl
Change-Id: Ie862bb782b4c3e203af88d45c850ce0cab60f2e5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94123
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'reportdesign')
-rw-r--r-- | reportdesign/source/ui/dlg/GroupsSorting.cxx | 47 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/GroupsSorting.hxx | 2 |
2 files changed, 23 insertions, 26 deletions
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 69ff9786cc3b..8cb3a65347f1 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -52,7 +52,7 @@ using namespace ::com::sun::star; using namespace svt; using namespace ::comphelper; - static void lcl_addToList_throw( ComboBoxControl& _rListBox, ::std::vector<ColumnInfo>& o_aColumnList,const uno::Reference< container::XNameAccess>& i_xColumns ) + static void lcl_addToList_throw( weld::ComboBox& _rListBox, ::std::vector<ColumnInfo>& o_aColumnList,const uno::Reference< container::XNameAccess>& i_xColumns ) { const uno::Sequence< OUString > aEntries = i_xColumns->getElementNames(); for ( const OUString& rEntry : aEntries ) @@ -63,9 +63,9 @@ using namespace ::comphelper; xColumn->getPropertyValue(PROPERTY_LABEL) >>= sLabel; o_aColumnList.emplace_back(rEntry,sLabel ); if ( !sLabel.isEmpty() ) - _rListBox.InsertEntry( sLabel ); + _rListBox.append_text( sLabel ); else - _rListBox.InsertEntry( rEntry ); + _rListBox.append_text( rEntry ); } } @@ -159,7 +159,7 @@ protected: private: - DECL_LINK( CBChangeHdl, ComboBox&, void); + DECL_LINK( CBChangeHdl, weld::ComboBox&, void); public: DECL_LINK( DelayedDelete, void*, void ); @@ -266,8 +266,9 @@ sal_Int8 OFieldExpressionControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt sal_Int8 nAction = DND_ACTION_NONE; if ( IsEditing() ) { - sal_Int32 nPos = m_pComboCell->GetSelectedEntryPos(); - if ( COMBOBOX_ENTRY_NOTFOUND != nPos || !m_pComboCell->GetText().isEmpty() ) + weld::ComboBox& rComboBox = m_pComboCell->get_widget(); + sal_Int32 nPos = rComboBox.get_active(); + if (nPos != -1 || !rComboBox.get_active_text().isEmpty()) SaveModified(); DeactivateCell(); } @@ -339,9 +340,10 @@ void OFieldExpressionControl::moveGroups(const uno::Sequence<uno::Any>& _aGroups void OFieldExpressionControl::fillColumns(const uno::Reference< container::XNameAccess>& _xColumns) { - m_pComboCell->Clear(); + weld::ComboBox& rComboBox = m_pComboCell->get_widget(); + rComboBox.clear(); if ( _xColumns.is() ) - lcl_addToList_throw(*m_pComboCell,m_aColumnInfo,_xColumns); + lcl_addToList_throw(rComboBox, m_aColumnInfo, _xColumns); } void OFieldExpressionControl::lateInit() @@ -368,10 +370,11 @@ void OFieldExpressionControl::lateInit() InsertDataColumn( FIELD_EXPRESSION, RptResId(STR_RPT_EXPRESSION), 100); m_pComboCell = VclPtr<ComboBoxControl>::Create( &GetDataWindow() ); - m_pComboCell->SetSelectHdl(LINK(this,OFieldExpressionControl,CBChangeHdl)); + weld::ComboBox& rComboBox = m_pComboCell->get_widget(); + rComboBox.connect_changed(LINK(this,OFieldExpressionControl,CBChangeHdl)); m_pComboCell->SetHelpId(HID_RPT_FIELDEXPRESSION); - m_pComboCell->SetGetFocusHdl(LINK(m_pParent, OGroupsSortingDialog, OnControlFocusGot)); + rComboBox.connect_focus_in(LINK(m_pParent, OGroupsSortingDialog, OnControlFocusGot)); // set browse mode @@ -389,20 +392,16 @@ void OFieldExpressionControl::lateInit() RowInserted(0, m_aGroupPositions.size()); } - -IMPL_LINK_NOARG( OFieldExpressionControl, CBChangeHdl, ComboBox&, void ) +IMPL_LINK_NOARG( OFieldExpressionControl, CBChangeHdl, weld::ComboBox&, void ) { - SaveModified(); } - bool OFieldExpressionControl::IsTabAllowed(bool /*bForward*/) const { return false; } - bool OFieldExpressionControl::SaveModified() { sal_Int32 nRow = GetCurRow(); @@ -447,10 +446,11 @@ bool OFieldExpressionControl::SaveModified() xGroup = m_pParent->getGroup(m_aGroupPositions[nRow]); if ( xGroup.is() ) { - sal_Int32 nPos = m_pComboCell->GetSelectedEntryPos(); + weld::ComboBox& rComboBox = m_pComboCell->get_widget(); + sal_Int32 nPos = rComboBox.get_active(); OUString sExpression; - if ( COMBOBOX_ENTRY_NOTFOUND == nPos ) - sExpression = m_pComboCell->GetText(); + if (nPos == -1) + sExpression = rComboBox.get_active_text(); else { sExpression = m_aColumnInfo[nPos].sColumnName; @@ -507,11 +507,10 @@ OUString OFieldExpressionControl::GetCellText( long nRow, sal_uInt16 /*nColId*/ return sText; } - void OFieldExpressionControl::InitController( CellControllerRef& /*rController*/, long nRow, sal_uInt16 nColumnId ) { - - m_pComboCell->SetText( GetCellText( nRow, nColumnId ) ); + weld::ComboBox& rComboBox = m_pComboCell->get_widget(); + rComboBox.set_entry_text(GetCellText(nRow, nColumnId)); } bool OFieldExpressionControl::CursorMoving(long nNewRow, sal_uInt16 nNewCol) @@ -532,11 +531,10 @@ bool OFieldExpressionControl::CursorMoving(long nNewRow, sal_uInt16 nNewCol) CellController* OFieldExpressionControl::GetController( long /*nRow*/, sal_uInt16 /*nColumnId*/ ) { ComboBoxCellController* pCellController = new ComboBoxCellController( m_pComboCell ); - pCellController->GetComboBox().SetReadOnly(!m_pParent->m_pController->isEditable()); + pCellController->GetComboBox().set_entry_editable(m_pParent->m_pController->isEditable()); return pCellController; } - bool OFieldExpressionControl::SeekRow( long _nRow ) { // the basis class needs the call, because that's how the class knows which line will be painted @@ -545,7 +543,6 @@ bool OFieldExpressionControl::SeekRow( long _nRow ) return true; } - void OFieldExpressionControl::PaintCell( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId ) const { OUString aText =GetCellText( m_nCurrentPos, nColumnId ); @@ -930,7 +927,7 @@ sal_Int32 OGroupsSortingDialog::getColumnDataType(const OUString& _sColumnName) return nDataType; } -IMPL_LINK_NOARG(OGroupsSortingDialog, OnControlFocusGot, Control&, void ) +IMPL_LINK_NOARG(OGroupsSortingDialog, OnControlFocusGot, weld::Widget&, void ) { m_xHelpWindow->set_label(RptResId(STR_RPT_HELP_FIELD)); } diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx index 270484a19b3c..cd038e6164c4 100644 --- a/reportdesign/source/ui/inc/GroupsSorting.hxx +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -74,7 +74,7 @@ private: DECL_LINK( OnWidgetFocusLost, weld::Widget&, void ); DECL_LINK( OnWidgetFocusGot, weld::Widget&, void ); - DECL_LINK( OnControlFocusGot, Control&, void ); + DECL_LINK( OnControlFocusGot, weld::Widget&, void ); DECL_LINK( LBChangeHdl, weld::ComboBox&, void ); DECL_LINK( OnFormatAction, const OString&, void ); |