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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 10 07:22:45 UTC 2021


 sw/qa/extras/layout/layout.cxx  |    4 ++--
 sw/source/core/text/porlay.cxx  |    7 +++++++
 sw/source/core/text/porlay.hxx  |    4 ++++
 sw/source/core/text/xmldump.cxx |    6 ++++++
 4 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 1c75df810439c71e975b166a66087c3d5a9ecdf3
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Sep 9 20:30:01 2021 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Sep 10 09:22:11 2021 +0200

    sw layout xml dump: show SwParaPortion
    
    Towards showing details of multi-portions, which are invisible to
    XmlPortionDumper, which uses SwPortionHandler, which was introduced for
    SwAccessiblePortionData, and is currently misused for debugging.
    
    Change-Id: Ib62df8c9338855b6f03b24ca2d83b4d0e4408761
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121861
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2f6f827b81a0..bb5a860cab07 100644
--- a/sw/qa/extras/layout/layout.cxx
+++ b/sw/qa/extras/layout/layout.cxx
@@ -2750,8 +2750,8 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123898)
     Scheduler::ProcessEventsToIdle();
 
     xmlDocUniquePtr pXmlDoc = parseLayoutDump();
-    // Make sure that the arrow on the left is not there (there are 43 children if it's there)
-    assertXPathChildren(pXmlDoc, "/root/page/body/txt/anchored/fly/txt", 42);
+    // Make sure that the arrow on the left is not there (there are 44 children if it's there)
+    assertXPathChildren(pXmlDoc, "/root/page/body/txt/anchored/fly/txt", 43);
 }
 
 CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTdf123651)
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 2aeced43f463..1af44ae369e3 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2505,6 +2505,13 @@ const SwDropPortion *SwParaPortion::FindDropPortion() const
     return nullptr;
 }
 
+void SwParaPortion::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwParaPortion"));
+    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 void SwLineLayout::Init( SwLinePortion* pNextPortion )
 {
     Height( 0, false );
diff --git a/sw/source/core/text/porlay.hxx b/sw/source/core/text/porlay.hxx
index 5234a537fa4c..3a3d458f2cf8 100644
--- a/sw/source/core/text/porlay.hxx
+++ b/sw/source/core/text/porlay.hxx
@@ -18,6 +18,8 @@
  */
 #pragma once
 
+#include <libxml/xmlwriter.h>
+
 #include <scriptinfo.hxx>
 
 #include <swrect.hxx>
@@ -321,6 +323,8 @@ public:
     void SetErgoSumNum( const OUString &rErgo );
 
     const SwDropPortion *FindDropPortion() const;
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 inline void SwParaPortion::ResetPreps()
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 03cf10e86b80..d188a0698373 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -28,6 +28,8 @@
 #include <view.hxx>
 #include <svx/svdobj.hxx>
 
+#include "porlay.hxx"
+
 namespace {
 
 class XmlPortionDumper:public SwPortionHandler
@@ -481,6 +483,10 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
                                       reinterpret_cast<const xmlChar *>(aText8.getStr(  )) );
             XmlPortionDumper pdumper( writer, aText );
             pTextFrame->VisitPortions( pdumper );
+            if (const SwParaPortion* pPara = pTextFrame->GetPara())
+            {
+                pPara->dumpAsXml(writer);
+            }
 
         }
         else


More information about the Libreoffice-commits mailing list