summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfimport/rtfimport.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-02-27 23:48:59 +0100
committerLuboš Luňák <l.lunak@centrum.cz>2014-05-28 11:56:34 +0200
commit4c8858b4a63906a5f5af009be139a8c5247c54b0 (patch)
tree96ac2f681edc59d9ca633e824d9b96451bb6989c /sw/qa/extras/rtfimport/rtfimport.cxx
parentf58522d989b17552f739c1fe63fe5ba483c662e3 (diff)
RTF import: fix spurious page breaks at doc end (related: rhbz#1065629)
When a document ends with \sect it's possible that a spurious page break is created. In fact the spurious page break is always created by the RTF importer, sometimes it is deleted again by DomainMapper_Impl::RemoveLastParagraph() and sometimes not. It is created because on the final \sect RTFDocumentImpl::sectBreak() still calls startSectionGroup(), and the popState() for the \rtf1 group then calls sectBreak() another time. To prevent this, do not call startSectionGroup() from sectBreak() but instead from setNeedSect(), and ensure that it is called as soon as anything after \sect is read. One unit test fails because the \page is not handled properly: the conversion to \skbpage \sect \skbnone is not correct, because the \skb* keywords are an exception and affect the \sect that precedes them, not the following one; sending the \skbpage later unfortunately requires additional cleanup later. (cherry picked from commit e3f254ab8211fbab7541cde2100a35c875b0c240) Signed-off-by: Luboš Luňák <l.lunak@centrum.cz> Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx writerfilter/source/rtftok/rtfdocumentimpl.cxx Change-Id: I3c1a3bceb2c8b75bbecdc748170562451ce5f5c3
Diffstat (limited to 'sw/qa/extras/rtfimport/rtfimport.cxx')
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index f33a47d45355..e1a67282eb07 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1554,6 +1554,9 @@ void Test::testNestedTable()
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
xPara.set(xParaEnum->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("Nom: John Doe"), xPara->getString());
+
+ // \sect at the end resulted in spurious page break
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);