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 /sw | |
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 'sw')
-rw-r--r-- | sw/inc/unochart.hxx | 14 | ||||
-rw-r--r-- | sw/inc/unotbl.hxx | 4 | ||||
-rw-r--r-- | sw/source/core/access/accmap.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/unocore/unobkm.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unochart.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unofield.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/unoframe.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/unocore/unoftn.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/unocore/unoidx.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/unocore/unoparagraph.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unorefmk.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/unocore/unosect.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/unocore/unotbl.cxx | 19 | ||||
-rw-r--r-- | sw/source/uibase/inc/unomailmerge.hxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/inc/unotxvw.hxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomailmerge.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 4 |
17 files changed, 72 insertions, 51 deletions
diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx index 935db3d705e1..1ed58e83fa8c 100644 --- a/sw/inc/unochart.hxx +++ b/sw/inc/unochart.hxx @@ -42,7 +42,7 @@ #include <com/sun/star/chart/ChartDataRowSource.hpp> #include <com/sun/star/table/XCell.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/weakref.hxx> @@ -135,9 +135,9 @@ class SwChartDataProvider : // all tables of the document. mutable Map_Set_DataSequenceRef_t aDataSequences; - ::cppu::OInterfaceContainerHelper aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; const SwDoc * pDoc; - bool bDisposed; + bool bDisposed; SwChartDataProvider( const SwChartDataProvider & ) = delete; SwChartDataProvider & operator = ( const SwChartDataProvider & ) = delete; @@ -251,8 +251,8 @@ class SwChartDataSequence : public SwChartDataSequenceBaseClass, public SwClient { - ::cppu::OInterfaceContainerHelper m_aEvtListeners; - ::cppu::OInterfaceContainerHelper m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 m_aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 m_aModifyListeners; css::chart2::data::DataSequenceRole m_aRole; OUString m_aRowLabelText; @@ -362,8 +362,8 @@ SwChartLabeledDataSequenceBaseClass; class SwChartLabeledDataSequence : public SwChartLabeledDataSequenceBaseClass { - ::cppu::OInterfaceContainerHelper aEvtListeners; - ::cppu::OInterfaceContainerHelper aModifyListeners; + ::comphelper::OInterfaceContainerHelper2 aEvtListeners; + ::comphelper::OInterfaceContainerHelper2 aModifyListeners; css::uno::Reference< css::chart2::data::XDataSequence > xData; css::uno::Reference< css::chart2::data::XDataSequence > xLabels; diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx index e978aaa509b9..f79598e39934 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -33,7 +33,7 @@ #include <com/sun/star/table/XAutoFormattable.hpp> #include <cppuhelper/implbase.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <comphelper/uno3.hxx> @@ -451,7 +451,7 @@ class SwXCellRange : public cppu::WeakImplHelper public SwClient { ::osl::Mutex m_Mutex; - ::cppu::OInterfaceContainerHelper m_ChartListeners; + ::comphelper::OInterfaceContainerHelper2 m_ChartListeners; SwRangeDescriptor aRgDesc; const SfxItemPropertySet* m_pPropSet; diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 817bdfd2ebc9..1ddc0af5a2fa 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -60,6 +60,7 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <cppuhelper/implbase.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <pagepreviewlayout.hxx> #include <dcontact.hxx> #include <svx/unoapi.hxx> @@ -120,7 +121,7 @@ class SwDrawModellListener_Impl : public SfxListener, public ::cppu::WeakImplHelper< document::XEventBroadcaster > { mutable ::osl::Mutex maListenerMutex; - ::cppu::OInterfaceContainerHelper maEventListeners; + ::comphelper::OInterfaceContainerHelper2 maEventListeners; SdrModel *mpDrawModel; protected: virtual ~SwDrawModellListener_Impl(); @@ -180,7 +181,7 @@ void SwDrawModellListener_Impl::Notify( SfxBroadcaster& /*rBC*/, if( !SvxUnoDrawMSFactory::createEvent( mpDrawModel, pSdrHint, aEvent ) ) return; - ::cppu::OInterfaceIteratorHelper aIter( maEventListeners ); + ::comphelper::OInterfaceIteratorHelper2 aIter( maEventListeners ); while( aIter.hasMoreElements() ) { uno::Reference < document::XEventListener > xListener( aIter.next(), diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index e254fff477d8..0093fcdfa77b 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -19,7 +19,7 @@ #include <unobookmark.hxx> #include <osl/mutex.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> @@ -45,11 +45,11 @@ class SwXBookmark::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SwDoc * m_pDoc; ::sw::mark::IMark * m_pRegisteredBookmark; OUString m_sMarkName; diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index 5a251dd334d1..4bce779bc2f7 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -172,11 +172,11 @@ static osl::Mutex & GetChartMutex() } static void LaunchModifiedEvent( - ::cppu::OInterfaceContainerHelper &rICH, + ::comphelper::OInterfaceContainerHelper2 &rICH, const uno::Reference< uno::XInterface > &rxI ) { lang::EventObject aEvtObj( rxI ); - cppu::OInterfaceIteratorHelper aIt( rICH ); + comphelper::OInterfaceIteratorHelper2 aIt( rICH ); while (aIt.hasMoreElements()) { uno::Reference< util::XModifyListener > xRef( aIt.next(), uno::UNO_QUERY ); diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 289bce53e33f..e28803dd3be8 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -412,11 +412,11 @@ class SwXFieldMaster::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SwDoc* m_pDoc; @@ -1127,11 +1127,11 @@ class SwXTextField::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SwFormatField const* m_pFormatField; SwDoc * m_pDoc; @@ -2858,10 +2858,10 @@ sal_Bool SwXTextFieldMasters::hasElements() throw( uno::RuntimeException, std::e class SwXTextFieldTypes::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: - ::cppu::OInterfaceContainerHelper m_RefreshListeners; + ::comphelper::OInterfaceContainerHelper2 m_RefreshListeners; Impl() : m_RefreshListeners(m_Mutex) { } }; diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 36d69e20a3f6..b56143f683d4 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -1142,11 +1142,11 @@ bool SwOLEProperties_Impl::AnyToItemSet( class SwXFrame::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; Impl() : m_EventListeners(m_Mutex) { } }; diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index f805fc50f58f..101732863770 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -22,7 +22,7 @@ #include <utility> #include <osl/mutex.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> #include <comphelper/sequence.hxx> @@ -49,15 +49,15 @@ class SwXFootnote::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: SwXFootnote & m_rThis; uno::WeakReference<uno::XInterface> m_wThis; const bool m_bIsEndnote; - ::cppu::OInterfaceContainerHelper m_EventListeners; - bool m_bIsDescriptor; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; + bool m_bIsDescriptor; const SwFormatFootnote * m_pFormatFootnote; OUString m_sLabel; diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 8de8f1f35aa2..1d67b51125a2 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -30,6 +30,7 @@ #include <osl/mutex.hxx> #include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> #include <editeng/unolingu.hxx> @@ -318,7 +319,7 @@ class SwXDocumentIndex::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; @@ -1536,7 +1537,7 @@ class SwXDocumentIndexMark::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 SwXDocumentIndexMark & m_rThis; bool m_bInReplaceMark; @@ -1545,7 +1546,7 @@ public: uno::WeakReference<uno::XInterface> m_wThis; SfxItemPropertySet const& m_rPropSet; const TOXTypes m_eTOXType; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; bool m_bIsDescriptor; SwDepend m_TypeDepend; const SwTOXMark * m_pTOXMark; diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index f8d31c57cbb7..f2d976955da0 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -19,7 +19,7 @@ #include <unoparagraph.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <cmdid.h> @@ -105,12 +105,12 @@ class SwXParagraph::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: SwXParagraph & m_rThis; uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SfxItemPropertySet const& m_rPropSet; bool m_bIsDescriptor; sal_Int32 m_nSelectionStartPos; diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index 39650a219497..f90c4afb493a 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -22,7 +22,7 @@ #include <utility> #include <osl/mutex.hxx> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> @@ -46,11 +46,11 @@ class SwXReferenceMark::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; bool m_bIsDescriptor; SwDoc * m_pDoc; const SwFormatRefMark * m_pMarkFormat; @@ -637,11 +637,11 @@ class SwXMeta::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; ::std::unique_ptr<const TextRangeList_t> m_pTextPortions; // 3 possible states: not attached, attached, disposed bool m_bIsDisposed; diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 8c235fa89dcd..9f8333f1c7bd 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -22,7 +22,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/text/SectionFileLink.hpp> -#include <cppuhelper/interfacecontainer.h> +#include <comphelper/interfacecontainer2.hxx> #include <cppuhelper/supportsservice.hxx> #include <cmdid.h> @@ -102,13 +102,13 @@ class SwXTextSection::Impl : public SwClient { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: SwXTextSection & m_rThis; uno::WeakReference<uno::XInterface> m_wThis; const SfxItemPropertySet & m_rPropSet; - ::cppu::OInterfaceContainerHelper m_EventListeners; + ::comphelper::OInterfaceContainerHelper2 m_EventListeners; const bool m_bIndexHeader; bool m_bIsDescriptor; OUString m_sName; diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index bd6ced180468..e20b35bf9232 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -152,6 +152,23 @@ static void lcl_SendChartEvent(::cppu::OWeakObject & rSource, } static void lcl_SendChartEvent(::cppu::OWeakObject & rSource, + ::comphelper::OInterfaceContainerHelper2 & rListeners) +{ + if (!rListeners.getLength()) + return; + //TODO: find appropriate settings of the Event + chart::ChartDataChangeEvent event; + event.Source = & rSource; + event.Type = chart::ChartDataChangeType_ALL; + event.StartColumn = 0; + event.EndColumn = 1; + event.StartRow = 0; + event.EndRow = 1; + rListeners.notifyEach( + & chart::XChartDataChangeEventListener::chartDataChanged, event); +} + +static void lcl_SendChartEvent(::cppu::OWeakObject & rSource, ::cppu::OMultiTypeInterfaceContainerHelper & rListeners) { ::cppu::OInterfaceContainerHelper *const pContainer(rListeners.getContainer( @@ -1772,7 +1789,7 @@ void SwXTextTableCursor::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNe class SwXTextTable::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: uno::WeakReference<uno::XInterface> m_wThis; diff --git a/sw/source/uibase/inc/unomailmerge.hxx b/sw/source/uibase/inc/unomailmerge.hxx index 59bceace1160..94e4c1f86cab 100644 --- a/sw/source/uibase/inc/unomailmerge.hxx +++ b/sw/source/uibase/inc/unomailmerge.hxx @@ -22,6 +22,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <unotools/configitem.hxx> #include <com/sun/star/task/XJob.hpp> @@ -75,9 +76,9 @@ class SwXMailMerge : { friend class MailMergeExecuteFinalizer; - cppu::OInterfaceContainerHelper m_aEvtListeners; - cppu::OInterfaceContainerHelper m_aMergeListeners; - OPropertyListenerContainerHelper m_aPropListeners; + comphelper::OInterfaceContainerHelper2 m_aEvtListeners; + comphelper::OInterfaceContainerHelper2 m_aMergeListeners; + OPropertyListenerContainerHelper m_aPropListeners; const SfxItemPropertySet* m_pPropSet; diff --git a/sw/source/uibase/inc/unotxvw.hxx b/sw/source/uibase/inc/unotxvw.hxx index d95c8e635b57..629d2fcdb254 100644 --- a/sw/source/uibase/inc/unotxvw.hxx +++ b/sw/source/uibase/inc/unotxvw.hxx @@ -18,8 +18,9 @@ */ #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX + #include <sfx2/sfxbasecontroller.hxx> -#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/interfacecontainer2.hxx> #include <com/sun/star/embed/XEmbeddedObject.hpp> #include <com/sun/star/text/XTextViewCursor.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> @@ -58,7 +59,7 @@ class SwXTextView : public css::datatransfer::XTransferableSupplier, public SfxBaseController { - ::cppu::OInterfaceContainerHelper m_SelChangedListeners; + ::comphelper::OInterfaceContainerHelper2 m_SelChangedListeners; SwView* m_pView; const SfxItemPropertySet* m_pPropSet; // property map for SwXTextView properties diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index f8ff1a5370bf..8bb6332f686c 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -843,7 +843,7 @@ void SAL_CALL SwXMailMerge::cancel() throw (css::uno::RuntimeException, std::exc void SwXMailMerge::LaunchMailMergeEvent( const MailMergeEvent &rEvt ) const { - cppu::OInterfaceIteratorHelper aIt( const_cast<SwXMailMerge *>(this)->m_aMergeListeners ); + comphelper::OInterfaceIteratorHelper2 aIt( const_cast<SwXMailMerge *>(this)->m_aMergeListeners ); while (aIt.hasMoreElements()) { Reference< XMailMergeListener > xRef( aIt.next(), UNO_QUERY ); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 4a386fc8678f..2ebaf0efeacb 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -249,10 +249,10 @@ static void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell* pDocShell ) class SwXTextDocument::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 public: - ::cppu::OInterfaceContainerHelper m_RefreshListeners; + ::comphelper::OInterfaceContainerHelper2 m_RefreshListeners; Impl() : m_RefreshListeners(m_Mutex) { } |