xref: /aoo4110/main/svl/inc/svl/itemiter.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 _SFXITEMITER_HXX
24 #define _SFXITEMITER_HXX
25 
26 #include "svl/svldllapi.h"
27 #include <tools/solar.h>
28 #include <svl/itemset.hxx>
29 
30 class SfxPoolItem;
31 class SfxItemSet;
32 class SfxItemPool;
33 
34 class SVL_DLLPUBLIC SfxItemIter
35 {
36 	// Item-Feld - Start & Ende
37 	const SfxItemSet&	_rSet;
38 	sal_uInt16				_nStt, _nEnd, _nAkt;
39 
40 public:
41 	SfxItemIter( const SfxItemSet& rSet );
42 	~SfxItemIter();
43 
44 	// falls es diese gibt, returne sie, sonst 0
FirstItem()45 	const SfxPoolItem* FirstItem()
46 					   { _nAkt = _nStt;
47 						 return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; }
LastItem()48 	const SfxPoolItem* LastItem()
49 					   { _nAkt = _nEnd;
50 						 return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; }
GetCurItem()51 	const SfxPoolItem* GetCurItem()
52 					   { return _rSet._nCount ? *(_rSet._aItems+_nAkt) : 0; }
53 	const SfxPoolItem* NextItem();
54 	const SfxPoolItem* PrevItem();
55 
IsAtStart() const56 	sal_Bool			   IsAtStart() const { return _nAkt == _nStt; }
IsAtEnd() const57 	sal_Bool               IsAtEnd() const   { return _nAkt == _nEnd; }
58 
GetCurPos() const59 	sal_uInt16             GetCurPos() const { return _nAkt; }
GetFirstPos() const60 	sal_uInt16             GetFirstPos() const { return _nStt; }
GetLastPos() const61 	sal_uInt16             GetLastPos() const { return _nEnd; }
62 };
63 
64 #endif
65