sw/source/core/text/porfld.cxx |   12 ++++++++++++
 sw/source/core/text/porfld.hxx |    2 ++
 2 files changed, 14 insertions(+)

New commits:
commit 68c15984ea17354c03e5ddf03e0c0b4214999659
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Dec 6 20:10:22 2021 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Dec 7 08:20:48 2021 +0100

    sw layout xml dump: handle SwFieldPortions
    
    This is the case where the field has a single placeholder character, but
    it typically expands to more characters at a view level.
    
    Change-Id: I5f11b29772697dbca3475aa53cf9301b67e64452
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126459
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index c366401c9153..12805b33b039 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -464,6 +464,18 @@ void SwFieldPortion::HandlePortion( SwPortionHandler& rPH 
) const
     rPH.Special( GetLen(), m_aExpand, GetWhichPor(), nH, nW, m_pFont.get() );
 }
 
+void SwFieldPortion::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFieldPortion"));
+    SwExpandPortion::dumpAsXml(pWriter);
+
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("expand"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), 
BAD_CAST(m_aExpand.toUtf8().getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
+
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 SwPosSize SwFieldPortion::GetTextSize( const SwTextSizeInfo &rInf ) const
 {
     SwFontSave aSave( rInf, m_pFont.get() );
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 519e56f8f58c..ec2ee7a61c51 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -107,6 +107,8 @@ public:
 
     // Accessibility: pass information about this portion to the PortionHandler
     virtual void HandlePortion( SwPortionHandler& rPH ) const override;
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 /**

Reply via email to