1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: itemiter.cxx,v $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svtools.hxx"
37 #include <svtools/itemiter.hxx>
38 #include <svtools/itempool.hxx>
39 #include <svtools/itemset.hxx>
41 // STATIC DATA -----------------------------------------------------------
43 DBG_NAME(SfxItemIter
);
46 // --------------------------------------------------------------------------
49 SfxItemIter::SfxItemIter( const SfxItemSet
& rItemSet
)
52 DBG_CTOR(SfxItemIter
, 0);
53 DBG_ASSERTWARNING( _rSet
.Count(), "es gibt gar keine Attribute" );
62 SfxItemArray ppFnd
= _rSet
._aItems
;
64 // suche das 1. gesetzte Item
65 for ( _nStt
= 0; !*(ppFnd
+ _nStt
); ++_nStt
)
67 if ( 1 < _rSet
.Count() )
68 for( _nEnd
= _rSet
.TotalCount(); !*( ppFnd
+ --_nEnd
); )
77 // --------------------------------------------------------------------------
80 SfxItemIter::~SfxItemIter()
82 DBG_DTOR(SfxItemIter
, 0);
85 // --------------------------------------------------------------------------
88 const SfxPoolItem
* SfxItemIter::NextItem()
90 DBG_CHKTHIS(SfxItemIter
, 0);
91 SfxItemArray ppFnd
= _rSet
._aItems
;
97 } while( _nAkt
< _nEnd
&& !*(ppFnd
+ _nAkt
) );
98 return *(ppFnd
+_nAkt
);
103 // --------------------------------------------------------------------------
106 const SfxPoolItem
* SfxItemIter::PrevItem()
108 DBG_CHKTHIS(SfxItemIter
, 0);
109 SfxItemArray ppFnd
= _rSet
._aItems
;
115 } while( _nAkt
&& !*(ppFnd
+ _nAkt
));
116 return *(ppFnd
+_nAkt
);