summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-06-01 20:06:37 +0200
committerMiklos Vajna <vmiklos@collabora.com>2023-06-02 08:03:16 +0200
commit15b126534b2dc8490d9ddda9baae76f2e87380f0 (patch)
tree45126a9e6fbf0eb9bf52133a1b16c2084e45ea6f /sw/source
parent7acc7660a752497a546263d28e82a2e8f61fd702 (diff)
sw layout xml dump: extract SwCellFrame::dumpAsXml() from SwFrame
Ideally SwFrame should not really know anything about cell frames. Change-Id: I01c7af5a4ded579a38e78ca9c8218871e0a1d325 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152509 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/inc/cellfrm.hxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx14
-rw-r--r--sw/source/core/text/xmldump.cxx9
3 files changed, 16 insertions, 9 deletions
diff --git a/sw/source/core/inc/cellfrm.hxx b/sw/source/core/inc/cellfrm.hxx
index 4fdbc707de6e..796cb1d3dfb3 100644
--- a/sw/source/core/inc/cellfrm.hxx
+++ b/sw/source/core/inc/cellfrm.hxx
@@ -69,6 +69,8 @@ public:
std::vector<const SwCellFrame*> GetCoveredCells() const;
void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
+
+ void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
};
#endif
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index c3ebfacb13f8..e35d5f693454 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -5900,6 +5900,20 @@ void SwCellFrame::dumpAsXmlAttributes(xmlTextWriterPtr pWriter) const
(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("precede"), "%" SAL_PRIuUINT32, pPrevious->GetFrameId());
}
+void SwCellFrame::dumpAsXml(xmlTextWriterPtr writer) const
+{
+ (void)xmlTextWriterStartElement(writer, reinterpret_cast<const xmlChar*>("cell"));
+ dumpAsXmlAttributes(writer);
+ (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "rowspan" ), "%ld", GetLayoutRowSpan() );
+
+ (void)xmlTextWriterStartElement(writer, BAD_CAST("infos"));
+ dumpInfosAsXml(writer);
+ (void)xmlTextWriterEndElement(writer);
+ dumpChildrenAsXml(writer);
+
+ (void)xmlTextWriterEndElement(writer);
+}
+
// #i103961#
void SwCellFrame::Cut()
{
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 4e1016522884..5c85d5c601fb 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -174,9 +174,6 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
switch ( GetType( ) )
{
- case SwFrameType::Cell:
- name = "cell";
- break;
case SwFrameType::Txt:
name = "txt";
break;
@@ -212,12 +209,6 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const
}
}
- if (IsCellFrame())
- {
- SwCellFrame const* pCellFrame(static_cast<SwCellFrame const*>(this));
- (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "rowspan" ), "%ld", pCellFrame->GetLayoutRowSpan() );
- }
-
(void)xmlTextWriterStartElement( writer, BAD_CAST( "infos" ) );
dumpInfosAsXml( writer );
(void)xmlTextWriterEndElement( writer );