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 de5a0023695584a4c2c5a2729284186d43fc7d82
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Thu Mar 26 15:50:59 2020 +0100
Commit:     Michael Stahl <michael.st...@cib.de>
CommitDate: Wed Apr 8 11:32:37 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>
    (cherry picked from commit 910197b8cf9b653c1b39b35b73424a36b7c1d1ae)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91512
    Reviewed-by: Michael Stahl <michael.st...@cib.de>

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 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& )
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to