LCOV - code coverage report
Current view: top level - include/svx - svditer.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 7 0.0 %
Date: 2014-04-14 Functions: 0 5 0.0 %
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             : #ifndef INCLUDED_SVX_SVDITER_HXX
      21             : #define INCLUDED_SVX_SVDITER_HXX
      22             : 
      23             : #include <vector>
      24             : 
      25             : #include <sal/types.h>
      26             : #include <svx/svxdllapi.h>
      27             : 
      28             : class SdrObjList;
      29             : class SdrObject;
      30             : class SdrMarkList;
      31             : 
      32             : // SdrObjListIter methods:
      33             : // IM_FLAT              : Flat over the list
      34             : // IM_DEEPWITHGROUPS    : With recursive descent parser, Next() also returns group objects
      35             : // IM_DEEPNOGROUPS      : With recursive descent parser, Next() returns no group objects
      36             : enum SdrIterMode { IM_FLAT, IM_DEEPWITHGROUPS, IM_DEEPNOGROUPS};
      37             : 
      38           0 : class SVX_DLLPUBLIC SdrObjListIter
      39             : {
      40             :     std::vector<SdrObject*>     maObjList;
      41             :     sal_uInt32                  mnIndex;
      42             :     bool                        mbReverse;
      43             : 
      44             :     void ImpProcessObjectList(const SdrObjList& rObjList, SdrIterMode eMode, bool bUseZOrder);
      45             :     void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode);
      46             :     void ImpProcessObj(SdrObject* pObj, SdrIterMode eMode, bool bUseZOrder);
      47             : 
      48             : public:
      49             :     explicit SdrObjListIter(const SdrObjList& rObjList, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false);
      50             :     /** This variant lets the user choose the order in which to travel over
      51             :         the objects.
      52             :         @param bUseZOrder
      53             :             When <TRUE/> then the z-order defines the order of iteration.
      54             :             Otherwise the navigation position as returned by
      55             :             SdrObject::GetNavigationPosition() is used.
      56             :     */
      57             :     SdrObjListIter(const SdrObjList& rObjList, bool bUseZOrder, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false);
      58             : 
      59             :     /* SJ: the following function can now be used with every
      60             :        SdrObject and is no longer limited to group objects */
      61             :     explicit SdrObjListIter(const SdrObject& rObj, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false);
      62             : 
      63             :     /** Iterates over a list of marked objects received from the SdrMarkView. */
      64             :     explicit SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = IM_DEEPNOGROUPS, bool bReverse = false);
      65             : 
      66           0 :     void Reset() { mnIndex = (mbReverse ? maObjList.size() : 0L); }
      67           0 :     bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.size())); }
      68           0 :     SdrObject* Next()
      69             :     {
      70           0 :         sal_uInt32 idx = (mbReverse ? --mnIndex : mnIndex++);
      71           0 :         return idx < maObjList.size() ? maObjList[idx] : NULL;
      72             :     }
      73             : 
      74           0 :     sal_uInt32 Count() { return maObjList.size(); }
      75             : };
      76             : 
      77             : #endif // INCLUDED_SVX_SVDITER_HXX
      78             : 
      79             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10