sw/source/core/doc/notxtfrm.cxx |   13 ++++++++++++
 sw/source/core/inc/frame.hxx    |    2 -
 sw/source/core/inc/notxtfrm.hxx |    2 +
 sw/source/core/text/xmldump.cxx |   41 ----------------------------------------
 4 files changed, 16 insertions(+), 42 deletions(-)

New commits:
commit 46d7119b8be03968017e59d882e5671350304e15
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Jul 13 20:04:59 2023 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Jul 14 08:13:46 2023 +0200

    sw layout xml dump: extract SwNoTextFrame::dumpAsXml() from SwFrame
    
    Which means finally SwFrame::dumpAsXml() can be pure-virtual as all
    subclasses overwrite it.
    
    Change-Id: I5a8c5437bb64f6745653038105891e4fb6b54399
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154397
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index ccf60904585d..14cb5680309b 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -648,6 +648,19 @@ double SwNoTextFrame::getLocalFrameRotation() const
     return 0.0;
 }
 
+void SwNoTextFrame::dumpAsXml(xmlTextWriterPtr writer) const
+{
+    (void)xmlTextWriterStartElement(writer, reinterpret_cast<const 
xmlChar*>("notxt"));
+    dumpAsXmlAttributes(writer);
+
+    (void)xmlTextWriterStartElement(writer, BAD_CAST("infos"));
+    dumpInfosAsXml(writer);
+    (void)xmlTextWriterEndElement(writer);
+    dumpChildrenAsXml(writer);
+
+    (void)xmlTextWriterEndElement(writer);
+}
+
 /** Calculate the Bitmap's site, if needed */
 void SwNoTextFrame::Format( vcl::RenderContext* /*pRenderContext*/, const 
SwBorderAttrs * )
 {
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index ec47266ec468..d405da36515b 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -938,7 +938,7 @@ public:
 
 public:
     // if writer is NULL, dumps the layout structure as XML in layout.xml
-    virtual void dumpAsXml(xmlTextWriterPtr writer = nullptr) const;
+    virtual void dumpAsXml(xmlTextWriterPtr writer = nullptr) const = 0;
     void dumpTopMostAsXml(xmlTextWriterPtr writer = nullptr) const;
     void dumpInfosAsXml(xmlTextWriterPtr writer) const;
     virtual void dumpAsXmlAttributes(xmlTextWriterPtr writer) const;
diff --git a/sw/source/core/inc/notxtfrm.hxx b/sw/source/core/inc/notxtfrm.hxx
index a3870c86150c..50612e396ab5 100644
--- a/sw/source/core/inc/notxtfrm.hxx
+++ b/sw/source/core/inc/notxtfrm.hxx
@@ -107,6 +107,8 @@ public:
 
     // RotateFlyFrame3 - Support for Transformations
     virtual void transform_translate(const Point& rOffset) override;
+
+    void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
 };
 
 #endif
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 2ed4113cddba..83111d397d38 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -168,47 +168,6 @@ void SwFrame::dumpTopMostAsXml(xmlTextWriterPtr writer) 
const
     pFrame->dumpAsXml(writer);
 }
 
-void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
-{
-    const char *name = nullptr;
-
-    switch ( GetType(  ) )
-    {
-    case SwFrameType::NoTxt:
-        name = "notxt";
-        break;
-    default: break;
-    }
-
-    if ( name != nullptr )
-    {
-        (void)xmlTextWriterStartElement( writer, reinterpret_cast<const 
xmlChar *>(name) );
-
-        dumpAsXmlAttributes( writer );
-
-        (void)xmlTextWriterStartElement( writer, BAD_CAST( "infos" ) );
-        dumpInfosAsXml( writer );
-        (void)xmlTextWriterEndElement( writer );
-
-        // Dump Anchored objects if any
-        const SwSortedObjs* pAnchored = GetDrawObjs();
-        if ( pAnchored && pAnchored->size() > 0 )
-        {
-            (void)xmlTextWriterStartElement( writer, BAD_CAST( "anchored" ) );
-
-            for (SwAnchoredObject* pObject : *pAnchored)
-            {
-                pObject->dumpAsXml( writer );
-            }
-
-            (void)xmlTextWriterEndElement( writer );
-        }
-
-        dumpChildrenAsXml( writer );
-        (void)xmlTextWriterEndElement( writer );
-    }
-}
-
 void SwFrame::dumpInfosAsXml( xmlTextWriterPtr writer ) const
 {
     // output the Frame

Reply via email to