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 dc0558919aeaeed82f199e720082c968ef886391 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Apr 24 09:38:50 2025 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri Apr 25 09:24:48 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/+/184535 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 866fe1f4e9d2..b48c9bbd44e8 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -1243,6 +1243,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 94891df09e49..86e1af091e47 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();