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@collabora.com>
Tested-by: Jenkins
diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx
index 2f6f827..bb5a860 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 2aeced4..1af44ae 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 5234a53..3a3d458 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 03cf10e..d188a06 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