cui/source/inc/numfmt.hxx | 5 ++-- cui/source/tabpages/numfmt.cxx | 46 ++++++++++++++++++----------------------- 2 files changed, 24 insertions(+), 27 deletions(-)
New commits: commit 2da439e02f384e5db8332fae1472016e23a3ebfe Author: Michael Weghorn <[email protected]> AuthorDate: Thu Jan 22 22:29:17 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jan 23 10:40:37 2026 +0100 tdf#130857 cui: Enable/Disable whole frame instead of label child Don't set the frame's internal label child to enabled/disabled, but do this for the whole frame. For the case where the label/frame is disabled, all widgets it contains are also set to disabled, so the parent being disabled is fine, too. (For the case where the label/frame is enabled, not necessarily all widgets are set to enabled, so leave the code in place that sets the enabled/sensitive status of the single child widgets.) This also prepares for supporting this tab page with native Qt widgets, where no separate widget exists for the frame's internal label child. 2 ways to trigger dialogs using the tab page: 1) * start Writer * "Insert" -> "Chart" * double-click on the y axis of the chart to open the "Y Axis" dialog * switch to the "Numbers" tab page 2) * start Base, create any new database * with "Tables" selected in the sidebar on the left, choose "Create Table in Design View..." * enter any field name and field type * at the bottom of the window, press the "Format field" button next to "Format example" Change-Id: Ifa01ac92487e796fe5f9e316035810ef1eceae35 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197878 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx index d16bc0b88792..bb7db5326308 100644 --- a/cui/source/inc/numfmt.hxx +++ b/cui/source/inc/numfmt.hxx @@ -98,7 +98,7 @@ private: std::unique_ptr<weld::TreeView> m_xLbFormat; std::unique_ptr<weld::Frame> m_xFrameLocale; std::unique_ptr<weld::CheckButton> m_xCbSourceFormat; - std::unique_ptr<weld::Label> m_xFtOptions; + std::unique_ptr<weld::Frame> m_xOptionsFrame; std::unique_ptr<weld::Label> m_xFtDecimals; std::unique_ptr<weld::SpinButton> m_xEdDecimals; std::unique_ptr<weld::Label> m_xFtDenominator; diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index ddf0a7028b0f..831a50dc6d92 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -203,7 +203,7 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::Dia , m_xLbFormat(m_xBuilder->weld_tree_view(u"formatlb"_ustr)) , m_xFrameLocale(m_xBuilder->weld_frame(u"localeframe"_ustr)) , m_xCbSourceFormat(m_xBuilder->weld_check_button(u"sourceformat"_ustr)) - , m_xFtOptions(m_xBuilder->weld_label(u"optionsft"_ustr)) + , m_xOptionsFrame(m_xBuilder->weld_frame(u"options"_ustr)) , m_xFtDecimals(m_xBuilder->weld_label(u"decimalsft"_ustr)) , m_xEdDecimals(m_xBuilder->weld_spin_button(u"decimalsed"_ustr)) , m_xFtDenominator(m_xBuilder->weld_label(u"denominatorft"_ustr)) @@ -543,6 +543,7 @@ void SvxNumberFormatTabPage::Obstructing() m_xIbRemove->set_sensitive(false ); m_xIbInfo->set_sensitive(false ); + m_xOptionsFrame->set_sensitive(false); m_xBtnNegRed->set_sensitive(false); m_xBtnThousand->set_sensitive(false); m_xBtnEngineering->set_sensitive(false); @@ -552,7 +553,6 @@ void SvxNumberFormatTabPage::Obstructing() m_xEdLeadZeroes->set_sensitive(false); m_xEdDecimals->set_sensitive(false); m_xEdDenominator->set_sensitive(false); - m_xFtOptions->set_sensitive(false); m_xEdDecimals->set_text( OUString() ); m_xEdLeadZeroes->set_text( OUString() ); m_xBtnNegRed->set_active( false ); @@ -584,6 +584,7 @@ void SvxNumberFormatTabPage::EnableBySourceFormat_Impl() m_xLbCurrency->set_sensitive( bEnable ); m_xLbFormat->set_sensitive( bEnable ); m_xFrameLocale->set_sensitive(bEnable); + m_xOptionsFrame->set_sensitive(bEnable); m_xFtDecimals->set_sensitive( bEnable ); m_xEdDecimals->set_sensitive( bEnable ); m_xFtDenominator->set_sensitive( bEnable ); @@ -592,8 +593,7 @@ void SvxNumberFormatTabPage::EnableBySourceFormat_Impl() m_xEdLeadZeroes->set_sensitive( bEnable ); m_xBtnNegRed->set_sensitive( bEnable ); m_xBtnThousand->set_sensitive( bEnable ); - m_xBtnEngineering->set_sensitive( bEnable ); - m_xFtOptions->set_sensitive( bEnable ); + m_xBtnEngineering->set_sensitive(bEnable); m_xFormatCodeFrame->set_sensitive( bEnable ); } @@ -884,7 +884,7 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa case CAT_CURRENCY: case CAT_FRACTION: case CAT_TIME: - m_xFtOptions->set_sensitive(true); + m_xOptionsFrame->set_sensitive(true); if ( nCategory == CAT_FRACTION ) { m_xFtDenominator->set_sensitive(true); @@ -922,7 +922,7 @@ void SvxNumberFormatTabPage::UpdateOptions_Impl( bool bCheckCatChange /*= sal_Fa case CAT_DATE: case CAT_BOOLEAN: default: - m_xFtOptions->set_sensitive(false); + m_xOptionsFrame->set_sensitive(false); m_xFtDecimals->set_sensitive(false); m_xEdDecimals->set_sensitive(false); m_xFtDenominator->set_sensitive(false); commit 5abb8356c53ac9b9df207d17ca5e5b0951aa1f5d Author: Michael Weghorn <[email protected]> AuthorDate: Thu Jan 22 21:43:08 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jan 23 10:40:30 2026 +0100 tdf#130857 cui: Enable/Disable whole frame instead of label + content Don't set the frame's internal label child and the combobox it contains to enabled/disabled separately, but do so for the whole frame. This also prepares for supporting this tab page with native Qt widgets, where no separate widget exists for the frame's internal label child. 2 ways to trigger dialogs using the tab page: 1) * start Writer * "Insert" -> "Chart" * double-click on the y axis of the chart to open the "Y Axis" dialog * switch to the "Numbers" tab page 2) * start Base, create any new database * with "Tables" selected in the sidebar on the left, choose "Create Table in Design View..." * enter any field name and field type * at the bottom of the window, press the "Format field" button next to "Format example" Change-Id: Ib8248d659962be1e1a5b2093c99c3e633f236831 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197877 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx index 76b3b247766c..d16bc0b88792 100644 --- a/cui/source/inc/numfmt.hxx +++ b/cui/source/inc/numfmt.hxx @@ -96,7 +96,7 @@ private: std::unique_ptr<weld::Label> m_xFtFormat; std::unique_ptr<weld::ComboBox> m_xLbCurrency; std::unique_ptr<weld::TreeView> m_xLbFormat; - std::unique_ptr<weld::Label> m_xFtLocale; + std::unique_ptr<weld::Frame> m_xFrameLocale; std::unique_ptr<weld::CheckButton> m_xCbSourceFormat; std::unique_ptr<weld::Label> m_xFtOptions; std::unique_ptr<weld::Label> m_xFtDecimals; diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index 1b8c59bba257..ddf0a7028b0f 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -201,7 +201,7 @@ SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::Dia , m_xFtFormat(m_xBuilder->weld_label(u"formatft"_ustr)) , m_xLbCurrency(m_xBuilder->weld_combo_box(u"currencylb"_ustr)) , m_xLbFormat(m_xBuilder->weld_tree_view(u"formatlb"_ustr)) - , m_xFtLocale(m_xBuilder->weld_label(u"localeft"_ustr)) + , m_xFrameLocale(m_xBuilder->weld_frame(u"localeframe"_ustr)) , m_xCbSourceFormat(m_xBuilder->weld_check_button(u"sourceformat"_ustr)) , m_xFtOptions(m_xBuilder->weld_label(u"optionsft"_ustr)) , m_xFtDecimals(m_xBuilder->weld_label(u"decimalsft"_ustr)) @@ -537,8 +537,7 @@ void SvxNumberFormatTabPage::Obstructing() { m_xLbFormat->unselect_all(); m_xLbLocale->set_active(-1); - m_xFtLocale->set_sensitive(false); - m_xLbLocale->set_sensitive(false); + m_xFrameLocale->set_sensitive(false); m_xIbAdd->set_sensitive(false ); m_xIbRemove->set_sensitive(false ); @@ -584,8 +583,7 @@ void SvxNumberFormatTabPage::EnableBySourceFormat_Impl() m_xFtFormat->set_sensitive( bEnable ); m_xLbCurrency->set_sensitive( bEnable ); m_xLbFormat->set_sensitive( bEnable ); - m_xFtLocale->set_sensitive( bEnable ); - m_xLbLocale->set_sensitive( bEnable ); + m_xFrameLocale->set_sensitive(bEnable); m_xFtDecimals->set_sensitive( bEnable ); m_xEdDecimals->set_sensitive( bEnable ); m_xFtDenominator->set_sensitive( bEnable ); @@ -601,10 +599,9 @@ void SvxNumberFormatTabPage::EnableBySourceFormat_Impl() void SvxNumberFormatTabPage::EnableLocaleUi() { - if (!m_xFtLocale->get_sensitive()) + if (!m_xFrameLocale->get_sensitive()) { - m_xFtLocale->set_sensitive(true); - m_xLbLocale->set_sensitive(true); + m_xFrameLocale->set_sensitive(true); m_xLbLocale->set_active_id(pNumFmtShell->GetCurLanguage()); } } @@ -622,8 +619,7 @@ void SvxNumberFormatTabPage::EnableLocaleUi() void SvxNumberFormatTabPage::HideLanguage(bool bFlag) { - m_xFtLocale->set_visible(!bFlag); - m_xLbLocale->set_visible(!bFlag); + m_xFrameLocale->set_visible(!bFlag); } /************************************************************************* @@ -641,7 +637,7 @@ void SvxNumberFormatTabPage::HideLanguage(bool bFlag) bool SvxNumberFormatTabPage::FillItemSet( SfxItemSet* rCoreAttrs ) { - bool bDataChanged = m_xFtLocale->get_sensitive() || m_xCbSourceFormat->get_sensitive(); + bool bDataChanged = m_xFrameLocale->get_sensitive() || m_xCbSourceFormat->get_sensitive(); if ( bDataChanged ) { const SfxItemSet& rMyItemSet = GetItemSet(); commit 0c819e9ff4be06900edbebc9526f6221812db062 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Jan 22 21:33:00 2026 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Fri Jan 23 10:40:23 2026 +0100 tdf#130857 cui: Replace REMOVE_DONTKNOW macro with a method The method will be further adjusted in an upcoming commit. Change-Id: Ia698d9a56195e9fa6be46ebe391257a6971e2aab Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197876 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> diff --git a/cui/source/inc/numfmt.hxx b/cui/source/inc/numfmt.hxx index 218c1826fc01..76b3b247766c 100644 --- a/cui/source/inc/numfmt.hxx +++ b/cui/source/inc/numfmt.hxx @@ -127,6 +127,7 @@ private: void UpdateDecimalsDenominatorEditBox(); void Obstructing(); void EnableBySourceFormat_Impl(); + void EnableLocaleUi(); void SetCategory( sal_uInt16 nPos ); OUString GetExpColorString( const Color*& rpPreviewColor, const OUString& aFormatStr, short nTmpCatPos ); void MakePreviewText( const OUString& rFormat ); diff --git a/cui/source/tabpages/numfmt.cxx b/cui/source/tabpages/numfmt.cxx index c2ee75564bb5..1b8c59bba257 100644 --- a/cui/source/tabpages/numfmt.cxx +++ b/cui/source/tabpages/numfmt.cxx @@ -189,14 +189,6 @@ void SvxNumberPreview::Paint(vcl::RenderContext& rRenderContext, const ::tools:: // class SvxNumberFormatTabPage ------------------------------------------ -#define REMOVE_DONTKNOW() \ - if (!m_xFtLocale->get_sensitive()) \ - { \ - m_xFtLocale->set_sensitive(true); \ - m_xLbLocale->set_sensitive(true); \ - m_xLbLocale->set_active_id(pNumFmtShell->GetCurLanguage()); \ - } - SvxNumberFormatTabPage::SvxNumberFormatTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreAttrs) : SfxTabPage(pPage, pController, u"cui/ui/numberingformatpage.ui"_ustr, u"NumberingFormatPage"_ustr, &rCoreAttrs) @@ -607,6 +599,15 @@ void SvxNumberFormatTabPage::EnableBySourceFormat_Impl() m_xFormatCodeFrame->set_sensitive( bEnable ); } +void SvxNumberFormatTabPage::EnableLocaleUi() +{ + if (!m_xFtLocale->get_sensitive()) + { + m_xFtLocale->set_sensitive(true); + m_xLbLocale->set_sensitive(true); + m_xLbLocale->set_active_id(pNumFmtShell->GetCurLanguage()); + } +} /************************************************************************* #* Method: HideLanguage @@ -990,8 +991,7 @@ void SvxNumberFormatTabPage::UpdateFormatListBox_Impl pNumFmtShell->LanguageChanged(m_xLbLocale->get_active_id(), nFmtLbSelPos,aEntryList); - REMOVE_DONTKNOW() // possibly UI-Enable - + EnableLocaleUi(); if ( (!aEntryList.empty()) && (nFmtLbSelPos != SELPOS_NONE) ) { @@ -1199,7 +1199,7 @@ void SvxNumberFormatTabPage::SelFormatHdl_Impl(weld::Widget* pLb) ChangePreviewText( static_cast<sal_uInt16>(nSelPos) ); } - REMOVE_DONTKNOW() // possibly UI-Enable + EnableLocaleUi(); if ( pNumFmtShell->FindEntry( aFormat) ) {
