From 5b1bd78bbaf09ecdd375f488b92a271b0b579b04 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 26 Oct 2015 12:59:01 +0200 Subject: boost::ptr_vector->std::vector no need to store uno::Reference objects on the heap Change-Id: I015c9c4f89a5520e874f4bf523129682d7da579c --- sc/source/ui/unoobj/viewuno.cxx | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'sc/source') diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 556be91cba78..bd93e98715d4 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -1336,7 +1336,7 @@ void ScTabViewObj::EndMouseListening() { lang::EventObject aEvent; aEvent.Source = static_cast(this); - for (const XMouseClickHandlerUnoRef rListener : aMouseClickHandlers) + for (const auto& rListener : aMouseClickHandlers) { try { @@ -1353,7 +1353,7 @@ void ScTabViewObj::EndActivationListening() { lang::EventObject aEvent; aEvent.Source = static_cast(this); - for (const XActivationEventListenerUnoRef rListener : aActivationListeners) + for (const auto& rListener : aActivationListeners) { try { @@ -1373,9 +1373,7 @@ void SAL_CALL ScTabViewObj::addEnhancedMouseClickHandler( const uno::Reference< if (aListener.is()) { - uno::Reference *pObj = - new uno::Reference( aListener ); - aMouseClickHandlers.push_back( pObj ); + aMouseClickHandlers.push_back( aListener ); } } @@ -1404,9 +1402,7 @@ void SAL_CALL ScTabViewObj::addActivationEventListener( const uno::Reference< sh if (aListener.is()) { - uno::Reference *pObj = - new uno::Reference( aListener ); - aActivationListeners.push_back( pObj ); + aActivationListeners.push_back( aListener ); } } @@ -1696,9 +1692,7 @@ void SAL_CALL ScTabViewObj::addSelectionChangeListener( throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - uno::Reference* pObj = - new uno::Reference( xListener ); - aSelectionChgListeners.push_back( pObj ); + aSelectionChgListeners.push_back( xListener ); } void SAL_CALL ScTabViewObj::removeSelectionChangeListener( @@ -1729,7 +1723,7 @@ void ScTabViewObj::SelectionChanged() aShell.ExecuteStyle( aReq ); lang::EventObject aEvent; aEvent.Source.set(static_cast(this)); - for (const XSelectionChangeListenerUnoRef rListener : aSelectionChgListeners) + for (const auto& rListener : aSelectionChgListeners) rListener->selectionChanged( aEvent ); // handle sheet events @@ -1978,9 +1972,7 @@ void SAL_CALL ScTabViewObj::addPropertyChangeListener( const OUString& /* aPrope std::exception) { SolarMutexGuard aGuard; - uno::Reference* pObj = - new uno::Reference( xListener ); - aPropertyChgListeners.push_back( pObj ); + aPropertyChgListeners.push_back( xListener ); } void SAL_CALL ScTabViewObj::removePropertyChangeListener( const OUString& /* aPropertyName */, @@ -2021,7 +2013,7 @@ void ScTabViewObj::VisAreaChanged() { beans::PropertyChangeEvent aEvent; aEvent.Source.set(static_cast(this)); - for (const XViewPropertyChangeListenerUnoRef rListener : aPropertyChgListeners) + for (const auto& rListener : aPropertyChgListeners) rListener->propertyChange( aEvent ); } @@ -2083,9 +2075,7 @@ void SAL_CALL ScTabViewObj::addRangeSelectionListener( throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - uno::Reference* pObj = - new uno::Reference( xListener ); - aRangeSelListeners.push_back( pObj ); + aRangeSelListeners.push_back( xListener ); } void SAL_CALL ScTabViewObj::removeRangeSelectionListener( @@ -2109,9 +2099,7 @@ void SAL_CALL ScTabViewObj::addRangeSelectionChangeListener( throw (uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - uno::Reference* pObj = - new uno::Reference( xListener ); - aRangeChgListeners.push_back( pObj ); + aRangeChgListeners.push_back( xListener ); } void SAL_CALL ScTabViewObj::removeRangeSelectionChangeListener( @@ -2139,7 +2127,7 @@ void ScTabViewObj::RangeSelDone( const OUString& rText ) // copy on the stack because listener could remove itself XRangeSelectionListenerVector const listeners(aRangeSelListeners); - for (const XRangeSelectionListenerUnoRef rListener : listeners) + for (const auto& rListener : listeners) rListener->done( aEvent ); } @@ -2152,7 +2140,7 @@ void ScTabViewObj::RangeSelAborted( const OUString& rText ) // copy on the stack because listener could remove itself XRangeSelectionListenerVector const listeners(aRangeSelListeners); - for (const XRangeSelectionListenerUnoRef rListener : listeners) + for (const auto& rListener : listeners) rListener->aborted( aEvent ); } @@ -2165,7 +2153,7 @@ void ScTabViewObj::RangeSelChanged( const OUString& rText ) // copy on the stack because listener could remove itself XRangeSelectionChangeListenerVector const listener(aRangeChgListeners); - for (const XRangeSelectionChangeListenerUnoRef rListener : listener) + for (const auto& rListener : listener) rListener->descriptorChanged( aEvent ); } -- cgit