diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 14:26:45 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-05-22 14:26:45 +0000 |
commit | dea462a00378b511d324c301deb985af29aa4753 (patch) | |
tree | bdb0fc8c7da59f51b1d390d774ba0df0e7620e11 /framework | |
parent | 6ac5960d2fe1bc37a69ed967c0be5f246e4241a7 (diff) |
INTEGRATION: CWS chart2mst3 (1.33.30); FILE MERGED
2007/04/24 19:08:42 bm 1.33.30.14: RESYNC: (1.60-1.62); FILE MERGED
2007/02/07 13:51:44 iha 1.33.30.13: RESYNC: (1.59-1.60); FILE MERGED
2006/11/30 16:16:17 mba 1.33.30.12: merge problem fixed: don't try to reparent windows if parent is NULL; stop layout timer when dockingareaacceptor is NULL
2006/11/25 09:31:46 bm 1.33.30.11: RESYNC: (1.58-1.59); FILE MERGED
2006/11/24 17:03:55 bm 1.33.30.10: RESYNC: (1.55-1.58); FILE MERGED
2006/10/27 07:25:06 cd 1.33.30.9: #i65734# Support menu merging with non-sfx based application modules using provided dispatch providers
2006/10/18 22:06:23 bm 1.33.30.8: RESYNC: (1.49-1.55); FILE MERGED
2006/08/22 15:54:58 bm 1.33.30.7: #i68861# setMergedMenuBar: broadcast a MERGEDMENUBAR event (needed for chart2 OLE object to re-request the statusbar)
2006/06/16 13:07:48 bm 1.33.30.6: RESYNC: (1.47-1.49); FILE MERGED
2006/05/05 14:29:28 bm 1.33.30.5: RESYNC: (1.41-1.47); FILE MERGED
2006/01/25 12:13:37 bm 1.33.30.4: RESYNC: (1.37-1.41); FILE MERGED
2005/10/07 16:00:54 bm 1.33.30.3: RESYNC: (1.35-1.37); FILE MERGED
2005/07/25 18:03:00 bm 1.33.30.2: RESYNC: (1.33-1.35); FILE MERGED
2005/06/06 15:22:15 cd 1.33.30.1: Reparent child windows to support creation of ui elements before correct docking area acceptor is set
Diffstat (limited to 'framework')
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 190 |
1 files changed, 154 insertions, 36 deletions
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index e5d06e846e9c..6faaad663721 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -4,9 +4,9 @@ * * $RCSfile: layoutmanager.cxx,v $ * - * $Revision: 1.62 $ + * $Revision: 1.63 $ * - * last change: $Author: ihi $ $Date: 2007-04-16 16:42:16 $ + * last change: $Author: vg $ $Date: 2007-05-22 15:26:45 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -3706,6 +3706,9 @@ sal_Bool SAL_CALL LayoutManager::setMergedMenuBar( throw (::com::sun::star::uno::RuntimeException) { implts_setInplaceMenuBar( xMergedMenuBar ); + + css::uno::Any a; + implts_notifyListeners( css::frame::LayoutManagerEvents::MERGEDMENUBAR, a ); return sal_True; } @@ -3748,6 +3751,9 @@ throw ( RuntimeException ) sal_Bool bAutomaticToolbars( m_bAutomaticToolbars ); std::vector< Reference< css::awt::XWindow > > oldDockingAreaWindows; + if ( !xDockingAreaAcceptor.is() ) + m_aAsyncLayoutTimer.Stop(); + // Remove listener from old docking area acceptor if ( m_xDockingAreaAcceptor.is() ) { @@ -3778,6 +3784,7 @@ throw ( RuntimeException ) css::uno::Reference< css::awt::XWindow > xLeftDockWindow; css::uno::Reference< css::awt::XWindow > xRightDockWindow; + Reference< ::com::sun::star::ui::XDockingAreaAcceptor > xOldDockingAreaAcceptor( m_xDockingAreaAcceptor ); m_xDockingAreaAcceptor = xDockingAreaAcceptor; if ( m_xDockingAreaAcceptor.is() ) { @@ -3829,9 +3836,12 @@ throw ( RuntimeException ) Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); if ( pContainerWindow ) pContainerWindow->AddChildEventListener( LINK( this, LayoutManager, WindowEventListener ) ); - } - implts_destroyElements(); // remove all elements + // We have now a new container window, reparent all child windows! + implts_reparentChildWindows(); + } + else + implts_destroyElements(); // remove all elements if ( oldDockingAreaWindows.size() > 0 ) { @@ -3848,9 +3858,13 @@ throw ( RuntimeException ) } } } + + // Reset docking area size for our old docking area acceptor + css::awt::Rectangle aEmptyRect; + xOldDockingAreaAcceptor->setDockingAreaSpace( aEmptyRect ); } - if ( m_xDockingAreaAcceptor.is() ) + if ( xDockingAreaAcceptor.is() ) { if ( bAutomaticToolbars ) { @@ -3863,6 +3877,105 @@ throw ( RuntimeException ) } } +void LayoutManager::implts_reparentChildWindows() +{ + UIElementVector aUIElementVector; + UIElement aStatusBarElement; + css::uno::Reference< css::awt::XWindow > xTopDockWindow; + css::uno::Reference< css::awt::XWindow > xBottomDockWindow; + css::uno::Reference< css::awt::XWindow > xLeftDockWindow; + css::uno::Reference< css::awt::XWindow > xRightDockWindow; + css::uno::Reference< css::awt::XWindow > xContainerWindow; + css::uno::Reference< css::awt::XWindow > xStatusBarWindow; + + WriteGuard aWriteLock( m_aLock ); + aUIElementVector = m_aUIElements; + xTopDockWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP]; + xBottomDockWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM]; + xLeftDockWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT]; + xRightDockWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT]; + xContainerWindow = m_xContainerWindow; + aStatusBarElement = m_aStatusBarElement; + aWriteLock.unlock(); + + if ( aStatusBarElement.m_xUIElement.is() ) + { + try + { + xStatusBarWindow = Reference< css::awt::XWindow >( + aStatusBarElement.m_xUIElement->getRealInterface(), + UNO_QUERY ); + } + catch ( RuntimeException& ) + { + throw; + } + catch ( Exception& ) + { + } + } + + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + Window* pTopDockWindow = VCLUnoHelper::GetWindow( xTopDockWindow ); + Window* pBottomDockWindow = VCLUnoHelper::GetWindow( xBottomDockWindow ); + Window* pLeftDockWindow = VCLUnoHelper::GetWindow( xLeftDockWindow ); + Window* pRightDockWindow = VCLUnoHelper::GetWindow( xRightDockWindow ); + if ( pContainerWindow ) + { + UIElementVector::iterator pIter; + for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ ) + { + Reference< XUIElement > xUIElement( pIter->m_xUIElement ); + if ( xUIElement.is() ) + { + Reference< css::awt::XWindow > xWindow; + try + { + // We have to retreive the window reference with try/catch as it is + // possible that all elements has been disposed! + xWindow = Reference< css::awt::XWindow >( xUIElement->getRealInterface(), UNO_QUERY ); + } + catch ( RuntimeException& ) + { + throw; + } + catch ( Exception& ) + { + } + + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow ) + { + // Reparent our child windows acording to their current state. + if ( pIter->m_bFloating ) + pWindow->SetParent( pContainerWindow ); + else + { + if ( pIter->m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_TOP ) + pWindow->SetParent( pTopDockWindow ); + else if ( pIter->m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_BOTTOM ) + pWindow->SetParent( pBottomDockWindow ); + else if ( pIter->m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_LEFT ) + pWindow->SetParent( pLeftDockWindow ); + else + pWindow->SetParent( pRightDockWindow ); + } + } + } + } + + if ( xStatusBarWindow.is() ) + { + Window* pWindow = VCLUnoHelper::GetWindow( xStatusBarWindow ); + if ( pWindow ) + pWindow->SetParent( pContainerWindow ); + } + + implts_resetMenuBar(); + } +} + IMPL_LINK( LayoutManager, WindowEventListener, VclSimpleEvent*, pEvent ) { // To enable toolbar controllers to change their image when a sub-toolbar function @@ -4434,38 +4547,10 @@ throw (RuntimeException) aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) { WriteGuard aWriteLock( m_aLock ); + m_bMenuVisible = sal_True; + aWriteLock.unlock(); - if ( m_xContainerWindow.is() ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - - m_bMenuVisible = sal_True; - if ( pWindow ) - { - MenuBar* pSetMenuBar = 0; - if ( m_xInplaceMenuBar.is() ) - { - pSetMenuBar = (MenuBar *)m_pInplaceMenuBar->GetMenuBar(); - ((SystemWindow *)pWindow)->SetMenuBar( pSetMenuBar ); - pSetMenuBar->SetDisplayable( sal_True ); - return sal_True; - } - else - { - MenuBarWrapper* pMenuBarWrapper = SAL_STATIC_CAST( MenuBarWrapper*, m_xMenuBar.get() ); - if ( pMenuBarWrapper ) - { - pSetMenuBar = (MenuBar *)pMenuBarWrapper->GetMenuBarManager()->GetMenuBar(); - ((SystemWindow *)pWindow)->SetMenuBar( pSetMenuBar ); - pSetMenuBar->SetDisplayable( sal_True ); - return sal_True; - } - } - } - } + return implts_resetMenuBar(); } else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || @@ -5872,6 +5957,39 @@ void LayoutManager::implts_updateMenuBarClose() } } +sal_Bool LayoutManager::implts_resetMenuBar() +{ + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + WriteGuard aWriteLock( m_aLock ); + sal_Bool bMenuVisible( m_bMenuVisible ); + Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); + + MenuBar* pSetMenuBar = 0; + if ( m_xInplaceMenuBar.is() ) + pSetMenuBar = (MenuBar *)m_pInplaceMenuBar->GetMenuBar(); + else + { + MenuBarWrapper* pMenuBarWrapper = SAL_STATIC_CAST( MenuBarWrapper*, m_xMenuBar.get() ); + if ( pMenuBarWrapper ) + pSetMenuBar = (MenuBar *)pMenuBarWrapper->GetMenuBarManager()->GetMenuBar(); + } + aWriteLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); + while ( pWindow && !pWindow->IsSystemWindow() ) + pWindow = pWindow->GetParent(); + + if ( pWindow && bMenuVisible && pSetMenuBar ) + { + ((SystemWindow *)pWindow)->SetMenuBar( pSetMenuBar ); + pSetMenuBar->SetDisplayable( sal_True ); + return sal_True; + } + + return sal_False; +} void LayoutManager::implts_setMenuBarCloser(sal_Bool bCloserState) { |