From 6296615b8d5c96530c59b06a9873be3614a1e76c Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Tue, 29 Sep 2026 14:20:18 +0200 Subject: [PATCH] tdf#173695 svx: Ensure minimum height for ColorWindow The number of colors displayed in the ColorIconView in ColorWindow depends on the selected palette. When the popup is shown for the first time, its size is calculated based on the size of the widgets it contains, and the size of the weld::IconView used for ColorIconView is in turn based on the number of colors in the initial palette. If the initial palette has few (or no) colors, switching to a palette with many colors results in the need for the weld::IconView to use more space than previously to show the additional items, but since the popup doesn't resize, it remains at its initial size and the selection of colors is inconvenient or even impossible. Avoid the problem by ensuring the ColorIconView has a minimum height of at least 200 pixels. Before the switch to ColorIconView in commit a4d5983b4e9331950fce1a6895d55becabcdaf5f Author: Michael Weghorn Date: Fri Jun 5 11:48:54 2026 +0200 tdf#130857 Port ColorWindow from SvxColorValueSet to ColorIconView , the SvxColorValueSet widget in use previously was always set to a fixed size altogether. Change-Id: I7b24dd823083891126cf7b4d0ebe1914c1e0cc87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211565 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- include/svx/ColorIconView.hxx | 4 ++++ svx/source/tbxctrls/ColorIconView.cxx | 7 +++++++ svx/source/tbxctrls/tbcontrl.cxx | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/include/svx/ColorIconView.hxx b/include/svx/ColorIconView.hxx index 7e054e0f253f..a789a813527f 100644 --- a/include/svx/ColorIconView.hxx +++ b/include/svx/ColorIconView.hxx @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -54,6 +55,9 @@ public: void set_sensitive(bool bSensitive); + void set_size_request(int nWidth, int nHeight); + Size get_size_request() const; + void set_help_id(const OUString& rName); void setColorActivatedHdl(const Link& rLink) { m_aColorActivatedHdl = rLink; } diff --git a/svx/source/tbxctrls/ColorIconView.cxx b/svx/source/tbxctrls/ColorIconView.cxx index 031f647ca5bc..e0899788e3c7 100644 --- a/svx/source/tbxctrls/ColorIconView.cxx +++ b/svx/source/tbxctrls/ColorIconView.cxx @@ -64,6 +64,13 @@ void ColorIconView::grab_focus() { m_pIconView->grab_focus(); } void ColorIconView::set_sensitive(bool bSensitive) { m_pIconView->set_sensitive(bSensitive); } +void ColorIconView::set_size_request(int nWidth, int nHeight) +{ + m_pIconView->set_size_request(nWidth, nHeight); +} + +Size ColorIconView::get_size_request() const { return m_pIconView->get_size_request(); } + void ColorIconView::set_help_id(const OUString& rName) { m_pIconView->set_help_id(rName); } IMPL_LINK(ColorIconView, ItemActivatedHdl, const weld::TreeIter&, rIter, bool) diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index d6b2851ea856..5d667c01efd7 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -2123,6 +2123,11 @@ ColorWindow::ColorWindow(OUString rCommand, mxPaletteManager->ReloadColorSet(maColorIconView); mxPaletteManager->ReloadRecentColorSet(maRecentColorIconView); + // ensure minimum height to also provide space for palettes with + // more colors when one with few colors is initially selected + if (maColorIconView.get_size_request().Height() < 200) + maColorIconView.set_size_request(-1, 200); + AddStatusListener( u".uno:ColorTableState"_ustr ); AddStatusListener( maCommand ); if ( maCommand == ".uno:FrameLineColor" )