Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
lpeobject.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
2#ifndef INKSCAPE_LIVEPATHEFFECT_OBJECT_H
3#define INKSCAPE_LIVEPATHEFFECT_OBJECT_H
4
5/*
6 * Inkscape::LivePathEffect
7 *
8 * Copyright (C) Johan Engelen 2007-2008 <j.b.c.engelen@utwente.nl>
9 *
10 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
11 */
12
13#include "effect-enum.h"
14#include "object/sp-object.h"
15#include "xml/node-observer.h"
16
17namespace Inkscape {
18namespace XML { class Node; struct Document; }
19namespace LivePathEffect { class Effect; }
20} // namespace Inkscape
21
23{
25 ~LPENodeObserver() override = default; // can only exist as a direct base of LivePathEffectObject
26
28};
29
31 : public SPObject
32 , private LPENodeObserver
33{
34public:
37 int tag() const override { return tag_of<decltype(*this)>; }
38
40
41 bool effecttype_set{false};
42 bool deleted{false};
43 bool isOnClipboard() const { return _isOnClipboard; };
44 // dont check values only structure and ID
46
47 LivePathEffectObject *fork_private_if_necessary(unsigned int nr_of_allowed_users = 1);
48
49 /* Note that the returned pointer can be NULL in a valid LivePathEffectObject contained in a valid list of lpeobjects in an lpeitem!
50 * So one should always check whether the returned value is NULL or not */
52 Inkscape::LivePathEffect::Effect const *get_lpe() const { return lpe; };
53
54 Inkscape::LivePathEffect::Effect *lpe{nullptr}; // this can be NULL in a valid LivePathEffectObject
55
56protected:
57 void build(SPDocument *doc, Inkscape::XML::Node *repr) override;
58 void release() override;
59
60 void set(SPAttr key, char const *value) override;
61
62 Inkscape::XML::Node *write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) override;
63
64private:
65 void setOnClipboard();
66 bool _isOnClipboard = false;
67 friend LPENodeObserver; // for static_cast
68 LPENodeObserver &nodeObserver() { return *this; }
69};
70
71#endif // INKSCAPE_LIVEPATHEFFECT_OBJECT_H
72
73/*
74 Local Variables:
75 mode:c++
76 c-file-style:"stroustrup"
77 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
78 indent-tabs-mode:nil
79 fill-column:99
80 End:
81*/
82// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
SPAttr
Definition attributes.h:27
constexpr int tag_of
Convenience function to retrieve the tag (class id) of a given type.
Definition cast.h:26
Interface for XML node observers.
Interface for refcounted XML nodes.
Definition node.h:80
void notifyAttributeChanged(Inkscape::XML::Node &node, GQuark key, Inkscape::Util::ptr_shared oldval, Inkscape::Util::ptr_shared newval) final
Attribute change callback.
~LPENodeObserver() override=default
bool isOnClipboard() const
Definition lpeobject.h:43
Inkscape::LivePathEffect::Effect const * get_lpe() const
Definition lpeobject.h:52
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
Virtual build: set livepatheffect attributes from its associated XML node.
Definition lpeobject.cpp:30
int tag() const override
Definition lpeobject.h:37
Inkscape::LivePathEffect::Effect * get_lpe()
Definition lpeobject.h:51
~LivePathEffectObject() override
void setOnClipboard()
Set lpeobject is on clipboard.
Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) override
Virtual write: write object attributes to repr.
Definition lpeobject.cpp:95
Inkscape::LivePathEffect::Effect * lpe
Definition lpeobject.h:54
LPENodeObserver & nodeObserver()
Definition lpeobject.h:68
bool is_similar(LivePathEffectObject *that)
Inkscape::LivePathEffect::EffectType effecttype
Definition lpeobject.h:39
LivePathEffectObject * fork_private_if_necessary(unsigned int nr_of_allowed_users=1)
If this has other users, create a new private duplicate and return it returns 'this' when no forking ...
void release() override
Virtual release of livepatheffect members before destruction.
Definition lpeobject.cpp:47
Typed SVG document implementation.
Definition document.h:101
SPObject is an abstract base class of all of the document nodes at the SVG document level.
Definition sp-object.h:160
Inkscape::XML::Node * repr
Definition sp-object.h:193
Inkscape::XML::Node * node
Helper class to stream background task notifications as a series of messages.
Interface for XML node observers.
static cairo_user_data_key_t key
guint32 GQuark
Interface for XML documents.
Definition document.h:43