summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-08-16 20:19:54 +0200
committerMiklos Vajna <vmiklos@collabora.com>2023-08-17 08:13:00 +0200
commitb32c9df02bf4abc9d36083c51b28bad6565465c6 (patch)
treeefe59d243836cfd582e1650e32ae3723b0007250
parentee52f20ec727e5c296cc5d8f4c2a25f1414eb0fe (diff)
sw: fold SwSectionFrame::dumpAsXmlAttributes() into dumpAsXml()
One dumpAsXml() per SwFrame subclass is enough, no need to have a separate function that dumps just the attributes. Also eliminate a manual reinterpret_cast<> and a static_cast<>. Change-Id: I99c44f4b097586bdc174d3133bbb4ee9f26e57cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155747 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/source/core/inc/sectfrm.hxx1
-rw-r--r--sw/source/core/layout/sectfrm.cxx9
-rw-r--r--sw/source/core/text/xmldump.cxx10
3 files changed, 7 insertions, 13 deletions
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 80d8185bc1c0..82a41d4e3167 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -156,7 +156,6 @@ public:
bool IsBalancedSection() const;
virtual void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
- virtual 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 18fac7a397b1..41623fc77177 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2958,8 +2958,13 @@ bool SwSectionFrame::IsBalancedSection() const
void SwSectionFrame::dumpAsXml(xmlTextWriterPtr writer) const
{
- (void)xmlTextWriterStartElement(writer, reinterpret_cast<const xmlChar*>("section"));
- dumpAsXmlAttributes(writer);
+ (void)xmlTextWriterStartElement(writer, BAD_CAST("section"));
+ SwFrame::dumpAsXmlAttributes( writer );
+ if ( HasFollow() )
+ (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
+
+ if (m_pPrecede != nullptr)
+ (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%" SAL_PRIuUINT32, m_pPrecede->GetFrame().GetFrameId() );
(void)xmlTextWriterStartElement(writer, BAD_CAST("infos"));
dumpInfosAsXml(writer);
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 29cbd4c5e911..48c893bf403c 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -312,14 +312,4 @@ void SwFlyAtContentFrame::dumpAsXmlAttributes(xmlTextWriterPtr pWriter) const
}
}
-void SwSectionFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const
-{
- SwFrame::dumpAsXmlAttributes( writer );
- if ( HasFollow() )
- (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
-
- if (m_pPrecede != nullptr)
- (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "precede" ), "%" SAL_PRIuUINT32, static_cast<SwSectionFrame*>( m_pPrecede )->GetFrameId() );
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */