summaryrefslogtreecommitdiffstats
path: root/src/object/sp-text.cpp
diff options
context:
space:
mode:
authorJabiertxof <jabier.arraiza@marker.es>2019-09-13 20:09:42 +0000
committerJabiertxof <jabier.arraiza@marker.es>2019-09-13 20:09:42 +0000
commitbf052b6e7cb79317c4f38ff144a77b6f9e49421e (patch)
tree8b5235b21eeac68e495ad60a51065aaeed4aff33 /src/object/sp-text.cpp
parentRefactor of prepare inner and some comments (diff)
downloadinkscape-bf052b6e7cb79317c4f38ff144a77b6f9e49421e.tar.gz
inkscape-bf052b6e7cb79317c4f38ff144a77b6f9e49421e.zip
Allow to paste paragraphs in SVG2 Flow then paste overflow the shape
Diffstat (limited to 'src/object/sp-text.cpp')
-rw-r--r--src/object/sp-text.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/object/sp-text.cpp b/src/object/sp-text.cpp
index 91ca65170..4dd5a9ff1 100644
--- a/src/object/sp-text.cpp
+++ b/src/object/sp-text.cpp
@@ -63,7 +63,12 @@
SPText::SPText() : SPItem() {
}
-SPText::~SPText() = default;
+SPText::~SPText()
+{
+ if (css) {
+ sp_repr_css_attr_unref(css);
+ }
+};
void SPText::build(SPDocument *doc, Inkscape::XML::Node *repr) {
this->readAttr( "x" );
@@ -76,7 +81,7 @@ void SPText::build(SPDocument *doc, Inkscape::XML::Node *repr) {
this->readAttr( "textLength" );
this->readAttr( "lengthAdjust" );
SPItem::build(doc, repr);
-
+ css = nullptr;
this->readAttr( "sodipodi:linespacing" ); // has to happen after the styles are read
}
@@ -383,6 +388,29 @@ void SPText::snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::
}
}
+void SPText::hide_shape_inside()
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ SPStyle *item_style = this->style;
+ if (item_style && prefs->getBool("/tools/text/use_svg2") && item_style->shape_inside.set) {
+ SPCSSAttr *css_unset = sp_css_attr_from_style(item_style, SP_STYLE_FLAG_IFSET);
+ css = sp_css_attr_from_style(item_style, SP_STYLE_FLAG_IFSET);
+ sp_repr_css_unset_property(css_unset, "shape-inside");
+ sp_repr_css_attr_unref(css_unset);
+ this->changeCSS(css_unset, "style");
+ } else {
+ css = nullptr;
+ }
+}
+
+void SPText::show_shape_inside()
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ if (prefs->getBool("/tools/text/use_svg2") && css) {
+ this->changeCSS(css, "style");
+ }
+}
+
Geom::Affine SPText::set_transform(Geom::Affine const &xform) {
// See if 'shape-inside' has rectangle
Inkscape::Preferences *prefs = Inkscape::Preferences::get();