cui/Library_cui.mk | 1 - cui/source/factory/dlgfact.cxx | 26 -------------------------- cui/source/factory/dlgfact.hxx | 3 --- cui/source/inc/cuitabarea.hxx | 2 +- include/vcl/abstdlg.hxx | 3 --- include/vcl/hexcolorcontrol.hxx | 4 ++-- solenv/clang-format/excludelist | 4 ++-- svx/Library_svxcore.mk | 1 - vcl/Library_vcl.mk | 3 +++ vcl/inc/colorpicker.hxx | 2 +- vcl/inc/salvtables.hxx | 5 +++-- vcl/source/app/salvtables.cxx | 23 +++++++++-------------- vcl/source/window/hexcolorcontrol.cxx | 2 +- 13 files changed, 22 insertions(+), 57 deletions(-)
New commits: commit 69449a1ce1a6366ac4677f509d3cd7ba7c11277c Author: Michael Weghorn <[email protected]> AuthorDate: Thu Dec 4 19:59:03 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Dec 8 07:46:05 2025 +0100 tdf#169505 Drop one level of abstraction for ColorPickerDialog Now after Change-Id: Ie3b0d1090300e249e40e1479a40d01caabbdf573 Author: Michael Weghorn <[email protected]> Date: Thu Dec 4 19:37:17 2025 +0100 tdf#169505 Move ColorPickerDialog from cui to vcl , there is no more need for AbstractColorPickerDialog, but ColorPickerDialog can be used directly. Change-Id: I0048c3fbabc4331e4bceac36155051a09d471372 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195095 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit 005d7e91a2f3694cbcec7da367be404795f1ab4c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195148 diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx index d24bc1959f6f..875eb912c9da 100644 --- a/vcl/inc/salvtables.hxx +++ b/vcl/inc/salvtables.hxx @@ -30,6 +30,7 @@ #include <vcl/toolkit/svlbitm.hxx> #include <o3tl/sorted_vector.hxx> #include "calendar.hxx" +#include "colorpicker.hxx" #include "iconview.hxx" #include "messagedialog.hxx" #include "verticaltabctrl.hxx" @@ -2312,10 +2313,10 @@ public: class SalInstanceColorChooserDialog : public SalInstanceDialog, public virtual weld::ColorChooserDialog { - ScopedVclPtr<AbstractColorPickerDialog> m_pAbstractColorPickerDialog; + std::unique_ptr<ColorPickerDialog> m_pColorPickerDialog; public: - SalInstanceColorChooserDialog(AbstractColorPickerDialog* pColorDialog); + SalInstanceColorChooserDialog(std::unique_ptr<ColorPickerDialog> pColorDialog); virtual ~SalInstanceColorChooserDialog() override; virtual void set_color(const Color& rColor) override; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 38b0501771ed..5f7abc62d94b 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -50,7 +50,6 @@ #include <utility> #include <tools/helpers.hxx> #include <vcl/abstdlg.hxx> -#include <vcl/abstdlgimpl.hxx> #include <vcl/builder.hxx> #include <vcl/dndlistenercontainer.hxx> #include <vcl/toolkit/combobox.hxx> @@ -6860,10 +6859,10 @@ void SalInstancePopover::resize_to_request() IMPL_LINK_NOARG(SalInstancePopover, PopupModeEndHdl, FloatingWindow*, void) { signal_closed(); } SalInstanceColorChooserDialog::SalInstanceColorChooserDialog( - AbstractColorPickerDialog* pColorDialog) - : SalInstanceDialog(dynamic_cast<SalInstanceDialog&>(*pColorDialog->GetDialog()).getDialog(), + std::unique_ptr<ColorPickerDialog> pColorDialog) + : SalInstanceDialog(dynamic_cast<SalInstanceDialog&>(*pColorDialog->getDialog()).getDialog(), nullptr, false) - , m_pAbstractColorPickerDialog(pColorDialog) + , m_pColorPickerDialog(std::move(pColorDialog)) { } @@ -6871,13 +6870,10 @@ SalInstanceColorChooserDialog::~SalInstanceColorChooserDialog() {} void SalInstanceColorChooserDialog::set_color(const Color& rColor) { - m_pAbstractColorPickerDialog->SetColor(rColor); + m_pColorPickerDialog->SetColor(rColor); } -Color SalInstanceColorChooserDialog::get_color() const -{ - return m_pAbstractColorPickerDialog->GetColor(); -} +Color SalInstanceColorChooserDialog::get_color() const { return m_pColorPickerDialog->GetColor(); } SalInstanceBuilder::SalInstanceBuilder(vcl::Window* pParent, std::u16string_view sUIRoot, const OUString& rUIFile, @@ -7354,36 +7350,12 @@ weld::MessageDialog* SalInstance::CreateMessageDialog(weld::Widget* pParent, return new SalInstanceMessageDialog(xMessageDialog, nullptr, true); } -namespace -{ -class AbstractColorPickerDialog_Impl - : public vcl::AbstractDialogImpl_Async<AbstractColorPickerDialog, ColorPickerDialog> -{ -public: - using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; - - virtual void SetColor(const Color& rColor) override { m_pDlg->SetColor(rColor); } - - virtual Color GetColor() const override { return m_pDlg->GetColor(); } - - virtual weld::Dialog* GetDialog() const override { return m_pDlg->getDialog(); } -}; - -VclPtr<AbstractColorPickerDialog> CreateColorPickerDialog(weld::Window* pParent, Color nColor, - vcl::ColorPickerMode eMode) -{ - std::unique_ptr<ColorPickerDialog> pColorPickerDialog( - std::make_unique<ColorPickerDialog>(pParent, nColor, eMode)); - return VclPtr<AbstractColorPickerDialog_Impl>::Create(std::move(pColorPickerDialog)); -} -} - std::unique_ptr<weld::ColorChooserDialog> SalInstance::CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode eMode) { - VclPtr<AbstractColorPickerDialog> pDialog = CreateColorPickerDialog(pParent, COL_BLACK, eMode); - assert(pDialog); - return std::make_unique<SalInstanceColorChooserDialog>(pDialog); + std::unique_ptr<ColorPickerDialog> pColorPickerDialog + = std::make_unique<ColorPickerDialog>(pParent, COL_BLACK, eMode); + return std::make_unique<SalInstanceColorChooserDialog>(std::move(pColorPickerDialog)); } weld::Window* SalInstance::GetFrameWeld(const css::uno::Reference<css::awt::XWindow>& rWindow) commit e96d624e7b0b2db2f76113453cc63731b4808514 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Dec 4 19:37:17 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Dec 8 07:45:59 2025 +0100 tdf#169505 Move ColorPickerDialog from cui to vcl ... and simplify a bit to no longer use the dialog factory logic which was needed previously to break a dependency cycle because the cui module is above vcl. Further simplification will follow in upcoming commits. Change-Id: Ie3b0d1090300e249e40e1479a40d01caabbdf573 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195094 Reviewed-by: Michael Weghorn <[email protected]> Tested-by: Jenkins (cherry picked from commit 89ad9eec8ba4f0923a3be843a8343646e8870b90) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195147 diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index a20ca726d8f0..b9e1fe20dd7c 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -117,7 +117,6 @@ $(eval $(call gb_Library_add_exception_objects,cui,\ cui/source/dialogs/about \ $(call gb_Helper_optional,EXTENSIONS, \ cui/source/dialogs/AdditionsDialog) \ - cui/source/dialogs/colorpicker \ cui/source/dialogs/cuifmsearch \ cui/source/dialogs/cuigaldlg \ cui/source/dialogs/cuigrfflt \ diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index b996d12324fe..259cc071ab77 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -48,7 +48,6 @@ #include <cuigaldlg.hxx> #include <transfrm.hxx> #include <bbdlg.hxx> -#include <colorpicker.hxx> #include <cuisrchdlg.hxx> #include <cuitbxform.hxx> #include <optdict.hxx> @@ -1422,31 +1421,6 @@ VclPtr<SfxAbstractLinksDialog> AbstractDialogFactory_Impl::CreateLinksDialog(wel return VclPtr<AbstractLinksDialog_Impl>::Create(std::move(xLinkDlg)); } -namespace -{ -class AbstractColorPickerDialog_Impl - : public vcl::AbstractDialogImpl_Async<AbstractColorPickerDialog, ColorPickerDialog> -{ -public: - using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; - - virtual void SetColor(const Color& rColor) override { m_pDlg->SetColor(rColor); } - - virtual Color GetColor() const override { return m_pDlg->GetColor(); } - - virtual weld::Dialog* GetDialog() const override { return m_pDlg->getDialog(); } -}; -} - -VclPtr<AbstractColorPickerDialog> -AbstractDialogFactory_Impl::CreateColorPickerDialog(weld::Window* pParent, Color nColor, - vcl::ColorPickerMode eMode) -{ - std::unique_ptr<ColorPickerDialog> pColorPickerDialog( - std::make_unique<ColorPickerDialog>(pParent, nColor, eMode)); - return VclPtr<AbstractColorPickerDialog_Impl>::Create(std::move(pColorPickerDialog)); -} - VclPtr<SfxAbstractTabDialog> AbstractDialogFactory_Impl::CreateSvxFormatCellsDialog(weld::Window* pParent, const SfxItemSet& rAttr, const SdrModel& rModel, bool bStyle) { return VclPtr<CuiAbstractTabController_Impl<SvxFormatCellsDialog>>::Create(pParent, rAttr, rModel, bStyle); diff --git a/cui/source/factory/dlgfact.hxx b/cui/source/factory/dlgfact.hxx index 4c3a9a4b436c..c949c2fc4eb0 100644 --- a/cui/source/factory/dlgfact.hxx +++ b/cui/source/factory/dlgfact.hxx @@ -59,9 +59,6 @@ public: virtual VclPtr<SfxAbstractPasteDialog> CreatePasteDialog(weld::Window* pParent) override; virtual VclPtr<SfxAbstractLinksDialog> CreateLinksDialog(weld::Window* pParent, sfx2::LinkManager* pMgr, bool bHTML = false, sfx2::SvBaseLink* p=nullptr) override; - virtual VclPtr<AbstractColorPickerDialog> - CreateColorPickerDialog(weld::Window* pParent, Color nColor, vcl::ColorPickerMode eMode) override; - virtual VclPtr<AbstractHangulHanjaConversionDialog> CreateHangulHanjaConversionDialog(weld::Widget* pParent) override; virtual VclPtr<AbstractThesaurusDialog> CreateThesaurusDialog(weld::Widget*, css::uno::Reference<css::linguistic2::XThesaurus> xThesaurus, diff --git a/include/vcl/abstdlg.hxx b/include/vcl/abstdlg.hxx index 65ea90bf1cfe..7a8e18393d4f 100644 --- a/include/vcl/abstdlg.hxx +++ b/include/vcl/abstdlg.hxx @@ -189,9 +189,6 @@ public: // The Id is an implementation detail of the factory virtual VclPtr<VclAbstractDialog> CreateVclDialog(weld::Window* pParent, sal_uInt32 nId) = 0; - virtual VclPtr<AbstractColorPickerDialog> - CreateColorPickerDialog(weld::Window* pParent, Color nColor, vcl::ColorPickerMode eMode) = 0; - // creates instance of PasswordToOpenModifyDialog from cui virtual VclPtr<AbstractPasswordToOpenModifyDialog> CreatePasswordToOpenModifyDialog(weld::Window * pParent, sal_uInt16 nMaxPasswdLen, bool bIsPasswordToModify) = 0; diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index ab94d7cb64a1..72b5f74fba92 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -2166,7 +2166,6 @@ cui/source/dialogs/DiagramDialog.cxx cui/source/dialogs/SpellAttrib.hxx cui/source/dialogs/SpellDialog.cxx cui/source/dialogs/about.cxx -cui/source/dialogs/colorpicker.cxx cui/source/dialogs/cuifmsearch.cxx cui/source/dialogs/cuigaldlg.cxx cui/source/dialogs/cuigrfflt.cxx @@ -14716,6 +14715,7 @@ vcl/source/window/brdwin.cxx vcl/source/window/bubblewindow.cxx vcl/source/window/builder.cxx vcl/source/window/clipping.cxx +vcl/source/window/colorpicker.cxx vcl/source/window/commandevent.cxx vcl/source/window/cursor.cxx vcl/source/window/debugevent.cxx diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 7ca18aa0a5a0..1452533b76f1 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -169,6 +169,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/window/brdwin \ vcl/source/window/bufferdevice \ vcl/source/window/accessibility \ + vcl/source/window/colorpicker \ vcl/source/window/legacyaccessibility \ vcl/source/window/clipping \ vcl/source/window/stacking \ diff --git a/cui/source/inc/colorpicker.hxx b/vcl/inc/colorpicker.hxx similarity index 100% rename from cui/source/inc/colorpicker.hxx rename to vcl/inc/colorpicker.hxx diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 18f5ee98283e..38b0501771ed 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/accessibility/AccessibleRelationType.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <colorpicker.hxx> #include <o3tl/safeint.hxx> #include <o3tl/sorted_vector.hxx> #include <o3tl/string_view.hxx> @@ -49,6 +50,7 @@ #include <utility> #include <tools/helpers.hxx> #include <vcl/abstdlg.hxx> +#include <vcl/abstdlgimpl.hxx> #include <vcl/builder.hxx> #include <vcl/dndlistenercontainer.hxx> #include <vcl/toolkit/combobox.hxx> @@ -7352,13 +7354,34 @@ weld::MessageDialog* SalInstance::CreateMessageDialog(weld::Widget* pParent, return new SalInstanceMessageDialog(xMessageDialog, nullptr, true); } +namespace +{ +class AbstractColorPickerDialog_Impl + : public vcl::AbstractDialogImpl_Async<AbstractColorPickerDialog, ColorPickerDialog> +{ +public: + using AbstractDialogImpl_BASE::AbstractDialogImpl_BASE; + + virtual void SetColor(const Color& rColor) override { m_pDlg->SetColor(rColor); } + + virtual Color GetColor() const override { return m_pDlg->GetColor(); } + + virtual weld::Dialog* GetDialog() const override { return m_pDlg->getDialog(); } +}; + +VclPtr<AbstractColorPickerDialog> CreateColorPickerDialog(weld::Window* pParent, Color nColor, + vcl::ColorPickerMode eMode) +{ + std::unique_ptr<ColorPickerDialog> pColorPickerDialog( + std::make_unique<ColorPickerDialog>(pParent, nColor, eMode)); + return VclPtr<AbstractColorPickerDialog_Impl>::Create(std::move(pColorPickerDialog)); +} +} + std::unique_ptr<weld::ColorChooserDialog> SalInstance::CreateColorChooserDialog(weld::Window* pParent, vcl::ColorPickerMode eMode) { - VclAbstractDialogFactory* pFact = VclAbstractDialogFactory::Create(); - assert(pFact); - VclPtr<AbstractColorPickerDialog> pDialog - = pFact->CreateColorPickerDialog(pParent, COL_BLACK, eMode); + VclPtr<AbstractColorPickerDialog> pDialog = CreateColorPickerDialog(pParent, COL_BLACK, eMode); assert(pDialog); return std::make_unique<SalInstanceColorChooserDialog>(pDialog); } diff --git a/cui/source/dialogs/colorpicker.cxx b/vcl/source/window/colorpicker.cxx similarity index 100% rename from cui/source/dialogs/colorpicker.cxx rename to vcl/source/window/colorpicker.cxx commit 383053318ee364cd39620edffc5bc16f26cc8885 Author: Michael Weghorn <[email protected]> AuthorDate: Thu Dec 4 19:16:37 2025 +0100 Commit: Michael Weghorn <[email protected]> CommitDate: Mon Dec 8 07:45:51 2025 +0100 tdf#169505 Move HexColorControl from svx to vcl ... in preparation of moving ColorPicker to vcl in an upcoming commit, too. Change-Id: I0ca1041073856253905022517f532134b7d243cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195093 Tested-by: Jenkins Reviewed-by: Michael Weghorn <[email protected]> (cherry picked from commit c80637bc429853ea034998fce49b980ef52d76fa) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195146 diff --git a/cui/source/inc/colorpicker.hxx b/cui/source/inc/colorpicker.hxx index e3a2b3c6d40d..dcc780dfd3ca 100644 --- a/cui/source/inc/colorpicker.hxx +++ b/cui/source/inc/colorpicker.hxx @@ -21,9 +21,9 @@ #include <vcl/ColorDialog.hxx> #include <vcl/customweld.hxx> +#include <vcl/hexcolorcontrol.hxx> #include <vcl/virdev.hxx> #include <vcl/weld.hxx> -#include <svx/hexcolorcontrol.hxx> #include <o3tl/typed_flags_set.hxx> enum class UpdateFlags diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx index bb7e897846db..c1acc7f2ce14 100644 --- a/cui/source/inc/cuitabarea.hxx +++ b/cui/source/inc/cuitabarea.hxx @@ -22,11 +22,11 @@ #include <svx/dlgctrl.hxx> #include <svx/xflasit.hxx> #include <svx/tabarea.hxx> -#include <svx/hexcolorcontrol.hxx> #include <svx/SvxColorValueSet.hxx> #include <svx/SvxPresetListBox.hxx> #include <svx/PaletteManager.hxx> #include <svx/svdview.hxx> +#include <vcl/hexcolorcontrol.hxx> class ColorListBox; class SdrModel; diff --git a/include/svx/hexcolorcontrol.hxx b/include/vcl/hexcolorcontrol.hxx similarity index 96% rename from include/svx/hexcolorcontrol.hxx rename to include/vcl/hexcolorcontrol.hxx index 7d4297749ff5..aaf396c9a4f9 100644 --- a/include/svx/hexcolorcontrol.hxx +++ b/include/vcl/hexcolorcontrol.hxx @@ -19,9 +19,9 @@ #pragma once -#include <svx/svxdllapi.h> #include <tools/color.hxx> #include <tools/link.hxx> +#include <vcl/dllapi.h> namespace weld { class Entry; } @@ -29,7 +29,7 @@ struct ImplSVEvent; namespace weld { -class SVXCORE_DLLPUBLIC HexColorControl +class VCL_DLLPUBLIC HexColorControl { private: std::unique_ptr<weld::Entry> m_xEntry; diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 8081c827fc75..ab94d7cb64a1 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -5626,7 +5626,6 @@ include/svx/grfflt.hxx include/svx/gridctrl.hxx include/svx/hdft.hxx include/svx/helperhittest3d.hxx -include/svx/hexcolorcontrol.hxx include/svx/hlnkitem.hxx include/svx/hyperdlg.hxx include/svx/ifaceids.hxx @@ -6101,6 +6100,7 @@ include/vcl/graphictools.hxx include/vcl/hatch.hxx include/vcl/headbar.hxx include/vcl/help.hxx +include/vcl/hexcolorcontrol.hxx include/vcl/i18nhelp.hxx include/vcl/idle.hxx include/vcl/image.hxx diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index ad98cd64917f..e2d178b688f5 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -121,7 +121,6 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/diagram/IDiagramHelper \ svx/source/dialog/dialmgr \ svx/source/dialog/dlgutil \ - svx/source/dialog/hexcolorcontrol \ svx/source/dialog/framelink \ svx/source/dialog/framelinkarray \ svx/source/dialog/langbox \ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 617e22e31dc1..7ca18aa0a5a0 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -69,6 +69,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\ $(if $(filter OPENCL,$(BUILD_TYPE)),opencl) \ sal \ salhelper \ + sax \ sot \ svl \ tl \ @@ -188,6 +189,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/window/DocWindow \ vcl/source/window/event \ vcl/source/window/floatwin \ + vcl/source/window/hexcolorcontrol \ $(if $(ENABLE_WASM_STRIP_SPLASH),,vcl/source/window/introwin) \ vcl/source/window/keycod \ vcl/source/window/keyevent \ diff --git a/svx/source/dialog/hexcolorcontrol.cxx b/vcl/source/window/hexcolorcontrol.cxx similarity index 99% rename from svx/source/dialog/hexcolorcontrol.cxx rename to vcl/source/window/hexcolorcontrol.cxx index 1c043359d73d..cb5f73b43ebf 100644 --- a/svx/source/dialog/hexcolorcontrol.cxx +++ b/vcl/source/window/hexcolorcontrol.cxx @@ -18,8 +18,8 @@ */ #include <sax/tools/converter.hxx> -#include <svx/hexcolorcontrol.hxx> #include <rtl/character.hxx> +#include <vcl/hexcolorcontrol.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx>
