LCOV - code coverage report
Current view: top level - svx/inc/svx - svditer.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 7 85.7 %
Date: 2012-08-25 Functions: 4 5 80.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 4 8 50.0 %

           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                 :            : #ifndef _SVDITER_HXX
      30                 :            : #define _SVDITER_HXX
      31                 :            : 
      32                 :            : #include <vector>
      33                 :            : 
      34                 :            : #include <sal/types.h>
      35                 :            : #include "svx/svxdllapi.h"
      36                 :            : 
      37                 :            : class SdrObjList;
      38                 :            : class SdrObject;
      39                 :            : class SdrMarkList;
      40                 :            : 
      41                 :            : // SdrObjListIter methods:
      42                 :            : // IM_FLAT              : Flat over the list
      43                 :            : // IM_DEEPWITHGROUPS    : With recursive descent parser, Next() also returns group objects
      44                 :            : // IM_DEEPNOGROUPS      : With recursive descent parser, Next() returns no group objects
      45                 :            : enum SdrIterMode { IM_FLAT, IM_DEEPWITHGROUPS, IM_DEEPNOGROUPS};
      46                 :            : 
      47                 :       8697 : class SVX_DLLPUBLIC SdrObjListIter
      48                 :            : {
      49                 :            :     std::vector<SdrObject*>     maObjList;
      50                 :            :     sal_uInt32                  mnIndex;
      51                 :            :     bool                        mbReverse;
      52                 :            : 
      53                 :            :     void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder);
      54                 :            :     void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode);
      55                 :            :     void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder);
      56                 :            : 
      57                 :            : public:
      58                 :            :     explicit SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false);
      59                 :            :     /** This variant lets the user choose the order in which to travel over
      60                 :            :         the objects.
      61                 :            :         @param bUseZOrder
      62                 :            :             When <TRUE/> then the z-order defines the order of iteration.
      63                 :            :             Otherwise the navigation position as returned by
      64                 :            :             SdrObject::GetNavigationPosition() is used.
      65                 :            :     */
      66                 :            :     SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false);
      67                 :            : 
      68                 :            :     /* SJ: the following function can now be used with every
      69                 :            :        SdrObject and is no longer limited to group objects */
      70                 :            :     explicit SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false);
      71                 :            : 
      72                 :            :     /** Iterates over a list of marked objects received from the SdrMarkView. */
      73                 :            :     explicit SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false);
      74                 :            : 
      75         [ -  + ]:      16737 :     void Reset() { mnIndex = (mbReverse ? maObjList.size() : 0L); }
      76         [ -  + ]:      10378 :     bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.size())); }
      77                 :       3479 :     SdrObject* Next()
      78                 :            :     {
      79         [ -  + ]:       3479 :         sal_uInt32 idx = (mbReverse ? --mnIndex : mnIndex++);
      80         [ +  - ]:       3479 :         return idx < maObjList.size() ? maObjList[idx] : NULL;
      81                 :            :     }
      82                 :            : 
      83                 :          0 :     sal_uInt32 Count() { return maObjList.size(); }
      84                 :            : };
      85                 :            : 
      86                 :            : #endif //_SVDITER_HXX
      87                 :            : 
      88                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10