LibreOffice Module sd (master) 1
OutlinerIteratorImpl.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#pragma once
21
22#include <svx/svditer.hxx>
23#include <OutlinerIterator.hxx>
24#include <optional>
25
26class SdDrawDocument;
27class SdPage;
28
29namespace sd {
30
31class ViewShell;
32
33namespace outliner {
34
41{
42public:
54 const std::weak_ptr<ViewShell>& rpViewShellWeak,
55 bool bDirectionIsForward);
57 std::weak_ptr<ViewShell> pViewShellWeak,
58 bool bDirectionIsForward, PageKind ePageKind, EditMode eEditMode);
59 virtual ~IteratorImplBase();
60
66 virtual void GotoNextText() = 0;
74 virtual const IteratorPosition& GetPosition();
83 virtual IteratorImplBase* Clone (IteratorImplBase* pObject=nullptr) const;
92 virtual bool operator== (const IteratorImplBase& rIterator) const;
99 virtual bool IsEqualSelection(const IteratorImplBase& rIterator) const;
102 virtual void Reverse();
103
104protected:
110 std::weak_ptr<ViewShell> mpViewShellWeak;
113};
114
125 : public IteratorImplBase
126{
127public:
129 const ::std::vector< ::unotools::WeakReference<SdrObject> >& rObjectList,
130 sal_Int32 nObjectIndex,
131 SdDrawDocument* pDocument,
132 const std::weak_ptr<ViewShell>& rpViewShellWeak,
133 bool bDirectionIsForward);
135 virtual ~SelectionIteratorImpl() override;
136
137 virtual void GotoNextText() override;
138 virtual const IteratorPosition& GetPosition() override;
139 virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override;
140 virtual bool operator== (const IteratorImplBase& rIterator) const override;
141
142private:
143 const ::std::vector<::unotools::WeakReference<SdrObject>>& mrObjectList;
144 sal_Int32 mnObjectIndex;
145
153 virtual bool IsEqualSelection(const IteratorImplBase& rIterator) const override;
154
156};
157
167{
168public:
170 sal_Int32 nPageIndex,
171 SdDrawDocument* pDocument,
172 const std::weak_ptr<ViewShell>& rpViewShellWeak,
173 bool bDirectionIsForward);
175 sal_Int32 nPageIndex,
176 SdDrawDocument* pDocument,
177 const std::weak_ptr<ViewShell>& rpViewShellWeak,
178 bool bDirectionIsForward,
179 PageKind ePageKind,
180 EditMode eEditMode);
181 virtual ~ViewIteratorImpl() override;
182
183 virtual void GotoNextText() override;
184 virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override;
185 virtual void Reverse() override;
186
187protected:
194 void SetPage (sal_Int32 nPageIndex);
195
196private:
202 std::optional<SdrObjListIter> moObjectIterator;
203
204 // Don't use this operator.
206};
207
215{
216public:
218 sal_Int32 nPageIndex,
219 PageKind ePageKind,
220 EditMode eEditMode,
221 SdDrawDocument* pDocument,
222 const std::weak_ptr<ViewShell>& rpViewShellWeak,
223 bool bDirectionIsForward);
224 virtual ~DocumentIteratorImpl() override;
225
226 virtual void GotoNextText() override;
227 virtual IteratorImplBase* Clone (IteratorImplBase* pObject = nullptr) const override;
228
229private:
231 sal_Int32 mnPageCount;
232
233 // Don't use this operator.
235};
236
237} } // end of namespace ::sd::outliner
238
239/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Iterator for iteration over all objects in all views.
sal_Int32 mnPageCount
Number of pages in the view that is specified by <member>maPosition</member>.
DocumentIteratorImpl(sal_Int32 nPageIndex, PageKind ePageKind, EditMode eEditMode, SdDrawDocument *pDocument, const std::weak_ptr< ViewShell > &rpViewShellWeak, bool bDirectionIsForward)
virtual IteratorImplBase * Clone(IteratorImplBase *pObject=nullptr) const override
Create an exact copy of this object.
DocumentIteratorImpl & operator=(const DocumentIteratorImpl &)=delete
virtual void GotoNextText() override
Advance to the next text of the current object or to the next object.
Base class for the polymorphic implementation class of the <type>Iterator</type> class.
IteratorImplBase(SdDrawDocument *pDocument, const std::weak_ptr< ViewShell > &rpViewShellWeak, bool bDirectionIsForward)
The constructor stores the given arguments to be used by the derived classes.
SdDrawDocument * mpDocument
The document on whose data the iterator operates.
virtual bool IsEqualSelection(const IteratorImplBase &rIterator) const
This method is used by the equality operator.
bool mbDirectionIsForward
Specifies the search direction.
virtual IteratorImplBase * Clone(IteratorImplBase *pObject=nullptr) const
Create an exact copy of this object.
virtual bool operator==(const IteratorImplBase &rIterator) const
Test the equality of the this object and the given iterator.
std::weak_ptr< ViewShell > mpViewShellWeak
Necessary secondary source of information.
virtual void GotoNextText()=0
Advance to the next text of the current object or to the next object.
IteratorPosition maPosition
The current position as returned by <member>GetPosition()</member>.
virtual const IteratorPosition & GetPosition()
Return an object that describes the current object.
virtual void Reverse()
Reverse the direction of iteration.
Data collection specifying a <type>SdrObject</type> and its position in a document and view.
Iterator all objects that belong to the current mark list a.k.a.
SelectionIteratorImpl(const SelectionIteratorImpl &rObject)
SelectionIteratorImpl(const ::std::vector< ::unotools::WeakReference< SdrObject > > &rObjectList, sal_Int32 nObjectIndex, SdDrawDocument *pDocument, const std::weak_ptr< ViewShell > &rpViewShellWeak, bool bDirectionIsForward)
virtual bool IsEqualSelection(const IteratorImplBase &rIterator) const override
Compare the given iterator with this object.
IteratorImplBase & operator=(const IteratorImplBase &rIterator)
virtual IteratorImplBase * Clone(IteratorImplBase *pObject=nullptr) const override
Create an exact copy of this object.
virtual bool operator==(const IteratorImplBase &rIterator) const override
Test the equality of the this object and the given iterator.
virtual void GotoNextText() override
Advance to the next text of the current object or to the next object.
virtual const IteratorPosition & GetPosition() override
Return an object that describes the current object.
const ::std::vector<::unotools::WeakReference< SdrObject > > & mrObjectList
Iterator for iteration over all objects in a single view.
bool mbPageChangeOccurred
Indicates whether a page changed occurred on switching to current page.
std::optional< SdrObjListIter > moObjectIterator
Iterator of all objects on the current page.
void SetPage(sal_Int32 nPageIndex)
Set up page pointer and object list iterator for the specified page.
virtual IteratorImplBase * Clone(IteratorImplBase *pObject=nullptr) const override
Create an exact copy of this object.
SdPage * mpPage
Pointer to the page associated with the current page index. May be NULL.
virtual void GotoNextText() override
Advance to the next text of the current object or to the next object.
virtual void Reverse() override
Reverse the direction of iteration.
ViewIteratorImpl & operator=(const ViewIteratorImpl &)=delete
ViewIteratorImpl(sal_Int32 nPageIndex, SdDrawDocument *pDocument, const std::weak_ptr< ViewShell > &rpViewShellWeak, bool bDirectionIsForward)
EmbeddedObjectRef * pObject
EditMode
Definition: pres.hxx:53
PageKind
Definition: pres.hxx:45