summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-07-01 12:20:09 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2013-09-06 19:30:48 +0200
commit180c8178e8c99295b5d122faffc44330cfca954d (patch)
tree0820698a0ebb1c435acaf6a03436cd0bad1b68d4 /oox
parent8f9f4232ca0cc5d2f8692083caf6a5f2494e5ce3 (diff)
bnc#779642 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 (cherry picked from commit f24e4c74d7d6a7d95090c6fa6a584fed7787706c)
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/vml/vmltextboxcontext.hxx1
-rw-r--r--oox/source/vml/vmltextbox.cxx7
-rw-r--r--oox/source/vml/vmltextboxcontext.cxx6
3 files changed, 14 insertions, 0 deletions
diff --git a/oox/inc/oox/vml/vmltextboxcontext.hxx b/oox/inc/oox/vml/vmltextboxcontext.hxx
index a644026f7b4d..b3240608309c 100644
--- a/oox/inc/oox/vml/vmltextboxcontext.hxx
+++ b/oox/inc/oox/vml/vmltextboxcontext.hxx
@@ -63,6 +63,7 @@ public:
virtual ::oox::core::ContextHandlerRef
onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ virtual void onEndElement();
private:
TextBox& mrTextBox;
diff --git a/oox/source/vml/vmltextbox.cxx b/oox/source/vml/vmltextbox.cxx
index 5a5d75c970dc..490a8973dd87 100644
--- a/oox/source/vml/vmltextbox.cxx
+++ b/oox/source/vml/vmltextbox.cxx
@@ -94,6 +94,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 17b087220c0f..903f64e49dd8 100644
--- a/oox/source/vml/vmltextboxcontext.cxx
+++ b/oox/source/vml/vmltextboxcontext.cxx
@@ -217,6 +217,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