Kaydet (Commit) 286f1b07 authored tarafından Maxim Monastirsky's avatar Maxim Monastirsky Kaydeden (comit) Andras Timar

tdf#93290 Limit the size request of the styles combobox

Change-Id: I1ef697008dcd5e993c1d509fce055c5454d80f40
(cherry picked from commit 7d3fa6ba)
Reviewed-on: https://gerrit.libreoffice.org/17668Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 1f3caca9
...@@ -163,6 +163,7 @@ private: ...@@ -163,6 +163,7 @@ private:
static void UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName); 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); 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); static bool AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle& rTextRect, long nHeight);
void SetOptimalSize();
DECL_LINK( MenuSelectHdl, Menu * ); DECL_LINK( MenuSelectHdl, Menu * );
}; };
...@@ -334,6 +335,7 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent, ...@@ -334,6 +335,7 @@ SvxStyleBox_Impl::SvxStyleBox_Impl(vcl::Window* pParent,
for(int i = 0; i < MAX_STYLES_ENTRIES; i++) for(int i = 0; i < MAX_STYLES_ENTRIES; i++)
m_pButtons[i] = NULL; m_pButtons[i] = NULL;
aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT ); aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT );
SetOptimalSize();
EnableAutocomplete( true ); EnableAutocomplete( true );
EnableUserDraw( true ); EnableUserDraw( true );
SetUserItemSize( Size( 0, ITEM_HEIGHT ) ); SetUserItemSize( Size( 0, ITEM_HEIGHT ) );
...@@ -542,7 +544,7 @@ void SvxStyleBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) ...@@ -542,7 +544,7 @@ void SvxStyleBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
(rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) )
{ {
SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT)); SetOptimalSize();
} }
ComboBox::DataChanged( rDCEvt ); ComboBox::DataChanged( rDCEvt );
...@@ -583,6 +585,14 @@ bool SvxStyleBox_Impl::AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle& ...@@ -583,6 +585,14 @@ bool SvxStyleBox_Impl::AdjustFontForItemHeight(OutputDevice* pDevice, Rectangle&
return false; 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) void SvxStyleBox_Impl::UserDrawEntry(const UserDrawEvent& rUDEvt, const OUString &rStyleName)
{ {
vcl::RenderContext *pDevice = rUDEvt.GetRenderContext(); vcl::RenderContext *pDevice = rUDEvt.GetRenderContext();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment