1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef INCLUDED_CONFIGMGR_SOURCE_BROADCASTER_HXX 25 #define INCLUDED_CONFIGMGR_SOURCE_BROADCASTER_HXX 26 27 #include "sal/config.h" 28 29 #include <vector> 30 31 #include "boost/noncopyable.hpp" 32 #include "com/sun/star/beans/PropertyChangeEvent.hpp" 33 #include "com/sun/star/container/ContainerEvent.hpp" 34 #include "com/sun/star/lang/EventObject.hpp" 35 #include "com/sun/star/uno/Reference.hxx" 36 #include "com/sun/star/uno/Sequence.hxx" 37 #include "com/sun/star/util/ChangesEvent.hpp" 38 39 namespace com { namespace sun { namespace star { 40 namespace beans { 41 class XPropertiesChangeListener; 42 class XPropertyChangeListener; 43 } 44 namespace container { class XContainerListener; } 45 namespace lang { class XEventListener; } 46 namespace util { class XChangesListener; } 47 } } } 48 49 namespace configmgr { 50 51 class Access; 52 53 class Broadcaster: private boost::noncopyable { 54 public: 55 void addDisposeNotification( 56 com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > 57 const & listener, 58 com::sun::star::lang::EventObject const & event); 59 60 void addContainerElementInsertedNotification( 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 addContainerElementRemovedNotification( 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 addContainerElementReplacedNotification( 71 com::sun::star::uno::Reference< 72 com::sun::star::container::XContainerListener > const & listener, 73 com::sun::star::container::ContainerEvent const & event); 74 75 void addPropertyChangeNotification( 76 com::sun::star::uno::Reference< 77 com::sun::star::beans::XPropertyChangeListener > const & listener, 78 com::sun::star::beans::PropertyChangeEvent const & event); 79 80 void addPropertiesChangeNotification( 81 com::sun::star::uno::Reference< 82 com::sun::star::beans::XPropertiesChangeListener > const & listener, 83 com::sun::star::uno::Sequence< 84 com::sun::star::beans::PropertyChangeEvent > const & event); 85 86 void addChangesNotification( 87 com::sun::star::uno::Reference< com::sun::star::util::XChangesListener > 88 const & listener, 89 com::sun::star::util::ChangesEvent const & event); 90 91 void send(); 92 93 private: 94 struct DisposeNotification { 95 com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > 96 listener; 97 com::sun::star::lang::EventObject event; 98 99 DisposeNotification( 100 com::sun::star::uno::Reference< 101 com::sun::star::lang::XEventListener > const & theListener, 102 com::sun::star::lang::EventObject const & theEvent); 103 }; 104 105 struct ContainerNotification { 106 com::sun::star::uno::Reference< 107 com::sun::star::container::XContainerListener > listener; 108 com::sun::star::container::ContainerEvent event; 109 110 ContainerNotification( 111 com::sun::star::uno::Reference< 112 com::sun::star::container::XContainerListener > const & 113 theListener, 114 com::sun::star::container::ContainerEvent const & theEvent); 115 }; 116 117 struct PropertyChangeNotification { 118 com::sun::star::uno::Reference< 119 com::sun::star::beans::XPropertyChangeListener > listener; 120 com::sun::star::beans::PropertyChangeEvent event; 121 122 PropertyChangeNotification( 123 com::sun::star::uno::Reference< 124 com::sun::star::beans::XPropertyChangeListener > const & 125 theListener, 126 com::sun::star::beans::PropertyChangeEvent const & theEvent); 127 }; 128 129 struct PropertiesChangeNotification { 130 com::sun::star::uno::Reference< 131 com::sun::star::beans::XPropertiesChangeListener > listener; 132 com::sun::star::uno::Sequence< 133 com::sun::star::beans::PropertyChangeEvent > event; 134 135 PropertiesChangeNotification( 136 com::sun::star::uno::Reference< 137 com::sun::star::beans::XPropertiesChangeListener > const & 138 theListener, 139 com::sun::star::uno::Sequence< 140 com::sun::star::beans::PropertyChangeEvent > const & theEvent); 141 }; 142 143 struct ChangesNotification { 144 com::sun::star::uno::Reference< com::sun::star::util::XChangesListener > 145 listener; 146 com::sun::star::util::ChangesEvent event; 147 148 ChangesNotification( 149 com::sun::star::uno::Reference< 150 com::sun::star::util::XChangesListener > const & theListener, 151 com::sun::star::util::ChangesEvent const & theEvent); 152 }; 153 154 typedef std::vector< DisposeNotification > DisposeNotifications; 155 156 typedef std::vector< ContainerNotification > ContainerNotifications; 157 158 typedef std::vector< PropertyChangeNotification > 159 PropertyChangeNotifications; 160 161 typedef std::vector< PropertiesChangeNotification > 162 PropertiesChangeNotifications; 163 164 typedef std::vector< ChangesNotification > ChangesNotifications; 165 166 DisposeNotifications disposeNotifications_; 167 ContainerNotifications containerElementInsertedNotifications_; 168 ContainerNotifications containerElementRemovedNotifications_; 169 ContainerNotifications containerElementReplacedNotifications_; 170 PropertyChangeNotifications propertyChangeNotifications_; 171 PropertiesChangeNotifications propertiesChangeNotifications_; 172 ChangesNotifications changesNotifications_; 173 }; 174 175 } 176 177 #endif 178