summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-11-16 19:57:10 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-11-17 08:30:25 +0100
commit3526faf09bd86a4f18fe606a3818e816c41d8c85 (patch)
tree58025e92cc398db0cb378f5da9fa12002b94077b /sw/source/core
parentbe1093cce53a3c34a67233391922674c7c62f4e3 (diff)
sw: extract SwTextFrame::dumpAsXmlAttributes() from SwFrame
Allows getting rid of a static cast. Change-Id: Ic74bb3e33f591387cc5939c0ffbc8793630978bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159517 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/inc/txtfrm.hxx1
-rw-r--r--sw/source/core/text/txtfrm.cxx25
-rw-r--r--sw/source/core/text/xmldump.cxx21
3 files changed, 25 insertions, 22 deletions
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index d73c2efa499f..aa2246727fc2 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -809,6 +809,7 @@ public:
static SwView* GetView();
void dumpAsXml(xmlTextWriterPtr writer = nullptr) const override;
+ void dumpAsXmlAttributes(xmlTextWriterPtr writer) const override;
};
//use this to protect a SwTextFrame for a given scope from getting merged with
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 470ce8b528fd..f043530de702 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -793,10 +793,33 @@ SwTextFrame::SwTextFrame(SwTextNode * const pNode, SwFrame* pSib,
m_pMergedPara = CheckParaRedlineMerge(*this, *pNode, eMode);
}
+void SwTextFrame::dumpAsXmlAttributes(xmlTextWriterPtr writer) const
+{
+ SwContentFrame::dumpAsXmlAttributes(writer);
+
+ const SwTextNode *pTextNode = GetTextNodeFirst();
+ (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), "%" SAL_PRIdINT32, sal_Int32(pTextNode->GetIndex()) );
+
+ OString aMode = "Horizontal";
+ if (IsVertLRBT())
+ {
+ aMode = "VertBTLR";
+ }
+ else if (IsVertLR())
+ {
+ aMode = "VertLR";
+ }
+ else if (IsVertical())
+ {
+ aMode = "Vertical";
+ }
+ (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), BAD_CAST(aMode.getStr()));
+}
+
void SwTextFrame::dumpAsXml(xmlTextWriterPtr writer) const
{
(void)xmlTextWriterStartElement(writer, reinterpret_cast<const xmlChar*>("txt"));
- SwFrame::dumpAsXmlAttributes( writer );
+ dumpAsXmlAttributes( writer );
if ( HasFollow() )
(void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "follow" ), "%" SAL_PRIuUINT32, GetFollow()->GetFrameId() );
diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx
index 445a0e306336..b5cde782775f 100644
--- a/sw/source/core/text/xmldump.cxx
+++ b/sw/source/core/text/xmldump.cxx
@@ -213,27 +213,6 @@ void SwFrame::dumpAsXmlAttributes( xmlTextWriterPtr writer ) const
SwSectionNode const*const pNode(pFrame->GetSection() ? pFrame->GetSection()->GetFormat()->GetSectionNode() : nullptr);
(void)xmlTextWriterWriteFormatAttribute(writer, BAD_CAST("sectionNodeIndex"), "%" SAL_PRIdINT32, pNode ? sal_Int32(pNode->GetIndex()) : -1);
}
- if ( IsTextFrame( ) )
- {
- const SwTextFrame *pTextFrame = static_cast<const SwTextFrame *>(this);
- const SwTextNode *pTextNode = pTextFrame->GetTextNodeFirst();
- (void)xmlTextWriterWriteFormatAttribute( writer, BAD_CAST( "txtNodeIndex" ), "%" SAL_PRIdINT32, sal_Int32(pTextNode->GetIndex()) );
-
- OString aMode = "Horizontal";
- if (IsVertLRBT())
- {
- aMode = "VertBTLR";
- }
- else if (IsVertLR())
- {
- aMode = "VertLR";
- }
- else if (IsVertical())
- {
- aMode = "Vertical";
- }
- (void)xmlTextWriterWriteAttribute(writer, BAD_CAST("WritingMode"), BAD_CAST(aMode.getStr()));
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */