Kaydet (Commit) 8c4bbc0a authored tarafından Michael Meeks's avatar Michael Meeks

tdf#91100 - don't Notify focus changes after dispose.

Change-Id: If870f88d1d83db8bd436ac1bb9a1c676c34605b5
üst e5ce3680
...@@ -48,8 +48,8 @@ using namespace ::com::sun::star::uno; ...@@ -48,8 +48,8 @@ using namespace ::com::sun::star::uno;
SingleTabDlgImpl::SingleTabDlgImpl() SingleTabDlgImpl::SingleTabDlgImpl()
: m_pSfxPage(NULL) : m_pSfxPage(NULL)
, m_pLine(NULL) , m_pLine(NULL)
{ {
} }
class SfxModelessDialog_Impl : public SfxListener class SfxModelessDialog_Impl : public SfxListener
{ {
...@@ -335,30 +335,31 @@ void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW) ...@@ -335,30 +335,31 @@ void SfxModelessDialog::Init(SfxBindings *pBindinx, SfxChildWindow *pCW)
*/ */
bool SfxModelessDialog::Notify( NotifyEvent& rEvt ) bool SfxModelessDialog::Notify( NotifyEvent& rEvt )
{ {
if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) if ( pImp )
{
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 ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
if ( !ModelessDialog::Notify( rEvt ) && SfxViewShell::Current() ) {
// then also for valid global accelerators. pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
return SfxViewShell::Current()->GlobalKeyInput_Impl( *rEvt.GetKeyEvent() ); pImp->pMgr->Activate_Impl();
return true; }
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 ); return ModelessDialog::Notify( rEvt );
} }
SfxModelessDialog::~SfxModelessDialog() SfxModelessDialog::~SfxModelessDialog()
{ {
disposeOnce(); disposeOnce();
...@@ -369,6 +370,7 @@ void SfxModelessDialog::dispose() ...@@ -369,6 +370,7 @@ void SfxModelessDialog::dispose()
if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() ) if ( pImp->pMgr->GetFrame().is() && pImp->pMgr->GetFrame() == pBindings->GetActiveFrame() )
pBindings->SetActiveFrame( NULL ); pBindings->SetActiveFrame( NULL );
delete pImp; delete pImp;
pImp = NULL;
ModelessDialog::dispose(); ModelessDialog::dispose();
} }
...@@ -423,33 +425,34 @@ bool SfxFloatingWindow::Notify( NotifyEvent& rEvt ) ...@@ -423,33 +425,34 @@ bool SfxFloatingWindow::Notify( NotifyEvent& rEvt )
*/ */
{ {
if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS ) if ( pImp )
{
pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
pImp->pMgr->Activate_Impl();
}
else if ( rEvt.GetType() == MouseNotifyEvent::LOSEFOCUS )
{ {
if ( !HasChildPathFocus() ) if ( rEvt.GetType() == MouseNotifyEvent::GETFOCUS )
{ {
pBindings->SetActiveFrame( NULL ); pBindings->SetActiveFrame( pImp->pMgr->GetFrame() );
pImp->pMgr->Deactivate_Impl(); 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 ); return FloatingWindow::Notify( rEvt );
} }
SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx, SfxFloatingWindow::SfxFloatingWindow( SfxBindings *pBindinx,
SfxChildWindow *pCW, SfxChildWindow *pCW,
vcl::Window* pParent, WinBits nWinBits) : vcl::Window* pParent, WinBits nWinBits) :
......
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