LibreOffice Module sd (master) 1
ConfigurationControllerBroadcaster.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <com/sun/star/uno/Reference.hxx>
23
24#include <unordered_map>
25#include <vector>
26
27namespace com::sun::star::drawing::framework { class XConfigurationChangeListener; }
28namespace com::sun::star::drawing::framework { class XConfigurationController; }
29namespace com::sun::star::drawing::framework { class XResource; }
30namespace com::sun::star::drawing::framework { class XResourceId; }
31namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; }
32
33namespace sd::framework {
34
45{
46public:
50 const css::uno::Reference<
51 css::drawing::framework::XConfigurationController>& rxController);
52
70 void AddListener(
71 const css::uno::Reference<
72 css::drawing::framework::XConfigurationChangeListener>& rxListener,
73 const OUString& rsEventType,
74 const css::uno::Any& rUserData);
75
84 void RemoveListener(
85 const css::uno::Reference<
86 css::drawing::framework::XConfigurationChangeListener>& rxListener);
87
95 const css::drawing::framework::ConfigurationChangeEvent& rEvent);
96
101 const OUString& rsEventType,
102 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
103 const css::uno::Reference<css::drawing::framework::XResource>& rxResourceObject);
104
110 void DisposeAndClear();
111
112private:
113 css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController;
115 {
116 public:
117 css::uno::Reference<css::drawing::framework::XConfigurationChangeListener> mxListener;
118 css::uno::Any maUserData;
119 };
120 typedef std::vector<ListenerDescriptor> ListenerList;
121 typedef std::unordered_map
122 <OUString,
125
132 const ListenerList& rList,
133 const css::drawing::framework::ConfigurationChangeEvent& rEvent);
134};
135
136} // end of namespace sd::framework
137
138/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::drawing::framework::XConfigurationChangeListener > mxListener
This class manages the set of XConfigurationChangeListeners and calls them when the ConfigurationCont...
css::uno::Reference< css::drawing::framework::XConfigurationController > mxConfigurationController
void NotifyListeners(const ListenerList &rList, const css::drawing::framework::ConfigurationChangeEvent &rEvent)
Broadcast the given event to all listeners in the given list.
void DisposeAndClear()
Call all listeners and inform them that the ConfigurationController is being disposed.
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.
void RemoveListener(const css::uno::Reference< css::drawing::framework::XConfigurationChangeListener > &rxListener)
Remove all references to the given listener.
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...
ConfigurationControllerBroadcaster(const css::uno::Reference< css::drawing::framework::XConfigurationController > &rxController)
The given controller is used as origin of thrown exceptions.
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.