diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2015-08-09 11:33:03 +0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-17 12:29:09 +0000 |
commit | d82a0dc64c367a512e33ce1bf498e6e6ebe75bc4 (patch) | |
tree | 2e44c27622e73466c821e754893c2d455d67b6bf | |
parent | 758b4c7feaca5ecc2da6b574919d3a5ad667a84c (diff) |
tdf#93290 Limit the size request of the styles combobox
Change-Id: I1ef697008dcd5e993c1d509fce055c5454d80f40
(cherry picked from commit 7d3fa6bae9f7a755eb2d0ca24bf1afd5f3646bb7)
Reviewed-on: https://gerrit.libreoffice.org/17668
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit 0bc62128589110686bd97b639bae93d29a8bdd8b)
Reviewed-on: https://gerrit.libreoffice.org/17776
Reviewed-by: Eike Rathke <erack@redhat.com>
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index d321bb803df6..e22c6c67aa98 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -163,6 +163,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 * ); }; @@ -334,6 +335,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 ) ); @@ -542,7 +544,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 ); @@ -583,6 +585,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(); |