Bump version to 6.4-15
[LibreOffice.git] / include / svx / svditer.hxx
blob6f64ccb316773109d7681b9513f2424ddcf840b6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
23 #include <vector>
25 #include <svx/svxdllapi.h>
27 class SdrObjList;
28 class SdrObject;
29 class SdrPage;
30 class SdrMarkList;
32 // SdrObjListIter methods:
33 // SdrIterMode::Flat : Flat over the list
34 // SdrIterMode::DeepWithGroups : With recursive descent parser, Next() also returns group objects
35 // SdrIterMode::DeepNoGroups : With recursive descent parser, Next() returns no group objects
36 enum class SdrIterMode { Flat, DeepWithGroups, DeepNoGroups };
38 class SVX_DLLPUBLIC SdrObjListIter
40 std::vector< const SdrObject* > maObjList;
41 size_t mnIndex;
42 bool const mbReverse;
43 bool mbUseZOrder;
45 void ImpProcessObjectList(const SdrObjList& rSdrObjList, SdrIterMode eMode);
46 void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode);
47 void ImpProcessObj(const SdrObject& rSdrObject, SdrIterMode eMode);
49 public:
50 explicit SdrObjListIter(const SdrObjList* pObjList, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
51 explicit SdrObjListIter(const SdrObjList* pObjList, bool bUseZOrder, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
53 /* SJ: the following function can now be used with every
54 SdrObject and is no longer limited to group objects */
55 explicit SdrObjListIter(const SdrObject& rSdrObject, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
56 explicit SdrObjListIter(const SdrPage* pSdrPage, SdrIterMode eMode = SdrIterMode::DeepNoGroups, bool bReverse = false);
58 /** Iterates over a list of marked objects received from the SdrMarkView. TTTT used in sc */
59 explicit SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = SdrIterMode::DeepNoGroups);
61 void Reset() { mnIndex = (mbReverse ? maObjList.size() : 0L); }
62 bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.size())); }
63 SdrObject* Next()
65 const size_t idx(mbReverse ? --mnIndex : mnIndex++);
66 return (idx < maObjList.size()) ? const_cast< SdrObject* >(maObjList[idx]) : nullptr;
69 size_t Count() { return maObjList.size(); }
72 #endif // INCLUDED_SVX_SVDITER_HXX
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */