Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
sp-style-elem.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
/*
5 * Authors: see git history
6 *
7 * Copyright (C) 2018 Authors
8 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
9 */
10#ifndef INKSCAPE_SP_STYLE_ELEM_H
11#define INKSCAPE_SP_STYLE_ELEM_H
12
13#include <memory>
14#include <vector>
16
17#include "media.h"
18#include "sp-object.h"
19
20#include "xml/node-observer.h"
21
22class SPStyleElem;
23
33
35{
36 friend class SPStyleElem;
37 ~SPStyleElemTextNodeObserver() override = default; // can only exist as a direct base of SPStyleElem
38
40};
41
42class SPStyleElem final
43 : public SPObject
46{
47public:
49 ~SPStyleElem() override;
50 int tag() const override { return tag_of<decltype(*this)>; }
51
52 // Container for the libcroco style sheet instance created on load.
54
56 bool is_css{false};
57
58 std::vector<std::unique_ptr<SPStyle>> get_styles() const;
59
60 void build(SPDocument *doc, Inkscape::XML::Node *repr) override;
61 void set(SPAttr key, char const *value) override;
62 void read_content() override;
63 void release() override;
64
65 Inkscape::XML::Node *write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) override;
66
67private:
70
71 // for static_casts
74};
75
76#endif /* !INKSCAPE_SP_STYLE_ELEM_H */
77
78/*
79 Local Variables:
80 mode:c++
81 c-file-style:"stroustrup"
82 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
83 indent-tabs-mode:nil
84 fill-column:99
85 End:
86*/
87// 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
Definition media.h:13
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
void notifyChildRemoved(Inkscape::XML::Node &, Inkscape::XML::Node &, Inkscape::XML::Node *) final
Child removal callback.
void notifyChildAdded(Inkscape::XML::Node &, Inkscape::XML::Node &, Inkscape::XML::Node *) final
Child addition callback.
void notifyChildOrderChanged(Inkscape::XML::Node &, Inkscape::XML::Node &, Inkscape::XML::Node *, Inkscape::XML::Node *) final
Child order change callback.
~SPStyleElemNodeObserver() override=default
void notifyContentChanged(Inkscape::XML::Node &, Inkscape::Util::ptr_shared, Inkscape::Util::ptr_shared) final
Content change callback.
~SPStyleElemTextNodeObserver() override=default
SPStyleElemNodeObserver & nodeObserver()
CRStyleSheet * style_sheet
void release() override
friend SPStyleElemNodeObserver
friend SPStyleElemTextNodeObserver
int tag() const override
void build(SPDocument *doc, Inkscape::XML::Node *repr) override
~SPStyleElem() override
SPStyleElemTextNodeObserver & textNodeObserver()
void read_content() override
Inkscape::XML::Node * write(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) override
std::vector< std::unique_ptr< SPStyle > > get_styles() const
Get the list of styles.
Declaration of the CRStatement class.
TODO: insert short description here.
Interface for XML node observers.
static cairo_user_data_key_t key
Interface for XML documents.
Definition document.h:43
An abstraction of a css stylesheet as defined by the css2 spec in chapter 4.