diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2021-10-07 16:48:46 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2021-11-12 14:08:08 +0100 |
commit | 723db12abd7c238e11dab0271516b6f4415e52eb (patch) | |
tree | b61726c403a558caf81691db11f5bd3a33227ba4 /sc | |
parent | 567f8d111701c288671440b6f75d67a57be43ff5 (diff) |
svx: Don't end text edit mode for all views
This allows multiple views to not disturb each other editing inside
a impress document. With the ending of text edit for all views still
enabled, one view can cancel other views text editing just by moving
or resizing a unrelated shape in the document.
To make this possible we also need a view-local undo manager for
the text edit mode, which is independent of the document undo
manager. When the text edit mode ends, all the changes will be
added as one change to the document undo stack. This prevents any
conflicts in the undo stack that could be made when 2 views are
editing the same document at the same time.
This also adds the test for the new use case and changes the existing
tests to reflect the change.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123220
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit c175c1dc19d0edc8ca66e39f0b4b8af04e3d6c87)
Change-Id: I04edb4f91d7e111a490c946f7121cbca75f818d7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125070
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/drawview.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/drawview.cxx | 9 |
2 files changed, 8 insertions, 5 deletions
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx index 46f5598705f2..aa5e1bbb8533 100644 --- a/sc/source/ui/inc/drawview.hxx +++ b/sc/source/ui/inc/drawview.hxx @@ -52,8 +52,8 @@ class ScDrawView final : public FmFormView void ImplClearCalcDropMarker(); - // support enhanced text edit for draw objects - virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const override; + // Create a local UndoManager + std::unique_ptr<SdrUndoManager> createLocalTextUndoManager() override; public: ScDrawView( diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index c7d12df62209..6959726b4efe 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -1103,10 +1103,13 @@ bool ScDrawView::calculateGridOffsetForB2DRange( return true; } -// support enhanced text edit for draw objects -SdrUndoManager* ScDrawView::getSdrUndoManagerForEnhancedTextEdit() const +// Create a new view-local UndoManager manager for Calc +std::unique_ptr<SdrUndoManager> ScDrawView::createLocalTextUndoManager() { - return pDoc ? dynamic_cast< SdrUndoManager* >(pDoc->GetUndoManager()) : nullptr; + std::unique_ptr<SdrUndoManager> pUndoManager(new SdrUndoManager); + ScDocShell* pDocShell = pViewData ? pViewData->GetDocShell() : nullptr; + pUndoManager->SetDocShell(pDocShell); + return pUndoManager; } // #i123922# helper to apply a Graphic to an existing SdrObject |