summaryrefslogtreecommitdiff
path: root/scripting/source/provider/BrowseNodeFactoryImpl.cxx
diff options
context:
space:
mode:
authorArkadiy Illarionov <qarkai@gmail.com>2019-07-27 23:20:29 +0300
committerArkadiy Illarionov <qarkai@gmail.com>2019-07-30 11:16:00 +0200
commit5ba84c3c7080d55d86b8b39db077b6da36cb700a (patch)
treea71491f3d336a314ab63e834bd013f0503be967b /scripting/source/provider/BrowseNodeFactoryImpl.cxx
parent850693273970be2662cce8f4d2710b3657a02f65 (diff)
Simplify Sequence iterations in scaddins, sccomp, scripting
Use range-based loops, STL and comphelper functions Change-Id: I836422a1c81a3dc9585687ed2e506eb59bb4ec91 Reviewed-on: https://gerrit.libreoffice.org/76484 Tested-by: Jenkins Reviewed-by: Arkadiy Illarionov <qarkai@gmail.com>
Diffstat (limited to 'scripting/source/provider/BrowseNodeFactoryImpl.cxx')
-rw-r--r--scripting/source/provider/BrowseNodeFactoryImpl.cxx25
1 files changed, 10 insertions, 15 deletions
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index 909443f5f511..c7a7829d900f 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -109,10 +109,8 @@ public:
sal_Int32 index = 0;
for ( Sequence< Reference < browse::XBrowseNode > >& children : seqs )
{
- for ( sal_Int32 j = 0; j < children.getLength(); j++ )
- {
- result[ index++ ] = children[ j ];
- }
+ std::copy(children.begin(), children.end(), std::next(result.begin(), index));
+ index += children.getLength();
if (index >= numChildren)
break;
@@ -220,25 +218,23 @@ private:
Sequence< Reference< browse::XBrowseNode > > langNodes =
m_origNode->getChildNodes();
- for ( sal_Int32 i = 0; i < langNodes.getLength(); i++ )
+ for ( const auto& rLangNode : langNodes )
{
Reference< browse::XBrowseNode > xbn;
- if ( langNodes[ i ]->getName() == "uno_packages" )
+ if ( rLangNode->getName() == "uno_packages" )
{
- xbn.set( new LocationBrowseNode( langNodes[ i ] ) );
+ xbn.set( new LocationBrowseNode( rLangNode ) );
}
else
{
- xbn.set( langNodes[ i ] );
+ xbn.set( rLangNode );
}
Sequence< Reference< browse::XBrowseNode > > grandchildren =
xbn->getChildNodes();
- for ( sal_Int32 j = 0; j < grandchildren.getLength(); j++ )
+ for ( const Reference< browse::XBrowseNode >& grandchild : grandchildren )
{
- Reference< browse::XBrowseNode > grandchild(grandchildren[j]);
-
auto h_it =
m_hBNA->find( grandchild->getName() );
@@ -289,11 +285,11 @@ std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Referen
return locnBNs;
}
- for ( sal_Int32 i = 0; i < openDocs.getLength(); i++ )
+ for ( const auto& rDoc : openDocs )
{
try
{
- Reference< frame::XModel > model( MiscUtils::tDocUrlToModel( openDocs[ i ] ), UNO_SET_THROW );
+ Reference< frame::XModel > model( MiscUtils::tDocUrlToModel( rDoc ), UNO_SET_THROW );
// #i44599 Check if it's a real document or something special like Hidden/Preview
css::uno::Reference< css::frame::XController > xCurrentController = model->getCurrentController();
@@ -401,9 +397,8 @@ public:
vXBrowseNodes aVNodes;
Sequence < Reference< browse::XBrowseNode > > nodes =
m_xWrappedBrowseNode->getChildNodes();
- for ( sal_Int32 i=0; i<nodes.getLength(); i++ )
+ for ( const Reference< browse::XBrowseNode >& xBrowseNode : nodes )
{
- Reference< browse::XBrowseNode > xBrowseNode = nodes[ i ];
OSL_ENSURE( xBrowseNode.is(), "DefaultBrowseNode::getChildNodes(): Invalid BrowseNode" );
if( xBrowseNode.is() )
aVNodes.push_back( new DefaultBrowseNode( m_xCtx, xBrowseNode ) );