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