diff options
Diffstat (limited to 'src/sp-pattern.h')
| -rw-r--r-- | src/sp-pattern.h | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/src/sp-pattern.h b/src/sp-pattern.h index 2eb71974f..6c63d0727 100644 --- a/src/sp-pattern.h +++ b/src/sp-pattern.h @@ -30,25 +30,21 @@ namespace Inkscape { namespace XML { class Node; - } } -#define SP_PATTERN(obj) (dynamic_cast<SPPattern*>((SPObject*)obj)) -#define SP_IS_PATTERN(obj) (dynamic_cast<const SPPattern*>((SPObject*)obj) != NULL) +#define SP_PATTERN(obj) (dynamic_cast<SPPattern *>((SPObject *)obj)) +#define SP_IS_PATTERN(obj) (dynamic_cast<const SPPattern *>((SPObject *)obj) != NULL) class SPPattern : public SPPaintServer, public SPViewBox { public: - enum PatternUnits { - UNITS_USERSPACEONUSE, - UNITS_OBJECTBOUNDINGBOX - }; + enum PatternUnits { UNITS_USERSPACEONUSE, UNITS_OBJECTBOUNDINGBOX }; - SPPattern(); - virtual ~SPPattern(); + SPPattern(); + virtual ~SPPattern(); /* Reference (href) */ - Glib::ustring href; + Glib::ustring href; SPPatternReference *ref; gdouble get_x() const; @@ -59,7 +55,7 @@ public: SPPattern::PatternUnits get_pattern_units() const; SPPattern::PatternUnits get_pattern_content_units() const; Geom::Affine const &get_transform() const; - SPPattern *get_root(); //TODO: const + SPPattern *get_root(); // TODO: const SPPattern *clone_if_necessary(SPItem *item, const gchar *property); void transform_multiply(Geom::Affine postmul, bool set); @@ -68,39 +64,39 @@ public: * @brief create a new pattern in XML tree * @return created pattern id */ - static const gchar *produce(const std::vector<Inkscape::XML::Node*> &reprs, - Geom::Rect bounds, SPDocument *document, Geom::Affine transform, Geom::Affine move); + static const gchar *produce(const std::vector<Inkscape::XML::Node *> &reprs, Geom::Rect bounds, + SPDocument *document, Geom::Affine transform, Geom::Affine move); bool isValid() const; - virtual cairo_pattern_t* pattern_new(cairo_t *ct, Geom::OptRect const &bbox, double opacity); + virtual cairo_pattern_t *pattern_new(cairo_t *ct, Geom::OptRect const &bbox, double opacity); protected: - virtual void build(SPDocument* doc, Inkscape::XML::Node* repr); - virtual void release(); - virtual void set(unsigned int key, const gchar* value); - virtual void update(SPCtx* ctx, unsigned int flags); - virtual void modified(unsigned int flags); + virtual void build(SPDocument *doc, Inkscape::XML::Node *repr); + virtual void release(); + virtual void set(unsigned int key, const gchar *value); + virtual void update(SPCtx *ctx, unsigned int flags); + virtual void modified(unsigned int flags); private: - bool _has_item_children() const; - void _get_children(std::list<SPObject*>& l); - SPPattern *_chain() const; + bool _has_item_children() const; + void _get_children(std::list<SPObject *> &l); + SPPattern *_chain() const; - /** - Count how many times pattern is used by the styles of o and its descendants - */ - guint _count_hrefs(SPObject* o) const; + /** + Count how many times pattern is used by the styles of o and its descendants + */ + guint _count_hrefs(SPObject *o) const; - /** - Gets called when the pattern is reattached to another <pattern> - */ - void _on_ref_changed(SPObject *old_ref, SPObject *ref); + /** + Gets called when the pattern is reattached to another <pattern> + */ + void _on_ref_changed(SPObject *old_ref, SPObject *ref); - /** - Gets called when the referenced <pattern> is changed - */ - void _on_ref_modified(SPObject *ref, guint flags); + /** + Gets called when the referenced <pattern> is changed + */ + void _on_ref_modified(SPObject *ref, guint flags); /* patternUnits and patternContentUnits attribute */ PatternUnits patternUnits : 1; @@ -122,14 +118,20 @@ private: class SPPatternReference : public Inkscape::URIReference { public: - SPPatternReference (SPObject *obj) : URIReference(obj) {} - SPPattern *getObject() const { + SPPatternReference(SPObject *obj) + : URIReference(obj) + { + } + + SPPattern *getObject() const + { return reinterpret_cast<SPPattern *>(URIReference::getObject()); } protected: - virtual bool _acceptObject(SPObject *obj) const { - return SP_IS_PATTERN (obj); + virtual bool _acceptObject(SPObject *obj) const + { + return SP_IS_PATTERN(obj); } }; |
