sw/qa/extras/ooxmlexport/data/tdf131594.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 7 +++++++ writerfilter/source/dmapper/DomainMapper.cxx | 25 +++++++++++++++---------- 3 files changed, 22 insertions(+), 10 deletions(-)
New commits: commit 910197b8cf9b653c1b39b35b73424a36b7c1d1ae Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Mar 26 15:50:59 2020 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Apr 2 14:49:02 2020 +0200 tdf#131594: switch line numbering off if w:countBy="0" See https://bugs.documentfoundation.org/show_bug.cgi?id=131594#c0 for more info Change-Id: Ic57826eb5a440e83cea1d9bde5e9144727e3b6df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91141 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf131594.docx b/sw/qa/extras/ooxmlexport/data/tdf131594.docx new file mode 100644 index 000000000000..009c6d56bd85 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf131594.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 3f217e35d96c..81f286c6e3da 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -784,6 +784,13 @@ DECLARE_OOXMLEXPORT_TEST(testImageCommentAtChar, "image-comment-at-char.docx") getProperty<OUString>(getRun(xPara, 5), "TextPortionType")); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf131594, "tdf131594.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + // lnNumType should not be exported if w:countBy="0" + assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:lnNumType", 0); +} + DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf121663, "tdf121663.docx") { xmlDocPtr pXmlDoc = parseExport("word/document.xml"); diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index d84c94b2fbfe..e69e3796160b 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2018,19 +2018,24 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) { uno::Reference< text::XLineNumberingProperties > xLineNumberingProperties( m_pImpl->GetTextDocument(), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xLineNumberingPropSet = xLineNumberingProperties->getLineNumberingProperties(); - xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_IS_ON ), uno::makeAny(true) ); - if( aSettings.nInterval ) - xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_INTERVAL ), uno::makeAny(static_cast<sal_Int16>(aSettings.nInterval)) ); - if( aSettings.nDistance != -1 ) - xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) ); + if( aSettings.nInterval == 0 ) + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_IS_ON ), uno::makeAny(false) ); else { - // set Auto value (0.5 cm) - xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_DISTANCE ), uno::makeAny(static_cast<sal_Int32>(500)) ); - if( pSectionContext ) - pSectionContext->SetdxaLnn( static_cast<sal_Int32>(283) ); + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_IS_ON ), uno::makeAny(true) ); + if( aSettings.nInterval ) + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_INTERVAL ), uno::makeAny(static_cast<sal_Int16>(aSettings.nInterval)) ); + if( aSettings.nDistance != -1 ) + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_DISTANCE ), uno::makeAny(aSettings.nDistance) ); + else + { + // set Auto value (0.5 cm) + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_DISTANCE ), uno::makeAny(static_cast<sal_Int32>(500)) ); + if( pSectionContext ) + pSectionContext->SetdxaLnn( static_cast<sal_Int32>(283) ); + } + xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) ); } - xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_RESTART_AT_EACH_PAGE ), uno::makeAny(aSettings.bRestartAtEachPage) ); } catch( const uno::Exception& ) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits