summaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorJabiertxof <jabier.arraiza@marker.es>2019-09-16 14:41:18 +0000
committerJabiertxof <jabier.arraiza@marker.es>2019-09-16 14:41:18 +0000
commitc239b8d513fae662a4e3be85f85efb794d98d83d (patch)
treec2528a5760b21acc685f13cde3b5426284d6fc5b /src/ui
parentAllow paste on flowbox at same sice of origin, also improve creation to get r... (diff)
downloadinkscape-c239b8d513fae662a4e3be85f85efb794d98d83d.tar.gz
inkscape-c239b8d513fae662a4e3be85f85efb794d98d83d.zip
Allow paste preserving new lines into a flowtext element
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/clipboard.cpp8
-rw-r--r--src/ui/toolbar/text-toolbar.cpp6
-rw-r--r--src/ui/tools/text-tool.cpp7
3 files changed, 21 insertions, 0 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index fb7bebc39..7341b8caf 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -65,6 +65,7 @@
#include "object/sp-rect.h"
#include "object/sp-root.h"
#include "object/sp-shape.h"
+#include "object/sp-flowtext.h"
#include "object/sp-textpath.h"
#include "object/sp-use.h"
#include "style.h"
@@ -1093,6 +1094,10 @@ bool ClipboardManagerImpl::_pasteText(SPDesktop *desktop)
if (textitem) {
textitem->hide_shape_inside();
}
+ SPFlowtext *flowtext = dynamic_cast<SPFlowtext *>(tc->text);
+ if (flowtext) {
+ flowtext->fix_overflow_flowregion(false);
+ }
// we realy only want to inherit container style
/* SPCSSAttr *css = take_style_from_item(tc->text);
for (int i = 0; i < nr_blocks; ++i)
@@ -1123,6 +1128,9 @@ bool ClipboardManagerImpl::_pasteText(SPDesktop *desktop)
if (textitem) {
textitem->show_shape_inside();
}
+ if (flowtext) {
+ flowtext->fix_overflow_flowregion(true);
+ }
}
return true;
}
diff --git a/src/ui/toolbar/text-toolbar.cpp b/src/ui/toolbar/text-toolbar.cpp
index b0af522d3..aa9c0fecc 100644
--- a/src/ui/toolbar/text-toolbar.cpp
+++ b/src/ui/toolbar/text-toolbar.cpp
@@ -2296,6 +2296,9 @@ void TextToolbar::prepare_inner()
if (text) {
text->hide_shape_inside();
}
+ if (flowtext) {
+ flowtext->fix_overflow_flowregion(false);
+ }
void *rawptr_start = nullptr;
void *rawptr_end = nullptr;
layout->getSourceOfCharacter(wrap_start, &rawptr_start);
@@ -2303,6 +2306,9 @@ void TextToolbar::prepare_inner()
if (text) {
text->show_shape_inside();
}
+ if (flowtext) {
+ flowtext->fix_overflow_flowregion(true);
+ }
if (!rawptr_start || !rawptr_end || !SP_IS_OBJECT(rawptr_start)|| !SP_IS_OBJECT(rawptr_end)) {
return;
}
diff --git a/src/ui/tools/text-tool.cpp b/src/ui/tools/text-tool.cpp
index 161b20aa2..5919d7fb2 100644
--- a/src/ui/tools/text-tool.cpp
+++ b/src/ui/tools/text-tool.cpp
@@ -1326,6 +1326,10 @@ bool sp_text_paste_inline(ToolBase *ec)
if (textitem) {
textitem->hide_shape_inside();
}
+ SPFlowtext *flowtext = dynamic_cast<SPFlowtext *>(tc->text);
+ if (flowtext) {
+ flowtext->fix_overflow_flowregion(false);
+ }
// Fix for 244940
// The XML standard defines the following as valid characters
// (Extensible Markup Language (XML) 1.0 (Fourth Edition) paragraph 2.2)
@@ -1374,6 +1378,9 @@ bool sp_text_paste_inline(ToolBase *ec)
if (textitem) {
textitem->show_shape_inside();
}
+ if (flowtext) {
+ flowtext->fix_overflow_flowregion(true);
+ }
DocumentUndo::done(ec->desktop->getDocument(), SP_VERB_CONTEXT_TEXT,
_("Paste text"));