From 0ebe9fab18e732468d2b9d53dddf9f266411a0e5 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Wed, 26 Oct 2016 16:18:22 +0200 Subject: init ScUndoRemoveMerge with range, tdf#92117 follow-up So the original selection is restored after Undo. Change-Id: Ie549a0b62da469ee38270ae089ea5abf9a6868e3 --- sc/source/ui/docshell/docfunc.cxx | 4 ++-- sc/source/ui/inc/undoblk.hxx | 1 + sc/source/ui/undo/undoblk.cxx | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 77c029fe7d73..4942c28995e6 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1907,7 +1907,7 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark, { ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); pUndoDoc->InitUndo( &rDoc, *aMark.begin(), *aMark.rbegin()); - pUndoRemoveMerge.reset( new ScUndoRemoveMerge( &rDocShell, pUndoDoc )); + pUndoRemoveMerge.reset( new ScUndoRemoveMerge( &rDocShell, rRange, pUndoDoc )); } for( ::std::vector::const_iterator iIter( qIncreaseRange.begin()); iIter != qIncreaseRange.end(); ++iIter ) @@ -2355,7 +2355,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark, { ScDocument* pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); pUndoDoc->InitUndo( &rDoc, *aMark.begin(), *aMark.rbegin()); - pUndoRemoveMerge.reset( new ScUndoRemoveMerge( &rDocShell, pUndoDoc )); + pUndoRemoveMerge.reset( new ScUndoRemoveMerge( &rDocShell, rRange, pUndoDoc )); } for( ::std::vector::const_iterator iIter( qDecreaseRange.begin()); iIter != qDecreaseRange.end(); ++iIter ) diff --git a/sc/source/ui/inc/undoblk.hxx b/sc/source/ui/inc/undoblk.hxx index 01af186c1ea1..32704024a09c 100644 --- a/sc/source/ui/inc/undoblk.hxx +++ b/sc/source/ui/inc/undoblk.hxx @@ -902,6 +902,7 @@ public: const ScCellMergeOption& rOption, ScDocument* pNewUndoDoc ); ScUndoRemoveMerge( ScDocShell* pNewDocShell, + const ScRange& rRange, ScDocument* pNewUndoDoc ); virtual ~ScUndoRemoveMerge() override; diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index ba29368f84b0..46b2ba31db27 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -2114,8 +2114,8 @@ ScUndoRemoveMerge::ScUndoRemoveMerge( ScDocShell* pNewDocShell, } ScUndoRemoveMerge::ScUndoRemoveMerge( ScDocShell* pNewDocShell, - ScDocument* pNewUndoDoc ) : - ScBlockUndo( pNewDocShell, ScRange(), SC_UNDO_SIMPLE ), + const ScRange& rRange, ScDocument* pNewUndoDoc ) : + ScBlockUndo( pNewDocShell, rRange, SC_UNDO_SIMPLE ), pUndoDoc( pNewUndoDoc ) { } -- cgit