1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_svx.hxx" 30 #include "svx/svditer.hxx" 31 #include <svx/svdpage.hxx> 32 #include <svx/svdogrp.hxx> 33 #include <svx/svdobj.hxx> 34 #include <svx/svdmark.hxx> 35 36 // #99190# 37 #include <svx/scene3d.hxx> 38 39 SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, sal_Bool bReverse) 40 : maObjList(1024, 64, 64), 41 mnIndex(0L), 42 mbReverse(bReverse) 43 { 44 ImpProcessObjectList(rObjList, eMode, sal_True); 45 Reset(); 46 } 47 48 SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, sal_Bool bUseZOrder, SdrIterMode eMode, sal_Bool bReverse) 49 : maObjList(1024, 64, 64), 50 mnIndex(0L), 51 mbReverse(bReverse) 52 { 53 ImpProcessObjectList(rObjList, eMode, bUseZOrder); 54 Reset(); 55 } 56 57 SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode, sal_Bool bReverse ) 58 : maObjList(1024, 64, 64), 59 mnIndex(0L), 60 mbReverse(bReverse) 61 { 62 if ( rObj.ISA( SdrObjGroup ) ) 63 ImpProcessObjectList(*rObj.GetSubList(), eMode, sal_True); 64 else 65 maObjList.Insert( (void*)&rObj, LIST_APPEND ); 66 Reset(); 67 } 68 69 SdrObjListIter::SdrObjListIter( const SdrMarkList& rMarkList, SdrIterMode eMode, sal_Bool bReverse ) 70 : maObjList(1024, 64, 64), 71 mnIndex(0L), 72 mbReverse(bReverse) 73 { 74 ImpProcessMarkList(rMarkList, eMode); 75 Reset(); 76 } 77 78 void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, sal_Bool bUseZOrder) 79 { 80 for( sal_uIntPtr nIdx = 0, nCount = rObjList.GetObjCount(); nIdx < nCount; ++nIdx ) 81 { 82 SdrObject* pObj = bUseZOrder ? 83 rObjList.GetObj( nIdx ) : rObjList.GetObjectForNavigationPosition( nIdx ); 84 OSL_ASSERT( pObj != 0 ); 85 if( pObj ) 86 ImpProcessObj( pObj, eMode, bUseZOrder ); 87 } 88 } 89 90 void SdrObjListIter::ImpProcessMarkList( const SdrMarkList& rMarkList, SdrIterMode eMode ) 91 { 92 for( sal_uIntPtr nIdx = 0, nCount = rMarkList.GetMarkCount(); nIdx < nCount; ++nIdx ) 93 if( SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj() ) 94 ImpProcessObj( pObj, eMode, sal_False ); 95 } 96 97 void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, sal_Bool bUseZOrder) 98 { 99 bool bIsGroup = pObj->IsGroupObject(); 100 // #99190# 3D objects are no group objects, IsGroupObject() 101 // only tests if pSub is not null ptr :-( 102 if( bIsGroup && pObj->ISA( E3dObject ) && !pObj->ISA( E3dScene ) ) 103 bIsGroup = false; 104 105 if( !bIsGroup || (eMode != IM_DEEPNOGROUPS) ) 106 maObjList.Insert( pObj, LIST_APPEND ); 107 108 if( bIsGroup && (eMode != IM_FLAT) ) 109 ImpProcessObjectList( *pObj->GetSubList(), eMode, bUseZOrder ); 110 } 111