diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-01-19 19:45:45 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-01-25 08:52:03 +0200 |
commit | 752cd07d085ac0aadc99bd512d49072843139032 (patch) | |
tree | 21ff2f55761b34bfdd721b5e1ed43333e8874e46 /chart2 | |
parent | 0e7cd653ea90da388820220bf6a3eb140b57bbd6 (diff) |
InterfaceContainer2 with vector instead of Sequence
create an InterfaceContainer2 class to replace InterfaceContainer.
It uses a std::vector instead of a Sequence for the mutable listener
list, which provides far better performance.
Switch all our internal use-sites to the new class.
Change-Id: I6b56cfa511ded2395faa22e68fab3b2f16c3cb88
Diffstat (limited to 'chart2')
16 files changed, 30 insertions, 38 deletions
diff --git a/chart2/inc/ChartModel.hxx b/chart2/inc/ChartModel.hxx index 41c6f33d533c..b473205c2b0c 100644 --- a/chart2/inc/ChartModel.hxx +++ b/chart2/inc/ChartModel.hxx @@ -60,7 +60,7 @@ #include <osl/mutex.hxx> #include <rtl/ref.hxx> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <svtools/grfmgr.hxx> #include <memory> @@ -130,7 +130,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties > m_xDocumentProperties; ::rtl::Reference< UndoManager > m_pUndoManager; - ::cppu::OInterfaceContainerHelper m_aControllers; + ::comphelper::OInterfaceContainerHelper2 m_aControllers; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xCurrentController; sal_uInt16 m_nControllerLockCount; diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx index ec0d858d4b7b..6ba98ac5e34a 100644 --- a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx @@ -22,7 +22,7 @@ #include "WrappedPropertySet.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -94,7 +94,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx index bc518df1dea2..e0dcf255d1eb 100644 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx @@ -23,7 +23,7 @@ #include "ReferenceSizePropertyProvider.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart/XAxis.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -131,7 +131,7 @@ private: //methods private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; tAxisType m_eType; diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 8c850b7ff7d0..dfde917be350 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -607,16 +607,7 @@ void ChartDataWrapper::fireChartDataChangeEvent( if( xSrc.is() ) aEvent.Source = xSrc; - ::cppu::OInterfaceIteratorHelper aIter( m_aEventListenerContainer ); - - while( aIter.hasMoreElements() ) - { - uno::Reference< - ::com::sun::star::chart::XChartDataChangeEventListener > xListener( - aIter.next(), uno::UNO_QUERY ); - if( xListener.is() ) - xListener->chartDataChanged( aEvent ); - } + m_aEventListenerContainer.notifyEach( &css::chart::XChartDataChangeEventListener::chartDataChanged, aEvent ); } void ChartDataWrapper::switchToInternalDataProvider() diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx index d5ab6d096110..0f2f2f958faf 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx @@ -21,7 +21,7 @@ #include "MutexContainer.hxx" #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> #include <com/sun/star/chart/XDateCategories.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -157,7 +157,7 @@ private: //member ::com::sun::star::chart2::XAnyDescriptionAccess > m_xDataAccess; std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx index b95d58505773..da6455a5925a 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx @@ -23,7 +23,7 @@ #include "ReferenceSizePropertyProvider.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart2/XDataSeries.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/lang/XComponent.hpp> @@ -126,7 +126,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; eType m_eType; sal_Int32 m_nSeriesIndexInNewAPI; diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx index bc2b0f33889c..0ec3eb56a7af 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx @@ -241,7 +241,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; ::com::sun::star::uno::Reference< ::com::sun::star::chart::XAxis > m_xXAxis; diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx index 590c232f00b7..a53e0b09e7b1 100644 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx @@ -22,7 +22,7 @@ #include "WrappedPropertySet.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -89,7 +89,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; tGridType m_eType; }; diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx index 2d6ea1c67705..8b1f1c2ed119 100644 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx @@ -23,7 +23,7 @@ #include "ReferenceSizePropertyProvider.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -102,7 +102,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; }; } // namespace wrapper diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx index e779fdeea04b..08748bfe12d5 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx @@ -21,7 +21,7 @@ #include "MutexContainer.hxx" #include "WrappedIgnoreProperty.hxx" -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart2/XDiagram.hpp> @@ -115,7 +115,7 @@ private: //methods private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; WrappedIgnoreProperty m_aWrappedLineJointProperty; }; diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx index 9bb457b38f30..648281f2310c 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx @@ -123,7 +123,7 @@ private: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; ::chart::TitleHelper::eTitleType m_eTitleType; }; diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx index ae6f08f10c09..938fe0881932 100644 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx @@ -20,7 +20,7 @@ #define INCLUDED_CHART2_SOURCE_CONTROLLER_CHARTAPIWRAPPER_UPDOWNBARWRAPPER_HXX #include "MutexContainer.hxx" -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/chart2/XDiagram.hpp> @@ -114,7 +114,7 @@ private: //methods private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; OUString m_aPropertySetName; }; diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx index f9e5429d9a86..3773f1fbb2c2 100644 --- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx +++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx @@ -22,7 +22,7 @@ #include "WrappedPropertySet.hxx" #include <cppuhelper/implbase.hxx> #include <comphelper/uno3.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -76,7 +76,7 @@ protected: private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; - ::cppu::OInterfaceContainerHelper m_aEventListenerContainer; + ::comphelper::OInterfaceContainerHelper2 m_aEventListenerContainer; bool m_bWall; }; diff --git a/chart2/source/controller/main/CommandDispatch.cxx b/chart2/source/controller/main/CommandDispatch.cxx index 35cbf08400df..ea7fd7a157f4 100644 --- a/chart2/source/controller/main/CommandDispatch.cxx +++ b/chart2/source/controller/main/CommandDispatch.cxx @@ -86,7 +86,7 @@ void SAL_CALL CommandDispatch::addStatusListener( const Reference< frame::XStatu { aIt = m_aListeners.insert( m_aListeners.begin(), - tListenerMap::value_type( URL.Complete, new ::cppu::OInterfaceContainerHelper( m_aMutex ))); + tListenerMap::value_type( URL.Complete, new ::comphelper::OInterfaceContainerHelper2( m_aMutex ))); } OSL_ASSERT( aIt != m_aListeners.end()); @@ -155,7 +155,7 @@ void CommandDispatch::fireStatusEventForURL( { if( aIt->second ) { - ::cppu::OInterfaceIteratorHelper aIntfIt( *((*aIt).second) ); + ::comphelper::OInterfaceIteratorHelper2 aIntfIt( *((*aIt).second) ); while( aIntfIt.hasMoreElements()) { diff --git a/chart2/source/controller/main/CommandDispatch.hxx b/chart2/source/controller/main/CommandDispatch.hxx index 6d9feb0849e7..928691554fd6 100644 --- a/chart2/source/controller/main/CommandDispatch.hxx +++ b/chart2/source/controller/main/CommandDispatch.hxx @@ -21,6 +21,7 @@ #include "MutexContainer.hxx" #include <cppuhelper/compbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/frame/XDispatch.hpp> #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -130,7 +131,7 @@ protected: ::com::sun::star::uno::Reference< ::com::sun::star::util::XURLTransformer > m_xURLTransformer; private: - typedef ::std::map< OUString, ::cppu::OInterfaceContainerHelper* > + typedef ::std::map< OUString, ::comphelper::OInterfaceContainerHelper2* > tListenerMap; tListenerMap m_aListeners; diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 3f7c8f3eb598..0b88e7546a0a 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -227,10 +227,10 @@ bool ChartModel::impl_isControllerConnected( const uno::Reference< frame::XContr { try { - uno::Sequence< uno::Reference<uno::XInterface> > aSeq = m_aControllers.getElements(); - for( sal_Int32 nN = aSeq.getLength(); nN--; ) + std::vector< uno::Reference<uno::XInterface> > aSeq = m_aControllers.getElements(); + for( const auto & r : aSeq ) { - if( aSeq[nN] == xController ) + if( r == xController ) return true; } } |