From 1876feb8a8805b2f80537e2828c152ccbdf67fe2 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Mon, 10 Jul 2023 15:27:29 -0400 Subject: tdf#136905 NBB: let ValueSetWithTextControl set optimal height There was no way to specify a "good font size" to use for .uno:AttributePageSize in the notebookbar. The font "resized to match to size of the box" which is hard-coded to aSize(250, 300). (Even if ValueSet::SetOptimalSize worked, it would set an inadequate height.) So it seems like the best thing to do is simply add a function that allows the box height to be modified. Using the fontsize from GetDefaultFont is not correct. Use the OS-defined label font size instead, which seems to be the most common choice - GetPushButtonFont would has also worked. I verified that the label font size is controled by the OS' font preference. The ability to define the box's optimal height is still (somewhat) necessary. It isn't good enough to just "use the system font size". I tested with an OS font size of 48 (instead of 11), and in that case the box height was too small (but with the font only using 4/9's of a 12pt space, even a 24pt font looked OK without adjusting optimal height). Change-Id: I0a0774dea9c2a6c21a8e84439318a94f39783413 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154286 Tested-by: Jenkins Reviewed-by: Justin Luth --- include/svx/sidebar/ValueSetWithTextControl.hxx | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/svx/sidebar/ValueSetWithTextControl.hxx b/include/svx/sidebar/ValueSetWithTextControl.hxx index ac397f9fdab6..407e9606757f 100644 --- a/include/svx/sidebar/ValueSetWithTextControl.hxx +++ b/include/svx/sidebar/ValueSetWithTextControl.hxx @@ -40,6 +40,7 @@ public: SVX_DLLPRIVATE virtual void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + void SetOptimalDrawingAreaHeight(); void AddItem(const OUString& rItemText, const OUString& rItemText2); SVX_DLLPRIVATE virtual void UserDraw(const UserDrawEvent& rUDEvt) override; -- cgit