LibreOffice Module svx (master)
1
svx
source
svdraw
svditer.cxx
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
#include <
svx/svditer.hxx
>
21
#include <
svx/svdpage.hxx
>
22
#include <
svx/svdobj.hxx
>
23
#include <
svx/svdmark.hxx
>
24
#include <osl/diagnose.h>
25
26
SdrObjListIter::SdrObjListIter
(
const
SdrObjList
* pObjList,
SdrIterMode
eMode,
bool
bReverse)
27
:
mnIndex
(0),
28
mbReverse(bReverse),
29
mbUseZOrder(true)
30
{
31
if
(
nullptr
!= pObjList)
32
{
33
ImpProcessObjectList
(*pObjList,
eMode
);
34
}
35
36
Reset
();
37
}
38
39
SdrObjListIter::SdrObjListIter
(
const
SdrObjList
* pObjList,
bool
bUseZOrder,
SdrIterMode
eMode,
bool
bReverse)
40
:
mnIndex
(0),
41
mbReverse(bReverse),
42
mbUseZOrder(bUseZOrder)
43
{
44
if
(
nullptr
!= pObjList)
45
{
46
// correct when we have no ObjectNavigationOrder
47
if
(!
mbUseZOrder
&& !pObjList->
HasObjectNavigationOrder
())
48
{
49
mbUseZOrder
=
false
;
50
}
51
52
ImpProcessObjectList
(*pObjList,
eMode
);
53
}
54
55
Reset
();
56
}
57
58
SdrObjListIter::SdrObjListIter
(
const
SdrObject
& rSdrObject,
SdrIterMode
eMode,
bool
bReverse)
59
:
mnIndex
(0),
60
mbReverse(bReverse),
61
mbUseZOrder(true)
62
{
63
ImpProcessObj
(rSdrObject,
eMode
);
64
Reset
();
65
}
66
67
SdrObjListIter::SdrObjListIter
(
const
SdrPage
* pSdrPage,
SdrIterMode
eMode,
bool
bReverse)
68
:
mnIndex
(0),
69
mbReverse(bReverse),
70
mbUseZOrder(true)
71
{
72
if
(pSdrPage)
73
ImpProcessObjectList
(*pSdrPage,
eMode
);
74
Reset
();
75
}
76
77
SdrObjListIter::SdrObjListIter
(
const
SdrMarkList
& rMarkList,
SdrIterMode
eMode )
78
:
mnIndex
(0),
79
mbReverse(false),
80
mbUseZOrder(true)
81
{
82
ImpProcessMarkList
(rMarkList,
eMode
);
83
Reset
();
84
}
85
86
void
SdrObjListIter::ImpProcessObjectList
(
const
SdrObjList
& rObjList,
SdrIterMode
eMode)
87
{
88
for
(
size_t
nIdx(0),
nCount
(rObjList.
GetObjCount
()); nIdx <
nCount
; ++nIdx)
89
{
90
const
SdrObject
* pSdrObject(
mbUseZOrder
91
? rObjList.
GetObj
(nIdx)
92
: rObjList.
GetObjectForNavigationPosition
(nIdx));
93
94
if
(
nullptr
== pSdrObject)
95
{
96
OSL_ENSURE(
false
,
"SdrObjListIter: corrupted SdrObjList (!)"
);
97
}
98
else
99
{
100
ImpProcessObj
(*pSdrObject,
eMode
);
101
}
102
}
103
}
104
105
void
SdrObjListIter::ImpProcessMarkList
(
const
SdrMarkList
& rMarkList,
SdrIterMode
eMode)
106
{
107
for
(
size_t
nIdx = 0,
nCount
= rMarkList.
GetMarkCount
(); nIdx <
nCount
; ++nIdx )
108
{
109
if
(
SdrObject
* pObj = rMarkList.
GetMark
( nIdx )->
GetMarkedSdrObj
() )
110
{
111
ImpProcessObj
(*pObj,
eMode
);
112
}
113
}
114
}
115
116
void
SdrObjListIter::ImpProcessObj
(
const
SdrObject
& rSdrObject,
SdrIterMode
eMode)
117
{
118
// TTTT: Note: The behaviour has changed here, it will now deep-iterate
119
// for SdrObjGroup and E3dScene. Old version only deep-dived for SdrObjGroup,
120
// E3dScene was just added flat. This is now more correct, but potentially
121
// there will exist code in the 3D area that *self-iterates* with local
122
// functions/methods due to this iterator was not doing the expected thing.
123
// These will be difficult to find, but in most cases should do no harm,
124
// but cost runtime. Will need to have an eye on this aspect on continued
125
// changes...
126
const
SdrObjList
* pChildren(rSdrObject.
getChildrenOfSdrObject
());
127
const
bool
bIsGroup(
nullptr
!= pChildren);
128
129
if
(!bIsGroup || (
SdrIterMode::DeepNoGroups
!=
eMode
))
130
{
131
maObjList
.push_back(&rSdrObject);
132
}
133
134
if
(bIsGroup && (
SdrIterMode::Flat
!=
eMode
))
135
{
136
ImpProcessObjectList
(*pChildren,
eMode
);
137
}
138
}
139
140
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SdrMarkList
Definition:
svdmark.hxx:137
SdrMarkList::GetMarkCount
size_t GetMarkCount() const
Definition:
svdmark.hxx:178
SdrMarkList::GetMark
SdrMark * GetMark(size_t nNum) const
Definition:
svdmark.cxx:230
SdrMark::GetMarkedSdrObj
SdrObject * GetMarkedSdrObj() const
Definition:
svdmark.hxx:68
SdrObjListIter::ImpProcessObj
void ImpProcessObj(const SdrObject &rSdrObject, SdrIterMode eMode)
Definition:
svditer.cxx:116
SdrObjListIter::SdrObjListIter
SdrObjListIter(const SdrObjList *pObjList, SdrIterMode eMode=SdrIterMode::DeepNoGroups, bool bReverse=false)
Definition:
svditer.cxx:26
SdrObjListIter::Reset
void Reset()
Definition:
svditer.hxx:61
SdrObjListIter::ImpProcessMarkList
void ImpProcessMarkList(const SdrMarkList &rMarkList, SdrIterMode eMode)
Definition:
svditer.cxx:105
SdrObjListIter::maObjList
std::vector< const SdrObject * > maObjList
Definition:
svditer.hxx:40
SdrObjListIter::ImpProcessObjectList
void ImpProcessObjectList(const SdrObjList &rSdrObjList, SdrIterMode eMode)
Definition:
svditer.cxx:86
SdrObjListIter::mbUseZOrder
bool mbUseZOrder
Definition:
svditer.hxx:43
SdrObjList
Definition:
svdpage.hxx:62
SdrObjList::GetObj
SdrObject * GetObj(size_t nNum) const
Definition:
svdpage.cxx:785
SdrObjList::GetObjCount
size_t GetObjCount() const
Definition:
svdpage.cxx:779
SdrObjList::HasObjectNavigationOrder
bool HasObjectNavigationOrder() const
Return whether there is an explicit, user defined, object navigation order.
Definition:
svdpage.cxx:865
SdrObjList::GetObjectForNavigationPosition
SdrObject * GetObjectForNavigationPosition(const sal_uInt32 nNavigationPosition) const
Return the object for the given navigation position.
Definition:
svdpage.cxx:916
SdrObject
Abstract DrawObject.
Definition:
svdobj.hxx:260
SdrObject::getChildrenOfSdrObject
virtual SdrObjList * getChildrenOfSdrObject() const
Definition:
svdobj.cxx:323
SdrPage
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition:
svdpage.hxx:379
nCount
int nCount
eMode
Mode eMode
svditer.hxx
SdrIterMode
SdrIterMode
Definition:
svditer.hxx:36
SdrIterMode::DeepNoGroups
@ DeepNoGroups
SdrIterMode::Flat
@ Flat
svdmark.hxx
svdobj.hxx
svdpage.hxx
mnIndex
sal_uInt32 mnIndex
Generated on Sun Jul 30 2023 04:28:21 for LibreOffice Module svx (master) by
1.9.3