sw/source/core/doc/docredln.cxx | 20 ++++++++++++++++++++ sw/source/core/inc/UndoCore.hxx | 1 + sw/source/core/inc/UndoRedline.hxx | 2 ++ sw/source/core/undo/unredln.cxx | 21 +++++++++++++++++++++ 4 files changed, 44 insertions(+)
New commits: commit 53773d52ed1d3ff2ee9dddb0e9c4e8c64d334720 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Apr 24 09:38:50 2025 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Apr 25 11:58:16 2025 +0200 sw doc model xml dump: show SwUndoRedline and SwRedlineSaveDatas I have a redline problem where the undo of reject doesn't restore all SwRedlineData of a SwRangeRedline; dumping these help deciding if the undo action is already created with the wrong info or just its execution is buggy. Change-Id: I19068e036e3eb421a6b4118d31095138eced5122 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184613 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index f777d7ac92fb..1fc309a23f95 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1238,6 +1238,26 @@ bool SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) c return true; } +void SwRedlineSaveDatas::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwRedlineSaveDatas")); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + + for (const auto& rRedlineData : m_Data) + { + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("data")); + const SwRedlineData* pData = rRedlineData.get(); + while (pData) + { + pData->dumpAsXml(pWriter); + pData = pData->Next(); + } + (void)xmlTextWriterEndElement(pWriter); + } + + (void)xmlTextWriterEndElement(pWriter); +} + SwRedlineData::SwRedlineData( RedlineType eT, std::size_t nAut, sal_uInt32 nMovedID ) : m_pNext( nullptr ), m_pExtraData( nullptr ), m_aStamp( DateTime::SYSTEM ), diff --git a/sw/source/core/inc/UndoCore.hxx b/sw/source/core/inc/UndoCore.hxx index 14756a51a4fe..7dea42692efc 100644 --- a/sw/source/core/inc/UndoCore.hxx +++ b/sw/source/core/inc/UndoCore.hxx @@ -82,6 +82,7 @@ public: #if OSL_DEBUG_LEVEL > 0 void SetRedlineCountDontCheck(bool bCheck) { m_Data[0]->m_bRedlineCountDontCheck=bCheck; } #endif + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; namespace sw { diff --git a/sw/source/core/inc/UndoRedline.hxx b/sw/source/core/inc/UndoRedline.hxx index 127aeae0aa29..955841b47d92 100644 --- a/sw/source/core/inc/UndoRedline.hxx +++ b/sw/source/core/inc/UndoRedline.hxx @@ -53,6 +53,7 @@ public: #if OSL_DEBUG_LEVEL > 0 void SetRedlineCountDontCheck(bool bCheck); #endif + void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; class SwUndoRedlineDelete final : public SwUndoRedline @@ -115,6 +116,7 @@ public: virtual void RepeatImpl( ::sw::RepeatContext & ) override; }; +/// Undo for Edit -> Track Changes -> Reject. class SwUndoRejectRedline final : public SwUndoRedline { private: diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index f77ceb3d26d8..8be50337fe8b 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -97,6 +97,27 @@ void SwUndoRedline::SetRedlineCountDontCheck(bool bCheck) } #endif +void SwUndoRedline::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwUndoRedline")); + (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"), BAD_CAST(typeid(*this).name())); + + const SwRedlineData* pRedlData = mpRedlData.get(); + while (pRedlData) + { + pRedlData->dumpAsXml(pWriter); + pRedlData = pRedlData->Next(); + } + + if (mpRedlSaveData) + { + mpRedlSaveData->dumpAsXml(pWriter); + } + + (void)xmlTextWriterEndElement(pWriter); +} + void SwUndoRedline::UndoImpl(::sw::UndoRedoContext & rContext) { SwDoc& rDoc = rContext.GetDoc();