sc/source/ui/dbgui/filtdlg.cxx | 57 +++++++++++++++++++++++++++ sc/source/ui/inc/filtdlg.hxx | 2 sc/uiconfig/scalc/ui/standardfilterdialog.ui | 22 +++++++++- 3 files changed, 78 insertions(+), 3 deletions(-)
New commits: commit 1ee221ad65ff5e3a725e80777406ac7f94ff3a72 Author: Martin van Zijl <martin.vanz...@gmail.com> AuthorDate: Sun May 24 16:33:29 2020 +1200 Commit: Heiko Tietze <heiko.tie...@documentfoundation.org> CommitDate: Mon Jun 1 10:24:57 2020 +0200 tdf#76898 add ability to reset standard filter Change-Id: If0694fe521770b86f4367fc39c087df8a89a976c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94767 Tested-by: Jenkins Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org> diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index addfedbe0f4c..22cc256baf74 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -80,6 +80,7 @@ ScFilterDlg::ScFilterDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pPa , m_xContents(m_xBuilder->weld_widget("grid")) , m_xScrollBar(m_xBuilder->weld_scrolled_window("scrollbar")) , m_xExpander(m_xBuilder->weld_expander("more")) + , m_xBtnClear(m_xBuilder->weld_button("clear")) , m_xBtnOk(m_xBuilder->weld_button("ok")) , m_xBtnCancel(m_xBuilder->weld_button("cancel")) , m_xBtnCase(m_xBuilder->weld_check_button("case")) @@ -121,6 +122,7 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet ) const ScQueryItem& rQueryItem = static_cast<const ScQueryItem&>( rArgSet.Get( nWhichQuery )); + m_xBtnClear->connect_clicked ( LINK( this, ScFilterDlg, BtnClearHdl ) ); m_xBtnOk->connect_clicked ( LINK( this, ScFilterDlg, EndDlgHdl ) ); m_xBtnCancel->connect_clicked ( LINK( this, ScFilterDlg, EndDlgHdl ) ); m_xBtnHeader->connect_clicked ( LINK( this, ScFilterDlg, CheckBoxHdl ) ); @@ -630,6 +632,61 @@ bool ScFilterDlg::IsRefInputMode() const // Handler: +IMPL_LINK( ScFilterDlg, BtnClearHdl, weld::Button&, rBtn, void ) +{ + if ( &rBtn == m_xBtnClear.get() ) + { + // scroll to the top + m_xScrollBar->vadjustment_set_value(0); + size_t nOffset = 0; + RefreshEditRow( nOffset); + + // clear all conditions + m_xLbConnect1->set_active(-1); + m_xLbConnect2->set_active(-1); + m_xLbConnect3->set_active(-1); + m_xLbConnect4->set_active(-1); + m_xLbField1->set_active(0); + m_xLbField2->set_active(0); + m_xLbField3->set_active(0); + m_xLbField4->set_active(0); + m_xLbCond1->set_active(0); + m_xLbCond2->set_active(0); + m_xLbCond3->set_active(0); + m_xLbCond4->set_active(0); + ClearValueList( 1 ); + ClearValueList( 2 ); + ClearValueList( 3 ); + ClearValueList( 4 ); + + // disable fields for second row onward + m_xLbConnect2->set_sensitive(false); + m_xLbConnect3->set_sensitive(false); + m_xLbConnect4->set_sensitive(false); + m_xLbField2->set_sensitive(false); + m_xLbField3->set_sensitive(false); + m_xLbField4->set_sensitive(false); + m_xLbCond2->set_sensitive(false); + m_xLbCond3->set_sensitive(false); + m_xLbCond4->set_sensitive(false); + m_xEdVal2->set_sensitive(false); + m_xEdVal3->set_sensitive(false); + m_xEdVal4->set_sensitive(false); + + // clear query data objects + SCSIZE nCount = theQueryData.GetEntryCount(); + if (maRefreshExceptQuery.size() < nCount + 1) + maRefreshExceptQuery.resize(nCount + 1, false); + for (SCSIZE i = 0; i < nCount; ++i) + { + theQueryData.GetEntry(i).bDoQuery = false; + maRefreshExceptQuery[i] = false; + theQueryData.GetEntry(i).nField = static_cast<SCCOL>(0); + } + maRefreshExceptQuery[0] = true; + } +} + IMPL_LINK( ScFilterDlg, EndDlgHdl, weld::Button&, rBtn, void ) { if ( &rBtn == m_xBtnOk.get() ) diff --git a/sc/source/ui/inc/filtdlg.hxx b/sc/source/ui/inc/filtdlg.hxx index 8445f1c462a6..e6c2d375f1c1 100644 --- a/sc/source/ui/inc/filtdlg.hxx +++ b/sc/source/ui/inc/filtdlg.hxx @@ -118,6 +118,7 @@ private: std::unique_ptr<weld::ScrolledWindow> m_xScrollBar; std::unique_ptr<weld::Expander> m_xExpander; + std::unique_ptr<weld::Button> m_xBtnClear; std::unique_ptr<weld::Button> m_xBtnOk; std::unique_ptr<weld::Button> m_xBtnCancel; @@ -146,6 +147,7 @@ private: DECL_LINK( LbSelectHdl, weld::ComboBox&, void ); DECL_LINK( ValModifyHdl, weld::ComboBox&, void ); DECL_LINK( CheckBoxHdl, weld::Button&, void ); + DECL_LINK( BtnClearHdl, weld::Button&, void ); DECL_LINK( EndDlgHdl, weld::Button&, void ); DECL_LINK( ScrollHdl, weld::ScrolledWindow&, void ); DECL_LINK( MoreExpandedHdl, weld::Expander&, void ); diff --git a/sc/uiconfig/scalc/ui/standardfilterdialog.ui b/sc/uiconfig/scalc/ui/standardfilterdialog.ui index a71da96fbb22..b657df65816e 100644 --- a/sc/uiconfig/scalc/ui/standardfilterdialog.ui +++ b/sc/uiconfig/scalc/ui/standardfilterdialog.ui @@ -24,6 +24,21 @@ <object class="GtkButtonBox" id="dialog-action_area1"> <property name="can_focus">False</property> <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="clear"> + <property name="label">gtk-clear</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> <child> <object class="GtkButton" id="ok"> <property name="label">gtk-ok</property> @@ -37,7 +52,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> <child> @@ -52,7 +67,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">1</property> + <property name="position">2</property> </packing> </child> <child> @@ -67,7 +82,7 @@ <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">2</property> + <property name="position">3</property> <property name="secondary">True</property> </packing> </child> @@ -842,6 +857,7 @@ </object> </child> <action-widgets> + <action-widget response="100">clear</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits