23#include <com/sun/star/lang/EventObject.hpp>
24#include <com/sun/star/lang/DisposedException.hpp>
39template <
class ListenerT>
class OInterfaceContainerHelper3;
75 css::uno::Reference<ListenerT>
const&
next();
95template <
class ListenerT>
104 rCont.removeInterface((*
maData)[nRemain]);
169 const css::uno::Reference<ListenerT>&
getInterface(sal_Int32 nIndex)
const;
190 template <
typename FuncT>
inline void forEach(FuncT
const& func);
212 template <
typename EventT>
213 inline void notifyEach(
void (SAL_CALL ListenerT::*NotificationMethod)(
const EventT&),
214 const EventT& Event);
239 typedef void (SAL_CALL ListenerT::*NotificationMethod)(
const EventT&);
250 void operator()(
const css::uno::Reference<ListenerT>& listener)
const
265template <
typename FuncT>
271 auto xListener = iter.
next();
276 catch (css::lang::DisposedException
const& exc)
278 if (exc.Context == xListener)
284template <
class ListenerT>
285template <
typename EventT>
287 void (SAL_CALL ListenerT::*NotificationMethod)(
const EventT&),
const EventT& Event)
294 osl::MutexGuard aGuard(mrMutex);
298template <
class ListenerT>
299std::vector<css::uno::Reference<ListenerT>>
302 std::vector<css::uno::Reference<ListenerT>> rVec;
303 osl::MutexGuard aGuard(mrMutex);
308template <
class ListenerT>
312 assert(rListener.is());
313 osl::MutexGuard aGuard(mrMutex);
315 maData->push_back(rListener);
319template <
class ListenerT>
321 const css::uno::Reference<ListenerT>& rListener)
323 assert(rListener.is());
324 osl::MutexGuard aGuard(mrMutex);
328 [&rListener](
const css::uno::Reference<css::uno::XInterface>& rItem) {
329 return rItem.get() == rListener.get();
342template <
class ListenerT>
343const css::uno::Reference<ListenerT>&
346 osl::MutexGuard aGuard(mrMutex);
351template <
class ListenerT>
354 osl::ClearableMutexGuard aGuard(mrMutex);
362 aIt.
next()->disposing(rEvt);
364 catch (css::uno::RuntimeException&)
374 osl::MutexGuard aGuard(mrMutex);
typedef void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &)
NotifySingleListener(NotificationMethod method, const EventT &event)
void operator()(const css::uno::Reference< ListenerT > &listener) const
NotificationMethod const m_pMethod
A container of interfaces.
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
Inserts an element into the container.
OInterfaceContainerHelper3(const OInterfaceContainerHelper3 &)=delete
std::vector< css::uno::Reference< ListenerT > > getElements() const
Return all interfaces added to this container.
void clear()
Clears the container without calling disposing().
void disposeAndClear(const css::lang::EventObject &rEvt)
Call disposing on all object in the container that support XEventListener.
OInterfaceContainerHelper3 & operator=(const OInterfaceContainerHelper3 &)=delete
o3tl::cow_wrapper< std::vector< css::uno::Reference< ListenerT > >, o3tl::ThreadSafeRefCountingPolicy > maData
static o3tl::cow_wrapper< std::vector< css::uno::Reference< ListenerT > >, o3tl::ThreadSafeRefCountingPolicy > & DEFAULT()
const css::uno::Reference< ListenerT > & getInterface(sal_Int32 nIndex) const
Return an interface by index.
OInterfaceContainerHelper3(::osl::Mutex &rMutex_)
Create an interface container.
sal_Int32 getLength() const
Return the number of Elements in the container.
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
Removes an element from the container.
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
Calls a UNO listener method for each contained listener.
void forEach(FuncT const &func)
Executes a functor for each contained listener of specified type, e.g.
This is the iterator of an OInterfaceContainerHelper3.
OInterfaceIteratorHelper3 & operator=(const OInterfaceIteratorHelper3 &)=delete
bool hasMoreElements() const
Return true, if there are more elements in the iterator.
OInterfaceContainerHelper3< ListenerT > & rCont
void remove()
Removes the current element (the last one returned by next()) from the underlying container.
css::uno::Reference< ListenerT > const & next()
Return the next element of the iterator.
o3tl::cow_wrapper< std::vector< css::uno::Reference< ListenerT > >, o3tl::ThreadSafeRefCountingPolicy > maData
OInterfaceIteratorHelper3(OInterfaceContainerHelper3< ListenerT > &rCont_)
Create an iterator over the elements of the container.
OInterfaceIteratorHelper3(const OInterfaceIteratorHelper3 &)=delete
std::vector< sal_Int8, boost::noinit_adaptor< std::allocator< sal_Int8 > > > maData
static PropertyMapEntry const * find(const rtl::Reference< PropertySetInfo > &mxInfo, const OUString &aName) noexcept