summaryrefslogtreecommitdiff
path: root/scripting/source/provider/BrowseNodeFactoryImpl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'scripting/source/provider/BrowseNodeFactoryImpl.cxx')
-rw-r--r--scripting/source/provider/BrowseNodeFactoryImpl.cxx35
1 files changed, 16 insertions, 19 deletions
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index d637048e614f..656690b2254b 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -55,14 +55,14 @@ class BrowseNodeAggregator :
{
private:
OUString m_Name;
- Sequence< Reference< browse::XBrowseNode > > m_Nodes;
+ std::vector< Reference< browse::XBrowseNode > > m_Nodes;
public:
explicit BrowseNodeAggregator( const Reference< browse::XBrowseNode >& node )
{
m_Name = node->getName();
- m_Nodes.realloc( 1 );
+ m_Nodes.resize( 1 );
m_Nodes[ 0 ] = node;
}
@@ -72,10 +72,7 @@ public:
void addBrowseNode( const Reference< browse::XBrowseNode>& node )
{
- sal_Int32 index = m_Nodes.getLength();
-
- m_Nodes.realloc( index + 1 );
- m_Nodes[ index ] = node;
+ m_Nodes.push_back( node );
}
virtual OUString
@@ -90,11 +87,11 @@ public:
throw ( RuntimeException, std::exception ) override
{
std::vector< Sequence< Reference < browse::XBrowseNode > > > seqs;
- seqs.reserve( m_Nodes.getLength() );
+ seqs.reserve( m_Nodes.size() );
sal_Int32 numChildren = 0;
- for ( sal_Int32 i = 0; i < m_Nodes.getLength(); i++ )
+ for ( size_t i = 0; i < m_Nodes.size(); i++ )
{
Sequence< Reference < browse::XBrowseNode > > children;
try
@@ -129,9 +126,9 @@ public:
hasChildNodes()
throw ( RuntimeException, std::exception ) override
{
- if ( m_Nodes.getLength() != 0 )
+ if ( !m_Nodes.empty() )
{
- for ( sal_Int32 i = 0 ; i < m_Nodes.getLength(); i++ )
+ for ( size_t i = 0 ; i < m_Nodes.size(); i++ )
{
try
{
@@ -294,7 +291,7 @@ private:
namespace
{
-Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference< XComponentContext >& xCtx )
+std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference< XComponentContext >& xCtx )
{
Sequence< OUString > openDocs =
MiscUtils::allOpenTDocUrls( xCtx );
@@ -303,7 +300,7 @@ Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference<
sal_Int32 initialSize = openDocs.getLength() + 2;
sal_Int32 mspIndex = 0;
- Sequence < Reference < browse::XBrowseNode > > locnBNs( initialSize );
+ std::vector< Reference < browse::XBrowseNode > > locnBNs( initialSize );
try
{
xFac = provider::theMasterScriptProviderFactory::get( xCtx );
@@ -317,7 +314,7 @@ Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference<
(void)e;
OSL_TRACE("Caught Exception %s",
OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- locnBNs.realloc( mspIndex );
+ locnBNs.resize( mspIndex );
return locnBNs;
}
@@ -350,7 +347,7 @@ Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference<
}
- Sequence < Reference < browse::XBrowseNode > > locnBNs_Return( mspIndex );
+ std::vector< Reference < browse::XBrowseNode > > locnBNs_Return( mspIndex );
for ( sal_Int32 j = 0; j < mspIndex; j++ )
locnBNs_Return[j] = locnBNs[j];
@@ -538,10 +535,10 @@ private:
public:
explicit DefaultRootBrowseNode( const Reference< XComponentContext >& xCtx )
{
- Sequence < Reference< browse::XBrowseNode > > nodes =
+ std::vector< Reference< browse::XBrowseNode > > nodes =
getAllBrowseNodes( xCtx );
- for ( sal_Int32 i=0; i<nodes.getLength(); i++ )
+ for ( size_t i=0; i<nodes.size(); i++ )
{
m_vNodes.push_back( new DefaultBrowseNode( xCtx, nodes[ i ] ) );
}
@@ -621,12 +618,12 @@ public:
throw ( RuntimeException, std::exception ) override
{
- Sequence < Reference < browse::XBrowseNode > > locnBNs = getAllBrowseNodes( m_xComponentContext );
+ std::vector< Reference < browse::XBrowseNode > > locnBNs = getAllBrowseNodes( m_xComponentContext );
Sequence< Reference< browse::XBrowseNode > > children(
- locnBNs.getLength() );
+ locnBNs.size() );
- for ( sal_Int32 j = 0; j < locnBNs.getLength(); j++ )
+ for ( size_t j = 0; j < locnBNs.size(); j++ )
{
children[j] = new LocationBrowseNode( locnBNs[j] );
}