diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-03-26 15:50:59 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-04-08 11:32:37 +0200 |
commit | de5a0023695584a4c2c5a2729284186d43fc7d82 (patch) | |
tree | 057d85ddb9be47eb78e190366f650ea17c3418d0 | |
parent | 7eb78233b46652f4317aef34a1bac4d084b00e2d (diff) |
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 <vmiklos@collabora.com>
(cherry picked from commit 910197b8cf9b653c1b39b35b73424a36b7c1d1ae)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91512
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf131594.docx | bin | 0 -> 17358 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 7 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper.cxx | 25 |
3 files changed, 22 insertions, 10 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf131594.docx b/sw/qa/extras/ooxmlexport/data/tdf131594.docx Binary files differnew file mode 100644 index 000000000000..009c6d56bd85 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf131594.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 91817f2f2220..47db568932bd 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -682,6 +682,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 70cd838d59b5..938cc59be726 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -1996,19 +1996,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& ) { |