xref: /aoo4110/main/svl/inc/svl/lstner.hxx (revision b1cdbd2c)
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 #ifndef _SFXLSTNER_HXX
24 #define _SFXLSTNER_HXX
25 
26 #include "svl/svldllapi.h"
27 #include <tools/rtti.hxx>
28 #include <svl/svarray.hxx>
29 
30 class SfxBroadcaster;
31 class SfxHint;
32 
33 #ifndef _SFX_LSTNER_CXX
34 typedef SvPtrarr SfxBroadcasterArr_Impl;
35 #endif
36 
37 #define SFX_NOTIFY( rBC, rBCT, rHint, rHintT ) \
38 		Notify( rBC, rHint )
39 
40 //-------------------------------------------------------------------------
41 
42 class SVL_DLLPUBLIC SfxListener
43 {
44 	SfxBroadcasterArr_Impl aBCs;
45 
46 private:
47 	const SfxListener&	operator=(const SfxListener &); // n.i., ist verboten
48 
49 public:
50 	TYPEINFO();
51 
52 						SfxListener();
53 						SfxListener( const SfxListener &rCopy );
54 	virtual 			~SfxListener();
55 
56 	sal_Bool				StartListening( SfxBroadcaster& rBroadcaster, sal_Bool bPreventDups = sal_False );
57 	sal_Bool				EndListening( SfxBroadcaster& rBroadcaster, sal_Bool bAllDups = sal_False );
58 	void				EndListening( sal_uInt16 nNo );
59 	void				EndListeningAll();
60 	sal_Bool				IsListening( SfxBroadcaster& rBroadcaster ) const;
61 
GetBroadcasterCount() const62 	sal_uInt16				GetBroadcasterCount() const
63 						{ return aBCs.Count(); }
GetBroadcasterJOE(sal_uInt16 nNo) const64 	SfxBroadcaster* 	GetBroadcasterJOE( sal_uInt16 nNo ) const
65 						{ return (SfxBroadcaster*) aBCs.GetObject(nNo); }
66 
67 	virtual void		Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
68 
69 #ifndef _NOTIFY_HXX
70 	void RemoveBroadcaster_Impl( SfxBroadcaster& rBC );
71 #endif
72 };
73 
74 #endif
75