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; diff --git a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx index 1b6ca2d42979..77b260272264 100644 --- a/svx/source/sidebar/tools/ValueSetWithTextControl.cxx +++ b/svx/source/sidebar/tools/ValueSetWithTextControl.cxx @@ -43,6 +43,15 @@ void ValueSetWithTextControl::SetDrawingArea(weld::DrawingArea* pDrawingArea) SetColCount(); } +void ValueSetWithTextControl::SetOptimalDrawingAreaHeight() +{ + const vcl::Font aFont(Application::GetSettings().GetStyleSettings().GetLabelFont()); + const sal_Int32 nRowHeight = aFont.GetFontSize().Height() * 9 / 4; // see UserDraw() + const Size aSize(GetOutputSizePixel().Width(), nRowHeight * maItems.size()); + GetDrawingArea()->set_size_request(aSize.Width(), aSize.Height()); + SetOutputSizePixel(aSize); +} + void ValueSetWithTextControl::AddItem( const OUString& rItemText, const OUString& rItemText2 ) diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index 211ebece9e5e..a85848ad753d 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -165,6 +165,7 @@ PageSizeControl::PageSizeControl(PageSizePopup* pControl, weld::Widget* pParent) } mxSizeValueSet->SetNoSelection(); mxSizeValueSet->SetSelectHdl( LINK(this, PageSizeControl, ImplSizeHdl ) ); + mxSizeValueSet->SetOptimalDrawingAreaHeight(); mxSizeValueSet->Show(); mxSizeValueSet->Resize();