summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-11-10 08:50:08 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-11-10 09:37:36 +0100
commit8e8e72f08b01a284cf1a90b888d48acfb6a33d2e (patch)
treee4e18c52d669f6233fdabdb0f4deed1a51cdd155 /sw/inc
parentcf2d88b8a44ac9e8b37954fc2cc4b52d719cc035 (diff)
sw: allow undo of typing in 2 views independent from each other
Undoing out of order is dangerous by default, so limit this to a very specific case as a start, that allows growing in follow-up commits. For now, allow out of order undo if: 1) redo stack is empty 2) we're in LOK mode (different views represent different users) 3) we undo a single action (count is 1) 4) the top undo action doesn't belong to the current view 5) the top and the previous undo actions are independent Which only requires that SwUndoInsert::UndoImpl() is independent for two different paragraphs, which seems to be the case. Independent undo actions opt in for this, currently the only such allowed undo action is SwUndoInsert ("typing"), which adds characters to a single text node. Even those are only considered independent if they operate on different text nodes. On the positive side, this allows out of order undo in the frequent case where two users collaborate on a long document and they just type some new content into the document at different paragraphs. Change-Id: Ibb4551e8f7046b4947491b8bf751eaa0cbb2d060 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124949 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/IDocumentUndoRedo.hxx3
-rw-r--r--sw/inc/editsh.hxx2
2 files changed, 4 insertions, 1 deletions
diff --git a/sw/inc/IDocumentUndoRedo.hxx b/sw/inc/IDocumentUndoRedo.hxx
index b533a7e647c2..dae73a333360 100644
--- a/sw/inc/IDocumentUndoRedo.hxx
+++ b/sw/inc/IDocumentUndoRedo.hxx
@@ -212,6 +212,9 @@ public:
*/
virtual void SetView(SwView* pView) = 0;
+ /// Zero offset means undoing the top undo action.
+ virtual bool UndoWithOffset(size_t nUndoOffset) = 0;
+
protected:
virtual ~IDocumentUndoRedo() {};
};
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index f3f645580135..076cbbf5b3bb 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -602,7 +602,7 @@ public:
/// should only be called by sw::UndoManager!
void HandleUndoRedoContext(::sw::UndoRedoContext & rContext);
- void Undo(sal_uInt16 const nCount = 1);
+ void Undo(sal_uInt16 const nCount = 1, sal_uInt16 nOffset = 0);
void Redo(sal_uInt16 const nCount = 1);
void Repeat(sal_uInt16 const nCount);