[Libreoffice-commits] core.git: svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 30 14:41:27 UTC 2019


 svx/source/tbxctrls/fillctrl.cxx |   27 ++++++++++-----------------
 svx/source/tbxctrls/itemwin.cxx  |    2 +-
 2 files changed, 11 insertions(+), 18 deletions(-)

New commits:
commit 90de8fa1d10190f45450aa41c60a42a408b15f68
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Wed Jan 30 12:01:48 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Jan 30 15:40:55 2019 +0100

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

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();
 }


More information about the Libreoffice-commits mailing list