summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-07-01 12:20:09 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-07-02 11:55:42 +0200
commitf24e4c74d7d6a7d95090c6fa6a584fed7787706c (patch)
treeb94d3592a7f592e16680afdcd55016b8937e329d /oox
parentb1f78c44c1acc246f06a963383232c9bf649a06b (diff)
fdo#46361 oox: handle multiple w:p for groupshape textboxes
One testcase had to be adjusted, as it seems previously we stripped all newlines at the end (I consider that as a bug), and now we only strip the last one (so the resulting number of paragraphs on the shape and in the source document equal). Change-Id: Ic22b96c2992b53c72e2609e2286622173b86065c
Diffstat (limited to 'oox')
-rw-r--r--oox/source/vml/vmltextbox.cxx7
-rw-r--r--oox/source/vml/vmltextboxcontext.cxx6
2 files changed, 13 insertions, 0 deletions
diff --git a/oox/source/vml/vmltextbox.cxx b/oox/source/vml/vmltextbox.cxx
index 1499091a8cfd..27b423491a4d 100644
--- a/oox/source/vml/vmltextbox.cxx
+++ b/oox/source/vml/vmltextbox.cxx
@@ -95,6 +95,13 @@ void TextBox::convert(uno::Reference<drawing::XShape> xShape) const
xTextAppend->appendTextPortion(aIt->maText, aPropSeq);
}
+ // Remove the last character of the shape text, if it would be a newline.
+ uno::Reference< text::XTextCursor > xCursor = xTextAppend->createTextCursor();
+ xCursor->gotoEnd(false);
+ xCursor->goLeft(1, true);
+ if (xCursor->getString() == "\n")
+ xCursor->setString("");
+
if ( maLayoutFlow == "vertical" )
{
uno::Reference<beans::XPropertySet> xProperties(xShape, uno::UNO_QUERY);
diff --git a/oox/source/vml/vmltextboxcontext.cxx b/oox/source/vml/vmltextboxcontext.cxx
index c04b6244d252..4c025c9068cc 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -219,6 +219,12 @@ ContextHandlerRef TextBoxContext::onCreateContext( sal_Int32 nElement, const Att
return 0;
}
+void TextBoxContext::onEndElement()
+{
+ if (getCurrentElement() == OOX_TOKEN(doc, p))
+ mrTextBox.appendPortion( TextFontModel(), "\n" );
+}
+
// ============================================================================
} // namespace vml