sw/source/core/inc/sectfrm.hxx | 1 + sw/source/core/layout/sectfrm.cxx | 10 +++++++++- sw/source/core/text/xmldump.cxx | 6 ------ 3 files changed, 10 insertions(+), 7 deletions(-)
New commits: commit 40309da824a6d370aaeae4169c44f237387ec427 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Nov 23 20:03:48 2023 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Nov 24 08:27:23 2023 +0100 sw: extract SwSectionFrame::dumpAsXmlAttributes() from SwFrame Allows getting rid of a static cast. Change-Id: Iaba2a328399dacad3e16efa15df4f23abec6f883 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159869 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx index 82a41d4e3167..c07d78b12ba9 100644 --- a/sw/source/core/inc/sectfrm.hxx +++ b/sw/source/core/inc/sectfrm.hxx @@ -156,6 +156,7 @@ public: bool IsBalancedSection() const; virtual void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override; + void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override; bool IsFootnoteAtEnd() const { return m_bFootnoteAtEnd; } bool IsEndnAtEnd() const { return m_bEndnAtEnd; } diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index fdbcb5a57092..a1fd849ec495 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -2962,7 +2962,7 @@ bool SwSectionFrame::IsBalancedSection() const void SwSectionFrame::dumpAsXml(xmlTextWriterPtr writer) const { (void)xmlTextWriterStartElement(writer, BAD_CAST("section")); - SwFrame::dumpAsXmlAttributes( writer ); + dumpAsXmlAttributes( writer ); if ( HasFollow() ) (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() ); @@ -2977,4 +2977,12 @@ void SwSectionFrame::dumpAsXml(xmlTextWriterPtr writer) const (void)xmlTextWriterEndElement(writer); } +void SwSectionFrame::dumpAsXmlAttributes(xmlTextWriterPtr writer) const +{ + SwLayoutFrame::dumpAsXmlAttributes(writer); + + SwSectionNode const*const pNode(GetSection() ? GetSection()->GetFormat()->GetSectionNode() : nullptr); + (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("sectionNodeIndex"), "%" SAL_PRIdINT32, pNode ? sal_Int32(pNode->GetIndex()) : -1); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index b5cde782775f..245a1aa96945 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -207,12 +207,6 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const if (pFF->GetFollow()) (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST("follow"), "%" SAL_PRIuUINT32, pFF->GetFollow()->GetFrameId() ); } - if (IsSctFrame()) - { - SwSectionFrame const*const pFrame(static_cast<SwSectionFrame const*>(this)); - SwSectionNode const*const pNode(pFrame->GetSection() ? pFrame->GetSection()->GetFormat()->GetSectionNode() : nullptr); - (void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("sectionNodeIndex"), "%" SAL_PRIdINT32, pNode ? sal_Int32(pNode->GetIndex()) : -1); - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */