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

Maxim Monastirsky momonasmon at gmail.com
Sun Aug 9 01:37:48 PDT 2015


 svx/source/tbxctrls/tbcontrl.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 7d3fa6bae9f7a755eb2d0ca24bf1afd5f3646bb7
Author: Maxim Monastirsky <momonasmon at gmail.com>
Date:   Sun Aug 9 11:33:03 2015 +0300

    tdf#93290 Limit the size request of the styles combobox
    
    Change-Id: I1ef697008dcd5e993c1d509fce055c5454d80f40

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index de0933b..a83a22c 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -164,6 +164,7 @@ private:
     static void     UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName);
     void            SetupEntry(vcl::RenderContext& rRenderContext, vcl::Window* pParent, sal_uInt16 nItem, const Rectangle& rRect, const OUString& rStyleName, bool bIsNotSelected);
     static bool     AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle& rTextRect, long nHeight);
+    void            SetOptimalSize();
     DECL_LINK( MenuSelectHdl, Menu * );
 };
 
@@ -333,6 +334,7 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent,
     for(int i = 0; i < MAX_STYLES_ENTRIES; i++)
         m_pButtons[i] = NULL;
     aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT );
+    SetOptimalSize();
     EnableAutocomplete( true );
     EnableUserDraw( true );
     SetUserItemSize( Size( 0, ITEM_HEIGHT ) );
@@ -541,7 +543,7 @@ void SvxStyleBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
     if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
          (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
     {
-        SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
+        SetOptimalSize();
     }
 
     ComboBox::DataChanged( rDCEvt );
@@ -582,6 +584,14 @@ bool SvxStyleBox_Impl::AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle&
     return false;
 }
 
+void SvxStyleBox_Impl::SetOptimalSize()
+{
+    Size aSize(LogicToPixel(aLogicalSize, MAP_APPFONT));
+    set_width_request(aSize.Width());
+    set_height_request(aSize.Height());
+    SetSizePixel(aSize);
+}
+
 void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName)
 {
     vcl::RenderContext *pDevice = rUDEvt.GetRenderContext();


More information about the Libreoffice-commits mailing list