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: svditer.cxx,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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
33 #include "svditer.hxx"
34 #include <svx/svdpage.hxx>
35 #include <svx/svdogrp.hxx>
36 #include <svx/svdobj.hxx>
37 #include <svx/svdmark.hxx>
40 #include <svx/scene3d.hxx>
42 SdrObjListIter::SdrObjListIter(const SdrObjList
& rObjList
, SdrIterMode eMode
, BOOL bReverse
)
43 : maObjList(1024, 64, 64),
47 ImpProcessObjectList(rObjList
, eMode
, TRUE
);
51 SdrObjListIter::SdrObjListIter(const SdrObjList
& rObjList
, BOOL bUseZOrder
, SdrIterMode eMode
, BOOL bReverse
)
52 : maObjList(1024, 64, 64),
56 ImpProcessObjectList(rObjList
, eMode
, bUseZOrder
);
60 SdrObjListIter::SdrObjListIter( const SdrObject
& rObj
, SdrIterMode eMode
, BOOL bReverse
)
61 : maObjList(1024, 64, 64),
65 if ( rObj
.ISA( SdrObjGroup
) )
66 ImpProcessObjectList(*rObj
.GetSubList(), eMode
, TRUE
);
68 maObjList
.Insert( (void*)&rObj
, LIST_APPEND
);
72 SdrObjListIter::SdrObjListIter( const SdrMarkList
& rMarkList
, SdrIterMode eMode
, BOOL bReverse
)
73 : maObjList(1024, 64, 64),
77 ImpProcessMarkList(rMarkList
, eMode
);
81 void SdrObjListIter::ImpProcessObjectList(const SdrObjList
& rObjList
, SdrIterMode eMode
, BOOL bUseZOrder
)
83 for( ULONG nIdx
= 0, nCount
= rObjList
.GetObjCount(); nIdx
< nCount
; ++nIdx
)
85 SdrObject
* pObj
= bUseZOrder
?
86 rObjList
.GetObj( nIdx
) : rObjList
.GetObjectForNavigationPosition( nIdx
);
87 OSL_ASSERT( pObj
!= 0 );
89 ImpProcessObj( pObj
, eMode
, bUseZOrder
);
93 void SdrObjListIter::ImpProcessMarkList( const SdrMarkList
& rMarkList
, SdrIterMode eMode
)
95 for( ULONG nIdx
= 0, nCount
= rMarkList
.GetMarkCount(); nIdx
< nCount
; ++nIdx
)
96 if( SdrObject
* pObj
= rMarkList
.GetMark( nIdx
)->GetMarkedSdrObj() )
97 ImpProcessObj( pObj
, eMode
, FALSE
);
100 void SdrObjListIter::ImpProcessObj(SdrObject
* pObj
, SdrIterMode eMode
, BOOL bUseZOrder
)
102 bool bIsGroup
= pObj
->IsGroupObject();
103 // #99190# 3D objects are no group objects, IsGroupObject()
104 // only tests if pSub is not null ptr :-(
105 if( bIsGroup
&& pObj
->ISA( E3dObject
) && !pObj
->ISA( E3dScene
) )
108 if( !bIsGroup
|| (eMode
!= IM_DEEPNOGROUPS
) )
109 maObjList
.Insert( pObj
, LIST_APPEND
);
111 if( bIsGroup
&& (eMode
!= IM_FLAT
) )
112 ImpProcessObjectList( *pObj
->GetSubList(), eMode
, bUseZOrder
);