sw/inc/fmtrfmrk.hxx | 1 + sw/inc/txtrfmrk.hxx | 1 + sw/source/core/txtnode/atrref.cxx | 24 ++++++++++++++++++++++++ sw/source/core/txtnode/txatbase.cxx | 3 +++ 4 files changed, 29 insertions(+)
New commits: commit 72fc34cdf8e2a3d4fa3a2de9a8a96f33aa19dbc4 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Jan 5 20:02:34 2023 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Jan 6 07:08:08 2023 +0000 sw doc model xml dump: show name of refmarks Unlike bookmarks, these are not tracked in the mark manager. Change-Id: I17b10dac6b74a738fd47cf25b84a7156031f01da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145103 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/inc/fmtrfmrk.hxx b/sw/inc/fmtrfmrk.hxx index 0d41e9070e14..8f708cf583ea 100644 --- a/sw/inc/fmtrfmrk.hxx +++ b/sw/inc/fmtrfmrk.hxx @@ -66,6 +66,7 @@ public: unotools::WeakReference<SwXReferenceMark> const& GetXRefMark() const { return m_wXReferenceMark; } void SetXRefMark(rtl::Reference<SwXReferenceMark> const& xMark); + void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; #endif diff --git a/sw/inc/txtrfmrk.hxx b/sw/inc/txtrfmrk.hxx index 0d25090197c1..4f55b4f28d38 100644 --- a/sw/inc/txtrfmrk.hxx +++ b/sw/inc/txtrfmrk.hxx @@ -39,6 +39,7 @@ public: // get and set TextNode pointer inline const SwTextNode& GetTextNode() const; void ChgTextNode( SwTextNode* pNew ) { m_pTextNode = pNew; } + void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; inline const SwTextNode& SwTextRefMark::GetTextNode() const diff --git a/sw/source/core/txtnode/atrref.cxx b/sw/source/core/txtnode/atrref.cxx index 51f913c49236..b7403518e930 100644 --- a/sw/source/core/txtnode/atrref.cxx +++ b/sw/source/core/txtnode/atrref.cxx @@ -19,6 +19,8 @@ #include <fmtrfmrk.hxx> +#include <libxml/xmlwriter.h> + #include <hintids.hxx> #include <hints.hxx> #include <txtrfmrk.hxx> @@ -76,6 +78,19 @@ void SwFormatRefMark::InvalidateRefMark() CallSwClientNotify(sw::LegacyModifyHint(&item, &item)); } +void SwFormatRefMark::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatRefMark")); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_pTextAttr"), "%p", m_pTextAttr); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("ref-name"), + BAD_CAST(m_aRefName.toUtf8().getStr())); + SfxPoolItem::dumpAsXml(pWriter); + + + (void)xmlTextWriterEndElement(pWriter); +} + // attribute for content references in the text SwTextRefMark::SwTextRefMark( SwFormatRefMark& rAttr, @@ -111,4 +126,13 @@ void SwTextRefMark::SetEnd(sal_Int32 n) m_pHints->EndPosChanged(); } +void SwTextRefMark::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTextRefMark")); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + SwTextAttr::dumpAsXml(pWriter); + + (void)xmlTextWriterEndElement(pWriter); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx index 1b65cf793448..3a92c471ec72 100644 --- a/sw/source/core/txtnode/txatbase.cxx +++ b/sw/source/core/txtnode/txatbase.cxx @@ -169,6 +169,9 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const case RES_TXTATR_CHARFMT: GetCharFormat().dumpAsXml(pWriter); break; + case RES_TXTATR_REFMARK: + GetRefMark().dumpAsXml(pWriter); + break; default: SAL_WARN("sw.core", "Unhandled TXTATR"); break;