summaryrefslogtreecommitdiffstats
path: root/src/sp-flowtext.cpp
diff options
context:
space:
mode:
authorMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
committerMichael Soegtrop <MSoegtrop@yahoo.de>2017-06-05 13:01:17 +0000
commit509ca3687330fea576ea67ae6c7f31d16e66b800 (patch)
tree9097520c54e355ded9bd0b4d6618af4e8dacdd91 /src/sp-flowtext.cpp
parentupdated to latest trunk (diff)
parent[Bug #1695016] Xaml export misses some radialGradients. (diff)
downloadinkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.tar.gz
inkscape-509ca3687330fea576ea67ae6c7f31d16e66b800.zip
updated to latest trunk
(bzr r14876.2.4)
Diffstat (limited to 'src/sp-flowtext.cpp')
-rw-r--r--src/sp-flowtext.cpp67
1 files changed, 31 insertions, 36 deletions
diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp
index 51fb3ae89..d79652bf4 100644
--- a/src/sp-flowtext.cpp
+++ b/src/sp-flowtext.cpp
@@ -2,7 +2,7 @@
*/
#ifdef HAVE_CONFIG_H
-# include "config.h"
+#include <config.h>
#endif
#include <glibmm/i18n.h>
#include <cstring>
@@ -13,20 +13,15 @@
#include "style.h"
#include "inkscape.h"
#include "document.h"
-#include "selection.h"
#include "desktop.h"
-#include "xml/repr.h"
-
#include "sp-flowdiv.h"
#include "sp-flowregion.h"
#include "sp-flowtext.h"
#include "sp-string.h"
-#include "sp-use.h"
#include "sp-rect.h"
#include "text-tag-attributes.h"
-#include "text-chemistry.h"
#include "text-editing.h"
#include "sp-text.h"
@@ -72,9 +67,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 +130,9 @@ void SPFlowtext::modified(unsigned int flags) {
}
}
- for ( SPObject *o = this->firstChild() ; o ; o = o->getNext() ) {
- if (dynamic_cast<SPFlowregion *>(o)) {
- region = o;
+ for (auto& o: children) {
+ if (dynamic_cast<SPFlowregion *>(&o)) {
+ region = &o;
break;
}
}
@@ -223,11 +218,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<SPFlowdiv *>(child) || dynamic_cast<SPFlowpara *>(child) || dynamic_cast<SPFlowregion *>(child) || dynamic_cast<SPFlowregionExclude *>(child)) {
- c_repr = child->updateRepr(doc, NULL, flags);
+ if ( dynamic_cast<SPFlowdiv *>(&child) || dynamic_cast<SPFlowpara *>(&child) || dynamic_cast<SPFlowregion *>(&child) || dynamic_cast<SPFlowregionExclude *>(&child)) {
+ c_repr = child.updateRepr(doc, NULL, flags);
}
if ( c_repr ) {
@@ -241,9 +236,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<SPFlowdiv *>(child) || dynamic_cast<SPFlowpara *>(child) || dynamic_cast<SPFlowregion *>(child) || dynamic_cast<SPFlowregionExclude *>(child)) {
- child->updateRepr(flags);
+ for (auto& child: children) {
+ if ( dynamic_cast<SPFlowdiv *>(&child) || dynamic_cast<SPFlowpara *>(&child) || dynamic_cast<SPFlowregion *>(&child) || dynamic_cast<SPFlowregionExclude *>(&child)) {
+ child.updateRepr(flags);
}
}
}
@@ -390,8 +385,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<SPString *>(child);
+ for (auto& child: root->children) {
+ SPString *str = dynamic_cast<SPString *>(&child);
if (str) {
if (*pending_line_break_object) {
if (dynamic_cast<SPFlowregionbreak *>(*pending_line_break_object))
@@ -402,12 +397,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<SPFlowregion *>(child);
+ SPFlowregion *region = dynamic_cast<SPFlowregion *>(&child);
if (region) {
std::vector<Shape*> const &computed = region->computed;
for (std::vector<Shape*>::const_iterator it = computed.begin() ; it != computed.end() ; ++it) {
@@ -421,8 +416,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<SPFlowregionExclude *>(child) && !sp_repr_is_meta_element(child->getRepr())) {
- _buildLayoutInput(child, exclusion_shape, shapes, pending_line_break_object);
+ else if (!dynamic_cast<SPFlowregionExclude *>(&child) && !sp_repr_is_meta_element(child.getRepr())) {
+ _buildLayoutInput(&child, exclusion_shape, shapes, pending_line_break_object);
}
}
}
@@ -440,9 +435,9 @@ Shape* SPFlowtext::_buildExclusionShape() const
Shape *shape = new Shape();
Shape *shape_temp = new Shape();
- for (SPObject *child = children ; child ; child = child->getNext() ) {
+ for (auto& child: children) {
// RH: is it right that this shouldn't be recursive?
- SPFlowregionExclude *c_child = dynamic_cast<SPFlowregionExclude *>(child);
+ SPFlowregionExclude *c_child = dynamic_cast<SPFlowregionExclude *>(const_cast<SPObject*>(&child));
if ( c_child && c_child->computed && c_child->computed->hasEdges() ) {
if (shape->hasEdges()) {
shape_temp->Booleen(shape, c_child->computed, bool_op_union);
@@ -540,7 +535,7 @@ Inkscape::XML::Node *SPFlowtext::getAsText()
this->layout.getSourceOfCharacter(it, &rawptr, &span_text_start_iter);
SPObject *source_obj = reinterpret_cast<SPObject *>(rawptr);
- Glib::ustring style_text = (dynamic_cast<SPString *>(source_obj) ? source_obj->parent : source_obj)->style->write( SP_STYLE_FLAG_IFDIFF, this->style);
+ Glib::ustring style_text = (dynamic_cast<SPString *>(source_obj) ? source_obj->parent : source_obj)->style->write( SP_STYLE_FLAG_IFDIFF, SP_STYLE_SRC_UNSET, this->style);
if (!style_text.empty()) {
span_tspan->setAttribute("style", style_text.c_str());
}
@@ -593,9 +588,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<SPFlowregion *>(o)) {
- region = o;
+ for (auto& o: children) {
+ if (dynamic_cast<SPFlowregion *>(&o)) {
+ region = &o;
break;
}
}
@@ -603,8 +598,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<SPItem *>(o);
+ for (auto& o: region->children) {
+ SPItem *item = dynamic_cast<SPItem *>(&o);
if (item) {
if ( (after == NULL) || past ) {
frame = item;
@@ -707,9 +702,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<SPFlowregion *>(o)) {
- region = o;
+ for (auto& o: children) {
+ if (dynamic_cast<SPFlowregion *>(&o)) {
+ region = &o;
break;
}
}