diff options
-rwxr-xr-x | framework/inc/helper/ilayoutnotifications.hxx | 52 | ||||
-rw-r--r-- | framework/inc/services/layoutmanager.hxx | 8 | ||||
-rwxr-xr-x | framework/source/layoutmanager/helpers.cxx | 43 | ||||
-rwxr-xr-x | framework/source/layoutmanager/helpers.hxx | 8 | ||||
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 131 | ||||
-rwxr-xr-x | framework/source/layoutmanager/toolbarlayoutmanager.cxx | 35 | ||||
-rwxr-xr-x | framework/source/layoutmanager/toolbarlayoutmanager.hxx | 8 |
7 files changed, 177 insertions, 108 deletions
diff --git a/framework/inc/helper/ilayoutnotifications.hxx b/framework/inc/helper/ilayoutnotifications.hxx new file mode 100755 index 000000000000..db63ea15c7b4 --- /dev/null +++ b/framework/inc/helper/ilayoutnotifications.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ + +namespace framework +{ + +class ILayoutNotifications +{ + public: + enum Hint + { + HINT_NOT_SPECIFIED, + HINT_TOOLBARSPACE_HAS_CHANGED, + HINT_COUNT + }; + + virtual void requestLayout( Hint eHint = HINT_NOT_SPECIFIED ) = 0; +}; + +} + +#endif // __FRAMEWORK_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index 898d1c240b2b..6fcd1e18488c 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -55,6 +55,7 @@ #include <classes/addonsoptions.hxx> #include <uielement/panelwindow.hxx> #include <uielement/uielement.hxx> +#include <helper/ilayoutnotifications.hxx> //_________________________________________________________________________________________________________________ // interface includes @@ -111,6 +112,7 @@ namespace framework // Order is neccessary for right initialization! private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. public ::cppu::OBroadcastHelper , + public ILayoutNotifications , public LayoutManager_PBase { public: @@ -218,6 +220,11 @@ namespace framework DECL_LINK( MenuBarClose, MenuBar * ); DECL_LINK( WindowEventListener, VclSimpleEvent* ); + //--------------------------------------------------------------------------------------------------------- + // ILayoutNotifications + //--------------------------------------------------------------------------------------------------------- + virtual void requestLayout( Hint eHint ); + struct DockedData { DockedData() : m_aPos( LONG_MAX, LONG_MAX ), @@ -282,7 +289,6 @@ namespace framework ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > implts_createElement( const rtl::OUString& aName ); // layouting methods - sal_Bool implts_compareRectangles( const ::com::sun::star::awt::Rectangle& rRect1, const ::com::sun::star::awt::Rectangle& rRect2 ); sal_Bool implts_resizeContainerWindow( const ::com::sun::star::awt::Size& rContainerSize, const ::com::sun::star::awt::Point& rComponentPos ); ::Size implts_getTopBottomDockingAreaSizes(); ::Size implts_getContainerWindowOutputSize(); diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx index bfa20e9324cd..8297a361ad93 100755 --- a/framework/source/layoutmanager/helpers.cxx +++ b/framework/source/layoutmanager/helpers.cxx @@ -69,6 +69,14 @@ using namespace com::sun::star; namespace framework { +void setZeroRectangle( ::Rectangle& rRect ) +{ + rRect.setX(0); + rRect.setY(0); + rRect.setWidth(0); + rRect.setHeight(0); +} + // ATTENTION! // This value is directly copied from the sfx2 project. // You have to change BOTH values, see sfx2/inc/sfx2/sfxsids.hrc (SID_DOCKWIN_START) @@ -152,7 +160,29 @@ bool impl_parseResourceURL( const rtl::OUString aResourceURL, rtl::OUString& aEl return false; } -css::awt::Rectangle impl_convertRectangleToAWT( const ::Rectangle& rRect ) +::com::sun::star::awt::Rectangle putRectangleValueToAWT( const ::Rectangle& rRect ) +{ + css::awt::Rectangle aRect; + aRect.X = rRect.Left(); + aRect.Y = rRect.Top(); + aRect.Width = rRect.Right(); + aRect.Height = rRect.Bottom(); + + return aRect; +} + +::Rectangle putAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ) +{ + ::Rectangle aRect; + aRect.Left() = rRect.X; + aRect.Top() = rRect.Y; + aRect.Right() = rRect.Width; + aRect.Bottom() = rRect.Height; + + return aRect; +} + +css::awt::Rectangle convertRectangleToAWT( const ::Rectangle& rRect ) { css::awt::Rectangle aRect; aRect.X = rRect.Left(); @@ -162,7 +192,7 @@ css::awt::Rectangle impl_convertRectangleToAWT( const ::Rectangle& rRect ) return aRect; } -::Rectangle impl_convertAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ) +::Rectangle convertAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ) { ::Rectangle aRect; aRect.Left() = rRect.X; @@ -173,6 +203,15 @@ css::awt::Rectangle impl_convertRectangleToAWT( const ::Rectangle& rRect ) return aRect; } +bool equalRectangles( const css::awt::Rectangle& rRect1, + const css::awt::Rectangle& rRect2 ) +{ + return (( rRect1.X == rRect2.X ) && + ( rRect1.Y == rRect2.Y ) && + ( rRect1.Width == rRect2.Width ) && + ( rRect1.Height == rRect2.Height )); +} + uno::Reference< frame::XModel > impl_getModelFromFrame( const uno::Reference< frame::XFrame >& rFrame ) { // Query for the model to get check the context information diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx index 71eb623df6ff..61b05d771278 100755 --- a/framework/source/layoutmanager/helpers.hxx +++ b/framework/source/layoutmanager/helpers.hxx @@ -67,12 +67,16 @@ namespace framework { +bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectangle& rRect2 ); +void setZeroRectangle( ::Rectangle& rRect ); bool lcl_checkUIElement(const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement,::com::sun::star::awt::Rectangle& _rPosSize, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xWindow); ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rFactory, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent, const char* pService ); WindowAlign ImplConvertAlignment( sal_Int16 aAlignment ); bool impl_parseResourceURL( const rtl::OUString aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName ); -::com::sun::star::awt::Rectangle impl_convertRectangleToAWT( const ::Rectangle& rRect ); -::Rectangle impl_convertAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ); +::Rectangle putAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ); +::com::sun::star::awt::Rectangle putRectangleValueToAWT( const ::Rectangle& rRect ); +::com::sun::star::awt::Rectangle convertRectangleToAWT( const ::Rectangle& rRect ); +::Rectangle convertAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ); ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > impl_getModelFromFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); sal_Bool implts_isPreviewModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); sal_Bool implts_isFrameOrWindowTop( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index cc8795171de7..6d2426936584 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -201,11 +201,12 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM , m_pToolbarManager( 0 ) { // Initialize statusbar member + const sal_Bool bRefreshVisibility = sal_False; m_aStatusBarElement.m_aType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "statusbar" )); m_aStatusBarElement.m_aName = m_aStatusBarAlias; m_pMiscOptions = new SvtMiscOptions(); - m_pToolbarManager = new ToolbarLayoutManager( xServiceManager, m_xUIElementFactoryManager ); + m_pToolbarManager = new ToolbarLayoutManager( xServiceManager, m_xUIElementFactoryManager, this ); m_xToolbarManager = uno::Reference< awt::XDockableWindowListener >( static_cast< OWeakObject* >( m_pToolbarManager ), uno::UNO_QUERY ); m_pMiscOptions->AddListenerLink( LINK( this, LayoutManager, OptionsChanged ) ); @@ -220,7 +221,6 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM registerProperty( LAYOUTMANAGER_PROPNAME_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, css::beans::PropertyAttribute::TRANSIENT, &m_bHideCurrentUI, ::getCppuType( &m_bHideCurrentUI ) ); registerProperty( LAYOUTMANAGER_PROPNAME_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY, &m_nLockCount, getCppuType( &m_nLockCount ) ); registerProperty( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, css::beans::PropertyAttribute::TRANSIENT, &m_bMenuBarCloser, ::getCppuType( &m_bMenuBarCloser ) ); - const sal_Bool bRefreshVisibility = sal_False; registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, css::beans::PropertyAttribute::TRANSIENT, ::getCppuType( &bRefreshVisibility ), &bRefreshVisibility ); registerProperty( LAYOUTMANAGER_PROPNAME_PRESERVE_CONTENT_SIZE, LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE, css::beans::PropertyAttribute::TRANSIENT, &m_bPreserveContentSize, ::getCppuType( &m_bPreserveContentSize ) ); } @@ -2085,16 +2085,16 @@ throw (RuntimeException) bMustBeLayouted = m_pToolbarManager->isLayoutDirty(); } } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" )) + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && + aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) { - if ( aElementName.equalsIgnoreAsciiCaseAscii( "menubar" ) && !bInPlaceMenu ) + // PB 2004-12-15 #i38743# don't create a menubar if frame isn't top + if ( !bInPlaceMenu && !m_xMenuBar.is() && implts_isFrameOrWindowTop( xFrame )) { vos::OGuard aGuard( Application::GetSolarMutex() ); - // PB 2004-12-15 #i38743# don't create a menubar if frame isn't top - if ( !m_xMenuBar.is() && implts_isFrameOrWindowTop(xFrame) ) - m_xMenuBar = implts_createElement( aName ); - if ( m_xMenuBar.is() && implts_isFrameOrWindowTop(xFrame) ) + m_xMenuBar = implts_createElement( aName ); + if ( m_xMenuBar.is() ) { Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); while ( pWindow && !pWindow->IsSystemWindow() ) @@ -2131,9 +2131,7 @@ throw (RuntimeException) pSysWindow->SetMenuBar( pMenuBar ); pMenuBar->SetDisplayable( m_bMenuVisible ); if ( m_bMenuVisible ) - { bNotify = sal_True; - } implts_updateMenuBarClose(); } } @@ -2191,7 +2189,7 @@ throw (RuntimeException) /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - sal_Bool bMustLayouted( sal_False ); + sal_Bool bMustBeLayouted( sal_False ); sal_Bool bMustBeDestroyed( sal_False ); sal_Bool bMustBeSorted( sal_False ); sal_Bool bNotify( sal_False ); @@ -2217,7 +2215,7 @@ throw (RuntimeException) { aWriteLock.unlock(); implts_destroyStatusBar(); - bMustLayouted = sal_True; + bMustBeLayouted = sal_True; bNotify = sal_True; } else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && @@ -2225,67 +2223,15 @@ throw (RuntimeException) { aWriteLock.unlock(); implts_createProgressBar(); - bMustLayouted = sal_True; + bMustBeLayouted = sal_True; bNotify = sal_True; } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ) && + m_pToolbarManager != NULL ) { - UIElementVector::iterator pIter; - - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aName == aName ) - { - xComponent.set( pIter->m_xUIElement, UNO_QUERY ); - Reference< XUIElement > xUIElement( pIter->m_xUIElement ); - if ( xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - - rtl::OUString aAddonTbResourceName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" )); - if ( aName.indexOf( aAddonTbResourceName ) != 0 ) - { - try - { - if ( xWindow.is() ) - xWindow->removeWindowListener( Reference< css::awt::XWindowListener >( - static_cast< OWeakObject * >( this ), UNO_QUERY )); - } - catch( Exception& ) - { - } - - try - { - if ( xDockWindow.is() ) - xDockWindow->removeDockableWindowListener( Reference< css::awt::XDockableWindowListener >( - static_cast< OWeakObject * >( this ), UNO_QUERY )); - } - catch ( Exception& ) - { - } - - bMustBeDestroyed = sal_True; - } - else - { - pIter->m_bVisible = sal_False; - xWindow->setVisible( sal_False ); - bNotify = sal_True; - } - - if ( !xDockWindow->isFloating() ) - bMustLayouted = sal_True; - if ( bMustBeDestroyed ) - pIter->m_xUIElement.clear(); - - bMustBeSorted = sal_True; - } - - break; - } - } + aWriteLock.unlock(); + bNotify = m_pToolbarManager->destroyToolbar( aName ); + bMustBeLayouted = m_pToolbarManager->isLayoutDirty(); } else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) { @@ -2294,8 +2240,8 @@ throw (RuntimeException) aWriteLock.unlock(); impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); - bMustLayouted = sal_False; - bNotify = sal_False; + bMustBeLayouted = sal_False; + bNotify = sal_False; } } aWriteLock.unlock(); @@ -2311,7 +2257,7 @@ throw (RuntimeException) if ( bMustBeSorted ) { implts_sortUIElements(); - if ( bMustLayouted ) + if ( bMustBeLayouted ) doLayout(); } @@ -3301,6 +3247,15 @@ throw (RuntimeException) implts_doLayout_notify( sal_True ); } +//--------------------------------------------------------------------------------------------------------- +// ILayoutNotifications +//--------------------------------------------------------------------------------------------------------- +void LayoutManager::requestLayout( Hint eHint ) +{ + if ( eHint == HINT_TOOLBARSPACE_HAS_CHANGED ) + doLayout(); +} + void LayoutManager::implts_doLayout_notify( sal_Bool bOuterResize ) { sal_Bool bLayouted = implts_doLayout( sal_False, bOuterResize ); @@ -3352,11 +3307,14 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_ aWriteGuard.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - css::awt::Rectangle aBorderSpace = implts_calcDockingAreaSizes(); + css::awt::Rectangle aDockSpace( implts_calcDockingAreaSizes() ); + css::awt::Rectangle aBorderSpace( aDockSpace ); sal_Bool bGotRequestedBorderSpace( sal_True ); - sal_Bool bEqual = implts_compareRectangles( aBorderSpace, aCurrBorderSpace ); - if ( !bEqual || bForceRequestBorderSpace || bMustDoLayout ) + // We have to add the height of a possible status bar + aBorderSpace.Height += implts_getStatusBarSize().Height(); + + if ( !equalRectangles( aBorderSpace, aCurrBorderSpace ) || bForceRequestBorderSpace || bMustDoLayout ) { // we always resize the content window (instead of the complete container window) if we're not set up // to (attempt to) preserve the content window's size @@ -3407,15 +3365,14 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_ if ( bGotRequestedBorderSpace ) { - ::Size aContainerSize; - ::Size aStatusBarSize; + ::Size aContainerSize; + ::Size aStatusBarSize; - aStatusBarSize = implts_getStatusBarSize(); - aBorderSpace.Height -= aStatusBarSize.Height(); - m_pToolbarManager->setDockingArea( aBorderSpace ); + m_pToolbarManager->setDockingArea( aDockSpace ); // Subtract status bar size from our container output size. Docking area windows // don't contain the status bar! + aStatusBarSize = implts_getStatusBarSize(); aContainerSize = implts_getContainerWindowOutputSize(); aContainerSize.Height() -= aStatusBarSize.Height(); @@ -3439,15 +3396,6 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_ return bLayouted; } -sal_Bool LayoutManager::implts_compareRectangles( const css::awt::Rectangle& rRect1, - const css::awt::Rectangle& rRect2 ) -{ - return (( rRect1.X == rRect2.X ) && - ( rRect1.Y == rRect2.Y ) && - ( rRect1.Width == rRect2.Width ) && - ( rRect1.Height == rRect2.Height )); -} - sal_Bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContainerSize, const awt::Point& rComponentPos ) { @@ -3558,9 +3506,6 @@ css::awt::Rectangle LayoutManager::implts_calcDockingAreaSizes() if ( xDockingAreaAcceptor.is() && xContainerWindow.is() ) aBorderSpace = m_pToolbarManager->getDockingArea(); - // We have to add the height of a possible status bar - aBorderSpace.Height += implts_getStatusBarSize().Height(); - return aBorderSpace; } diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index 076a82b24ebd..96d641cef387 100755 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -68,8 +68,10 @@ namespace framework ToolbarLayoutManager::ToolbarLayoutManager( const uno::Reference< lang::XMultiServiceFactory >& xSMGR, - const uno::Reference< ui::XUIElementFactory >& xUIElementFactory ) + const uno::Reference< ui::XUIElementFactory >& xUIElementFactory, + ILayoutNotifications* pParentLayouter ) : ThreadHelpBase( &Application::GetSolarMutex() ), + m_pParentLayouter( pParentLayouter ), m_xSMGR( xSMGR ), m_xUIElementFactoryManager( xUIElementFactory ), m_eDockOperation( DOCKOP_ON_COLROW ), @@ -85,6 +87,11 @@ ToolbarLayoutManager::ToolbarLayoutManager( m_aCustomTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "custom_" )), m_aCustomizeCmd( RTL_CONSTASCII_USTRINGPARAM( "ConfigureDialog" )) { + // initialize rectangles to zero values + setZeroRectangle( m_aDockingAreaOffsets ); + setZeroRectangle( m_aDockingArea ); + + // create toolkit object m_xToolkit = uno::Reference< css::awt::XToolkit >( m_xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), uno::UNO_QUERY ); } @@ -145,14 +152,14 @@ void SAL_CALL ToolbarLayoutManager::disposing( const lang::EventObject& aEvent ) aWriteLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - return impl_convertRectangleToAWT( aNewDockingArea ); + return putRectangleValueToAWT(aNewDockingArea); } void ToolbarLayoutManager::setDockingArea( const awt::Rectangle& rDockingArea ) { /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - m_aDockingArea = impl_convertAWTToRectangle( rDockingArea ); + m_aDockingArea = putAWTToRectangle( rDockingArea ); m_bLayoutDirty = true; aWriteLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -259,6 +266,11 @@ void ToolbarLayoutManager::doLayout(const ::Size& aContainerSize) nOffset += aRowColumnsWindowData[j].nStaticSize; } } + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + WriteGuard aWriteLock( m_aLock ); + m_bLayoutDirty = false; + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } bool ToolbarLayoutManager::implts_isParentWindowVisible() const @@ -290,6 +302,10 @@ Rectangle ToolbarLayoutManager::implts_calcDockingArea() std::vector< sal_Int32 > aRowColumnSizes[DOCKINGAREAS_COUNT]; UIElementVector::const_iterator pConstIter; + // initialize rectangle with zero values! + aBorderSpace.setWidth(0); + aBorderSpace.setHeight(0); + aRowColumnSizes[nCurrDockingArea].clear(); aRowColumnSizes[nCurrDockingArea].push_back( 0 ); @@ -1016,7 +1032,7 @@ void ToolbarLayoutManager::implts_createElement( const ::rtl::OUString& aName, b /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - UIElement rElement = impl_findElement( aName ); + UIElement& rElement = impl_findElement( aName ); if ( rElement.m_aName.getLength() > 0 ) { // Reuse a local entry so we are able to use the latest @@ -3119,7 +3135,7 @@ void SAL_CALL ToolbarLayoutManager::startDocking( const awt::DockingEvent& e ) throw (uno::RuntimeException) { - sal_Bool bWinFound( sal_False ); + bool bWinFound( false ); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadGuard( m_aLock ); @@ -3142,6 +3158,8 @@ throw (uno::RuntimeException) if ( aUIElement.m_xUIElement.is() && xWindow.is() ) { awt::Rectangle aRect; + + bWinFound = true; uno::Reference< css::awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); if ( xDockWindow->isFloating() ) { @@ -3189,7 +3207,6 @@ throw (uno::RuntimeException) UIElement aUIDockingElement; DockingOperation eDockingOperation( DOCKOP_ON_COLROW ); - aDockingData.TrackingRectangle = e.TrackingRectangle; sal_Bool bDockingInProgress; { @@ -3204,6 +3221,8 @@ throw (uno::RuntimeException) xRightDockingWindow = m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT]; xBottomDockingWindow = m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM]; aUIDockingElement = m_aDockUIElement; + + aDockingData.TrackingRectangle = e.TrackingRectangle; } /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } @@ -3464,8 +3483,12 @@ throw (uno::RuntimeException) aWriteLock.lock(); m_bDockingInProgress = sal_False; m_bLayoutDirty = !bStartDockFloated || !bFloating; + bool bNotify = m_bLayoutDirty; aWriteLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + if ( bNotify ) + m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED ); } sal_Bool SAL_CALL ToolbarLayoutManager::prepareToggleFloatingMode( diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx index 95b27f69c9c9..9d7ce8c28be7 100755 --- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx @@ -54,7 +54,7 @@ #include <uiconfiguration/windowstateconfiguration.hxx> #include <classes/addonsoptions.hxx> #include <uielement/uielement.hxx> -#include <uielement/menubarmanager.hxx> +#include <helper/ilayoutnotifications.hxx> //_________________________________________________________________________________________________________________ // interface includes @@ -75,8 +75,6 @@ #include <com/sun/star/awt/XWindow2.hpp> #include <com/sun/star/awt/XDockableWindow.hpp> #include <com/sun/star/awt/XDockableWindowListener.hpp> -#include <com/sun/star/frame/XMenuBarMergingAcceptor.hpp> -#include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp> //_________________________________________________________________________________________________________________ // other includes @@ -96,7 +94,8 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper2< ::com::sun::star::a enum { DOCKINGAREAS_COUNT = 4 }; ToolbarLayoutManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMGR, - const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElementFactory >& xUIElementFactory ); + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElementFactory >& xUIElementFactory, + ILayoutNotifications* pParentLayouter ); virtual ~ToolbarLayoutManager(); void reset(); @@ -290,6 +289,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper2< ::com::sun::star::a css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; css::uno::Reference< ::com::sun::star::awt::XToolkit > m_xToolkit; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; + ILayoutNotifications* m_pParentLayouter; UIElementVector m_aUIElements; UIElement m_aDockUIElement; |