24#include <osl/diagnose.h>
60 : mxIterator(rIterator.mxIterator ? rIterator.mxIterator->
Clone() : nullptr)
65 : mxIterator(std::move(rIterator.mxIterator))
80 if (
this != &rIterator)
92 mxIterator = std::move(rIterator.mxIterator);
131: mpOutliner(pOutliner)
174 const std::shared_ptr<ViewShell>& rpViewShell,
175 bool bDirectionIsForward,
178 OSL_ASSERT(rpViewShell);
180 sal_Int32 nObjectIndex;
182 if (bDirectionIsForward)
191 nObjectIndex = rObjectList.size();
200 nObjectIndex = rObjectList.size()-1;
207 return Iterator (std::make_unique<SelectionIteratorImpl> (
208 rObjectList, nObjectIndex, pDocument, rpViewShell, bDirectionIsForward));
213 const std::shared_ptr<ViewShell>& rpViewShell,
214 bool bDirectionIsForward,
217 OSL_ASSERT(rpViewShell);
226 if (bDirectionIsForward)
239 if (bDirectionIsForward)
252 const std::shared_ptr<DrawViewShell> pDrawViewShell(
253 std::dynamic_pointer_cast<DrawViewShell>(rpViewShell));
256 ePageKind = pDrawViewShell->GetPageKind();
257 eEditMode = pDrawViewShell->GetEditMode();
267 sal_Int32 nPageIndex =
GetPageIndex (pDocument, rpViewShell,
268 ePageKind, eEditMode, bDirectionIsForward, aLocation);
271 std::make_unique<DocumentIteratorImpl> (nPageIndex, ePageKind, eEditMode,
272 pDocument, rpViewShell, bDirectionIsForward));
277 const std::shared_ptr<ViewShell>& rpViewShell,
280 bool bDirectionIsForward,
283 OSL_ASSERT(rpViewShell);
285 sal_Int32 nPageIndex;
286 sal_Int32 nPageCount;
288 const std::shared_ptr<DrawViewShell> pDrawViewShell(
289 std::dynamic_pointer_cast<DrawViewShell>(rpViewShell));
307 nPageIndex = pDrawViewShell->GetCurPagePos();
310 const SdPage* pPage = rpViewShell->GetActualPage();
311 if (pPage !=
nullptr)
320 if (bDirectionIsForward)
323 nPageIndex = nPageCount-1;
327 if (bDirectionIsForward)
328 nPageIndex = nPageCount;
340 const std::weak_ptr<ViewShell>& rpViewShellWeak,
341 bool bDirectionIsForward)
342: mpDocument (pDocument)
343, mpViewShellWeak (rpViewShellWeak)
344, mbDirectionIsForward (bDirectionIsForward)
346 std::shared_ptr<DrawViewShell> pDrawViewShell;
348 pDrawViewShell = std::dynamic_pointer_cast<DrawViewShell>(rpViewShellWeak.lock());
363 std::weak_ptr<ViewShell> pViewShellWeak,
365: mpDocument (pDocument)
366, mpViewShellWeak (
std::move(pViewShellWeak))
367, mbDirectionIsForward (bDirectionIsForward)
415 sal_Int32 nObjectIndex,
417 const std::weak_ptr<ViewShell>& rpViewShellWeak,
418 bool bDirectionIsForward)
420 mrObjectList(rObjectList),
421 mnObjectIndex(nObjectIndex)
431 if (pIterator ==
nullptr)
508 sal_Int32 nPageIndex,
510 const std::weak_ptr<ViewShell>& rpViewShellWeak,
511 bool bDirectionIsForward)
513 mbPageChangeOccurred(false),
520 sal_Int32 nPageIndex,
522 const std::weak_ptr<ViewShell>& rpViewShellWeak,
523 bool bDirectionIsForward,
526 :
IteratorImplBase (pDocument, rpViewShellWeak, bDirectionIsForward, ePageKind, eEditMode),
527 mbPageChangeOccurred(false),
541 if (pIterator ==
nullptr)
617 sal_Int32 nPageCount;
629 if (nPageIndex>=0 && nPageIndex < nPageCount)
633 static_cast<sal_uInt16
>(nPageIndex),
637 static_cast<sal_uInt16
>(nPageIndex),
690 sal_Int32 nPageIndex,
693 const std::weak_ptr<ViewShell>& rpViewShellWeak,
694 bool bDirectionIsForward)
695 :
ViewIteratorImpl (nPageIndex, pDocument, rpViewShellWeak, bDirectionIsForward,
696 ePageKind, eEditMode)
710 if (pIterator ==
nullptr)
720 bool bSetToOnePastLastPage =
false;
721 bool bViewChanged =
false;
741 bSetToOnePastLastPage =
true;
762 bSetToOnePastLastPage =
true;
777 bSetToOnePastLastPage =
true;
787 sal_Int32 nPageCount;
794 if (bSetToOnePastLastPage)
sal_uInt16 GetMasterSdPageCount(PageKind ePgKind) const
SdPage * GetSdPage(sal_uInt16 nPgNum, PageKind ePgKind) const
SdPage * GetMasterSdPage(sal_uInt16 nPgNum, PageKind ePgKind)
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
The main purpose of this class is searching and replacing as well as spelling of impress documents.
::std::vector< unotools::WeakReference< SdrObject > > maMarkListCopy
When the search is restricted to the current selection then this list contains pointers to all the ob...
bool mbRestrictSearchToSelection
This flag indicates that only the selected objects are to be searched.
std::weak_ptr<::sd::ViewShell > mpWeakViewShell
The view shell containing the view.
bool mbDirectionIsForward
This flag indicates whether to search forward or backwards.
SdDrawDocument * mpDrawDocument
The document on whose objects and pages this class operates.
sal_uInt16 GetPageNum() const
virtual sal_Int32 getTextCount() const override
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.
virtual void GotoNextText() override
Advance to the next text of the current object or to the next object.
virtual ~DocumentIteratorImpl() override
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.
virtual ~IteratorImplBase()
std::weak_ptr< ViewShell > mpViewShellWeak
Necessary secondary source of information.
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.
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.
Iterator current()
Return an iterator that points to the current object of one of the sets described above.
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.
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.
Iterator all objects that belong to the current mark list a.k.a.
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.
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 ~SelectionIteratorImpl() override
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.
virtual ~ViewIteratorImpl() override
ViewIteratorImpl(sal_Int32 nPageIndex, SdDrawDocument *pDocument, const std::weak_ptr< ViewShell > &rpViewShellWeak, bool bDirectionIsForward)
#define DBG_ASSERT(sCon, aError)
EmbeddedObjectRef * pObject
IteratorLocation
Use this enum to specify the initial location of the object pointed to by a newly created iterator.
Reference< XAnimationNode > Clone(const Reference< XAnimationNode > &xSourceNode, const SdPage *pSource, const SdPage *pTarget)
SVXCORE_DLLPUBLIC SdrTextObj * DynCastSdrTextObj(SdrObject *)