diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-05-06 13:42:21 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-05-06 13:45:21 +0100 |
commit | 8c4bbc0a0ddb1ea8051f0be5a42ef128cf7d891e (patch) | |
tree | 8290e8d32052e41b2ee6f6f07cc7a93cd3a9c87a | |
parent | e5ce36800b1669da08ab6440bc2f8bc2bd305ded (diff) |
tdf#91100 - don't Notify focus changes after dispose.
Change-Id: If870f88d1d83db8bd436ac1bb9a1c676c34605b5
-rw-r--r-- | sfx2/source/dialog/basedlgs.cxx | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/sfx2/source/dialog/basedlgs.cxx b/sfx2/source/dialog/basedlgs.cxx index d33f89512308..b961ac119db1 100644 --- a/sfx2/source/dialog/basedlgs.cxx +++ b/sfx2/source/dialog/basedlgs.cxx @@ -48,8 +48,8 @@ using namespace ::com::sun::star::uno; SingleTabDlgImpl::SingleTabDlgImpl() : m_pSfxPage(NULL) , m_pLine(NULL) - { - } +{ +} class SfxModelessDialog_Impl : public SfxListener { @@ -335,30 +335,31 @@ void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW) */ bool SfxModelessDialog::Notify( NotifyEvent& rEvt ) { - if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) - { - pBindings->SetActiveFrame( pImp->pMgr->GetFrame() ); - pImp->pMgr->Activate_Impl(); - } - else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && !HasChildPathFocus() ) - { - pBindings->SetActiveFrame( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > () ); - pImp->pMgr->Deactivate_Impl(); - } - else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + if ( pImp ) { - // First, allow KeyInput for Dialog functions ( TAB etc. ) - if ( !ModelessDialog::Notify( rEvt ) && SfxViewShell::Current() ) - // then also for valid global accelerators. - return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); - return true; + if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) + { + pBindings->SetActiveFrame( pImp->pMgr->GetFrame() ); + pImp->pMgr->Activate_Impl(); + } + else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS && !HasChildPathFocus() ) + { + pBindings->SetActiveFrame( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > () ); + pImp->pMgr->Deactivate_Impl(); + } + else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + { + // First, allow KeyInput for Dialog functions ( TAB etc. ) + if ( !ModelessDialog::Notify( rEvt ) && SfxViewShell::Current() ) + // then also for valid global accelerators. + return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); + return true; + } } return ModelessDialog::Notify( rEvt ); } - - SfxModelessDialog::~SfxModelessDialog() { disposeOnce(); @@ -369,6 +370,7 @@ void SfxModelessDialog::dispose() if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() ) pBindings->SetActiveFrame( NULL ); delete pImp; + pImp = NULL; ModelessDialog::dispose(); } @@ -423,33 +425,34 @@ bool SfxFloatingWindow::Notify( NotifyEvent& rEvt ) */ { - if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) - { - pBindings->SetActiveFrame( pImp->pMgr->GetFrame() ); - pImp->pMgr->Activate_Impl(); - } - else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS ) + if ( pImp ) { - if ( !HasChildPathFocus() ) + if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) { - pBindings->SetActiveFrame( NULL ); - pImp->pMgr->Deactivate_Impl(); + pBindings->SetActiveFrame( pImp->pMgr->GetFrame() ); + pImp->pMgr->Activate_Impl(); + } + else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS ) + { + if ( !HasChildPathFocus() ) + { + pBindings->SetActiveFrame( NULL ); + pImp->pMgr->Deactivate_Impl(); + } + } + else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + { + // First, allow KeyInput for Dialog functions + if ( !FloatingWindow::Notify( rEvt ) && SfxViewShell::Current() ) + // then also for valid global accelerators. + return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); + return true; } - } - else if( rEvt.GetType() == MouseNotifyEvent::KEYINPUT ) - { - // First, allow KeyInput for Dialog functions - if ( !FloatingWindow::Notify( rEvt ) && SfxViewShell::Current() ) - // then also for valid global accelerators. - return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); - return true; } return FloatingWindow::Notify( rEvt ); } - - SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx, SfxChildWindow *pCW, vcl::Window* pParent, WinBits nWinBits) : |