sc/source/ui/dbgui/tpsubt.cxx | 140 ++++++++++++---------------- sc/source/ui/inc/tpsubt.hxx | 27 ++--- sc/uiconfig/scalc/ui/subtotaloptionspage.ui | 26 ----- 3 files changed, 79 insertions(+), 114 deletions(-)
New commits: commit cac00eeb8ca32e931efb9b245643bff815e84bb9 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sun Oct 7 19:31:54 2018 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Oct 8 10:13:31 2018 +0200 weld ScTpSubTotalOptions Change-Id: Id147ae786c8c93939acff8a97c4167f99451f364 Reviewed-on: https://gerrit.libreoffice.org/61499 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index 8ff412d68191..36b1d8a28c15 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -435,11 +435,10 @@ bool ScTpSubTotalGroup3::FillItemSet( SfxItemSet* rArgSet ) { return FILLSET(3); // options tab page: -ScTpSubTotalOptions::ScTpSubTotalOptions( vcl::Window* pParent, - const SfxItemSet& rArgSet ) +ScTpSubTotalOptions::ScTpSubTotalOptions(TabPageParent pParent, const SfxItemSet& rArgSet) : SfxTabPage ( pParent, - "SubTotalOptionsPage", "modules/scalc/ui/subtotaloptionspage.ui" , + "modules/scalc/ui/subtotaloptionspage.ui", "SubTotalOptionsPage", &rArgSet ), pViewData ( nullptr ), pDoc ( nullptr ), @@ -447,17 +446,16 @@ ScTpSubTotalOptions::ScTpSubTotalOptions( vcl::Window* pParent, rSubTotalData ( static_cast<const ScSubTotalItem&>( rArgSet.Get( nWhichSubTotals )). GetSubTotalData() ) + , m_xBtnPagebreak(m_xBuilder->weld_check_button("pagebreak")) + , m_xBtnCase(m_xBuilder->weld_check_button("case")) + , m_xBtnSort(m_xBuilder->weld_check_button("sort")) + , m_xFlSort(m_xBuilder->weld_label("label2")) + , m_xBtnAscending(m_xBuilder->weld_radio_button("ascending")) + , m_xBtnDescending(m_xBuilder->weld_radio_button("descending")) + , m_xBtnFormats(m_xBuilder->weld_check_button("formats")) + , m_xBtnUserDef(m_xBuilder->weld_check_button("btnuserdef")) + , m_xLbUserDef(m_xBuilder->weld_combo_box("lbuserdef")) { - get(pBtnPagebreak,"pagebreak"); - get(pBtnCase,"case"); - get(pBtnSort,"sort"); - get(pFlSort,"label2"); - get(pBtnAscending,"ascending"); - get(pBtnDescending,"descending"); - get(pBtnFormats,"formats"); - get(pBtnUserDef,"btnuserdef"); - get(pLbUserDef,"lbuserdef"); - Init(); } @@ -466,20 +464,6 @@ ScTpSubTotalOptions::~ScTpSubTotalOptions() disposeOnce(); } -void ScTpSubTotalOptions::dispose() -{ - pBtnPagebreak.clear(); - pBtnCase.clear(); - pBtnSort.clear(); - pFlSort.clear(); - pBtnAscending.clear(); - pBtnDescending.clear(); - pBtnFormats.clear(); - pBtnUserDef.clear(); - pLbUserDef.clear(); - SfxTabPage::dispose(); -} - void ScTpSubTotalOptions::Init() { const ScSubTotalItem& rSubTotalItem = static_cast<const ScSubTotalItem&>( @@ -490,41 +474,41 @@ void ScTpSubTotalOptions::Init() OSL_ENSURE( pViewData && pDoc, "ViewData or Document not found!" ); - pBtnSort->SetClickHdl ( LINK( this, ScTpSubTotalOptions, CheckHdl ) ); - pBtnUserDef->SetClickHdl ( LINK( this, ScTpSubTotalOptions, CheckHdl ) ); + m_xBtnSort->connect_clicked( LINK( this, ScTpSubTotalOptions, CheckHdl ) ); + m_xBtnUserDef->connect_clicked( LINK( this, ScTpSubTotalOptions, CheckHdl ) ); FillUserSortListBox(); } -VclPtr<SfxTabPage> ScTpSubTotalOptions::Create( TabPageParent pParent, - const SfxItemSet* rArgSet ) +VclPtr<SfxTabPage> ScTpSubTotalOptions::Create(TabPageParent pParent, + const SfxItemSet* rArgSet) { - return VclPtr<ScTpSubTotalOptions>::Create( pParent.pParent, *rArgSet ); + return VclPtr<ScTpSubTotalOptions>::Create(pParent, *rArgSet); } void ScTpSubTotalOptions::Reset( const SfxItemSet* /* rArgSet */ ) { - pBtnPagebreak->Check ( rSubTotalData.bPagebreak ); - pBtnCase->Check ( rSubTotalData.bCaseSens ); - pBtnFormats->Check ( rSubTotalData.bIncludePattern ); - pBtnSort->Check ( rSubTotalData.bDoSort ); - pBtnAscending->Check ( rSubTotalData.bAscending ); - pBtnDescending->Check( !rSubTotalData.bAscending ); + m_xBtnPagebreak->set_active( rSubTotalData.bPagebreak ); + m_xBtnCase->set_active( rSubTotalData.bCaseSens ); + m_xBtnFormats->set_active( rSubTotalData.bIncludePattern ); + m_xBtnSort->set_active( rSubTotalData.bDoSort ); + m_xBtnAscending->set_active( rSubTotalData.bAscending ); + m_xBtnDescending->set_active( !rSubTotalData.bAscending ); if ( rSubTotalData.bUserDef ) { - pBtnUserDef->Check(); - pLbUserDef->Enable(); - pLbUserDef->SelectEntryPos( rSubTotalData.nUserIndex ); + m_xBtnUserDef->set_active(true); + m_xLbUserDef->set_sensitive(true); + m_xLbUserDef->set_active(rSubTotalData.nUserIndex); } else { - pBtnUserDef->Check( false ); - pLbUserDef->Disable(); - pLbUserDef->SelectEntryPos( 0 ); + m_xBtnUserDef->set_active( false ); + m_xLbUserDef->set_sensitive(false); + m_xLbUserDef->set_active(0); } - CheckHdl( pBtnSort ); + CheckHdl(*m_xBtnSort); } bool ScTpSubTotalOptions::FillItemSet( SfxItemSet* rArgSet ) @@ -538,15 +522,15 @@ bool ScTpSubTotalOptions::FillItemSet( SfxItemSet* rArgSet ) theSubTotalData = static_cast<const ScSubTotalItem*>(pItem)->GetSubTotalData(); } - theSubTotalData.bPagebreak = pBtnPagebreak->IsChecked(); + theSubTotalData.bPagebreak = m_xBtnPagebreak->get_active(); theSubTotalData.bReplace = true; - theSubTotalData.bCaseSens = pBtnCase->IsChecked(); - theSubTotalData.bIncludePattern = pBtnFormats->IsChecked(); - theSubTotalData.bDoSort = pBtnSort->IsChecked(); - theSubTotalData.bAscending = pBtnAscending->IsChecked(); - theSubTotalData.bUserDef = pBtnUserDef->IsChecked(); - theSubTotalData.nUserIndex = (pBtnUserDef->IsChecked()) - ? pLbUserDef->GetSelectedEntryPos() + theSubTotalData.bCaseSens = m_xBtnCase->get_active(); + theSubTotalData.bIncludePattern = m_xBtnFormats->get_active(); + theSubTotalData.bDoSort = m_xBtnSort->get_active(); + theSubTotalData.bAscending = m_xBtnAscending->get_active(); + theSubTotalData.bUserDef = m_xBtnUserDef->get_active(); + theSubTotalData.nUserIndex = (m_xBtnUserDef->get_active()) + ? m_xLbUserDef->get_active() : 0; rArgSet->Put( ScSubTotalItem( nWhichSubTotals, &theSubTotalData ) ); @@ -558,51 +542,53 @@ void ScTpSubTotalOptions::FillUserSortListBox() { ScUserList* pUserLists = ScGlobal::GetUserList(); - pLbUserDef->Clear(); + m_xLbUserDef->freeze(); + m_xLbUserDef->clear(); if ( pUserLists ) { size_t nCount = pUserLists->size(); for ( size_t i=0; i<nCount; ++i ) - pLbUserDef->InsertEntry( (*pUserLists)[i].GetString() ); + m_xLbUserDef->append_text((*pUserLists)[i].GetString() ); } + m_xLbUserDef->thaw(); } // Handler: -IMPL_LINK( ScTpSubTotalOptions, CheckHdl, Button*, pBox, void ) +IMPL_LINK(ScTpSubTotalOptions, CheckHdl, weld::Button&, rBox, void) { - if ( pBox == pBtnSort ) + if (&rBox == m_xBtnSort.get()) { - if ( pBtnSort->IsChecked() ) + if ( m_xBtnSort->get_active() ) { - pFlSort->Enable(); - pBtnFormats->Enable(); - pBtnUserDef->Enable(); - pBtnAscending->Enable(); - pBtnDescending->Enable(); - - if ( pBtnUserDef->IsChecked() ) - pLbUserDef->Enable(); + m_xFlSort->set_sensitive(true); + m_xBtnFormats->set_sensitive(true); + m_xBtnUserDef->set_sensitive(true); + m_xBtnAscending->set_sensitive(true); + m_xBtnDescending->set_sensitive(true); + + if ( m_xBtnUserDef->get_active() ) + m_xLbUserDef->set_sensitive(true); } else { - pFlSort->Disable(); - pBtnFormats->Disable(); - pBtnUserDef->Disable(); - pBtnAscending->Disable(); - pBtnDescending->Disable(); - pLbUserDef->Disable(); + m_xFlSort->set_sensitive(false); + m_xBtnFormats->set_sensitive(false); + m_xBtnUserDef->set_sensitive(false); + m_xBtnAscending->set_sensitive(false); + m_xBtnDescending->set_sensitive(false); + m_xLbUserDef->set_sensitive(false); } } - else if ( pBox == pBtnUserDef ) + else if (&rBox == m_xBtnUserDef.get()) { - if ( pBtnUserDef->IsChecked() ) + if ( m_xBtnUserDef->get_active() ) { - pLbUserDef->Enable(); - pLbUserDef->GrabFocus(); + m_xLbUserDef->set_sensitive(true); + m_xLbUserDef->grab_focus(); } else - pLbUserDef->Disable(); + m_xLbUserDef->set_sensitive(false); } } diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx index a88d608fd92d..8ed4b12ec851 100644 --- a/sc/source/ui/inc/tpsubt.hxx +++ b/sc/source/ui/inc/tpsubt.hxx @@ -125,7 +125,6 @@ class ScTpSubTotalOptions final : public SfxTabPage { public: virtual ~ScTpSubTotalOptions() override; - virtual void dispose() override; static VclPtr<SfxTabPage> Create ( TabPageParent pParent, const SfxItemSet* rArgSet ); virtual bool FillItemSet ( SfxItemSet* rArgSet ) override; @@ -133,28 +132,28 @@ public: private: friend class VclPtr<ScTpSubTotalOptions>; - ScTpSubTotalOptions( vcl::Window* pParent, - const SfxItemSet& rArgSet ); + ScTpSubTotalOptions(TabPageParent pParent, const SfxItemSet& rArgSet); void Init (); void FillUserSortListBox (); // Handler ------------------------ - DECL_LINK( CheckHdl, Button*, void ); - - VclPtr<CheckBox> pBtnPagebreak; - VclPtr<CheckBox> pBtnCase; - VclPtr<CheckBox> pBtnSort; - VclPtr<FixedText> pFlSort; - VclPtr<RadioButton> pBtnAscending; - VclPtr<RadioButton> pBtnDescending; - VclPtr<CheckBox> pBtnFormats; - VclPtr<CheckBox> pBtnUserDef; - VclPtr<ListBox> pLbUserDef; + DECL_LINK(CheckHdl, weld::Button&, void); + ScViewData* pViewData; ScDocument* pDoc; const sal_uInt16 nWhichSubTotals; const ScSubTotalParam& rSubTotalData; + + std::unique_ptr<weld::CheckButton> m_xBtnPagebreak; + std::unique_ptr<weld::CheckButton> m_xBtnCase; + std::unique_ptr<weld::CheckButton> m_xBtnSort; + std::unique_ptr<weld::Label> m_xFlSort; + std::unique_ptr<weld::RadioButton> m_xBtnAscending; + std::unique_ptr<weld::RadioButton> m_xBtnDescending; + std::unique_ptr<weld::CheckButton> m_xBtnFormats; + std::unique_ptr<weld::CheckButton> m_xBtnUserDef; + std::unique_ptr<weld::ComboBox> m_xLbUserDef; }; #endif // INCLUDED_SC_SOURCE_UI_INC_TPSUBT_HXX diff --git a/sc/uiconfig/scalc/ui/subtotaloptionspage.ui b/sc/uiconfig/scalc/ui/subtotaloptionspage.ui index b1b3dd97d2f2..29cb4fe913d1 100644 --- a/sc/uiconfig/scalc/ui/subtotaloptionspage.ui +++ b/sc/uiconfig/scalc/ui/subtotaloptionspage.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> - <!-- interface-requires gtk+ 3.0 --> - <!-- interface-requires LibreOffice 1.0 --> + <requires lib="gtk+" version="3.18"/> <object class="GtkBox" id="SubTotalOptionsPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -44,8 +44,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -62,8 +60,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -80,8 +76,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -139,13 +133,10 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">descending</property> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -164,8 +155,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -182,8 +171,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -203,18 +190,13 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> - <object class="VclComboBoxText" id="lbuserdef"> + <object class="GtkComboBoxText" id="lbuserdef"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="margin_left">12</property> - <property name="entry_text_column">0</property> - <property name="id_column">1</property> - <property name="max_width_chars">65</property> <accessibility> <relation type="labelled-by" target="btnuserdef"/> </accessibility> @@ -222,8 +204,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits