sc/source/ui/inc/tpdefaults.hxx | 21 +-- sc/source/ui/optdlg/tpdefaults.cxx | 80 +++++------- sc/uiconfig/scalc/ui/optdefaultpage.ui | 8 - sw/source/ui/config/optload.cxx | 196 +++++++++++++------------------ sw/source/uibase/inc/optload.hxx | 39 +++--- sw/uiconfig/swriter/ui/optgeneralpage.ui | 24 ++- 6 files changed, 166 insertions(+), 202 deletions(-)
New commits: commit afe99a508e78abbf7e3d97730b7abfc8fdbec77c Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Jul 27 21:39:17 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Jul 28 22:14:00 2019 +0200 weld ScTpDefaultsOptions Change-Id: I2a4a053b38229b971fbf6fc8205680ce02132234 Reviewed-on: https://gerrit.libreoffice.org/76486 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/inc/tpdefaults.hxx b/sc/source/ui/inc/tpdefaults.hxx index b173e6a6df2b..59be1c7a73b0 100644 --- a/sc/source/ui/inc/tpdefaults.hxx +++ b/sc/source/ui/inc/tpdefaults.hxx @@ -19,31 +19,30 @@ class ScTpDefaultsOptions : public SfxTabPage public: using SfxTabPage::DeactivatePage; - static VclPtr<SfxTabPage> Create (TabPageParent pParent, const SfxItemSet* rCoreSet); + static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet* rCoreSet); virtual bool FillItemSet(SfxItemSet* rCoreSet) override; virtual void Reset(const SfxItemSet* rCoreSet) override; virtual DeactivateRC DeactivatePage(SfxItemSet* pSet) override; private: - explicit ScTpDefaultsOptions(vcl::Window* pParent, const SfxItemSet& rCoreSet); + explicit ScTpDefaultsOptions(TabPageParent pParent, const SfxItemSet& rCoreSet); virtual ~ScTpDefaultsOptions() override; - virtual void dispose() override; void CheckNumSheets(); - void CheckPrefix(Edit* pEdit); - void OnFocusPrefixInput(const Edit* pEdit); + void CheckPrefix(); + void OnFocusPrefixInput(); - DECL_LINK( NumModifiedHdl, Edit&, void ); - DECL_LINK( PrefixModifiedHdl, Edit&, void ); - DECL_LINK( PrefixEditOnFocusHdl, Control&, void ); + DECL_LINK( NumModifiedHdl, weld::Entry&, void ); + DECL_LINK( PrefixModifiedHdl, weld::Entry&, void ); + DECL_LINK( PrefixEditOnFocusHdl, weld::Widget&, void ); private: - VclPtr<NumericField> m_pEdNSheets; - VclPtr<Edit> m_pEdSheetPrefix; - // Stores old Sheet Prefix OUString maOldPrefixValue; + + std::unique_ptr<weld::SpinButton> m_xEdNSheets; + std::unique_ptr<weld::Entry> m_xEdSheetPrefix; }; #endif diff --git a/sc/source/ui/optdlg/tpdefaults.cxx b/sc/source/ui/optdlg/tpdefaults.cxx index cc4642d61bd9..9fd4e9155721 100644 --- a/sc/source/ui/optdlg/tpdefaults.cxx +++ b/sc/source/ui/optdlg/tpdefaults.cxx @@ -14,33 +14,23 @@ #include <defaultsoptions.hxx> #include <document.hxx> -ScTpDefaultsOptions::ScTpDefaultsOptions(vcl::Window *pParent, const SfxItemSet &rCoreSet) : - SfxTabPage(pParent, "OptDefaultPage", "modules/scalc/ui/optdefaultpage.ui", &rCoreSet) - +ScTpDefaultsOptions::ScTpDefaultsOptions(TabPageParent pParent, const SfxItemSet &rCoreSet) + : SfxTabPage(pParent, "modules/scalc/ui/optdefaultpage.ui", "OptDefaultPage", &rCoreSet) + , m_xEdNSheets(m_xBuilder->weld_spin_button("sheetsnumber")) + , m_xEdSheetPrefix(m_xBuilder->weld_entry("sheetprefix")) { - get( m_pEdNSheets, "sheetsnumber"); - get( m_pEdSheetPrefix, "sheetprefix"); - - m_pEdNSheets->SetModifyHdl( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) ); - m_pEdSheetPrefix->SetModifyHdl( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) ); - m_pEdSheetPrefix->SetGetFocusHdl( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) ); + m_xEdNSheets->connect_changed( LINK(this, ScTpDefaultsOptions, NumModifiedHdl) ); + m_xEdSheetPrefix->connect_changed( LINK(this, ScTpDefaultsOptions, PrefixModifiedHdl) ); + m_xEdSheetPrefix->connect_focus_in( LINK(this, ScTpDefaultsOptions, PrefixEditOnFocusHdl) ); } ScTpDefaultsOptions::~ScTpDefaultsOptions() { - disposeOnce(); -} - -void ScTpDefaultsOptions::dispose() -{ - m_pEdNSheets.clear(); - m_pEdSheetPrefix.clear(); - SfxTabPage::dispose(); } VclPtr<SfxTabPage> ScTpDefaultsOptions::Create(TabPageParent pParent, const SfxItemSet *rCoreAttrs) { - return VclPtr<ScTpDefaultsOptions>::Create(pParent.pParent, *rCoreAttrs); + return VclPtr<ScTpDefaultsOptions>::Create(pParent, *rCoreAttrs); } bool ScTpDefaultsOptions::FillItemSet(SfxItemSet *rCoreSet) @@ -48,11 +38,11 @@ bool ScTpDefaultsOptions::FillItemSet(SfxItemSet *rCoreSet) bool bRet = false; ScDefaultsOptions aOpt; - SCTAB nTabCount = static_cast<SCTAB>(m_pEdNSheets->GetValue()); - OUString aSheetPrefix = m_pEdSheetPrefix->GetText(); + SCTAB nTabCount = static_cast<SCTAB>(m_xEdNSheets->get_value()); + OUString aSheetPrefix = m_xEdSheetPrefix->get_text(); - if ( m_pEdNSheets->IsValueChangedFromSaved() - || m_pEdSheetPrefix->GetSavedValue() != aSheetPrefix ) + if ( m_xEdNSheets->get_value_changed_from_saved() + || m_xEdSheetPrefix->get_saved_value() != aSheetPrefix ) { aOpt.SetInitTabCount( nTabCount ); aOpt.SetInitTabPrefix( aSheetPrefix ); @@ -71,10 +61,10 @@ void ScTpDefaultsOptions::Reset(const SfxItemSet* rCoreSet) if(SfxItemState::SET == rCoreSet->GetItemState(SID_SCDEFAULTSOPTIONS, false , &pItem)) aOpt = static_cast<const ScTpDefaultsItem*>(pItem)->GetDefaultsOptions(); - m_pEdNSheets->SetValue( static_cast<sal_uInt16>( aOpt.GetInitTabCount()) ); - m_pEdSheetPrefix->SetText( aOpt.GetInitTabPrefix() ); - m_pEdNSheets->SaveValue(); - m_pEdSheetPrefix->SaveValue(); + m_xEdNSheets->set_value(aOpt.GetInitTabCount()); + m_xEdSheetPrefix->set_text( aOpt.GetInitTabPrefix() ); + m_xEdNSheets->save_value(); + m_xEdSheetPrefix->save_value(); } DeactivateRC ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/) @@ -84,55 +74,49 @@ DeactivateRC ScTpDefaultsOptions::DeactivatePage(SfxItemSet* /*pSet*/) void ScTpDefaultsOptions::CheckNumSheets() { - sal_Int64 nVal = m_pEdNSheets->GetValue(); + auto nVal = m_xEdNSheets->get_value(); if (nVal > MAXINITTAB) - m_pEdNSheets->SetValue(MAXINITTAB); + m_xEdNSheets->set_value(MAXINITTAB); if (nVal < MININITTAB) - m_pEdNSheets->SetValue(MININITTAB); + m_xEdNSheets->set_value(MININITTAB); } -void ScTpDefaultsOptions::CheckPrefix(Edit* pEdit) +void ScTpDefaultsOptions::CheckPrefix() { - if (!pEdit) - return; - - OUString aSheetPrefix = pEdit->GetText(); + OUString aSheetPrefix = m_xEdSheetPrefix->get_text(); - if ( !aSheetPrefix.isEmpty() && !ScDocument::ValidTabName( aSheetPrefix ) ) + if (!aSheetPrefix.isEmpty() && !ScDocument::ValidTabName(aSheetPrefix)) { // Revert to last good Prefix and also select it to // indicate something illegal was typed - Selection aSel( 0, maOldPrefixValue.getLength() ); - pEdit->SetText( maOldPrefixValue, aSel ); + m_xEdSheetPrefix->set_text(maOldPrefixValue); + m_xEdSheetPrefix->select_region(0, -1); } else { - OnFocusPrefixInput(pEdit); + OnFocusPrefixInput(); } } -void ScTpDefaultsOptions::OnFocusPrefixInput(const Edit* pEdit) +void ScTpDefaultsOptions::OnFocusPrefixInput() { - if (!pEdit) - return; - // Store Prefix in case we need to revert - maOldPrefixValue = pEdit->GetText(); + maOldPrefixValue = m_xEdSheetPrefix->get_text(); } -IMPL_LINK_NOARG(ScTpDefaultsOptions, NumModifiedHdl, Edit&, void) +IMPL_LINK_NOARG(ScTpDefaultsOptions, NumModifiedHdl, weld::Entry&, void) { CheckNumSheets(); } -IMPL_LINK( ScTpDefaultsOptions, PrefixModifiedHdl, Edit&, rEdit, void ) +IMPL_LINK_NOARG(ScTpDefaultsOptions, PrefixModifiedHdl, weld::Entry&, void) { - CheckPrefix(&rEdit); + CheckPrefix(); } -IMPL_LINK( ScTpDefaultsOptions, PrefixEditOnFocusHdl, Control&, rControl, void ) +IMPL_LINK_NOARG(ScTpDefaultsOptions, PrefixEditOnFocusHdl, weld::Widget&, void) { - OnFocusPrefixInput(static_cast<Edit*>(&rControl)); + OnFocusPrefixInput(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/uiconfig/scalc/ui/optdefaultpage.ui b/sc/uiconfig/scalc/ui/optdefaultpage.ui index 9cec1bf4d904..df269e5f1a7a 100644 --- a/sc/uiconfig/scalc/ui/optdefaultpage.ui +++ b/sc/uiconfig/scalc/ui/optdefaultpage.ui @@ -1,5 +1,5 @@ <?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="GtkAdjustment" id="adjustment1"> @@ -36,10 +36,10 @@ <object class="GtkLabel" id="textsheetsnumber"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="optdefaultpage|textsheetsnumber">_Number of worksheets in new document:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">sheetsnumber</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -50,10 +50,10 @@ <object class="GtkLabel" id="textsheetprefix"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="optdefaultpage|textsheetprefix">_Prefix name for new worksheet:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">sheetprefix</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -65,6 +65,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="valign">center</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -76,6 +77,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> + <property name="activates_default">True</property> <property name="adjustment">adjustment1</property> <property name="climb_rate">1</property> <property name="update_policy">if-valid</property> commit 9ece9fdd33d17e88768dd96ac347938e57bc7918 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Sat Jul 27 21:24:34 2019 +0100 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Sun Jul 28 22:13:45 2019 +0200 weld SwLoadOptPage Change-Id: Id415d2fc6a1476eb5adaf633a8c4932e267ba3b7 Reviewed-on: https://gerrit.libreoffice.org/76485 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 4bffcc5f0598..5ce9878d0403 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -83,26 +83,25 @@ FieldUnit SwFieldUnitTable::GetValue(sal_uInt32 nPos) return FieldUnit::NONE; } -SwLoadOptPage::SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet) - : SfxTabPage(pParent, "OptGeneralPage", "modules/swriter/ui/optgeneralpage.ui", &rSet) +SwLoadOptPage::SwLoadOptPage(TabPageParent pParent, const SfxItemSet& rSet) + : SfxTabPage(pParent, "modules/swriter/ui/optgeneralpage.ui", "OptGeneralPage", &rSet) , m_pWrtShell(nullptr) , m_nLastTab(0) , m_nOldLinkMode(MANUAL) + , m_xAlwaysRB(m_xBuilder->weld_radio_button("always")) + , m_xRequestRB(m_xBuilder->weld_radio_button("onrequest")) + , m_xNeverRB(m_xBuilder->weld_radio_button("never")) + , m_xAutoUpdateFields(m_xBuilder->weld_check_button("updatefields")) + , m_xAutoUpdateCharts(m_xBuilder->weld_check_button("updatecharts")) + , m_xMetricLB(m_xBuilder->weld_combo_box("metric")) + , m_xTabFT(m_xBuilder->weld_label("tablabel")) + , m_xTabMF(m_xBuilder->weld_metric_spin_button("tab", FieldUnit::CM)) + , m_xUseSquaredPageMode(m_xBuilder->weld_check_button("squaremode")) + , m_xUseCharUnit(m_xBuilder->weld_check_button("usecharunit")) + , m_xWordCountED(m_xBuilder->weld_entry("wordcount")) + , m_xShowStandardizedPageCount(m_xBuilder->weld_check_button("standardizedpageshow")) + , m_xStandardizedPageSizeNF(m_xBuilder->weld_spin_button("standardpagesize")) { - get(m_pAlwaysRB, "always"); - get(m_pRequestRB, "onrequest"); - get(m_pNeverRB, "never"); - get(m_pAutoUpdateFields, "updatefields"); - get(m_pAutoUpdateCharts, "updatecharts"); - get(m_pMetricLB, "metric"); - get(m_pTabFT, "tablabel"); - get(m_pTabMF, "tab"); - get(m_pUseSquaredPageMode, "squaremode"); - get(m_pUseCharUnit, "usecharunit"); - get(m_pWordCountED, "wordcount"); - get(m_pShowStandardizedPageCount, "standardizedpageshow"); - get(m_pStandardizedPageSizeNF, "standardpagesize"); - for (sal_uInt32 i = 0; i < SwFieldUnitTable::Count(); ++i) { const OUString sMetric = SwFieldUnitTable::GetString(i); @@ -117,67 +116,46 @@ SwLoadOptPage::SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet) case FieldUnit::INCH: { // use only these metrics - sal_Int32 nPos = m_pMetricLB->InsertEntry( sMetric ); - m_pMetricLB->SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_IntPtr>(eFUnit)) ); + m_xMetricLB->append(OUString::number(static_cast<sal_uInt32>(eFUnit)), sMetric); break; } default:; //prevent warning } } - m_pMetricLB->SetSelectHdl(LINK(this, SwLoadOptPage, MetricHdl)); + m_xMetricLB->connect_changed(LINK(this, SwLoadOptPage, MetricHdl)); const SfxPoolItem* pItem; if (SfxItemState::SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem) && static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON) { - m_pTabFT->Hide(); - m_pTabMF->Hide(); + m_xTabFT->hide(); + m_xTabMF->hide(); } SvtCJKOptions aCJKOptions; if(!aCJKOptions.IsAsianTypographyEnabled()) { - m_pUseSquaredPageMode->Hide(); - m_pUseCharUnit->Hide(); + m_xUseSquaredPageMode->hide(); + m_xUseCharUnit->hide(); } - Link<Button*,void> aLink = LINK(this, SwLoadOptPage, StandardizedPageCountCheckHdl); - m_pShowStandardizedPageCount->SetClickHdl(aLink); + Link<weld::Button&,void> aLink = LINK(this, SwLoadOptPage, StandardizedPageCountCheckHdl); + m_xShowStandardizedPageCount->connect_clicked(aLink); } SwLoadOptPage::~SwLoadOptPage() { - disposeOnce(); -} - -void SwLoadOptPage::dispose() -{ - m_pAlwaysRB.clear(); - m_pRequestRB.clear(); - m_pNeverRB.clear(); - m_pAutoUpdateFields.clear(); - m_pAutoUpdateCharts.clear(); - m_pMetricLB.clear(); - m_pTabFT.clear(); - m_pTabMF.clear(); - m_pUseSquaredPageMode.clear(); - m_pUseCharUnit.clear(); - m_pWordCountED.clear(); - m_pShowStandardizedPageCount.clear(); - m_pStandardizedPageSizeNF.clear(); - SfxTabPage::dispose(); } - VclPtr<SfxTabPage> SwLoadOptPage::Create( TabPageParent pParent, const SfxItemSet* rAttrSet ) { - return VclPtr<SwLoadOptPage>::Create(pParent.pParent, *rAttrSet ); + return VclPtr<SwLoadOptPage>::Create(pParent, *rAttrSet ); } -IMPL_LINK_NOARG(SwLoadOptPage, StandardizedPageCountCheckHdl, Button*, void) +IMPL_LINK_NOARG(SwLoadOptPage, StandardizedPageCountCheckHdl, weld::Button&, void) { - m_pStandardizedPageSizeNF->Enable(m_pShowStandardizedPageCount->IsChecked()); + m_xStandardizedPageSizeNF->set_sensitive(m_xShowStandardizedPageCount->get_active()); } bool SwLoadOptPage::FillItemSet( SfxItemSet* rSet ) @@ -186,16 +164,16 @@ bool SwLoadOptPage::FillItemSet( SfxItemSet* rSet ) SwModule* pMod = SW_MOD(); sal_Int32 nNewLinkMode = AUTOMATIC; - if (m_pNeverRB->IsChecked()) + if (m_xNeverRB->get_active()) nNewLinkMode = NEVER; - else if (m_pRequestRB->IsChecked()) + else if (m_xRequestRB->get_active()) nNewLinkMode = MANUAL; - SwFieldUpdateFlags eFieldFlags = m_pAutoUpdateFields->IsChecked() ? - m_pAutoUpdateCharts->IsChecked() ? AUTOUPD_FIELD_AND_CHARTS : AUTOUPD_FIELD_ONLY : AUTOUPD_OFF; + SwFieldUpdateFlags eFieldFlags = m_xAutoUpdateFields->get_active() ? + m_xAutoUpdateCharts->get_active() ? AUTOUPD_FIELD_AND_CHARTS : AUTOUPD_FIELD_ONLY : AUTOUPD_OFF; - if(m_pAutoUpdateFields->IsValueChangedFromSaved() || - m_pAutoUpdateCharts->IsValueChangedFromSaved()) + if (m_xAutoUpdateFields->get_state_changed_from_saved() || + m_xAutoUpdateCharts->get_state_changed_from_saved()) { pMod->ApplyFieldUpdateFlags(eFieldFlags); if(m_pWrtShell) @@ -217,65 +195,65 @@ bool SwLoadOptPage::FillItemSet( SfxItemSet* rSet ) bRet = true; } - const sal_Int32 nMPos = m_pMetricLB->GetSelectedEntryPos(); - if ( m_pMetricLB->IsValueChangedFromSaved() ) + const sal_Int32 nMPos = m_xMetricLB->get_active(); + if (m_xMetricLB->get_value_changed_from_saved()) { // Double-Cast for VA3.0 - const sal_uInt16 nFieldUnit = static_cast<sal_uInt16>(reinterpret_cast<sal_IntPtr>(m_pMetricLB->GetEntryData( nMPos ))); + const sal_uInt16 nFieldUnit = m_xMetricLB->get_id(nMPos).toUInt32(); rSet->Put( SfxUInt16Item( SID_ATTR_METRIC, nFieldUnit ) ); bRet = true; } - if(m_pTabMF->IsVisible() && m_pTabMF->IsValueChangedFromSaved()) + if (m_xTabMF->get_visible() && m_xTabMF->get_value_changed_from_saved()) { rSet->Put(SfxUInt16Item(SID_ATTR_DEFTABSTOP, - static_cast<sal_uInt16>(m_pTabMF->Denormalize(m_pTabMF->GetValue(FieldUnit::TWIP))))); + static_cast<sal_uInt16>(m_xTabMF->denormalize(m_xTabMF->get_value(FieldUnit::TWIP))))); bRet = true; } - bool bIsUseCharUnitFlag = m_pUseCharUnit->IsChecked(); + bool bIsUseCharUnitFlag = m_xUseCharUnit->get_active(); SvtCJKOptions aCJKOptions; bIsUseCharUnitFlag = bIsUseCharUnitFlag && aCJKOptions.IsAsianTypographyEnabled(); - if( (bIsUseCharUnitFlag ? 1 : 0) != m_pUseCharUnit->GetSavedValue()) + if( (bIsUseCharUnitFlag ? 1 : 0) != m_xUseCharUnit->get_saved_state()) { rSet->Put(SfxBoolItem(SID_ATTR_APPLYCHARUNIT, bIsUseCharUnitFlag )); bRet = true; } - if( m_pWordCountED->IsValueChangedFromSaved() ) + if (m_xWordCountED->get_value_changed_from_saved()) { std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create()); - officecfg::Office::Writer::WordCount::AdditionalSeparators::set(m_pWordCountED->GetText(), batch); + officecfg::Office::Writer::WordCount::AdditionalSeparators::set(m_xWordCountED->get_text(), batch); batch->commit(); bRet = true; } - if (m_pShowStandardizedPageCount->GetState() != m_pShowStandardizedPageCount->GetSavedValue()) + if (m_xShowStandardizedPageCount->get_state_changed_from_saved()) { std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create()); officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::set( - m_pShowStandardizedPageCount->IsChecked(), + m_xShowStandardizedPageCount->get_active(), batch); batch->commit(); bRet = true; } - if (m_pStandardizedPageSizeNF->GetText() != m_pStandardizedPageSizeNF->GetSavedValue()) + if (m_xStandardizedPageSizeNF->get_value_changed_from_saved()) { std::shared_ptr< comphelper::ConfigurationChanges > batch( comphelper::ConfigurationChanges::create()); officecfg::Office::Writer::WordCount::StandardizedPageSize::set( - m_pStandardizedPageSizeNF->GetValue(), + m_xStandardizedPageSizeNF->get_value(), batch); batch->commit(); bRet = true; } - bool bIsSquaredPageModeFlag = m_pUseSquaredPageMode->IsChecked(); - if ( bIsSquaredPageModeFlag != static_cast<bool>(m_pUseSquaredPageMode->GetSavedValue()) ) + if (m_xUseSquaredPageMode->get_state_changed_from_saved()) { + bool bIsSquaredPageModeFlag = m_xUseSquaredPageMode->get_active(); pMod->ApplyDefaultPageMode( bIsSquaredPageModeFlag ); if ( m_pWrtShell ) { @@ -309,88 +287,88 @@ void SwLoadOptPage::Reset( const SfxItemSet* rSet) if(AUTOUPD_GLOBALSETTING == eFieldFlags) eFieldFlags = pUsrPref->GetFieldUpdateFlags(); - m_pAutoUpdateFields->Check(eFieldFlags != AUTOUPD_OFF); - m_pAutoUpdateCharts->Check(eFieldFlags == AUTOUPD_FIELD_AND_CHARTS); + m_xAutoUpdateFields->set_active(eFieldFlags != AUTOUPD_OFF); + m_xAutoUpdateCharts->set_active(eFieldFlags == AUTOUPD_FIELD_AND_CHARTS); switch (m_nOldLinkMode) { - case NEVER: m_pNeverRB->Check(); break; - case MANUAL: m_pRequestRB->Check(); break; - case AUTOMATIC: m_pAlwaysRB->Check(); break; + case NEVER: m_xNeverRB->set_active(true); break; + case MANUAL: m_xRequestRB->set_active(true); break; + case AUTOMATIC: m_xAlwaysRB->set_active(true); break; } - m_pAutoUpdateFields->SaveValue(); - m_pAutoUpdateCharts->SaveValue(); - m_pMetricLB->SetNoSelection(); + m_xAutoUpdateFields->save_state(); + m_xAutoUpdateCharts->save_state(); + m_xMetricLB->set_active(-1); if ( rSet->GetItemState( SID_ATTR_METRIC ) >= SfxItemState::DEFAULT ) { const SfxUInt16Item& rItem = rSet->Get( SID_ATTR_METRIC ); FieldUnit eFieldUnit = static_cast<FieldUnit>(rItem.GetValue()); - for ( sal_Int32 i = 0; i < m_pMetricLB->GetEntryCount(); ++i ) + for (sal_Int32 i = 0, nEntryCount = m_xMetricLB->get_count(); i < nEntryCount; ++i) { - if ( static_cast<int>(reinterpret_cast<sal_IntPtr>(m_pMetricLB->GetEntryData( i ))) == static_cast<int>(eFieldUnit) ) + if (m_xMetricLB->get_id(i).toUInt32() == static_cast<sal_uInt32>(eFieldUnit)) { - m_pMetricLB->SelectEntryPos( i ); + m_xMetricLB->set_active(i); break; } } - ::SetFieldUnit(*m_pTabMF, eFieldUnit); + ::SetFieldUnit(*m_xTabMF, eFieldUnit); } - m_pMetricLB->SaveValue(); + m_xMetricLB->save_value(); if(SfxItemState::SET == rSet->GetItemState(SID_ATTR_DEFTABSTOP, false, &pItem)) { m_nLastTab = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); - m_pTabMF->SetValue(m_pTabMF->Normalize(m_nLastTab), FieldUnit::TWIP); + m_xTabMF->set_value(m_xTabMF->normalize(m_nLastTab), FieldUnit::TWIP); } - m_pTabMF->SaveValue(); + m_xTabMF->save_value(); //default page mode loading if(m_pWrtShell) { bool bSquaredPageMode = m_pWrtShell->GetDoc()->IsSquaredPageMode(); - m_pUseSquaredPageMode->Check( bSquaredPageMode ); - m_pUseSquaredPageMode->SaveValue(); + m_xUseSquaredPageMode->set_active( bSquaredPageMode ); + m_xUseSquaredPageMode->save_state(); } if(SfxItemState::SET == rSet->GetItemState(SID_ATTR_APPLYCHARUNIT, false, &pItem)) { bool bUseCharUnit = static_cast<const SfxBoolItem*>(pItem)->GetValue(); - m_pUseCharUnit->Check(bUseCharUnit); + m_xUseCharUnit->set_active(bUseCharUnit); } else { - m_pUseCharUnit->Check(pUsrPref->IsApplyCharUnit()); + m_xUseCharUnit->set_active(pUsrPref->IsApplyCharUnit()); } - m_pUseCharUnit->SaveValue(); + m_xUseCharUnit->save_state(); - m_pWordCountED->SetText(officecfg::Office::Writer::WordCount::AdditionalSeparators::get()); - m_pWordCountED->Enable(!officecfg::Office::Writer::WordCount::AdditionalSeparators::isReadOnly()); - m_pWordCountED->SaveValue(); - m_pShowStandardizedPageCount->Check(officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::get()); - m_pShowStandardizedPageCount->Enable(!officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::isReadOnly()); - m_pShowStandardizedPageCount->SaveValue(); - m_pStandardizedPageSizeNF->SetValue(officecfg::Office::Writer::WordCount::StandardizedPageSize::get()); - m_pStandardizedPageSizeNF->Enable(!officecfg::Office::Writer::WordCount::StandardizedPageSize::isReadOnly()); - m_pStandardizedPageSizeNF->SaveValue(); - m_pStandardizedPageSizeNF->Enable(m_pShowStandardizedPageCount->IsChecked()); + m_xWordCountED->set_text(officecfg::Office::Writer::WordCount::AdditionalSeparators::get()); + m_xWordCountED->set_sensitive(!officecfg::Office::Writer::WordCount::AdditionalSeparators::isReadOnly()); + m_xWordCountED->save_value(); + m_xShowStandardizedPageCount->set_active(officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::get()); + m_xShowStandardizedPageCount->set_sensitive(!officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::isReadOnly()); + m_xShowStandardizedPageCount->save_state(); + m_xStandardizedPageSizeNF->set_value(officecfg::Office::Writer::WordCount::StandardizedPageSize::get()); + m_xStandardizedPageSizeNF->set_sensitive(!officecfg::Office::Writer::WordCount::StandardizedPageSize::isReadOnly()); + m_xStandardizedPageSizeNF->save_value(); + m_xStandardizedPageSizeNF->set_sensitive(m_xShowStandardizedPageCount->get_active()); } -IMPL_LINK_NOARG(SwLoadOptPage, MetricHdl, ListBox&, void) +IMPL_LINK_NOARG(SwLoadOptPage, MetricHdl, weld::ComboBox&, void) { - const sal_Int32 nMPos = m_pMetricLB->GetSelectedEntryPos(); - if(nMPos != LISTBOX_ENTRY_NOTFOUND) + const sal_Int32 nMPos = m_xMetricLB->get_active(); + if(nMPos != -1) { // Double-Cast for VA3.0 - FieldUnit eFieldUnit = static_cast<FieldUnit>(reinterpret_cast<sal_IntPtr>(m_pMetricLB->GetEntryData( nMPos ))); - bool bModified = m_pTabMF->IsModified(); + FieldUnit eFieldUnit = static_cast<FieldUnit>(m_xMetricLB->get_id(nMPos).toUInt32()); + bool bModified = m_xTabMF->get_value_changed_from_saved(); long nVal = bModified ? - sal::static_int_cast<sal_Int32, sal_Int64 >( m_pTabMF->Denormalize( m_pTabMF->GetValue( FieldUnit::TWIP ) )) : + sal::static_int_cast<sal_Int32, sal_Int64 >( m_xTabMF->denormalize( m_xTabMF->get_value( FieldUnit::TWIP ) )) : m_nLastTab; - ::SetFieldUnit( *m_pTabMF, eFieldUnit ); - m_pTabMF->SetValue( m_pTabMF->Normalize( nVal ), FieldUnit::TWIP ); - if(!bModified) - m_pTabMF->ClearModifyFlag(); + ::SetFieldUnit( *m_xTabMF, eFieldUnit ); + m_xTabMF->set_value( m_xTabMF->normalize( nVal ), FieldUnit::TWIP ); + if (!bModified) + m_xTabMF->save_value(); } } diff --git a/sw/source/uibase/inc/optload.hxx b/sw/source/uibase/inc/optload.hxx index 7f19f94f7536..8d00320c2035 100644 --- a/sw/source/uibase/inc/optload.hxx +++ b/sw/source/uibase/inc/optload.hxx @@ -60,33 +60,32 @@ public: class SwLoadOptPage : public SfxTabPage { private: - VclPtr<RadioButton> m_pAlwaysRB; - VclPtr<RadioButton> m_pRequestRB; - VclPtr<RadioButton> m_pNeverRB; - - VclPtr<CheckBox> m_pAutoUpdateFields; - VclPtr<CheckBox> m_pAutoUpdateCharts; - - VclPtr<ListBox> m_pMetricLB; - VclPtr<FixedText> m_pTabFT; - VclPtr<MetricField> m_pTabMF; - VclPtr<CheckBox> m_pUseSquaredPageMode; - VclPtr<CheckBox> m_pUseCharUnit; - VclPtr<Edit> m_pWordCountED; - VclPtr<CheckBox> m_pShowStandardizedPageCount; - VclPtr<NumericField> m_pStandardizedPageSizeNF; - SwWrtShell* m_pWrtShell; sal_uInt16 m_nLastTab; sal_Int32 m_nOldLinkMode; - DECL_LINK(MetricHdl, ListBox&, void); - DECL_LINK(StandardizedPageCountCheckHdl, Button*, void); + std::unique_ptr<weld::RadioButton> m_xAlwaysRB; + std::unique_ptr<weld::RadioButton> m_xRequestRB; + std::unique_ptr<weld::RadioButton> m_xNeverRB; + + std::unique_ptr<weld::CheckButton> m_xAutoUpdateFields; + std::unique_ptr<weld::CheckButton> m_xAutoUpdateCharts; + + std::unique_ptr<weld::ComboBox> m_xMetricLB; + std::unique_ptr<weld::Label> m_xTabFT; + std::unique_ptr<weld::MetricSpinButton> m_xTabMF; + std::unique_ptr<weld::CheckButton> m_xUseSquaredPageMode; + std::unique_ptr<weld::CheckButton> m_xUseCharUnit; + std::unique_ptr<weld::Entry> m_xWordCountED; + std::unique_ptr<weld::CheckButton> m_xShowStandardizedPageCount; + std::unique_ptr<weld::SpinButton> m_xStandardizedPageSizeNF; + + DECL_LINK(MetricHdl, weld::ComboBox&, void); + DECL_LINK(StandardizedPageCountCheckHdl, weld::Button&, void); public: - SwLoadOptPage(vcl::Window* pParent, const SfxItemSet& rSet); + SwLoadOptPage(TabPageParent pParent, const SfxItemSet& rSet); virtual ~SwLoadOptPage() override; - virtual void dispose() override; static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rAttrSet); diff --git a/sw/uiconfig/swriter/ui/optgeneralpage.ui b/sw/uiconfig/swriter/ui/optgeneralpage.ui index d6f18bc1180c..f2d5ddb867b4 100644 --- a/sw/uiconfig/swriter/ui/optgeneralpage.ui +++ b/sw/uiconfig/swriter/ui/optgeneralpage.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkAdjustment" id="adjustment-sps"> @@ -64,7 +64,6 @@ <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> - <property name="group">onrequest</property> </object> <packing> <property name="left_attach">0</property> @@ -80,7 +79,7 @@ <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="group">never</property> + <property name="group">always</property> </object> <packing> <property name="left_attach">0</property> @@ -224,10 +223,10 @@ <object class="GtkLabel" id="label5"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="optgeneralpage|label5">_Measurement unit:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">metric</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -249,10 +248,10 @@ <object class="GtkLabel" id="tablabel"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">1</property> <property name="label" translatable="yes" context="optgeneralpage|tablabel">_Tab stops:</property> <property name="use_underline">True</property> - <property name="mnemonic_widget">tab:0.00cm</property> + <property name="mnemonic_widget">tab</property> + <property name="xalign">1</property> </object> <packing> <property name="left_attach">0</property> @@ -260,11 +259,12 @@ </packing> </child> <child> - <object class="GtkSpinButton" id="tab:0.00cm"> + <object class="GtkSpinButton" id="tab"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> - <property name="text" translatable="no">1.25</property> + <property name="activates_default">True</property> + <property name="text">1.25</property> <property name="adjustment">adjustment1</property> <property name="digits">2</property> <property name="value">1.25</property> @@ -373,10 +373,10 @@ <object class="GtkLabel" id="label7"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="optgeneralpage|label7">_Additional separators:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">wordcount</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -388,6 +388,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> @@ -434,10 +435,10 @@ <object class="GtkLabel" id="labelstandardpages"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="optgeneralpage|labelstandardpages">Characters per standardized page:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">standardpagesize</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -449,7 +450,8 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="halign">start</property> - <property name="text" translatable="no">1800</property> + <property name="activates_default">True</property> + <property name="text">1800</property> <property name="adjustment">adjustment-sps</property> <property name="value">1800</property> </object> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits