[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Mon Sep 28 02:43:46 PDT 2015


 sw/qa/extras/rtfimport/data/tdf94456.rtf     |   23 +++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx         |   10 ++++++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    6 +++---
 3 files changed, 36 insertions(+), 3 deletions(-)

New commits:
commit b669d85de9c933553ae57a9f51902bce7f9da9b5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Sep 28 10:52:31 2015 +0200

    tdf#94456 RTF import: fix list vs paragraph style interaction wrt para indents
    
    In case we set the paragraph left/right/first margin just to mimic the
    list vs paragraph style interaction as Word wants it, never overwrite
    properties, as they are always meant to be just callbacks in case there
    is no real hard formatting.
    
    Change-Id: Ibdb2834c693d43cf4114453e42628e8f64c0a856

diff --git a/sw/qa/extras/rtfimport/data/tdf94456.rtf b/sw/qa/extras/rtfimport/data/tdf94456.rtf
new file mode 100644
index 0000000..075fb53
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf94456.rtf
@@ -0,0 +1,23 @@
+{\rtf1\ansi\deff3\adeflang1025
+{\stylesheet
+{\s0\snext0\nowidctlpar\hyphpar0\aspalpha\ltrpar\cf0\kerning1\dbch\af8\langfe2052\dbch\af6\afs24\alang1081\loch\f3\fs24\lang2055 Normal;}
+{\s1\sbasedon15\snext16\ilvl0\outlinelevel0\sb240\sa120\keepn\b\dbch\af5\dbch\af6\afs36\ab\loch\f4\fs36 Heading 1;}
+{\s15\sbasedon0\snext16\sb240\sa120\keepn\dbch\af5\dbch\af6\afs28\loch\f4\fs28 Heading;}
+}
+{\*\listtable
+{\list\listtemplateid1
+{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2
+{\leveltext \'00;}
+{\levelnumbers;}
+\fi-432\li432}
+\listid1}
+}
+{\listoverridetable
+{\listoverride\listid1\listoverridecount0\ls1}
+}
+\pard\plain \s1\ilvl0\outlinelevel0\sb240\sa120\keepn\b\dbch\af5\dbch\af6\afs36\ab\loch\f4\fs36
+{\listtext\pard\plain \tab}
+\ls1 \li432\ri0\lin432\rin0\fi-432\sb240\sa120
+{\rtlch \ltrch\loch
+Heading}
+\par}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 6aec7bf..19802d9 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2345,6 +2345,16 @@ DECLARE_RTFIMPORT_TEST(testTdf92481, "tdf92481.rtf")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int8>(2), getProperty<sal_Int8>(getParagraph(1), "ParaWidows"));
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf94456, "tdf94456.rtf")
+{
+    // Paragraph left margin and first line indent wasn't imported correctly.
+
+    // This was 1270.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(762), getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
+    // This was -635.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-762), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index eecbb43..bf9eb21 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -449,7 +449,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                 sal_Int32 nFirstLineIndent = m_pImpl->getCurrentNumberingProperty("FirstLineIndent");
 
                 if (nFirstLineIndent != 0)
-                    m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent));
+                    m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent), /*bOverwrite=*/false);
 
                 m_pImpl->GetTopContext()->Insert(
                     PROP_PARA_LEFT_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));
@@ -465,9 +465,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
                 sal_Int32 nParaLeftMargin = m_pImpl->getCurrentNumberingProperty("IndentAt");
 
                 if (nFirstLineIndent != 0)
-                    m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent));
+                    m_pImpl->GetTopContext()->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent), /*bOverwrite=*/false);
                 if (nParaLeftMargin != 0)
-                    m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN, uno::makeAny(nParaLeftMargin));
+                    m_pImpl->GetTopContext()->Insert(PROP_PARA_LEFT_MARGIN, uno::makeAny(nParaLeftMargin), /*bOverwrite=*/false);
 
                 m_pImpl->GetTopContext()->Insert(
                     PROP_PARA_RIGHT_MARGIN, uno::makeAny( ConversionHelper::convertTwipToMM100(nIntValue ) ));


More information about the Libreoffice-commits mailing list