diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-11-09 19:59:45 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-11-10 08:06:47 +0100 |
commit | 052c917d97aa88f21008cc3d978c6ca2ad83c88e (patch) | |
tree | 1ac3aec6ee2bf33bd15d710bf5eca1278dbaa5f1 /sw | |
parent | 3aca2d9776a871f15009a1aa70628ba3a03ee147 (diff) |
sw layout xml dump: avoid a static_cast in SwFrame::dumpAsXmlAttributes()
Move the code to SwLayoutFrame from SwFrame, then no cast is needed.
Change-Id: Ieb402efb19710adf94bce022fca484178fce719f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159227
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/inc/layfrm.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/layout/wsfrm.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/text/xmldump.cxx | 7 |
3 files changed, 13 insertions, 7 deletions
diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index b0f981477499..52e22829d4ad 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -183,6 +183,7 @@ public: m_VertPosOrientFramesFor.end(), pObj), m_VertPosOrientFramesFor.end()); } + void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override; }; /** diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 7fdd19ace322..1cd01d53c680 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -4139,6 +4139,18 @@ void SwLayoutFrame::FormatWidthCols( const SwBorderAttrs &rAttrs, } } +void SwLayoutFrame::dumpAsXmlAttributes(xmlTextWriterPtr writer) const +{ + SwFrame::dumpAsXmlAttributes(writer); + + const SwFrameFormat* pFormat = GetFormat(); + if (pFormat) + { + (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "format" ), "%p", pFormat); + (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "formatName" ), "%s", BAD_CAST(pFormat->GetName().toUtf8().getStr())); + } +} + static SwContentFrame* lcl_InvalidateSection( SwFrame *pCnt, SwInvalidateFlags nInv ) { SwSectionFrame* pSect = pCnt->FindSctFrame(); diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 019866a9acbd..445a0e306336 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -234,13 +234,6 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const } (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), BAD_CAST(aMode.getStr())); } - if (IsHeaderFrame() || IsFooterFrame()) - { - const SwHeadFootFrame *pHeadFootFrame = static_cast<const SwHeadFootFrame*>(this); - OUString aFormatName = pHeadFootFrame->GetFormat()->GetName(); - (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "fmtName" ), "%s", BAD_CAST(OUStringToOString(aFormatName, RTL_TEXTENCODING_UTF8).getStr())); - (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "fmtPtr" ), "%p", pHeadFootFrame->GetFormat()); - } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |