summaryrefslogtreecommitdiff
path: root/toolkit/source/awt
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-06-30 13:39:03 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-06-30 17:17:49 +0200
commit172a5e3306edbef3d40d9850c446dba00b7ada06 (patch)
treec0a18bb6138c1f0909386801abc4e5a2ba08b7d9 /toolkit/source/awt
parentb2fe75d13e8cf7bf1deabfb232fd907f0894996e (diff)
Simplify Sequence iterations in toolkit
Use range-based loops or replace with STL functions Change-Id: I8129ca201dd7017fc4064b04834f41d69cc01274 Reviewed-on: https://gerrit.libreoffice.org/74926 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'toolkit/source/awt')
-rw-r--r--toolkit/source/awt/animatedimagespeer.cxx4
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx24
-rw-r--r--toolkit/source/awt/vclxwindow1.cxx12
-rw-r--r--toolkit/source/awt/vclxwindows.cxx22
4 files changed, 28 insertions, 34 deletions
diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx
index 4d1be4be96e7..5277841af3e6 100644
--- a/toolkit/source/awt/animatedimagespeer.cxx
+++ b/toolkit/source/awt/animatedimagespeer.cxx
@@ -169,9 +169,9 @@ namespace toolkit
o_images.resize(0);
size_t count = size_t( i_imageURLs.getLength() );
o_images.reserve( count );
- for ( size_t i = 0; i < count; ++i )
+ for ( const auto& rImageURL : i_imageURLs )
{
- o_images.emplace_back( i_imageURLs[i] );
+ o_images.emplace_back( rImageURL );
}
}
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 904f95fd5e38..42c135c7b889 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -1413,14 +1413,12 @@ vcl::Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp,
css::uno::Sequence< css::beans::NamedValue > aProps;
if( anyHandle >>= aProps )
{
- const int nProps = aProps.getLength();
- const css::beans::NamedValue* pProps = aProps.getConstArray();
- for( int i = 0; i < nProps; i++ )
+ for( const css::beans::NamedValue& rProp : aProps )
{
- if ( pProps[i].Name == "WINDOW" )
- pProps[i].Value >>= nWindowHandle;
- else if ( pProps[i].Name == "XEMBED" )
- pProps[i].Value >>= bXEmbed;
+ if ( rProp.Name == "WINDOW" )
+ rProp.Value >>= nWindowHandle;
+ else if ( rProp.Name == "XEMBED" )
+ rProp.Value >>= bXEmbed;
}
}
else
@@ -1645,14 +1643,12 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::createSystemChild( con
css::uno::Sequence< css::beans::NamedValue > aProps;
if( Parent >>= aProps )
{
- const int nProps = aProps.getLength();
- const css::beans::NamedValue* pProps = aProps.getConstArray();
- for( int i = 0; i < nProps; i++ )
+ for( const css::beans::NamedValue& rProp : aProps )
{
- if ( pProps[i].Name == "WINDOW" )
- pProps[i].Value >>= nWindowHandle;
- else if ( pProps[i].Name == "XEMBED" )
- pProps[i].Value >>= bXEmbed;
+ if ( rProp.Name == "WINDOW" )
+ rProp.Value >>= nWindowHandle;
+ else if ( rProp.Name == "XEMBED" )
+ rProp.Value >>= bXEmbed;
}
}
else
diff --git a/toolkit/source/awt/vclxwindow1.cxx b/toolkit/source/awt/vclxwindow1.cxx
index f774ab13ab51..16f696a1c138 100644
--- a/toolkit/source/awt/vclxwindow1.cxx
+++ b/toolkit/source/awt/vclxwindow1.cxx
@@ -55,14 +55,12 @@ void VCLXWindow::SetSystemParent_Impl( const css::uno::Any& rHandle )
css::uno::Sequence< css::beans::NamedValue > aProps;
if( rHandle >>= aProps )
{
- const int nProps = aProps.getLength();
- const css::beans::NamedValue* pProps = aProps.getConstArray();
- for( int i = 0; i < nProps; i++ )
+ for( const css::beans::NamedValue& rProp : aProps )
{
- if ( pProps[i].Name == "WINDOW" )
- pProps[i].Value >>= nHandle;
- else if ( pProps[i].Name == "XEMBED" )
- pProps[i].Value >>= bXEmbed;
+ if ( rProp.Name == "WINDOW" )
+ rProp.Value >>= nHandle;
+ else if ( rProp.Name == "XEMBED" )
+ rProp.Value >>= bXEmbed;
}
}
else
diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx
index f7281ced9c1d..8d96999406a3 100644
--- a/toolkit/source/awt/vclxwindows.cxx
+++ b/toolkit/source/awt/vclxwindows.cxx
@@ -2156,14 +2156,14 @@ void SAL_CALL VCLXListBox::itemListChanged( const EventObject& i_rEvent )
Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
uno::Sequence< beans::Pair< OUString, OUString > > aItems = xItemList->getAllItems();
- for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
+ for ( const auto& rItem : aItems )
{
- OUString aLocalizationKey( aItems[i].First );
+ OUString aLocalizationKey( rItem.First );
if ( xStringResourceResolver.is() && aLocalizationKey.startsWith("&") )
{
aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
}
- pListBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( aItems[i].Second ) );
+ pListBox->InsertEntry( aLocalizationKey, lcl_getImageFromURL( rItem.Second ) );
}
}
@@ -2660,10 +2660,10 @@ void SAL_CALL VCLXMultiPage::setTabProps( sal_Int32 ID, const uno::Sequence< bea
if ( pTabControl->GetTabPage( sal::static_int_cast< sal_uInt16 >( ID ) ) == nullptr )
throw lang::IndexOutOfBoundsException();
- for (sal_Int32 i = 0; i < Properties.getLength(); ++i)
+ for (const auto& rProp : Properties)
{
- const OUString &name = Properties[i].Name;
- const uno::Any &value = Properties[i].Value;
+ const OUString &name = rProp.Name;
+ const uno::Any &value = rProp.Value;
if (name == "Title")
{
@@ -4247,9 +4247,9 @@ void VCLXComboBox::addItems( const css::uno::Sequence< OUString>& aItems, sal_In
if ( pBox )
{
sal_uInt16 nP = nPos;
- for ( sal_Int32 n = 0; n < aItems.getLength(); n++ )
+ for ( const auto& rItem : aItems )
{
- pBox->InsertEntry( aItems.getConstArray()[n], nP );
+ pBox->InsertEntry( rItem, nP );
if ( nP == 0xFFFF )
{
OSL_FAIL( "VCLXComboBox::addItems: too many entries!" );
@@ -4616,15 +4616,15 @@ void SAL_CALL VCLXComboBox::itemListChanged( const EventObject& i_rEvent )
Reference< XItemList > xItemList( i_rEvent.Source, uno::UNO_QUERY_THROW );
uno::Sequence< beans::Pair< OUString, OUString > > aItems = xItemList->getAllItems();
- for ( sal_Int32 i=0; i<aItems.getLength(); ++i )
+ for ( const auto& rItem : aItems )
{
- OUString aLocalizationKey( aItems[i].First );
+ OUString aLocalizationKey( rItem.First );
if ( xStringResourceResolver.is() && !aLocalizationKey.isEmpty() && aLocalizationKey[0] == '&' )
{
aLocalizationKey = xStringResourceResolver->resolveString(aLocalizationKey.copy( 1 ));
}
pComboBox->InsertEntryWithImage(aLocalizationKey,
- lcl_getImageFromURL(aItems[i].Second));
+ lcl_getImageFromURL(rItem.Second));
}
}
void SAL_CALL VCLXComboBox::disposing( const EventObject& i_rEvent )