summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-08-01 17:35:23 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-08-01 17:04:45 +0000
commit4cbaa49c0ee707a2e1e1d842279b32473e8c8a28 (patch)
treedc5fa102c9e8f8dbe68d18290607ee73d365ff1e /sw
parent2e3bc9fcee1c728d9fe91cbdf92b15d090c2b619 (diff)
svl: implement SfxUndoAction::GetViewShellId() interface in SfxListUndoAction
Client code in sw, sd, sc and svx is adapted, the rest is just a placeholder for now. With this, e.g. the undo item for Writer's insert comment properly tracks which window was used for the insertion. Change-Id: Idad587e6ca07ba69bf59aa7013b251af8bf95bab Reviewed-on: https://gerrit.libreoffice.org/27781 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/docnew.cxx1
-rw-r--r--sw/source/core/inc/UndoManager.hxx3
-rw-r--r--sw/source/core/undo/docundo.cxx23
3 files changed, 25 insertions, 2 deletions
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index daa055b22863..42dbb2221dca 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -611,6 +611,7 @@ void SwDoc::SetDocShell( SwDocShell* pDSh )
if (mpDocShell)
{
mpDocShell->SetUndoManager(& GetUndoManager());
+ GetUndoManager().SetDocShell(mpDocShell);
}
getIDocumentLinksAdministration().GetLinkManager().SetPersist( mpDocShell );
diff --git a/sw/source/core/inc/UndoManager.hxx b/sw/source/core/inc/UndoManager.hxx
index 95a7cbdbfd57..68774c47d003 100644
--- a/sw/source/core/inc/UndoManager.hxx
+++ b/sw/source/core/inc/UndoManager.hxx
@@ -28,6 +28,7 @@
class IDocumentDrawModelAccess;
class IDocumentRedlineAccess;
class IDocumentState;
+class SwDocShell;
namespace sw {
@@ -85,6 +86,7 @@ public:
SwNodes const& GetUndoNodes() const;
SwNodes & GetUndoNodes();
+ void SetDocShell(SwDocShell* pDocShell);
private:
IDocumentDrawModelAccess & m_rDrawModelAccess;
@@ -99,6 +101,7 @@ private:
bool m_bLockUndoNoModifiedPosition : 1;
/// position in Undo-Array at which Doc was saved (and is not modified)
UndoStackMark m_UndoSaveMark;
+ SwDocShell* m_pDocShell;
typedef enum { UNDO = int(true), REDO = int(false) } UndoOrRedo_t;
bool impl_DoUndoRedo(UndoOrRedo_t const undoOrRedo);
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 056179d5da9f..9f70fa0d1768 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -23,6 +23,8 @@
#include <svx/svdmodel.hxx>
#include <swmodule.hxx>
#include <doc.hxx>
+#include <docsh.hxx>
+#include <view.hxx>
#include <drawdoc.hxx>
#include <ndarr.hxx>
#include <pam.hxx>
@@ -79,6 +81,11 @@ bool UndoManager::IsUndoNodes(SwNodes const& rNodes) const
return & rNodes == m_xUndoNodes.get();
}
+void UndoManager::SetDocShell(SwDocShell* pDocShell)
+{
+ m_pDocShell = pDocShell;
+}
+
size_t UndoManager::GetUndoActionCount(const bool bCurrentLevel) const
{
return SdrUndoManager::GetUndoActionCount(bCurrentLevel);
@@ -212,7 +219,13 @@ UndoManager::StartUndo(SwUndoId const i_eUndoId,
comment = pRewriter->Apply(comment);
}
- SdrUndoManager::EnterListAction(comment, comment, eUndoId);
+ int nViewShellId = -1;
+ if (m_pDocShell)
+ {
+ if (const SwView* pView = m_pDocShell->GetView())
+ nViewShellId = pView->GetViewShellId();
+ }
+ SdrUndoManager::EnterListAction(comment, comment, eUndoId, nViewShellId);
return eUndoId;
}
@@ -563,7 +576,13 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext,
sal_uInt16 const nId(pRepeatAction->GetId());
if (DoesUndo())
{
- EnterListAction(comment, rcomment, nId);
+ int nViewShellId = -1;
+ if (m_pDocShell)
+ {
+ if (const SwView* pView = m_pDocShell->GetView())
+ nViewShellId = pView->GetViewShellId();
+ }
+ EnterListAction(comment, rcomment, nId, nViewShellId);
}
SwPaM* pTmp = rContext.m_pCurrentPaM;