LCOV - code coverage report
Current view: top level - svx/source/svdraw - svditer.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 32 42 76.2 %
Date: 2015-06-13 12:38:46 Functions: 5 7 71.4 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "svx/svditer.hxx"
      21             : #include <svx/svdpage.hxx>
      22             : #include <svx/svdogrp.hxx>
      23             : #include <svx/svdobj.hxx>
      24             : #include <svx/svdmark.hxx>
      25             : #include <svx/scene3d.hxx>
      26             : 
      27       36700 : SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode, bool bReverse)
      28             : :   mnIndex(0L),
      29       36700 :     mbReverse(bReverse)
      30             : {
      31       36700 :     ImpProcessObjectList(rObjList, eMode, true);
      32       36700 :     Reset();
      33       36700 : }
      34             : 
      35           4 : SdrObjListIter::SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode, bool bReverse)
      36             : :   mnIndex(0L),
      37           4 :     mbReverse(bReverse)
      38             : {
      39           4 :     ImpProcessObjectList(rObjList, eMode, bUseZOrder);
      40           4 :     Reset();
      41           4 : }
      42             : 
      43        7076 : SdrObjListIter::SdrObjListIter( const SdrObject& rObj, SdrIterMode eMode, bool bReverse )
      44             : :   mnIndex(0L),
      45        7076 :     mbReverse(bReverse)
      46             : {
      47        7076 :     if ( rObj.ISA( SdrObjGroup ) )
      48        1640 :         ImpProcessObjectList(*rObj.GetSubList(), eMode, true);
      49             :     else
      50        5436 :         maObjList.push_back(const_cast<SdrObject*>(&rObj));
      51        7076 :     Reset();
      52        7076 : }
      53             : 
      54           0 : SdrObjListIter::SdrObjListIter( const SdrMarkList& rMarkList, SdrIterMode eMode, bool bReverse )
      55             : :   mnIndex(0L),
      56           0 :     mbReverse(bReverse)
      57             : {
      58           0 :     ImpProcessMarkList(rMarkList, eMode);
      59           0 :     Reset();
      60           0 : }
      61             : 
      62       71547 : void SdrObjListIter::ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder)
      63             : {
      64      192480 :     for( size_t nIdx = 0, nCount = rObjList.GetObjCount(); nIdx < nCount; ++nIdx )
      65             :     {
      66             :         SdrObject* pObj = bUseZOrder ?
      67      120933 :             rObjList.GetObj( nIdx ) : rObjList.GetObjectForNavigationPosition( nIdx );
      68             :         OSL_ASSERT( pObj != 0 );
      69      120933 :         if( pObj )
      70      120933 :             ImpProcessObj( pObj, eMode, bUseZOrder );
      71             :     }
      72       71547 : }
      73             : 
      74           0 : void SdrObjListIter::ImpProcessMarkList( const SdrMarkList& rMarkList, SdrIterMode eMode )
      75             : {
      76           0 :     for( size_t nIdx = 0, nCount = rMarkList.GetMarkCount(); nIdx < nCount; ++nIdx )
      77           0 :         if( SdrObject* pObj = rMarkList.GetMark( nIdx )->GetMarkedSdrObj() )
      78           0 :             ImpProcessObj( pObj, eMode, false );
      79           0 : }
      80             : 
      81      120933 : void SdrObjListIter::ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder)
      82             : {
      83      120933 :     bool bIsGroup = pObj->IsGroupObject();
      84             :     // 3D objects are not group objects, IsGroupObject()
      85             :     // only tests if pSub is not null ptr :-(
      86      120933 :     if( bIsGroup && pObj->ISA( E3dObject ) && !pObj->ISA( E3dScene ) )
      87        1632 :         bIsGroup = false;
      88             : 
      89      120933 :     if( !bIsGroup || (eMode != IM_DEEPNOGROUPS) )
      90       87730 :         maObjList.push_back(pObj);
      91             : 
      92      120933 :     if( bIsGroup && (eMode != IM_FLAT) )
      93       33203 :         ImpProcessObjectList( *pObj->GetSubList(), eMode, bUseZOrder );
      94      120933 : }
      95             : 
      96             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11