From 65ef769a60df0aad2dea9811713faa323757f0b2 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Fri, 28 Feb 2014 20:14:12 +0100 Subject: RTF import: fix paragraphs in header/footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit 74b3f4f00766d199df3b017d056cf7a00ae52988) Signed-off-by: Luboš Luňák Conflicts: sw/qa/extras/rtfimport/rtfimport.cxx Change-Id: I91f04cad7a39428ce6f9555d18b974f0d45181f7 --- sw/qa/extras/rtfimport/data/footer-para.rtf | 5 +++++ sw/qa/extras/rtfimport/rtfimport.cxx | 14 ++++++++++++++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/rtfimport/data/footer-para.rtf diff --git a/sw/qa/extras/rtfimport/data/footer-para.rtf b/sw/qa/extras/rtfimport/data/footer-para.rtf new file mode 100644 index 000000000000..28863b202f17 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/footer-para.rtf @@ -0,0 +1,5 @@ +{\rtf1\fbidis\ansi\ansicpg0\uc0\deff0\deflang0\deflangfe0\paperw11905\paperh16838\margl1200\margr1200\margt1200\margb1200\headery600\footery600\viewscale100\viewzk0\titlepg +{\fonttbl{\f0\fnil Arial;}} +{\footerf +\pard\s0\fi0\li0\qc\ri0\sb0\sa0\itap0 \plain \f0\fs18 All Rights Reserved.\par} +\pard\par} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index e1a67282eb07..b3bc41f613af 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1608,6 +1608,20 @@ DECLARE_RTFIMPORT_TEST(testDoDhgtOld, "do-dhgt-old.rtf") CPPUNIT_ASSERT_EQUAL(OUString("b"), xShape->getString()); } +DECLARE_RTFIMPORT_TEST(testFooterPara, "footer-para.rtf") +{ + // check that paragraph properties in footer are imported + uno::Reference xFooterText = + getProperty< uno::Reference >( + getStyles("PageStyles")->getByName("First Page"), "FooterText"); + uno::Reference xParagraph = + getParagraphOrTable(1, xFooterText); + CPPUNIT_ASSERT_EQUAL(OUString("All Rights Reserved."), + uno::Reference(xParagraph, uno::UNO_QUERY)->getString()); + CPPUNIT_ASSERT_EQUAL((sal_Int16)style::ParagraphAdjust_CENTER, + getProperty(xParagraph, "ParaAdjust")); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 3f6ebc73c5fd..8011bc791dfa 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -401,8 +401,9 @@ void RTFDocumentImpl::setNeedSect(bool bNeedSect) if (!m_pSuperstream) // no sections in header/footer! { Mapper().startSectionGroup(); - m_bNeedSect = bNeedSect; } + // set flag in substream too - otherwise multiple startParagraphGroup + m_bNeedSect = bNeedSect; Mapper().startParagraphGroup(); setNeedPar(true); } -- cgit