sw/qa/extras/layout/data/tdf167526.docx                  |binary
 sw/qa/extras/layout/layout5.cxx                          |   12 ++++++++++++
 sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx |    3 +++
 3 files changed, 15 insertions(+)

New commits:
commit cd35f5035e3849ddb809dc38aafcd02ba85583e8
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Jul 17 18:01:35 2025 +0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jul 17 15:58:36 2025 +0200

    tdf#167535: Ignore dummy anchor nodes in line numbering (take 2)
    
    Commit 441aed20b95ee40dec1df72fb8e8167d0e48c0c4 (tdf#167379 sw floattable:
    make dummy paragraph from DOCX import less visible, 2025-07-10) introduced
    dummy nodes as invisible anchors for floating tables without normal anchor
    nodes. These nodes are not part of actual content; use suppressLineNumbers
    property in OOXMLFastContextHandlerTextTable::lcl_startFastElement, which
    avoids their use in line numbering.
    
    Change-Id: Id1703c10ede6960499e08758c250d6d561d1f07f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/188012
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/qa/extras/layout/data/tdf167526.docx 
b/sw/qa/extras/layout/data/tdf167526.docx
index 050f081ff8e3..47c0fe5d2a01 100644
Binary files a/sw/qa/extras/layout/data/tdf167526.docx and 
b/sw/qa/extras/layout/data/tdf167526.docx differ
diff --git a/sw/qa/extras/layout/layout5.cxx b/sw/qa/extras/layout/layout5.cxx
index 4714376b3f2d..f6e69743866e 100644
--- a/sw/qa/extras/layout/layout5.cxx
+++ b/sw/qa/extras/layout/layout5.cxx
@@ -1834,6 +1834,18 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf167526)
         // Without a fix, this would fail, because the third element was the 
wrongly emitted <w:p>
         assertXPathNodeName(pXmlDoc, "/w:document/w:body/*[3]", "tbl");
     }
+
+    // tdf#167535: check line numbering; the dummy node must not interfere 
with it
+    {
+        // Dump the rendering of the first page as an XML file.
+        SwDocShell* pShell = getSwDocShell();
+        std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
+        MetafileXmlDump dumper;
+        xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
+        // Without a fix, this was 3
+        assertXPathContent(
+            pXmlDoc, "/metafile/push/push/push/textarray[@index=0 and 
@length=1][2]/text", u"2");
+    }
 }
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx 
b/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx
index 71b327dfa89b..0bd68b5d9049 100644
--- a/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx
+++ b/sw/source/writerfilter/ooxml/OOXMLFastContextHandler.cxx
@@ -1634,6 +1634,9 @@ void 
OOXMLFastContextHandlerTextTable::lcl_startFastElement
             pAttributes->add(NS_ooxml::LN_CT_Spacing_line, pSLVal, 
OOXMLProperty::ATTRIBUTE);
             OOXMLValue pSprm = OOXMLValue::createPropertySet(pAttributes);
             pSprms->add(NS_ooxml::LN_CT_PPrBase_spacing, pSprm, 
OOXMLProperty::SPRM);
+            // Do not count it in line numbering
+            pSprms->add(NS_ooxml::LN_CT_PPrBase_suppressLineNumbers,
+                        OOXMLValue::createBoolean(true), OOXMLProperty::SPRM);
         }
         mpStream->props(pSprms.get());
 

Reply via email to