diff options
Diffstat (limited to 'sw/source/uibase')
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/inc/unomailmerge.hxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/inc/unotxvw.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxvw.cxx | 24 |
5 files changed, 20 insertions, 31 deletions
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 7c9917a83825..8245b420295a 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -1369,13 +1369,9 @@ SwPasteContext::~SwPasteContext() // Invoke the listeners. uno::Sequence<beans::PropertyValue> aEvent{ aPropertyValue }; - comphelper::OInterfaceIteratorHelper2 it(m_rWrtShell.GetPasteListeners()); + comphelper::OInterfaceIteratorHelper3 it(m_rWrtShell.GetPasteListeners()); while (it.hasMoreElements()) - { - uno::Reference<text::XPasteListener> xListener(it.next(), UNO_QUERY); - if (xListener.is()) - xListener->notifyPasteEvent(aEvent); - } + it.next()->notifyPasteEvent(aEvent); } catch (const uno::Exception& rException) { diff --git a/sw/source/uibase/inc/unomailmerge.hxx b/sw/source/uibase/inc/unomailmerge.hxx index c94d385adb05..050e99ce806b 100644 --- a/sw/source/uibase/inc/unomailmerge.hxx +++ b/sw/source/uibase/inc/unomailmerge.hxx @@ -23,6 +23,7 @@ #include <cppuhelper/implbase.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <comphelper/interfacecontainer2.hxx> +#include <comphelper/interfacecontainer3.hxx> #include <comphelper/multiinterfacecontainer2.hxx> #include <com/sun/star/task/XJob.hpp> @@ -76,8 +77,8 @@ class SwXMailMerge final : { friend class MailMergeExecuteFinalizer; - comphelper::OInterfaceContainerHelper2 m_aEvtListeners; - comphelper::OInterfaceContainerHelper2 m_aMergeListeners; + comphelper::OInterfaceContainerHelper3<css::lang::XEventListener> 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 614f2ac2749d..9608ed619be0 100644 --- a/sw/source/uibase/inc/unotxvw.hxx +++ b/sw/source/uibase/inc/unotxvw.hxx @@ -20,7 +20,7 @@ #define INCLUDED_SW_SOURCE_UIBASE_INC_UNOTXVW_HXX #include <sfx2/sfxbasecontroller.hxx> -#include <comphelper/interfacecontainer2.hxx> +#include <comphelper/interfacecontainer3.hxx> #include <com/sun/star/text/XTextViewCursor.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XTextViewTextRangeSupplier.hpp> @@ -61,7 +61,7 @@ class SwXTextView final : public css::datatransfer::XTransferableTextSupplier, public SfxBaseController { - ::comphelper::OInterfaceContainerHelper2 m_SelChangedListeners; + ::comphelper::OInterfaceContainerHelper3<css::view::XSelectionChangeListener> m_SelChangedListeners; SwView* m_pView; const SfxItemPropertySet* m_pPropSet; // property map for SwXTextView properties diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 698e31cccdd0..60d5b2b9e4ce 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -259,10 +259,10 @@ static void lcl_DisposeView( SfxViewFrame* pToClose, SwDocShell const * pDocShel class SwXTextDocument::Impl { private: - ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2 + ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper3 public: - ::comphelper::OInterfaceContainerHelper2 m_RefreshListeners; + ::comphelper::OInterfaceContainerHelper3<css::util::XRefreshListener> m_RefreshListeners; Impl() : m_RefreshListeners(m_Mutex) { } @@ -2166,14 +2166,16 @@ void SAL_CALL SwXTextDocument::addRefreshListener( const Reference<util::XRefreshListener> & xListener) { // no need to lock here as m_pImpl is const and container threadsafe - m_pImpl->m_RefreshListeners.addInterface(xListener); + if (xListener) + m_pImpl->m_RefreshListeners.addInterface(xListener); } void SAL_CALL SwXTextDocument::removeRefreshListener( const Reference<util::XRefreshListener> & xListener) { // no need to lock here as m_pImpl is const and container threadsafe - m_pImpl->m_RefreshListeners.removeInterface(xListener); + if (xListener) + m_pImpl->m_RefreshListeners.removeInterface(xListener); } void SwXTextDocument::updateLinks( ) diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 7e133b9e78c2..d1636de920e9 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -718,28 +718,18 @@ void SwXTextView::NotifySelChanged() &view::XSelectionChangeListener::selectionChanged, aEvent); } -namespace { - struct DispatchListener - { - URL const & m_rURL; - Sequence<PropertyValue> const& m_rSeq; - explicit DispatchListener(URL const& rURL, - Sequence<PropertyValue> const& rSeq) - : m_rURL(rURL), m_rSeq(rSeq) { } - void operator()(uno::Reference<XDispatch> const & xListener) const - { - xListener->dispatch(m_rURL, m_rSeq); - } - }; -} - void SwXTextView::NotifyDBChanged() { URL aURL; aURL.Complete = OUString::createFromAscii(SwXDispatch::GetDBChangeURL()); - m_SelChangedListeners.forEach<XDispatch>( - DispatchListener(aURL, {})); + m_SelChangedListeners.forEach( + [&aURL] (const uno::Reference<XSelectionChangeListener>& xListener) + { + uno::Reference<XDispatch> xDispatch(xListener, UNO_QUERY); + if (xDispatch) + xDispatch->dispatch(aURL, {}); + }); } uno::Reference< beans::XPropertySetInfo > SAL_CALL SwXTextView::getPropertySetInfo( ) |