Line data Source code
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 : #ifndef INCLUDED_CONFIGMGR_SOURCE_BROADCASTER_HXX
21 : #define INCLUDED_CONFIGMGR_SOURCE_BROADCASTER_HXX
22 :
23 : #include <sal/config.h>
24 :
25 : #include <vector>
26 :
27 : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
28 : #include <com/sun/star/container/ContainerEvent.hpp>
29 : #include <com/sun/star/lang/EventObject.hpp>
30 : #include <com/sun/star/uno/Reference.hxx>
31 : #include <com/sun/star/uno/Sequence.hxx>
32 : #include <com/sun/star/util/ChangesEvent.hpp>
33 :
34 : namespace com { namespace sun { namespace star {
35 : namespace beans {
36 : class XPropertiesChangeListener;
37 : class XPropertyChangeListener;
38 : }
39 : namespace container { class XContainerListener; }
40 : namespace lang { class XEventListener; }
41 : namespace util { class XChangesListener; }
42 : } } }
43 :
44 : namespace configmgr {
45 :
46 151590 : class Broadcaster {
47 : public:
48 151590 : Broadcaster() {}
49 :
50 : void addDisposeNotification(
51 : com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >
52 : const & listener,
53 : com::sun::star::lang::EventObject const & event);
54 :
55 : void addContainerElementInsertedNotification(
56 : com::sun::star::uno::Reference<
57 : com::sun::star::container::XContainerListener > const & listener,
58 : com::sun::star::container::ContainerEvent const & event);
59 :
60 : void addContainerElementRemovedNotification(
61 : com::sun::star::uno::Reference<
62 : com::sun::star::container::XContainerListener > const & listener,
63 : com::sun::star::container::ContainerEvent const & event);
64 :
65 : void addContainerElementReplacedNotification(
66 : com::sun::star::uno::Reference<
67 : com::sun::star::container::XContainerListener > const & listener,
68 : com::sun::star::container::ContainerEvent const & event);
69 :
70 : void addPropertyChangeNotification(
71 : com::sun::star::uno::Reference<
72 : com::sun::star::beans::XPropertyChangeListener > const & listener,
73 : com::sun::star::beans::PropertyChangeEvent const & event);
74 :
75 : void addPropertiesChangeNotification(
76 : com::sun::star::uno::Reference<
77 : com::sun::star::beans::XPropertiesChangeListener > const & listener,
78 : com::sun::star::uno::Sequence<
79 : com::sun::star::beans::PropertyChangeEvent > const & event);
80 :
81 : void addChangesNotification(
82 : com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
83 : const & listener,
84 : com::sun::star::util::ChangesEvent const & event);
85 :
86 : void send();
87 :
88 : private:
89 : Broadcaster(const Broadcaster&) SAL_DELETED_FUNCTION;
90 : Broadcaster& operator=(const Broadcaster&) SAL_DELETED_FUNCTION;
91 :
92 6 : struct DisposeNotification {
93 : com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >
94 : listener;
95 : com::sun::star::lang::EventObject event;
96 :
97 : DisposeNotification(
98 : com::sun::star::uno::Reference<
99 : com::sun::star::lang::XEventListener > const & theListener,
100 : com::sun::star::lang::EventObject const & theEvent);
101 : };
102 :
103 0 : struct ContainerNotification {
104 : com::sun::star::uno::Reference<
105 : com::sun::star::container::XContainerListener > listener;
106 : com::sun::star::container::ContainerEvent event;
107 :
108 : ContainerNotification(
109 : com::sun::star::uno::Reference<
110 : com::sun::star::container::XContainerListener > const &
111 : theListener,
112 : com::sun::star::container::ContainerEvent const & theEvent);
113 : };
114 :
115 336 : struct PropertyChangeNotification {
116 : com::sun::star::uno::Reference<
117 : com::sun::star::beans::XPropertyChangeListener > listener;
118 : com::sun::star::beans::PropertyChangeEvent event;
119 :
120 : PropertyChangeNotification(
121 : com::sun::star::uno::Reference<
122 : com::sun::star::beans::XPropertyChangeListener > const &
123 : theListener,
124 : com::sun::star::beans::PropertyChangeEvent const & theEvent);
125 : };
126 :
127 0 : struct PropertiesChangeNotification {
128 : com::sun::star::uno::Reference<
129 : com::sun::star::beans::XPropertiesChangeListener > listener;
130 : com::sun::star::uno::Sequence<
131 : com::sun::star::beans::PropertyChangeEvent > event;
132 :
133 : PropertiesChangeNotification(
134 : com::sun::star::uno::Reference<
135 : com::sun::star::beans::XPropertiesChangeListener > const &
136 : theListener,
137 : com::sun::star::uno::Sequence<
138 : com::sun::star::beans::PropertyChangeEvent > const & theEvent);
139 : };
140 :
141 24186 : struct ChangesNotification {
142 : com::sun::star::uno::Reference< com::sun::star::util::XChangesListener >
143 : listener;
144 : com::sun::star::util::ChangesEvent event;
145 :
146 : ChangesNotification(
147 : com::sun::star::uno::Reference<
148 : com::sun::star::util::XChangesListener > const & theListener,
149 : com::sun::star::util::ChangesEvent const & theEvent);
150 : };
151 :
152 : typedef std::vector< DisposeNotification > DisposeNotifications;
153 :
154 : typedef std::vector< ContainerNotification > ContainerNotifications;
155 :
156 : typedef std::vector< PropertyChangeNotification >
157 : PropertyChangeNotifications;
158 :
159 : typedef std::vector< PropertiesChangeNotification >
160 : PropertiesChangeNotifications;
161 :
162 : typedef std::vector< ChangesNotification > ChangesNotifications;
163 :
164 : DisposeNotifications disposeNotifications_;
165 : ContainerNotifications containerElementInsertedNotifications_;
166 : ContainerNotifications containerElementRemovedNotifications_;
167 : ContainerNotifications containerElementReplacedNotifications_;
168 : PropertyChangeNotifications propertyChangeNotifications_;
169 : PropertiesChangeNotifications propertiesChangeNotifications_;
170 : ChangesNotifications changesNotifications_;
171 : };
172 :
173 : }
174 :
175 : #endif
176 :
177 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|