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: accfrmobjslist.hxx,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 ************************************************************************/
30 #ifndef _ACCFRMOBJSLIST_HXX
31 #define _ACCFRMOBJSLIST_HXX
33 #include <accfrmobj.hxx>
35 class SwFrmOrObjSList
;
37 class SwFrmOrObjSList_const_iterator
39 friend class SwFrmOrObjSList
;
40 const SwFrmOrObjSList
& rList
; // The frame we are iterating over
41 SwFrmOrObj aCurr
; // The current object
42 sal_uInt16 nNextObj
; // The index of the current sdr object
44 inline SwFrmOrObjSList_const_iterator( const SwFrmOrObjSList
& rLst
);
45 SwFrmOrObjSList_const_iterator( const SwFrmOrObjSList
& rLst
, sal_Bool
);
47 // SwFrmOrObjSList_const_iterator& begin();
48 SwFrmOrObjSList_const_iterator
& next();
49 SwFrmOrObjSList_const_iterator
& next_visible();
53 inline SwFrmOrObjSList_const_iterator(
54 const SwFrmOrObjSList_const_iterator
& rIter
);
55 inline sal_Bool
operator==(
56 const SwFrmOrObjSList_const_iterator
& r
) const;
57 inline sal_Bool
operator!=(
58 const SwFrmOrObjSList_const_iterator
& r
) const;
59 inline SwFrmOrObjSList_const_iterator
& operator++();
60 inline const SwFrmOrObj
& operator*() const;
63 // An iterator to iterate over a frame's child in any order
66 friend class SwFrmOrObjSList_const_iterator
;
69 const SwFrm
*pFrm
; // The frame we are iterating over
70 sal_Bool bVisibleOnly
;
74 typedef SwFrmOrObjSList_const_iterator const_iterator
;
76 inline SwFrmOrObjSList( const SwFrm
*pF
);
77 inline SwFrmOrObjSList( const SwRect
& rVisArea
, const SwFrm
*pF
);
79 inline const_iterator
begin() const;
80 inline const_iterator
end() const;
83 inline SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(
84 const SwFrmOrObjSList
& rLst
) :
85 rList( rLst
), nNextObj( 0 )
89 inline SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(
90 const SwFrmOrObjSList_const_iterator
& rIter
) :
93 nNextObj( rIter
.nNextObj
)
97 inline sal_Bool
SwFrmOrObjSList_const_iterator::operator==(
98 const SwFrmOrObjSList_const_iterator
& r
) const
100 return aCurr
== r
.aCurr
;
103 inline sal_Bool
SwFrmOrObjSList_const_iterator::operator!=(
104 const SwFrmOrObjSList_const_iterator
& r
) const
106 return !(aCurr
== r
.aCurr
);
109 inline SwFrmOrObjSList_const_iterator
& SwFrmOrObjSList_const_iterator::operator++()
111 return rList
.bVisibleOnly
? next_visible() : next();
114 inline const SwFrmOrObj
& SwFrmOrObjSList_const_iterator::operator*() const
119 inline SwFrmOrObjSList::SwFrmOrObjSList( const SwFrm
*pF
) :
121 bVisibleOnly( sal_False
)
125 inline SwFrmOrObjSList::SwFrmOrObjSList( const SwRect
& rVisArea
,
127 aVisArea( rVisArea
),
130 SwFrmOrObj
aFrm( pFrm
);
131 bVisibleOnly
= aFrm
.IsVisibleChildrenOnly();
134 inline SwFrmOrObjSList_const_iterator
SwFrmOrObjSList::begin() const
136 // SwFrmOrObjSList_const_iterator aIter2( *this );
139 return SwFrmOrObjSList_const_iterator( *this, sal_True
);
142 inline SwFrmOrObjSList_const_iterator
SwFrmOrObjSList::end() const
144 return SwFrmOrObjSList_const_iterator( *this );