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