summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-05-30 12:48:52 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-05-30 21:16:21 +0200
commit278bfe012a0e465cb8d08957fc07d2e5dcebdc81 (patch)
tree94665bc26b629e1d5ad01f5d98af1046c0e354d6
parent709040e0adf0a533700576b14c8498f986a601e9 (diff)
tdf#106950 sw: support CharShadingValue property on paragraph styles
Regression from commit 26d40686128e70916a636e20f5ccc5763bbb6cc8 (fdo65400: fix for Character Shading being lost, 2013-06-23), though much more visible since commit a9e029ace41562e28e9242d63230ad1ca275f5d3 (tdf#104744 RTF import: fix unexpected zero para left margin wrt style dedup, 2017-01-03), when I fixed the RTF filter to not duplicate the "align paragraph to center" paragraph style property as a direct formatting as well. The problem was that the CharShadingValue property was not added as a paragraph style property, while in general all character properties are also allowed on paragraphs and paragraph styles as well. Change-Id: If1bdad96e45adc545a81a1f550ab7ccb3591c4f6 Reviewed-on: https://gerrit.libreoffice.org/38210 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/rtfimport/data/tdf106950.rtf8
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx9
-rw-r--r--sw/source/core/unocore/unomapproperties.hxx1
3 files changed, 18 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/tdf106950.rtf b/sw/qa/extras/rtfimport/data/tdf106950.rtf
new file mode 100644
index 000000000000..8ebaa3ce100f
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf106950.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+{\stylesheet
+{\s20\chcbpat2\qc Title;}
+}
+\plain\plain\s20\chcbpat2\qc\plain
+hello
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 8cefb3af2cfa..90fe265d8238 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2827,6 +2827,15 @@ DECLARE_RTFIMPORT_TEST(testTdf107116, "tdf107116.rtf")
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(120)), getProperty<sal_Int32>(getParagraph(2), "TopBorderDistance"));
}
+DECLARE_RTFIMPORT_TEST(testTdf106950, "tdf106950.rtf")
+{
+ uno::Reference<text::XTextRange> xPara(getParagraph(1));
+ // This was ParagraphAdjust_LEFT, trying to set CharShadingValue on a
+ // paragraph style thrown an exception, and remaining properties were not
+ // set.
+ CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xPara, "ParaAdjust")));
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx
index b8b3091464d0..633fd3db3e2e 100644
--- a/sw/source/core/unocore/unomapproperties.hxx
+++ b/sw/source/core/unocore/unomapproperties.hxx
@@ -400,6 +400,7 @@
{ OUString(UNO_NAME_PARA_BOTTOM_MARGIN_RELATIVE), RES_UL_SPACE, cppu::UnoType<sal_Int16>::get(), PROPERTY_NONE, MID_LO_REL_MARGIN},\
TABSTOPS_MAP_ENTRY\
{ OUString(UNO_NAME_CHAR_WORD_MODE), RES_CHRATR_WORDLINEMODE,cppu::UnoType<bool>::get() , PROPERTY_NONE, 0},\
+ { OUString(UNO_NAME_CHAR_SHADING_VALUE), RES_CHRATR_BACKGROUND, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_SHADING_VALUE }, \
{ OUString(UNO_NAME_CHAR_LEFT_BORDER), RES_CHRATR_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, LEFT_BORDER |CONVERT_TWIPS },\
{ OUString(UNO_NAME_CHAR_RIGHT_BORDER), RES_CHRATR_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, RIGHT_BORDER |CONVERT_TWIPS },\
{ OUString(UNO_NAME_CHAR_TOP_BORDER), RES_CHRATR_BOX, cppu::UnoType<css::table::BorderLine>::get(), PROPERTY_NONE, TOP_BORDER |CONVERT_TWIPS },\