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 | |
parent | f94aae5cbab5b826ea8821e9ed3b456d65c03c70 (diff) |
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')
53 files changed, 429 insertions, 458 deletions
diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index f5fe3eecefdc..4724857b847f 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -210,11 +210,11 @@ void SAL_CALL CloseDispatcher::dispatchWithNotification(const css::util::URL& // <- SAFE ---------------------------------- bool bIsSynchron = false; - for (sal_Int32 nArgs=0; nArgs<lArguments.getLength(); nArgs++ ) + for (const css::beans::PropertyValue& rArg : lArguments ) { - if ( lArguments[nArgs].Name == "SynchronMode" ) + if ( rArg.Name == "SynchronMode" ) { - lArguments[nArgs].Value >>= bIsSynchron; + rArg.Value >>= bIsSynchron; break; } } diff --git a/framework/source/dispatch/dispatchdisabler.cxx b/framework/source/dispatch/dispatchdisabler.cxx index 76fe27d8cf4a..098942c4b5a8 100644 --- a/framework/source/dispatch/dispatchdisabler.cxx +++ b/framework/source/dispatch/dispatchdisabler.cxx @@ -28,8 +28,8 @@ void SAL_CALL DispatchDisabler::initialize( const uno::Sequence< uno::Any >& aAr if( aArguments.hasElements() && ( aArguments[0] >>= aDisabledURLs ) ) { - for( sal_Int32 i = 0; i < aDisabledURLs.getLength(); ++i ) - maDisabledURLs.insert(aDisabledURLs[i]); + for( OUString const & url : std::as_const(aDisabledURLs) ) + maDisabledURLs.insert(url); } } diff --git a/framework/source/fwe/classes/addonmenu.cxx b/framework/source/fwe/classes/addonmenu.cxx index 0ce25ceca88f..80ac7c0e0850 100644 --- a/framework/source/fwe/classes/addonmenu.cxx +++ b/framework/source/fwe/classes/addonmenu.cxx @@ -152,9 +152,9 @@ void AddonMenuManager::MergeAddonPopupMenus( const Reference< XFrame >& rFrame, OUString aModuleIdentifier = vcl::CommandInfoProvider::GetModuleIdentifier(rFrame); const Sequence< Sequence< PropertyValue > >& rAddonMenuEntries = aAddonsOptions.GetAddonsMenuBarPart(); - for ( sal_Int32 i = 0; i < rAddonMenuEntries.getLength(); i++ ) + for ( const Sequence< PropertyValue >& rEntry : rAddonMenuEntries ) { - AddonMenuManager::GetMenuEntry( rAddonMenuEntries[i], + AddonMenuManager::GetMenuEntry( rEntry, aTitle, aURL, aTarget, @@ -270,21 +270,21 @@ void AddonMenuManager::GetMenuEntry( const Sequence< PropertyValue >& rAddonMenu // Reset submenu parameter rAddonSubMenu = Sequence< Sequence< PropertyValue > >(); - for ( int i = 0; i < rAddonMenuEntry.getLength(); i++ ) + for ( const PropertyValue& rEntry : rAddonMenuEntry ) { - OUString aMenuEntryPropName = rAddonMenuEntry[i].Name; + OUString aMenuEntryPropName = rEntry.Name; if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_URL ) - rAddonMenuEntry[i].Value >>= rURL; + rEntry.Value >>= rURL; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_TITLE ) - rAddonMenuEntry[i].Value >>= rTitle; + rEntry.Value >>= rTitle; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_TARGET ) - rAddonMenuEntry[i].Value >>= rTarget; + rEntry.Value >>= rTarget; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_IMAGEIDENTIFIER ) - rAddonMenuEntry[i].Value >>= rImageId; + rEntry.Value >>= rImageId; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_SUBMENU ) - rAddonMenuEntry[i].Value >>= rAddonSubMenu; + rEntry.Value >>= rAddonSubMenu; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_CONTEXT ) - rAddonMenuEntry[i].Value >>= rContext; + rEntry.Value >>= rContext; } } diff --git a/framework/source/fwe/classes/addonsoptions.cxx b/framework/source/fwe/classes/addonsoptions.cxx index efba924622ab..725bec2f5405 100644 --- a/framework/source/fwe/classes/addonsoptions.cxx +++ b/framework/source/fwe/classes/addonsoptions.cxx @@ -997,8 +997,8 @@ void AddonsOptions_Impl::ReadMergeMenuData( const OUString& aMergeAddonInstructi aMergeMenuBaseNode += m_aPathDelimiter; // extend the node names to have full path strings - for ( sal_Int32 i = 0; i < aSubMenuNodeNames.getLength(); i++ ) - aSubMenuNodeNames[i] = aMergeMenuBaseNode + aSubMenuNodeNames[i]; + for ( OUString& rName : aSubMenuNodeNames ) + rName = aMergeMenuBaseNode + rName; ReadSubMenuEntries( aSubMenuNodeNames, rMergeMenu ); } @@ -1324,8 +1324,8 @@ bool AddonsOptions_Impl::ReadMenuItem( const OUString& aMenuNodeName, Sequence< // Continue to read the sub menu nodes Sequence< Sequence< PropertyValue > > aSubMenuSeq; OUString aSubMenuRootNodeName( aRootSubMenuName + m_aPathDelimiter ); - for ( sal_Int32 n = 0; n < aRootSubMenuNodeNames.getLength(); n++ ) - aRootSubMenuNodeNames[n] = aSubMenuRootNodeName + aRootSubMenuNodeNames[n]; + for ( OUString& rName : aRootSubMenuNodeNames ) + rName = aSubMenuRootNodeName + rName; ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq ); aMenuItem[ OFFSET_MENUITEM_SUBMENU ].Value <<= aSubMenuSeq; bResult = true; @@ -1388,8 +1388,8 @@ bool AddonsOptions_Impl::ReadPopupMenu( const OUString& aPopupMenuNodeName, Sequ // Continue to read the sub menu nodes Sequence< Sequence< PropertyValue > > aSubMenuSeq; OUString aSubMenuRootNodeName( aRootSubMenuName + m_aPathDelimiter ); - for ( sal_Int32 n = 0; n < aRootSubMenuNodeNames.getLength(); n++ ) - aRootSubMenuNodeNames[n] = aSubMenuRootNodeName + aRootSubMenuNodeNames[n]; + for ( OUString& rName : aRootSubMenuNodeNames ) + rName = aSubMenuRootNodeName + rName; ReadSubMenuEntries( aRootSubMenuNodeNames, aSubMenuSeq ); aPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aSubMenuSeq; bResult = true; @@ -1409,8 +1409,8 @@ void AddonsOptions_Impl::AppendPopupMenu( Sequence< PropertyValue >& rTargetPopu { sal_uInt32 nIndex = aTargetSubMenuSeq.getLength(); aTargetSubMenuSeq.realloc( nIndex + aSourceSubMenuSeq.getLength() ); - for ( sal_Int32 i = 0; i < aSourceSubMenuSeq.getLength(); i++ ) - aTargetSubMenuSeq[nIndex++] = aSourceSubMenuSeq[i]; + for ( Sequence<PropertyValue> const & rSeq : std::as_const(aSourceSubMenuSeq) ) + aTargetSubMenuSeq[nIndex++] = rSeq; rTargetPopupMenu[ OFFSET_POPUPMENU_SUBMENU ].Value <<= aTargetSubMenuSeq; } } diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index a9bc60525af1..84de0f40bd39 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -118,32 +118,32 @@ static void ExtractMenuParameters( const Sequence< PropertyValue >& rProp, sal_Int16& rType, sal_Int16& rStyle ) { - for ( sal_Int32 i = 0; i < rProp.getLength(); i++ ) + for ( const PropertyValue& p : rProp ) { - if ( rProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) + if ( p.Name == ITEM_DESCRIPTOR_COMMANDURL ) { - rProp[i].Value >>= rCommandURL; + p.Value >>= rCommandURL; rCommandURL = rCommandURL.intern(); } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_HELPURL ) + else if ( p.Name == ITEM_DESCRIPTOR_HELPURL ) { - rProp[i].Value >>= rHelpURL; + p.Value >>= rHelpURL; } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_CONTAINER ) + else if ( p.Name == ITEM_DESCRIPTOR_CONTAINER ) { - rProp[i].Value >>= rSubMenu; + p.Value >>= rSubMenu; } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_LABEL ) + else if ( p.Name == ITEM_DESCRIPTOR_LABEL ) { - rProp[i].Value >>= rLabel; + p.Value >>= rLabel; } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_TYPE ) + else if ( p.Name == ITEM_DESCRIPTOR_TYPE ) { - rProp[i].Value >>= rType; + p.Value >>= rType; } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_STYLE ) + else if ( p.Name == ITEM_DESCRIPTOR_STYLE ) { - rProp[i].Value >>= rStyle; + p.Value >>= rStyle; } } } diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index e9e6d0038ea1..b0e836600fdc 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -100,28 +100,28 @@ static void ExtractStatusbarItemParameters( sal_Int16& rStyle, sal_Int16& rWidth ) { - for ( sal_Int32 i = 0; i < rProp.getLength(); i++ ) + for ( const PropertyValue& rEntry : rProp ) { - if ( rProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) + if ( rEntry.Name == ITEM_DESCRIPTOR_COMMANDURL ) { - rProp[i].Value >>= rCommandURL; + rEntry.Value >>= rCommandURL; rCommandURL = rCommandURL.intern(); } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_HELPURL ) + else if ( rEntry.Name == ITEM_DESCRIPTOR_HELPURL ) { - rProp[i].Value >>= rHelpURL; + rEntry.Value >>= rHelpURL; } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_OFFSET ) + else if ( rEntry.Name == ITEM_DESCRIPTOR_OFFSET ) { - rProp[i].Value >>= rOffset; + rEntry.Value >>= rOffset; } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_STYLE ) + else if ( rEntry.Name == ITEM_DESCRIPTOR_STYLE ) { - rProp[i].Value >>= rStyle; + rEntry.Value >>= rStyle; } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_WIDTH ) + else if ( rEntry.Name == ITEM_DESCRIPTOR_WIDTH ) { - rProp[i].Value >>= rWidth; + rEntry.Value >>= rWidth; } } } diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 1027d18af4b8..ea5facd7247d 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -63,21 +63,21 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp, bool& rVisible, sal_Int16& rType ) { - for ( sal_Int32 i = 0; i < rProp.getLength(); i++ ) + for ( const PropertyValue& rEntry : rProp ) { - if ( rProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) + if ( rEntry.Name == ITEM_DESCRIPTOR_COMMANDURL ) { - rProp[i].Value >>= rCommandURL; + rEntry.Value >>= rCommandURL; rCommandURL = rCommandURL.intern(); } - else if ( rProp[i].Name == ITEM_DESCRIPTOR_LABEL ) - rProp[i].Value >>= rLabel; - else if ( rProp[i].Name == ITEM_DESCRIPTOR_TYPE ) - rProp[i].Value >>= rType; - else if ( rProp[i].Name == ITEM_DESCRIPTOR_VISIBLE ) - rProp[i].Value >>= rVisible; - else if ( rProp[i].Name == ITEM_DESCRIPTOR_STYLE ) - rProp[i].Value >>= rStyle; + else if ( rEntry.Name == ITEM_DESCRIPTOR_LABEL ) + rEntry.Value >>= rLabel; + else if ( rEntry.Name == ITEM_DESCRIPTOR_TYPE ) + rEntry.Value >>= rType; + else if ( rEntry.Name == ITEM_DESCRIPTOR_VISIBLE ) + rEntry.Value >>= rVisible; + else if ( rEntry.Name == ITEM_DESCRIPTOR_STYLE ) + rEntry.Value >>= rStyle; } } diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx index 75e560e7a975..b53cd0f2672d 100644 --- a/framework/source/fwi/helper/mischelper.cxx +++ b/framework/source/fwi/helper/mischelper.cxx @@ -122,17 +122,13 @@ void FillLangItems( std::set< OUString > &rLangItems, if ( !xDocumentLanguages.is() ) return; - Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount )); - if ( rLocales.hasElements() ) + const Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount )); + for ( const Locale& rLocale : rLocales ) { - for ( sal_Int32 i = 0; i < rLocales.getLength(); ++i ) - { - if ( rLangItems.size() == static_cast< size_t >(nMaxCount) ) - break; - const Locale& rLocale=rLocales[i]; - if( IsScriptTypeMatchingToLanguage( nScriptType, SvtLanguageTable::GetLanguageType( rLocale.Language ))) - rLangItems.insert( rLocale.Language ); - } + if ( rLangItems.size() == static_cast< size_t >(nMaxCount) ) + break; + if( IsScriptTypeMatchingToLanguage( nScriptType, SvtLanguageTable::GetLanguageType( rLocale.Language ))) + rLangItems.insert( rLocale.Language ); } } diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx index 0ba8470628c3..b0138d04a77c 100644 --- a/framework/source/helper/uiconfigelementwrapperbase.cxx +++ b/framework/source/helper/uiconfigelementwrapperbase.cxx @@ -114,10 +114,10 @@ void SAL_CALL UIConfigElementWrapperBase::initialize( const Sequence< Any >& aAr if ( m_bInitialized ) return; - for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) + for ( const Any& rArg : aArguments ) { PropertyValue aPropValue; - if ( aArguments[n] >>= aPropValue ) + if ( rArg >>= aPropValue ) { if ( aPropValue.Name == UIELEMENT_PROPNAME_CONFIGSOURCE ) setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGSOURCE, aPropValue.Value ); diff --git a/framework/source/helper/uielementwrapperbase.cxx b/framework/source/helper/uielementwrapperbase.cxx index d02e8954c2cf..76cf234ff94f 100644 --- a/framework/source/helper/uielementwrapperbase.cxx +++ b/framework/source/helper/uielementwrapperbase.cxx @@ -86,10 +86,10 @@ void SAL_CALL UIElementWrapperBase::initialize( const Sequence< Any >& aArgument if ( m_bInitialized ) return; - for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) + for ( const Any& rArg : aArguments ) { PropertyValue aPropValue; - if ( aArguments[n] >>= aPropValue ) + if ( rArg >>= aPropValue ) { if ( aPropValue.Name == "ResourceURL" ) aPropValue.Value >>= m_aResourceURL; 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&) diff --git a/framework/source/services/modulemanager.cxx b/framework/source/services/modulemanager.cxx index 96d400bb5ecc..5c066d034d74 100644 --- a/framework/source/services/modulemanager.cxx +++ b/framework/source/services/modulemanager.cxx @@ -256,9 +256,8 @@ css::uno::Any SAL_CALL ModuleManager::getByName(const OUString& sName) comphelper::SequenceAsHashMap lProps; lProps[OUString("ooSetupFactoryModuleIdentifier")] <<= sName; - for (sal_Int32 i = 0; i < lPropNames.getLength(); ++i) + for (const OUString& sPropName : lPropNames) { - const OUString& sPropName = lPropNames[i]; lProps[sPropName] = xModule->getByName(sPropName); } @@ -296,11 +295,11 @@ css::uno::Reference< css::container::XEnumeration > SAL_CALL ModuleManager::crea const css::uno::Sequence< OUString > lModules = getElementNames(); ::std::vector< css::uno::Any > lResult; - for (sal_Int32 i = 0; i < lModules.getLength(); ++i) + for (const OUString& rModuleName : lModules) { try { - ::comphelper::SequenceAsHashMap lModuleProps = getByName(lModules[i]); + ::comphelper::SequenceAsHashMap lModuleProps = getByName(rModuleName); if (lModuleProps.match(lSearchProps)) lResult.push_back(css::uno::makeAny(lModuleProps.getAsConstPropertyValueList())); } @@ -331,10 +330,10 @@ OUString ModuleManager::implts_identify(const css::uno::Reference< css::uno::XIn return OUString(); const css::uno::Sequence< OUString > lKnownModules = getElementNames(); - for (sal_Int32 i = 0; i < lKnownModules.getLength(); ++i) + for (const OUString& rName : lKnownModules) { - if (xInfo->supportsService(lKnownModules[i])) - return lKnownModules[i]; + if (xInfo->supportsService(rName)) + return rName; } return OUString(); diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx index 0bf1665ae2ed..b0c7e70eb725 100644 --- a/framework/source/services/sessionlistener.cxx +++ b/framework/source/services/sessionlistener.cxx @@ -233,9 +233,9 @@ void SAL_CALL SessionListener::initialize(const Sequence< Any >& args) else if (args.hasElements()) { NamedValue v; - for (int i = 0; i < args.getLength(); i++) + for (const Any& rArg : args) { - if (args[i] >>= v) + if (rArg >>= v) { if ( v.Name == "SessionManagerName" ) v.Value >>= aSMgr; diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 67c38860164b..be00e8bd5a6b 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -562,10 +562,10 @@ void ImageManagerImpl::initialize( const Sequence< Any >& aArguments ) if ( m_bInitialized ) return; - for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) + for ( const Any& rArg : aArguments ) { PropertyValue aPropValue; - if ( aArguments[n] >>= aPropValue ) + if ( rArg >>= aPropValue ) { if ( aPropValue.Name == "UserConfigStorage" ) { @@ -716,8 +716,6 @@ Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages( Sequence< uno::Reference< XGraphic > > aGraphSeq( aCommandURLSequence.getLength() ); - const OUString* aStrArray = aCommandURLSequence.getConstArray(); - vcl::ImageType nIndex = implts_convertImageTypeToIndex( nImageType ); rtl::Reference< GlobalImageList > rGlobalImageList; CmdImageList* pDefaultImageList = nullptr; @@ -732,17 +730,18 @@ Sequence< uno::Reference< XGraphic > > ImageManagerImpl::getImages( // 1. user image list (read/write) // 2. module image list (read) // 3. global image list (read) - for ( sal_Int32 n = 0; n < aCommandURLSequence.getLength(); n++ ) + sal_Int32 n = 0; + for ( const OUString& rURL : aCommandURLSequence ) { - Image aImage = pUserImageList->GetImage( aStrArray[n] ); + Image aImage = pUserImageList->GetImage( rURL ); if ( !aImage && m_bUseGlobal ) { - aImage = pDefaultImageList->getImageFromCommandURL( nIndex, aStrArray[n] ); + aImage = pDefaultImageList->getImageFromCommandURL( nIndex, rURL ); if ( !aImage ) - aImage = rGlobalImageList->getImageFromCommandURL( nIndex, aStrArray[n] ); + aImage = rGlobalImageList->getImageFromCommandURL( nIndex, rURL ); } - aGraphSeq[n] = GetXGraphic(aImage); + aGraphSeq[n++] = GetXGraphic(aImage); } return aGraphSeq; @@ -860,9 +859,9 @@ void ImageManagerImpl::removeImages( ::sal_Int16 nImageType, const Sequence< OUS ImageList* pImageList = implts_getUserImageList(nIndex); uno::Reference<XGraphic> xEmptyGraphic; - for ( sal_Int32 i = 0; i < aCommandURLSequence.getLength(); i++ ) + for ( const OUString& rURL : aCommandURLSequence ) { - sal_uInt16 nPos = pImageList->GetImagePos( aCommandURLSequence[i] ); + sal_uInt16 nPos = pImageList->GetImagePos( rURL ); if ( nPos != IMAGELIST_IMAGE_NOTFOUND ) { sal_uInt16 nId = pImageList->GetImageId( nPos ); @@ -872,27 +871,27 @@ void ImageManagerImpl::removeImages( ::sal_Int16 nImageType, const Sequence< OUS { // Check, if we have an image in our module/global image list. If we find one => // this is a replace instead of a remove operation! - Image aNewImage = pDefaultImageList->getImageFromCommandURL( nIndex, aCommandURLSequence[i] ); + Image aNewImage = pDefaultImageList->getImageFromCommandURL( nIndex, rURL ); if ( !aNewImage ) - aNewImage = rGlobalImageList->getImageFromCommandURL( nIndex, aCommandURLSequence[i] ); + aNewImage = rGlobalImageList->getImageFromCommandURL( nIndex, rURL ); if ( !aNewImage ) { if ( !pRemovedImages ) pRemovedImages = new GraphicNameAccess(); - pRemovedImages->addElement( aCommandURLSequence[i], xEmptyGraphic ); + pRemovedImages->addElement( rURL, xEmptyGraphic ); } else { if ( !pReplacedImages ) pReplacedImages = new GraphicNameAccess(); - pReplacedImages->addElement(aCommandURLSequence[i], GetXGraphic(aNewImage)); + pReplacedImages->addElement(rURL, GetXGraphic(aNewImage)); } } // if ( m_bUseGlobal ) else { if ( !pRemovedImages ) pRemovedImages = new GraphicNameAccess(); - pRemovedImages->addElement( aCommandURLSequence[i], xEmptyGraphic ); + pRemovedImages->addElement( rURL, xEmptyGraphic ); } } } diff --git a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx index 5f29f804d8ec..31d61d8d0ad5 100644 --- a/framework/source/uiconfiguration/moduleuicfgsupplier.cxx +++ b/framework/source/uiconfiguration/moduleuicfgsupplier.cxx @@ -101,9 +101,8 @@ ModuleUIConfigurationManagerSupplier::ModuleUIConfigurationManagerSupplier( cons // Retrieve known modules and insert them into our unordered_map to speed-up access time. Reference< XNameAccess > xNameAccess( m_xModuleMgr, UNO_QUERY_THROW ); const Sequence< OUString > aNameSeq = xNameAccess->getElementNames(); - const OUString* pNameSeq = aNameSeq.getConstArray(); - for ( sal_Int32 n = 0; n < aNameSeq.getLength(); n++ ) - m_aModuleToModuleUICfgMgrMap.emplace( pNameSeq[n], Reference< XModuleUIConfigurationManager2 >() ); + for ( const OUString& rName : aNameSeq ) + m_aModuleToModuleUICfgMgrMap.emplace( rName, Reference< XModuleUIConfigurationManager2 >() ); } catch(...) { @@ -149,11 +148,11 @@ Reference< XUIConfigurationManager > SAL_CALL ModuleUIConfigurationManagerSuppli { Sequence< PropertyValue > lProps; m_xModuleMgr->getByName(sModuleIdentifier) >>= lProps; - for (sal_Int32 i=0; i<lProps.getLength(); ++i) + for (PropertyValue const & rProp : std::as_const(lProps)) { - if ( lProps[i].Name == "ooSetupFactoryShortName" ) + if ( rProp.Name == "ooSetupFactoryShortName" ) { - lProps[i].Value >>= sShort; + rProp.Value >>= sShort; break; } } diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 1b9926d7f7eb..793d8ed18f4c 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -361,23 +361,23 @@ void ModuleUIConfigurationManager::impl_preloadUIElementTypeList( Layer eLayer, "/"; UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap; - Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames(); - for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ ) + const Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames(); + for ( OUString const & rElementName : aUIElementNames ) { UIElementData aUIElementData; // Resource name must be without ".xml" - sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' ); - if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() )) + sal_Int32 nIndex = rElementName.lastIndexOf( '.' ); + if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() )) { - OUString aExtension( aUIElementNames[n].copy( nIndex+1 )); - OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex )); + OUString aExtension( rElementName.copy( nIndex+1 )); + OUString aUIElementName( rElementName.copy( 0, nIndex )); if (!aUIElementName.isEmpty() && ( aExtension.equalsIgnoreAsciiCase("xml"))) { aUIElementData.aResourceURL = aResURLPrefix + aUIElementName; - aUIElementData.aName = aUIElementNames[n]; + aUIElementData.aName = rElementName; if ( eLayer == LAYER_USERDEFINED ) { @@ -982,10 +982,10 @@ void SAL_CALL ModuleUIConfigurationManager::reset() if ( rElementType.xStorage.is() ) { bool bCommitSubStorage( false ); - Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames(); - for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ ) + const Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames(); + for ( OUString const & rName : aUIElementStreamNames ) { - rElementType.xStorage->removeElement( aUIElementStreamNames[j] ); + rElementType.xStorage->removeElement( rName ); bCommitSubStorage = true; } diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx index 2c27f0403914..517a8d47f5b4 100644 --- a/framework/source/uiconfiguration/uicategorydescription.cxx +++ b/framework/source/uiconfiguration/uicategorydescription.cxx @@ -164,20 +164,19 @@ void ConfigurationAccess_UICategory::fillCache() if ( m_bCacheFilled ) return; - sal_Int32 i( 0 ); OUString aUIName; - Sequence< OUString > aNameSeq = m_xConfigAccess->getElementNames(); + const Sequence< OUString > aNameSeq = m_xConfigAccess->getElementNames(); - for ( i = 0; i < aNameSeq.getLength(); i++ ) + for ( OUString const & rName : aNameSeq ) { try { - Reference< XNameAccess > xNameAccess(m_xConfigAccess->getByName( aNameSeq[i] ),UNO_QUERY); + Reference< XNameAccess > xNameAccess(m_xConfigAccess->getByName( rName ),UNO_QUERY); if ( xNameAccess.is() ) { xNameAccess->getByName( m_aPropUIName ) >>= aUIName; - m_aIdCache.emplace( aNameSeq[i], aUIName ); + m_aIdCache.emplace( rName, aUIName ); } } catch ( const css::lang::WrappedTargetException& ) diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 5ec6a167131e..be337b580987 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -287,23 +287,23 @@ void UIConfigurationManager::impl_preloadUIElementTypeList( sal_Int16 nElementTy "/"; UIElementDataHashMap& rHashMap = rElementTypeData.aElementsHashMap; - Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames(); - for ( sal_Int32 n = 0; n < aUIElementNames.getLength(); n++ ) + const Sequence< OUString > aUIElementNames = xElementTypeStorage->getElementNames(); + for ( OUString const & rElementName : aUIElementNames ) { UIElementData aUIElementData; // Resource name must be without ".xml" - sal_Int32 nIndex = aUIElementNames[n].lastIndexOf( '.' ); - if (( nIndex > 0 ) && ( nIndex < aUIElementNames[n].getLength() )) + sal_Int32 nIndex = rElementName.lastIndexOf( '.' ); + if (( nIndex > 0 ) && ( nIndex < rElementName.getLength() )) { - OUString aExtension( aUIElementNames[n].copy( nIndex+1 )); - OUString aUIElementName( aUIElementNames[n].copy( 0, nIndex )); + OUString aExtension( rElementName.copy( nIndex+1 )); + OUString aUIElementName( rElementName.copy( 0, nIndex )); if (!aUIElementName.isEmpty() && ( aExtension.equalsIgnoreAsciiCase("xml"))) { aUIElementData.aResourceURL = aResURLPrefix + aUIElementName; - aUIElementData.aName = aUIElementNames[n]; + aUIElementData.aName = rElementName; aUIElementData.bModified = false; aUIElementData.bDefault = false; @@ -769,10 +769,10 @@ void SAL_CALL UIConfigurationManager::reset() if ( rElementType.xStorage.is() ) { bool bCommitSubStorage( false ); - Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames(); - for ( sal_Int32 j = 0; j < aUIElementStreamNames.getLength(); j++ ) + const Sequence< OUString > aUIElementStreamNames = rElementType.xStorage->getElementNames(); + for ( OUString const & rStreamName : aUIElementStreamNames ) { - rElementType.xStorage->removeElement( aUIElementStreamNames[j] ); + rElementType.xStorage->removeElement( rStreamName ); bCommitSubStorage = true; bCommit = true; } diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx index 536f4b2d048f..f44b5cf1305b 100644 --- a/framework/source/uiconfiguration/windowstateconfiguration.cxx +++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx @@ -1289,19 +1289,17 @@ WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentC { } Sequence< PropertyValue > aSeq; - OUString aModuleIdentifier; - for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) + for ( OUString const & aModuleIdentifier : std::as_const(aElementNames) ) { - aModuleIdentifier = aElementNames[i]; if ( xModuleManager->getByName( aModuleIdentifier ) >>= aSeq ) { OUString aWindowStateFileStr; - for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) + for ( PropertyValue const & rProp : std::as_const(aSeq) ) { - if ( aSeq[y].Name == "ooSetupFactoryWindowStateConfigRef" ) + if ( rProp.Name == "ooSetupFactoryWindowStateConfigRef" ) { - aSeq[y].Value >>= aWindowStateFileStr; + rProp.Value >>= aWindowStateFileStr; break; } } diff --git a/framework/source/uielement/FixedTextToolbarController.cxx b/framework/source/uielement/FixedTextToolbarController.cxx index 374ad33798aa..531c0f8b64a5 100644 --- a/framework/source/uielement/FixedTextToolbarController.cxx +++ b/framework/source/uielement/FixedTextToolbarController.cxx @@ -73,12 +73,12 @@ void FixedTextToolbarController::executeControlCommand( if (rControlCommand.Command != "SetText") return; - for (sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++) + for (const NamedValue& rArg : rControlCommand.Arguments) { - if (rControlCommand.Arguments[i].Name == "Text") + if (rArg.Name == "Text") { OUString aText; - rControlCommand.Arguments[i].Value >>= aText; + rArg.Value >>= aText; m_pFixedTextControl->SetText(aText); m_pFixedTextControl->SetSizePixel(m_pFixedTextControl->GetOptimalSize()); diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 3fc54f1ad00c..e2d61259943f 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -200,7 +200,7 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue sal_uInt32 nElements( 0 ); bool bAppendSeparator( false ); Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar ); - for ( sal_uInt32 n = 0; n < o3tl::make_unsigned(rAddonToolbar.getLength()); n++ ) + for ( const Sequence< PropertyValue >& rSeq : rAddonToolbar ) { OUString aURL; OUString aTitle; @@ -210,8 +210,6 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue OUString aControlType; sal_uInt16 nWidth( 0 ); - const Sequence< PropertyValue >& rSeq = rAddonToolbar[n]; - ToolBarMerger::ConvertSequenceToValues( rSeq, aURL, aTitle, aImageId, aTarget, aContext, aControlType, nWidth ); if ( IsCorrectContext( aModuleIdentifier, aContext )) diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx index 025b57904ff1..5d08fb5c7224 100644 --- a/framework/source/uielement/addonstoolbarwrapper.cxx +++ b/framework/source/uielement/addonstoolbarwrapper.cxx @@ -81,10 +81,10 @@ void SAL_CALL AddonsToolBarWrapper::initialize( const Sequence< Any >& aArgument UIElementWrapperBase::initialize( aArguments ); - for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) + for ( const Any& rArg : aArguments ) { PropertyValue aPropValue; - if ( aArguments[n] >>= aPropValue ) + if ( rArg >>= aPropValue ) { if ( aPropValue.Name == "ConfigurationData" ) aPropValue.Value >>= m_aConfigData; diff --git a/framework/source/uielement/buttontoolbarcontroller.cxx b/framework/source/uielement/buttontoolbarcontroller.cxx index c13d645f57f0..6c5c3fdeb88c 100644 --- a/framework/source/uielement/buttontoolbarcontroller.cxx +++ b/framework/source/uielement/buttontoolbarcontroller.cxx @@ -107,9 +107,9 @@ void SAL_CALL ButtonToolbarController::initialize( m_bInitialized = true; PropertyValue aPropValue; - for ( int i = 0; i < aArguments.getLength(); i++ ) + for ( const css::uno::Any& rArg : aArguments ) { - if ( aArguments[i] >>= aPropValue ) + if ( rArg >>= aPropValue ) { if ( aPropValue.Name == "Frame" ) m_xFrame.set(aPropValue.Value,UNO_QUERY); diff --git a/framework/source/uielement/comboboxtoolbarcontroller.cxx b/framework/source/uielement/comboboxtoolbarcontroller.cxx index 352fe7bd0833..1fc8d1e89c5e 100644 --- a/framework/source/uielement/comboboxtoolbarcontroller.cxx +++ b/framework/source/uielement/comboboxtoolbarcontroller.cxx @@ -215,12 +215,12 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control { if ( rControlCommand.Command == "SetText" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Text" ) + if ( rArg.Name == "Text" ) { OUString aText; - rControlCommand.Arguments[i].Value >>= aText; + rArg.Value >>= aText; m_pComboBox->set_active_or_entry_text(aText); // send notification @@ -231,16 +231,16 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control } else if ( rControlCommand.Command == "SetList" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "List" ) + if ( rArg.Name == "List" ) { Sequence< OUString > aList; m_pComboBox->clear(); - rControlCommand.Arguments[i].Value >>= aList; - for (sal_Int32 j = 0; j < aList.getLength(); ++j) - m_pComboBox->append_text(aList[j]); + rArg.Value >>= aList; + for (OUString const & rName : std::as_const(aList)) + m_pComboBox->append_text(rName); // send notification uno::Sequence< beans::NamedValue > aInfo { { "List", css::uno::makeAny(aList) } }; @@ -255,11 +255,11 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control else if ( rControlCommand.Command == "AddEntry" ) { OUString aText; - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Text" ) + if ( rArg.Name == "Text" ) { - if ( rControlCommand.Arguments[i].Value >>= aText ) + if ( rArg.Value >>= aText ) m_pComboBox->append_text(aText); break; } @@ -269,32 +269,32 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control { sal_Int32 nPos(-1); OUString aText; - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Pos" ) + if ( rArg.Name == "Pos" ) { sal_Int32 nTmpPos = 0; - if ( rControlCommand.Arguments[i].Value >>= nTmpPos ) + if ( rArg.Value >>= nTmpPos ) { if (( nTmpPos >= 0 ) && ( nTmpPos < m_pComboBox->get_count() )) nPos = nTmpPos; } } - else if ( rControlCommand.Arguments[i].Name == "Text" ) - rControlCommand.Arguments[i].Value >>= aText; + else if ( rArg.Name == "Text" ) + rArg.Value >>= aText; } m_pComboBox->insert_text(nPos, aText); } else if ( rControlCommand.Command == "RemoveEntryPos" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Pos" ) + if ( rArg.Name == "Pos" ) { sal_Int32 nPos( -1 ); - if ( rControlCommand.Arguments[i].Value >>= nPos ) + if ( rArg.Value >>= nPos ) { if (0 <= nPos && nPos < m_pComboBox->get_count()) m_pComboBox->remove(nPos); @@ -305,12 +305,12 @@ void ComboboxToolbarController::executeControlCommand( const css::frame::Control } else if ( rControlCommand.Command == "RemoveEntryText" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Text") + if ( rArg.Name == "Text") { OUString aText; - if ( rControlCommand.Arguments[i].Value >>= aText ) + if ( rArg.Value >>= aText ) { auto nPos = m_pComboBox->find_text(aText); if (nPos != -1) diff --git a/framework/source/uielement/complextoolbarcontroller.cxx b/framework/source/uielement/complextoolbarcontroller.cxx index 9b985a039e78..06da77962f4a 100644 --- a/framework/source/uielement/complextoolbarcontroller.cxx +++ b/framework/source/uielement/complextoolbarcontroller.cxx @@ -178,12 +178,12 @@ void ComplexToolbarController::statusChanged( const FeatureStateEvent& Event ) { if (aControlCommand.Command == "SetQuickHelpText") { - for (sal_Int32 i = 0; i < aControlCommand.Arguments.getLength(); i++) + for (NamedValue const & rArg : std::as_const(aControlCommand.Arguments)) { - if (aControlCommand.Arguments[i].Name == "HelpText") + if (rArg.Name == "HelpText") { OUString aHelpText; - aControlCommand.Arguments[i].Value >>= aHelpText; + rArg.Value >>= aHelpText; m_xToolbar->SetQuickHelpText(m_nID, aHelpText); break; } diff --git a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx index 84865f0a0f80..56acf0a018c9 100644 --- a/framework/source/uielement/dropdownboxtoolbarcontroller.cxx +++ b/framework/source/uielement/dropdownboxtoolbarcontroller.cxx @@ -177,16 +177,16 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control { if ( rControlCommand.Command == "SetList" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "List" ) + if ( rArg.Name == "List" ) { Sequence< OUString > aList; m_pListBoxControl->clear(); - rControlCommand.Arguments[i].Value >>= aList; - for (sal_Int32 j = 0; j < aList.getLength(); ++j) - m_pListBoxControl->append_text(aList[j]); + rArg.Value >>= aList; + for (OUString const & rName : std::as_const(aList)) + m_pListBoxControl->append_text(rName); m_pListBoxControl->set_active(0); @@ -203,11 +203,11 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control else if ( rControlCommand.Command == "AddEntry" ) { OUString aText; - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Text" ) + if ( rArg.Name == "Text" ) { - if ( rControlCommand.Arguments[i].Value >>= aText ) + if ( rArg.Value >>= aText ) m_pListBoxControl->append_text(aText); break; } @@ -217,32 +217,32 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control { sal_Int32 nPos(-1); OUString aText; - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Pos" ) + if ( rArg.Name == "Pos" ) { sal_Int32 nTmpPos = 0; - if ( rControlCommand.Arguments[i].Value >>= nTmpPos ) + if ( rArg.Value >>= nTmpPos ) { if (( nTmpPos >= 0 ) && ( nTmpPos < m_pListBoxControl->get_count() )) nPos = nTmpPos; } } - else if ( rControlCommand.Arguments[i].Name == "Text" ) - rControlCommand.Arguments[i].Value >>= aText; + else if ( rArg.Name == "Text" ) + rArg.Value >>= aText; } m_pListBoxControl->insert_text(nPos, aText); } else if ( rControlCommand.Command == "RemoveEntryPos" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Pos" ) + if ( rArg.Name == "Pos" ) { sal_Int32 nPos( -1 ); - if ( rControlCommand.Arguments[i].Value >>= nPos ) + if ( rArg.Value >>= nPos ) { if ( 0 <= nPos && nPos < m_pListBoxControl->get_count() ) m_pListBoxControl->remove(nPos); @@ -253,12 +253,12 @@ void DropdownToolbarController::executeControlCommand( const css::frame::Control } else if ( rControlCommand.Command == "RemoveEntryText" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Text" ) + if ( rArg.Name == "Text" ) { OUString aText; - if ( rControlCommand.Arguments[i].Value >>= aText ) + if ( rArg.Value >>= aText ) { auto nPos = m_pListBoxControl->find_text(aText); if (nPos != -1) diff --git a/framework/source/uielement/edittoolbarcontroller.cxx b/framework/source/uielement/edittoolbarcontroller.cxx index 6bdcd18c3cc4..1d863c596b3f 100644 --- a/framework/source/uielement/edittoolbarcontroller.cxx +++ b/framework/source/uielement/edittoolbarcontroller.cxx @@ -185,12 +185,12 @@ void EditToolbarController::executeControlCommand( const css::frame::ControlComm if ( !rControlCommand.Command.startsWith( "SetText" )) return; - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name.startsWith( "Text" )) + if ( rArg.Name.startsWith( "Text" )) { OUString aText; - rControlCommand.Arguments[i].Value >>= aText; + rArg.Value >>= aText; m_pEditControl->set_text(aText); // send notification diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index ed7bb926c3ad..70c0043aede5 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -75,7 +75,6 @@ FontMenuController::~FontMenuController() // private function void FontMenuController::fillPopupMenu( const Sequence< OUString >& rFontNameSeq, Reference< css::awt::XPopupMenu > const & rPopupMenu ) { - const OUString* pFontNameArray = rFontNameSeq.getConstArray(); VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( rPopupMenu )); PopupMenu* pVCLPopupMenu = nullptr; @@ -90,9 +89,9 @@ void FontMenuController::fillPopupMenu( const Sequence< OUString >& rFontNameSeq vector<OUString> aVector; aVector.reserve(rFontNameSeq.getLength()); - for ( sal_Int32 i = 0; i < rFontNameSeq.getLength(); i++ ) + for ( OUString const & s : rFontNameSeq ) { - aVector.push_back(MnemonicGenerator::EraseAllMnemonicChars(pFontNameArray[i])); + aVector.push_back(MnemonicGenerator::EraseAllMnemonicChars(s)); } sort(aVector.begin(), aVector.end(), lcl_I18nCompareString ); diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index 5fa645d68a1a..79259c2e5e98 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -78,12 +78,12 @@ OUString FontSizeMenuController::retrievePrinterName( css::uno::Reference< css:: Reference< XPrintable > xPrintable( xController->getModel(), UNO_QUERY ); if ( xPrintable.is() ) { - Sequence< PropertyValue > aPrinterSeq = xPrintable->getPrinter(); - for ( int i = 0; i < aPrinterSeq.getLength(); i++ ) + const Sequence< PropertyValue > aPrinterSeq = xPrintable->getPrinter(); + for ( PropertyValue const & prop : aPrinterSeq ) { - if ( aPrinterSeq[i].Name == "Name" ) + if ( prop.Name == "Name" ) { - aPrinterSeq[i].Value >>= aPrinterName; + prop.Value >>= aPrinterName; break; } } diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index ec0f64c146f1..b13739932b32 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -242,12 +242,12 @@ void GenericToolbarController::statusChanged( const FeatureStateEvent& Event ) { if (aControlCommand.Command == "SetQuickHelpText") { - for (sal_Int32 i = 0; i < aControlCommand.Arguments.getLength(); i++) + for ( NamedValue const & rArg : std::as_const(aControlCommand.Arguments) ) { - if (aControlCommand.Arguments[i].Name == "HelpText") + if (rArg.Name == "HelpText") { OUString aHelpText; - aControlCommand.Arguments[i].Value >>= aHelpText; + rArg.Value >>= aHelpText; m_xToolbar->SetQuickHelpText(m_nID, aHelpText); break; } diff --git a/framework/source/uielement/imagebuttontoolbarcontroller.cxx b/framework/source/uielement/imagebuttontoolbarcontroller.cxx index 340999620c68..5c0cbeba873f 100644 --- a/framework/source/uielement/imagebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/imagebuttontoolbarcontroller.cxx @@ -87,12 +87,12 @@ void ImageButtonToolbarController::executeControlCommand( const css::frame::Cont rControlCommand.Command == "SetImage") ) return; - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( const NamedValue& rArg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "URL" ) + if ( rArg.Name == "URL" ) { OUString aURL; - rControlCommand.Arguments[i].Value >>= aURL; + rArg.Value >>= aURL; SubstituteVariables( aURL ); diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 03dba963af7d..e6700d0ebf31 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -130,29 +130,25 @@ void MacrosMenuController::addScriptItems( PopupMenu* pPopupMenu, sal_uInt16 sta { break; } - Sequence< OUString > serviceNames = xServiceInfo->getSupportedServiceNames(); + const Sequence< OUString > serviceNames = xServiceInfo->getSupportedServiceNames(); - if ( serviceNames.getLength() > 0 ) + for ( OUString const & serviceName : serviceNames ) { - for ( sal_Int32 index = 0; index < serviceNames.getLength(); index++ ) + if ( serviceName.startsWith( providerKey ) ) { - if ( serviceNames[ index ].startsWith( providerKey ) ) + OUString aCommand = aCmdBase; + OUString aDisplayName = serviceName.copy( providerKey.getLength() ); + if( aDisplayName == "Java" || aDisplayName == "Basic" ) { - OUString serviceName = serviceNames[ index ]; - OUString aCommand = aCmdBase; - OUString aDisplayName = serviceName.copy( providerKey.getLength() ); - if( aDisplayName == "Java" || aDisplayName == "Basic" ) - { - // no entries for Java & Basic added elsewhere - break; - } - aCommand += aDisplayName; - aDisplayName += ellipsis; - pPopupMenu->InsertItem( itemId, aDisplayName ); - pPopupMenu->SetItemCommand( itemId, aCommand ); - itemId++; + // no entries for Java & Basic added elsewhere break; } + aCommand += aDisplayName; + aDisplayName += ellipsis; + pPopupMenu->InsertItem( itemId, aDisplayName ); + pPopupMenu->SetItemCommand( itemId, aCommand ); + itemId++; + break; } } } diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 8be9c718e5ad..f7ff1e18dbf6 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -1400,7 +1400,7 @@ void MenuBarManager::FillMenu( // Fill menu bar with container contents for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ ) { - Sequence< PropertyValue > aProp; + Sequence< PropertyValue > aProps; OUString aCommandURL; OUString aLabel; OUString aModuleIdentifier( rModuleIdentifier ); @@ -1410,32 +1410,32 @@ void MenuBarManager::FillMenu( sal_Int16 nStyle = 0; try { - if ( rItemContainer->getByIndex( n ) >>= aProp ) + if ( rItemContainer->getByIndex( n ) >>= aProps ) { bool bShow = true; bool bEnabled = true; - for ( int i = 0; i < aProp.getLength(); i++ ) + for ( beans::PropertyValue const & rProp : std::as_const(aProps) ) { - OUString aPropName = aProp[i].Name; + OUString aPropName = rProp.Name; if ( aPropName == "CommandURL" ) - aProp[i].Value >>= aCommandURL; + rProp.Value >>= aCommandURL; else if ( aPropName == "ItemDescriptorContainer" ) - aProp[i].Value >>= xIndexContainer; + rProp.Value >>= xIndexContainer; else if ( aPropName == "Label" ) - aProp[i].Value >>= aLabel; + rProp.Value >>= aLabel; else if ( aPropName == "Type" ) - aProp[i].Value >>= nType; + rProp.Value >>= nType; else if ( aPropName == "ModuleIdentifier" ) - aProp[i].Value >>= aModuleIdentifier; + rProp.Value >>= aModuleIdentifier; else if ( aPropName == "DispatchProvider" ) - aProp[i].Value >>= xDispatchProvider; + rProp.Value >>= xDispatchProvider; else if ( aPropName == "Style" ) - aProp[i].Value >>= nStyle; + rProp.Value >>= nStyle; else if ( aPropName == "IsVisible" ) - aProp[i].Value >>= bShow; + rProp.Value >>= bShow; else if ( aPropName == "Enabled" ) - aProp[i].Value >>= bEnabled; + rProp.Value >>= bEnabled; } if (!aCommandURL.isEmpty() && vcl::CommandInfoProvider::IsExperimental(aCommandURL, rModuleIdentifier) && diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx index 0ef3b9ee6334..eb3b291ff66d 100644 --- a/framework/source/uielement/menubarmerger.cxx +++ b/framework/source/uielement/menubarmerger.cxx @@ -388,21 +388,21 @@ void MenuBarMerger::GetMenuEntry( // Reset submenu member rAddonMenuItem.aSubMenu.clear(); - for ( sal_Int32 i = 0; i < rAddonMenuEntry.getLength(); i++ ) + for ( const beans::PropertyValue& rProp : rAddonMenuEntry ) { - OUString aMenuEntryPropName = rAddonMenuEntry[i].Name; + OUString aMenuEntryPropName = rProp.Name; if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_URL ) - rAddonMenuEntry[i].Value >>= rAddonMenuItem.aURL; + rProp.Value >>= rAddonMenuItem.aURL; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_TITLE ) - rAddonMenuEntry[i].Value >>= rAddonMenuItem.aTitle; + rProp.Value >>= rAddonMenuItem.aTitle; else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_SUBMENU ) { uno::Sequence< uno::Sequence< beans::PropertyValue > > aSubMenu; - rAddonMenuEntry[i].Value >>= aSubMenu; + rProp.Value >>= aSubMenu; GetSubMenu( aSubMenu, rAddonMenuItem.aSubMenu ); } else if ( aMenuEntryPropName == ADDONSMENUITEM_STRING_CONTEXT ) - rAddonMenuEntry[i].Value >>= rAddonMenuItem.aContext; + rProp.Value >>= rAddonMenuItem.aContext; } } diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index 716bc77094e2..48700304f72d 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -156,10 +156,10 @@ void SAL_CALL MenuBarWrapper::initialize( const Sequence< Any >& aArguments ) } bool bMenuOnly( false ); - for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) + for ( const Any& rArg : aArguments ) { PropertyValue aPropValue; - if ( aArguments[n] >>= aPropValue ) + if ( rArg >>= aPropValue ) { if ( aPropValue.Name == "MenuOnly" ) aPropValue.Value >>= bMenuOnly; diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 0bcd24982c47..a6d5310c20ed 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -466,11 +466,11 @@ void NewMenuController::impl_setPopupMenu() if ( xModuleManager->getByName( m_aModuleIdentifier ) >>= aSeq ) { - for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) + for ( PropertyValue const & prop : std::as_const(aSeq) ) { - if ( aSeq[y].Name == "ooSetupFactoryEmptyDocumentURL" ) + if ( prop.Name == "ooSetupFactoryEmptyDocumentURL" ) { - aSeq[y].Value >>= m_aEmptyDocURL; + prop.Value >>= m_aEmptyDocURL; break; } } diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index 24ceeb1cb506..9b75f3fdb66e 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -101,9 +101,9 @@ RecentFilesMenuController::RecentFilesMenuController( const uno::Reference< uno: m_bShowToolbarEntries( false ) { css::beans::PropertyValue aPropValue; - for ( sal_Int32 i = 0; i < args.getLength(); ++i ) + for ( uno::Any const & arg : args ) { - args[i] >>= aPropValue; + arg >>= aPropValue; if ( aPropValue.Name == "InToolbar" ) { aPropValue.Value >>= m_bShowToolbarEntries; @@ -135,14 +135,14 @@ void RecentFilesMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > { for ( int i = 0; i < nPickListMenuItems; i++ ) { - Sequence< PropertyValue >& rPickListEntry = aHistoryList[i]; + const Sequence< PropertyValue >& rPickListEntry = aHistoryList[i]; OUString aURL; - for ( int j = 0; j < rPickListEntry.getLength(); j++ ) + for ( PropertyValue const & prop : rPickListEntry ) { - if ( rPickListEntry[j].Name == HISTORY_PROPERTYNAME_URL ) + if ( prop.Name == HISTORY_PROPERTYNAME_URL ) { - rPickListEntry[j].Value >>= aURL; + prop.Value >>= aURL; break; } } diff --git a/framework/source/uielement/spinfieldtoolbarcontroller.cxx b/framework/source/uielement/spinfieldtoolbarcontroller.cxx index 684c5b419f1f..db3f9d67781c 100644 --- a/framework/source/uielement/spinfieldtoolbarcontroller.cxx +++ b/framework/source/uielement/spinfieldtoolbarcontroller.cxx @@ -294,14 +294,14 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro if ( rControlCommand.Command == "SetStep" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Step" ) + if ( arg.Name == "Step" ) { sal_Int32 nValue; double fValue; bool bFloat( false ); - if ( impl_getValue( rControlCommand.Arguments[i].Value, nValue, fValue, bFloat )) + if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) aStep = bFloat ? OUString( OUString::number( fValue )) : OUString( OUString::number( nValue )); break; @@ -310,15 +310,15 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro } else if ( rControlCommand.Command == "SetValue" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Value" ) + if ( arg.Name == "Value" ) { sal_Int32 nValue; double fValue; bool bFloat( false ); - if ( impl_getValue( rControlCommand.Arguments[i].Value, nValue, fValue, bFloat )) + if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) { aValue = bFloat ? OUString( OUString::number( fValue )) : OUString( OUString::number( nValue )); @@ -330,14 +330,14 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro } else if ( rControlCommand.Command == "SetValues" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { sal_Int32 nValue; double fValue; bool bFloat( false ); - OUString aName = rControlCommand.Arguments[i].Name; - if ( impl_getValue( rControlCommand.Arguments[i].Value, nValue, fValue, bFloat )) + OUString aName = arg.Name; + if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) { if ( aName == "Value" ) { @@ -356,19 +356,19 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro OUString( OUString::number( nValue )); } else if ( aName == "OutputFormat" ) - rControlCommand.Arguments[i].Value >>= m_aOutFormat; + arg.Value >>= m_aOutFormat; } } else if ( rControlCommand.Command == "SetLowerLimit" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "LowerLimit" ) + if ( arg.Name == "LowerLimit" ) { sal_Int32 nValue; double fValue; bool bFloat( false ); - if ( impl_getValue( rControlCommand.Arguments[i].Value, nValue, fValue, bFloat )) + if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) aMin = bFloat ? OUString( OUString::number( fValue )) : OUString( OUString::number( nValue )); break; @@ -377,14 +377,14 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro } else if ( rControlCommand.Command == "SetUpperLimit" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "UpperLimit" ) + if ( arg.Name == "UpperLimit" ) { sal_Int32 nValue; double fValue; bool bFloat( false ); - if ( impl_getValue( rControlCommand.Arguments[i].Value, nValue, fValue, bFloat )) + if ( impl_getValue( arg.Value, nValue, fValue, bFloat )) aMax = bFloat ? OUString( OUString::number( fValue )) : OUString( OUString::number( nValue )); break; @@ -393,11 +393,11 @@ void SpinfieldToolbarController::executeControlCommand( const css::frame::Contro } else if ( rControlCommand.Command == "SetOutputFormat" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "OutputFormat" ) + if ( arg.Name == "OutputFormat" ) { - rControlCommand.Arguments[i].Value >>= m_aOutFormat; + arg.Value >>= m_aOutFormat; break; } } diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index dff80ece225c..f97becd5d1ff 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -402,7 +402,7 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ ) { - uno::Sequence< beans::PropertyValue > aProp; + uno::Sequence< beans::PropertyValue > aProps; OUString aCommandURL; sal_Int16 nOffset( 0 ); sal_Int16 nStyle( 0 ); @@ -411,29 +411,29 @@ void StatusBarManager::FillStatusBar( const uno::Reference< container::XIndexAcc try { - if ( rItemContainer->getByIndex( n ) >>= aProp ) + if ( rItemContainer->getByIndex( n ) >>= aProps ) { - for ( int i = 0; i < aProp.getLength(); i++ ) + for ( beans::PropertyValue const & prop : std::as_const(aProps) ) { - if ( aProp[i].Name == "CommandURL" ) + if ( prop.Name == "CommandURL" ) { - aProp[i].Value >>= aCommandURL; + prop.Value >>= aCommandURL; } - else if ( aProp[i].Name == "Style" ) + else if ( prop.Name == "Style" ) { - aProp[i].Value >>= nStyle; + prop.Value >>= nStyle; } - else if ( aProp[i].Name == "Type" ) + else if ( prop.Name == "Type" ) { - aProp[i].Value >>= nType; + prop.Value >>= nType; } - else if ( aProp[i].Name == "Width" ) + else if ( prop.Name == "Width" ) { - aProp[i].Value >>= nWidth; + prop.Value >>= nWidth; } - else if ( aProp[i].Name == "Offset" ) + else if ( prop.Name == "Offset" ) { - aProp[i].Value >>= nOffset; + prop.Value >>= nOffset; } } diff --git a/framework/source/uielement/statusbarmerger.cxx b/framework/source/uielement/statusbarmerger.cxx index 3fabfc6ea695..900acecb8f1c 100644 --- a/framework/source/uielement/statusbarmerger.cxx +++ b/framework/source/uielement/statusbarmerger.cxx @@ -39,10 +39,8 @@ void lcl_ConvertSequenceToValues( bool bOwnerDraw = false; bool bMandatory = true; - PropertyValue aPropVal; - for ( sal_Int32 i = 0; i < rSequence.getLength(); i++ ) + for ( PropertyValue const & aPropVal : rSequence ) { - aPropVal = rSequence[i]; if ( aPropVal.Name == "URL" ) aPropVal.Value >>= rItem.aCommandURL; else if ( aPropVal.Name == "Title" ) @@ -163,10 +161,10 @@ bool StatusbarMerger::ConvertSeqSeqToVector( const Sequence< Sequence< PropertyValue > > &rSequence, AddonStatusbarItemContainer& rContainer ) { - for ( sal_Int32 i = 0; i < rSequence.getLength(); i++ ) + for ( auto const & i : rSequence ) { AddonStatusbarItem aStatusBarItem; - lcl_ConvertSequenceToValues( rSequence[i], aStatusBarItem ); + lcl_ConvertSequenceToValues( i, aStatusBarItem ); rContainer.push_back( aStatusBarItem ); } diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx index 635ebfb90770..3bbb2147f28b 100644 --- a/framework/source/uielement/subtoolbarcontroller.cxx +++ b/framework/source/uielement/subtoolbarcontroller.cxx @@ -94,10 +94,10 @@ public: SubToolBarController::SubToolBarController( const css::uno::Sequence< css::uno::Any >& rxArgs ) { - css::beans::PropertyValue aPropValue; - for ( sal_Int32 i = 0; i < rxArgs.getLength(); ++i ) + for ( css::uno::Any const & arg : rxArgs ) { - rxArgs[i] >>= aPropValue; + css::beans::PropertyValue aPropValue; + arg >>= aPropValue; if ( aPropValue.Name == "Value" ) { sal_Int32 nIdx{ 0 }; diff --git a/framework/source/uielement/togglebuttontoolbarcontroller.cxx b/framework/source/uielement/togglebuttontoolbarcontroller.cxx index 0f0e341d1448..ee2cb30e9910 100644 --- a/framework/source/uielement/togglebuttontoolbarcontroller.cxx +++ b/framework/source/uielement/togglebuttontoolbarcontroller.cxx @@ -107,19 +107,19 @@ void ToggleButtonToolbarController::executeControlCommand( const css::frame::Con if ( rControlCommand.Command == "SetList" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "List" ) + if ( arg.Name == "List" ) { Sequence< OUString > aList; m_aDropdownMenuList.clear(); m_aCurrentSelection.clear(); - rControlCommand.Arguments[i].Value >>= aList; - for ( sal_Int32 j = 0; j < aList.getLength(); j++ ) + arg.Value >>= aList; + for ( OUString const & label : std::as_const(aList) ) { m_aDropdownMenuList.push_back( DropdownMenuItem() ); - m_aDropdownMenuList.back().mLabel = aList[j]; + m_aDropdownMenuList.back().mLabel = label; } // send notification @@ -134,13 +134,13 @@ void ToggleButtonToolbarController::executeControlCommand( const css::frame::Con } else if ( rControlCommand.Command == "CheckItemPos" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Pos" ) + if ( arg.Name == "Pos" ) { sal_Int32 nPos( -1 ); - rControlCommand.Arguments[i].Value >>= nPos; + arg.Value >>= nPos; if ( nPos >= 0 && ( sal::static_int_cast< sal_uInt32 >(nPos) < m_aDropdownMenuList.size() ) ) @@ -162,15 +162,15 @@ void ToggleButtonToolbarController::executeControlCommand( const css::frame::Con OUString aText; OUString aTipHelpText; - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Text" ) + if ( arg.Name == "Text" ) { - rControlCommand.Arguments[i].Value >>= aText; + arg.Value >>= aText; } - else if ( rControlCommand.Arguments[i].Name == "TipHelpText" ) + else if ( arg.Name == "TipHelpText" ) { - rControlCommand.Arguments[i].Value >>= aTipHelpText; + arg.Value >>= aTipHelpText; } } @@ -186,19 +186,19 @@ void ToggleButtonToolbarController::executeControlCommand( const css::frame::Con sal_Int32 nPos(0); sal_Int32 nSize = sal_Int32( m_aDropdownMenuList.size() ); OUString aText; - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Pos" ) + if ( arg.Name == "Pos" ) { sal_Int32 nTmpPos = 0; - if ( rControlCommand.Arguments[i].Value >>= nTmpPos ) + if ( arg.Value >>= nTmpPos ) { if (( nTmpPos >= 0 ) && ( nTmpPos < nSize )) nPos = nTmpPos; } } - else if ( rControlCommand.Arguments[i].Name == "Text" ) - rControlCommand.Arguments[i].Value >>= aText; + else if ( arg.Name == "Text" ) + arg.Value >>= aText; } std::vector< DropdownMenuItem >::iterator aIter = m_aDropdownMenuList.begin(); @@ -209,12 +209,12 @@ void ToggleButtonToolbarController::executeControlCommand( const css::frame::Con } else if ( rControlCommand.Command == "RemoveEntryPos" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Pos" ) + if ( arg.Name == "Pos" ) { sal_Int32 nPos( -1 ); - if ( rControlCommand.Arguments[i].Value >>= nPos ) + if ( arg.Value >>= nPos ) { if ( nPos < sal_Int32( m_aDropdownMenuList.size() )) { @@ -227,12 +227,12 @@ void ToggleButtonToolbarController::executeControlCommand( const css::frame::Con } else if ( rControlCommand.Command == "RemoveEntryText" ) { - for ( sal_Int32 i = 0; i < rControlCommand.Arguments.getLength(); i++ ) + for ( auto const & arg : rControlCommand.Arguments ) { - if ( rControlCommand.Arguments[i].Name == "Text" ) + if ( arg.Name == "Text" ) { OUString aText; - if ( rControlCommand.Arguments[i].Value >>= aText ) + if ( arg.Value >>= aText ) { sal_Int32 nSize = sal_Int32( m_aDropdownMenuList.size() ); for ( sal_Int32 j = 0; j < nSize; j++ ) diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 9aa20b7933e5..670b30873233 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -573,10 +573,10 @@ void ToolBarManager::impl_elementChanged(bool const isRemove, if ( xIfacDocImgMgr == Event.Source ) nImageInfo = 0; - Sequence< OUString > aSeq = xNameAccess->getElementNames(); - for ( sal_Int32 i = 0; i < aSeq.getLength(); i++ ) + const Sequence< OUString > aSeq = xNameAccess->getElementNames(); + for ( OUString const & commandName : aSeq ) { - CommandToInfoMap::iterator pIter = m_aCommandMap.find( aSeq[i] ); + CommandToInfoMap::iterator pIter = m_aCommandMap.find( commandName ); if ( pIter != m_aCommandMap.end() && ( pIter->second.nImageInfo >= nImageInfo )) { if (isRemove) @@ -599,7 +599,7 @@ void ToolBarManager::impl_elementChanged(bool const isRemove, else { Reference< XGraphic > xGraphic; - if ( xNameAccess->getByName( aSeq[i] ) >>= xGraphic ) + if ( xNameAccess->getByName( commandName ) >>= xGraphic ) { Image aImage( xGraphic ); setToolBarImage(aImage,pIter); @@ -983,7 +983,7 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine CommandInfo aCmdInfo; for ( sal_Int32 n = 0; n < rItemContainer->getCount(); n++ ) { - Sequence< PropertyValue > aProp; + Sequence< PropertyValue > aProps; OUString aCommandURL; OUString aLabel; OUString aTooltip; @@ -992,23 +992,23 @@ void ToolBarManager::FillToolbar( const Reference< XIndexAccess >& rItemContaine try { - if ( rItemContainer->getByIndex( n ) >>= aProp ) + if ( rItemContainer->getByIndex( n ) >>= aProps ) { bool bIsVisible( true ); - for ( int i = 0; i < aProp.getLength(); i++ ) + for ( PropertyValue const & prop : std::as_const(aProps) ) { - if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) - aProp[i].Value >>= aCommandURL; - else if ( aProp[i].Name == "Label" ) - aProp[i].Value >>= aLabel; - else if ( aProp[i].Name == "Tooltip" ) - aProp[i].Value >>= aTooltip; - else if ( aProp[i].Name == "Type" ) - aProp[i].Value >>= nType; - else if ( aProp[i].Name == ITEM_DESCRIPTOR_VISIBLE ) - aProp[i].Value >>= bIsVisible; - else if ( aProp[i].Name == "Style" ) - aProp[i].Value >>= nStyle; + if ( prop.Name == ITEM_DESCRIPTOR_COMMANDURL ) + prop.Value >>= aCommandURL; + else if ( prop.Name == "Label" ) + prop.Value >>= aLabel; + else if ( prop.Name == "Tooltip" ) + prop.Value >>= aTooltip; + else if ( prop.Name == "Type" ) + prop.Value >>= nType; + else if ( prop.Name == ITEM_DESCRIPTOR_VISIBLE ) + prop.Value >>= bIsVisible; + else if ( prop.Name == "Style" ) + prop.Value >>= nStyle; } if (!aCommandURL.isEmpty() && vcl::CommandInfoProvider::IsExperimental(aCommandURL, m_aModuleIdentifier) && diff --git a/framework/source/uielement/toolbarmerger.cxx b/framework/source/uielement/toolbarmerger.cxx index 1bd87a1c26d2..d6d5b4ad4dd2 100644 --- a/framework/source/uielement/toolbarmerger.cxx +++ b/framework/source/uielement/toolbarmerger.cxx @@ -190,24 +190,24 @@ void ToolBarMerger::ConvertSequenceToValues( OUString& rControlType, sal_uInt16& rWidth ) { - for ( sal_Int32 i = 0; i < rSequence.getLength(); i++ ) + for ( beans::PropertyValue const & prop : rSequence ) { - if ( rSequence[i].Name == MERGE_TOOLBAR_URL ) - rSequence[i].Value >>= rCommandURL; - else if ( rSequence[i].Name == MERGE_TOOLBAR_TITLE ) - rSequence[i].Value >>= rLabel; - else if ( rSequence[i].Name == MERGE_TOOLBAR_IMAGEID ) - rSequence[i].Value >>= rImageIdentifier; - else if ( rSequence[i].Name == MERGE_TOOLBAR_CONTEXT ) - rSequence[i].Value >>= rContext; - else if ( rSequence[i].Name == MERGE_TOOLBAR_TARGET ) - rSequence[i].Value >>= rTarget; - else if ( rSequence[i].Name == MERGE_TOOLBAR_CONTROLTYPE ) - rSequence[i].Value >>= rControlType; - else if ( rSequence[i].Name == MERGE_TOOLBAR_WIDTH ) + if ( prop.Name == MERGE_TOOLBAR_URL ) + prop.Value >>= rCommandURL; + else if ( prop.Name == MERGE_TOOLBAR_TITLE ) + prop.Value >>= rLabel; + else if ( prop.Name == MERGE_TOOLBAR_IMAGEID ) + prop.Value >>= rImageIdentifier; + else if ( prop.Name == MERGE_TOOLBAR_CONTEXT ) + prop.Value >>= rContext; + else if ( prop.Name == MERGE_TOOLBAR_TARGET ) + prop.Value >>= rTarget; + else if ( prop.Name == MERGE_TOOLBAR_CONTROLTYPE ) + prop.Value >>= rControlType; + else if ( prop.Name == MERGE_TOOLBAR_WIDTH ) { sal_Int32 aValue = 0; - rSequence[i].Value >>= aValue; + prop.Value >>= aValue; rWidth = sal_uInt16( aValue ); } } diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index d8febf95b4bf..be2f42c57712 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -213,17 +213,16 @@ Reference< XDispatch > ToolbarsMenuController::getDispatchFromCommandURL( const static void fillHashMap( const Sequence< Sequence< css::beans::PropertyValue > >& rSeqToolBars, ToolbarHashMap& rHashMap ) { - for ( sal_Int32 i = 0; i < rSeqToolBars.getLength(); i++ ) + for ( Sequence< css::beans::PropertyValue > const & props : rSeqToolBars ) { OUString aResourceURL; OUString aUIName; - const PropertyValue* pProperties = rSeqToolBars[i].getConstArray(); - for ( sal_Int32 j = 0; j < rSeqToolBars[i].getLength(); j++ ) + for ( css::beans::PropertyValue const & prop : props ) { - if ( pProperties[j].Name == "ResourceURL" ) - pProperties[j].Value >>= aResourceURL; - else if ( pProperties[j].Name == "UIName" ) - pProperties[j].Value >>= aUIName; + if ( prop.Name == "ResourceURL" ) + prop.Value >>= aResourceURL; + else if ( prop.Name == "UIName" ) + prop.Value >>= aUIName; } if ( !aResourceURL.isEmpty() && @@ -236,11 +235,10 @@ static void fillHashMap( const Sequence< Sequence< css::beans::PropertyValue > > Sequence< Sequence< css::beans::PropertyValue > > ToolbarsMenuController::getLayoutManagerToolbars( const Reference< css::frame::XLayoutManager >& rLayoutManager ) { std::vector< ToolBarInfo > aToolBarArray; - Sequence< Reference< XUIElement > > aUIElements = rLayoutManager->getElements(); - for ( sal_Int32 i = 0; i < aUIElements.getLength(); i++ ) + const Sequence< Reference< XUIElement > > aUIElements = rLayoutManager->getElements(); + for ( Reference< XUIElement > const & xUIElement : aUIElements ) { - Reference< XUIElement > xUIElement( aUIElements[i] ); - Reference< XPropertySet > xPropSet( aUIElements[i], UNO_QUERY ); + Reference< XPropertySet > xPropSet( xUIElement, UNO_QUERY ); if ( xPropSet.is() && xUIElement.is() ) { try @@ -345,16 +343,16 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co if ( a >>= aWindowState ) { - for ( sal_Int32 i = 0; i < aWindowState.getLength(); i++ ) + for ( PropertyValue const & prop : std::as_const(aWindowState) ) { - if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_UINAME ) - aWindowState[i].Value >>= aUIName; - else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_HIDEFROMENU ) - aWindowState[i].Value >>= bHideFromMenu; - else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_CONTEXT ) - aWindowState[i].Value >>= bContextSensitive; - else if ( aWindowState[i].Name == WINDOWSTATE_PROPERTY_VISIBLE ) - aWindowState[i].Value >>= bVisible; + if ( prop.Name == WINDOWSTATE_PROPERTY_UINAME ) + prop.Value >>= aUIName; + else if ( prop.Name == WINDOWSTATE_PROPERTY_HIDEFROMENU ) + prop.Value >>= bHideFromMenu; + else if ( prop.Name == WINDOWSTATE_PROPERTY_CONTEXT ) + prop.Value >>= bContextSensitive; + else if ( prop.Name == WINDOWSTATE_PROPERTY_VISIBLE ) + prop.Value >>= bVisible; } } } diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 3e1706ed0b17..28367830c9f7 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -115,10 +115,10 @@ void SAL_CALL ToolBarWrapper::initialize( const Sequence< Any >& aArguments ) bool bPopupMode( false ); Reference< XWindow > xParentWindow; - for ( sal_Int32 i = 0; i < aArguments.getLength(); i++ ) + for ( Any const & arg : aArguments ) { PropertyValue aPropValue; - if ( aArguments[i] >>= aPropValue ) + if ( arg >>= aPropValue ) { if ( aPropValue.Name == "PopupMode" ) aPropValue.Value >>= bPopupMode; diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index d81591ac3876..6c7b13a3f281 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -585,21 +585,19 @@ UICommandDescription::~UICommandDescription() void UICommandDescription::impl_fillElements(const char* _pName) { m_xModuleManager.set( ModuleManager::create( m_xContext ) ); - Sequence< OUString > aElementNames = m_xModuleManager->getElementNames(); - Sequence< PropertyValue > aSeq; - OUString aModuleIdentifier; + const Sequence< OUString > aElementNames = m_xModuleManager->getElementNames(); - for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) + for ( OUString const & aModuleIdentifier : aElementNames ) { - aModuleIdentifier = aElementNames[i]; + Sequence< PropertyValue > aSeq; if ( m_xModuleManager->getByName( aModuleIdentifier ) >>= aSeq ) { OUString aCommandStr; - for ( sal_Int32 y = 0; y < aSeq.getLength(); y++ ) + for ( PropertyValue const & prop : std::as_const(aSeq) ) { - if ( aSeq[y].Name.equalsAscii(_pName) ) + if ( prop.Name.equalsAscii(_pName) ) { - aSeq[y].Value >>= aCommandStr; + prop.Value >>= aCommandStr; break; } } @@ -612,7 +610,7 @@ void UICommandDescription::impl_fillElements(const char* _pName) if ( pIter == m_aUICommandsHashMap.end() ) m_aUICommandsHashMap.emplace( aCommandStr, Reference< XNameAccess >() ); } - } // for ( sal_Int32 i = 0; i < aElementNames.getLength(); i++ ) + } // for ( sal_Int32 i = 0; i < aElementNames.(); i++ ) } Any SAL_CALL UICommandDescription::getByName( const OUString& aName ) diff --git a/framework/source/uifactory/addonstoolbarfactory.cxx b/framework/source/uifactory/addonstoolbarfactory.cxx index 7607d20653d1..021d3dc02c53 100644 --- a/framework/source/uifactory/addonstoolbarfactory.cxx +++ b/framework/source/uifactory/addonstoolbarfactory.cxx @@ -113,26 +113,25 @@ bool AddonsToolBarFactory::hasButtonsInContext( // Check before we create a toolbar that we have at least one button in // the current frame context. - for ( sal_uInt32 i = 0; i < o3tl::make_unsigned(rPropSeqSeq.getLength()); i++ ) + for ( Sequence<PropertyValue> const & props : rPropSeqSeq ) { bool bIsButton( true ); bool bIsCorrectContext( false ); sal_uInt32 nPropChecked( 0 ); - const Sequence< PropertyValue >& rPropSeq = rPropSeqSeq[i]; - for ( sal_uInt32 j = 0; j < o3tl::make_unsigned(rPropSeq.getLength()); j++ ) + for ( PropertyValue const & prop : props ) { - if ( rPropSeq[j].Name == "Context" ) + if ( prop.Name == "Context" ) { OUString aContextList; - if ( rPropSeq[j].Value >>= aContextList ) + if ( prop.Value >>= aContextList ) bIsCorrectContext = IsCorrectContext( aModuleIdentifier, aContextList ); nPropChecked++; } - else if ( rPropSeq[j].Name == "URL" ) + else if ( prop.Name == "URL" ) { OUString aURL; - rPropSeq[j].Value >>= aURL; + prop.Value >>= aURL; bIsButton = aURL != "private:separator"; nPropChecked++; } @@ -159,14 +158,14 @@ Reference< XUIElement > SAL_CALL AddonsToolBarFactory::createUIElement( Reference< XFrame > xFrame; OUString aResourceURL( ResourceURL ); - for ( sal_Int32 n = 0; n < Args.getLength(); n++ ) + for ( PropertyValue const & arg : Args ) { - if ( Args[n].Name == "ConfigurationData" ) - Args[n].Value >>= aConfigData; - else if ( Args[n].Name == "Frame" ) - Args[n].Value >>= xFrame; - else if ( Args[n].Name == "ResourceURL" ) - Args[n].Value >>= aResourceURL; + if ( arg.Name == "ConfigurationData" ) + arg.Value >>= aConfigData; + else if ( arg.Name == "Frame" ) + arg.Value >>= xFrame; + else if ( arg.Name == "ResourceURL" ) + arg.Value >>= aResourceURL; } if ( !aResourceURL.startsWith("private:resource/toolbar/addon_") ) diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx index f67cea50d3db..485b5a0a94e7 100644 --- a/framework/source/uifactory/factoryconfiguration.cxx +++ b/framework/source/uifactory/factoryconfiguration.cxx @@ -224,7 +224,7 @@ void ConfigurationAccess_ControllerFactory::updateConfigurationData() if ( !m_xConfigAccess.is() ) return; - Sequence< OUString > aPopupMenuControllers = m_xConfigAccess->getElementNames(); + const Sequence< OUString > aPopupMenuControllers = m_xConfigAccess->getElementNames(); OUString aCommand; OUString aModule; @@ -233,11 +233,11 @@ void ConfigurationAccess_ControllerFactory::updateConfigurationData() OUString aValue; m_aMenuControllerMap.clear(); - for ( sal_Int32 i = 0; i < aPopupMenuControllers.getLength(); i++ ) + for ( OUString const & name : aPopupMenuControllers ) { try { - if ( impl_getElementProps( m_xConfigAccess->getByName( aPopupMenuControllers[i] ), aCommand, aModule, aService,aValue )) + if ( impl_getElementProps( m_xConfigAccess->getByName( name ), aCommand, aModule, aService,aValue )) { // Create hash key from command and module as they are together a primary key to // the UNO service that implements the popup menu controller. diff --git a/framework/source/uifactory/uicontrollerfactory.cxx b/framework/source/uifactory/uicontrollerfactory.cxx index 08aff413d7b1..35d883a4c9f0 100644 --- a/framework/source/uifactory/uicontrollerfactory.cxx +++ b/framework/source/uifactory/uicontrollerfactory.cxx @@ -126,9 +126,9 @@ Reference< XInterface > SAL_CALL UIControllerFactory::createInstanceWithArgument // Retrieve the optional module name from the Arguments sequence. It is used as a part of // the hash map key to support different controller implementation for the same URL but different // module!! - for ( int i = 0; i < Arguments.getLength(); i++ ) + for ( Any const & arg : Arguments ) { - if (( Arguments[i] >>= aPropValue ) && ( aPropValue.Name == aPropModuleName )) + if (( arg >>= aPropValue ) && ( aPropValue.Name == aPropModuleName )) { aPropValue.Value >>= aPropName; break; diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index e58493e8f7e3..68e2286836cb 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -279,16 +279,16 @@ void ConfigurationAccess_FactoryManager::readConfigurationData() if ( !m_xConfigAccess.is() ) return; - Sequence< OUString > aUIElementFactories = m_xConfigAccess->getElementNames(); + const Sequence< OUString > aUIElementFactories = m_xConfigAccess->getElementNames(); OUString aType; OUString aName; OUString aModule; OUString aService; OUString aHashKey; - for ( sal_Int32 i = 0; i < aUIElementFactories.getLength(); i++ ) + for ( OUString const & factoryName : aUIElementFactories ) { - if ( impl_getElementProps( m_xConfigAccess->getByName( aUIElementFactories[i] ), aType, aName, aModule, aService )) + if ( impl_getElementProps( m_xConfigAccess->getByName( factoryName ), aType, aName, aModule, aService )) { // Create hash key from type, name and module as they are together a primary key to // the UNO service that implements the user interface element factory. @@ -415,12 +415,12 @@ Reference< XUIElement > SAL_CALL UIElementFactoryManager::createUIElement( // Retrieve the frame instance from the arguments to determine the module identifier. This must be provided // to the search function. An empty module identifier is provided if the frame is missing or the module id cannot // retrieve from it. - for ( int i = 0; i < Args.getLength(); i++ ) + for ( auto const & arg : Args ) { - if ( Args[i].Name == "Frame") - Args[i].Value >>= xFrame; - if (Args[i].Name == "Module") - Args[i].Value >>= aModuleId; + if ( arg.Name == "Frame") + arg.Value >>= xFrame; + if (arg.Name == "Module") + arg.Value >>= aModuleId; } } // SAFE diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx index 4352bb7a8934..996fae5f41a1 100644 --- a/framework/source/uifactory/windowcontentfactorymanager.cxx +++ b/framework/source/uifactory/windowcontentfactorymanager.cxx @@ -109,10 +109,10 @@ uno::Reference< uno::XInterface > SAL_CALL WindowContentFactoryManager::createIn uno::Reference< frame::XFrame > xFrame; OUString aResourceURL; - for (sal_Int32 i=0; i < Arguments.getLength(); i++ ) + for (auto const & arg : Arguments ) { beans::PropertyValue aPropValue; - if ( Arguments[i] >>= aPropValue ) + if ( arg >>= aPropValue ) { if ( aPropValue.Name == "Frame" ) aPropValue.Value >>= xFrame; |