summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/baslibnode.cxx10
-rw-r--r--scripting/source/provider/BrowseNodeFactoryImpl.cxx35
-rw-r--r--scripting/source/provider/ProviderCache.cxx4
3 files changed, 23 insertions, 26 deletions
diff --git a/scripting/source/basprov/baslibnode.cxx b/scripting/source/basprov/baslibnode.cxx
index aee5ae04ada7..b39368ee03ce 100644
--- a/scripting/source/basprov/baslibnode.cxx
+++ b/scripting/source/basprov/baslibnode.cxx
@@ -20,6 +20,7 @@
#include "baslibnode.hxx"
#include "basmodnode.hxx"
#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
+#include <comphelper/sequence.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <basic/basmgr.hxx>
@@ -77,7 +78,7 @@ namespace basprov
{
SolarMutexGuard aGuard;
- Sequence< Reference< browse::XBrowseNode > > aChildNodes;
+ std::vector< Reference< browse::XBrowseNode > > aChildNodes;
if ( m_xLibContainer.is() && m_xLibContainer->hasByName( m_sLibName ) && !m_xLibContainer->isLibraryLoaded( m_sLibName ) )
m_xLibContainer->loadLibrary( m_sLibName );
@@ -90,19 +91,18 @@ namespace basprov
Sequence< OUString > aNames = m_xLibrary->getElementNames();
sal_Int32 nCount = aNames.getLength();
const OUString* pNames = aNames.getConstArray();
- aChildNodes.realloc( nCount );
- Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray();
+ aChildNodes.resize( nCount );
for ( sal_Int32 i = 0 ; i < nCount ; ++i )
{
SbModule* pModule = pBasic->FindModule( pNames[i] );
if ( pModule )
- pChildNodes[i] = static_cast< browse::XBrowseNode* >( new BasicModuleNodeImpl( m_xContext, m_sScriptingContext, pModule, m_bIsAppScript ) );
+ aChildNodes[i] = static_cast< browse::XBrowseNode* >( new BasicModuleNodeImpl( m_xContext, m_sScriptingContext, pModule, m_bIsAppScript ) );
}
}
}
- return aChildNodes;
+ return comphelper::containerToSequence(aChildNodes);
}
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] );
}
diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx
index 854b8235163f..34686b156b1f 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -83,18 +83,18 @@ ProviderCache::getProvider( const OUString& providerName )
Sequence < Reference< provider::XScriptProvider > >
ProviderCache::getAllProviders() throw ( RuntimeException )
{
- Sequence < Reference< provider::XScriptProvider > > providers ( m_hProviderDetailsCache.size() );
// need to create providers that haven't been created already
// so check what providers exist and what ones don't
::osl::Guard< osl::Mutex > aGuard( m_mutex );
+ Sequence < Reference< provider::XScriptProvider > > providers ( m_hProviderDetailsCache.size() );
ProviderDetails_hash::iterator h_itEnd = m_hProviderDetailsCache.end();
ProviderDetails_hash::iterator h_it = m_hProviderDetailsCache.begin();
// should assert if size !> 0
if ( !m_hProviderDetailsCache.empty() )
{
sal_Int32 providerIndex = 0;
- sal_Int32 index = 0;
+ sal_Int32 index = 0;
for ( index = 0; h_it != h_itEnd; ++h_it, index++ )
{
Reference< provider::XScriptProvider > xScriptProvider = h_it->second.provider;