diff options
Diffstat (limited to 'sw/source/core/undo/docundo.cxx')
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index f59f3dd50d8e..46a66933e709 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -39,6 +39,7 @@ #include <IDocumentDrawModelAccess.hxx> #include <IDocumentRedlineAccess.hxx> #include <IDocumentState.hxx> +#include <comphelper/lok.hxx> using namespace ::com::sun::star; @@ -296,7 +297,7 @@ UndoManager::EndUndo(SwUndoId const i_eUndoId, SwRewriter const*const pRewriter) bool UndoManager::GetLastUndoInfo( - OUString *const o_pStr, SwUndoId *const o_pId) const + OUString *const o_pStr, SwUndoId *const o_pId, const SwView* pView) const { // this is actually expected to work on the current level, // but that was really not obvious from the previous implementation... @@ -307,6 +308,14 @@ UndoManager::GetLastUndoInfo( SfxUndoAction *const pAction( SdrUndoManager::GetUndoAction() ); + if (comphelper::LibreOfficeKit::isActive()) + { + // If an other view created the undo action, prevent undoing it from this view. + sal_Int32 nViewShellId = pView ? pView->GetViewShellId() : m_pDocShell->GetView()->GetViewShellId(); + if (pAction->GetViewShellId() != nViewShellId) + return false; + } + if (o_pStr) { *o_pStr = pAction->GetComment(); @@ -338,7 +347,8 @@ SwUndoComments_t UndoManager::GetUndoComments() const } bool UndoManager::GetFirstRedoInfo(OUString *const o_pStr, - SwUndoId *const o_pId) const + SwUndoId *const o_pId, + const SwView* pView) const { if (!SdrUndoManager::GetRedoActionCount()) { @@ -351,6 +361,14 @@ bool UndoManager::GetFirstRedoInfo(OUString *const o_pStr, return false; } + if (comphelper::LibreOfficeKit::isActive()) + { + // If an other view created the undo action, prevent redoing it from this view. + sal_Int32 nViewShellId = pView ? pView->GetViewShellId() : m_pDocShell->GetView()->GetViewShellId(); + if (pAction->GetViewShellId() != nViewShellId) + return false; + } + if (o_pStr) { *o_pStr = pAction->GetComment(); |