[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jan 30 10:14:56 UTC 2018
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 697359f63e392a73fe3c34635819706a93e5c6b1
Author: Miklos Vajna <vmiklos at 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).
(cherry picked from commit 7655001a65a250ea7cd70f2efcc78037b5a9813f)
Change-Id: I1c9be30700c51ef97fb274e8781d6008db3121d8
Reviewed-on: https://gerrit.libreoffice.org/48888
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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 b71a21f901d8..030fccae1aab 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -179,6 +179,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 39368c29d812..8b2020e300ff 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1334,6 +1334,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 daaf9a44b969..399be66da0a6 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -1465,8 +1465,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,
More information about the Libreoffice-commits
mailing list