25#include "vselection.h"
27#include "vcomposite.h"
31VFillCmd::VFillCmd(
VDocument *doc,
const VFill &fill,
const TQString &icon )
32 :
VCommand( doc, i18n(
"Fill Objects" ), icon ), m_fill( fill )
34 m_selection = document()->selection()->clone();
36 if( m_selection->objects().count() == 1 )
37 setName( i18n(
"Fill Object" ) );
48VFillCmd::changeFill(
const VFill &fill )
55 VObjectListIterator itr( m_selection->objects() );
57 for( ; itr.current() ; ++itr )
59 visit( *itr.current() );
66VFillCmd::visitVGroup(
VGroup& group )
68 VObjectListIterator itr( group.
objects() );
70 for( ; itr.current() ; ++itr )
72 m_oldfills.push_back( VFill( *( itr.current()->fill() ) ) );
73 itr.current()->setFill( m_fill );
74 m_objects.append(itr.current() );
79VFillCmd::visitVPath(
VPath& composite )
81 m_oldfills.push_back( VFill( *( composite.
fill() ) ) );
83 m_objects.append( &composite );
87VFillCmd::visitVText( VText& text )
89 m_oldfills.push_back( VFill( *( text.
fill() ) ) );
91 m_objects.append( &text );
99 VObjectListIterator itr( m_selection->objects() );
101 for( ; itr.current() ; ++itr )
103 visit( *itr.current() );
112 VObjectListIterator itr( m_objects );
116 for( ; itr.current() ; ++itr )
118 itr.current()->setFill( m_oldfills[ i++ ] );
The base class for all karbon commands.
virtual void unexecute()
Unexecutes the command.
VDocument * document() const
Returns the document the command works on.
virtual void execute()=0
Executes the command.
All non-visual, static doc info is in here.
VSelection * selection() const
Returns a pointer to the selection.
Manages the fill of shapes.
Base class for all sort of VObject conglomerats.
const VObjectList & objects() const
Read only access to the grouped objects.
virtual VFill * fill() const
Gets the object's actual fill.
virtual void setFill(const VFill &fill)
Sets the fill to a given new fill.
A composite path consists of one or many subpaths.
virtual VSelection * clone() const
Create an exact copy of this object.
virtual bool visit(VObject &object)
General visit method.
void setSuccess(bool success=true)
Set the success property.