[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-5-2+backports' - sw/qa writerfilter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Jan 11 13:51:35 UTC 2019
sw/qa/extras/rtfimport/data/tdf117246.rtf | 11 +++++++++++
sw/qa/extras/rtfimport/rtfimport.cxx | 6 ++++++
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 9 +++++++++
3 files changed, 26 insertions(+)
New commits:
commit 48486ee07a9c6620bc296363b24970f42430561c
Author: Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Thu Apr 26 12:03:12 2018 +0200
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Fri Jan 11 14:51:12 2019 +0100
tdf#117246 RTF import: don't loose page breaks inside nested groups
Regression from e3f254ab8211fbab7541cde2100a35c875b0c240 (RTF import:
fix spurious page breaks at doc end (related: rhbz#1065629),
2014-02-27), the problem was that now we update the parser state to
remember the next section break should set the break type of the current
section to "next page", but this state should be remembered once the RTF
group ends ("}" character), otherwise \page will be represented with a
continuous break, i.e. lost.
Change-Id: I69a8413f45e17e11d6d676c7bfd13ca7560b4d43
Reviewed-on: https://gerrit.libreoffice.org/53498
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/66154
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/sw/qa/extras/rtfimport/data/tdf117246.rtf b/sw/qa/extras/rtfimport/data/tdf117246.rtf
new file mode 100644
index 000000000000..a6fc7cf94426
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf117246.rtf
@@ -0,0 +1,11 @@
+{\rtf1
+\sbknone\pard\plain
+{Page 1}
+{\par }
+{\page }
+{Page 2}
+{\par }
+{\page }
+{Page 3}
+{\par }
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index bafe8ed3cea5..3ffd489cdc06 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -211,6 +211,12 @@ DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf")
CPPUNIT_ASSERT(bDrawFound);
}
+DECLARE_RTFIMPORT_TEST(testTdf117246, "tdf117246.rtf")
+{
+ // This was 2, all but the last \page was lost.
+ CPPUNIT_ASSERT_EQUAL(3, getPages());
+}
+
DECLARE_RTFIMPORT_TEST(testFdo42465, "fdo42465.rtf")
{
CPPUNIT_ASSERT_EQUAL(3, getLength());
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 4d16fbe8c9f3..f2a87e034485 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3073,6 +3073,15 @@ RTFError RTFDocumentImpl::popState()
// don't do it again in the outer state later.
m_aStates.top().nTableRowWidthAfter = 0;
+ if (m_nResetBreakOnSectBreak != RTF_invalid && !m_aStates.empty())
+ {
+ // Section break type created for \page still has an effect in the
+ // outer state as well.
+ RTFValue::Pointer_t pType = aState.aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type);
+ if (pType)
+ m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_type, pType);
+ }
+
return RTFError::OK;
}
More information about the Libreoffice-commits
mailing list