From d1947e768272c703674129d5c583204ff2b59251 Mon Sep 17 00:00:00 2001 From: Adrian Boguszewski Date: Wed, 13 Jul 2016 13:36:19 +0200 Subject: Second part of new SPObject children list (bzr r14954.1.19) --- src/sp-flowtext.cpp | 54 ++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/sp-flowtext.cpp') diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index 51fb3ae89..eed882800 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -72,9 +72,9 @@ void SPFlowtext::update(SPCtx* ctx, unsigned int flags) { GSList *l = NULL; - for (SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { - sp_object_ref(child); - l = g_slist_prepend(l, child); + for (auto& child: _children) { + sp_object_ref(&child); + l = g_slist_prepend(l, &child); } l = g_slist_reverse(l); @@ -135,9 +135,9 @@ void SPFlowtext::modified(unsigned int flags) { } } - for ( SPObject *o = this->firstChild() ; o ; o = o->getNext() ) { - if (dynamic_cast(o)) { - region = o; + for (auto& o: _children) { + if (dynamic_cast(&o)) { + region = &o; break; } } @@ -223,11 +223,11 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X GSList *l = NULL; - for (SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { + for (auto& child: _children) { Inkscape::XML::Node *c_repr = NULL; - if ( dynamic_cast(child) || dynamic_cast(child) || dynamic_cast(child) || dynamic_cast(child)) { - c_repr = child->updateRepr(doc, NULL, flags); + if ( dynamic_cast(&child) || dynamic_cast(&child) || dynamic_cast(&child) || dynamic_cast(&child)) { + c_repr = child.updateRepr(doc, NULL, flags); } if ( c_repr ) { @@ -241,9 +241,9 @@ Inkscape::XML::Node* SPFlowtext::write(Inkscape::XML::Document* doc, Inkscape::X l = g_slist_remove(l, l->data); } } else { - for (SPObject *child = this->firstChild() ; child ; child = child->getNext() ) { - if ( dynamic_cast(child) || dynamic_cast(child) || dynamic_cast(child) || dynamic_cast(child)) { - child->updateRepr(flags); + for (auto& child: _children) { + if ( dynamic_cast(&child) || dynamic_cast(&child) || dynamic_cast(&child) || dynamic_cast(&child)) { + child.updateRepr(flags); } } } @@ -390,8 +390,8 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, *pending_line_break_object = NULL; } - for (SPObject *child = root->firstChild() ; child ; child = child->getNext() ) { - SPString *str = dynamic_cast(child); + for (auto& child: root->_children) { + SPString *str = dynamic_cast(&child); if (str) { if (*pending_line_break_object) { if (dynamic_cast(*pending_line_break_object)) @@ -402,12 +402,12 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, *pending_line_break_object = NULL; } if (with_indent) { - layout.appendText(str->string, root->style, child, &pi); + layout.appendText(str->string, root->style, &child, &pi); } else { - layout.appendText(str->string, root->style, child); + layout.appendText(str->string, root->style, &child); } } else { - SPFlowregion *region = dynamic_cast(child); + SPFlowregion *region = dynamic_cast(&child); if (region) { std::vector const &computed = region->computed; for (std::vector::const_iterator it = computed.begin() ; it != computed.end() ; ++it) { @@ -421,8 +421,8 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, } } //Xml Tree is being directly used while it shouldn't be. - else if (!dynamic_cast(child) && !sp_repr_is_meta_element(child->getRepr())) { - _buildLayoutInput(child, exclusion_shape, shapes, pending_line_break_object); + else if (!dynamic_cast(&child) && !sp_repr_is_meta_element(child.getRepr())) { + _buildLayoutInput(&child, exclusion_shape, shapes, pending_line_break_object); } } } @@ -593,9 +593,9 @@ SPItem *SPFlowtext::get_frame(SPItem const *after) SPItem *frame = 0; SPObject *region = 0; - for (SPObject *o = firstChild() ; o ; o = o->getNext() ) { - if (dynamic_cast(o)) { - region = o; + for (auto& o: _children) { + if (dynamic_cast(&o)) { + region = &o; break; } } @@ -603,8 +603,8 @@ SPItem *SPFlowtext::get_frame(SPItem const *after) if (region) { bool past = false; - for (SPObject *o = region->firstChild() ; o ; o = o->getNext() ) { - SPItem *item = dynamic_cast(o); + for (auto& o: region->_children) { + SPItem *item = dynamic_cast(&o); if (item) { if ( (after == NULL) || past ) { frame = item; @@ -707,9 +707,9 @@ Geom::Affine SPFlowtext::set_transform (Geom::Affine const &xform) } SPObject *region = NULL; - for ( SPObject *o = this->firstChild() ; o ; o = o->getNext() ) { - if (dynamic_cast(o)) { - region = o; + for (auto& o: _children) { + if (dynamic_cast(&o)) { + region = &o; break; } } -- cgit v1.2.3