LibreOffice Module svx (master) 1
svditer.hxx
Go to the documentation of this file.
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 <svx/svxdllapi.h>
26
27class SdrObjList;
28class SdrObject;
29class SdrPage;
30class SdrMarkList;
31
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
37
39{
40 std::vector< const SdrObject* > maObjList;
41 size_t mnIndex;
44
45 void ImpProcessObjectList(const SdrObjList& rSdrObjList, SdrIterMode eMode);
46 void ImpProcessMarkList(const SdrMarkList& rMarkList, SdrIterMode eMode);
47 void ImpProcessObj(const SdrObject& rSdrObject, SdrIterMode eMode);
48
49public:
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);
52
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);
57
59 explicit SdrObjListIter(const SdrMarkList& rMarkList, SdrIterMode eMode = SdrIterMode::DeepNoGroups);
60
61 void Reset() { mnIndex = (mbReverse ? maObjList.size() : 0L); }
62 bool IsMore() const { return (mbReverse ? mnIndex != 0 : ( mnIndex < maObjList.size())); }
64 {
65 const size_t idx(mbReverse ? --mnIndex : mnIndex++);
66 return (idx < maObjList.size()) ? const_cast< SdrObject* >(maObjList[idx]) : nullptr;
67 }
68
69 size_t Count() const { return maObjList.size(); }
70};
71
72#endif // INCLUDED_SVX_SVDITER_HXX
73
74/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
size_t mnIndex
Definition: svditer.hxx:41
size_t Count() const
Definition: svditer.hxx:69
void Reset()
Definition: svditer.hxx:61
bool mbReverse
Definition: svditer.hxx:42
SdrObject * Next()
Definition: svditer.hxx:63
std::vector< const SdrObject * > maObjList
Definition: svditer.hxx:40
bool IsMore() const
Definition: svditer.hxx:62
bool mbUseZOrder
Definition: svditer.hxx:43
Abstract DrawObject.
Definition: svdobj.hxx:260
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:379
const sal_uInt16 idx[]
SdrIterMode
Definition: svditer.hxx:36
sal_uInt32 mnIndex
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35