sw/source/core/inc/layfrm.hxx   |    1 +
 sw/source/core/layout/wsfrm.cxx |   12 ++++++++++++
 sw/source/core/text/xmldump.cxx |    7 -------
 3 files changed, 13 insertions(+), 7 deletions(-)

New commits:
commit 052c917d97aa88f21008cc3d978c6ca2ad83c88e
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Nov 9 19:59:45 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Nov 10 08:06:47 2023 +0100

    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 <vmik...@collabora.com>

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: */

Reply via email to