update dev300-m57
[ooovba.git] / svx / inc / svditer.hxx
blob0dc391ec462dccf47ec802d641485d8a0d88d070
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: svditer.hxx,v $
10 * $Revision: 1.9.246.1 $
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 _SVDITER_HXX
32 #define _SVDITER_HXX
34 #include <sal/types.h>
35 #include <tools/list.hxx>
36 #include "svx/svxdllapi.h"
38 class SdrObjList;
39 class SdrObject;
40 class SdrMarkList;
42 // SdrObjListIter methods:
43 // IM_FLAT : Flach ueber die Liste
44 // IM_DEEPWITHGROUPS : Mit rekursivem Abstieg, Next() liefert auch Gruppenobjekte
45 // IM_DEEPNOGROUPS : Mit rekursivem Abstieg, Next() liefert keine Gruppenobjekte
46 enum SdrIterMode { IM_FLAT, IM_DEEPWITHGROUPS, IM_DEEPNOGROUPS};
48 class SVX_DLLPUBLIC SdrObjListIter
50 List maObjList;
51 sal_uInt32 mnIndex;
52 BOOL mbReverse;
54 void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, BOOL bUseZOrder);
55 void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode);
56 void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, BOOL bUseZOrder);
58 public:
59 SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE);
60 /** This variant lets the user choose the order in which to travel over
61 the objects.
62 @param bUseZOrder
63 When <TRUE/> then the z-order defines the order of iteration.
64 Otherwise the navigation position as returned by
65 SdrObject::GetNavigationPosition() is used.
67 SdrObjListIter(const SdrObjList& rObjList, BOOL bUseZOrder, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE);
69 /* SJ: the following function can now be used with every
70 SdrObject and is no longer limited to group objects */
71 SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE);
73 /** Iterates over a list of marked objects received from the SdrMarkView. */
74 SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = IM_DEEPNOGROUPS, BOOL bReverse = FALSE);
76 void Reset() { mnIndex = (mbReverse ? maObjList.Count() : 0L); }
77 BOOL IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.Count())); }
78 SdrObject* Next() { return (SdrObject*)maObjList.GetObject(mbReverse ? --mnIndex : mnIndex++); }
80 sal_uInt32 Count() { return maObjList.Count(); }
83 #endif //_SVDITER_HXX