diff options
author | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-09-20 21:18:11 +0400 |
---|---|---|
committer | Ivan Timofeev <timofeev.i.s@gmail.com> | 2012-09-22 14:32:05 +0400 |
commit | b40f95f9159c3868a059b33fb524ccc7ed182272 (patch) | |
tree | ba6c620c2a4eca9dd4f956a43a40b6d868a6176f /framework/source | |
parent | ecf56eda2fa41a5bed01294670e82d61c0f98798 (diff) |
fdo#34392: request button size after vcl has updated its settings
Change-Id: I1810562a2c0c09404271be5b910f5811fce3e465
Diffstat (limited to 'framework/source')
-rw-r--r-- | framework/source/services/backingwindow.cxx | 26 | ||||
-rw-r--r-- | framework/source/services/backingwindow.hxx | 2 |
2 files changed, 19 insertions, 9 deletions
diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx index cc67aab9a990..008f463b6cc4 100644 --- a/framework/source/services/backingwindow.cxx +++ b/framework/source/services/backingwindow.cxx @@ -193,6 +193,10 @@ BackingWindow::BackingWindow( Window* i_pParent ) : // clean up resource stack FreeResource(); + // fdo#34392: we do the layout dynamically, the layout depends on the font, + // so we should handle data changed events (font changing) of the last child + // control, at this point all the controls have updated settings (i.e. font). + maToolbox.AddEventListener( LINK( this, BackingWindow, WindowEventListener ) ); EnableChildTransparentMode(); SetStyle( GetStyle() | WB_DIALOGCONTROL ); @@ -249,6 +253,7 @@ BackingWindow::BackingWindow( Window* i_pParent ) : BackingWindow::~BackingWindow() { + maToolbox.RemoveEventListener( LINK( this, BackingWindow, WindowEventListener ) ); delete mpRecentMenu; delete mpAccExec; } @@ -267,17 +272,22 @@ class ImageContainerRes : public Resource ~ImageContainerRes() { FreeResource(); } }; -void BackingWindow::DataChanged( const DataChangedEvent& rDCEvt ) +IMPL_LINK( BackingWindow, WindowEventListener, VclSimpleEvent*, pEvent ) { - Window::DataChanged( rDCEvt ); - - if ( rDCEvt.GetFlags() & SETTINGS_STYLE ) + VclWindowEvent* pWinEvent = dynamic_cast<VclWindowEvent*>( pEvent ); + if ( pWinEvent && pWinEvent->GetId() == VCLEVENT_WINDOW_DATACHANGED ) { - initBackground(); - Invalidate(); - // fdo#34392: Resize buttons to match the new text size. - Resize(); + DataChangedEvent* pDCEvt = + static_cast<DataChangedEvent*>( pWinEvent->GetData() ); + if ( pDCEvt->GetFlags() & SETTINGS_STYLE ) + { + initBackground(); + Invalidate(); + // fdo#34392: Resize buttons to match the new text size. + Resize(); + } } + return 0; } void BackingWindow::prepareRecentFileMenu() diff --git a/framework/source/services/backingwindow.hxx b/framework/source/services/backingwindow.hxx index 071b8e0d5d53..75a45bb344fa 100644 --- a/framework/source/services/backingwindow.hxx +++ b/framework/source/services/backingwindow.hxx @@ -154,6 +154,7 @@ namespace framework DECL_LINK( SelectHdl, Button* ); DECL_LINK( ActivateHdl, Button* ); DECL_LINK( ToolboxHdl, void* ); + DECL_LINK( WindowEventListener, VclSimpleEvent* ); void initControls(); void initBackground(); @@ -165,7 +166,6 @@ namespace framework virtual void Paint( const Rectangle& rRect ); virtual void Resize(); virtual long Notify( NotifyEvent& rNEvt ); - virtual void DataChanged( const DataChangedEvent& rDCEvt ); virtual void GetFocus(); void setOwningFrame( const com::sun::star::uno::Reference< com::sun::star::frame::XFrame >& xFrame ); |