Code

Filter effects dialog:
[inkscape.git] / src / sp-text.cpp
index c9811ec6e18420d291de0efbd875a55beaadf6ef..d1105ac2065987e817fa3a709e2c3e17558ac516 100644 (file)
@@ -46,6 +46,7 @@
 #include "mod360.h"
 
 #include "sp-textpath.h"
+#include "sp-tref.h"
 #include "sp-tspan.h"
 
 #include "text-editing.h"
@@ -248,6 +249,7 @@ sp_text_update (SPObject *object, SPCtx *ctx, guint flags)
         sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE);
         for (SPItemView* v = text->display; v != NULL; v = v->next) {
             text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
+            nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
             // pass the bbox of the text object as paintbox (used for paintserver fills)
             text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
         }
@@ -273,6 +275,7 @@ sp_text_modified (SPObject *object, guint flags)
         sp_item_invoke_bbox(text, &paintbox, NR::identity(), TRUE);
         for (SPItemView* v = text->display; v != NULL; v = v->next) {
             text->_clearFlow(NR_ARENA_GROUP(v->arenaitem));
+            nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object));
             text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
         }
     }
@@ -301,13 +304,14 @@ sp_text_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
     SPText *text = SP_TEXT (object);
 
     if (flags & SP_OBJECT_WRITE_BUILD) {
+        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object));
         if (!repr)
-            repr = sp_repr_new ("svg:text");
+            repr = xml_doc->createElement("svg:text");
         GSList *l = NULL;
         for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
             Inkscape::XML::Node *crepr = NULL;
             if (SP_IS_STRING(child)) {
-                crepr = sp_repr_new_text(SP_STRING(child)->string.c_str());
+                crepr = xml_doc->createTextNode(SP_STRING(child)->string.c_str());
             } else {
                 crepr = child->updateRepr(NULL, flags);
             }
@@ -513,6 +517,9 @@ unsigned SPText::_buildLayoutInput(SPObject *root, Inkscape::Text::Layout::Optio
         bool use_xy = !in_textpath && (tspan->role == SP_TSPAN_ROLE_UNSPECIFIED || !tspan->attributes.singleXYCoordinates());
         tspan->attributes.mergeInto(&optional_attrs, parent_optional_attrs, parent_attrs_offset, use_xy, true);
     }
+    else if (SP_IS_TREF(root)) {
+        SP_TREF(root)->attributes.mergeInto(&optional_attrs, parent_optional_attrs, parent_attrs_offset, true, true);
+    }
     else if (SP_IS_TEXTPATH(root)) {
         in_textpath = true;
         SP_TEXTPATH(root)->attributes.mergeInto(&optional_attrs, parent_optional_attrs, parent_attrs_offset, false, true);
@@ -616,6 +623,9 @@ void SPText::_adjustCoordsRecursive(SPItem *item, NR::Matrix const &m, double ex
         SP_TEXT(item)->attributes.transform(m, ex, ex, is_root);
     else if (SP_IS_TEXTPATH(item))
         SP_TEXTPATH(item)->attributes.transform(m, ex, ex, is_root);
+    else if (SP_IS_TREF(item)) {
+        SP_TREF(item)->attributes.transform(m, ex, ex, is_root);
+    }
 
     for (SPObject *o = item->children; o != NULL; o = o->next) {
         if (SP_IS_ITEM(o))