[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jun 30 04:31:32 PDT 2015
sw/qa/extras/rtfimport/data/tdf92061.rtf | 5 +++++
sw/qa/extras/rtfimport/rtfimport.cxx | 6 ++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 2 ++
3 files changed, 13 insertions(+)
New commits:
commit 326ca9e0710d17274eb0a6cdc0d95d4f933784f0
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jun 22 09:05:30 2015 +0200
tdf#92061 RTF import: fix missing body text after footnote
A missing seek in the \footnote handler could result in a situation that
the missed text contained a "{" but not its matching "}", which resulted
in the parser terminating earlier than the end of the document.
(cherry picked from commit 7b08304b55cf2284a3c583426c60baef618ba206)
Conflicts:
sw/qa/extras/rtfimport/rtfimport.cxx
Change-Id: I6df476b2d6397dfa918111b33854dc2f95fbe81d
Reviewed-on: https://gerrit.libreoffice.org/16501
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/qa/extras/rtfimport/data/tdf92061.rtf b/sw/qa/extras/rtfimport/data/tdf92061.rtf
new file mode 100644
index 0000000..03978b4
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf92061.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+body-before
+{\footnote AAAAA {B} C}
+body-after\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index f7fa4de..bfff118 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2309,6 +2309,12 @@ DECLARE_RTFIMPORT_TEST(testTdf90315, "tdf90315.rtf")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), getProperty<sal_Int32>(xTextSection->getPropertyValue("TextColumns"), "AutomaticDistance"));
}
+DECLARE_RTFIMPORT_TEST(testTdf92061, "tdf92061.rtf")
+{
+ // This was "C", i.e. part of the footnote ended up in the body text.
+ CPPUNIT_ASSERT_EQUAL(OUString("body-after"), getRun(getParagraph(1), 3)->getString());
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 75978e4..ea5a212 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1690,11 +1690,13 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
// Check if this is an endnote.
OStringBuffer aBuf;
char ch;
+ sal_Size nCurrent = Strm().Tell();
for (int i = 0; i < 7; ++i)
{
Strm().ReadChar(ch);
aBuf.append(ch);
}
+ Strm().Seek(nCurrent);
OString aKeyword = aBuf.makeStringAndClear();
if (aKeyword.equals("\\ftnalt"))
nId = NS_ooxml::LN_endnote;
More information about the Libreoffice-commits
mailing list