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 a4d5983b4e
    Author: Michael Weghorn <m.weghorn@posteo.de>
    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 <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2026-09-29 17:32:27 +02:00
parent 3f2e68ce5f
commit 6296615b8d
3 changed files with 16 additions and 0 deletions
+4
View File
@@ -11,6 +11,7 @@
#include <svx/IColorSet.hxx>
#include <svx/svxdllapi.h>
#include <tools/gen.hxx>
#include <tools/link.hxx>
#include <vcl/vclptr.hxx>
@@ -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<int, void>& rLink) { m_aColorActivatedHdl = rLink; }
+7
View File
@@ -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)
+5
View File
@@ -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" )