diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-01-30 12:01:48 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-01-30 15:40:55 +0100 |
commit | 90de8fa1d10190f45450aa41c60a42a408b15f68 (patch) | |
tree | 49c84f7f3fd0ca1840d8b9e3fd1235755c74f3d7 /svx | |
parent | 3f726abf5c4c32619f93d4982f8fb1e07619ba40 (diff) |
Related: tdf#118038 give SvxFillTypeBox in toolbar optimal width
Change-Id: I2fae1d529ea877acdf42c898323b10c0ba4edc9c
Reviewed-on: https://gerrit.libreoffice.org/67129
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/fillctrl.cxx | 27 | ||||
-rw-r--r-- | svx/source/tbxctrls/itemwin.cxx | 2 |
2 files changed, 11 insertions, 18 deletions
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx index 0e3d2ef79936..3620bbbf2006 100644 --- a/svx/source/tbxctrls/fillctrl.cxx +++ b/svx/source/tbxctrls/fillctrl.cxx @@ -861,35 +861,28 @@ IMPL_LINK_NOARG(SvxFillToolBoxControl, SelectFillAttrHdl, ListBox&, void) void FillControl::Resize() { - // Relative width of the two list boxes is 2/5 : 3/5 Size aSize(GetOutputSizePixel()); - long nW = aSize.Width() / 5; long nH = aSize.Height(); - long nPrefHeight = mpLbFillType->get_preferred_size().Height(); + Size aTypeSize(mpLbFillType->get_preferred_size()); + long nPrefHeight = aTypeSize.Height(); long nOffset = (nH - nPrefHeight)/2; - mpLbFillType->SetPosSizePixel(Point(0, nOffset), Size(nW * 2, nPrefHeight)); + mpLbFillType->SetPosSizePixel(Point(0, nOffset), Size(aTypeSize.Width(), nPrefHeight)); nPrefHeight = mpToolBoxColor->get_preferred_size().Height(); nOffset = (nH - nPrefHeight)/2; - mpToolBoxColor->SetPosSizePixel(Point(nW * 2, nOffset),Size(nW * 3, nPrefHeight)); + mpToolBoxColor->SetPosSizePixel(Point(aTypeSize.Width(), nOffset),Size(aSize.Width() - aTypeSize.Width(), nPrefHeight)); nPrefHeight = mpLbFillType->get_preferred_size().Height(); nOffset = (nH - nPrefHeight)/2; - mpLbFillAttr->SetPosSizePixel(Point(nW * 2, nOffset),Size(nW * 3, nPrefHeight)); + mpLbFillAttr->SetPosSizePixel(Point(aTypeSize.Width(), nOffset),Size(aSize.Width() - aTypeSize.Width(), nPrefHeight)); } void FillControl::SetOptimalSize() { - const Size aLogicalAttrSize(50,0); - Size aSize(LogicToPixel(aLogicalAttrSize, MapMode(MapUnit::MapAppFont))); - - Point aAttrPnt = mpLbFillAttr->GetPosPixel(); - - aSize.setHeight( std::max(aSize.Height(), mpLbFillType->get_preferred_size().Height()) ); - aSize.setHeight( std::max(aSize.Height(), mpToolBoxColor->get_preferred_size().Height()) ); - aSize.setHeight( std::max(aSize.Height(), mpLbFillAttr->get_preferred_size().Height()) ); - - aSize.setWidth( aAttrPnt.X() + aSize.Width() ); - + Size aSize(mpLbFillType->get_preferred_size()); + Size aFirstSize(mpToolBoxColor->get_preferred_size()); + Size aSecondSize(mpLbFillAttr->get_preferred_size()); + aSize.setHeight(std::max({aSize.Height(), aFirstSize.Height(), aSecondSize.Height()})); + aSize.setWidth(aSize.Width() + LogicToPixel(Size(55, 0), MapMode(MapUnit::MapAppFont)).Width()); SetSizePixel(aSize); } diff --git a/svx/source/tbxctrls/itemwin.cxx b/svx/source/tbxctrls/itemwin.cxx index 1b523ef49afd..e4d82364228f 100644 --- a/svx/source/tbxctrls/itemwin.cxx +++ b/svx/source/tbxctrls/itemwin.cxx @@ -419,8 +419,8 @@ SvxFillTypeBox::SvxFillTypeBox( vcl::Window* pParent ) : nCurPos ( 0 ), bSelect ( false ) { - SetSizePixel(LogicToPixel(Size(40, 40), MapMode(MapUnit::MapAppFont))); Fill(); + SetSizePixel(get_preferred_size()); SelectEntryPos( sal_Int32(drawing::FillStyle_SOLID) ); Show(); } |