xref: /aoo4110/main/svl/inc/svl/listeneriter.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 _SVT_LISTENERITER_HXX
24 #define _SVT_LISTENERITER_HXX
25 
26 #include "svl/svldllapi.h"
27 #include <tools/rtti.hxx>
28 
29 class SvtListener;
30 class SvtListenerBase;
31 class SvtBroadcaster;
32 
33 //-------------------------------------------------------------------------
34 
35 class SVL_DLLPUBLIC SvtListenerIter
36 {
37 	friend class SvtListenerBase;
38 
39 	SvtBroadcaster& rRoot;
40 	SvtListenerBase *pAkt, *pDelNext;
41 
42 	// for the update of all iterator's, if a listener is added or removed
43 	// at the same time.
44 	static SvtListenerIter *pListenerIters;
45 	SvtListenerIter *pNxtIter;
46 	TypeId aSrchId;				// fuer First/Next - suche diesen Type
47 
48 	SVL_DLLPRIVATE static void RemoveListener( SvtListenerBase& rDel,
49 											   SvtListenerBase* pNext );
50 
51 public:
52 	SvtListenerIter( SvtBroadcaster& );
53 	~SvtListenerIter();
54 
GetBroadcaster() const55 	const SvtBroadcaster& GetBroadcaster() const	{ return rRoot; }
GetBroadcaster()56 		  SvtBroadcaster& GetBroadcaster() 			{ return rRoot; }
57 
58 	SvtListener* GoNext();			// to the next
59 	SvtListener* GoPrev();			// to the previous
60 
61 	SvtListener* GoStart(); 		// to the start of the list
62 	SvtListener* GoEnd();			// to the end of the list
63 
64 	SvtListener* GoRoot(); 			// to the root
65 	SvtListener* GetCurr() const;	// returns the current
66 
IsChanged() const67 	int IsChanged() const 		{ return pDelNext != pAkt; }
68 
69 	SvtListener* First( TypeId nType );
70 	SvtListener* Next();
71 };
72 
73 
74 #endif
75 
76