dockingwindows: Fixed problems with changes done via UI configuration API not being sent to the ToolbarLayoutManager

This commit is contained in:
Carsten Driesner 2010-10-13 17:31:05 +02:00
parent a62a624542
commit bc5dc66313
3 changed files with 49 additions and 17 deletions

View file

@ -368,7 +368,7 @@ namespace framework
::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener
PanelManager* m_pPanelManager;
ToolbarLayoutManager* m_pToolbarManager;
css::uno::Reference< ::com::sun::star::lang::XComponent > m_xToolbarManager;
css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener > m_xToolbarManager;
};
} // namespace framework

View file

@ -189,7 +189,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM
m_aStatusBarElement.m_aName = m_aStatusBarAlias;
m_pToolbarManager = new ToolbarLayoutManager( xServiceManager, m_xUIElementFactoryManager, this );
m_xToolbarManager = uno::Reference< lang::XComponent >( static_cast< OWeakObject* >( m_pToolbarManager ), uno::UNO_QUERY );
m_xToolbarManager = uno::Reference< ui::XUIConfigurationListener >( static_cast< OWeakObject* >( m_pToolbarManager ), uno::UNO_QUERY );
Application::AddEventListener( LINK( this, LayoutManager, SettingsChanged ) );
@ -482,7 +482,7 @@ sal_Bool LayoutManager::implts_isEmbeddedLayoutManager() const
void LayoutManager::implts_destroyElements()
{
WriteGuard aWriteLock( m_aLock );
uno::Reference< lang::XComponent > xThis( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager );
ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
aWriteLock.unlock();
@ -499,7 +499,7 @@ void LayoutManager::implts_destroyElements()
void LayoutManager::implts_toggleFloatingUIElementsVisibility( sal_Bool bActive )
{
ReadGuard aReadLock( m_aLock );
uno::Reference< lang::XComponent > xThis( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager );
ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
aReadLock.unlock();
@ -921,7 +921,7 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible )
if ( bSetVisible )
{
uno::Reference< lang::XComponent > xThis( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager );
if ( xThis.is() )
m_pToolbarManager->setVisible(bSetVisible);
implts_doLayout_notify( sal_False );
@ -1270,7 +1270,7 @@ void LayoutManager::implts_setOffset( const sal_Int32 nBottomOffset )
aOffsetRect.setHeight( nBottomOffset );
// make sure that the toolbar manager refernence/pointer is valid
uno::Reference< lang::XComponent > xThis( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager );
if ( xThis.is() )
m_pToolbarManager->setDockingAreaOffsets( aOffsetRect );
}
@ -1427,7 +1427,7 @@ throw ( RuntimeException )
sal_Bool bAutomaticToolbars( m_bAutomaticToolbars );
std::vector< Reference< awt::XWindow > > oldDockingAreaWindows;
uno::Reference< lang::XComponent > xToolbarManager( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager );
ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
if ( !xDockingAreaAcceptor.is() )
@ -1566,7 +1566,7 @@ IMPL_LINK( LayoutManager, WindowEventListener, VclSimpleEvent*, pEvent )
long nResult( 1 );
ReadGuard aReadLock( m_aLock );
uno::Reference< lang::XComponent > xThis( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager );
ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
aReadLock.unlock();
@ -1827,14 +1827,15 @@ throw (uno::RuntimeException)
bNotify = true;
bDoLayout = true;
}
else if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR ) && m_bParentWindowVisible )
else if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR ) &&
m_bParentWindowVisible && m_bVisible )
{
ReadGuard aReadLock( m_aLock );
bool bComponentAttached( m_aModuleIdentifier.getLength() > 0 );
uno::Reference< uno::XInterface > xThis( m_xToolbarManager, uno::UNO_QUERY );
ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
aReadLock.unlock();
aWriteLock.unlock();
if ( pToolbarManager )
if ( pToolbarManager && bComponentAttached )
{
bNotify = pToolbarManager->requestToolbar( rResourceURL );
bDoLayout = true;
@ -2243,7 +2244,7 @@ throw (RuntimeException)
if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR ))
{
ReadGuard aReadLock( m_aLock );
uno::Reference< lang::XComponent > xToolbarManager( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager );
ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
aReadLock.unlock();
@ -2262,7 +2263,7 @@ throw (RuntimeException)
if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR ))
{
ReadGuard aReadLock( m_aLock );
uno::Reference< lang::XComponent > xToolbarManager( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager );
ToolbarLayoutManager* pToolbarManager( m_pToolbarManager );
aReadLock.unlock();
@ -3163,7 +3164,7 @@ throw( RuntimeException )
else if ( rEvent.Source == Reference< XInterface >( m_xContainerWindow, UNO_QUERY ))
{
// Our container window gets disposed. Remove all user interface elements.
uno::Reference< lang::XComponent > xToolbarManager( m_xToolbarManager );
uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager );
ToolbarLayoutManager* pToolbarManager = m_pToolbarManager;
if ( pToolbarManager )
{

View file

@ -4208,10 +4208,41 @@ throw (uno::RuntimeException)
}
}
void SAL_CALL ToolbarLayoutManager::elementReplaced(
const ui::ConfigurationEvent& /*Event*/ )
void SAL_CALL ToolbarLayoutManager::elementReplaced( const ui::ConfigurationEvent& rEvent )
throw (uno::RuntimeException)
{
::rtl::OUString aElementType;
::rtl::OUString aElementName;
UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL );
uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY );
if ( xElementSettings.is() )
{
::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" ));
uno::Reference< uno::XInterface > xElementCfgMgr;
uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY );
if ( xPropSet.is() )
xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr;
if ( !xElementCfgMgr.is() )
return;
// Check if the same UI configuration manager has changed => update settings
if ( rEvent.Source == xElementCfgMgr )
{
xElementSettings->updateSettings();
WriteGuard aWriteLock( m_aLock );
bool bDirty = !aUIElement.m_bFloating;
m_bLayoutDirty = bDirty;
ILayoutNotifications* pParentLayouter( m_pParentLayouter );
aWriteLock.unlock();
if ( bDirty && pParentLayouter )
pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED );
}
}
}
//---------------------------------------------------------------------------------------------------------