19 #ifndef INCLUDED_COMPHELPER_INTERFACECONTAINER3_H
20 #define INCLUDED_COMPHELPER_INTERFACECONTAINER3_H
24 #include <com/sun/star/lang/EventObject.hpp>
25 #include <com/sun/star/lang/DisposedException.hpp>
77 css::uno::Reference<ListenerT>
const&
next();
95 template <
class ListenerT>
104 rCont.removeInterface((*
maData)[nRemain]);
137 std::vector<css::uno::Reference<ListenerT>>
getElements()
const;
155 sal_Int32
addInterface(
const css::uno::Reference<ListenerT>& rxIFace);
163 sal_Int32
removeInterface(
const css::uno::Reference<ListenerT>& rxIFace);
184 template <
typename FuncT>
inline void forEach(FuncT
const& func);
206 template <
typename EventT>
207 inline void notifyEach(
void (SAL_CALL ListenerT::*NotificationMethod)(
const EventT&),
208 const EventT& Event);
221 typedef void (SAL_CALL ListenerT::*NotificationMethod)(
const EventT&);
232 void operator()(
const css::uno::Reference<ListenerT>& listener)
const
240 template <
typename FuncT>
246 auto xListener = iter.
next();
251 catch (css::lang::DisposedException
const& exc)
253 if (exc.Context == xListener)
259 template <
class ListenerT>
260 template <
typename EventT>
262 void (SAL_CALL ListenerT::*NotificationMethod)(
const EventT&),
const EventT& Event)
269 osl::MutexGuard aGuard(rMutex);
273 template <
class ListenerT>
274 std::vector<css::uno::Reference<ListenerT>>
277 std::vector<css::uno::Reference<ListenerT>> rVec;
278 osl::MutexGuard aGuard(rMutex);
283 template <
class ListenerT>
288 osl::MutexGuard aGuard(rMutex);
290 maData->push_back(rListener);
294 template <
class ListenerT>
296 const css::uno::Reference<ListenerT>& rListener)
299 osl::MutexGuard aGuard(rMutex);
303 [&rListener](
const css::uno::Reference<css::uno::XInterface>& rItem) {
304 return rItem.get() == rListener.get();
317 template <
class ListenerT>
320 osl::ClearableMutexGuard aGuard(rMutex);
328 aIt.
next()->disposing(rEvt);
330 catch (css::uno::RuntimeException&)
340 osl::MutexGuard aGuard(rMutex);
OInterfaceContainerHelper3(::osl::Mutex &rMutex_)
Create an interface container.
bool hasMoreElements() const
Return true, if there are more elements in the iterator.
void clear()
Clears the container without calling disposing().
OInterfaceIteratorHelper3 & operator=(const OInterfaceIteratorHelper3 &)=delete
sal_Int32 addInterface(const css::uno::Reference< ListenerT > &rxIFace)
Inserts an element into the container.
std::vector< css::uno::Reference< ListenerT > > getElements() const
Return all interfaces added to this container.
OInterfaceContainerHelper3 & operator=(const OInterfaceContainerHelper3 &)=delete
std::vector< sal_Int8 > maData
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
This is the iterator of an InterfaceContainerHelper.
o3tl::cow_wrapper< std::vector< css::uno::Reference< ListenerT > > > maData
sal_Int32 getLength() const
Return the number of Elements in the container.
void forEach(FuncT const &func)
Executes a functor for each contained listener of specified type, e.g.
void remove()
Removes the current element (the last one returned by next()) from the underlying container...
sal_Int32 removeInterface(const css::uno::Reference< ListenerT > &rxIFace)
Removes an element from the container.
css::uno::Reference< ListenerT > const & next()
Return the next element of the iterator.
typedef void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &)
A container of interfaces.
void notifyEach(void(SAL_CALL ListenerT::*NotificationMethod)(const EventT &), const EventT &Event)
Calls a UNO listener method for each contained listener.
OInterfaceIteratorHelper3(OInterfaceContainerHelper3< ListenerT > &rCont_)
Create an iterator over the elements of the container.
void operator()(const css::uno::Reference< ListenerT > &listener) const
static PropertyMapEntry const * find(rtl::Reference< PropertySetInfo > &mxInfo, const OUString &aName)
NotificationMethod const m_pMethod
o3tl::cow_wrapper< std::vector< css::uno::Reference< ListenerT > > > maData
NotifySingleListener(NotificationMethod method, const EventT &event)
OInterfaceContainerHelper3< ListenerT > & rCont
void disposeAndClear(const css::lang::EventObject &rEvt)
Call disposing on all object in the container that support XEventListener.