From 0bcb591b0cba12a285556ece7c6e5028309e6da3 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 2 Jun 2026 11:15:26 +0200 Subject: [PATCH] weld: Move weld::TriStateEnabled to own header/source Move the class definition and implementation out of weld.hxx and weldutils.cxx into its own header and source file, in order to make it easier to keep an overview and to avoid having to recompile ~all UI code when the class is modified. Change-Id: I97768bf75dac492e32e1d387853d123481aa643a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205902 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- .../controller/dialogs/res_DataLabel.hxx | 1 + cui/source/inc/FontFeaturesDialog.hxx | 1 + cui/source/inc/align.hxx | 1 + cui/source/inc/chardlg.hxx | 1 + cui/source/inc/paragrph.hxx | 1 + include/svtools/editbrowsebox.hxx | 1 + include/vcl/weld/TriStateEnabled.hxx | 30 ++++++++++++++++ include/vcl/weld/weld.hxx | 12 ------- sc/source/ui/inc/tabpages.hxx | 1 + vcl/Library_vcl.mk | 1 + vcl/source/weld/TriStateEnabled.cxx | 35 +++++++++++++++++++ vcl/source/weld/weldutils.cxx | 20 ----------- 12 files changed, 73 insertions(+), 32 deletions(-) create mode 100644 include/vcl/weld/TriStateEnabled.hxx create mode 100644 vcl/source/weld/TriStateEnabled.cxx diff --git a/chart2/source/controller/dialogs/res_DataLabel.hxx b/chart2/source/controller/dialogs/res_DataLabel.hxx index ec77c8111554..dfe1cdfd8945 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.hxx +++ b/chart2/source/controller/dialogs/res_DataLabel.hxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include diff --git a/cui/source/inc/FontFeaturesDialog.hxx b/cui/source/inc/FontFeaturesDialog.hxx index 62025cd3b082..c5e77e9dab9e 100644 --- a/cui/source/inc/FontFeaturesDialog.hxx +++ b/cui/source/inc/FontFeaturesDialog.hxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/cui/source/inc/align.hxx b/cui/source/inc/align.hxx index be90401b2d50..7aa1f48b8924 100644 --- a/cui/source/inc/align.hxx +++ b/cui/source/inc/align.hxx @@ -45,6 +45,7 @@ enum VerticalAlign { #include #include #include +#include #include class SvxJustifyMethodItem; diff --git a/cui/source/inc/chardlg.hxx b/cui/source/inc/chardlg.hxx index df380a0e8543..1b6a032c22b1 100644 --- a/cui/source/inc/chardlg.hxx +++ b/cui/source/inc/chardlg.hxx @@ -30,6 +30,7 @@ #include #include #include +#include #include #include diff --git a/cui/source/inc/paragrph.hxx b/cui/source/inc/paragrph.hxx index 7a39dc2b6625..a46c8b7d4c9e 100644 --- a/cui/source/inc/paragrph.hxx +++ b/cui/source/inc/paragrph.hxx @@ -25,6 +25,7 @@ #include #include #include +#include class SvxLineSpacingItem; diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index 08e8e8eab26c..3e2133ecf909 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/include/vcl/weld/TriStateEnabled.hxx b/include/vcl/weld/TriStateEnabled.hxx new file mode 100644 index 000000000000..584adb071e2d --- /dev/null +++ b/include/vcl/weld/TriStateEnabled.hxx @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include +#include + +namespace weld +{ +struct VCL_DLLPUBLIC TriStateEnabled +{ + TriState eState; + bool bTriStateEnabled; + TriStateEnabled() + : eState(TRISTATE_INDET) + , bTriStateEnabled(true) + { + } + void CheckButtonToggled(CheckButton& rToggle); +}; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/include/vcl/weld/weld.hxx b/include/vcl/weld/weld.hxx index 7133d38795a5..c1c11152697d 100644 --- a/include/vcl/weld/weld.hxx +++ b/include/vcl/weld/weld.hxx @@ -131,18 +131,6 @@ public: virtual void set_label_wrap(bool wrap) = 0; }; -struct VCL_DLLPUBLIC TriStateEnabled -{ - TriState eState; - bool bTriStateEnabled; - TriStateEnabled() - : eState(TRISTATE_INDET) - , bTriStateEnabled(true) - { - } - void CheckButtonToggled(CheckButton& rToggle); -}; - class VCL_DLLPUBLIC RadioButton : virtual public Toggleable { public: diff --git a/sc/source/ui/inc/tabpages.hxx b/sc/source/ui/inc/tabpages.hxx index f7f70673a047..6d8accec40c0 100644 --- a/sc/source/ui/inc/tabpages.hxx +++ b/sc/source/ui/inc/tabpages.hxx @@ -20,6 +20,7 @@ #pragma once #include +#include class ScTabPageProtection : public SfxTabPage { diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index bf8edaebb8b5..771677e9f192 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -614,6 +614,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/weld/TextView \ vcl/source/weld/TextWidget \ vcl/source/weld/TreeView \ + vcl/source/weld/TriStateEnabled \ vcl/source/weld/WaitObject \ vcl/source/weld/Widget \ vcl/source/weld/weldutils \ diff --git a/vcl/source/weld/TriStateEnabled.cxx b/vcl/source/weld/TriStateEnabled.cxx new file mode 100644 index 000000000000..a96020228a15 --- /dev/null +++ b/vcl/source/weld/TriStateEnabled.cxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include + +namespace weld +{ +void TriStateEnabled::CheckButtonToggled(weld::CheckButton& rToggle) +{ + if (bTriStateEnabled) + { + switch (eState) + { + case TRISTATE_INDET: + rToggle.set_state(TRISTATE_FALSE); + break; + case TRISTATE_TRUE: + rToggle.set_state(TRISTATE_INDET); + break; + case TRISTATE_FALSE: + rToggle.set_state(TRISTATE_TRUE); + break; + } + } + eState = rToggle.get_state(); +} +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/weld/weldutils.cxx b/vcl/source/weld/weldutils.cxx index 51eb42002f43..c073cd620337 100644 --- a/vcl/source/weld/weldutils.cxx +++ b/vcl/source/weld/weldutils.cxx @@ -41,26 +41,6 @@ BuilderPage::~BuilderPage() {} namespace weld { -void TriStateEnabled::CheckButtonToggled(weld::CheckButton& rToggle) -{ - if (bTriStateEnabled) - { - switch (eState) - { - case TRISTATE_INDET: - rToggle.set_state(TRISTATE_FALSE); - break; - case TRISTATE_TRUE: - rToggle.set_state(TRISTATE_INDET); - break; - case TRISTATE_FALSE: - rToggle.set_state(TRISTATE_TRUE); - break; - } - } - eState = rToggle.get_state(); -} - size_t GetAbsPos(const weld::TreeView& rTreeView, const weld::TreeIter& rIter) { size_t nAbsPos = 0;