27#include <KoXmlWriter.h>
28#include <KoOasisLoadingContext.h>
29#include <KoStyleStack.h>
32#include "vcomposite.h"
33#include "shapes/vellipse.h"
34#include "shapes/vrectangle.h"
35#include "shapes/vsinus.h"
36#include "shapes/vspiral.h"
37#include "shapes/vstar.h"
38#include "shapes/vpolyline.h"
39#include "shapes/vpolygon.h"
46#include "vclipgroup.h"
68 VObjectListIterator itr = group.
m_objects;
69 for ( ; itr.current() ; ++itr )
70 append( itr.current()->clone() );
76 for ( ; itr.current(); ++itr )
78 delete( itr.current() );
95 for ( ; itr.current(); ++itr )
96 itr.current()->draw( painter, rect );
108 for( ; itr.current(); ++itr )
122 return new VGroup( *
this );
130 for ( ; itr.current() ; ++itr )
131 itr.current()->setFill(
fill );
141 for ( ; itr.current() ; ++itr )
142 itr.current()->setStroke(
stroke );
152 for ( ; itr.current() ; ++itr )
154 itr.current()->setState(
state );
164 TQDomElement me = element.ownerDocument().createElement(
"GROUP" );
165 element.appendChild( me );
170 for ( ; itr.current(); ++itr )
171 itr.current()->save( me );
178VGroup::saveOasis( KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyles,
int &index )
const
184 docWriter->startElement(
"draw:g" );
189 for ( ; itr.current(); ++itr )
190 itr.current()->saveOasis( store, docWriter, mainStyles, ++index );
192 docWriter->endElement();
202 TQDomNodeList list = element.childNodes();
203 for( uint i = 0; i < list.count(); ++i )
205 if( list.item( i ).isElement() )
207 TQDomElement e = list.item( i ).toElement();
209 kdDebug(38000) <<
"VGroup::loadOasis: e.tagName() = " << e.tagName() << endl;
210 kdDebug(38000) <<
"VGroup::loadOasis: e.namespaceURI() = " << e.namespaceURI() << endl;
211 kdDebug(38000) <<
"VGroup::loadOasis: e.localName() = " << e.localName() << endl;
213 if( e.namespaceURI() != KoXmlNS::draw )
216 context.styleStack().save();
218 if( e.localName() ==
"path" || e.localName() ==
"custom-shape" )
224 else if( e.localName() ==
"circle" || e.localName() ==
"ellipse" )
226 VEllipse* ellipse =
new VEllipse(
this );
227 ellipse->loadOasis( e, context );
230 else if( e.localName() ==
"rect" )
232 VRectangle* rectangle =
new VRectangle(
this );
233 rectangle->loadOasis( e, context );
236 else if( e.localName() ==
"g" )
242 else if( e.localName() ==
"polyline" || e.localName() ==
"line" )
244 VPolyline* polyline =
new VPolyline(
this );
245 polyline->loadOasis( e, context );
248 else if( e.localName() ==
"polygon" )
250 VPolygon* polygon =
new VPolygon(
this );
251 polygon->loadOasis( e, context );
255 context.styleStack().restore();
271 TQDomNodeList list = element.childNodes();
272 for( uint i = 0; i < list.count(); ++i )
274 if( list.item( i ).isElement() )
276 TQDomElement e = list.item( i ).toElement();
278 if( e.tagName() ==
"COMPOSITE" || e.tagName() ==
"PATH" )
281 composite->
load( e );
284 else if( e.tagName() ==
"ELLIPSE" )
286 VEllipse* ellipse =
new VEllipse(
this );
290 else if( e.tagName() ==
"RECT" )
292 VRectangle* rectangle =
new VRectangle(
this );
293 rectangle->load( e );
296 else if( e.tagName() ==
"POLYLINE" )
298 VPolyline* polyline =
new VPolyline(
this );
302 else if( e.tagName() ==
"POLYGON" )
304 VPolygon* polygon =
new VPolygon(
this );
308 else if( e.tagName() ==
"SINUS" )
310 VSinus* sinus =
new VSinus(
this );
314 else if( e.tagName() ==
"SPIRAL" )
316 VSpiral* spiral =
new VSpiral(
this );
320 else if( e.tagName() ==
"STAR" )
326 else if( e.tagName() ==
"GROUP" )
332 else if( e.tagName() ==
"CLIP" )
338 else if( e.tagName() ==
"IMAGE" )
340 VImage* img =
new VImage(
this );
344 else if( e.tagName() ==
"TEXT" )
346#ifdef HAVE_KARBONTEXT
347 VText *text =
new VText(
this );
374 object->setParent(
this );
Base class for clipping conglomerates the first child element is used for clipping.
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
Manages the fill of shapes.
Base class for all sort of VObject conglomerats.
void clear()
Clears the group, without destroying the grouped objects.
virtual void setState(const VState state)
Sets the state to a specified new state.
virtual VGroup * clone() const
Create an exact copy of this object.
virtual void insertInfrontOf(VObject *newObject, VObject *oldObject)
This function is important for undo/redo.
virtual void setStroke(const VStroke &stroke)
Sets the stroke to a given new stroke.
virtual void accept(VVisitor &visitor)
Accept a VVisitor.
virtual void saveOasis(KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyles, int &index) const
Save this object's state to OpenDocument.
virtual void setFill(const VFill &fill)
Sets the fill to a given new fill.
void take(const VObject &object)
Removes the reference to child object, not the object itself.
void append(VObject *object)
Appends a new child object.
VGroup(VObject *parent, VState state=normal)
Constructs a new group object that is child of parent and has the given state.
virtual const KoRect & boundingBox() const
Calculates the tightest bounding box around the object.
virtual void draw(VPainter *painter, const KoRect *rect=0L) const
Draw the object to a painting device.
VObjectList m_objects
the list of grouped objects
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
virtual ~VGroup()
Destroys the group and all of the child objects.
virtual void save(TQDomElement &element) const
Save this object's state to xml.
virtual bool loadOasis(const TQDomElement &element, KoOasisLoadingContext &context)
Load this object's state from OpenDocument and initialize this object accordingly.
bool m_boundingBoxIsInvalid
the flag stating if the bounding box is valid
VObject(VObject *parent, VState state=edit)
Constructs a new object that is child of parent and has the given state.
virtual void setState(const VState state)
Sets the state to a specified new state.
VObject * parent() const
Returns pointer to current parent object.
@ hidden_locked
hidden and locked (r/o)
@ deleted
deleted, nearly dead
VState m_state
the object's state
VStroke * m_stroke
the object's stroke
virtual void setStroke(const VStroke &stroke)
Sets the stroke to a given new stroke.
void setParent(VObject *parent)
Sets a new parent object.
VFill * m_fill
the object's fill
void invalidateBoundingBox()
Invalidates the bounding box, so it has to be recalculated.
virtual VFill * fill() const
Gets the object's actual fill.
KoRect m_boundingBox
the object's bounding box
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
virtual VStroke * stroke() const
Gets the object's actual stroke.
virtual void save(TQDomElement &element) const
Save this object's state to xml.
virtual void setFill(const VFill &fill)
Sets the fill to a given new fill.
VState state() const
Get the state the object is in.
A composite path consists of one or many subpaths.
virtual bool loadOasis(const TQDomElement &element, KoOasisLoadingContext &context)
Load this object's state from OpenDocument and initialize this object accordingly.
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
This shape offers star-like shapes with a lot of parameters :
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
Manages stroke properties.
The abstract visitor class.
virtual void visitVGroup(VGroup &group)
Visit method for a VGroup.