summaryrefslogtreecommitdiff
path: root/sd
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-02 10:55:53 +0200
commitb0a1c742a92fa685d45492cbec8a0105375be884 (patch)
tree5b45ea021730d4f360fa652804ee6f1fcc351c18 /sd
parent2aa728780e273feaa3646f0299b727c02502c18d (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. Reviewed-on: https://gerrit.libreoffice.org/27781 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org> (cherry picked from commit 4cbaa49c0ee707a2e1e1d842279b32473e8c8a28) Conflicts: sc/source/ui/view/viewfun3.cxx Change-Id: Idad587e6ca07ba69bf59aa7013b251af8bf95bab
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/undo/undomanager.hxx2
-rw-r--r--sd/source/core/drawdoc3.cxx11
-rw-r--r--sd/source/core/undo/undomanager.cxx4
-rw-r--r--sd/source/ui/animations/SlideTransitionPane.cxx2
-rw-r--r--sd/source/ui/func/fubullet.cxx6
-rw-r--r--sd/source/ui/func/fuinsfil.cxx4
-rw-r--r--sd/source/ui/func/fuoaprms.cxx3
-rw-r--r--sd/source/ui/func/fupage.cxx3
-rw-r--r--sd/source/ui/sidebar/DocumentHelper.cxx4
-rw-r--r--sd/source/ui/view/ViewShellImplementation.cxx2
-rw-r--r--sd/source/ui/view/drawview.cxx6
-rw-r--r--sd/source/ui/view/drviews2.cxx2
-rw-r--r--sd/source/ui/view/outlview.cxx2
13 files changed, 34 insertions, 17 deletions
diff --git a/sd/inc/undo/undomanager.hxx b/sd/inc/undo/undomanager.hxx
index ecea0ed3949e..a0200382ae27 100644
--- a/sd/inc/undo/undomanager.hxx
+++ b/sd/inc/undo/undomanager.hxx
@@ -31,7 +31,7 @@ class UndoManager : public SdrUndoManager
public:
UndoManager( sal_uInt16 nMaxUndoActionCount = 20 );
- virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId) override;
+ virtual void EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, sal_Int32 nViewShellId) override;
virtual void AddUndoAction( SfxUndoAction *pAction, bool bTryMerg=false ) override;
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index fe2f66cacbf2..7817f75066d4 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -60,6 +60,7 @@
#include "../ui/inc/GraphicDocShell.hxx"
#include "../ui/inc/ViewShell.hxx"
#include "../ui/inc/View.hxx"
+#include "../ui/inc/ViewShellBase.hxx"
#include "../ui/inc/cfgids.hxx"
#include "../ui/inc/strings.hrc"
@@ -488,7 +489,10 @@ bool SdDrawDocument::InsertBookmarkAsPage(
if( mpDocSh )
{
pUndoMgr = mpDocSh->GetUndoManager();
- pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_INSERTPAGES), "", 0);
+ sal_Int32 nViewShellId = -1;
+ if (sd::ViewShell* pViewShell = mpDocSh->GetViewShell())
+ nViewShellId = pViewShell->GetViewShellBase().GetViewShellId();
+ pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_INSERTPAGES), "", 0, nViewShellId);
}
// Refactored copy'n'pasted layout name collection into IterateBookmarkPages
@@ -1426,7 +1430,10 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
if (bUndo)
{
- pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_SET_PRESLAYOUT), OUString(), 0);
+ sal_Int32 nViewShellId = -1;
+ if (sd::ViewShell* pViewShell = mpDocSh->GetViewShell())
+ nViewShellId = pViewShell->GetViewShellBase().GetViewShellId();
+ pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_SET_PRESLAYOUT), OUString(), 0, nViewShellId);
}
SdPage* pSelectedPage = GetSdPage(nSdPageNum, PK_STANDARD);
diff --git a/sd/source/core/undo/undomanager.cxx b/sd/source/core/undo/undomanager.cxx
index 20e13edde08a..bbf2069ce75b 100644
--- a/sd/source/core/undo/undomanager.cxx
+++ b/sd/source/core/undo/undomanager.cxx
@@ -27,12 +27,12 @@ UndoManager::UndoManager( sal_uInt16 nMaxUndoActionCount /* = 20 */ )
{
}
-void UndoManager::EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId /* =0 */)
+void UndoManager::EnterListAction(const OUString &rComment, const OUString& rRepeatComment, sal_uInt16 nId, sal_Int32 nViewShellId)
{
if( !IsDoing() )
{
ClearLinkedRedoActions();
- SdrUndoManager::EnterListAction( rComment, rRepeatComment, nId );
+ SdrUndoManager::EnterListAction( rComment, rRepeatComment, nId, nViewShellId );
}
}
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx
index c8ae5ed0fe96..e5c924dcbf5a 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -249,7 +249,7 @@ void lcl_CreateUndoForPages(
return;
OUString aComment( SdResId(STR_UNDO_SLIDE_PARAMS) );
- pManager->EnterListAction(aComment, aComment, 0);
+ pManager->EnterListAction(aComment, aComment, 0, rBase.GetViewShellId());
SdUndoGroup* pUndoGroup = new SdUndoGroup( pDoc );
pUndoGroup->SetComment( aComment );
diff --git a/sd/source/ui/func/fubullet.cxx b/sd/source/ui/func/fubullet.cxx
index 9bd341923ba9..895ee2d05623 100644
--- a/sd/source/ui/func/fubullet.cxx
+++ b/sd/source/ui/func/fubullet.cxx
@@ -25,6 +25,7 @@
#include <editeng/fontitem.hxx>
#include "OutlineViewShell.hxx"
#include "DrawViewShell.hxx"
+#include "ViewShellBase.hxx"
#include "Window.hxx"
#include "drawdoc.hxx"
#include "strings.hrc"
@@ -128,7 +129,7 @@ void FuBullet::InsertFormattingMark( sal_Unicode cMark )
// prepare undo
::svl::IUndoManager& rUndoMgr = pOL->GetUndoManager();
rUndoMgr.EnterListAction(SD_RESSTR(STR_UNDO_INSERT_SPECCHAR),
- "", 0 );
+ "", 0, mpViewShell->GetViewShellBase().GetViewShellId() );
// insert given text
OUString aStr( cMark );
@@ -255,8 +256,9 @@ void FuBullet::InsertSpecialCharacter( SfxRequest& rReq )
aOldSet.Put( pOV->GetAttribs() );
::svl::IUndoManager& rUndoMgr = pOL->GetUndoManager();
+ int nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : -1;
rUndoMgr.EnterListAction(SD_RESSTR(STR_UNDO_INSERT_SPECCHAR),
- "", 0 );
+ "", 0, nViewShellId );
pOV->InsertText(aChars, true);
// set attributes (set font)
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index c1c7a73977de..018f7fdc2c91 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -54,6 +54,7 @@
#include "glob.hrc"
#include "sdpage.hxx"
#include "strmname.h"
+#include "ViewShellBase.hxx"
#include "DrawViewShell.hxx"
#include "OutlineViewShell.hxx"
#include "DrawDocShell.hxx"
@@ -636,8 +637,9 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
nNewPages = 0;
+ int nViewShellId = mpViewShell ? mpViewShell->GetViewShellBase().GetViewShellId() : -1;
rDocliner.GetUndoManager().EnterListAction(
- SD_RESSTR(STR_UNDO_INSERT_FILE), OUString(), 0 );
+ SD_RESSTR(STR_UNDO_INSERT_FILE), OUString(), 0, nViewShellId );
sal_Int32 nSourcePos = 0;
SfxStyleSheet* pStyleSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_OUTLINE );
diff --git a/sd/source/ui/func/fuoaprms.cxx b/sd/source/ui/func/fuoaprms.cxx
index 2f4c67204e19..51458e13cf5b 100644
--- a/sd/source/ui/func/fuoaprms.cxx
+++ b/sd/source/ui/func/fuoaprms.cxx
@@ -36,6 +36,7 @@
#include "glob.hrc"
#include "drawdoc.hxx"
#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
#include "anminfo.hxx"
#include "unoaprms.hxx"
#include "sdundogr.hxx"
@@ -618,7 +619,7 @@ void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq )
// with 'following curves', we have an additional UndoAction
// therefore cling? here
- pUndoMgr->EnterListAction(aComment, aComment, 0);
+ pUndoMgr->EnterListAction(aComment, aComment, 0, mpViewShell->GetViewShellBase().GetViewShellId());
// create undo group
SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx
index 91670b3b01bf..aac1366e9dc1 100644
--- a/sd/source/ui/func/fupage.cxx
+++ b/sd/source/ui/func/fupage.cxx
@@ -59,6 +59,7 @@
#include "drawdoc.hxx"
#include "DrawDocShell.hxx"
#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
#include "DrawViewShell.hxx"
#include "app.hrc"
#include "unchss.hxx"
@@ -412,7 +413,7 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent )
{
OUString aComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
::svl::IUndoManager* pUndoMgr = mpDocSh->GetUndoManager();
- pUndoMgr->EnterListAction(aComment, aComment, 0);
+ pUndoMgr->EnterListAction(aComment, aComment, 0, mpViewShell->GetViewShellBase().GetViewShellId());
SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
pUndoGroup->SetComment(aComment);
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx b/sd/source/ui/sidebar/DocumentHelper.cxx
index 61205a255fdf..3f90c354a5b0 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -27,6 +27,8 @@
#include "strings.hrc"
#include "sdresid.hxx"
#include "undoback.hxx"
+#include "ViewShell.hxx"
+#include "ViewShellBase.hxx"
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
@@ -320,7 +322,7 @@ void DocumentHelper::AssignMasterPageToPageList (
::svl::IUndoManager* pUndoMgr = rTargetDocument.GetDocSh()->GetUndoManager();
if( pUndoMgr )
- pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_SET_PRESLAYOUT), OUString(), 0);
+ pUndoMgr->EnterListAction(SD_RESSTR(STR_UNDO_SET_PRESLAYOUT), OUString(), 0, rTargetDocument.GetDocSh()->GetViewShell()->GetViewShellBase().GetViewShellId());
SdPage* pMasterPageInDocument = ProvideMasterPage(rTargetDocument,pMasterPage,rpPageList);
if (pMasterPageInDocument == nullptr)
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx b/sd/source/ui/view/ViewShellImplementation.cxx
index 75c5ca19b0be..d4639fdd03c6 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -175,7 +175,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot (
if( pUndoManager )
{
OUString aComment( SdResId(STR_UNDO_MODIFY_PAGE) );
- pUndoManager->EnterListAction(aComment, aComment, 0);
+ pUndoManager->EnterListAction(aComment, aComment, 0, mrViewShell.GetViewShellBase().GetViewShellId());
ModifyPageUndoAction* pAction = new ModifyPageUndoAction(
pDocument, pUndoPage, aNewName, aNewAutoLayout, bBVisible, bBObjsVisible);
pUndoManager->AddUndoAction(pAction);
diff --git a/sd/source/ui/view/drawview.cxx b/sd/source/ui/view/drawview.cxx
index f929197eda81..72fb3b43678f 100644
--- a/sd/source/ui/view/drawview.cxx
+++ b/sd/source/ui/view/drawview.cxx
@@ -52,6 +52,7 @@
#include "drawdoc.hxx"
#include "DrawDocShell.hxx"
#include "sdpage.hxx"
+#include "ViewShellBase.hxx"
#include "DrawViewShell.hxx"
#include "pres.hxx"
#include "sdresid.hxx"
@@ -181,7 +182,7 @@ bool DrawView::SetAttributes(const SfxItemSet& rSet,
// replace placeholder by template name
OUString aComment(SD_RESSTR(STR_UNDO_CHANGE_PRES_OBJECT));
aComment = aComment.replaceFirst("$", SD_RESSTR(STR_PSEUDOSHEET_OUTLINE));
- mpDocSh->GetUndoManager()->EnterListAction( aComment, OUString(), 0 );
+ mpDocSh->GetUndoManager()->EnterListAction( aComment, OUString(), 0, mpDrawViewShell->GetViewShellBase().GetViewShellId() );
std::vector<Paragraph*> aSelList;
pOV->CreateSelectionList(aSelList);
@@ -545,7 +546,8 @@ void DrawView::DeleteMarked()
{
OUString aUndo(SVX_RESSTR(STR_EditDelete));
aUndo = aUndo.replaceFirst("%1", GetDescriptionOfMarkedObjects());
- pUndoManager->EnterListAction(aUndo, aUndo, 0);
+ sal_Int32 nViewShellId = mpDrawViewShell ? mpDrawViewShell->GetViewShellBase().GetViewShellId() : -1;
+ pUndoManager->EnterListAction(aUndo, aUndo, 0, nViewShellId);
}
SdPage* pPage = nullptr;
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 4852ef384b75..026021cd7d16 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -210,7 +210,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList();
if( rMarkList.GetMarkCount() == 1 )
{
- pUndoManager->EnterListAction("", "", 0);
+ pUndoManager->EnterListAction("", "", 0, GetViewShellBase().GetViewShellId());
mpDrawView->BegUndo();
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 09f1008f839e..1b66c13c94d4 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -1455,7 +1455,7 @@ void OutlineView::IgnoreCurrentPageChanges (bool bIgnoreChanges)
and or the drawing document model. It will create needed undo actions */
void OutlineView::BeginModelChange()
{
- mrOutliner.GetUndoManager().EnterListAction("", "", 0);
+ mrOutliner.GetUndoManager().EnterListAction("", "", 0, mrOutlineViewShell.GetViewShellBase().GetViewShellId());
BegUndo(SD_RESSTR(STR_UNDO_CHANGE_TITLE_AND_LAYOUT));
}