sc/inc/scabstdlg.hxx | 5 sc/source/ui/attrdlg/scdlgfact.cxx | 14 - sc/source/ui/attrdlg/scdlgfact.hxx | 12 sc/source/ui/dbgui/pfiltdlg.cxx | 393 +++++++++++++----------------- sc/source/ui/inc/pfiltdlg.hxx | 60 ++-- sc/source/ui/view/gridwin2.cxx | 2 sc/source/ui/view/pivotsh.cxx | 2 sc/uiconfig/scalc/ui/pivotfilterdialog.ui | 57 ++-- 8 files changed, 260 insertions(+), 285 deletions(-)
New commits: commit d9de9d2d33bffb0032eac563079f66b13f1ca426 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Mar 26 10:06:54 2019 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Mar 26 13:14:35 2019 +0100 weld ScPivotFilterDlg Change-Id: I0a2ffa6fd02dcf82d55f961ba229112b456eda8e Reviewed-on: https://gerrit.libreoffice.org/69733 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 4a5d326049a1..5bcfd9d5fab4 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -468,8 +468,9 @@ public: virtual VclPtr<AbstractScNamePasteDlg> CreateScNamePasteDlg(weld::Window * pParent, ScDocShell* pShell) = 0; - virtual VclPtr<AbstractScPivotFilterDlg> CreateScPivotFilterDlg(vcl::Window* pParent, - const SfxItemSet& rArgSet, sal_uInt16 nSourceTab) = 0; + virtual VclPtr<AbstractScPivotFilterDlg> CreateScPivotFilterDlg(weld::Window* pParent, + const SfxItemSet& rArgSet, + sal_uInt16 nSourceTab) = 0; virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Window* pParent, const ScDPLabelDataVector& rLabelVec, diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 88a153120400..581391c4857a 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -162,7 +162,10 @@ short AbstractScNamePasteDlg_Impl::Execute() return m_xDlg->run(); } -IMPL_ABSTDLG_BASE(AbstractScPivotFilterDlg_Impl); +short AbstractScPivotFilterDlg_Impl::Execute() +{ + return m_xDlg->run(); +} short AbstractScDPFunctionDlg_Impl::Execute() { @@ -603,9 +606,9 @@ std::vector<OUString> AbstractScNamePasteDlg_Impl::GetSelectedNames() const return m_xDlg->GetSelectedNames(); } -const ScQueryItem& AbstractScPivotFilterDlg_Impl::GetOutputItem() +const ScQueryItem& AbstractScPivotFilterDlg_Impl::GetOutputItem() { - return pDlg->GetOutputItem(); + return m_xDlg->GetOutputItem(); } PivotFunc AbstractScDPFunctionDlg_Impl::GetFuncMask() const @@ -903,11 +906,10 @@ VclPtr<AbstractScNamePasteDlg> ScAbstractDialogFactory_Impl::CreateScNamePasteDl return VclPtr<AbstractScNamePasteDlg_Impl>::Create(std::make_unique<ScNamePasteDlg>(pParent, pShell)); } -VclPtr<AbstractScPivotFilterDlg> ScAbstractDialogFactory_Impl::CreateScPivotFilterDlg(vcl::Window* pParent, +VclPtr<AbstractScPivotFilterDlg> ScAbstractDialogFactory_Impl::CreateScPivotFilterDlg(weld::Window* pParent, const SfxItemSet& rArgSet, sal_uInt16 nSourceTab) { - VclPtr<ScPivotFilterDlg> pDlg = VclPtr<ScPivotFilterDlg>::Create(pParent, rArgSet, nSourceTab); - return VclPtr<AbstractScPivotFilterDlg_Impl>::Create(pDlg); + return VclPtr<AbstractScPivotFilterDlg_Impl>::Create(std::make_unique<ScPivotFilterDlg>(pParent, rArgSet, nSourceTab)); } VclPtr<AbstractScDPFunctionDlg> ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg(weld::Window* pParent, diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index c752101f82af..4d762f219742 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -388,7 +388,13 @@ public: class AbstractScPivotFilterDlg_Impl : public AbstractScPivotFilterDlg { - DECL_ABSTDLG_BASE( AbstractScPivotFilterDlg_Impl, ScPivotFilterDlg) + std::unique_ptr<ScPivotFilterDlg> m_xDlg; +public: + explicit AbstractScPivotFilterDlg_Impl(std::unique_ptr<ScPivotFilterDlg> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; virtual const ScQueryItem& GetOutputItem() override; }; @@ -660,8 +666,8 @@ public: virtual VclPtr<AbstractScNamePasteDlg> CreateScNamePasteDlg(weld::Window * pParent, ScDocShell* pShell) override; - virtual VclPtr<AbstractScPivotFilterDlg> CreateScPivotFilterDlg(vcl::Window* pParent, - const SfxItemSet& rArgSet, sal_uInt16 nSourceTab) override; + virtual VclPtr<AbstractScPivotFilterDlg> CreateScPivotFilterDlg(weld::Window* pParent, const SfxItemSet& rArgSet, + sal_uInt16 nSourceTab) override; virtual VclPtr<AbstractScDPFunctionDlg> CreateScDPFunctionDlg(weld::Window* pParent, const ScDPLabelDataVector& rLabelVec, 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: */ diff --git a/sc/source/ui/inc/pfiltdlg.hxx b/sc/source/ui/inc/pfiltdlg.hxx index df40641ad3d6..cd2a96f0ac35 100644 --- a/sc/source/ui/inc/pfiltdlg.hxx +++ b/sc/source/ui/inc/pfiltdlg.hxx @@ -20,11 +20,7 @@ #ifndef INCLUDED_SC_SOURCE_UI_INC_PFILTDLG_HXX #define INCLUDED_SC_SOURCE_UI_INC_PFILTDLG_HXX -#include <vcl/button.hxx> -#include <vcl/fixed.hxx> -#include <vcl/dialog.hxx> -#include <vcl/lstbox.hxx> -#include <vcl/combobox.hxx> +#include <vcl/weld.hxx> #include <address.hxx> #include <queryparam.hxx> #include <array> @@ -36,34 +32,15 @@ class ScQueryItem; class SfxItemSet; struct ScFilterEntries; -class ScPivotFilterDlg : public ModalDialog +class ScPivotFilterDlg : public weld::GenericDialogController { public: - ScPivotFilterDlg(vcl::Window* pParent, const SfxItemSet& rArgSet, SCTAB nSourceTab); + ScPivotFilterDlg(weld::Window* pParent, const SfxItemSet& rArgSet, SCTAB nSourceTab); virtual ~ScPivotFilterDlg() override; - virtual void dispose() override; const ScQueryItem& GetOutputItem(); private: - VclPtr<ListBox> m_pLbField1; - VclPtr<ListBox> m_pLbCond1; - VclPtr<ComboBox> m_pEdVal1; - - VclPtr<ListBox> m_pLbConnect1; - VclPtr<ListBox> m_pLbField2; - VclPtr<ListBox> m_pLbCond2; - VclPtr<ComboBox> m_pEdVal2; - - VclPtr<ListBox> m_pLbConnect2; - VclPtr<ListBox> m_pLbField3; - VclPtr<ListBox> m_pLbCond3; - VclPtr<ComboBox> m_pEdVal3; - - VclPtr<CheckBox> m_pBtnCase; - VclPtr<CheckBox> m_pBtnRegExp; - VclPtr<CheckBox> m_pBtnUnique; - VclPtr<FixedText> m_pFtDbArea; const OUString aStrNone; const OUString aStrEmpty; const OUString aStrNotEmpty; @@ -76,9 +53,28 @@ private: ScDocument* pDoc; SCTAB const nSrcTab; - VclPtr<ComboBox> aValueEdArr[3]; - VclPtr<ListBox> aFieldLbArr[3]; - VclPtr<ListBox> aCondLbArr[3]; + std::unique_ptr<weld::ComboBox> m_xLbField1; + std::unique_ptr<weld::ComboBox> m_xLbCond1; + std::unique_ptr<weld::ComboBox> m_xEdVal1; + + std::unique_ptr<weld::ComboBox> m_xLbConnect1; + std::unique_ptr<weld::ComboBox> m_xLbField2; + std::unique_ptr<weld::ComboBox> m_xLbCond2; + std::unique_ptr<weld::ComboBox> m_xEdVal2; + + std::unique_ptr<weld::ComboBox> m_xLbConnect2; + std::unique_ptr<weld::ComboBox> m_xLbField3; + std::unique_ptr<weld::ComboBox> m_xLbCond3; + std::unique_ptr<weld::ComboBox> m_xEdVal3; + + std::unique_ptr<weld::CheckButton> m_xBtnCase; + std::unique_ptr<weld::CheckButton> m_xBtnRegExp; + std::unique_ptr<weld::CheckButton> m_xBtnUnique; + std::unique_ptr<weld::Label> m_xFtDbArea; + + weld::ComboBox* aValueEdArr[3]; + weld::ComboBox* aFieldLbArr[3]; + weld::ComboBox* aCondLbArr[3]; std::array<std::unique_ptr<ScFilterEntries>, MAXCOLCOUNT> m_pEntryLists; @@ -90,9 +86,9 @@ private: sal_uInt16 GetFieldSelPos ( SCCOL nField ); // Handler: - DECL_LINK( LbSelectHdl, ListBox&, void ); - DECL_LINK( ValModifyHdl, Edit&, void ); - DECL_LINK( CheckBoxHdl, Button*, void ); + DECL_LINK( LbSelectHdl, weld::ComboBox&, void ); + DECL_LINK( ValModifyHdl, weld::ComboBox&, void ); + DECL_LINK( CheckBoxHdl, weld::Button&, void ); }; #endif // INCLUDED_SC_SOURCE_UI_INC_PFILTDLG_HXX diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index fda045a3789f..aef8160eedc7 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -206,7 +206,7 @@ void ScGridWindow::DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent& ScopedVclPtr<AbstractScPivotFilterDlg> pDlg( pFact->CreateScPivotFilterDlg( - pViewData->GetViewShell()->GetDialogParent(), aArgSet, nSrcTab)); + pViewData->GetViewShell()->GetFrameWeld(), aArgSet, nSrcTab)); if ( pDlg->Execute() == RET_OK ) { ScSheetSourceDesc aNewDesc(pDoc); diff --git a/sc/source/ui/view/pivotsh.cxx b/sc/source/ui/view/pivotsh.cxx index 79f7900b7f49..e71221797d95 100644 --- a/sc/source/ui/view/pivotsh.cxx +++ b/sc/source/ui/view/pivotsh.cxx @@ -104,7 +104,7 @@ void ScPivotShell::Execute( const SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); ScopedVclPtr<AbstractScPivotFilterDlg> pDlg(pFact->CreateScPivotFilterDlg( - pViewShell->GetDialogParent(), aArgSet, nSrcTab)); + pViewShell->GetFrameWeld(), aArgSet, nSrcTab)); if( pDlg->Execute() == RET_OK ) { diff --git a/sc/uiconfig/scalc/ui/pivotfilterdialog.ui b/sc/uiconfig/scalc/ui/pivotfilterdialog.ui index 6d6f85160572..b3b11bf107c6 100644 --- a/sc/uiconfig/scalc/ui/pivotfilterdialog.ui +++ b/sc/uiconfig/scalc/ui/pivotfilterdialog.ui @@ -1,12 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="PivotFilterDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="pivotfilterdialog|PivotFilterDialog">Filter</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -215,12 +221,12 @@ <property name="visible">True</property> <property name="can_focus">False</property> <items> - <item translatable="no">=</item> - <item translatable="no"><</item> - <item translatable="no">></item> - <item translatable="no"><=</item> - <item translatable="no">>=</item> - <item translatable="no"><></item> + <item>=</item> + <item><</item> + <item>></item> + <item><=</item> + <item>>=</item> + <item><></item> </items> <accessibility> <relation type="labelled-by" target="label4"/> @@ -236,12 +242,12 @@ <property name="visible">True</property> <property name="can_focus">False</property> <items> - <item translatable="no">=</item> - <item translatable="no"><</item> - <item translatable="no">></item> - <item translatable="no"><=</item> - <item translatable="no">>=</item> - <item translatable="no"><></item> + <item>=</item> + <item><</item> + <item>></item> + <item><=</item> + <item>>=</item> + <item><></item> </items> <accessibility> <relation type="labelled-by" target="label4"/> @@ -257,12 +263,12 @@ <property name="visible">True</property> <property name="can_focus">False</property> <items> - <item translatable="no">=</item> - <item translatable="no"><</item> - <item translatable="no">></item> - <item translatable="no"><=</item> - <item translatable="no">>=</item> - <item translatable="no"><></item> + <item>=</item> + <item><</item> + <item>></item> + <item><=</item> + <item>>=</item> + <item><></item> </items> <accessibility> <relation type="labelled-by" target="label4"/> @@ -281,7 +287,8 @@ <property name="has_entry">True</property> <child internal-child="entry"> <object class="GtkEntry" id="comboboxtext-entry2"> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> </object> </child> <accessibility> @@ -301,7 +308,8 @@ <property name="has_entry">True</property> <child internal-child="entry"> <object class="GtkEntry" id="comboboxtext-entry4"> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> </object> </child> <accessibility> @@ -321,7 +329,8 @@ <property name="has_entry">True</property> <child internal-child="entry"> <object class="GtkEntry" id="comboboxtext-entry6"> - <property name="can_focus">False</property> + <property name="can_focus">True</property> + <property name="activates_default">True</property> </object> </child> <accessibility> @@ -446,8 +455,8 @@ <object class="GtkLabel" id="dbarealabel"> <property name="sensitive">False</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pivotfilterdialog|dbarealabel">Data range:</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -459,8 +468,8 @@ <property name="sensitive">False</property> <property name="can_focus">False</property> <property name="hexpand">True</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="pivotfilterdialog|dbarea">dummy</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">1</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits