20#ifndef __VCOMPOSITE_H__
21#define __VCOMPOSITE_H__
29#include "svgpathparser.h"
31#include <koffice_export.h>
39typedef TQPtrList<VSubpath> VSubpathList;
40typedef TQPtrListIterator<VSubpath> VSubpathListIterator;
47class KARBONBASE_EXPORT VPath :
public VObject, SVGPathParser
51 VPath(
const VPath& path );
62 bool moveTo(
const KoPoint& p );
63 bool lineTo(
const KoPoint& p );
77 const KoPoint& p1,
const KoPoint& p2,
const KoPoint& p3 );
90 bool curve1To(
const KoPoint& p2,
const KoPoint& p3 );
103 bool curve2To(
const KoPoint& p1,
const KoPoint& p3 );
123 bool arcTo(
const KoPoint& p1,
const KoPoint& p2,
double r );
130 bool isClosed()
const;
135 void combine(
const VPath& path );
155 const VSubpathList& paths()
const
163 VFillRule fillMode()
const;
166 VFillRule fillRule()
const
171 void setFillRule( VFillRule fillRule )
173 m_fillRule = fillRule;
177 virtual void draw( VPainter *painter,
const KoRect* rect = 0L )
const;
179 bool drawCenterNode()
const
181 return m_drawCenterNode;
184 void setDrawCenterNode(
bool drawCenterNode =
true )
186 m_drawCenterNode = drawCenterNode;
190 virtual void save( TQDomElement& element )
const;
191 virtual void saveOasis( KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyles,
int &index )
const;
192 virtual void load(
const TQDomElement& element );
193 virtual bool loadOasis(
const TQDomElement &element, KoOasisLoadingContext &context );
195 virtual VPath*
clone()
const;
199 void transform(
const TQString &transform );
200 void transformOasis(
const TQString &transform );
202 static TQWMatrix parseTransform(
const TQString &transform );
204 void transform(
const TQWMatrix &mat )
210 void loadSvgPath(
const TQString & );
211 void saveSvgPath( TQString & )
const;
214 TQString buildSvgTransform()
const;
215 TQString buildSvgTransform(
const TQWMatrix &mat )
const;
216 TQString buildOasisTransform()
const;
217 TQString buildOasisTransform(
const TQWMatrix &mat )
const;
219 void transformByViewbox(
const TQDomElement &element, TQString viewbox );
222 virtual void svgMoveTo(
double x1,
double y1,
bool abs =
true );
223 virtual void svgLineTo(
double x1,
double y1,
bool abs =
true );
224 virtual void svgCurveToCubic(
double x1,
double y1,
double x2,
double y2,
double x,
double y,
bool abs =
true );
225 virtual void svgClosePath();
227 virtual void saveOasisFill( KoGenStyles &mainStyles, KoGenStyle &stylesojectauto )
const;
228 TQWMatrix parseOasisTransform(
const TQString &transform );
237 VSubpathList m_paths;
240 bool m_drawCenterNode;
241 VFillRule m_fillRule : 1;
VObject(VObject *parent, VState state=edit)
Constructs a new object that is child of parent and has the given state.
virtual VObject * clone() const =0
Create an exact copy of this object.
VObject * parent() const
Returns pointer to current parent object.
virtual void accept(VVisitor &)
Accept a VVisitor.
virtual void saveOasis(KoStore *store, KoXmlWriter *docWriter, KoGenStyles &mainStyles, int &index) const
Save this object's state to OpenDocument.
@ normal
visible, not active
virtual DCOPObject * dcopObject()
Returns pointer to internal DCOP object.
virtual const KoRect & boundingBox() const
Calculates the tightest bounding box around the object.
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
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.
virtual void draw(VPainter *painter, const KoRect *rect=0L) const
Draw the object to a painting device.
VState state() const
Get the state the object is in.
const KoPoint & currentPoint() const
Returns the knot of the last segment of the last subpath.
void close()
Closes the current subpath.
void combine(const VPath &path)
Combines two composite paths.
bool arcTo(const KoPoint &p1, const KoPoint &p2, double r)
A convenience function to aproximate a circular arc with a bezier curve.
void combinePath(const VSubpath &path)
Adds a path to the composite path.
bool pointIsInside(const KoPoint &p) const
Returns true if point p is located inside the composite.
bool intersects(const VSegment &segment) const
Returns true if the segment intersects this composite.
virtual void svgMoveTo(double x1, double y1, bool abs=true)
For svg path data parsing.
A class representing lines and beziers.
VSubpath provides a sophisticated list of VSegment.
The abstract visitor class.