1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDITER_HXX
21 #define INCLUDED_SVX_SVDITER_HXX
25 #include <sal/types.h>
26 #include <svx/svxdllapi.h>
33 // SdrObjListIter methods:
34 // SdrIterMode::Flat : Flat over the list
35 // SdrIterMode::DeepWithGroups : With recursive descent parser, Next() also returns group objects
36 // SdrIterMode::DeepNoGroups : With recursive descent parser, Next() returns no group objects
37 enum class SdrIterMode
{ Flat
, DeepWithGroups
, DeepNoGroups
};
39 class SVX_DLLPUBLIC SdrObjListIter
41 std::vector
< const SdrObject
* > maObjList
;
46 void ImpProcessObjectList(const SdrObjList
& rSdrObjList
, SdrIterMode eMode
);
47 void ImpProcessMarkList(const SdrMarkList
& rMarkList
, SdrIterMode eMode
);
48 void ImpProcessObj(const SdrObject
& rSdrObject
, SdrIterMode eMode
);
51 explicit SdrObjListIter(const SdrObjList
* pObjList
, SdrIterMode eMode
= SdrIterMode::DeepNoGroups
, bool bReverse
= false);
52 explicit SdrObjListIter(const SdrObjList
* pObjList
, bool bUseZOrder
, SdrIterMode eMode
= SdrIterMode::DeepNoGroups
, bool bReverse
= false);
54 /* SJ: the following function can now be used with every
55 SdrObject and is no longer limited to group objects */
56 explicit SdrObjListIter(const SdrObject
& rSdrObject
, SdrIterMode eMode
= SdrIterMode::DeepNoGroups
, bool bReverse
= false);
57 explicit SdrObjListIter(const SdrPage
* pSdrPage
, SdrIterMode eMode
= SdrIterMode::DeepNoGroups
, bool bReverse
= false);
59 /** Iterates over a list of marked objects received from the SdrMarkView. TTTT used in sc */
60 explicit SdrObjListIter(const SdrMarkList
& rMarkList
, SdrIterMode eMode
= SdrIterMode::DeepNoGroups
);
62 void Reset() { mnIndex
= (mbReverse
? maObjList
.size() : 0L); }
63 bool IsMore() const { return (mbReverse
? mnIndex
!= 0 : ( mnIndex
< maObjList
.size())); }
66 const size_t idx(mbReverse
? --mnIndex
: mnIndex
++);
67 return (idx
< maObjList
.size()) ? const_cast< SdrObject
* >(maObjList
[idx
]) : nullptr;
70 size_t Count() { return maObjList
.size(); }
73 #endif // INCLUDED_SVX_SVDITER_HXX
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */