From 15b126534b2dc8490d9ddda9baae76f2e87380f0 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 1 Jun 2023 20:06:37 +0200 Subject: sw layout xml dump: extract SwCellFrame::dumpAsXml() from SwFrame Ideally SwFrame should not really know anything about cell frames. Change-Id: I01c7af5a4ded579a38e78ca9c8218871e0a1d325 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152509 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- sw/source/core/inc/cellfrm.hxx | 2 ++ sw/source/core/layout/tabfrm.cxx | 14 ++++++++++++++ sw/source/core/text/xmldump.cxx | 9 --------- 3 files changed, 16 insertions(+), 9 deletions(-) (limited to 'sw/source') diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx index 4fdbc707de6e..796cb1d3dfb3 100644 --- a/sw/source/core/inc/cellfrm.hxx +++ b/sw/source/core/inc/cellfrm.hxx @@ -69,6 +69,8 @@ public: std::vector GetCoveredCells() const; void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override; + + void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override; }; #endif diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index c3ebfacb13f8..e35d5f693454 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -5900,6 +5900,20 @@ void SwCellFrame::dumpAsXmlAttributes(xmlTextWriterPtr pWriter) const (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("precede"), "%" SAL_PRIuUINT32, pPrevious->GetFrameId()); } +void SwCellFrame::dumpAsXml(xmlTextWriterPtr writer) const +{ + (void)xmlTextWriterStartElement(writer, reinterpret_cast("cell")); + dumpAsXmlAttributes(writer); + (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "rowspan" ), "%ld", GetLayoutRowSpan() ); + + (void)xmlTextWriterStartElement(writer, BAD_CAST("infos")); + dumpInfosAsXml(writer); + (void)xmlTextWriterEndElement(writer); + dumpChildrenAsXml(writer); + + (void)xmlTextWriterEndElement(writer); +} + // #i103961# void SwCellFrame::Cut() { diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 4e1016522884..5c85d5c601fb 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -174,9 +174,6 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const switch ( GetType( ) ) { - case SwFrameType::Cell: - name = "cell"; - break; case SwFrameType::Txt: name = "txt"; break; @@ -212,12 +209,6 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const } } - if (IsCellFrame()) - { - SwCellFrame const* pCellFrame(static_cast(this)); - (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "rowspan" ), "%ld", pCellFrame->GetLayoutRowSpan() ); - } - (void)xmlTextWriterStartElement( writer, BAD_CAST( "infos" ) ); dumpInfosAsXml( writer ); (void)xmlTextWriterEndElement( writer ); -- cgit