[Libreoffice-commits] core.git: sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 22 09:37:23 UTC 2021


 sw/source/core/inc/UndoTable.hxx |    1 
 sw/source/core/undo/untbl.cxx    |   57 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

New commits:
commit 982f8408286bc0519c2d9d73fb4e59142e03f00a
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Mar 22 09:12:36 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Mar 22 10:36:17 2021 +0100

    Related: tdf#133933 sw: show SwUndoTableCpyTable in doc model xml dump
    
    Hard to track undo/redo of paste (which is delete+insert) on top of
    redlines otherwise.
    
    Change-Id: I8d33b56559facc4a8ef6b18134c5948ac83b2dcd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112862
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 472f9fdd65d5..81b4780b9792 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -289,6 +289,7 @@ public:
 
     bool IsEmpty() const;
     bool InsertRow( SwTable& rTable, const SwSelBoxes& rBoxes, sal_uInt16 nCnt );
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 class SwUndoCpyTable : public SwUndo
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index fdc8b25b0631..a744e8316c89 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <libxml/xmlwriter.h>
+
 #include <UndoTable.hxx>
 #include <UndoRedline.hxx>
 #include <UndoDelete.hxx>
@@ -88,6 +90,8 @@ struct UndoTableCpyTable_Entry
     bool bJoin; // For redlining only
 
     explicit UndoTableCpyTable_Entry( const SwTableBox& rBox );
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 namespace {
@@ -2295,6 +2299,42 @@ UndoTableCpyTable_Entry::UndoTableCpyTable_Entry( const SwTableBox& rBox )
 {
 }
 
+void UndoTableCpyTable_Entry::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("UndoTableCpyTable_Entry"));
+
+    xmlTextWriterStartElement(pWriter, BAD_CAST("nBoxIdx"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+                                BAD_CAST(OString::number(nBoxIdx).getStr()));
+    xmlTextWriterEndElement(pWriter);
+
+    xmlTextWriterStartElement(pWriter, BAD_CAST("nOffset"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+                                BAD_CAST(OString::number(nOffset).getStr()));
+    xmlTextWriterEndElement(pWriter);
+
+    if (pBoxNumAttr)
+    {
+        xmlTextWriterStartElement(pWriter, BAD_CAST("pBoxNumAttr"));
+        pBoxNumAttr->dumpAsXml(pWriter);
+        xmlTextWriterEndElement(pWriter);
+    }
+
+    if (pUndo)
+    {
+        xmlTextWriterStartElement(pWriter, BAD_CAST("pUndo"));
+        pUndo->dumpAsXml(pWriter);
+        xmlTextWriterEndElement(pWriter);
+    }
+
+    xmlTextWriterStartElement(pWriter, BAD_CAST("bJoin"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+                                BAD_CAST(OString::boolean(bJoin).getStr()));
+    xmlTextWriterEndElement(pWriter);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 SwUndoTableCpyTable::SwUndoTableCpyTable(const SwDoc& rDoc)
     : SwUndo( SwUndoId::TBLCPYTBL, &rDoc )
 {
@@ -2702,6 +2742,23 @@ bool SwUndoTableCpyTable::InsertRow( SwTable& rTable, const SwSelBoxes& rBoxes,
     return bRet;
 }
 
+void SwUndoTableCpyTable::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SwUndoTableCpyTable"));
+
+    for (const auto& pEntry : m_vArr)
+    {
+        pEntry->dumpAsXml(pWriter);
+    }
+
+    if (m_pInsRowUndo)
+    {
+        m_pInsRowUndo->dumpAsXml(pWriter);
+    }
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 bool SwUndoTableCpyTable::IsEmpty() const
 {
     return !m_pInsRowUndo && m_vArr.empty();


More information about the Libreoffice-commits mailing list