office-gobmx/sd/source/ui/inc/OutlinerIteratorImpl.hxx
Oliver Bolte 98bd0fd01c CWS-TOOLING: integrate CWS impress166
2009-01-27 11:42:29 +0100 af  r266972 : #i98508# Handle non DrawViewShell view shells correctly.
2009-01-21 10:41:32 +0100 af  r266635 : #i98069# Do not call PreModelChange() for every ModelLock.
2009-01-20 15:25:41 +0100 af  r266588 : #i98069# Added friend declaration that became necessary on Solaris after recent changes.
2009-01-19 13:48:47 +0100 af  r266493 : #i97478# Prevent SID_PARASPACE_(DE|IN)CREASE from crashing when style sheet is missing.
2009-01-16 11:52:37 +0100 af  r266411 : #i97338# Check the dispatcher before using it to show a context menu.
2009-01-15 14:33:55 +0100 sj  r266373 : #153716# taking care of font-independent line spacing (editmode and hittest)
2009-01-15 14:29:46 +0100 sj  r266372 : #153716# taking care of font-independent line spacing also in presentation styles
2009-01-14 14:04:16 +0100 af  r266301 : #i97634# Do view change synchronously.  Use shared pointers for view shells.
2009-01-14 14:01:27 +0100 af  r266300 : #i97634# Added non-API methods that update the configuration synchronously.
2009-01-14 13:34:40 +0100 af  r266295 : #i98069# Be more carefull with handling model updates to avoid assertion regarding number of selected pages.
2009-01-14 11:34:57 +0100 cl  r266270 : #i97261# force outliner para oibject after text edit
2009-01-14 10:49:08 +0100 cl  r266269 : #i97413# dispose cell undo action if shape dies
2009-01-13 18:50:05 +0100 cl  r266247 : #i97347# fixed cell undo crash
2009-01-12 14:16:56 +0100 af  r266156 : #i97296# Using is() method to check WeakReference for validity.
2009-01-12 13:52:00 +0100 af  r266155 : #i97190# Turned static_cast to dynamic_cast in CreateChildList.
2009-01-12 13:06:57 +0100 af  r266153 : #i97552# Catching Exceptions caught while accessing OLE-Object that is to be inserted.
2009-01-12 13:06:37 +0100 cl  r266152 : #i96164# applied patch to fix ambiguous operation
2009-02-12 12:44:26 +00:00

275 lines
9.8 KiB
C++

