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