diff options
author | Rüdiger Timm <rt@openoffice.org> | 2005-11-10 15:13:56 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2005-11-10 15:13:56 +0000 |
commit | 400e994cde19a46c7066ff238320afa45a153497 (patch) | |
tree | eb8d12d4240ae4d8dd1d2bd6e1f3e29c5f989354 /sfx2 | |
parent | 5aff184d1f242be344e6209ee69a5e3c2bed6cf5 (diff) |
INTEGRATION: CWS stacks01 (1.51.58); FILE MERGED
2005/11/04 09:52:30 cd 1.51.58.1: #122235# Use task pane list from top system window parent
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/toolbox/tbxitem.cxx | 67 |
1 files changed, 30 insertions, 37 deletions
diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index 7da1002f72cb..b50647d9ca2a 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -4,9 +4,9 @@ * * $RCSfile: tbxitem.cxx,v $ * - * $Revision: 1.51 $ + * $Revision: 1.52 $ * - * last change: $Author: rt $ $Date: 2005-09-07 19:23:34 $ + * last change: $Author: rt $ $Date: 2005-11-10 16:13:56 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -197,6 +197,29 @@ SFX_IMPL_TOOLBOX_CONTROL(SfxAppToolBoxControl_Impl, SfxStringItem); //SFX_IMPL_TOOLBOX_CONTROL(SfxReloadToolBoxControl_Impl, SfxBoolItem); //SFX_IMPL_TOOLBOX_CONTROL(SfxAddonsToolBoxControl_Impl, SfxVoidItem); +static Window* GetTopMostParentSystemWindow( Window* pWindow ) +{ + OSL_ASSERT( pWindow ); + if ( pWindow ) + { + // ->manually search topmost system window + // required because their might be another system window between this and the top window + pWindow = pWindow->GetParent(); + SystemWindow* pTopMostSysWin = NULL; + while ( pWindow ) + { + if ( pWindow->IsSystemWindow() ) + pTopMostSysWin = (SystemWindow*)pWindow; + pWindow = pWindow->GetParent(); + } + pWindow = pTopMostSysWin; + OSL_ASSERT( pWindow ); + return pWindow; + } + + return NULL; +} + svt::ToolboxController* SAL_CALL SfxToolBoxControllerFactory( const Reference< XFrame >& rFrame, ToolBox* pToolbox, unsigned short nID, const ::rtl::OUString& aCommandURL ) { ::vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -1277,10 +1300,7 @@ SfxPopupWindow::SfxPopupWindow( { m_xServiceManager = ::comphelper::getProcessServiceFactory(); - Window* pWindow = SFX_APP()->GetTopWindow(); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - + Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); } @@ -1300,10 +1320,7 @@ SfxPopupWindow::SfxPopupWindow( { m_xServiceManager = ::comphelper::getProcessServiceFactory(); - Window* pWindow = SFX_APP()->GetTopWindow(); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - + Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); } @@ -1324,10 +1341,7 @@ SfxPopupWindow::SfxPopupWindow( { m_xServiceManager = ::comphelper::getProcessServiceFactory(); - Window* pWindow = SFX_APP()->GetTopWindow(); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - + Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); } @@ -1348,10 +1362,7 @@ SfxPopupWindow::SfxPopupWindow( { m_xServiceManager = ::comphelper::getProcessServiceFactory(); - Window* pWindow = SFX_APP()->GetTopWindow(); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - + Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); } @@ -1366,25 +1377,7 @@ SfxPopupWindow::~SfxPopupWindow() m_xStatusListener.clear(); } - Window* pWindow = SFX_APP()->GetTopWindow(); - if( !pWindow ) - { - // #i48549# no top window found (may happen during document close) - // ->manually search topmost system window - // required because their might be another system window between this and the top window - pWindow = GetParent(); - SystemWindow* pTopMostSysWin = NULL; - while ( pWindow ) - { - if ( pWindow->IsSystemWindow() ) - pTopMostSysWin = (SystemWindow*)pWindow; - pWindow = pWindow->GetParent(); - } - pWindow = pTopMostSysWin; - } - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - + Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) ((SystemWindow *)pWindow)->GetTaskPaneList()->RemoveWindow( this ); } |