/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: OutlinerIteratorImpl.hxx,v $
* $Revision: 1.6 $
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef SD_OUTLINER_ITERATOR_IMPL_HXX
#define SD_OUTLINER_ITERATOR_IMPL_HXX
#include <svx/svdobj.hxx>
#include "OutlinerIterator.hxx"
#include <boost/weak_ptr.hpp>
class SdDrawDocument;
class SdPage;
class SdrObjListIter;
namespace sd {
class ViewShell;
namespace outliner {
class IteratorImplBase;
/** Base class for the polymorphic implementation class of the
<type>Iterator</type> class. The iterators based on this class are
basically uni directional iterators. Their direction can, however, be
reversed at any point of their life time.
*/
class IteratorImplBase
{
public:
/** The constructor stores the given arguments to be used by the derived
classes.
@param pDocument
The document provides the information to be iterated on.
@param pViewShellWeak
Some information has to be taken from the view shell.
@param bDirectionIsForward
This flag defines the iteration direction. When <TRUE/> then
the direction is forwards otherwise it is backwards.
*/
IteratorImplBase (SdDrawDocument* pDocument,
const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
IteratorImplBase (SdDrawDocument* pDocument,
const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward, PageKind ePageKind, EditMode eEditMode);
virtual ~IteratorImplBase (void);
/** Advance to the next text of the current object or to the next object.
This takes the iteration direction into
account. The new object pointed to can be retrieved (among other
information) by calling the <member>GetPosition</member> method.
*/
virtual void GotoNextText (void) = 0;
/** Return an object that describes the current object.
@return
The returned object describes the current object pointed to by
the iterator. See the description of
<type>IteratorPosition</type> for details on the available
information.
*/
virtual const IteratorPosition& GetPosition (void);
/** Create an exact copy of this object. No argument should be
specified when called from the outside. It then creates an object
first and passes that to the inherited <member>Clone()</member>
methods to fill in class specific information.
@return
Returns a copy of this object. When this method is called with
an argument then this value will be returned.
*/
virtual IteratorImplBase* Clone (IteratorImplBase* pObject=NULL) const;
/** Test the equality of the this object and the given iterator. Two
iterators are taken to be equal when they point to the same object.
Iteration direction is not taken into account.
@param rIterator
The iterator to compare to.
@return
When both iterators ar equal <TRUE/> is returned, <FALSE/> otherwise.
*/
virtual bool operator== (const IteratorImplBase& rIterator) const;
/** This method is used by the equality operator. Additionaly to the
iterator it takes a type information which is taken into account on
comparison. It is part of a "multimethod" pattern.
@param rIterator
The iterator to compare to.
@param aType
The type of the iterator.
@return
Returns <TRUE/> when both iterators point to the same object.
*/
virtual bool IsEqual (const IteratorImplBase& rIterator, IteratorType aType) const;
/** Reverse the direction of iteration. The current object stays the same.
*/
virtual void Reverse (void);
protected:
/// The current position as returned by <member>GetPosition()</member>.
IteratorPosition maPosition;
/// The document on whose data the iterator operates.
SdDrawDocument* mpDocument;
/// Necessary secondary source of information.
::boost::weak_ptr<ViewShell> mpViewShellWeak;
/// Specifies the search direction.
bool mbDirectionIsForward;
};
/** Iterator all objects that belong to the current mark list
a.k.a. selection. It is assumed that all marked objects belong to the
same page. It is further assumed that the mark list does not change
while an iterator is alive. It is therefore the responsibility of an
iterator's owner to handle the case of a changed mark list.
<p>For documentation of the methods please refere to the base class
<type>IteratorImplBase</type>.</p>
*/
class SelectionIteratorImpl
: public IteratorImplBase
{
public:
SelectionIteratorImpl (
const ::std::vector< SdrObjectWeakRef >& rObjectList,
sal_Int32 nObjectIndex,
SdDrawDocument* pDocument,
const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
SelectionIteratorImpl (const SelectionIteratorImpl& rObject);
virtual ~SelectionIteratorImpl (void);
virtual void GotoNextText (void);
virtual const IteratorPosition& GetPosition (void);
virtual IteratorImplBase* Clone (IteratorImplBase* pObject) const;
virtual bool operator== (const IteratorImplBase& rIterator) const;
private:
const ::std::vector<SdrObjectWeakRef>& mrObjectList;
sal_Int32 mnObjectIndex;
/** Compare the given iterator with this object. This method handles
only the case that the given iterator is an instance of this class.
@param rIterator
The iterator to compare to.
@param aType
The type of the iterator.
@return
Returns <TRUE/> when both iterators point to the same object.
*/
virtual bool IsEqual (const IteratorImplBase& rIterator, IteratorType aType) const;
IteratorImplBase& operator= (const IteratorImplBase& rIterator);
};
/** Iterator for iteration over all objects in a single view. On reaching
the last object on the last page (or the first object on the first page)
the view is *not* switched. Further calls to the
<member>GotoNextObject()</member> method will be ignored.
<p>For documentation of the methods please refere to the base class
<type>IteratorImplBase</type>.</p>
*/
class ViewIteratorImpl : public IteratorImplBase
{
public:
ViewIteratorImpl (
sal_Int32 nPageIndex,
SdDrawDocument* pDocument,
const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
ViewIteratorImpl (
sal_Int32 nPageIndex,
SdDrawDocument* pDocument,
const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward,
PageKind ePageKind,
EditMode eEditMode);
virtual ~ViewIteratorImpl (void);
virtual void GotoNextText (void);
virtual IteratorImplBase* Clone (IteratorImplBase* pObject) const;
virtual void Reverse (void);
protected:
/// Number of pages in the view that is specified by <member>maPosition</member>.
sal_Int32 mnPageCount;
/** Initialize this iterator with respect to the given location. After
this call the object looks like newly constructed.
*/
void Init (IteratorLocation aLocation);
/** Set up page pointer and object list iterator for the specified
page.
@param nPageIndex
Index of the new page. It may lie outside the valid range for
page indices.
*/
void SetPage (sal_Int32 nPageIndex);
private:
/// Indicates whether a page changed occured on switching to current page.
bool mbPageChangeOccured;
/// Pointer to the page associated with the current page index. May be NULL.
SdPage* mpPage;
/// Iterator of all objects on the current page.
SdrObjListIter* mpObjectIterator;
// Don't use this operator.
ViewIteratorImpl& operator= (const ViewIteratorImpl&){return *this;};
};
/** Iterator for iteration over all objects in all views. It automatically
switches views when reaching the end/beginning of a view.
<p>For documentation of the methods please refere to the base class
<type>IteratorImplBase</type>.</p>
*/
class DocumentIteratorImpl : public ViewIteratorImpl
{
public:
DocumentIteratorImpl (
sal_Int32 nPageIndex,
PageKind ePageKind,
EditMode eEditMode,
SdDrawDocument* pDocument,
const ::boost::weak_ptr<ViewShell>& rpViewShellWeak,
bool bDirectionIsForward);
virtual ~DocumentIteratorImpl (void);
virtual void GotoNextText (void);
virtual IteratorImplBase* Clone (IteratorImplBase* pObject) const;
private:
sal_Int32 mnPageCount;
// Don't use this operator.
DocumentIteratorImpl& operator= (const DocumentIteratorImpl& ){return *this;};
};
} } // end of namespace ::sd::outliner
#endif