diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-11-10 08:50:08 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-11-10 09:37:36 +0100 |
commit | 8e8e72f08b01a284cf1a90b888d48acfb6a33d2e (patch) | |
tree | e4e18c52d669f6233fdabdb0f4deed1a51cdd155 /include/svl | |
parent | cf2d88b8a44ac9e8b37954fc2cc4b52d719cc035 (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 'include/svl')
-rw-r--r-- | include/svl/undo.hxx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx index 2757967aaee4..e0d064b27987 100644 --- a/include/svl/undo.hxx +++ b/include/svl/undo.hxx @@ -42,6 +42,12 @@ public: class SVL_DLLPUBLIC SfxUndoContext { public: + /** + * Don't undo the top undo action, but an earlier one. It's the caller's responsibility to + * ensure that the earlier undo action is independent from the following ones. + */ + virtual size_t GetUndoOffset() { return 0; } + virtual ~SfxUndoContext() = 0; }; |