sw/qa/extras/rtfimport/data/tdf115155.rtf       |   30 ++++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx            |   10 ++++++++
 writerfilter/source/dmapper/DomainMapper.cxx    |    1 
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |   13 ++++++++--
 4 files changed, 52 insertions(+), 2 deletions(-)

New commits:
commit 7655001a65a250ea7cd70f2efcc78037b5a9813f
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Mon Jan 29 22:01:54 2018 +0100

    tdf#115155 RTF import: fix left indent handling inside list definition
    
    This used to work in the past only because the left indent was also
    imported as a direct paragraph formatting, but that is not the case
    since left margin of lists is deduplicated during import after commit
    c9dee880d88305312094b311abdae155e452bf14 (tdf#104016 RTF import:
    deduplicate before text indent from numbering, 2017-12-05).
    
    Change-Id: I1c9be30700c51ef97fb274e8781d6008db3121d8
    Reviewed-on: https://gerrit.libreoffice.org/48855
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk>

diff --git a/sw/qa/extras/rtfimport/data/tdf115155.rtf 
b/sw/qa/extras/rtfimport/data/tdf115155.rtf
new file mode 100644
index 000000000000..199a6df68485
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf115155.rtf
@@ -0,0 +1,30 @@
+{\rtf1
+{\stylesheet
+{Normal;}
+}
+{\*\listtable
+{\list\listtemplateid-1421309416\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc0
+\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\leveltemplateid646248826\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li720 }
+{\listname ;}
+\listid2098404966}
+{\list\listtemplateid1569465126\listhybrid
+{\listlevel\levelnfc0\levelnfcn0\leveljc0
+\leveljcn0\levelfollow0\levelstartat1\levelspace0\levelindent0
+{\leveltext\leveltemplateid-597686520\'02\'00.;}
+{\levelnumbers\'01;}
+\rtlch\fcs1 \af0 \ltrch\fcs0 \fbias0 \fi-360\li1440 }
+\listid298658175}
+}
+{\*\listoverridetable
+{\listoverride\listid2098404966\listoverridecount0\ls1}
+{\listoverride\listid298658175\listoverridecount0\ls2}
+}
+\pard \fi-360\li720\ri0\ls1
+outer\par
+\pard \fi-360\li1440\ri0\ls2
+inner\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 103c6726abe4..6621626e662a 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -175,6 +175,16 @@ DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf")
     }
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf115155, "tdf115155.rtf")
+{
+    auto xLevels
+        = 
getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(2), 
"NumberingRules");
+    // 1st level
+    comphelper::SequenceAsHashMap aMap(xLevels->getByIndex(0));
+    // This was 1270: the left margin in the numbering rule was too small.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2540), 
aMap["IndentAt"].get<sal_Int32>());
+}
+
 DECLARE_RTFIMPORT_TEST(testTdf108951, "tdf108951.rtf")
 {
     // This test is import-only, as we assert the list ID, which is OK to
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 464910fb625c..5ae0bdc612ab 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1277,6 +1277,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const 
PropertyMapPtr& rContext )
                     // So no situation where keeping indentation at this point 
would make sense -> erase.
                     rContext->Erase(PROP_PARA_FIRST_LINE_INDENT);
                     rContext->Erase(PROP_PARA_LEFT_MARGIN);
+                    rContext->Erase(PROP_PARA_RIGHT_MARGIN);
                 }
             }
             else
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx 
b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 1529e3805448..615476e42ee2 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -1474,8 +1474,17 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword 
nKeyword, int nParam)
         }
         case RTF_LI:
         {
-            putNestedAttribute(m_aStates.top().aParagraphSprms, 
NS_ooxml::LN_CT_PPrBase_ind,
-                               NS_ooxml::LN_CT_Ind_left, pIntValue);
+            if (m_aStates.top().eDestination == Destination::LISTLEVEL)
+            {
+                if (m_aStates.top().bLevelNumbersValid)
+                    putNestedAttribute(m_aStates.top().aTableSprms, 
NS_ooxml::LN_CT_PPrBase_ind,
+                                       NS_ooxml::LN_CT_Ind_left, pIntValue);
+            }
+            else
+            {
+                putNestedAttribute(m_aStates.top().aParagraphSprms, 
NS_ooxml::LN_CT_PPrBase_ind,
+                                   NS_ooxml::LN_CT_Ind_left, pIntValue);
+            }
             // It turns out \li should reset the \fi inherited from the 
stylesheet.
             // So set the direct formatting to zero, if we don't have such 
direct formatting yet.
             putNestedAttribute(m_aStates.top().aParagraphSprms, 
NS_ooxml::LN_CT_PPrBase_ind,
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to