1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_CONFIGMGR_SOURCE_BROADCASTER_HXX
21 #define INCLUDED_CONFIGMGR_SOURCE_BROADCASTER_HXX
23 #include "sal/config.h"
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"
35 namespace com
{ namespace sun
{ namespace star
{
37 class XPropertiesChangeListener
;
38 class XPropertyChangeListener
;
40 namespace container
{ class XContainerListener
; }
41 namespace lang
{ class XEventListener
; }
42 namespace util
{ class XChangesListener
; }
47 class Broadcaster
: private boost::noncopyable
{
49 void addDisposeNotification(
50 com::sun::star::uno::Reference
< com::sun::star::lang::XEventListener
>
52 com::sun::star::lang::EventObject
const & event
);
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
);
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
);
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
);
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
);
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
);
80 void addChangesNotification(
81 com::sun::star::uno::Reference
< com::sun::star::util::XChangesListener
>
83 com::sun::star::util::ChangesEvent
const & event
);
88 struct DisposeNotification
{
89 com::sun::star::uno::Reference
< com::sun::star::lang::XEventListener
>
91 com::sun::star::lang::EventObject event
;
94 com::sun::star::uno::Reference
<
95 com::sun::star::lang::XEventListener
> const & theListener
,
96 com::sun::star::lang::EventObject
const & theEvent
);
99 struct ContainerNotification
{
100 com::sun::star::uno::Reference
<
101 com::sun::star::container::XContainerListener
> listener
;
102 com::sun::star::container::ContainerEvent event
;
104 ContainerNotification(
105 com::sun::star::uno::Reference
<
106 com::sun::star::container::XContainerListener
> const &
108 com::sun::star::container::ContainerEvent
const & theEvent
);
111 struct PropertyChangeNotification
{
112 com::sun::star::uno::Reference
<
113 com::sun::star::beans::XPropertyChangeListener
> listener
;
114 com::sun::star::beans::PropertyChangeEvent event
;
116 PropertyChangeNotification(
117 com::sun::star::uno::Reference
<
118 com::sun::star::beans::XPropertyChangeListener
> const &
120 com::sun::star::beans::PropertyChangeEvent
const & theEvent
);
123 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
;
129 PropertiesChangeNotification(
130 com::sun::star::uno::Reference
<
131 com::sun::star::beans::XPropertiesChangeListener
> const &
133 com::sun::star::uno::Sequence
<
134 com::sun::star::beans::PropertyChangeEvent
> const & theEvent
);
137 struct ChangesNotification
{
138 com::sun::star::uno::Reference
< com::sun::star::util::XChangesListener
>
140 com::sun::star::util::ChangesEvent event
;
143 com::sun::star::uno::Reference
<
144 com::sun::star::util::XChangesListener
> const & theListener
,
145 com::sun::star::util::ChangesEvent
const & theEvent
);
148 typedef std::vector
< DisposeNotification
> DisposeNotifications
;
150 typedef std::vector
< ContainerNotification
> ContainerNotifications
;
152 typedef std::vector
< PropertyChangeNotification
>
153 PropertyChangeNotifications
;
155 typedef std::vector
< PropertiesChangeNotification
>
156 PropertiesChangeNotifications
;
158 typedef std::vector
< ChangesNotification
> ChangesNotifications
;
160 DisposeNotifications disposeNotifications_
;
161 ContainerNotifications containerElementInsertedNotifications_
;
162 ContainerNotifications containerElementRemovedNotifications_
;
163 ContainerNotifications containerElementReplacedNotifications_
;
164 PropertyChangeNotifications propertyChangeNotifications_
;
165 PropertiesChangeNotifications propertiesChangeNotifications_
;
166 ChangesNotifications changesNotifications_
;
173 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */