merge the formfield patch from ooo-build
[ooovba.git] / configmgr / source / treecache / cachemulticaster.hxx
blob6fcb7fc13b6208fad635d8c2a39e046236dcd7cf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cachemulticaster.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef CONFIGMGR_BACKEND_CACHEMULTICASTER_HXX
32 #define CONFIGMGR_BACKEND_CACHEMULTICASTER_HXX
34 #include "sal/config.h"
36 #include <list>
38 #include "osl/mutex.hxx"
39 #include "rtl/ref.hxx"
41 #include "utility.hxx"
43 namespace configmgr
45 class TreeManager;
47 namespace backend
49 class ComponentRequest;
50 class UpdateRequest;
51 // ---------------------------------------------------------------------------
53 /** Interface providing a multicasting service for changes to the cache
54 managed by a <type>CacheController</type>
56 class CacheChangeMulticaster
58 public:
59 CacheChangeMulticaster();
60 virtual ~CacheChangeMulticaster();
62 /** notify a new component to all registered listeners.
63 <p> Must be called after the component has been created in the cache.</p>
65 void notifyCreated(ComponentRequest const & _aComponentName) SAL_THROW(());
67 /** notify changed data to all registered listeners.
68 <p> Must be called after the change has been applied to the cache
69 and before any subsequent changes to the same component.</p>
71 void notifyChanged(UpdateRequest const & _anUpdate) SAL_THROW(());
73 // notification support.
74 /// register a listener for observing changes to the cached data
75 void addListener(rtl::Reference<TreeManager> _xListener) SAL_THROW(());
76 /// unregister a listener previously registered
77 void removeListener(rtl::Reference<TreeManager> _xListener) SAL_THROW(());
78 private:
79 std::list< rtl::Reference<TreeManager> > copyListenerList();
81 osl::Mutex m_aMutex;
82 std::list< rtl::Reference<TreeManager> > m_aListeners;
84 // ---------------------------------------------------------------------------
85 } // namespace backend
87 // ---------------------------------------------------------------------------
88 } // namespace configmgr
90 #endif