sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 14 +++++++++++ writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 7 +++++ writerfilter/source/dmapper/DomainMapper_Impl.cxx | 19 +++++++++++++++ 3 files changed, 40 insertions(+)
New commits: commit 521e350ff967bfc3019e8184a0d077228853fba1 Author: László Németh <nem...@numbertext.org> AuthorDate: Tue Jun 9 14:42:26 2020 +0200 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Thu Feb 18 10:01:55 2021 +0100 tdf#131070 DOCX import: fix indentation of direct numbering Indentation came from direct numbering has precedence over table style. Also paragraph style based right indentation affects DOCX list items with not paragraph style based numbering, unlike Writer. Keep all indentation values using direct paragraph formatting. Change-Id: Ia66645269a4fcd06f0be4f02c775007c83d22a0b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95954 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 20ba8d8d9f4fcf7d5826fcb3366a9bff0d6a8ca1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111047 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index ae47d4f28a9c..eca4c431fbc4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -386,6 +386,20 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf118812, "tdf118812_tableStyles-compre assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[6]/w:tc/w:p/w:r[2]/w:rPr/w:color", 1); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[6]/w:tc/w:p/w:r[2]/w:rPr/w:color", "val", "AAAA00"); assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[6]/w:tc/w:p/w:r[2]/w:rPr/w:sz", "val", "16"); + + // tdf#131070 keep paragraph style based right indentation with indentation of direct numbering + // cell A7 - This was <w:ind w:start="1440" w:hanging="0"/> + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[7]/w:tc/w:p/w:pPr/w:ind", 0); + // cell A8 + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[8]/w:tc/w:p/w:pPr/w:ind", "start", "714"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[8]/w:tc/w:p/w:pPr/w:ind", "end", "1701"); + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[8]/w:tc/w:p/w:pPr/w:ind", "hanging", "357"); + // cell A9 + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[9]/w:tc/w:p/w:pPr/w:ind", "end", "1440"); + // This was 1440 + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[9]/w:tc/w:p/w:pPr/w:ind", "start", "720"); + // This was 0 + assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[9]/w:tc/w:p/w:pPr/w:ind", "hanging", "360"); } DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf107626, "tdf107626.odt") diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index c32b33af10c4..d5bde5aea4d8 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -1074,6 +1074,13 @@ void DomainMapperTableHandler::ApplyParagraphPropertiesFromTableStyle(TableParag // if there is no direct paragraph formatting if ( !rParaProp.m_pPropertyMap->isSet(eId) ) { + if ( (eId == PROP_PARA_LEFT_MARGIN || eId == PROP_PARA_FIRST_LINE_INDENT) && + rParaProp.m_pPropertyMap->isSet(PROP_NUMBERING_RULES) ) + { + // indentation of direct numbering has bigger precedence, than table style + continue; + } + OUString sPropertyName = getPropertyName(eId); auto pCellProp = std::find_if(rCellProperties.begin(), rCellProperties.end(), [&](const beans::PropertyValue& rProp) { return rProp.Name == sPropertyName; }); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 40fef6294438..07de495c68f2 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1468,6 +1468,25 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con pParaContext->Insert(PROP_PARA_RIGHT_MARGIN, uno::makeAny(nParaRightMargin), /*bOverwrite=*/false); } } + // Paragraph style based right paragraph indentation affects not paragraph style based lists in DOCX. + // Apply it as direct formatting, also left and first line indentation of numbering to keep them. + else if (isNumberingViaRule) + { + uno::Any aRightMargin = GetPropertyFromParaStyleSheet(PROP_PARA_RIGHT_MARGIN); + if ( aRightMargin != uno::Any() ) + { + pParaContext->Insert(PROP_PARA_RIGHT_MARGIN, aRightMargin, /*bOverwrite=*/false); + + sal_Int32 nListId2(static_cast<ParagraphPropertyMap*>(pPropertyMap.get())->GetListId()); + + const sal_Int32 nFirstLineIndent = getNumberingProperty(nListId2, nListLevel, "FirstLineIndent"); + const sal_Int32 nParaLeftMargin = getNumberingProperty(nListId2, nListLevel, "IndentAt"); + if (nFirstLineIndent != 0) + pParaContext->Insert(PROP_PARA_FIRST_LINE_INDENT, uno::makeAny(nFirstLineIndent), /*bOverwrite=*/false); + if (nParaLeftMargin != 0) + pParaContext->Insert(PROP_PARA_LEFT_MARGIN, uno::makeAny(nParaLeftMargin), /*bOverwrite=*/false); + } + } } // apply AutoSpacing: it has priority over all other margin settings _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits