diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-20 13:45:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-21 08:48:26 +0200 |
commit | 89340fcb6509afd1bffea7b6060d5ff5a444b3f1 (patch) | |
tree | d5ae1feaeed8b67afb89b71e642b6306dd4ebc37 /framework/source/layoutmanager | |
parent | vcl: change bitmap::loadFromName to be like BitmapEx const. (diff) | |
download | core-89340fcb6509afd1bffea7b6060d5ff5a444b3f1.tar.gz core-89340fcb6509afd1bffea7b6060d5ff5a444b3f1.zip |
use for-range on Sequence in f*
Change-Id: I820255001c1b96d1f4b76a203f3c0f76fa09fe66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94567
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/layoutmanager')
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 52 | ||||
-rw-r--r-- | framework/source/layoutmanager/toolbarlayoutmanager.cxx | 41 |
2 files changed, 44 insertions, 49 deletions
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index e63466746b44..e11371f1f27b 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -534,28 +534,28 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem if ( rPersistentWindowState->hasByName( aName ) && (rPersistentWindowState->getByName( aName ) >>= aWindowState) ) { bool bValue( false ); - for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ ) + for ( PropertyValue const & rProp : std::as_const(aWindowState) ) { - if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_DOCKED ) + if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKED ) { - if ( aWindowState[n].Value >>= bValue ) + if ( rProp.Value >>= bValue ) rElementData.m_bFloating = !bValue; } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_VISIBLE ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_VISIBLE ) { - if ( aWindowState[n].Value >>= bValue ) + if ( rProp.Value >>= bValue ) rElementData.m_bVisible = bValue; } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_DOCKINGAREA ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA ) { ui::DockingArea eDockingArea; - if ( aWindowState[n].Value >>= eDockingArea ) + if ( rProp.Value >>= eDockingArea ) rElementData.m_aDockedData.m_nDockedArea = eDockingArea; } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_DOCKPOS ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS ) { awt::Point aPoint; - if (aWindowState[n].Value >>= aPoint) + if (rProp.Value >>= aPoint) { //tdf#90256 repair these broken Docking positions if (aPoint.X < 0) @@ -565,39 +565,39 @@ bool LayoutManager::readWindowStateData( const OUString& aName, UIElement& rElem rElementData.m_aDockedData.m_aPos = aPoint; } } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_POS ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_POS ) { awt::Point aPoint; - if ( aWindowState[n].Value >>= aPoint ) + if ( rProp.Value >>= aPoint ) rElementData.m_aFloatingData.m_aPos = aPoint; } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_SIZE ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_SIZE ) { awt::Size aSize; - if ( aWindowState[n].Value >>= aSize ) + if ( rProp.Value >>= aSize ) rElementData.m_aFloatingData.m_aSize = aSize; } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_UINAME ) - aWindowState[n].Value >>= rElementData.m_aUIName; - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_STYLE ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_UINAME ) + rProp.Value >>= rElementData.m_aUIName; + else if ( rProp.Name == WINDOWSTATE_PROPERTY_STYLE ) { sal_Int32 nStyle = 0; - if ( aWindowState[n].Value >>= nStyle ) + if ( rProp.Value >>= nStyle ) rElementData.m_nStyle = static_cast<ButtonType>( nStyle ); } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_LOCKED ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_LOCKED ) { - if ( aWindowState[n].Value >>= bValue ) + if ( rProp.Value >>= bValue ) rElementData.m_aDockedData.m_bLocked = bValue; } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_CONTEXT ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_CONTEXT ) { - if ( aWindowState[n].Value >>= bValue ) + if ( rProp.Value >>= bValue ) rElementData.m_bContextSensitive = bValue; } - else if ( aWindowState[n].Name == WINDOWSTATE_PROPERTY_NOCLOSE ) + else if ( rProp.Name == WINDOWSTATE_PROPERTY_NOCLOSE ) { - if ( aWindowState[n].Value >>= bValue ) + if ( rProp.Value >>= bValue ) rElementData.m_bNoClose = bValue; } } @@ -2519,11 +2519,11 @@ void LayoutManager::implts_createMSCompatibleMenuBar( const OUString& aName ) uno::Sequence< beans::PropertyValue > aProps; xMenuIndex->getByIndex( nIndex ) >>= aProps; OUString aCommand; - for (sal_Int32 nSeqInd = 0; nSeqInd < aProps.getLength(); ++nSeqInd) + for ( beans::PropertyValue const & rProp : std::as_const(aProps) ) { - if (aProps[nSeqInd].Name == "CommandURL") + if (rProp.Name == "CommandURL") { - aProps[nSeqInd].Value >>= aCommand; + rProp.Value >>= aCommand; break; } } diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index b5418af17d96..17d2be8ca2ab 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -1224,22 +1224,19 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars() try { - uno::Sequence< OUString > aToolbarNames = xPersistentWindowState->getElementNames(); + const uno::Sequence< OUString > aToolbarNames = xPersistentWindowState->getElementNames(); if ( aToolbarNames.hasElements() ) { OUString aElementType; OUString aElementName; - OUString aName; aMakeVisibleToolbars.reserve(aToolbarNames.getLength()); SolarMutexGuard g; - const OUString* pTbNames = aToolbarNames.getConstArray(); - for ( sal_Int32 i = 0; i < aToolbarNames.getLength(); i++ ) + for ( OUString const & aName : aToolbarNames ) { - aName = pTbNames[i]; parseResourceURL( aName, aElementType, aElementName ); // Check that we only create: @@ -1279,18 +1276,16 @@ void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars() void ToolbarLayoutManager::implts_createCustomToolBars( const uno::Sequence< uno::Sequence< beans::PropertyValue > >& aTbxSeqSeq ) { - const uno::Sequence< beans::PropertyValue >* pTbxSeq = aTbxSeqSeq.getConstArray(); - for ( sal_Int32 i = 0; i < aTbxSeqSeq.getLength(); i++ ) + for ( const uno::Sequence< beans::PropertyValue >& rTbxSeq : aTbxSeqSeq ) { - const uno::Sequence< beans::PropertyValue >& rTbxSeq = pTbxSeq[i]; OUString aTbxResName; OUString aTbxTitle; - for ( sal_Int32 j = 0; j < rTbxSeq.getLength(); j++ ) + for ( const beans::PropertyValue& rProp : rTbxSeq ) { - if ( rTbxSeq[j].Name == "ResourceURL" ) - rTbxSeq[j].Value >>= aTbxResName; - else if ( rTbxSeq[j].Name == "UIName" ) - rTbxSeq[j].Value >>= aTbxTitle; + if ( rProp.Name == "ResourceURL" ) + rProp.Value >>= aTbxResName; + else if ( rProp.Name == "UIName" ) + rProp.Value >>= aTbxTitle; } // Only create custom toolbars. Their name have to start with "custom_"! @@ -3138,10 +3133,10 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( try { - uno::Sequence< OUString > aWindowElements = xPersistentWindowState->getElementNames(); - for ( sal_Int32 i = 0; i < aWindowElements.getLength(); i++ ) + const uno::Sequence< OUString > aWindowElements = xPersistentWindowState->getElementNames(); + for ( OUString const & rWindowElementName : aWindowElements ) { - if ( rUIElement.m_aName != aWindowElements[i] ) + if ( rUIElement.m_aName != rWindowElementName ) { try { @@ -3149,13 +3144,13 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( awt::Point aDockedPos; ui::DockingArea nDockedArea( ui::DockingArea_DOCKINGAREA_DEFAULT ); - xPersistentWindowState->getByName( aWindowElements[i] ) >>= aPropValueSeq; - for ( sal_Int32 j = 0; j < aPropValueSeq.getLength(); j++ ) + xPersistentWindowState->getByName( rWindowElementName ) >>= aPropValueSeq; + for ( beans::PropertyValue const & rProp : std::as_const(aPropValueSeq) ) { - if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKINGAREA ) - aPropValueSeq[j].Value >>= nDockedArea; - else if ( aPropValueSeq[j].Name == WINDOWSTATE_PROPERTY_DOCKPOS ) - aPropValueSeq[j].Value >>= aDockedPos; + if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKINGAREA ) + rProp.Value >>= nDockedArea; + else if ( rProp.Name == WINDOWSTATE_PROPERTY_DOCKPOS ) + rProp.Value >>= aDockedPos; } // Don't change toolbars without a valid docking position! @@ -3171,7 +3166,7 @@ void ToolbarLayoutManager::implts_renumberRowColumnData( aDockedPos.X += 1; uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY ); - xReplace->replaceByName( aWindowElements[i], makeAny( aPropValueSeq )); + xReplace->replaceByName( rWindowElementName, makeAny( aPropValueSeq )); } } catch (const uno::Exception&) |