diff options
author | Szymon Kłos <szymon.klos@collabora.com> | 2023-06-22 16:46:22 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-06-24 11:54:35 +0200 |
commit | ad5539626401e097a7026d896339764e805789a4 (patch) | |
tree | 3dfbe9c01a39247a287bca8d54aecb6ae8c09e3c | |
parent | sc: prefix m_* ScViewFunctionSet class members (diff) | |
download | core-ad5539626401e097a7026d896339764e805789a4.tar.gz core-ad5539626401e097a7026d896339764e805789a4.zip |
lok: use correct shell when doing undo
When doing undo we save EditShell reference in the context object.
Later it is used to get cursor we want to move to the place
where modification was done (in sw/source/core/undo/unins.cxx:281).
In LOK case when 2 different sessions were used and undo was done
by user A - then user's B cursor was moved. This fixes that issue.
We use current shell instead of getting it indirectly through
SwDoc::GetEditShell()
Change-Id: I7a10ea98587f48818e8d0aaa9ad739d4eed514f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153461
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153492
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index ccff1b663cf3..1933741ea971 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -29,6 +29,7 @@ #include <pam.hxx> #include <swundo.hxx> #include <UndoCore.hxx> +#include <wrtsh.hxx> #include <editsh.hxx> #include <unobaseclass.hxx> #include <IDocumentDrawModelAccess.hxx> @@ -665,8 +666,10 @@ bool UndoManager::impl_DoUndoRedo(UndoOrRedoType undoOrRedo, size_t nUndoOffset) UnoActionContext c(& rDoc); // exception-safe StartAllAction/EndAllAction - SwEditShell *const pEditShell( rDoc.GetEditShell() ); - + SwView* pViewShell = dynamic_cast<SwView*>(SfxViewShell::Current()); + SwEditShell *const pEditShell( + comphelper::LibreOfficeKit::isActive() && pViewShell ? pViewShell->GetWrtShellPtr() + : rDoc.GetEditShell()); OSL_ENSURE(pEditShell, "sw::UndoManager needs a SwEditShell!"); if (!pEditShell) { |