diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-05-13 16:57:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-05-21 09:53:46 +0200 |
commit | 8477bbf8d6867e656b8132f0ddd682d08590a547 (patch) | |
tree | 11d1f70190b6478bf3b070480393f364d58c81ab /dbaccess | |
parent | c764b37489fb5f639c9e1c4faba64ebe405cc347 (diff) |
weld ListBoxControl
Change-Id: I5a8c7d68e4c147eb938b0217dc6368c832e465c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94154
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/control/RelationControl.cxx | 21 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/indexfieldscontrol.cxx | 44 | ||||
-rw-r--r-- | dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx | 120 | ||||
-rw-r--r-- | dbaccess/source/ui/tabledesign/TEditControl.cxx | 23 |
4 files changed, 118 insertions, 90 deletions
diff --git a/dbaccess/source/ui/control/RelationControl.cxx b/dbaccess/source/ui/control/RelationControl.cxx index 14c923c3bf26..041e7a50378c 100644 --- a/dbaccess/source/ui/control/RelationControl.cxx +++ b/dbaccess/source/ui/control/RelationControl.cxx @@ -218,7 +218,8 @@ namespace dbaui long nRow = GetCurRow(); if ( nRow != BROWSER_ENDOFSELECTION ) { - OUString sFieldName(m_pListCell->GetSelectedEntry()); + weld::ComboBox& rListBox = m_pListCell->get_widget(); + OUString sFieldName(rListBox.get_active_text()); OConnectionLineDataVec& rLines = m_pConnData->GetConnLineDataList(); if ( rLines.size() <= o3tl::make_unsigned(nRow) ) { @@ -307,14 +308,15 @@ namespace dbaui fillListBox(xDef); OUString sName = GetCellText( nRow, nColumnId ); - m_pListCell->SelectEntry( sName ); - if ( m_pListCell->GetSelectedEntry() != sName ) + weld::ComboBox& rList = m_pListCell->get_widget(); + rList.set_active_text(sName); + if (rList.get_active_text() != sName) { - m_pListCell->InsertEntry( sName ); - m_pListCell->SelectEntry( sName ); + rList.append_text(sName); + rList.set_active_text(sName); } - m_pListCell->SetHelpId(sHelpId); + rList.set_help_id(sHelpId); } CellController* ORelationControl::GetController( long /*nRow*/, sal_uInt16 /*nColumnId*/ ) @@ -348,7 +350,8 @@ namespace dbaui } void ORelationControl::fillListBox(const Reference< XPropertySet>& _xDest) { - m_pListCell->Clear(); + weld::ComboBox& rList = m_pListCell->get_widget(); + rList.clear(); try { if ( _xDest.is() ) @@ -361,9 +364,9 @@ namespace dbaui const OUString* pEnd = pIter + aNames.getLength(); for(;pIter != pEnd;++pIter) { - m_pListCell->InsertEntry( *pIter ); + rList.append_text(*pIter); } - m_pListCell->InsertEntry(OUString(), 0); + rList.insert_text(0, OUString()); } } catch( const Exception& ) diff --git a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx index 9f11f0ee09a8..8676ff24d97a 100644 --- a/dbaccess/source/ui/dlg/indexfieldscontrol.cxx +++ b/dbaccess/source/ui/dlg/indexfieldscontrol.cxx @@ -208,9 +208,10 @@ static constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | Br InsertDataColumn(COLUMN_ID_ORDER, sColumnName, nSortOrderColumnWidth, HeaderBarItemBits::STDSTYLE, 1); m_pSortingCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); - m_pSortingCell->InsertEntry(m_sAscendingText); - m_pSortingCell->InsertEntry(m_sDescendingText); - m_pSortingCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_SORTORDER ); + weld::ComboBox& rSortingListBox = m_pSortingCell->get_widget(); + rSortingListBox.append_text(m_sAscendingText); + rSortingListBox.append_text(m_sDescendingText); + rSortingListBox.set_help_id(HID_DLGINDEX_INDEXDETAILS_SORTORDER); nFieldNameWidth -= nSortOrderColumnWidth; } @@ -224,12 +225,13 @@ static constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | Br // create the cell controllers // for the field name cell m_pFieldNameCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); - m_pFieldNameCell->InsertEntry(OUString()); - m_pFieldNameCell->SetHelpId( HID_DLGINDEX_INDEXDETAILS_FIELD ); + weld::ComboBox& rNameListBox = m_pFieldNameCell->get_widget(); + rNameListBox.append_text(OUString()); + rNameListBox.set_help_id(HID_DLGINDEX_INDEXDETAILS_FIELD); const OUString* pFields = _rAvailableFields.getConstArray(); const OUString* pFieldsEnd = pFields + _rAvailableFields.getLength(); for (;pFields < pFieldsEnd; ++pFields) - m_pFieldNameCell->InsertEntry(*pFields); + rNameListBox.append_text(*pFields); } CellController* IndexFieldsControl::GetController(long _nRow, sal_uInt16 _nColumnId) @@ -280,7 +282,8 @@ static constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | Br { case COLUMN_ID_FIELDNAME: { - OUString sFieldSelected = m_pFieldNameCell->GetSelectedEntry(); + weld::ComboBox& rNameListBox = m_pFieldNameCell->get_widget(); + OUString sFieldSelected = rNameListBox.get_active_text(); bool bEmptySelected = sFieldSelected.isEmpty(); if (isNewField()) { @@ -326,8 +329,9 @@ static constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | Br { OSL_ENSURE(!isNewField(), "IndexFieldsControl::SaveModified: why the hell ...!!!"); // selected entry - sal_Int32 nPos = m_pSortingCell->GetSelectedEntryPos(); - OSL_ENSURE(LISTBOX_ENTRY_NOTFOUND != nPos, "IndexFieldsControl::SaveModified: how did you get this selection??"); + weld::ComboBox& rSortingListBox = m_pSortingCell->get_widget(); + sal_Int32 nPos = rSortingListBox.get_active(); + OSL_ENSURE(nPos != -1, "IndexFieldsControl::SaveModified: how did you get this selection??"); // adjust the sort flag in the index field description OIndexField& rCurrentField = m_aFields[GetCurRow()]; rCurrentField.bSortAscending = (0 == nPos); @@ -348,14 +352,20 @@ static constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | Br switch (_nColumnId) { case COLUMN_ID_FIELDNAME: - m_pFieldNameCell->SelectEntry(bNewField ? OUString() : aFieldDescription->sFieldName); - m_pFieldNameCell->SaveValue(); + { + weld::ComboBox& rNameListBox = m_pFieldNameCell->get_widget(); + rNameListBox.set_active_text(bNewField ? OUString() : aFieldDescription->sFieldName); + rNameListBox.save_value(); break; + } case COLUMN_ID_ORDER: - m_pSortingCell->SelectEntry(aFieldDescription->bSortAscending ? m_sAscendingText : m_sDescendingText); - m_pSortingCell->SaveValue(); + { + weld::ComboBox& rSortingListBox = m_pSortingCell->get_widget(); + rSortingListBox.set_active_text(aFieldDescription->bSortAscending ? m_sAscendingText : m_sDescendingText); + rSortingListBox.save_value(); break; + } default: OSL_FAIL("IndexFieldsControl::InitController: invalid column id!"); @@ -364,17 +374,17 @@ static constexpr auto BROWSER_STANDARD_FLAGS = BrowserMode::COLUMNSELECTION | Br IMPL_LINK( IndexFieldsControl, OnListEntrySelected, DbaMouseDownListBoxController&, rController, void ) { - ListBoxControl& rListBox = rController.GetListBox(); - if (!rListBox.IsTravelSelect()) + weld::ComboBox& rListBox = rController.GetListBox(); + if (!rListBox.get_popup_shown()) m_aModifyHdl.Call(*this); - if (&rListBox != m_pFieldNameCell.get()) + if (&rListBox != &m_pFieldNameCell->get_widget()) return; // a field has been selected if (GetCurRow() >= GetRowCount() - 2) { // and we're in one of the last two rows - OUString sSelectedEntry = m_pFieldNameCell->GetSelectedEntry(); + OUString sSelectedEntry = rListBox.get_active_text(); sal_Int32 nCurrentRow = GetCurRow(); sal_Int32 rowCount = GetRowCount(); diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index c2b4cd9517d8..98d782d8d4fd 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -121,14 +121,15 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent ) m_pTextCell = VclPtr<Edit>::Create(&GetDataWindow(), 0); m_pVisibleCell = VclPtr<CheckBoxControl>::Create(&GetDataWindow()); - m_pTableCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); m_pTableCell->SetDropDownLineCount( 20 ); + m_pTableCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); m_pFieldCell = VclPtr<ComboBoxControl>::Create(&GetDataWindow()); m_pOrderCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); - m_pFunctionCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); m_pFunctionCell->SetDropDownLineCount( 20 ); + m_pFunctionCell = VclPtr<ListBoxControl>::Create(&GetDataWindow()); m_pVisibleCell->SetHelpId(HID_QRYDGN_ROW_VISIBLE); m_pTableCell->SetHelpId(HID_QRYDGN_ROW_TABLE); m_pFieldCell->SetHelpId(HID_QRYDGN_ROW_FIELD); + weld::ComboBox& rOrderBox = m_pOrderCell->get_widget(); m_pOrderCell->SetHelpId(HID_QRYDGN_ROW_ORDER); m_pFunctionCell->SetHelpId(HID_QRYDGN_ROW_FUNCTION); @@ -141,7 +142,7 @@ OSelectionBrowseBox::OSelectionBrowseBox( vcl::Window* pParent ) const OUString aTxt(DBA_RES(STR_QUERY_SORTTEXT)); for (sal_Int32 nIdx {0}; nIdx>=0;) - m_pOrderCell->InsertEntry(aTxt.getToken(0, ';', nIdx)); + rOrderBox.append_text(aTxt.getToken(0, ';', nIdx)); m_bVisibleRow.insert(m_bVisibleRow.end(), BROW_ROW_CNT, true); @@ -202,13 +203,15 @@ void OSelectionBrowseBox::initialize() // We slip in a few optionals one, too. if ( lcl_SupportsCoreSQLGrammar(xConnection) ) { + weld::ComboBox& rComboBox = m_pFunctionCell->get_widget(); for (sal_Int32 nIdx {0}; nIdx>=0;) - m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(0, ';', nIdx)); + rComboBox.append_text(m_aFunctionStrings.getToken(0, ';', nIdx)); } else // else only COUNT(*) and COUNT("table".*) { - m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(0, ';')); - m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(2, ';')); // 2 -> COUNT + weld::ComboBox& rComboBox = m_pFunctionCell->get_widget(); + rComboBox.append_text(m_aFunctionStrings.getToken(0, ';')); + rComboBox.append_text(m_aFunctionStrings.getToken(2, ';')); // 2 -> COUNT } try { @@ -493,18 +496,19 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon } break; case BROW_TABLE_ROW: { - m_pTableCell->Clear(); - enableControl(pEntry,m_pTableCell); + weld::ComboBox& rComboBox = m_pTableCell->get_widget(); + rComboBox.clear(); + enableControl(pEntry, m_pTableCell); if ( !pEntry->isCondition() ) { for (auto const& tabWin : getDesignView()->getTableView()->GetTabWinMap()) - m_pTableCell->InsertEntry(static_cast<OQueryTableWindow*>(tabWin.second.get())->GetAliasName()); + rComboBox.append_text(static_cast<OQueryTableWindow*>(tabWin.second.get())->GetAliasName()); - m_pTableCell->InsertEntry(DBA_RES(STR_QUERY_NOTABLE), 0); + rComboBox.insert_text(0, DBA_RES(STR_QUERY_NOTABLE)); if (!pEntry->GetAlias().isEmpty()) - m_pTableCell->SelectEntry(pEntry->GetAlias()); + rComboBox.set_active_text(pEntry->GetAlias()); else - m_pTableCell->SelectEntry(DBA_RES(STR_QUERY_NOTABLE)); + rComboBox.set_active_text(DBA_RES(STR_QUERY_NOTABLE)); } } break; case BROW_VIS_ROW: @@ -531,10 +535,13 @@ void OSelectionBrowseBox::InitController(CellControllerRef& /*rController*/, lon } } break; case BROW_ORDER_ROW: - m_pOrderCell->SelectEntryPos( + { + weld::ComboBox& rComboBox = m_pOrderCell->get_widget(); + rComboBox.set_active( sal::static_int_cast< sal_uInt16 >(pEntry->GetOrderDir())); enableControl(pEntry,m_pOrderCell); break; + } case BROW_COLUMNALIAS_ROW: setTextCellContext(pEntry,pEntry->GetFieldAlias(),HID_QRYDGN_ROW_ALIAS); break; @@ -983,9 +990,10 @@ bool OSelectionBrowseBox::SaveModified() case BROW_TABLE_ROW: { - OUString aAliasName = m_pTableCell->GetSelectedEntry(); + weld::ComboBox& rComboBox = m_pTableCell->get_widget(); + OUString aAliasName = rComboBox.get_active_text(); strOldCellContents = pEntry->GetAlias(); - if ( m_pTableCell->GetSelectedEntryPos() != 0 ) + if (rComboBox.get_active() != 0) { pEntry->SetAlias(aAliasName); // we have to set the table name as well as the table window @@ -1014,8 +1022,9 @@ bool OSelectionBrowseBox::SaveModified() case BROW_ORDER_ROW: { strOldCellContents = OUString::number(static_cast<sal_uInt16>(pEntry->GetOrderDir())); - sal_Int32 nIdx = m_pOrderCell->GetSelectedEntryPos(); - if (nIdx == LISTBOX_ENTRY_NOTFOUND) + weld::ComboBox& rComboBox = m_pOrderCell->get_widget(); + sal_Int32 nIdx = rComboBox.get_active(); + if (nIdx == -1) nIdx = 0; pEntry->SetOrderDir(EOrderDir(nIdx)); if(!m_bOrderByUnRelated) @@ -1035,9 +1044,10 @@ bool OSelectionBrowseBox::SaveModified() case BROW_FUNCTION_ROW: { strOldCellContents = pEntry->GetFunction(); - sal_Int32 nPos = m_pFunctionCell->GetSelectedEntryPos(); + weld::ComboBox& rComboBox = m_pFunctionCell->get_widget(); + sal_Int32 nPos = rComboBox.get_active(); // these functions are only available in CORE - OUString sFunctionName = m_pFunctionCell->GetEntry(nPos); + OUString sFunctionName = rComboBox.get_text(nPos); OUString sGroupFunctionName = m_aFunctionStrings.copy(m_aFunctionStrings.lastIndexOf(';')+1); bool bGroupBy = false; if ( sGroupFunctionName == sFunctionName ) // check if the function name is GROUP @@ -1856,9 +1866,10 @@ void OSelectionBrowseBox::CellModified() { OTableFieldDescRef pEntry = getEntry(GetColumnPos(GetCurColumnId()) - 1); - sal_Int32 nIdx = m_pOrderCell->GetSelectedEntryPos(); + weld::ComboBox& rComboBox = m_pOrderCell->get_widget(); + sal_Int32 nIdx = rComboBox.get_active(); if(!m_bOrderByUnRelated && nIdx > 0 && - nIdx != LISTBOX_ENTRY_NOTFOUND && + nIdx != -1 && !pEntry->IsEmpty() && pEntry->GetOrderDir() != ORDER_NONE) { @@ -2137,52 +2148,53 @@ OUString OSelectionBrowseBox::GetCellText(long nRow, sal_uInt16 nColId) const bool OSelectionBrowseBox::GetFunctionName(sal_uInt32 _nFunctionTokenId, OUString& rFkt) { + weld::ComboBox& rComboBox = m_pFunctionCell->get_widget(); switch(_nFunctionTokenId) { case SQL_TOKEN_COUNT: - rFkt = (m_pFunctionCell->GetEntryCount() < 3) ? m_pFunctionCell->GetEntry(1) : m_pFunctionCell->GetEntry(2); + rFkt = (rComboBox.get_count() < 3) ? rComboBox.get_text(1) : rComboBox.get_text(2); break; case SQL_TOKEN_AVG: - rFkt = m_pFunctionCell->GetEntry(1); + rFkt = rComboBox.get_text(1); break; case SQL_TOKEN_MAX: - rFkt = m_pFunctionCell->GetEntry(3); + rFkt = rComboBox.get_text(3); break; case SQL_TOKEN_MIN: - rFkt = m_pFunctionCell->GetEntry(4); + rFkt = rComboBox.get_text(4); break; case SQL_TOKEN_SUM: - rFkt = m_pFunctionCell->GetEntry(5); + rFkt = rComboBox.get_text(5); break; case SQL_TOKEN_EVERY: - rFkt = m_pFunctionCell->GetEntry(6); + rFkt = rComboBox.get_text(6); break; case SQL_TOKEN_ANY: - rFkt = m_pFunctionCell->GetEntry(7); + rFkt = rComboBox.get_text(7); break; case SQL_TOKEN_SOME: - rFkt = m_pFunctionCell->GetEntry(8); + rFkt = rComboBox.get_text(8); break; case SQL_TOKEN_STDDEV_POP: - rFkt = m_pFunctionCell->GetEntry(9); + rFkt = rComboBox.get_text(9); break; case SQL_TOKEN_STDDEV_SAMP: - rFkt = m_pFunctionCell->GetEntry(10); + rFkt = rComboBox.get_text(10); break; case SQL_TOKEN_VAR_SAMP: - rFkt = m_pFunctionCell->GetEntry(11); + rFkt = rComboBox.get_text(11); break; case SQL_TOKEN_VAR_POP: - rFkt = m_pFunctionCell->GetEntry(12); + rFkt = rComboBox.get_text(12); break; case SQL_TOKEN_COLLECT: - rFkt = m_pFunctionCell->GetEntry(13); + rFkt = rComboBox.get_text(13); break; case SQL_TOKEN_FUSION: - rFkt = m_pFunctionCell->GetEntry(14); + rFkt = rComboBox.get_text(14); break; case SQL_TOKEN_INTERSECTION: - rFkt = m_pFunctionCell->GetEntry(15); + rFkt = rComboBox.get_text(15); break; default: { @@ -2218,8 +2230,8 @@ OUString OSelectionBrowseBox::GetCellContents(sal_Int32 nCellIndex, sal_uInt16 n return pEntry->IsVisible() ? OUStringLiteral("1") : OUStringLiteral("0"); case BROW_ORDER_ROW: { - sal_Int32 nIdx = m_pOrderCell->GetSelectedEntryPos(); - if (nIdx == LISTBOX_ENTRY_NOTFOUND) + sal_Int32 nIdx = m_pOrderCell->get_widget().get_active(); + if (nIdx == -1) nIdx = 0; return OUString::number(nIdx); } @@ -2608,10 +2620,11 @@ void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef const & _pEntry) { sal_Int32 nIdx {0}; // if we have an asterisk, no other function than count is allowed - m_pFunctionCell->Clear(); - m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(0, ';', nIdx)); + weld::ComboBox& rComboBox = m_pFunctionCell->get_widget(); + rComboBox.clear(); + rComboBox.append_text(m_aFunctionStrings.getToken(0, ';', nIdx)); if ( isFieldNameAsterisk(_pEntry->GetField()) ) - m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(1, ';', nIdx)); // 2nd token: COUNT + rComboBox.append_text(m_aFunctionStrings.getToken(1, ';', nIdx)); // 2nd token: COUNT else { const bool bSkipLastToken {_pEntry->isNumeric()}; @@ -2620,36 +2633,37 @@ void OSelectionBrowseBox::setFunctionCell(OTableFieldDescRef const & _pEntry) const OUString sTok {m_aFunctionStrings.getToken(0, ';', nIdx)}; if (bSkipLastToken && nIdx<0) break; - m_pFunctionCell->InsertEntry(sTok); + rComboBox.append_text(sTok); } } if ( _pEntry->IsGroupBy() ) { OSL_ENSURE(!_pEntry->isNumeric(),"Not allowed to combine group by and numeric values!"); - m_pFunctionCell->SelectEntry(m_pFunctionCell->GetEntry(m_pFunctionCell->GetEntryCount() - 1)); + rComboBox.set_active_text(rComboBox.get_text(rComboBox.get_count() - 1)); } - else if ( m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != LISTBOX_ENTRY_NOTFOUND ) - m_pFunctionCell->SelectEntry(_pEntry->GetFunction()); + else if (rComboBox.find_text(_pEntry->GetFunction()) != -1) + rComboBox.set_active_text(_pEntry->GetFunction()); else - m_pFunctionCell->SelectEntryPos(0); + rComboBox.set_active(0); - enableControl(_pEntry,m_pFunctionCell); + enableControl(_pEntry, m_pFunctionCell); } else { // only COUNT(*) and COUNT("table".*) allowed bool bCountRemoved = !isFieldNameAsterisk(_pEntry->GetField()); + weld::ComboBox& rComboBox = m_pFunctionCell->get_widget(); if ( bCountRemoved ) - m_pFunctionCell->RemoveEntry(1); + rComboBox.remove(1); - if ( !bCountRemoved && m_pFunctionCell->GetEntryCount() < 2) - m_pFunctionCell->InsertEntry(m_aFunctionStrings.getToken(2, ';')); // 2 -> COUNT + if ( !bCountRemoved && rComboBox.get_count() < 2) + rComboBox.append_text(m_aFunctionStrings.getToken(2, ';')); // 2 -> COUNT - if(m_pFunctionCell->GetEntryPos(_pEntry->GetFunction()) != LISTBOX_ENTRY_NOTFOUND) - m_pFunctionCell->SelectEntry(_pEntry->GetFunction()); + if (rComboBox.find_text(_pEntry->GetFunction()) != -1) + rComboBox.set_active_text(_pEntry->GetFunction()); else - m_pFunctionCell->SelectEntryPos(0); + rComboBox.set_active(0); } } diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx index 76300c5d21eb..a17cf27bdf76 100644 --- a/dbaccess/source/ui/tabledesign/TEditControl.cxx +++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx @@ -209,7 +209,6 @@ void OTableEditorCtrl::InitCellController() // Cell type pTypeCell = VclPtr<ListBoxControl>::Create( &GetDataWindow() ); - pTypeCell->SetDropDownLineCount( 15 ); // Cell description pDescrCell = VclPtr<Edit>::Create( &GetDataWindow(), WB_LEFT ); @@ -241,7 +240,7 @@ void OTableEditorCtrl::ClearModified() pNameCell->ClearModifyFlag(); pDescrCell->ClearModifyFlag(); pHelpTextCell->ClearModifyFlag(); - pTypeCell->SaveValue(); + pTypeCell->get_widget().save_value(); } OTableEditorCtrl::~OTableEditorCtrl() @@ -367,14 +366,15 @@ void OTableEditorCtrl::InitController(CellControllerRef&, long nRow, sal_uInt16 aInitString = pActFieldDescr->getTypeInfo()->aUIName; // Set the ComboBox contents - pTypeCell->Clear(); + weld::ComboBox& rTypeList = pTypeCell->get_widget(); + rTypeList.clear(); if( !pActFieldDescr ) break; const OTypeInfoMap& rTypeInfo = GetView()->getController().getTypeInfo(); for (auto const& elem : rTypeInfo) - pTypeCell->InsertEntry( elem.second->aUIName ); - pTypeCell->SelectEntry( aInitString ); + rTypeList.append_text(elem.second->aUIName); + rTypeList.set_active_text(aInitString); } break; @@ -681,8 +681,8 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId ) void OTableEditorCtrl::resetType() { - sal_Int32 nPos = pTypeCell->GetSelectedEntryPos(); - if(nPos != LISTBOX_ENTRY_NOTFOUND) + sal_Int32 nPos = pTypeCell->get_widget().get_active(); + if(nPos != -1) SwitchType( GetView()->getController().getTypeInfo(nPos) ); else SwitchType(TOTypeInfoSP()); @@ -1564,9 +1564,10 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType ) pRow->SetFieldType( _pType, true ); if ( _pType.get() ) { - const sal_Int32 nCurrentlySelected = pTypeCell->GetSelectedEntryPos(); + weld::ComboBox& rTypeList = pTypeCell->get_widget(); + const sal_Int32 nCurrentlySelected = rTypeList.get_active(); - if ( ( LISTBOX_ENTRY_NOTFOUND == nCurrentlySelected ) + if ( ( nCurrentlySelected == -1 ) || ( GetView()->getController().getTypeInfo( nCurrentlySelected ) != _pType ) ) { @@ -1578,8 +1579,8 @@ void OTableEditorCtrl::SwitchType( const TOTypeInfoSP& _pType ) break; ++nEntryPos; } - if (nEntryPos < pTypeCell->GetEntryCount()) - pTypeCell->SelectEntryPos( nEntryPos ); + if (nEntryPos < rTypeList.get_count()) + rTypeList.set_active(nEntryPos); } } |