diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-03-26 10:06:54 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-03-26 13:14:35 +0100 |
commit | d9de9d2d33bffb0032eac563079f66b13f1ca426 (patch) | |
tree | 9a88df9fdd24b1c3bd9053c9199592a84a607063 /sc/source/ui/dbgui/pfiltdlg.cxx | |
parent | e94767dfaacc6e69bda2ac74a8a380a3e016c182 (diff) |
weld ScPivotFilterDlg
Change-Id: I0a2ffa6fd02dcf82d55f961ba229112b456eda8e
Reviewed-on: https://gerrit.libreoffice.org/69733
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/dbgui/pfiltdlg.cxx')
-rw-r--r-- | sc/source/ui/dbgui/pfiltdlg.cxx | 393 |
1 files changed, 177 insertions, 216 deletions
diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index a23e77027266..bd6b6ec1bbb3 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -37,72 +37,39 @@ #include <pfiltdlg.hxx> #include <svl/sharedstringpool.hxx> -ScPivotFilterDlg::ScPivotFilterDlg(vcl::Window* pParent, const SfxItemSet& rArgSet, - SCTAB nSourceTab ) - : ModalDialog(pParent, "PivotFilterDialog", - "modules/scalc/ui/pivotfilterdialog.ui" ) - , - - aStrNone ( ScResId(SCSTR_NONE) ), - aStrEmpty ( ScResId(SCSTR_FILTER_EMPTY) ), - aStrNotEmpty ( ScResId(SCSTR_FILTER_NOTEMPTY) ), - aStrColumn ( ScResId(SCSTR_COLUMN) ), - - nWhichQuery ( rArgSet.GetPool()->GetWhich( SID_QUERY ) ), - theQueryData ( static_cast<const ScQueryItem&>( - rArgSet.Get( nWhichQuery )).GetQueryData() ), - pViewData ( nullptr ), - pDoc ( nullptr ), - nSrcTab ( nSourceTab ) // is not in QueryParam +ScPivotFilterDlg::ScPivotFilterDlg(weld::Window* pParent, const SfxItemSet& rArgSet, + SCTAB nSourceTab ) + : GenericDialogController(pParent, "modules/scalc/ui/pivotfilterdialog.ui", "PivotFilterDialog") + , aStrNone(ScResId(SCSTR_NONE)) + , aStrEmpty(ScResId(SCSTR_FILTER_EMPTY)) + , aStrNotEmpty(ScResId(SCSTR_FILTER_NOTEMPTY)) + , aStrColumn(ScResId(SCSTR_COLUMN)) + , nWhichQuery(rArgSet.GetPool()->GetWhich(SID_QUERY)) + , theQueryData(static_cast<const ScQueryItem&>(rArgSet.Get(nWhichQuery)).GetQueryData()) + , pViewData(nullptr) + , pDoc(nullptr) + , nSrcTab(nSourceTab) // is not in QueryParam + , m_xLbField1(m_xBuilder->weld_combo_box("field1")) + , m_xLbCond1(m_xBuilder->weld_combo_box("cond1")) + , m_xEdVal1(m_xBuilder->weld_combo_box("val1")) + , m_xLbConnect1(m_xBuilder->weld_combo_box("connect1")) + , m_xLbField2(m_xBuilder->weld_combo_box("field2")) + , m_xLbCond2(m_xBuilder->weld_combo_box("cond2")) + , m_xEdVal2(m_xBuilder->weld_combo_box("val2")) + , m_xLbConnect2(m_xBuilder->weld_combo_box("connect2")) + , m_xLbField3(m_xBuilder->weld_combo_box("field3")) + , m_xLbCond3(m_xBuilder->weld_combo_box("cond3")) + , m_xEdVal3(m_xBuilder->weld_combo_box("val3")) + , m_xBtnCase(m_xBuilder->weld_check_button("case")) + , m_xBtnRegExp(m_xBuilder->weld_check_button("regexp")) + , m_xBtnUnique(m_xBuilder->weld_check_button("unique")) + , m_xFtDbArea(m_xBuilder->weld_label("dbarea")) { - get(m_pLbField1, "field1"); - get(m_pLbCond1, "cond1"); - get(m_pEdVal1, "val1"); - get(m_pLbConnect1, "connect1"); - get(m_pLbField2, "field2"); - get(m_pLbCond2, "cond2"); - get(m_pEdVal2, "val2"); - get(m_pLbConnect2, "connect2"); - get(m_pLbField3, "field3"); - get(m_pLbCond3, "cond3"); - get(m_pEdVal3, "val3"); - get(m_pBtnCase, "case"); - get(m_pBtnRegExp, "regexp"); - get(m_pBtnUnique, "unique"); - get(m_pFtDbArea, "dbarea"); - Init( rArgSet ); } ScPivotFilterDlg::~ScPivotFilterDlg() { - disposeOnce(); -} - -void ScPivotFilterDlg::dispose() -{ - for (auto& a : m_pEntryLists) a.reset(); - - pOutItem.reset(); - m_pLbField1.clear(); - m_pLbCond1.clear(); - m_pEdVal1.clear(); - m_pLbConnect1.clear(); - m_pLbField2.clear(); - m_pLbCond2.clear(); - m_pEdVal2.clear(); - m_pLbConnect2.clear(); - m_pLbField3.clear(); - m_pLbCond3.clear(); - m_pEdVal3.clear(); - m_pBtnCase.clear(); - m_pBtnRegExp.clear(); - m_pBtnUnique.clear(); - m_pFtDbArea.clear(); - for (auto& a : aValueEdArr) a.clear(); - for (auto& a : aFieldLbArr) a.clear(); - for (auto& a : aCondLbArr) a.clear(); - ModalDialog::dispose(); } void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) @@ -110,31 +77,31 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) const ScQueryItem& rQueryItem = static_cast<const ScQueryItem&>( rArgSet.Get( nWhichQuery )); - m_pBtnCase->SetClickHdl ( LINK( this, ScPivotFilterDlg, CheckBoxHdl ) ); + m_xBtnCase->connect_clicked ( LINK( this, ScPivotFilterDlg, CheckBoxHdl ) ); - m_pLbField1->SetSelectHdl ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); - m_pLbField2->SetSelectHdl ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); - m_pLbField3->SetSelectHdl ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); - m_pLbConnect1->SetSelectHdl( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); - m_pLbConnect2->SetSelectHdl( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); + m_xLbField1->connect_changed ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); + m_xLbField2->connect_changed ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); + m_xLbField3->connect_changed ( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); + m_xLbConnect1->connect_changed( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); + m_xLbConnect2->connect_changed( LINK( this, ScPivotFilterDlg, LbSelectHdl ) ); - m_pBtnCase->Check( theQueryData.bCaseSens ); - m_pBtnRegExp->Check( theQueryData.eSearchType == utl::SearchParam::SearchType::Regexp ); - m_pBtnUnique->Check( !theQueryData.bDuplicate ); + m_xBtnCase->set_active( theQueryData.bCaseSens ); + m_xBtnRegExp->set_active( theQueryData.eSearchType == utl::SearchParam::SearchType::Regexp ); + m_xBtnUnique->set_active( !theQueryData.bDuplicate ); pViewData = rQueryItem.GetViewData(); pDoc = pViewData ? pViewData->GetDocument() : nullptr; // for easier access: - aFieldLbArr [0] = m_pLbField1; - aFieldLbArr [1] = m_pLbField2; - aFieldLbArr [2] = m_pLbField3; - aValueEdArr [0] = m_pEdVal1; - aValueEdArr [1] = m_pEdVal2; - aValueEdArr [2] = m_pEdVal3; - aCondLbArr [0] = m_pLbCond1; - aCondLbArr [1] = m_pLbCond2; - aCondLbArr [2] = m_pLbCond3; + aFieldLbArr [0] = m_xLbField1.get(); + aFieldLbArr [1] = m_xLbField2.get(); + aFieldLbArr [2] = m_xLbField3.get(); + aValueEdArr [0] = m_xEdVal1.get(); + aValueEdArr [1] = m_xEdVal2.get(); + aValueEdArr [2] = m_xEdVal3.get(); + aCondLbArr [0] = m_xLbCond1.get(); + aCondLbArr [1] = m_xLbCond2.get(); + aCondLbArr [2] = m_xLbCond3.get(); if ( pViewData && pDoc ) { @@ -164,11 +131,11 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) aBuf.append(" ("); aBuf.append(theDbName); aBuf.append(')'); - m_pFtDbArea->SetText(aBuf.makeStringAndClear()); + m_xFtDbArea->set_label(aBuf.makeStringAndClear()); } else { - m_pFtDbArea->SetText( EMPTY_OUSTRING ); + m_xFtDbArea->set_label(EMPTY_OUSTRING); } // Read the field lists and select the entries: @@ -189,72 +156,72 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) sal_uInt16 nCondPos = static_cast<sal_uInt16>(rEntry.eOp); sal_uInt16 nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) ); - aFieldLbArr[i]->SelectEntryPos( nFieldSelPos ); - aCondLbArr [i]->SelectEntryPos( nCondPos ); + aFieldLbArr[i]->set_active( nFieldSelPos ); + aCondLbArr [i]->set_active( nCondPos ); UpdateValueList( static_cast<sal_uInt16>(i+1) ); - aValueEdArr[i]->SetText( aValStr ); + aValueEdArr[i]->set_entry_text(aValStr); if (aValStr == aStrEmpty || aValStr == aStrNotEmpty) - aCondLbArr[i]->Disable(); + aCondLbArr[i]->set_sensitive(false); } else { - aFieldLbArr[i]->SelectEntryPos( 0 ); // "none" selected - aCondLbArr [i]->SelectEntryPos( 0 ); // "=" selected + aFieldLbArr[i]->set_active( 0 ); // "none" selected + aCondLbArr [i]->set_active( 0 ); // "=" selected UpdateValueList( static_cast<sal_uInt16>(i) ); - aValueEdArr[i]->SetText( EMPTY_OUSTRING ); + aValueEdArr[i]->set_entry_text(EMPTY_OUSTRING); } - aValueEdArr[i]->SetModifyHdl( LINK( this, ScPivotFilterDlg, ValModifyHdl ) ); + aValueEdArr[i]->connect_changed( LINK( this, ScPivotFilterDlg, ValModifyHdl ) ); } // disable/enable logic: - (m_pLbField1->GetSelectedEntryPos() != 0) - && (m_pLbField2->GetSelectedEntryPos() != 0) - ? m_pLbConnect1->SelectEntryPos( static_cast<sal_uInt16>(theQueryData.GetEntry(1).eConnect) ) - : m_pLbConnect1->SetNoSelection(); + if (m_xLbField1->get_active() != 0 && m_xLbField2->get_active() != 0) + m_xLbConnect1->set_active( static_cast<sal_uInt16>(theQueryData.GetEntry(1).eConnect) ); + else + m_xLbConnect1->set_active(-1); - (m_pLbField2->GetSelectedEntryPos() != 0) - && (m_pLbField3->GetSelectedEntryPos() != 0) - ? m_pLbConnect2->SelectEntryPos( static_cast<sal_uInt16>(theQueryData.GetEntry(2).eConnect) ) - : m_pLbConnect2->SetNoSelection(); + if (m_xLbField2->get_active() != 0 && m_xLbField3->get_active() != 0) + m_xLbConnect2->set_active( static_cast<sal_uInt16>(theQueryData.GetEntry(2).eConnect) ); + else + m_xLbConnect2->set_active(-1); - if ( m_pLbField1->GetSelectedEntryPos() == 0 ) + if (m_xLbField1->get_active() == 0) { - m_pLbConnect1->Disable(); - m_pLbField2->Disable(); - m_pLbCond2->Disable(); - m_pEdVal2->Disable(); + m_xLbConnect1->set_sensitive(false); + m_xLbField2->set_sensitive(false); + m_xLbCond2->set_sensitive(false); + m_xEdVal2->set_sensitive(false); } - else if ( m_pLbConnect1->GetSelectedEntryCount() == 0 ) + else if (m_xLbConnect1->get_active() == -1) { - m_pLbField2->Disable(); - m_pLbCond2->Disable(); - m_pEdVal2->Disable(); + m_xLbField2->set_sensitive(false); + m_xLbCond2->set_sensitive(false); + m_xEdVal2->set_sensitive(false); } - if ( m_pLbField2->GetSelectedEntryPos() == 0 ) + if (m_xLbField2->get_active() == 0) { - m_pLbConnect2->Disable(); - m_pLbField3->Disable(); - m_pLbCond3->Disable(); - m_pEdVal3->Disable(); + m_xLbConnect2->set_sensitive(false); + m_xLbField3->set_sensitive(false); + m_xLbCond3->set_sensitive(false); + m_xEdVal3->set_sensitive(false); } - else if ( m_pLbConnect2->GetSelectedEntryCount() == 0 ) + else if (m_xLbConnect2->get_active() == -1) { - m_pLbField3->Disable(); - m_pLbCond3->Disable(); - m_pEdVal3->Disable(); + m_xLbField3->set_sensitive(false); + m_xLbCond3->set_sensitive(false); + m_xEdVal3->set_sensitive(false); } } void ScPivotFilterDlg::FillFieldLists() { - m_pLbField1->Clear(); - m_pLbField2->Clear(); - m_pLbField3->Clear(); - m_pLbField1->InsertEntry( aStrNone, 0 ); - m_pLbField2->InsertEntry( aStrNone, 0 ); - m_pLbField3->InsertEntry( aStrNone, 0 ); + m_xLbField1->clear(); + m_xLbField2->clear(); + m_xLbField3->clear(); + m_xLbField1->append_text(aStrNone); + m_xLbField2->append_text(aStrNone); + m_xLbField3->append_text(aStrNone); if ( pDoc ) { @@ -264,7 +231,6 @@ void ScPivotFilterDlg::FillFieldLists() SCROW nFirstRow = theQueryData.nRow1; SCCOL nMaxCol = theQueryData.nCol2; SCCOL col = 0; - sal_uInt16 i=1; for ( col=nFirstCol; col<=nMaxCol; col++ ) { @@ -273,10 +239,9 @@ void ScPivotFilterDlg::FillFieldLists() { aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, "%1", ScColToAlpha( col )); } - m_pLbField1->InsertEntry( aFieldName, i ); - m_pLbField2->InsertEntry( aFieldName, i ); - m_pLbField3->InsertEntry( aFieldName, i ); - i++; + m_xLbField1->append_text(aFieldName); + m_xLbField2->append_text(aFieldName); + m_xLbField3->append_text(aFieldName); } } } @@ -285,28 +250,26 @@ void ScPivotFilterDlg::UpdateValueList( sal_uInt16 nList ) { if ( pDoc && nList>0 && nList<=3 ) { - ComboBox* pValList = aValueEdArr[nList-1].get(); - sal_Int32 nFieldSelPos = aFieldLbArr[nList-1]->GetSelectedEntryPos(); - sal_Int32 nListPos = 0; - OUString aCurValue = pValList->GetText(); + weld::ComboBox* pValList = aValueEdArr[nList-1]; + sal_Int32 nFieldSelPos = aFieldLbArr[nList-1]->get_active(); + OUString aCurValue = pValList->get_active_text(); - pValList->Clear(); - pValList->InsertEntry( aStrNotEmpty, 0 ); - pValList->InsertEntry( aStrEmpty, 1 ); - nListPos = 2; + pValList->clear(); + pValList->append_text(aStrNotEmpty); + pValList->append_text(aStrEmpty); if ( pDoc && nFieldSelPos ) { SCCOL nColumn = theQueryData.nCol1 + static_cast<SCCOL>(nFieldSelPos) - 1; if (!m_pEntryLists[nColumn]) { - WaitObject aWaiter( this ); + weld::WaitObject aWaiter(m_xDialog.get()); SCTAB nTab = nSrcTab; SCROW nFirstRow = theQueryData.nRow1; SCROW nLastRow = theQueryData.nRow2; nFirstRow++; - bool bCaseSens = m_pBtnCase->IsChecked(); + bool bCaseSens = m_xBtnCase->get_active(); m_pEntryLists[nColumn].reset( new ScFilterEntries); pDoc->GetFilterEntriesArea( nColumn, nFirstRow, nLastRow, nTab, bCaseSens, *m_pEntryLists[nColumn]); @@ -315,11 +278,10 @@ void ScPivotFilterDlg::UpdateValueList( sal_uInt16 nList ) const ScFilterEntries* pColl = m_pEntryLists[nColumn].get(); for (const auto& rEntry : *pColl) { - pValList->InsertEntry(rEntry.GetString(), nListPos); - nListPos++; + pValList->append_text(rEntry.GetString()); } } - pValList->SetText( aCurValue ); + pValList->set_entry_text(aCurValue); } } @@ -327,11 +289,11 @@ void ScPivotFilterDlg::ClearValueList( sal_uInt16 nList ) { if ( nList>0 && nList<=3 ) { - ComboBox* pValList = aValueEdArr[nList-1].get(); - pValList->Clear(); - pValList->InsertEntry( aStrNotEmpty, 0 ); - pValList->InsertEntry( aStrEmpty, 1 ); - pValList->SetText( EMPTY_OUSTRING ); + weld::ComboBox* pValList = aValueEdArr[nList-1]; + pValList->clear(); + pValList->append_text(aStrNotEmpty); + pValList->append_text(aStrEmpty); + pValList->set_entry_text(EMPTY_OUSTRING); } } @@ -346,17 +308,17 @@ sal_uInt16 ScPivotFilterDlg::GetFieldSelPos( SCCOL nField ) const ScQueryItem& ScPivotFilterDlg::GetOutputItem() { ScQueryParam theParam( theQueryData ); - sal_Int32 nConnect1 = m_pLbConnect1->GetSelectedEntryPos(); - sal_Int32 nConnect2 = m_pLbConnect2->GetSelectedEntryPos(); + sal_Int32 nConnect1 = m_xLbConnect1->get_active(); + sal_Int32 nConnect2 = m_xLbConnect2->get_active(); svl::SharedStringPool& rPool = pViewData->GetDocument()->GetSharedStringPool(); for ( SCSIZE i=0; i<3; i++ ) { - const sal_Int32 nField = aFieldLbArr[i]->GetSelectedEntryPos(); - ScQueryOp eOp = static_cast<ScQueryOp>(aCondLbArr[i]->GetSelectedEntryPos()); + const sal_Int32 nField = aFieldLbArr[i]->get_active(); + ScQueryOp eOp = static_cast<ScQueryOp>(aCondLbArr[i]->get_active()); - bool bDoThis = (aFieldLbArr[i]->GetSelectedEntryPos() != 0); + bool bDoThis = (aFieldLbArr[i]->get_active() != 0); theParam.GetEntry(i).bDoQuery = bDoThis; if ( bDoThis ) @@ -364,7 +326,7 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem() ScQueryEntry& rEntry = theParam.GetEntry(i); ScQueryEntry::Item& rItem = rEntry.GetQueryItem(); - OUString aStrVal = aValueEdArr[i]->GetText(); + OUString aStrVal = aValueEdArr[i]->get_active_text(); /* * The dialog returns the specific field values "empty"/"non empty" @@ -394,10 +356,10 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem() } } - theParam.GetEntry(1).eConnect = (nConnect1 != LISTBOX_ENTRY_NOTFOUND) + theParam.GetEntry(1).eConnect = (nConnect1 != -1) ? static_cast<ScQueryConnect>(nConnect1) : SC_AND; - theParam.GetEntry(2).eConnect = (nConnect2 != LISTBOX_ENTRY_NOTFOUND) + theParam.GetEntry(2).eConnect = (nConnect2 != -1) ? static_cast<ScQueryConnect>(nConnect2) : SC_AND; @@ -406,9 +368,9 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem() theParam.nDestCol = 0; theParam.nDestRow = 0; - theParam.bDuplicate = !m_pBtnUnique->IsChecked(); - theParam.bCaseSens = m_pBtnCase->IsChecked(); - theParam.eSearchType = m_pBtnRegExp->IsChecked() ? utl::SearchParam::SearchType::Regexp : utl::SearchParam::SearchType::Normal; + theParam.bDuplicate = !m_xBtnUnique->get_active(); + theParam.bCaseSens = m_xBtnCase->get_active(); + theParam.eSearchType = m_xBtnRegExp->get_active() ? utl::SearchParam::SearchType::Regexp : utl::SearchParam::SearchType::Normal; pOutItem.reset( new ScQueryItem( nWhichQuery, &theParam ) ); @@ -417,134 +379,133 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem() // Handler: -IMPL_LINK( ScPivotFilterDlg, LbSelectHdl, ListBox&, rLb, void ) +IMPL_LINK( ScPivotFilterDlg, LbSelectHdl, weld::ComboBox&, rLb, void ) { - /* * Handling the enable/disable logic based on which ListBox was touched: */ - - if (&rLb == m_pLbConnect1) + if (&rLb == m_xLbConnect1.get()) { - if ( !m_pLbField2->IsEnabled() ) + if ( !m_xLbField2->get_sensitive() ) { - m_pLbField2->Enable(); - m_pLbCond2->Enable(); - m_pEdVal2->Enable(); + m_xLbField2->set_sensitive(true); + m_xLbCond2->set_sensitive(true); + m_xEdVal2->set_sensitive(true); } } - else if (&rLb == m_pLbConnect2) + else if (&rLb == m_xLbConnect2.get()) { - if ( !m_pLbField3->IsEnabled() ) + if ( !m_xLbField3->get_sensitive() ) { - m_pLbField3->Enable(); - m_pLbCond3->Enable(); - m_pEdVal3->Enable(); + m_xLbField3->set_sensitive(true); + m_xLbCond3->set_sensitive(true); + m_xEdVal3->set_sensitive(true); } } - else if (&rLb == m_pLbField1) + else if (&rLb == m_xLbField1.get()) { - if ( m_pLbField1->GetSelectedEntryPos() == 0 ) + if ( m_xLbField1->get_active() == 0 ) { - m_pLbConnect1->SetNoSelection(); - m_pLbConnect2->SetNoSelection(); - m_pLbField2->SelectEntryPos( 0 ); - m_pLbField3->SelectEntryPos( 0 ); - m_pLbCond2->SelectEntryPos( 0 ); - m_pLbCond3->SelectEntryPos( 0 ); + m_xLbConnect1->set_active(-1); + m_xLbConnect2->set_active(-1); + m_xLbField2->set_active( 0 ); + m_xLbField3->set_active( 0 ); + m_xLbCond2->set_active( 0 ); + m_xLbCond3->set_active( 0 ); ClearValueList( 1 ); ClearValueList( 2 ); ClearValueList( 3 ); - m_pLbConnect1->Disable(); - m_pLbConnect2->Disable(); - m_pLbField2->Disable(); - m_pLbField3->Disable(); - m_pLbCond2->Disable(); - m_pLbCond3->Disable(); - m_pEdVal2->Disable(); - m_pEdVal3->Disable(); + m_xLbConnect1->set_sensitive(false); + m_xLbConnect2->set_sensitive(false); + m_xLbField2->set_sensitive(false); + m_xLbField3->set_sensitive(false); + m_xLbCond2->set_sensitive(false); + m_xLbCond3->set_sensitive(false); + m_xEdVal2->set_sensitive(false); + m_xEdVal3->set_sensitive(false); } else { UpdateValueList( 1 ); - if ( !m_pLbConnect1->IsEnabled() ) + if ( !m_xLbConnect1->get_sensitive() ) { - m_pLbConnect1->Enable(); + m_xLbConnect1->set_sensitive(true); } } } - else if (&rLb == m_pLbField2) + else if (&rLb == m_xLbField2.get()) { - if ( m_pLbField2->GetSelectedEntryPos() == 0 ) + if ( m_xLbField2->get_active() == 0 ) { - m_pLbConnect2->SetNoSelection(); - m_pLbField3->SelectEntryPos( 0 ); - m_pLbCond3->SelectEntryPos( 0 ); + m_xLbConnect2->set_active(-1); + m_xLbField3->set_active( 0 ); + m_xLbCond3->set_active( 0 ); ClearValueList( 2 ); ClearValueList( 3 ); - m_pLbConnect2->Disable(); - m_pLbField3->Disable(); - m_pLbCond3->Disable(); - m_pEdVal3->Disable(); + m_xLbConnect2->set_sensitive(false); + m_xLbField3->set_sensitive(false); + m_xLbCond3->set_sensitive(false); + m_xEdVal3->set_sensitive(false); } else { UpdateValueList( 2 ); - if ( !m_pLbConnect2->IsEnabled() ) + if (!m_xLbConnect2->get_sensitive()) { - m_pLbConnect2->Enable(); + m_xLbConnect2->set_sensitive(true); } } } - else if (&rLb == m_pLbField3) + else if (&rLb == m_xLbField3.get()) { - ( m_pLbField3->GetSelectedEntryPos() == 0 ) - ? ClearValueList( 3 ) - : UpdateValueList( 3 ); + if (m_xLbField3->get_active() == 0) + ClearValueList(3); + else + UpdateValueList(3); } } -IMPL_LINK( ScPivotFilterDlg, CheckBoxHdl, Button*, pBox, void ) +IMPL_LINK(ScPivotFilterDlg, CheckBoxHdl, weld::Button&, rBox, void) { // update the value lists when dealing with uppercase/lowercase - if (pBox == m_pBtnCase) // value lists + if (&rBox == m_xBtnCase.get()) // value lists { for (auto& a : m_pEntryLists) a.reset(); - OUString aCurVal1 = m_pEdVal1->GetText(); - OUString aCurVal2 = m_pEdVal2->GetText(); - OUString aCurVal3 = m_pEdVal3->GetText(); + OUString aCurVal1 = m_xEdVal1->get_active_text(); + OUString aCurVal2 = m_xEdVal2->get_active_text(); + OUString aCurVal3 = m_xEdVal3->get_active_text(); UpdateValueList( 1 ); UpdateValueList( 2 ); UpdateValueList( 3 ); - m_pEdVal1->SetText( aCurVal1 ); - m_pEdVal2->SetText( aCurVal2 ); - m_pEdVal3->SetText( aCurVal3 ); + m_xEdVal1->set_entry_text(aCurVal1); + m_xEdVal2->set_entry_text(aCurVal2); + m_xEdVal3->set_entry_text(aCurVal3); } } -IMPL_LINK( ScPivotFilterDlg, ValModifyHdl, Edit&, rEd, void ) +IMPL_LINK( ScPivotFilterDlg, ValModifyHdl, weld::ComboBox&, rEd, void ) { - OUString aStrVal = rEd.GetText(); - ListBox* pLb = m_pLbCond1; + OUString aStrVal = rEd.get_active_text(); + weld::ComboBox* pLb = m_xLbCond1.get(); - if ( &rEd == m_pEdVal2 ) pLb = m_pLbCond2; - else if ( &rEd == m_pEdVal3 ) pLb = m_pLbCond3; + if ( &rEd == m_xEdVal2.get() ) pLb = m_xLbCond2.get(); + else if ( &rEd == m_xEdVal3.get() ) pLb = m_xLbCond3.get(); // if cond of the special values "empty"/"non-empty" was chosen only the // =-operand makes sense: if ( aStrEmpty == aStrVal || aStrNotEmpty == aStrVal ) { - pLb->SelectEntry(OUString('=')); - pLb->Disable(); + pLb->set_active_text(OUString('=')); + pLb->set_sensitive(false); } else - pLb->Enable(); + pLb->set_sensitive(true); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |