diff options
Diffstat (limited to 'src/text-editing.cpp')
| -rw-r--r-- | src/text-editing.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 2bdee4c10..e93ebdffa 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -1843,6 +1843,37 @@ void sp_te_apply_style(SPItem *text, Inkscape::Text::Layout::iterator const &sta text->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG); } +bool is_part_of_text_subtree (SPObject *obj) +{ + return (SP_IS_TSPAN(obj) + || SP_IS_TEXT(obj) + || SP_IS_FLOWTEXT(obj) + || SP_IS_FLOWTSPAN(obj) + || SP_IS_FLOWDIV(obj) + || SP_IS_FLOWPARA(obj) + || SP_IS_FLOWLINE(obj) + || SP_IS_FLOWREGIONBREAK(obj)); +} + +bool is_top_level_text_object (SPObject *obj) +{ + return (SP_IS_TEXT(obj) + || SP_IS_FLOWTEXT(obj)); +} + +bool has_visible_text (SPObject *obj) +{ + if (SP_IS_STRING(obj) && !SP_STRING(obj)->string.empty()) + return true; // maybe we should also check that it's not all whitespace? + + for (SPObject const *child = obj->firstChild() ; child ; child = SP_OBJECT_NEXT(child)) { + if (has_visible_text((SPObject *) child)) + return true; + } + + return false; +} + /* Local Variables: mode:c++ |
