LibreOffice Module sd (master) 1
|
This class manages the set of XConfigurationChangeListeners and calls them when the ConfigurationController wants to broadcast an event. More...
#include <ConfigurationControllerBroadcaster.hxx>
Classes | |
class | ListenerDescriptor |
Public Member Functions | |
ConfigurationControllerBroadcaster (const css::uno::Reference< css::drawing::framework::XConfigurationController > &rxController) | |
The given controller is used as origin of thrown exceptions. More... | |
void | AddListener (const css::uno::Reference< css::drawing::framework::XConfigurationChangeListener > &rxListener, const OUString &rsEventType, const css::uno::Any &rUserData) |
Add a listener for one type of event. More... | |
void | RemoveListener (const css::uno::Reference< css::drawing::framework::XConfigurationChangeListener > &rxListener) |
Remove all references to the given listener. More... | |
void | NotifyListeners (const css::drawing::framework::ConfigurationChangeEvent &rEvent) |
Broadcast the given event to all listeners that have been registered for its type of event as well as all universal listeners. More... | |
void | NotifyListeners (const OUString &rsEventType, const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId, const css::uno::Reference< css::drawing::framework::XResource > &rxResourceObject) |
This convenience variant of NotifyListeners create the event from the given arguments. More... | |
void | DisposeAndClear () |
Call all listeners and inform them that the ConfigurationController is being disposed. More... | |
Private Types | |
typedef std::vector< ListenerDescriptor > | ListenerList |
typedef std::unordered_map< OUString, ListenerList > | ListenerMap |
Private Member Functions | |
void | NotifyListeners (const ListenerList &rList, const css::drawing::framework::ConfigurationChangeEvent &rEvent) |
Broadcast the given event to all listeners in the given list. More... | |
Private Attributes | |
css::uno::Reference< css::drawing::framework::XConfigurationController > | mxConfigurationController |
ListenerMap | maListenerMap |
This class manages the set of XConfigurationChangeListeners and calls them when the ConfigurationController wants to broadcast an event.
For every registered combination of listener and event type a user data object is stored. This user data object is then given to the listener whenever it is called for an event. With this the listener can use a switch statement to handle different event types.
Definition at line 44 of file ConfigurationControllerBroadcaster.hxx.
|
private |
Definition at line 120 of file ConfigurationControllerBroadcaster.hxx.
|
private |
Definition at line 123 of file ConfigurationControllerBroadcaster.hxx.
|
explicit |
The given controller is used as origin of thrown exceptions.
Definition at line 34 of file ConfigurationControllerBroadcaster.cxx.
void sd::framework::ConfigurationControllerBroadcaster::AddListener | ( | const css::uno::Reference< css::drawing::framework::XConfigurationChangeListener > & | rxListener, |
const OUString & | rsEventType, | ||
const css::uno::Any & | rUserData | ||
) |
Add a listener for one type of event.
When one listener is interested in more than one event type this method has to be called once for every event type. Alternatively it can register as universal listener that will be called for all event types.
rxListener | A valid reference to a listener. |
rsEventType | The type of event that the listener will be called for. The empty string is a special value in that the listener will be called for all event types. |
rUserData | This object is passed to the listener whenever it is called for the specified event type. For different event types different user data objects can be provided. |
IllegalArgumentException | when an empty listener reference is given. |
Definition at line 40 of file ConfigurationControllerBroadcaster.cxx.
References maListenerMap, sd::framework::ConfigurationControllerBroadcaster::ListenerDescriptor::maUserData, mxConfigurationController, and sd::framework::ConfigurationControllerBroadcaster::ListenerDescriptor::mxListener.
void sd::framework::ConfigurationControllerBroadcaster::DisposeAndClear | ( | ) |
Call all listeners and inform them that the ConfigurationController is being disposed.
When this method returns the list of registered listeners is empty. Further calls to RemoveListener() are not necessary but do not result in an error.
Definition at line 146 of file ConfigurationControllerBroadcaster.cxx.
References aEvent, DBG_UNHANDLED_EXCEPTION, maListenerMap, mxConfigurationController, and RemoveListener().
void sd::framework::ConfigurationControllerBroadcaster::NotifyListeners | ( | const css::drawing::framework::ConfigurationChangeEvent & | rEvent | ) |
Broadcast the given event to all listeners that have been registered for its type of event as well as all universal listeners.
When calling a listener results in a DisposedException being thrown the listener is unregistered automatically.
|
private |
Broadcast the given event to all listeners in the given list.
When calling a listener results in a DisposedException being thrown the listener is unregistered automatically.
void sd::framework::ConfigurationControllerBroadcaster::NotifyListeners | ( | const OUString & | rsEventType, |
const css::uno::Reference< css::drawing::framework::XResourceId > & | rxResourceId, | ||
const css::uno::Reference< css::drawing::framework::XResource > & | rxResourceObject | ||
) |
This convenience variant of NotifyListeners create the event from the given arguments.
void sd::framework::ConfigurationControllerBroadcaster::RemoveListener | ( | const css::uno::Reference< css::drawing::framework::XConfigurationChangeListener > & | rxListener | ) |
Remove all references to the given listener.
When one listener has been registered for more than one type of event then it is removed for all of them.
rxListener | A valid reference to a listener. |
IllegalArgumentException | when an empty listener reference is given. |
Definition at line 58 of file ConfigurationControllerBroadcaster.cxx.
References maListenerMap, and mxConfigurationController.
Referenced by DisposeAndClear().
|
private |
Definition at line 124 of file ConfigurationControllerBroadcaster.hxx.
Referenced by AddListener(), DisposeAndClear(), and RemoveListener().
|
private |
Definition at line 113 of file ConfigurationControllerBroadcaster.hxx.
Referenced by AddListener(), DisposeAndClear(), and RemoveListener().