diff options
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 5 | ||||
-rw-r--r-- | comphelper/source/misc/accessibleeventnotifier.cxx | 13 | ||||
-rw-r--r-- | cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx | 19 | ||||
-rw-r--r-- | cppuhelper/source/gcc3.map | 6 | ||||
-rw-r--r-- | cppuhelper/source/interfacecontainer.cxx | 108 | ||||
-rw-r--r-- | dbaccess/source/core/api/RowSet.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/inc/apitools.hxx | 13 | ||||
-rw-r--r-- | desktop/source/deployment/registry/dp_backend.cxx | 6 | ||||
-rw-r--r-- | embedserv/source/embed/intercept.cxx | 12 | ||||
-rw-r--r-- | include/cppuhelper/interfacecontainer.h | 16 | ||||
-rw-r--r-- | sc/source/ui/unoobj/fielduno.cxx | 66 | ||||
-rw-r--r-- | sd/source/core/stlsheet.cxx | 11 | ||||
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 8 | ||||
-rw-r--r-- | svx/source/table/tabledesign.cxx | 4 | ||||
-rw-r--r-- | svx/source/unodraw/unoshcol.cxx | 4 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 24 | ||||
-rw-r--r-- | toolkit/source/controls/controlmodelcontainerbase.cxx | 10 | ||||
-rw-r--r-- | ucb/source/ucp/file/filrset.cxx | 12 |
18 files changed, 202 insertions, 148 deletions
diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 31e378603339..e38dfcee6b4f 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -227,9 +227,10 @@ bool ChartModel::impl_isControllerConnected( const uno::Reference< frame::XContr { try { - for( uno::Reference<uno::XInterface> & rInterface : m_aControllers.getElements() ) + uno::Sequence< uno::Reference<uno::XInterface> > aSeq = m_aControllers.getElements(); + for( sal_Int32 nN = aSeq.getLength(); nN--; ) { - if( rInterface == xController ) + if( aSeq[nN] == xController ) return true; } } diff --git a/comphelper/source/misc/accessibleeventnotifier.cxx b/comphelper/source/misc/accessibleeventnotifier.cxx index 224c44de0c14..d8a3b36253e8 100644 --- a/comphelper/source/misc/accessibleeventnotifier.cxx +++ b/comphelper/source/misc/accessibleeventnotifier.cxx @@ -255,7 +255,7 @@ namespace comphelper void AccessibleEventNotifier::addEvent( const TClientId _nClient, const AccessibleEventObject& _rEvent ) { - std::vector< Reference< XInterface > > aListeners; + Sequence< Reference< XInterface > > aListeners; // --- <mutex lock> ------------------------------- { @@ -267,22 +267,25 @@ namespace comphelper return; // since we're synchronous, again, we want to notify immediately - aListeners = aClientPos->second->getElementsAsVector(); + aListeners = aClientPos->second->getElements(); } // --- </mutex lock> ------------------------------ - // default handling: loop through all listeners, and notify them - for ( const Reference< XInterface > & rL : aListeners ) + // default handling: loop through all listeners, and notify them + const Reference< XInterface >* pListeners = aListeners.getConstArray(); + const Reference< XInterface >* pListenersEnd = pListeners + aListeners.getLength(); + while ( pListeners != pListenersEnd ) { try { - static_cast< XAccessibleEventListener* >( rL.get() )->notifyEvent( _rEvent ); + static_cast< XAccessibleEventListener* >( pListeners->get() )->notifyEvent( _rEvent ); } catch( const Exception& ) { // no assertion, because a broken access remote bridge or something like this // can cause this exception } + ++pListeners; } } diff --git a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx index e98aab205adc..ff7c7925276c 100644 --- a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx +++ b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx @@ -112,11 +112,12 @@ namespace cppu_ifcontainer pContainer->addInterface(xRef); aListeners.push_back(xRef); } - std::vector< Reference< XInterface > > aElements = pContainer->getElementsAsVector(); + Sequence< Reference< XInterface > > aElements; + aElements = pContainer->getElements(); CPPUNIT_ASSERT_MESSAGE("query contents", - (int)aElements.size() == nTests); - if ((int)aElements.size() == nTests) + (int)aElements.getLength() == nTests); + if ((int)aElements.getLength() == nTests) { for (i = 0; i < nTests; i++) { @@ -156,8 +157,8 @@ namespace cppu_ifcontainer pHelper = pContainer->getContainer(pTypes[i]); CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); - std::vector<Reference< XInterface > > aSeq = pHelper->getElementsAsVector(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.size() == 2); + Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); + CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 2); CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]); CPPUNIT_ASSERT_MESSAGE("match", aSeq[1] == xRefs[i*2+1]); } @@ -174,8 +175,8 @@ namespace cppu_ifcontainer pHelper = pContainer->getContainer(pTypes[i]); CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); - std::vector<Reference< XInterface > > aSeq = pHelper->getElementsAsVector(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.size() == 1); + Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); + CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 1); CPPUNIT_ASSERT_MESSAGE("match", aSeq[0] == xRefs[i*2]); } @@ -190,8 +191,8 @@ namespace cppu_ifcontainer pHelper = pContainer->getContainer(pTypes[i]); CPPUNIT_ASSERT_MESSAGE("no helper", pHelper != NULL); - std::vector<Reference< XInterface > > aSeq = pHelper->getElementsAsVector(); - CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.size() == 0); + Sequence<Reference< XInterface > > aSeq = pHelper->getElements(); + CPPUNIT_ASSERT_MESSAGE("wrong num elements", aSeq.getLength() == 0); } delete pContainer; diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map index 1a15f35be3ff..12c29834ab16 100644 --- a/cppuhelper/source/gcc3.map +++ b/cppuhelper/source/gcc3.map @@ -430,12 +430,6 @@ global: _ZN4cppu15supportsServiceEPN3com3sun4star4lang12XServiceInfoERKN3rtl8OUStringE; # cppu::supportsService(com::sun::star::lang::XServiceInfo*, rtl::OUString const&) } UDK_3.8; - -PRIVATE_cppuhelper.1 { # LibreOffice 5.1 - global: - _ZNK4cppu25OInterfaceContainerHelper19getElementsAsVectorEv; # std::vector< Reference<XInterface> > OInterfaceContainerHelper::getElementsAsVector() const -}; - # Unique libstdc++ symbols: GLIBCXX_3.4 { global: diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx index 93a38363f8a6..5bd20a442128 100644 --- a/cppuhelper/source/interfacecontainer.cxx +++ b/cppuhelper/source/interfacecontainer.cxx @@ -28,7 +28,6 @@ #include <memory> #include <com/sun/star/lang/XEventListener.hpp> -#include <iterator> using namespace osl; @@ -37,6 +36,32 @@ using namespace com::sun::star::lang; namespace cppu { +/** + * Reallocate the sequence. + */ +static void realloc( Sequence< Reference< XInterface > > & rSeq, sal_Int32 nNewLen ) +{ + rSeq.realloc( nNewLen ); +} + +/** + * Remove an element from an interface sequence. + */ +static void sequenceRemoveElementAt( Sequence< Reference< XInterface > > & rSeq, sal_Int32 index ) +{ + sal_Int32 nNewLen = rSeq.getLength() - 1; + + Sequence< Reference< XInterface > > aDestSeq( rSeq.getLength() - 1 ); + // getArray on a const sequence is faster + const Reference< XInterface > * pSource = ((const Sequence< Reference< XInterface > > &)rSeq).getConstArray(); + Reference< XInterface > * pDest = aDestSeq.getArray(); + sal_Int32 i = 0; + for( ; i < index; i++ ) + pDest[i] = pSource[i]; + for( sal_Int32 j = i ; j < nNewLen; j++ ) + pDest[j] = pSource[j+1]; + rSeq = aDestSeq; +} #ifdef _MSC_VER #pragma warning( disable: 4786 ) @@ -54,7 +79,7 @@ OInterfaceIteratorHelper::OInterfaceIteratorHelper( OInterfaceContainerHelper & if( bIsList ) { rCont.bInUse = sal_True; - nRemain = aData.pAsVector->size(); + nRemain = aData.pAsSequence->getLength(); } else if( aData.pAsInterface ) { @@ -71,7 +96,7 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper() { MutexGuard aGuard( rCont.rMutex ); // bResetInUse protect the iterator against recursion - bShared = aData.pAsVector == rCont.aData.pAsVector && rCont.bIsList; + bShared = aData.pAsSequence == rCont.aData.pAsSequence && rCont.bIsList; if( bShared ) { OSL_ENSURE( rCont.bInUse, "OInterfaceContainerHelper must be in use" ); @@ -83,7 +108,7 @@ OInterfaceIteratorHelper::~OInterfaceIteratorHelper() { if( bIsList ) // Sequence owned by the iterator - delete aData.pAsVector; + delete aData.pAsSequence; else if( aData.pAsInterface ) // Interface is acquired by the iterator aData.pAsInterface->release(); @@ -96,7 +121,8 @@ XInterface * OInterfaceIteratorHelper::next() { nRemain--; if( bIsList ) - return (*aData.pAsVector)[nRemain].get(); + // typecase to const,so the getArray method is faster + return aData.pAsSequence->getConstArray()[nRemain].get(); else if( aData.pAsInterface ) return aData.pAsInterface; } @@ -109,8 +135,8 @@ void OInterfaceIteratorHelper::remove() if( bIsList ) { OSL_ASSERT( nRemain >= 0 && - nRemain < static_cast<sal_Int32>(aData.pAsVector->size()) ); - XInterface * p = (*aData.pAsVector)[nRemain].get(); + nRemain < aData.pAsSequence->getLength() ); + XInterface * p = aData.pAsSequence->getConstArray()[nRemain].get(); rCont.removeInterface( * reinterpret_cast< const Reference< XInterface > * >( &p ) ); } else @@ -131,7 +157,7 @@ OInterfaceContainerHelper::~OInterfaceContainerHelper() { OSL_ENSURE( !bInUse, "~OInterfaceContainerHelper but is in use" ); if( bIsList ) - delete aData.pAsVector; + delete aData.pAsSequence; else if( aData.pAsInterface ) aData.pAsInterface->release(); } @@ -140,30 +166,17 @@ sal_Int32 OInterfaceContainerHelper::getLength() const { MutexGuard aGuard( rMutex ); if( bIsList ) - return aData.pAsVector->size(); + return aData.pAsSequence->getLength(); else if( aData.pAsInterface ) return 1; return 0; } -std::vector< Reference<XInterface> > OInterfaceContainerHelper::getElementsAsVector() const -{ - MutexGuard aGuard( rMutex ); - if( bIsList ) - return *aData.pAsVector; - else if( aData.pAsInterface ) - { - Reference<XInterface> x( aData.pAsInterface ); - return { x }; - } - return std::vector< Reference< XInterface > >(); -} - -css::uno::Sequence< Reference<XInterface> > OInterfaceContainerHelper::getElements() const +Sequence< Reference<XInterface> > OInterfaceContainerHelper::getElements() const { MutexGuard aGuard( rMutex ); if( bIsList ) - return css::uno::Sequence< Reference<XInterface> >( aData.pAsVector->data(), static_cast<sal_Int32>(aData.pAsVector->size()) ); + return *aData.pAsSequence; else if( aData.pAsInterface ) { Reference<XInterface> x( aData.pAsInterface ); @@ -180,7 +193,7 @@ void OInterfaceContainerHelper::copyAndResetInUse() // this should be the worst case. If a iterator is active // and a new Listener is added. if( bIsList ) - aData.pAsVector = new std::vector< Reference< XInterface > >( *aData.pAsVector ); + aData.pAsSequence = new Sequence< Reference< XInterface > >( *aData.pAsSequence ); else if( aData.pAsInterface ) aData.pAsInterface->acquire(); @@ -197,16 +210,19 @@ sal_Int32 OInterfaceContainerHelper::addInterface( const Reference<XInterface> & if( bIsList ) { - aData.pAsVector->push_back( rListener ); - return aData.pAsVector->size(); + sal_Int32 nLen = aData.pAsSequence->getLength(); + realloc( *aData.pAsSequence, nLen +1 ); + aData.pAsSequence->getArray()[ nLen ] = rListener; + return nLen +1; } else if( aData.pAsInterface ) { - std::vector< Reference< XInterface > > * pSeq = new std::vector< Reference< XInterface > >( 2 ); - (*pSeq)[0] = aData.pAsInterface; - (*pSeq)[1] = rListener; + Sequence< Reference< XInterface > > * pSeq = new Sequence< Reference< XInterface > >( 2 ); + Reference<XInterface> * pArray = pSeq->getArray(); + pArray[0] = aData.pAsInterface; + pArray[1] = rListener; aData.pAsInterface->release(); - aData.pAsVector = pSeq; + aData.pAsSequence = pSeq; bIsList = sal_True; return 2; } @@ -228,41 +244,43 @@ sal_Int32 OInterfaceContainerHelper::removeInterface( const Reference<XInterface if( bIsList ) { - // It is not valid to compare the pointer directly, but it's faster. - bool bFound = false; - for( auto it = std::begin(*aData.pAsVector); it != std::end(*aData.pAsVector); ++it ) + const Reference<XInterface> * pL = aData.pAsSequence->getConstArray(); + sal_Int32 nLen = aData.pAsSequence->getLength(); + sal_Int32 i; + for( i = 0; i < nLen; i++ ) { - if( (*it).get() == rListener.get() ) + // It is not valid to compare the pointer directly, but it's faster. + if( pL[i].get() == rListener.get() ) { - aData.pAsVector->erase(it); - bFound = true; + sequenceRemoveElementAt( *aData.pAsSequence, i ); break; } } - if (!bFound) + + if( i == nLen ) { // interface not found, use the correct compare method - for( auto it = std::begin(*aData.pAsVector); it != std::end(*aData.pAsVector); ++it ) + for( i = 0; i < nLen; i++ ) { - if( *it == rListener ) + if( pL[i] == rListener ) { - aData.pAsVector->erase(it); + sequenceRemoveElementAt(*aData.pAsSequence, i ); break; } } } - if( aData.pAsVector->size() == 1 ) + if( aData.pAsSequence->getLength() == 1 ) { - XInterface * p = (*aData.pAsVector)[0].get(); + XInterface * p = aData.pAsSequence->getConstArray()[0].get(); p->acquire(); - delete aData.pAsVector; + delete aData.pAsSequence; aData.pAsInterface = p; bIsList = sal_False; return 1; } else - return aData.pAsVector->size(); + return aData.pAsSequence->getLength(); } else if( aData.pAsInterface && Reference<XInterface>( aData.pAsInterface ) == rListener ) { diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 8220327af727..f1723a96f4fe 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -104,15 +104,22 @@ com_sun_star_comp_dba_ORowSet_get_implementation(css::uno::XComponentContext* co } #define NOTIFY_LISTERNERS_CHECK(_rListeners,T,method) \ - std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElementsAsVector(); \ + Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ + \ + const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \ + const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \ \ _rGuard.clear(); \ bool bCheck = true; \ - for( auto iter = aListenerSeq.rbegin(); iter != aListenerSeq.rend() && bCheck; ++iter ) \ + while( pxInt > pxIntBegin && bCheck ) \ { \ try \ { \ - bCheck = static_cast< T* >( (*iter).get() )->method(aEvt); \ + while( pxInt > pxIntBegin && bCheck ) \ + { \ + --pxInt; \ + bCheck = static_cast< T* >( pxInt->get() )->method(aEvt); \ + } \ } \ catch( RuntimeException& ) \ { \ diff --git a/dbaccess/source/inc/apitools.hxx b/dbaccess/source/inc/apitools.hxx index 583fff3bda82..6672420abac6 100644 --- a/dbaccess/source/inc/apitools.hxx +++ b/dbaccess/source/inc/apitools.hxx @@ -328,14 +328,21 @@ public: return new ::cppu::OPropertyArrayHelper(aDescriptor); #define NOTIFY_LISTERNERS(_rListeners,T,method) \ - std::vector< Reference< XInterface > > aListenerSeq = _rListeners.getElementsAsVector(); \ + Sequence< Reference< XInterface > > aListenerSeq = _rListeners.getElements(); \ + \ + const Reference< XInterface >* pxIntBegin = aListenerSeq.getConstArray(); \ + const Reference< XInterface >* pxInt = pxIntBegin + aListenerSeq.getLength(); \ \ _rGuard.clear(); \ - for( auto iter = aListenerSeq.rbegin(); iter != aListenerSeq.rend(); ++iter ) \ + while( pxInt > pxIntBegin ) \ { \ try \ { \ - static_cast< T* >( (*iter).get() )->method(aEvt); \ + while( pxInt > pxIntBegin ) \ + { \ + --pxInt; \ + static_cast< T* >( pxInt->get() )->method(aEvt); \ + } \ } \ catch( RuntimeException& ) \ { \ diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index 6963e8679f07..720e8abf005c 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -596,10 +596,10 @@ void Package::fireModified() ::cppu::OInterfaceContainerHelper * container = rBHelper.getContainer( cppu::UnoType<util::XModifyListener>::get() ); if (container != 0) { - std::vector< Reference<XInterface> > elements( - container->getElementsAsVector() ); + Sequence< Reference<XInterface> > elements( + container->getElements() ); lang::EventObject evt( static_cast<OWeakObject *>(this) ); - for ( sal_Int32 pos = 0; pos < (sal_Int32)elements.size(); ++pos ) + for ( sal_Int32 pos = 0; pos < elements.getLength(); ++pos ) { Reference<util::XModifyListener> xListener( elements[ pos ], UNO_QUERY ); diff --git a/embedserv/source/embed/intercept.cxx b/embedserv/source/embed/intercept.cxx index e335d122c6ae..20dcfd116511 100644 --- a/embedserv/source/embed/intercept.cxx +++ b/embedserv/source/embed/intercept.cxx @@ -218,10 +218,10 @@ void Interceptor::generateFeatureStateEvent() cppu::OInterfaceContainerHelper* pICH = m_pStatCL->getContainer(m_aInterceptedURL[i]); - std::vector<uno::Reference<uno::XInterface> > aSeq; + uno::Sequence<uno::Reference<uno::XInterface> > aSeq; if(pICH) - aSeq = pICH->getElementsAsVector(); - if(aSeq.empty()) + aSeq = pICH->getElements(); + if(!aSeq.getLength()) continue; frame::FeatureStateEvent aStateEvent; @@ -249,11 +249,13 @@ void Interceptor::generateFeatureStateEvent() } - for(uno::Reference<uno::XInterface> & x : aSeq) + for(sal_Int32 k = 0; k < aSeq.getLength(); ++k) { - uno::Reference<frame::XStatusListener> Control(x,uno::UNO_QUERY); + uno::Reference<frame::XStatusListener> + Control(aSeq[k],uno::UNO_QUERY); if(Control.is()) Control->statusChanged(aStateEvent); + } } } diff --git a/include/cppuhelper/interfacecontainer.h b/include/cppuhelper/interfacecontainer.h index 74338f6074fd..a29eba04e752 100644 --- a/include/cppuhelper/interfacecontainer.h +++ b/include/cppuhelper/interfacecontainer.h @@ -47,7 +47,7 @@ namespace detail { */ union element_alias { - std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > *pAsVector; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > *pAsSequence; ::com::sun::star::uno::XInterface * pAsInterface; element_alias() : pAsInterface(0) {} }; @@ -155,18 +155,10 @@ public: */ sal_Int32 SAL_CALL getLength() const; -#ifdef LIBO_INTERNAL_ONLY /** Return all interfaces added to this container. - @since LibreOffice 5.1 - Not exposed because std::vector is problematic for an ABI **/ - std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > SAL_CALL getElementsAsVector() const; -#endif - /** - Return all interfaces added to this container. - **/ - css::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > SAL_CALL getElements() const; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > SAL_CALL getElements() const; /** Inserts an element into the container. The position is not specified, thus it is not specified in which order events are fired. @@ -244,14 +236,14 @@ public: private: friend class OInterfaceIteratorHelper; /** - bIsList == TRUE -> aData.pAsVector of type std::vector< XInterface >, + bIsList == TRUE -> aData.pAsSequence of type Sequence< XInterfaceSequence >, otherwise aData.pAsInterface == of type (XEventListener *) */ detail::element_alias aData; ::osl::Mutex & rMutex; /** TRUE -> used by an iterator. */ sal_Bool bInUse; - /** TRUE -> aData.pAsVector is of type std::vector< XInterface >. */ + /** TRUE -> aData.pAsSequence is of type Sequence< XInterfaceSequence >. */ sal_Bool bIsList; OInterfaceContainerHelper( const OInterfaceContainerHelper & ) diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index b5ec70bdba6a..94c29dcc50dd 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -410,19 +410,32 @@ void SAL_CALL ScCellFieldsObj::refresh( ) if (mpRefreshListeners) { // Call all listeners. - std::vector< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElementsAsVector()); - if (!aListeners.empty()) + uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements()); + sal_uInt32 nLength(aListeners.getLength()); + if (nLength) { - lang::EventObject aEvent; - aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); - for (auto & x : aListeners) + const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray(); + if (pInterfaces) { - try - { - static_cast< util::XRefreshListener* >(x.get())->refreshed(aEvent); - } - catch(uno::RuntimeException&) + lang::EventObject aEvent; + aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); + sal_uInt32 i(0); + while (i < nLength) { + try + { + while(i < nLength) + { + static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent); + ++pInterfaces; + ++i; + } + } + catch(uno::RuntimeException&) + { + ++pInterfaces; + ++i; + } } } } @@ -577,19 +590,32 @@ void SAL_CALL ScHeaderFieldsObj::refresh( ) if (mpRefreshListeners) { // Call all listeners. - std::vector< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElementsAsVector()); - if (!aListeners.empty()) + uno::Sequence< uno::Reference< uno::XInterface > > aListeners(mpRefreshListeners->getElements()); + sal_uInt32 nLength(aListeners.getLength()); + if (nLength) { - lang::EventObject aEvent; - aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); - for (auto & x : aListeners) + const uno::Reference< uno::XInterface >* pInterfaces = aListeners.getConstArray(); + if (pInterfaces) { - try - { - static_cast< util::XRefreshListener* >(x.get())->refreshed(aEvent); - } - catch(uno::RuntimeException&) + lang::EventObject aEvent; + aEvent.Source.set(uno::Reference< util::XRefreshable >(this)); + sal_uInt32 i(0); + while (i < nLength) { + try + { + while(i < nLength) + { + static_cast< util::XRefreshListener* >(pInterfaces->get())->refreshed(aEvent); + ++pInterfaces; + ++i; + } + } + catch(uno::RuntimeException&) + { + ++pInterfaces; + ++i; + } } } } diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 86d9ba39f9e4..4ed628920757 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -345,13 +345,14 @@ bool SdStyleSheet::IsUsed() const OInterfaceContainerHelper * pContainer = mrBHelper.getContainer( cppu::UnoType<XModifyListener>::get() ); if( pContainer ) { - for( auto & x : pContainer->getElements() ) + Sequence< Reference< XInterface > > aModifyListeners( pContainer->getElements() ); + Reference< XInterface > *p = aModifyListeners.getArray(); + sal_Int32 nCount = aModifyListeners.getLength(); + while( nCount-- && !bResult ) { - Reference< XStyle > xStyle( x, UNO_QUERY ); - if( xStyle.is() ) { + Reference< XStyle > xStyle( *p++, UNO_QUERY ); + if( xStyle.is() ) bResult = xStyle->isInUse(); - break; - } } } } diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index a8b567f31dc9..54b4a905f88a 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -2282,11 +2282,11 @@ void SfxDocumentMetaData::createUserDefined() m_xUserDefined, css::uno::UNO_QUERY); if (xMB.is()) { - const std::vector<css::uno::Reference<css::uno::XInterface> > - listeners(m_NotifyListeners.getElementsAsVector()); - for (css::uno::Reference< css::uno::XInterface > const & iter : listeners) { + const css::uno::Sequence<css::uno::Reference<css::uno::XInterface> > + listeners(m_NotifyListeners.getElements()); + for (css::uno::Reference< css::uno::XInterface > const * iter = listeners.begin(); iter != listeners.end(); ++iter) { xMB->addModifyListener( - css::uno::Reference< css::util::XModifyListener >(iter, + css::uno::Reference< css::util::XModifyListener >(*iter, css::uno::UNO_QUERY)); } } diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index 2f0dbc92cf7a..66c05447861e 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -235,10 +235,10 @@ sal_Bool SAL_CALL TableDesignStyle::isInUse() throw (RuntimeException, std::exce OInterfaceContainerHelper * pContainer = rBHelper.getContainer( cppu::UnoType<XModifyListener>::get() ); if( pContainer ) { - std::vector< Reference< XInterface > > aListener( pContainer->getElementsAsVector() ); + Sequence< Reference< XInterface > > aListener( pContainer->getElements() ); aGuard.clear(); - sal_Int32 nIndex = aListener.size(); + sal_Int32 nIndex = aListener.getLength(); while( --nIndex >= 0 ) { TableDesignUser* pUser = dynamic_cast< TableDesignUser* >( aListener[nIndex].get() ); diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx index 1a94ecf2b5b3..20133ca6faf1 100644 --- a/svx/source/unodraw/unoshcol.cxx +++ b/svx/source/unodraw/unoshcol.cxx @@ -229,10 +229,10 @@ uno::Any SAL_CALL SvxShapeCollection::getByIndex( sal_Int32 Index ) if( Index < 0 || Index >= getCount() ) throw lang::IndexOutOfBoundsException(); - std::vector< Reference< uno::XInterface> > xElements( maShapeContainer.getElementsAsVector() ); + uno::Sequence< Reference< uno::XInterface> > xElements( maShapeContainer.getElements() ); - return uno::makeAny( Reference< drawing::XShape>(static_cast< drawing::XShape* >( xElements[Index].get())) ); + return uno::makeAny( Reference< drawing::XShape>(static_cast< drawing::XShape* >( xElements.getArray()[Index].get())) ); } // XElementAccess diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index ce25b2bba160..cf141577038e 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -1757,13 +1757,13 @@ void VCLXToolkit::callTopWindowListeners( = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); if (pWindow->IsTopWindow()) { - std::vector< css::uno::Reference< css::uno::XInterface > > - aListeners(m_aTopWindowListeners.getElementsAsVector()); - if (!aListeners.empty()) + css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > + aListeners(m_aTopWindowListeners.getElements()); + if (aListeners.hasElements()) { css::lang::EventObject aAwtEvent( static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer())); - for (::sal_Int32 i = 0; i < (sal_Int32)aListeners.size(); ++i) + for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) { css::uno::Reference< css::awt::XTopWindowListener > xListener(aListeners[i], css::uno::UNO_QUERY); @@ -1786,10 +1786,10 @@ void VCLXToolkit::callTopWindowListeners( long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent, bool bPressed) { - std::vector< css::uno::Reference< css::uno::XInterface > > - aHandlers(m_aKeyHandlers.getElementsAsVector()); + css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > + aHandlers(m_aKeyHandlers.getElements()); - if (!aHandlers.empty()) + if (aHandlers.hasElements()) { vcl::Window * pWindow = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); @@ -1809,7 +1809,7 @@ long VCLXToolkit::callKeyHandlers(::VclSimpleEvent const * pEvent, pKeyEvent->GetKeyCode().GetCode(), pKeyEvent->GetCharCode(), sal::static_int_cast< sal_Int16 >( pKeyEvent->GetKeyCode().GetFunction())); - for (::sal_Int32 i = 0; i < (sal_Int32)aHandlers.size(); ++i) + for (::sal_Int32 i = 0; i < aHandlers.getLength(); ++i) { css::uno::Reference< css::awt::XKeyHandler > xHandler( aHandlers[i], css::uno::UNO_QUERY); @@ -1838,9 +1838,9 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, = static_cast< ::VclWindowEvent const * >(pEvent)->GetWindow(); if (pWindow->IsTopWindow()) { - std::vector< css::uno::Reference< css::uno::XInterface > > - aListeners(m_aFocusListeners.getElementsAsVector()); - if (!aListeners.empty()) + css::uno::Sequence< css::uno::Reference< css::uno::XInterface > > + aListeners(m_aFocusListeners.getElements()); + if (aListeners.hasElements()) { // Ignore the interior of compound controls when determining the // window that gets the focus next (see implementation in @@ -1859,7 +1859,7 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()), static_cast<sal_Int16>(pWindow->GetGetFocusFlags()), xNext, false); - for (size_t i = 0; i < aListeners.size(); ++i) + for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) { css::uno::Reference< css::awt::XFocusListener > xListener( aListeners[i], css::uno::UNO_QUERY); diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index b064aff4c295..a7eff04a42e5 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -916,11 +916,13 @@ void ControlModelContainerBase::implNotifyTabModelChange( const OUString& _rAcce aEvent.Changes[ 0 ].Accessor <<= _rAccessor; - std::vector< Reference< XInterface > > aChangeListeners( maChangeListeners.getElementsAsVector() ); - for ( Reference< XInterface > & rListener : aChangeListeners ) + Sequence< Reference< XInterface > > aChangeListeners( maChangeListeners.getElements() ); + const Reference< XInterface >* pListener = aChangeListeners.getConstArray(); + const Reference< XInterface >* pListenerEnd = aChangeListeners.getConstArray() + aChangeListeners.getLength(); + for ( ; pListener != pListenerEnd; ++pListener ) { - if ( rListener.is() ) - static_cast< XChangesListener* >( rListener.get() )->changesOccurred( aEvent ); + if ( pListener->is() ) + static_cast< XChangesListener* >( pListener->get() )->changesOccurred( aEvent ); } } diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx index 820fda51b564..e4d8159c0dc5 100644 --- a/ucb/source/ucp/file/filrset.cxx +++ b/ucb/source/ucp/file/filrset.cxx @@ -162,11 +162,11 @@ XResultSet_impl::dispose() void XResultSet_impl::rowCountChanged() { sal_Int32 aOldValue,aNewValue; - std::vector< uno::Reference< uno::XInterface > > seq; + uno::Sequence< uno::Reference< uno::XInterface > > seq; { osl::MutexGuard aGuard( m_aMutex ); if( m_pRowCountListeners ) - seq = m_pRowCountListeners->getElementsAsVector(); + seq = m_pRowCountListeners->getElements(); aNewValue = m_aItems.size(); aOldValue = aNewValue-1; } @@ -176,7 +176,7 @@ void XResultSet_impl::rowCountChanged() aEv.PropertyHandle = -1; aEv.OldValue <<= aOldValue; aEv.NewValue <<= aNewValue; - for( sal_Int32 i = 0; i < (sal_Int32)seq.size(); ++i ) + for( sal_Int32 i = 0; i < seq.getLength(); ++i ) { uno::Reference< beans::XPropertyChangeListener > listener( seq[i], uno::UNO_QUERY ); @@ -188,11 +188,11 @@ void XResultSet_impl::rowCountChanged() void XResultSet_impl::isFinalChanged() { - std::vector< uno::Reference< XInterface > > seq; + uno::Sequence< uno::Reference< XInterface > > seq; { osl::MutexGuard aGuard( m_aMutex ); if( m_pIsFinalListeners ) - seq = m_pIsFinalListeners->getElementsAsVector(); + seq = m_pIsFinalListeners->getElements(); m_bRowCountFinal = true; } beans::PropertyChangeEvent aEv; @@ -203,7 +203,7 @@ void XResultSet_impl::isFinalChanged() bool tval = true; aEv.OldValue <<= fval; aEv.NewValue <<= tval; - for( sal_Int32 i = 0; i < (sal_Int32)seq.size(); ++i ) + for( sal_Int32 i = 0; i < seq.getLength(); ++i ) { uno::Reference< beans::XPropertyChangeListener > listener( seq[i], uno::UNO_QUERY ); |