[Libreoffice-commits] core.git: sw/qa sw/source writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Dec 11 08:10:38 UTC 2018


 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx    |    3 ++-
 sw/source/filter/ww8/docxattributeoutput.cxx |    5 +++--
 writerfilter/source/dmapper/PropertyMap.cxx  |    5 ++++-
 3 files changed, 9 insertions(+), 4 deletions(-)

New commits:
commit 46c5c62a9829a217f54d826c2cff6d2e15f7cba9
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Dec 10 20:53:52 2018 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Dec 11 09:10:15 2018 +0100

    Related: tdf#121664 DOCX filter: fix line numbering start value handling
    
    SwWW8ImplReader::HandleLineNumbering() and
    WW8AttributeOutput::SectionLineNumbering() does the same for the DOC
    filter.
    
    Change-Id: I13c53a135d640829aeab44c29991c61c27a4ccf1
    Reviewed-on: https://gerrit.libreoffice.org/64892
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 6f862ef90b5c..4d62de086506 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -802,7 +802,8 @@ DECLARE_OOXMLEXPORT_TEST(testFdo66543, "fdo66543.docx")
     // but nothing was done with it.
 
     uno::Reference< text::XTextRange > paragraph1 = getParagraph( 1 );
-    CPPUNIT_ASSERT_EQUAL( sal_Int32( 1 ), getProperty< sal_Int32 >( paragraph1, "ParaLineNumberStartValue" ));
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2),
+                         getProperty<sal_Int32>(paragraph1, "ParaLineNumberStartValue"));
 }
 
 DECLARE_OOXMLEXPORT_TEST(testN822175, "n822175.odt")
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index a15842e28ddc..f3955135065c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -6055,8 +6055,9 @@ void DocxAttributeOutput::SectionLineNumbering( sal_uLong nRestartNo, const SwLi
     pAttr->add( FSNS( XML_w, XML_restart ), rLnNumInfo.IsRestartEachPage() ? "newPage" : "continuous" );
     if( rLnNumInfo.GetPosFromLeft())
         pAttr->add( FSNS( XML_w, XML_distance ), OString::number(rLnNumInfo.GetPosFromLeft()).getStr());
-    if( nRestartNo )
-        pAttr->add( FSNS( XML_w, XML_start ), OString::number( nRestartNo).getStr());
+    if (nRestartNo > 0)
+        // Writer is 1-based, Word is 0-based.
+        pAttr->add(FSNS(XML_w, XML_start), OString::number(nRestartNo - 1).getStr());
     XFastAttributeListRef xAttrs( pAttr );
     m_pSerializer->singleElementNS( XML_w, XML_lnNumType, xAttrs );
 }
diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index ff81c20286d5..d0b4bc8c0d6e 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -1345,7 +1345,10 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
                     //set the start value at the beginning of the document
                     xRangeProperties.set( rDM_Impl.GetTextDocument()->getText()->getStart(), uno::UNO_QUERY_THROW );
                 }
-                xRangeProperties->setPropertyValue( getPropertyName( PROP_PARA_LINE_NUMBER_START_VALUE ), uno::makeAny( m_nLnnMin ) );
+                // Writer is 1-based, Word is 0-based.
+                xRangeProperties->setPropertyValue(
+                    getPropertyName(PROP_PARA_LINE_NUMBER_START_VALUE),
+                    uno::makeAny(m_nLnnMin + 1));
             }
             catch ( const uno::Exception& )
             {


More information about the Libreoffice-commits mailing list