summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--framework/inc/services/layoutmanager.hxx1
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx135
-rwxr-xr-xframework/source/layoutmanager/toolbarlayoutmanager.cxx272
-rwxr-xr-xframework/source/layoutmanager/toolbarlayoutmanager.hxx21
4 files changed, 196 insertions, 233 deletions
diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx
index 6fcd1e18488c..48bca97bdb71 100644
--- a/framework/inc/services/layoutmanager.hxx
+++ b/framework/inc/services/layoutmanager.hxx
@@ -311,6 +311,7 @@ namespace framework
sal_Bool implts_showProgressBar();
sal_Bool implts_hideProgressBar();
void implts_backupProgressBarWrapper();
+ void implts_setOffset( const sal_Int32 nBottomOffset );
void implts_setInplaceMenuBar(
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMergedMenuBar )
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 6d2426936584..3a1392476c73 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -67,7 +67,6 @@
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/awt/XDevice.hpp>
#include <com/sun/star/awt/XSystemDependentWindowPeer.hpp>
-#include <com/sun/star/awt/XTopWindow.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/UIElementType.hpp>
@@ -327,10 +326,6 @@ void LayoutManager::implts_reset( sal_Bool bAttached )
ReadGuard aReadLock( m_aLock );
Reference< XFrame > xFrame = m_xFrame;
Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow );
- Reference< css::awt::XWindow > xTopDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP];
- Reference< css::awt::XWindow > xLeftDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT];
- Reference< css::awt::XWindow > xRightDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT];
- Reference< css::awt::XWindow > xBottomDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM];
Reference< XUIConfiguration > xModuleCfgMgr( m_xModuleCfgMgr, UNO_QUERY );
Reference< XUIConfiguration > xDocCfgMgr( m_xDocCfgMgr, UNO_QUERY );
Reference< XNameAccess > xPersistentWindowState( m_xPersistentWindowState );
@@ -1119,55 +1114,12 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible )
{
WriteGuard aWriteLock( m_aLock );
+ bOld = m_bDoLayout;
m_bDoLayout = sal_True;
- bOld = m_bDoLayout;
- }
-
- ReadGuard aReadLock( m_aLock );
- aWinVector.reserve(m_aUIElements.size());
- UIElementVector::iterator pIter;
- for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ )
- {
- if ( pIter->m_xUIElement.is() )
- {
- Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY );
- if ( xWindow.is() )
- {
- if ( bSetVisible )
- {
- if ( pIter->m_bVisible && !pIter->m_bMasterHide )
- aWinVector.push_back( xWindow );
- }
- else
- aWinVector.push_back( xWindow );
- }
- }
- }
-
- aReadLock.unlock();
-
- try
- {
- vos::OGuard aGuard( Application::GetSolarMutex() );
- const sal_uInt32 nCount = aWinVector.size();
- for ( sal_uInt32 i = 0; i < nCount; i++ )
- {
- Reference< css::awt::XWindow > xWindow( aWinVector[i] );
- if ( xWindow.is() )
- {
- // we need VCL here to pass special flags to Show()
- Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- if( pWindow )
- pWindow->Show( bSetVisible, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE );
- }
- }
- }
- catch ( DisposedException& )
- {
}
// Hide/show menubar according to bSetVisible
- aReadLock.lock();
+ ReadGuard aReadLock( m_aLock );
Reference< XUIElement > xMenuBar( m_xMenuBar, UNO_QUERY );
Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow );
Reference< XComponent > xInplaceMenuBar( m_xInplaceMenuBar );
@@ -1215,38 +1167,17 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible )
if ( bSetVisible )
{
- m_pToolbarManager->implts_createNonContextSensitiveToolBars();
+ uno::Reference< uno::XInterface > xThis( m_xToolbarManager, uno::UNO_QUERY );
+ if ( xThis.is() )
+ m_pToolbarManager->setVisible(bSetVisible);
implts_doLayout_notify( sal_False );
}
else
{
- // Set docking area window size to zero
- ReadGuard aReadLock2( m_aLock );
- Reference< css::awt::XWindow > xTopDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP];
- Reference< css::awt::XWindow > xLeftDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT];
- Reference< css::awt::XWindow > xRightDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT];
- Reference< css::awt::XWindow > xBottomDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM];
- aReadLock2.unlock();
-
- try
- {
- if ( xTopDockingWindow.is() )
- xTopDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE );
- if ( xLeftDockingWindow.is() )
- xLeftDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE );
- if ( xRightDockingWindow.is() )
- xRightDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE );
- if ( xBottomDockingWindow.is() )
- xBottomDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE );
-
- WriteGuard aWriteLock( m_aLock );
- m_aDockingArea = css::awt::Rectangle();
- m_bMustDoLayout = sal_True;
- aWriteLock.unlock();
- }
- catch ( Exception& )
- {
- }
+ WriteGuard aWriteLock( m_aLock );
+ m_aDockingArea = css::awt::Rectangle();
+ m_bMustDoLayout = sal_True;
+ aWriteLock.unlock();
}
}
@@ -1491,6 +1422,7 @@ sal_Bool LayoutManager::implts_showProgressBar()
{
if ( !pWindow->IsVisible() )
{
+ implts_setOffset( pWindow->GetSizePixel().Height() );
pWindow->Show();
implts_doLayout_notify( sal_False );
}
@@ -1532,6 +1464,7 @@ sal_Bool LayoutManager::implts_hideProgressBar()
if ( pWindow && pWindow->IsVisible() &&
( bHideStatusBar || bInternalStatusBar ))
{
+ implts_setOffset( 0 );
pWindow->Hide();
implts_doLayout_notify( sal_False );
return sal_True;
@@ -1558,7 +1491,9 @@ sal_Bool LayoutManager::implts_showStatusBar( sal_Bool bStoreState )
Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && !pWindow->IsVisible() )
{
+ implts_setOffset( pWindow->GetSizePixel().Height() );
pWindow->Show();
+ implts_doLayout_notify( sal_False );
return sal_True;
}
}
@@ -1584,7 +1519,9 @@ sal_Bool LayoutManager::implts_hideStatusBar( sal_Bool bStoreState )
Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
if ( pWindow && pWindow->IsVisible() )
{
+ implts_setOffset( 0 );
pWindow->Hide();
+ implts_doLayout_notify( sal_False );
return sal_True;
}
}
@@ -1592,6 +1529,18 @@ sal_Bool LayoutManager::implts_hideStatusBar( sal_Bool bStoreState )
return sal_False;
}
+void LayoutManager::implts_setOffset( const sal_Int32 nBottomOffset )
+{
+ ::Rectangle aOffsetRect;
+ setZeroRectangle( aOffsetRect );
+ aOffsetRect.setHeight( nBottomOffset );
+
+ // make sure that the toolbar manager refernence/pointer is valid
+ uno::Reference< uno::XInterface > xThis( m_xToolbarManager, uno::UNO_QUERY );
+ if ( xThis.is() )
+ m_pToolbarManager->setDockingAreaOffsets( aOffsetRect );
+}
+
void LayoutManager::implts_setInplaceMenuBar( const Reference< XIndexAccess >& xMergedMenuBar )
throw (::com::sun::star::uno::RuntimeException)
{
@@ -1684,8 +1633,6 @@ throw (::com::sun::star::uno::RuntimeException)
m_xFrame = xFrame;
aWriteLock.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- // if ( xFrame.is() )
- // xFrame->getContainerWindow()->addWindowListener( Reference< css::awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY ));
}
void SAL_CALL LayoutManager::reset()
@@ -3937,31 +3884,6 @@ throw( css::uno::RuntimeException )
xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE );
}
}
- else
- {
- // resize event for one of the UIElements
- sal_Bool bLocked( m_bDockingInProgress );
- sal_Bool bDoLayout( m_bDoLayout );
- aWriteLock.unlock();
- /* SAFE AREA ----------------------------------------------------------------------------------------------- */
-
- if ( !bLocked && !bDoLayout )
- {
- // Do not do anything if we are in the middle of a docking process. This would interfere all other
- // operations. We will store the new position and size in the docking handlers.
- // Do not do anything if we are in the middle of our layouting process. We will adapt the position
- // and size of the user interface elements.
- UIElement aUIElement;
- if ( implts_findElement( aEvent.Source, aUIElement ))
- {
- if ( aUIElement.m_bFloating )
- implts_writeNewStateData( aUIElement.m_aName,
- Reference< css::awt::XWindow >( aEvent.Source, UNO_QUERY ));
- else
- doLayout();
- }
- }
- }
}
void SAL_CALL LayoutManager::windowMoved( const css::awt::WindowEvent& ) throw( css::uno::RuntimeException )
@@ -3992,10 +3914,7 @@ void SAL_CALL LayoutManager::windowShown( const css::lang::EventObject& aEvent )
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
if ( bSetVisible )
- {
implts_updateUIElementsVisibleState( sal_True );
- //implts_doLayout( sal_False );
- }
}
}
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 96d641cef387..8ff7e265dbf0 100755
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -83,6 +83,8 @@ ToolbarLayoutManager::ToolbarLayoutManager(
m_bStoreWindowState( false ),
m_bGlobalSettings( false ),
m_bDockingInProgress( false ),
+ m_bVisible( true ),
+ m_bLayoutInProgress( false ),
m_aFullAddonTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" )),
m_aCustomTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "custom_" )),
m_aCustomizeCmd( RTL_CONSTASCII_USTRINGPARAM( "ConfigureDialog" ))
@@ -251,6 +253,16 @@ bool ToolbarLayoutManager::isLayoutDirty()
void ToolbarLayoutManager::doLayout(const ::Size& aContainerSize)
{
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ WriteGuard aWriteLock( m_aLock );
+
+ if ( m_bLayoutInProgress )
+ return;
+
+ m_bLayoutInProgress = true;
+ aWriteLock.unlock();
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+
// Retrieve row/column dependent data from all docked user-interface elements
for ( sal_Int32 i = 0; i < DOCKINGAREAS_COUNT; i++ )
{
@@ -268,8 +280,10 @@ void ToolbarLayoutManager::doLayout(const ::Size& aContainerSize)
}
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- WriteGuard aWriteLock( m_aLock );
- m_bLayoutDirty = false;
+ aWriteLock.lock();
+ m_bLayoutDirty = false;
+ m_bLayoutInProgress = false;
+ aWriteLock.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
}
@@ -403,6 +417,7 @@ void ToolbarLayoutManager::reset()
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
destroyToolbars();
+ resetDockingArea();
}
void ToolbarLayoutManager::attach(
@@ -538,10 +553,13 @@ void ToolbarLayoutManager::destroyToolbars()
{
UIElementVector aUIElementVector;
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
WriteGuard aWriteLock( m_aLock );
aUIElementVector = m_aUIElements;
m_aUIElements.clear();
+ m_bLayoutDirty = true;
aWriteLock.unlock();
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
UIElementVector::iterator pIter;
for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ )
@@ -552,6 +570,36 @@ void ToolbarLayoutManager::destroyToolbars()
}
}
+void ToolbarLayoutManager::setVisible( bool bVisible )
+{
+ UIElementVector aUIElementVector;
+
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ WriteGuard aWriteLock( m_aLock );
+ aUIElementVector = m_aUIElements;
+ m_bLayoutDirty = true;
+ aWriteLock.unlock();
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+
+ UIElementVector::iterator pIter;
+ for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ )
+ {
+ bool bToolbarVisible = pIter->m_bVisible;
+
+ pIter->m_bMasterHide = !bVisible;
+ if ( pIter->m_xUIElement.is() )
+ {
+ uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement );
+ uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY );
+ if ( xWindow.is() )
+ xWindow->setVisible(bVisible & bToolbarVisible);
+ }
+ }
+
+ if ( !bVisible )
+ resetDockingArea();
+}
+
void ToolbarLayoutManager::dockToolbar(
const ::rtl::OUString& /*rResourceURL*/,
::com::sun::star::ui::DockingArea /*eDockingArea*/,
@@ -699,7 +747,7 @@ void ToolbarLayoutManager::implts_createAddonsToolBars()
if ( aElement.m_aUIName.getLength() == 0 )
{
aElement.m_aUIName = aGenericAddonTitle;
- implts_writeWindowStateData( aElement.m_aName, aElement );
+ implts_writeWindowStateData( aElement );
}
}
else
@@ -712,7 +760,7 @@ void ToolbarLayoutManager::implts_createAddonsToolBars()
if ( aNewToolbar.m_aUIName.getLength() == 0 )
{
aNewToolbar.m_aUIName = aGenericAddonTitle;
- implts_writeWindowStateData( aNewToolbar.m_aName, aNewToolbar );
+ implts_writeWindowStateData( aNewToolbar );
}
implts_insertElement( aNewToolbar );
}
@@ -1197,7 +1245,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno
css::awt::PosSize::POS );
if ( bWriteData )
- implts_writeWindowStateData( rElement.m_aName, rElement );
+ implts_writeWindowStateData( rElement );
if ( bShowElement && pWindow )
{
vos::OGuard aGuard( Application::GetSolarMutex() );
@@ -1421,7 +1469,7 @@ sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const rtl::OUString&
return sal_False;
}
-void ToolbarLayoutManager::implts_writeWindowStateData( const rtl::OUString& aName, const UIElement& rElementData )
+void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElementData )
{
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
WriteGuard aWriteLock( m_aLock );
@@ -1457,35 +1505,36 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const rtl::OUString& aNa
{
uno::Sequence< beans::PropertyValue > aWindowState( 8 );
- aWindowState[0].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKED );
- aWindowState[0].Value = ::uno::makeAny( sal_Bool( !rElementData.m_bFloating ));
- aWindowState[1].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_VISIBLE );
- aWindowState[1].Value = uno::makeAny( sal_Bool( rElementData.m_bVisible ));
+ aWindowState[0].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKED );
+ aWindowState[0].Value = ::uno::makeAny( sal_Bool( !rElementData.m_bFloating ));
+ aWindowState[1].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_VISIBLE );
+ aWindowState[1].Value = uno::makeAny( sal_Bool( rElementData.m_bVisible ));
- aWindowState[2].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKINGAREA );
- aWindowState[2].Value = uno::makeAny( static_cast< ui::DockingArea >( rElementData.m_aDockedData.m_nDockedArea ) );
+ aWindowState[2].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKINGAREA );
+ aWindowState[2].Value = uno::makeAny( static_cast< ui::DockingArea >( rElementData.m_aDockedData.m_nDockedArea ) );
awt::Point aPos;
aPos.X = rElementData.m_aDockedData.m_aPos.X();
aPos.Y = rElementData.m_aDockedData.m_aPos.Y();
- aWindowState[3].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKPOS );
- aWindowState[3].Value <<= aPos;
+ aWindowState[3].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKPOS );
+ aWindowState[3].Value <<= aPos;
aPos.X = rElementData.m_aFloatingData.m_aPos.X();
aPos.Y = rElementData.m_aFloatingData.m_aPos.Y();
- aWindowState[4].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_POS );
- aWindowState[4].Value <<= aPos;
+ aWindowState[4].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_POS );
+ aWindowState[4].Value <<= aPos;
awt::Size aSize;
- aSize.Width = rElementData.m_aFloatingData.m_aSize.Width();
+ aSize.Width = rElementData.m_aFloatingData.m_aSize.Width();
aSize.Height = rElementData.m_aFloatingData.m_aSize.Height();
- aWindowState[5].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_SIZE );
- aWindowState[5].Value <<= aSize;
- aWindowState[6].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_UINAME );
- aWindowState[6].Value = uno::makeAny( rElementData.m_aUIName );
- aWindowState[7].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_LOCKED );
- aWindowState[7].Value = uno::makeAny( rElementData.m_aDockedData.m_bLocked );
-
+ aWindowState[5].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_SIZE );
+ aWindowState[5].Value <<= aSize;
+ aWindowState[6].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_UINAME );
+ aWindowState[6].Value = uno::makeAny( rElementData.m_aUIName );
+ aWindowState[7].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_LOCKED );
+ aWindowState[7].Value = uno::makeAny( rElementData.m_aDockedData.m_bLocked );
+
+ ::rtl::OUString aName = rElementData.m_aName;
if ( xPersistentWindowState->hasByName( aName ))
{
uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY );
@@ -1503,9 +1552,11 @@ void ToolbarLayoutManager::implts_writeWindowStateData( const rtl::OUString& aNa
}
// Reset flag
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
aWriteLock.lock();
m_bStoreWindowState = false;
aWriteLock.unlock();
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
}
/******************************************************************************
@@ -3129,6 +3180,80 @@ void ToolbarLayoutManager::implts_renumberRowColumnData(
}
//---------------------------------------------------------------------------------------------------------
+// XWindowListener
+//---------------------------------------------------------------------------------------------------------
+void SAL_CALL ToolbarLayoutManager::windowResized( const css::awt::WindowEvent& aEvent )
+throw( css::uno::RuntimeException )
+{
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ WriteGuard aWriteLock( m_aLock );
+ bool bLocked( m_bDockingInProgress );
+ bool bDoLayout( m_bLayoutInProgress );
+ aWriteLock.unlock();
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+
+ // Do not do anything if we are in the middle of a docking process. This would interfere all other
+ // operations. We will store the new position and size in the docking handlers.
+ // Do not do anything if we are in the middle of our layouting process. We will adapt the position
+ // and size of the user interface elements.
+ if ( !bLocked && !bDoLayout )
+ {
+ bool bNotify( false );
+ uno::Reference< css::awt::XWindow > xWindow( aEvent.Source, uno::UNO_QUERY );
+
+ UIElement aUIElement = implts_findElement( aEvent.Source );
+ if ( aUIElement.m_xUIElement.is() )
+ {
+ if ( aUIElement.m_bFloating )
+ {
+ uno::Reference< css::awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY );
+
+ if( xWindow2.is() )
+ {
+ awt::Rectangle aPos = xWindow2->getPosSize();
+ awt::Size aSize = xWindow2->getOutputSize(); // always use output size for consistency
+ bool bVisible = xWindow2->isVisible();
+
+ // update element data
+ aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y );
+ aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height );
+ aUIElement.m_bVisible = bVisible;
+ }
+
+ implts_writeWindowStateData( aUIElement );
+ }
+ else
+ {
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ aWriteLock.lock();
+ m_bLayoutDirty = true;
+ bNotify = true;
+ aWriteLock.unlock();
+ /* SAFE AREA ----------------------------------------------------------------------------------------------- */
+ }
+ }
+
+ if ( bNotify )
+ m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
+ }
+}
+
+void SAL_CALL ToolbarLayoutManager::windowMoved( const css::awt::WindowEvent& /*aEvent*/ )
+throw( css::uno::RuntimeException )
+{
+}
+
+void SAL_CALL ToolbarLayoutManager::windowShown( const css::lang::EventObject& /*aEvent*/ )
+throw( css::uno::RuntimeException )
+{
+}
+
+void SAL_CALL ToolbarLayoutManager::windowHidden( const css::lang::EventObject& /*aEvent*/ )
+throw( css::uno::RuntimeException )
+{
+}
+
+//---------------------------------------------------------------------------------------------------------
// XDockableWindowListener
//---------------------------------------------------------------------------------------------------------
void SAL_CALL ToolbarLayoutManager::startDocking(
@@ -3443,7 +3568,7 @@ throw (uno::RuntimeException)
aWriteLock.unlock();
/* SAFE AREA ----------------------------------------------------------------------------------------------- */
- implts_writeWindowStateData( aUIDockingElement.m_aName, aUIDockingElement );
+ implts_writeWindowStateData( aUIDockingElement );
if ( bDockingInProgress )
{
@@ -3659,7 +3784,7 @@ throw (uno::RuntimeException)
m_bLayoutDirty = true;
aWriteLock.unlock();
- implts_writeWindowStateData( aUIDockingElement.m_aName, aUIDockingElement );
+ implts_writeWindowStateData( aUIDockingElement );
implts_sortUIElements();
}
}
@@ -3762,101 +3887,6 @@ throw (uno::RuntimeException)
sal_Bool SAL_CALL ToolbarLayoutManager::dockWindow( const ::rtl::OUString& /*aName*/, ui::DockingArea /*DockingArea*/, const awt::Point& /*Pos*/ )
throw (uno::RuntimeException)
{
-/*
- UIElement& rUIElement = impl_findElement( aUIElement.m_aName );
-
- if ( rUIElement.m_xUIElement.is() )
- {
- try
- {
- uno::Reference< awt::XWindow > xWindow( rUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY );
- uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY );
- if ( xDockWindow.is() )
- {
- if ( DockingArea != DockingArea_DOCKINGAREA_DEFAULT )
- aUIElement.m_aDockedData.m_nDockedArea = sal_Int16( DockingArea );
-
- if (( Pos.X != SAL_MAX_INT32 ) && ( Pos.Y != SAL_MAX_INT32 ))
- aUIElement.m_aDockedData.m_aPos = ::Point( Pos.X, Pos.Y );
-
- if ( !xDockWindow->isFloating() )
- {
- Window* pWindow( 0 );
- ToolBox* pToolBox( 0 );
-
- {
- vos::OGuard aGuard( Application::GetSolarMutex() );
- pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX )
- {
- pToolBox = (ToolBox *)pWindow;
-
- // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a
- // horizontal to a vertical docking area!
- pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ));
- }
- }
-
- if (( aUIElement.m_aDockedData.m_aPos.X() == SAL_MAX_INT32 ) ||
- ( aUIElement.m_aDockedData.m_aPos.Y() == SAL_MAX_INT32 ))
- {
- // Docking on its default position without a preset position -
- // we have to find a good place for it.
- ::Size aSize;
-
- vos::OGuard aGuard( Application::GetSolarMutex() );
- {
- if ( pToolBox )
- aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) );
- else
- aSize = pWindow->GetSizePixel();
- }
-
- ::Point aPixelPos;
- ::Point aDockPos;
- implts_findNextDockingPos( (::com::sun::star::ui::DockingArea)aUIElement.m_aDockedData.m_nDockedArea,
- aSize,
- aDockPos,
- aPixelPos );
- aUIElement.m_aDockedData.m_aPos = aDockPos;
- }
- }
-
- WriteGuard aWriteLock( m_aLock );
- UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName );
- if ( rUIElement.m_aName == aName )
- {
- rUIElement.m_aDockedData.m_nDockedArea = aUIElement.m_aDockedData.m_nDockedArea;
- rUIElement.m_aDockedData.m_aPos = aUIElement.m_aDockedData.m_aPos;
- }
- aWriteLock.unlock();
-
- if ( xDockWindow->isFloating() )
- {
- // Will call toggle floating mode which will do the rest!
- xWindow->setVisible( sal_False );
- xDockWindow->setFloatingMode( sal_False );
- xWindow->setVisible( sal_True );
- }
- else
- {
- implts_writeWindowStateData( aName, aUIElement );
- implts_sortUIElements();
-
- if ( aUIElement.m_bVisible )
- {
- m_bLayoutDirty = true;
- }
- }
-
- return sal_True;
- }
- }
- catch ( uno::DisposedException& )
- {
- }
- }
-*/
return false;
}
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
index 9d7ce8c28be7..016168cefcc0 100755
--- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
@@ -80,14 +80,15 @@
// other includes
//_________________________________________________________________________________________________________________
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
namespace framework
{
-class ToolbarLayoutManager : public ::cppu::WeakImplHelper2< ::com::sun::star::awt::XDockableWindowListener,
- ::com::sun::star::ui::XUIConfigurationListener >,
+class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::awt::XDockableWindowListener,
+ ::com::sun::star::ui::XUIConfigurationListener,
+ ::com::sun::star::awt::XWindowListener >,
private ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses.
{
public:
@@ -117,6 +118,8 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper2< ::com::sun::star::a
void createToolbars();
void destroyToolbars();
+ void setVisible(bool bVisible);
+ bool isVisible() { return m_bVisible; }
bool createToolbar( const ::rtl::OUString& rResourceURL );
bool destroyToolbar( const ::rtl::OUString& rResourceURL );
@@ -138,6 +141,14 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper2< ::com::sun::star::a
virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
//---------------------------------------------------------------------------------------------------------
+ // XWindowListener
+ //---------------------------------------------------------------------------------------------------------
+ virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
+ virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException );
+
+ //---------------------------------------------------------------------------------------------------------
// XDockableWindowListener
//---------------------------------------------------------------------------------------------------------
virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException);
@@ -275,7 +286,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper2< ::com::sun::star::a
// persistence methods
//---------------------------------------------------------------------------------------------------------
sal_Bool implts_readWindowStateData( const rtl::OUString& aName, UIElement& rElementData );
- void implts_writeWindowStateData( const rtl::OUString& aName, const UIElement& rElementData );
+ void implts_writeWindowStateData( const UIElement& rElementData );
//---------------------------------------------------------------------------------------------------------
// members
@@ -307,6 +318,8 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper2< ::com::sun::star::a
bool m_bStoreWindowState;
bool m_bGlobalSettings;
bool m_bDockingInProgress;
+ bool m_bVisible;
+ bool m_bLayoutInProgress;
::rtl::OUString m_aFullAddonTbxPrefix;
::rtl::OUString m_aCustomTbxPrefix;