diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-01 17:35:23 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-08-01 17:04:45 +0000 |
commit | 4cbaa49c0ee707a2e1e1d842279b32473e8c8a28 (patch) | |
tree | dc5fa102c9e8f8dbe68d18290607ee73d365ff1e /sd | |
parent | 2e3bc9fcee1c728d9fe91cbdf92b15d090c2b619 (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 'sd')
-rw-r--r-- | sd/inc/undo/undomanager.hxx | 2 | ||||
-rw-r--r-- | sd/source/core/drawdoc3.cxx | 11 | ||||
-rw-r--r-- | sd/source/core/undo/undomanager.cxx | 4 | ||||
-rwxr-xr-x | sd/source/ui/animations/SlideTransitionPane.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/fubullet.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/func/fuinsfil.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/func/fuoaprms.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/func/fupage.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/sidebar/DocumentHelper.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/ViewShellImplementation.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drawview.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/outlview.cxx | 2 |
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 33656fe616d6..c423141560a9 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" @@ -484,7 +485,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 @@ -1422,7 +1426,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 92f4d909677f..a59ec42f25cc 100755 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -245,7 +245,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 f03dfa544f20..ac1b89fa5ba1 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 1a4152be0e9c..54f06c2d2e4e 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" @@ -629,8 +630,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 6dc2bbabab40..7c21c3944d49 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" @@ -619,7 +620,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 712549e1b00f..02df0da5defc 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" @@ -417,7 +418,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 0380081644b9..7c626602f6c6 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> @@ -319,7 +321,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 709ab58a81cf..f13c20307521 100644 --- a/sd/source/ui/view/ViewShellImplementation.cxx +++ b/sd/source/ui/view/ViewShellImplementation.cxx @@ -171,7 +171,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 6ba151f9f9f8..a05aa94b1956 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 ca3c3704b529..abe829c7fc37 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -211,7 +211,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 024b5be5d39f..d4fc5b7e262e 100644 --- a/sd/source/ui/view/outlview.cxx +++ b/sd/source/ui/view/outlview.cxx @@ -1459,7 +1459,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)); } |