LibreOffice Module sd (master) 1
OutlinerIterator.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/svdobj.hxx>
23
24#include "pres.hxx"
25#include <sal/types.h>
26#include <memory>
27#include <vector>
28
29class SdDrawDocument;
30class SdOutliner;
31
32namespace sd {
33
34class ViewShell;
35
36namespace outliner {
37
38class IteratorImplBase;
39class IteratorPosition;
40
52
75{
76public:
77 Iterator();
78
82 Iterator (const Iterator& rIterator);
83 Iterator(Iterator&& rIterator) noexcept;
84
90 explicit Iterator (std::unique_ptr<IteratorImplBase> pObject);
91
92 ~Iterator();
93
99 Iterator& operator= (const Iterator& rIterator);
100 Iterator& operator=(Iterator&& rIterator) noexcept;
101
108 const IteratorPosition& operator* () const;
124 bool operator== (const Iterator& rIterator) const;
132 bool operator!= (const Iterator& rIterator) const;
136 void Reverse();
137
138private:
140 std::unique_ptr<IteratorImplBase> mxIterator;
141};
142
154{
155public:
161 OutlinerContainer (SdOutliner* pOutliner);
162
170 Iterator begin();
171
180 Iterator end();
181
192
193private:
196
208
226 const ::std::vector<::unotools::WeakReference<SdrObject>>& rObjectList,
227 SdDrawDocument* pDocument,
228 const std::shared_ptr<ViewShell>& rpViewShell,
229 bool bDirectionIsForward,
230 IteratorLocation aLocation);
231
244 SdDrawDocument* pDocument,
245 const std::shared_ptr<ViewShell>& rpViewShell,
246 bool bDirectionIsForward,
247 IteratorLocation aLocation);
248
266 static sal_Int32 GetPageIndex (
267 SdDrawDocument const * pDocument,
268 const std::shared_ptr<ViewShell>& rpViewShell,
269 PageKind ePageKind,
270 EditMode eEditMode,
271 bool bDirectionIsForward,
272 IteratorLocation aLocation);
273
274 // Do not allow default constructor and copying of outliner containers.
277};
278
283{
284public:
290
296 bool operator== (const IteratorPosition& aPosition) const;
297
300
302 sal_Int32 mnText;
303
305 sal_Int32 mnPageIndex;
310};
311
312} } // end of namespace ::sd::outliner
313
314/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
The main purpose of this class is searching and replacing as well as spelling of impress documents.
Definition: Outliner.hxx:123
Data collection specifying a <type>SdrObject</type> and its position in a document and view.
bool operator==(const IteratorPosition &aPosition) const
Compare two positions for equality.
PageKind mePageKind
Page kind of the view.
EditMode meEditMode
Edit mode of the view.
IteratorPosition()
Create a new object with all data members set to default values.
sal_Int32 mnPageIndex
The index of a page where the object is located on.
sal_Int32 mnText
Number of the actual SdrText from the current <type>SdrObject</type>
::unotools::WeakReference< SdrObject > mxObject
Pointer to the actual <type>SdrObject</type> object.
This iterator can be used to iterate over all <type>SdrObject</type> objects of one of three set deno...
void Reverse()
Reverse the direction of iteration.
const IteratorPosition & operator*() const
Return the current position of the iterator.
Iterator & operator++()
The prefix increment operator returns the iterator pointing to the next object.
Iterator & operator=(const Iterator &rIterator)
Assign the iterator from the given one.
bool operator==(const Iterator &rIterator) const
Test equality of two iterators.
std::unique_ptr< IteratorImplBase > mxIterator
The implementation object to which most of the methods are forwarded.
bool operator!=(const Iterator &rIterator) const
Test whether two iterators point to different objects.
This class wraps the <type>SdOutliner</type> class and represents it as a container of <type>SdrObjec...
Iterator current()
Return an iterator that points to the current object of one of the sets described above.
OutlinerContainer & operator=(const OutlinerContainer &)=delete
OutlinerContainer(SdOutliner *pOutliner)
Create a new wrapper object for the given outliner.
static sal_Int32 GetPageIndex(SdDrawDocument const *pDocument, const std::shared_ptr< ViewShell > &rpViewShell, PageKind ePageKind, EditMode eEditMode, bool bDirectionIsForward, IteratorLocation aLocation)
Return the index of a page that contains an object that a new iterator shall point to.
OutlinerContainer(const OutlinerContainer &)=delete
Iterator begin()
Return an iterator that points to the first object of one of the sets described above.
Iterator CreateIterator(IteratorLocation aLocation)
Create an iterator.
Iterator end()
Return an iterator that marks the end of the iteration.
static Iterator CreateSelectionIterator(const ::std::vector<::unotools::WeakReference< SdrObject > > &rObjectList, SdDrawDocument *pDocument, const std::shared_ptr< ViewShell > &rpViewShell, bool bDirectionIsForward, IteratorLocation aLocation)
Create an iterator that iterates over all currently selected <type>SdrObjects</type> objects of the <...
static Iterator CreateDocumentIterator(SdDrawDocument *pDocument, const std::shared_ptr< ViewShell > &rpViewShell, bool bDirectionIsForward, IteratorLocation aLocation)
Create an iterator that iterates over all <type>SdrObjects</type> objects of the <member>mpOutliner</...
SdOutliner * mpOutliner
The wrapped outliner that is represented as object container.
EmbeddedObjectRef * pObject
IteratorLocation
Use this enum to specify the initial location of the object pointed to by a newly created iterator.
EditMode
Definition: pres.hxx:53
PageKind
Definition: pres.hxx:45