From 2de168e99ba9cd2539f1ddbeffad7e3eb71a7b1b Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 16 Aug 2016 09:16:47 +0200 Subject: tdf#100507 RTF import: don't set default para style to the 0th char style Regression from commit 1be0a3fa9ebb22b607c54b47739d4467acfed259 (n#825305: writerfilter RTF import: override style properties like Word, 2014-06-17), the problem was that the RTF_PARD handler wanted to set a default paragraph style, but it didn't check if the 0th style is actually a paragraph one. This resulted in using a character style name as a paragraph one, throwing in SwUnoCursorHelper::SetTextFormatColl() -> all paragraph properties were lost, including the left indent. Fix this by tracking the style type, and filtering out character styles when looking up a default paragraph style. Change-Id: I41faab0e72667b89ec9a507014b395a675847abf --- sw/qa/extras/rtfimport/data/tdf100507.rtf | 22 ++++++++++++++++++++++ sw/qa/extras/rtfimport/rtfimport.cxx | 6 ++++++ 2 files changed, 28 insertions(+) create mode 100644 sw/qa/extras/rtfimport/data/tdf100507.rtf (limited to 'sw/qa') diff --git a/sw/qa/extras/rtfimport/data/tdf100507.rtf b/sw/qa/extras/rtfimport/data/tdf100507.rtf new file mode 100644 index 000000000000..1665c4e40dd5 --- /dev/null +++ b/sw/qa/extras/rtfimport/data/tdf100507.rtf @@ -0,0 +1,22 @@ +{\rtf1\ansi\ansicpg1252\deff0\dntblnsbdb\viewkind1 +{\fonttbl +{\f0\froman\fcharset0 Times New Roman;} +{\f1\fnil\fcharset0 Arial;} +{\f2\fnil\fcharset0 Arial;} +{\f3\fnil\fcharset0 Arial;} +{\f4\fnil\fcharset0 Arial;} +{\f5\fnil\fcharset0 Arial;} +{\f6\fnil\fcharset0 Arial;} +{\f7\fnil\fcharset0 Arial;} +{\f8\fnil\fcharset0 Arial;} +} +{\colortbl;\red255\green255\blue0;\red0\green0\blue255;\red255\green255\blue255;} +{\stylesheet +{\*\cs0 Default Paragraph Font;} +} +\jexpand\pgwsxn12240\pghsxn15840 +\margl1748\margr1460\margt678\margb478\marglsxn1748\margrsxn1460\cols1\colno1\colw9032 +{\pard\plain \li3752\ql +{\f2\b\fs20 Generation 1} +\par} +} diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index 048eecdc7d8c..f60716867cef 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -2678,6 +2678,12 @@ DECLARE_RTFIMPORT_TEST(testTdf78506, "tdf78506.rtf") } } +DECLARE_RTFIMPORT_TEST(testTdf100507, "tdf100507.rtf") +{ + // This was 0: left margin of the first paragraph was lost on import. + CPPUNIT_ASSERT_EQUAL(static_cast(6618), getProperty(getParagraph(1), "ParaLeftMargin")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit