RTF import: fix spurious page breaks at doc end (related: rhbz#1065629)cp-4.2-branch-point
commit153993292cc9f11fed8fcba8de45b0c46d5e0ef2
authorMichael Stahl <mstahl@redhat.com>
Thu, 27 Feb 2014 22:48:59 +0000 (27 23:48 +0100)
committerMiklos Vajna <vmiklos@collabora.co.uk>
Mon, 3 Mar 2014 16:31:30 +0000 (3 10:31 -0600)
tree772310769244edceee186f784b51230598278472
parentcb83b334e489a4ec1cc067145c3f64b129475e7f
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)

RTF import: add unit test for page break in continuous section

(cherry picked from commit f03218f43e8c25c2e136d364455f3cdaf95362b6)

RTF import: fix paragraphs in header/footer

(cherry picked from commit 74b3f4f00766d199df3b017d056cf7a00ae52988)

Change-Id: I3c1a3bceb2c8b75bbecdc748170562451ce5f5c3
Reviewed-on: https://gerrit.libreoffice.org/8439
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
sw/qa/extras/rtfimport/data/cont-section-pagebreak.rtf [new file with mode: 0644]
sw/qa/extras/rtfimport/data/footer-para.rtf [new file with mode: 0644]
sw/qa/extras/rtfimport/rtfimport.cxx
writerfilter/source/rtftok/rtfdocumentimpl.cxx
writerfilter/source/rtftok/rtfdocumentimpl.hxx