summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-16 09:16:47 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-16 10:43:09 +0200
commit2de168e99ba9cd2539f1ddbeffad7e3eb71a7b1b (patch)
tree29002b5a17d858e25cbce7230d9b6efa83504a40 /sw/qa
parentc505ec78ddf97fbcb6e39b7865df5a455d41bf38 (diff)
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
Diffstat (limited to 'sw/qa')
-rw-r--r--sw/qa/extras/rtfimport/data/tdf100507.rtf22
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx6
2 files changed, 28 insertions, 0 deletions
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<sal_Int32>(6618), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */