diff options
author | Jan Holesovsky <kendy@suse.cz> | 2013-04-09 22:30:54 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2013-04-10 10:39:54 +0200 |
commit | 99d851b3e2b9f41a6616813cbf7a681aa842615e (patch) | |
tree | 4553f507e34da46fd0062bace76a0debfb15e181 /framework/source/layoutmanager | |
parent | 44b1352c540a97b1cb25abcd46cd9ec387288841 (diff) |
Kill copy'n'paste.
Change-Id: I5e5b80f8d8efe91df806bb7ae9750fd84009c6be
Diffstat (limited to 'framework/source/layoutmanager')
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 31 | ||||
-rw-r--r-- | framework/source/layoutmanager/toolbarlayoutmanager.cxx | 136 |
2 files changed, 25 insertions, 142 deletions
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index e8b8358c1a4d..278492747357 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -482,23 +482,32 @@ uno::Reference< ui::XUIElement > LayoutManager::implts_findElement( const OUStri sal_Bool LayoutManager::implts_readWindowStateData( const OUString& aName, UIElement& rElementData ) { - sal_Bool bGetSettingsState( sal_False ); + return readWindowStateData( aName, rElementData, m_aLock, m_xPersistentWindowState, + m_pGlobalSettings, m_bGlobalSettings, comphelper::getComponentContext(m_xSMGR) ); +} - WriteGuard aWriteLock( m_aLock ); - Reference< XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); +sal_Bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElementData, + LockHelper &rLock, const Reference< XNameAccess > &rPersistentWindowState, + GlobalSettings* &rGlobalSettings, bool &bInGlobalSettings, + const Reference< XComponentContext > &rComponentContext ) +{ + bool bGetSettingsState( false ); + + WriteGuard aWriteLock( rLock ); + Reference< XNameAccess > xPersistentWindowState( rPersistentWindowState ); aWriteLock.unlock(); if ( xPersistentWindowState.is() ) { aWriteLock.lock(); - sal_Bool bGlobalSettings( m_bGlobalSettings ); + bool bGlobalSettings( bInGlobalSettings ); GlobalSettings* pGlobalSettings( 0 ); - if ( m_pGlobalSettings == 0 ) + if ( rGlobalSettings == 0 ) { - m_pGlobalSettings = new GlobalSettings( comphelper::getComponentContext(m_xSMGR) ); - bGetSettingsState = sal_True; + rGlobalSettings = new GlobalSettings( rComponentContext ); + bGetSettingsState = true; } - pGlobalSettings = m_pGlobalSettings; + pGlobalSettings = rGlobalSettings; aWriteLock.unlock(); try @@ -584,12 +593,12 @@ sal_Bool LayoutManager::implts_readWindowStateData( const OUString& aName, UIEle { if ( pGlobalSettings->HasStatesInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR )) { - WriteGuard aWriteLock2( m_aLock ); - m_bGlobalSettings = sal_True; + WriteGuard aWriteLock2( rLock ); + bInGlobalSettings = true; aWriteLock2.unlock(); uno::Any aValue; - sal_Bool bValue = sal_Bool(); + sal_Bool bValue = sal_Bool(); if ( pGlobalSettings->GetStateInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR, GlobalSettings::STATEINFO_LOCKED, aValue )) diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index dd14cec2a070..421a413e89b2 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -20,6 +20,7 @@ #include <toolbarlayoutmanager.hxx> #include <helpers.hxx> #include <services.h> +#include <services/layoutmanager.hxx> #include <classes/resource.hrc> #include <classes/fwkresid.hxx> #include <uiconfiguration/windowstateconfiguration.hxx> @@ -1574,135 +1575,8 @@ void ToolbarLayoutManager::implts_destroyDockingAreaWindows() sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const OUString& aName, UIElement& rElementData ) { - WriteGuard aWriteLock( m_aLock ); - uno::Reference< container::XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); - bool bGetSettingsState( false ); - aWriteLock.unlock(); - - if ( xPersistentWindowState.is() ) - { - aWriteLock.lock(); - bool bGlobalSettings( m_bGlobalSettings ); - GlobalSettings* pGlobalSettings( 0 ); - if ( m_pGlobalSettings == 0 ) - { - m_pGlobalSettings = new GlobalSettings( m_xContext ); - bGetSettingsState = true; - } - pGlobalSettings = m_pGlobalSettings; - aWriteLock.unlock(); - - try - { - uno::Sequence< beans::PropertyValue > aWindowState; - if ( xPersistentWindowState->getByName( aName ) >>= aWindowState ) - { - sal_Bool bValue( sal_False ); - for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ ) - { - if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKED )) - { - if ( aWindowState[n].Value >>= bValue ) - rElementData.m_bFloating = !bValue; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_VISIBLE )) - { - if ( aWindowState[n].Value >>= bValue ) - rElementData.m_bVisible = bValue; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKINGAREA )) - { - ui::DockingArea eDockingArea; - if ( aWindowState[n].Value >>= eDockingArea ) - rElementData.m_aDockedData.m_nDockedArea = sal_Int16( eDockingArea ); - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKPOS )) - { - awt::Point aPoint; - if ( aWindowState[n].Value >>= aPoint ) - rElementData.m_aDockedData.m_aPos = aPoint; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_POS )) - { - awt::Point aPoint; - if ( aWindowState[n].Value >>= aPoint ) - rElementData.m_aFloatingData.m_aPos = aPoint; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_SIZE )) - { - awt::Size aSize; - if ( aWindowState[n].Value >>= aSize ) - rElementData.m_aFloatingData.m_aSize = aSize; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_UINAME )) - aWindowState[n].Value >>= rElementData.m_aUIName; - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_STYLE )) - { - sal_Int32 nStyle = 0; - if ( aWindowState[n].Value >>= nStyle ) - rElementData.m_nStyle = sal_Int16( nStyle ); - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_LOCKED )) - { - if ( aWindowState[n].Value >>= bValue ) - rElementData.m_aDockedData.m_bLocked = bValue; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_CONTEXT )) - { - if ( aWindowState[n].Value >>= bValue ) - rElementData.m_bContextSensitive = bValue; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_NOCLOSE )) - { - if ( aWindowState[n].Value >>= bValue ) - rElementData.m_bNoClose = bValue; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_CONTEXTACTIVE )) - { - if ( aWindowState[n].Value >>= bValue ) - rElementData.m_bContextActive = bValue; - } - else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_SOFTCLOSE )) - { - if ( aWindowState[n].Value >>= bValue ) - rElementData.m_bSoftClose = bValue; - } - } - } - - // oversteer values with global settings - if ( pGlobalSettings && ( bGetSettingsState || bGlobalSettings )) - { - if ( pGlobalSettings->HasStatesInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR )) - { - WriteGuard aWriteLock2( m_aLock ); - m_bGlobalSettings = true; - aWriteLock2.unlock(); - - uno::Any aValue; - sal_Bool bValue = sal_Bool(); - if ( pGlobalSettings->GetStateInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR, - GlobalSettings::STATEINFO_LOCKED, - aValue )) - aValue >>= rElementData.m_aDockedData.m_bLocked; - if ( pGlobalSettings->GetStateInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR, - GlobalSettings::STATEINFO_DOCKED, - aValue )) - { - if ( aValue >>= bValue ) - rElementData.m_bFloating = !bValue; - } - } - } - - return sal_True; - } - catch (const container::NoSuchElementException&) - { - } - } - - return sal_False; + return LayoutManager::readWindowStateData( aName, rElementData, m_aLock, m_xPersistentWindowState, + m_pGlobalSettings, m_bGlobalSettings, m_xContext ); } void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElementData ) @@ -3308,9 +3182,9 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( xPersistentWindowState->getByName( aWindowElements[i] ) >>= aPropValueSeq; for ( sal_Int32 j = 0; j < aPropValueSeq.getLength(); j++ ) { - if ( aPropValueSeq[j].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKINGAREA )) + if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKINGAREA ) aPropValueSeq[j].Value >>= nDockedArea; - else if ( aPropValueSeq[j].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKPOS )) + else if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKPOS ) aPropValueSeq[j].Value >>= aDockedPos; } |