/src/libreoffice/configmgr/source/broadcaster.hxx
Line | Count | Source |
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 <sal/config.h> |
23 | | |
24 | | #include <vector> |
25 | | |
26 | | #include <com/sun/star/beans/PropertyChangeEvent.hpp> |
27 | | #include <com/sun/star/container/ContainerEvent.hpp> |
28 | | #include <com/sun/star/lang/EventObject.hpp> |
29 | | #include <com/sun/star/uno/Reference.hxx> |
30 | | #include <com/sun/star/uno/Sequence.hxx> |
31 | | #include <com/sun/star/util/ChangesEvent.hpp> |
32 | | |
33 | | namespace com::sun::star { |
34 | | namespace beans { |
35 | | class XPropertiesChangeListener; |
36 | | class XPropertyChangeListener; |
37 | | } |
38 | | namespace container { class XContainerListener; } |
39 | | namespace lang { class XEventListener; } |
40 | | namespace util { class XChangesListener; } |
41 | | } |
42 | | |
43 | | namespace configmgr { |
44 | | |
45 | | class Broadcaster { |
46 | | public: |
47 | 0 | Broadcaster() {} |
48 | | |
49 | | void addDisposeNotification( |
50 | | css::uno::Reference< css::lang::XEventListener > const & listener, |
51 | | css::lang::EventObject const & event); |
52 | | |
53 | | void addContainerElementInsertedNotification( |
54 | | css::uno::Reference< css::container::XContainerListener > const & listener, |
55 | | css::container::ContainerEvent const & event); |
56 | | |
57 | | void addContainerElementRemovedNotification( |
58 | | css::uno::Reference< css::container::XContainerListener > const & listener, |
59 | | css::container::ContainerEvent const & event); |
60 | | |
61 | | void addContainerElementReplacedNotification( |
62 | | css::uno::Reference< css::container::XContainerListener > const & listener, |
63 | | css::container::ContainerEvent const & event); |
64 | | |
65 | | void addPropertyChangeNotification( |
66 | | css::uno::Reference< css::beans::XPropertyChangeListener > const & listener, |
67 | | css::beans::PropertyChangeEvent const & event); |
68 | | |
69 | | void addPropertiesChangeNotification( |
70 | | css::uno::Reference< css::beans::XPropertiesChangeListener > const & listener, |
71 | | css::uno::Sequence< css::beans::PropertyChangeEvent > const & event); |
72 | | |
73 | | void addChangesNotification( |
74 | | css::uno::Reference< css::util::XChangesListener > const & listener, |
75 | | css::util::ChangesEvent const & event, bool bRootListener); |
76 | | |
77 | | void send(); |
78 | | |
79 | | private: |
80 | | Broadcaster(const Broadcaster&) = delete; |
81 | | Broadcaster& operator=(const Broadcaster&) = delete; |
82 | | |
83 | | struct DisposeNotification { |
84 | | css::uno::Reference< css::lang::XEventListener > listener; |
85 | | css::lang::EventObject event; |
86 | | |
87 | | DisposeNotification( |
88 | | css::uno::Reference< css::lang::XEventListener > const & theListener, |
89 | | css::lang::EventObject theEvent); |
90 | | }; |
91 | | |
92 | | struct ContainerNotification { |
93 | | css::uno::Reference< css::container::XContainerListener > listener; |
94 | | css::container::ContainerEvent event; |
95 | | |
96 | | ContainerNotification( |
97 | | css::uno::Reference< css::container::XContainerListener > const & theListener, |
98 | | css::container::ContainerEvent theEvent); |
99 | | }; |
100 | | |
101 | | struct PropertyChangeNotification { |
102 | | css::uno::Reference< css::beans::XPropertyChangeListener > listener; |
103 | | css::beans::PropertyChangeEvent event; |
104 | | |
105 | | PropertyChangeNotification( |
106 | | css::uno::Reference< css::beans::XPropertyChangeListener > const & theListener, |
107 | | css::beans::PropertyChangeEvent theEvent); |
108 | | }; |
109 | | |
110 | | struct PropertiesChangeNotification { |
111 | | css::uno::Reference< css::beans::XPropertiesChangeListener > listener; |
112 | | css::uno::Sequence< css::beans::PropertyChangeEvent > event; |
113 | | |
114 | | PropertiesChangeNotification( |
115 | | css::uno::Reference< css::beans::XPropertiesChangeListener > const & theListener, |
116 | | css::uno::Sequence< css::beans::PropertyChangeEvent > const & theEvent); |
117 | | }; |
118 | | |
119 | | struct ChangesNotification { |
120 | | css::uno::Reference< css::util::XChangesListener > listener; |
121 | | css::util::ChangesEvent event; |
122 | | |
123 | | ChangesNotification( |
124 | | css::uno::Reference< css::util::XChangesListener > const & theListener, |
125 | | css::util::ChangesEvent theEvent); |
126 | | }; |
127 | | |
128 | | std::vector< DisposeNotification > disposeNotifications_; |
129 | | std::vector< ContainerNotification > containerElementInsertedNotifications_; |
130 | | std::vector< ContainerNotification > containerElementRemovedNotifications_; |
131 | | std::vector< ContainerNotification > containerElementReplacedNotifications_; |
132 | | std::vector< PropertyChangeNotification > propertyChangeNotifications_; |
133 | | std::vector< PropertiesChangeNotification > propertiesChangeNotifications_; |
134 | | std::vector< ChangesNotification > rootChangesNotifications_; |
135 | | std::vector< ChangesNotification > changesNotifications_; |
136 | | }; |
137 | | |
138 | | } |
139 | | |
140 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |