21#include "vreplacingcmd.h"
22#include "vselection.h"
33VReplacingCmd::~VReplacingCmd()
35 delete( m_oldObjects );
36 delete( m_newObjects );
44 bool successful =
false;
55 VObjectListIterator itr( m_oldObjects->
objects() );
58 for( ; itr.current(); ++itr )
61 newObject = itr.current()->
clone();
64 if(
visit( *newObject ) )
70 newObject, itr.current() );
73 m_newObjects->
append( newObject );
78 rejects.append( itr.current() );
83 VObjectListIterator jtr( rejects );
84 for( ; jtr.current(); ++jtr )
87 m_oldObjects->
take( *jtr.current() );
92 if( m_newObjects->
objects().count() == 0 )
96 VObjectListIterator itr( m_oldObjects->
objects() );
99 for( ; itr.current(); ++itr )
106 for( itr = m_newObjects->
objects(); itr.current(); ++itr )
121 if( m_newObjects->
objects().count() == 0 )
125 VObjectListIterator itr( m_oldObjects->
objects() );
128 for( ; itr.current(); ++itr )
135 for( itr = m_newObjects->
objects(); itr.current(); ++itr )
The base class for all karbon commands.
VDocument * document() const
Returns the document the command works on.
All non-visual, static doc info is in here.
VSelection * selection() const
Returns a pointer to the selection.
The base class for all karbon objects.
virtual VObject * clone() const =0
Create an exact copy of this object.
VObject * parent() const
Returns pointer to current parent object.
@ deleted
deleted, nearly dead
@ normal
visible, not active
virtual void insertInfrontOf(VObject *newObject, VObject *oldObject)
This function is important for undo/redo.
virtual void execute()
Executes the command.
VReplacingCmd(VDocument *doc, const TQString &name)
Make it "abstract".
virtual void unexecute()
Unexecutes the command.
VSelection manages a set of selected vobjects.
const VObjectList & objects() const
Read only access to the selected objects.
void append()
Adds all objects to the selection.
virtual VSelection * clone() const
Create an exact copy of this object.
void take(VObject &object)
Removes the reference to the object, not the object itself.
virtual bool visit(VObject &object)
General visit method.
void setSuccess(bool success=true)
Set the success property.