Code

fix 3d box drag
[inkscape.git] / src / sp-flowtext.cpp
index b589bb64d6dc298255e35351470bfd009faee566..552adb36eb37a0fe8a00281c8bc09e6ca5d8cc53 100644 (file)
@@ -5,6 +5,8 @@
 # include "config.h"
 #endif
 #include <glibmm/i18n.h>
+#include <cstring>
+#include <string>
 
 #include "attributes.h"
 #include "xml/repr.h"
@@ -173,11 +175,12 @@ sp_flowtext_update(SPObject *object, SPCtx *ctx, unsigned flags)
 
     group->rebuildLayout();
 
-    // pass the bbox of the flowtext object as paintbox (used for paintserver fills)
     NRRect paintbox;
     sp_item_invoke_bbox(group, &paintbox, NR::identity(), TRUE);
     for (SPItemView *v = group->display; v != NULL; v = v->next) {
         group->_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 flowtext object as paintbox (used for paintserver fills)
         group->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox);
     }
 }
@@ -328,7 +331,7 @@ sp_flowtext_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform,
 
     // Add stroke width
     SPStyle* style=SP_OBJECT_STYLE (item);
-    if (style->stroke.type != SP_PAINT_TYPE_NONE) {
+    if ( !style->stroke.isNone() ) {
         double const scale = expansion(transform);
         if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
             double const width = MAX(0.125, style->stroke_width.computed * scale);
@@ -350,7 +353,12 @@ sp_flowtext_print(SPItem *item, SPPrintContext *ctx)
     NRRect pbox;
     sp_item_invoke_bbox(item, &pbox, NR::identity(), TRUE);
     NRRect bbox;
-    sp_item_bbox_desktop(item, &bbox);
+    NR::Maybe<NR::Rect> bbox_maybe = sp_item_bbox_desktop(item);
+    if (!bbox_maybe) {
+        return;
+    }
+    bbox = NRRect(*bbox_maybe);
+
     NRRect dbox;
     dbox.x0 = 0.0;
     dbox.y0 = 0.0;
@@ -379,6 +387,8 @@ sp_flowtext_show(SPItem *item, NRArena *arena, unsigned/* key*/, unsigned /*flag
     NRArenaGroup *flowed = NRArenaGroup::create(arena);
     nr_arena_group_set_transparent(flowed, FALSE);
 
+    nr_arena_group_set_style(flowed, group->style);
+
     // pass the bbox of the flowtext object as paintbox (used for paintserver fills)
     NRRect paintbox;
     sp_item_invoke_bbox(item, &paintbox, NR::identity(), TRUE);