summaryrefslogtreecommitdiffstats
path: root/src/sp-flowdiv.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2013-09-19 22:33:11 +0000
committerJabiertxof <jtx@jtx.marker.es>2013-09-19 22:33:11 +0000
commit4bda89e32e33c7bdff5d3ea3c1ceee1f806de9f7 (patch)
treecaeb924426bcc861badc6fa81318b67460b26d47 /src/sp-flowdiv.cpp
parentUpdate to trunk (diff)
parentupdates for cmake (diff)
downloadinkscape-4bda89e32e33c7bdff5d3ea3c1ceee1f806de9f7.tar.gz
inkscape-4bda89e32e33c7bdff5d3ea3c1ceee1f806de9f7.zip
Update to trunk
(bzr r11950.1.141)
Diffstat (limited to 'src/sp-flowdiv.cpp')
-rw-r--r--src/sp-flowdiv.cpp437
1 files changed, 182 insertions, 255 deletions
diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp
index c588335d8..867e68441 100644
--- a/src/sp-flowdiv.cpp
+++ b/src/sp-flowdiv.cpp
@@ -6,91 +6,74 @@
#endif
#include "xml/repr.h"
-//#include "svg/svg.h"
-
-//#include "style.h"
-
#include "sp-flowdiv.h"
#include "sp-string.h"
#include "document.h"
-static void sp_flowdiv_release (SPObject *object);
-static Inkscape::XML::Node *sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static void sp_flowdiv_update (SPObject *object, SPCtx *ctx, unsigned int flags);
-static void sp_flowdiv_modified (SPObject *object, guint flags);
-static void sp_flowdiv_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr);
-static void sp_flowdiv_set (SPObject *object, unsigned int key, const gchar *value);
-
-static void sp_flowtspan_release (SPObject *object);
-static Inkscape::XML::Node *sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static void sp_flowtspan_update (SPObject *object, SPCtx *ctx, unsigned int flags);
-static void sp_flowtspan_modified (SPObject *object, guint flags);
-static void sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr);
-static void sp_flowtspan_set (SPObject *object, unsigned int key, const gchar *value);
-
-static void sp_flowpara_release (SPObject *object);
-static Inkscape::XML::Node *sp_flowpara_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static void sp_flowpara_update (SPObject *object, SPCtx *ctx, unsigned int flags);
-static void sp_flowpara_modified (SPObject *object, guint flags);
-static void sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr);
-static void sp_flowpara_set (SPObject *object, unsigned int key, const gchar *value);
-
-static void sp_flowline_release (SPObject *object);
-static Inkscape::XML::Node *sp_flowline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static void sp_flowline_modified (SPObject *object, guint flags);
-
-static void sp_flowregionbreak_release (SPObject *object);
-static Inkscape::XML::Node *sp_flowregionbreak_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static void sp_flowregionbreak_modified (SPObject *object, guint flags);
-
-G_DEFINE_TYPE(SPFlowdiv, sp_flowdiv, SP_TYPE_ITEM);
-
-static void sp_flowdiv_class_init(SPFlowdivClass *klass)
-{
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
-
- sp_object_class->build = sp_flowdiv_build;
- sp_object_class->set = sp_flowdiv_set;
- sp_object_class->release = sp_flowdiv_release;
- sp_object_class->write = sp_flowdiv_write;
- sp_object_class->update = sp_flowdiv_update;
- sp_object_class->modified = sp_flowdiv_modified;
-}
-
-static void sp_flowdiv_init(SPFlowdiv */*group*/)
-{
-}
-
-static void sp_flowdiv_release(SPObject *object)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->release(object);
- }
+#include "sp-factory.h"
+
+namespace {
+ SPObject* createFlowdiv() {
+ return new SPFlowdiv();
+ }
+
+ SPObject* createFlowtspan() {
+ return new SPFlowtspan();
+ }
+
+ SPObject* createFlowpara() {
+ return new SPFlowpara();
+ }
+
+ SPObject* createFlowline() {
+ return new SPFlowline();
+ }
+
+ SPObject* createFlowregionbreak() {
+ return new SPFlowregionbreak();
+ }
+
+ bool flowdivRegistered = SPFactory::instance().registerObject("svg:flowDiv", createFlowdiv);
+ bool flowtspanRegistered = SPFactory::instance().registerObject("svg:flowSpan", createFlowtspan);
+ bool flowparaRegistered = SPFactory::instance().registerObject("svg:flowPara", createFlowpara);
+ bool flowlineRegistered = SPFactory::instance().registerObject("svg:flowLine", createFlowline);
+ bool flowregionbreakRegistered = SPFactory::instance().registerObject("svg:flowRegionBreak", createFlowregionbreak);
+}
+
+SPFlowdiv::SPFlowdiv() : SPItem() {
+}
+
+SPFlowdiv::~SPFlowdiv() {
+}
+
+void SPFlowdiv::release() {
+ SPItem::release();
}
-static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags)
-{
+void SPFlowdiv::update(SPCtx *ctx, unsigned int flags) {
SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
SPItemCtx cctx = *ictx;
- if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->update) {
- reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->update(object, ctx, flags);
- }
+ SPItem::update(ctx, flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
+
flags &= SP_OBJECT_MODIFIED_CASCADE;
GSList* l = NULL;
- for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
- g_object_ref( G_OBJECT(child) );
+ for (SPObject *child = this->firstChild() ; child ; child = child->getNext() ) {
+ sp_object_ref(child);
l = g_slist_prepend(l, child);
}
+
l = g_slist_reverse(l);
+
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
+
if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
if (SP_IS_ITEM(child)) {
SPItem const &chi = *SP_ITEM(child);
@@ -101,62 +84,63 @@ static void sp_flowdiv_update(SPObject *object, SPCtx *ctx, unsigned int flags)
child->updateDisplay(ctx, flags);
}
}
- g_object_unref( G_OBJECT(child) );
+
+ sp_object_unref(child);
}
}
-static void sp_flowdiv_modified(SPObject *object, guint flags)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->modified(object, flags);
- }
+void SPFlowdiv::modified(unsigned int flags) {
+ SPItem::modified(flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
+
flags &= SP_OBJECT_MODIFIED_CASCADE;
GSList *l = NULL;
- for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
- g_object_ref( G_OBJECT(child) );
+ for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) {
+ sp_object_ref(child);
l = g_slist_prepend(l, child);
}
+
l = g_slist_reverse (l);
+
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
+
if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
child->emitModified(flags);
}
- g_object_unref( G_OBJECT(child) );
+
+ sp_object_unref(child);
}
}
-static void sp_flowdiv_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
-{
- object->_requireSVGVersion(Inkscape::Version(1, 2));
- if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->build) {
- reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->build(object, doc, repr);
- }
+void SPFlowdiv::build(SPDocument *doc, Inkscape::XML::Node *repr) {
+ this->_requireSVGVersion(Inkscape::Version(1, 2));
+
+ SPItem::build(doc, repr);
}
-static void sp_flowdiv_set(SPObject *object, unsigned int key, const gchar *value)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->set) {
- reinterpret_cast<SPObjectClass *>(sp_flowdiv_parent_class)->set(object, key, value);
- }
+void SPFlowdiv::set(unsigned int key, const gchar* value) {
+ SPItem::set(key, value);
}
-static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-{
+
+Inkscape::XML::Node* SPFlowdiv::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags & SP_OBJECT_WRITE_BUILD ) {
if ( repr == NULL ) {
repr = xml_doc->createElement("svg:flowDiv");
}
+
GSList *l = NULL;
- for (SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
+
+ for (SPObject* child = this->firstChild() ; child ; child = child->getNext() ) {
Inkscape::XML::Node* c_repr = NULL;
+
if ( SP_IS_FLOWTSPAN (child) ) {
c_repr = child->updateRepr(xml_doc, NULL, flags);
} else if ( SP_IS_FLOWPARA(child) ) {
@@ -164,17 +148,19 @@ static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Do
} else if ( SP_IS_STRING(child) ) {
c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
}
+
if ( c_repr ) {
l = g_slist_prepend (l, c_repr);
}
}
+
while ( l ) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
Inkscape::GC::release((Inkscape::XML::Node *) l->data);
l = g_slist_remove(l, l->data);
}
} else {
- for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
+ for ( SPObject* child = this->firstChild() ; child ; child = child->getNext() ) {
if ( SP_IS_FLOWTSPAN (child) ) {
child->updateRepr(flags);
} else if ( SP_IS_FLOWPARA(child) ) {
@@ -185,9 +171,7 @@ static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Do
}
}
- if (((SPObjectClass *) (sp_flowdiv_parent_class))->write) {
- ((SPObjectClass *) (sp_flowdiv_parent_class))->write(object, xml_doc, repr, flags);
- }
+ SPItem::write(xml_doc, repr, flags);
return repr;
}
@@ -196,54 +180,41 @@ static Inkscape::XML::Node *sp_flowdiv_write(SPObject *object, Inkscape::XML::Do
/*
*
*/
-G_DEFINE_TYPE(SPFlowtspan, sp_flowtspan, SP_TYPE_ITEM);
-static void sp_flowtspan_class_init(SPFlowtspanClass *klass)
-{
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
-
- sp_object_class->build = sp_flowtspan_build;
- sp_object_class->set = sp_flowtspan_set;
- sp_object_class->release = sp_flowtspan_release;
- sp_object_class->write = sp_flowtspan_write;
- sp_object_class->update = sp_flowtspan_update;
- sp_object_class->modified = sp_flowtspan_modified;
+SPFlowtspan::SPFlowtspan() : SPItem() {
}
-static void sp_flowtspan_init(SPFlowtspan */*group*/)
-{
+SPFlowtspan::~SPFlowtspan() {
}
-static void sp_flowtspan_release(SPObject *object)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->release(object);
- }
+void SPFlowtspan::release() {
+ SPItem::release();
}
-static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags)
-{
+void SPFlowtspan::update(SPCtx *ctx, unsigned int flags) {
SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
SPItemCtx cctx = *ictx;
- if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->update) {
- reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->update(object, ctx, flags);
- }
+ SPItem::update(ctx, flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
+
flags &= SP_OBJECT_MODIFIED_CASCADE;
GSList* l = NULL;
- for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
- g_object_ref( G_OBJECT(child) );
+ for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) {
+ sp_object_ref(child);
l = g_slist_prepend(l, child);
}
+
l = g_slist_reverse (l);
+
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
+
if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
if (SP_IS_ITEM(child)) {
SPItem const &chi = *SP_ITEM(child);
@@ -254,60 +225,60 @@ static void sp_flowtspan_update(SPObject *object, SPCtx *ctx, unsigned int flags
child->updateDisplay(ctx, flags);
}
}
- g_object_unref( G_OBJECT(child) );
+
+ sp_object_unref(child);
}
}
-static void sp_flowtspan_modified(SPObject *object, guint flags)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->modified(object, flags);
- }
+void SPFlowtspan::modified(unsigned int flags) {
+ SPItem::modified(flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
+
flags &= SP_OBJECT_MODIFIED_CASCADE;
GSList *l = NULL;
- for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
- g_object_ref( G_OBJECT(child) );
+ for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) {
+ sp_object_ref(child);
l = g_slist_prepend(l, child);
}
+
l = g_slist_reverse (l);
+
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
+
if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
child->emitModified(flags);
}
- g_object_unref( G_OBJECT(child) );
+
+ sp_object_unref(child);
}
}
-static void sp_flowtspan_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->build) {
- reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->build(object, doc, repr);
- }
+
+void SPFlowtspan::build(SPDocument *doc, Inkscape::XML::Node *repr) {
+ SPItem::build(doc, repr);
}
-static void sp_flowtspan_set(SPObject *object, unsigned int key, const gchar *value)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->set) {
- reinterpret_cast<SPObjectClass *>(sp_flowtspan_parent_class)->set(object, key, value);
- }
+void SPFlowtspan::set(unsigned int key, const gchar* value) {
+ SPItem::set(key, value);
}
-static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-{
+Inkscape::XML::Node *SPFlowtspan::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags&SP_OBJECT_WRITE_BUILD ) {
if ( repr == NULL ) {
repr = xml_doc->createElement("svg:flowSpan");
}
+
GSList *l = NULL;
- for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
+
+ for ( SPObject* child = this->firstChild() ; child ; child = child->getNext() ) {
Inkscape::XML::Node* c_repr = NULL;
+
if ( SP_IS_FLOWTSPAN(child) ) {
c_repr = child->updateRepr(xml_doc, NULL, flags);
} else if ( SP_IS_FLOWPARA(child) ) {
@@ -315,17 +286,19 @@ static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML::
} else if ( SP_IS_STRING(child) ) {
c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
}
+
if ( c_repr ) {
l = g_slist_prepend(l, c_repr);
}
}
+
while ( l ) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
Inkscape::GC::release((Inkscape::XML::Node *) l->data);
l = g_slist_remove(l, l->data);
}
} else {
- for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
+ for ( SPObject* child = this->firstChild() ; child ; child = child->getNext() ) {
if ( SP_IS_FLOWTSPAN(child) ) {
child->updateRepr(flags);
} else if ( SP_IS_FLOWPARA(child) ) {
@@ -336,66 +309,49 @@ static Inkscape::XML::Node *sp_flowtspan_write(SPObject *object, Inkscape::XML::
}
}
- if (((SPObjectClass *) (sp_flowtspan_parent_class))->write) {
- ((SPObjectClass *) (sp_flowtspan_parent_class))->write(object, xml_doc, repr, flags);
- }
+ SPItem::write(xml_doc, repr, flags);
return repr;
}
-
/*
*
*/
-G_DEFINE_TYPE(SPFlowpara, sp_flowpara, SP_TYPE_ITEM);
-
-static void sp_flowpara_class_init(SPFlowparaClass *klass)
-{
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
-
- sp_object_class->build = sp_flowpara_build;
- sp_object_class->set = sp_flowpara_set;
- sp_object_class->release = sp_flowpara_release;
- sp_object_class->write = sp_flowpara_write;
- sp_object_class->update = sp_flowpara_update;
- sp_object_class->modified = sp_flowpara_modified;
+SPFlowpara::SPFlowpara() : SPItem() {
}
-static void sp_flowpara_init (SPFlowpara */*group*/)
-{
+SPFlowpara::~SPFlowpara() {
}
-static void sp_flowpara_release(SPObject *object)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->release(object);
- }
+void SPFlowpara::release() {
+ SPItem::release();
}
-static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags)
-{
+void SPFlowpara::update(SPCtx *ctx, unsigned int flags) {
SPItemCtx *ictx = reinterpret_cast<SPItemCtx *>(ctx);
SPItemCtx cctx = *ictx;
- if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->update) {
- reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->update(object, ctx, flags);
- }
+ SPItem::update(ctx, flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
+
flags &= SP_OBJECT_MODIFIED_CASCADE;
GSList* l = NULL;
- for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
- g_object_ref( G_OBJECT(child) );
+ for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) {
+ sp_object_ref(child);
l = g_slist_prepend(l, child);
}
+
l = g_slist_reverse (l);
+
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
+
if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
if (SP_IS_ITEM(child)) {
SPItem const &chi = *SP_ITEM(child);
@@ -406,58 +362,60 @@ static void sp_flowpara_update(SPObject *object, SPCtx *ctx, unsigned int flags)
child->updateDisplay(ctx, flags);
}
}
- g_object_unref( G_OBJECT(child) );
+
+ sp_object_unref(child);
}
}
-static void sp_flowpara_modified(SPObject *object, guint flags)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->modified(object, flags);
- }
+void SPFlowpara::modified(unsigned int flags) {
+ SPItem::modified(flags);
if (flags & SP_OBJECT_MODIFIED_FLAG) {
flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
}
+
flags &= SP_OBJECT_MODIFIED_CASCADE;
GSList *l = NULL;
- for ( SPObject *child = object->firstChild() ; child ; child = child->getNext() ) {
- g_object_ref( G_OBJECT(child) );
+ for ( SPObject *child = this->firstChild() ; child ; child = child->getNext() ) {
+ sp_object_ref(child);
l = g_slist_prepend(l, child);
}
+
l = g_slist_reverse (l);
+
while (l) {
SPObject *child = SP_OBJECT(l->data);
l = g_slist_remove(l, child);
+
if (flags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) {
child->emitModified(flags);
}
- g_object_unref( G_OBJECT(child) );
+
+ sp_object_unref(child);
}
}
-static void sp_flowpara_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->build) {
- reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->build(object, doc, repr);
- }
+
+void SPFlowpara::build(SPDocument *doc, Inkscape::XML::Node *repr) {
+ SPItem::build(doc, repr);
}
-static void sp_flowpara_set(SPObject *object, unsigned int key, const gchar *value)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->set) {
- reinterpret_cast<SPObjectClass *>(sp_flowpara_parent_class)->set(object, key, value);
- }
+void SPFlowpara::set(unsigned int key, const gchar* value) {
+ SPItem::set(key, value);
}
-static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-{
+Inkscape::XML::Node *SPFlowpara::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags&SP_OBJECT_WRITE_BUILD ) {
- if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara");
+ if ( repr == NULL ) {
+ repr = xml_doc->createElement("svg:flowPara");
+ }
+
GSList *l = NULL;
- for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
+
+ for ( SPObject* child = this->firstChild() ; child ; child = child->getNext() ) {
Inkscape::XML::Node* c_repr = NULL;
+
if ( SP_IS_FLOWTSPAN(child) ) {
c_repr = child->updateRepr(xml_doc, NULL, flags);
} else if ( SP_IS_FLOWPARA(child) ) {
@@ -465,17 +423,19 @@ static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::D
} else if ( SP_IS_STRING(child) ) {
c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
}
+
if ( c_repr ) {
l = g_slist_prepend(l, c_repr);
}
}
+
while ( l ) {
repr->addChild((Inkscape::XML::Node *) l->data, NULL);
Inkscape::GC::release((Inkscape::XML::Node *) l->data);
l = g_slist_remove(l, l->data);
}
} else {
- for ( SPObject* child = object->firstChild() ; child ; child = child->getNext() ) {
+ for ( SPObject* child = this->firstChild() ; child ; child = child->getNext() ) {
if ( SP_IS_FLOWTSPAN(child) ) {
child->updateRepr(flags);
} else if ( SP_IS_FLOWPARA(child) ) {
@@ -486,119 +446,86 @@ static Inkscape::XML::Node *sp_flowpara_write(SPObject *object, Inkscape::XML::D
}
}
- if (((SPObjectClass *) (sp_flowpara_parent_class))->write) {
- ((SPObjectClass *) (sp_flowpara_parent_class))->write(object, xml_doc, repr, flags);
- }
+ SPItem::write(xml_doc, repr, flags);
return repr;
}
+
/*
*
*/
-G_DEFINE_TYPE(SPFlowline, sp_flowline, SP_TYPE_OBJECT);
-
-static void sp_flowline_class_init(SPFlowlineClass *klass)
-{
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
- sp_object_class->release = sp_flowline_release;
- sp_object_class->write = sp_flowline_write;
- sp_object_class->modified = sp_flowline_modified;
+SPFlowline::SPFlowline() : SPObject() {
}
-static void sp_flowline_init(SPFlowline */*group*/)
-{
+SPFlowline::~SPFlowline() {
}
-static void sp_flowline_release(SPObject *object)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->release(object);
- }
+void SPFlowline::release() {
+ SPObject::release();
}
-static void sp_flowline_modified(SPObject *object, guint flags)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->modified(object, flags);
- }
+void SPFlowline::modified(unsigned int flags) {
+ SPObject::modified(flags);
- if (flags & SP_OBJECT_MODIFIED_FLAG) {
- flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
- }
- flags &= SP_OBJECT_MODIFIED_CASCADE;
+ if (flags & SP_OBJECT_MODIFIED_FLAG) {
+ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
+ }
+
+ flags &= SP_OBJECT_MODIFIED_CASCADE;
}
-static Inkscape::XML::Node *sp_flowline_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-{
+Inkscape::XML::Node *SPFlowline::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags & SP_OBJECT_WRITE_BUILD ) {
if ( repr == NULL ) {
repr = xml_doc->createElement("svg:flowLine");
}
- } else {
}
- if (reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->write) {
- reinterpret_cast<SPObjectClass *>(sp_flowline_parent_class)->write(object, xml_doc, repr, flags);
- }
+ SPObject::write(xml_doc, repr, flags);
return repr;
}
+
/*
*
*/
-G_DEFINE_TYPE(SPFlowregionbreak, sp_flowregionbreak, SP_TYPE_OBJECT);
-static void sp_flowregionbreak_class_init(SPFlowregionbreakClass *klass)
-{
- SPObjectClass *sp_object_class = reinterpret_cast<SPObjectClass *>(klass);
-
- sp_object_class->release = sp_flowregionbreak_release;
- sp_object_class->write = sp_flowregionbreak_write;
- sp_object_class->modified = sp_flowregionbreak_modified;
+SPFlowregionbreak::SPFlowregionbreak() : SPObject() {
}
-static void sp_flowregionbreak_init(SPFlowregionbreak */*group*/)
-{
+SPFlowregionbreak::~SPFlowregionbreak() {
}
-static void sp_flowregionbreak_release(SPObject *object)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->release) {
- reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->release(object);
- }
+void SPFlowregionbreak::release() {
+ SPObject::release();
}
-static void sp_flowregionbreak_modified(SPObject *object, guint flags)
-{
- if (reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->modified) {
- reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->modified(object, flags);
- }
+void SPFlowregionbreak::modified(unsigned int flags) {
+ SPObject::modified(flags);
- if (flags & SP_OBJECT_MODIFIED_FLAG) {
- flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
- }
- flags &= SP_OBJECT_MODIFIED_CASCADE;
+ if (flags & SP_OBJECT_MODIFIED_FLAG) {
+ flags |= SP_OBJECT_PARENT_MODIFIED_FLAG;
+ }
+
+ flags &= SP_OBJECT_MODIFIED_CASCADE;
}
-static Inkscape::XML::Node *sp_flowregionbreak_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
-{
+Inkscape::XML::Node *SPFlowregionbreak::write(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
if ( flags & SP_OBJECT_WRITE_BUILD ) {
if ( repr == NULL ) {
repr = xml_doc->createElement("svg:flowLine");
}
- } else {
}
- if (reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->write) {
- reinterpret_cast<SPObjectClass *>(sp_flowregionbreak_parent_class)->write(object, xml_doc, repr, flags);
- }
+ SPObject::write(xml_doc, repr, flags);
return repr;
}
+
/*
Local Variables:
mode:c++