diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-04-27 15:40:23 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-27 17:12:08 +0100 |
commit | 9b6a6705f756467b12d9ff508e572b1bc279c394 (patch) | |
tree | fffeccc24fa74c96c79b851e5b5b69ffcf41342d /svx | |
parent | cd962f121586e84eb7d020643dcf134e7e50a1c8 (diff) |
if it makes sense to handle DataChanged, then the same init must be called
as in the ctor
Change-Id: Ib95768397dc99d09154af03846f001d647437b69
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbcontrl.cxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index 6dfadc7ef548..35ef96793827 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -192,6 +192,8 @@ private: } DECL_DLLPRIVATE_LINK( CheckAndMarkUnknownFont, VclWindowEvent* ); + void SetOptimalSize(); + protected: virtual void Select() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; @@ -909,10 +911,7 @@ SvxFontNameBox_Impl::SvxFontNameBox_Impl( vcl::Window* pParent, const Reference< m_xFrame (_xFrame), mbEndPreview(false) { - Size aSize(LogicToPixel(aLogicalSize, MAP_APPFONT)); - set_width_request(aSize.Width()); - set_height_request(aSize.Height()); - SetSizePixel(aSize); + SetOptimalSize(); EnableControls_Impl(); GetSubEdit()->AddEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont )); } @@ -1031,12 +1030,20 @@ bool SvxFontNameBox_Impl::Notify( NotifyEvent& rNEvt ) return nHandled || FontNameBox::Notify( rNEvt ); } +void SvxFontNameBox_Impl::SetOptimalSize() +{ + Size aSize(LogicToPixel(aLogicalSize, MAP_APPFONT)); + set_width_request(aSize.Width()); + set_height_request(aSize.Height()); + SetSizePixel(aSize); +} + void SvxFontNameBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) { if ( (rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE) ) { - SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT)); + SetOptimalSize(); } else if ( ( rDCEvt.GetType() == DataChangedEventType::FONTS ) || ( rDCEvt.GetType() == DataChangedEventType::DISPLAY ) ) |