[Libreoffice-commits] core.git: sc/inc sc/source
Noel Grandin
noel at peralex.com
Mon Oct 26 04:00:08 PDT 2015
sc/inc/viewuno.hxx | 30 ++++++------------------------
sc/source/ui/unoobj/viewuno.cxx | 38 +++++++++++++-------------------------
2 files changed, 19 insertions(+), 49 deletions(-)
New commits:
commit 5b1bd78bbaf09ecdd375f488b92a271b0b579b04
Author: Noel Grandin <noel at peralex.com>
Date: Mon Oct 26 12:59:01 2015 +0200
boost::ptr_vector->std::vector
no need to store uno::Reference objects on the heap
Change-Id: I015c9c4f89a5520e874f4bf523129682d7da579c
diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index 4e919b5..fd5da4a 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -41,7 +41,6 @@
#include <com/sun/star/datatransfer/XTransferableSupplier.hpp>
#include "address.hxx"
-#include <boost/ptr_container/ptr_vector.hpp>
class ScTabViewShell;
class ScPreviewShell;
@@ -160,29 +159,12 @@ class ScTabViewObj : public ScViewPaneBase,
public com::sun::star::sheet::XSelectedSheetsSupplier
{
private:
- typedef ::com::sun::star::uno::Reference<
- ::com::sun::star::sheet::XRangeSelectionListener > XRangeSelectionListenerUnoRef;
- typedef boost::ptr_vector<XRangeSelectionListenerUnoRef> XRangeSelectionListenerVector;
-
- typedef ::com::sun::star::uno::Reference<
- ::com::sun::star::sheet::XRangeSelectionChangeListener > XRangeSelectionChangeListenerUnoRef;
- typedef boost::ptr_vector<XRangeSelectionChangeListenerUnoRef> XRangeSelectionChangeListenerVector;
-
- typedef ::com::sun::star::uno::Reference<
- ::com::sun::star::view::XSelectionChangeListener > XSelectionChangeListenerUnoRef;
- typedef boost::ptr_vector<XSelectionChangeListenerUnoRef> XSelectionChangeListenerVector;
-
- typedef ::com::sun::star::uno::Reference<
- ::com::sun::star::beans::XPropertyChangeListener > XViewPropertyChangeListenerUnoRef;
- typedef boost::ptr_vector<XViewPropertyChangeListenerUnoRef> XViewPropertyChangeListenerVector;
-
- typedef ::com::sun::star::uno::Reference<
- ::com::sun::star::awt::XEnhancedMouseClickHandler > XMouseClickHandlerUnoRef;
- typedef boost::ptr_vector<XMouseClickHandlerUnoRef> XMouseClickHandlerVector;
-
- typedef ::com::sun::star::uno::Reference<
- ::com::sun::star::sheet::XActivationEventListener > XActivationEventListenerUnoRef;
- typedef boost::ptr_vector<XActivationEventListenerUnoRef> XActivationEventListenerVector;
+ typedef std::vector<css::uno::Reference<css::sheet::XRangeSelectionListener> > XRangeSelectionListenerVector;
+ typedef std::vector<css::uno::Reference<css::sheet::XRangeSelectionChangeListener> > XRangeSelectionChangeListenerVector;
+ typedef std::vector<css::uno::Reference<css::view::XSelectionChangeListener> > XSelectionChangeListenerVector;
+ typedef std::vector<css::uno::Reference<css::beans::XPropertyChangeListener> > XViewPropertyChangeListenerVector;
+ typedef std::vector<css::uno::Reference<css::awt::XEnhancedMouseClickHandler> > XMouseClickHandlerVector;
+ typedef std::vector<css::uno::Reference<css::sheet::XActivationEventListener> > XActivationEventListenerVector;
SfxItemPropertySet aPropSet;
XSelectionChangeListenerVector aSelectionChgListeners;
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 556be91..bd93e98 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<cppu::OWeakObject*>(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<cppu::OWeakObject*>(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<awt::XEnhancedMouseClickHandler> *pObj =
- new uno::Reference<awt::XEnhancedMouseClickHandler>( 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<sheet::XActivationEventListener> *pObj =
- new uno::Reference<sheet::XActivationEventListener>( 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<view::XSelectionChangeListener>* pObj =
- new uno::Reference<view::XSelectionChangeListener>( 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<cppu::OWeakObject*>(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<beans::XPropertyChangeListener>* pObj =
- new uno::Reference<beans::XPropertyChangeListener>( 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<cppu::OWeakObject*>(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<sheet::XRangeSelectionListener>* pObj =
- new uno::Reference<sheet::XRangeSelectionListener>( 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<sheet::XRangeSelectionChangeListener>* pObj =
- new uno::Reference<sheet::XRangeSelectionChangeListener>( 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 );
}
More information about the Libreoffice-commits
mailing list