diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-10-26 00:59:34 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-10-26 17:01:59 +0200 |
commit | 05d40c33b0d3e8d33912ad2b43ae8e31c6a1e443 (patch) | |
tree | 22327eb9d411ef508089af37b274113ac12c01ac /sc | |
parent | 267aa59dfe918f97c32b0ba8f9a54b548c89b4c9 (diff) |
add local range names to undo
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/inc/undocell.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/undo/undocell.cxx | 19 |
2 files changed, 18 insertions, 5 deletions
diff --git a/sc/source/ui/inc/undocell.hxx b/sc/source/ui/inc/undocell.hxx index 2ab9ab1a9cfa..3ff3127bba39 100644 --- a/sc/source/ui/inc/undocell.hxx +++ b/sc/source/ui/inc/undocell.hxx @@ -352,8 +352,9 @@ class ScUndoRangeNames: public ScSimpleUndo { public: TYPEINFO(); + //use nTab = -1 for global range names ScUndoRangeNames( ScDocShell* pNewDocShell, - ScRangeName* pOld, ScRangeName* pNew ); + ScRangeName* pOld, ScRangeName* pNew , SCTAB nTab = -1); virtual ~ScUndoRangeNames(); virtual void Undo(); @@ -366,6 +367,7 @@ public: private: ScRangeName* pOldRanges; ScRangeName* pNewRanges; + SCTAB mnTab; void DoChange( sal_Bool bUndo ); }; diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index fa98ed441a7d..a4c6c6dc529f 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -1084,10 +1084,11 @@ sal_Bool ScUndoDetective::CanRepeat(SfxRepeatTarget& /* rTarget */) const // ScUndoRangeNames::ScUndoRangeNames( ScDocShell* pNewDocShell, - ScRangeName* pOld, ScRangeName* pNew ) : + ScRangeName* pOld, ScRangeName* pNew, SCTAB nTab ) : ScSimpleUndo( pNewDocShell ), pOldRanges ( pOld ), - pNewRanges ( pNew ) + pNewRanges ( pNew ), + mnTab ( nTab ) { } @@ -1108,9 +1109,19 @@ void ScUndoRangeNames::DoChange( sal_Bool bUndo ) pDoc->CompileNameFormula( sal_True ); // CreateFormulaString if ( bUndo ) - pDoc->SetRangeName( new ScRangeName( *pOldRanges ) ); + { + if (mnTab >= 0) + pDoc->SetRangeName( mnTab, new ScRangeName( *pOldRanges ) ); + else + pDoc->SetRangeName( new ScRangeName( *pOldRanges ) ); + } else - pDoc->SetRangeName( new ScRangeName( *pNewRanges ) ); + { + if (mnTab >= 0) + pDoc->SetRangeName( mnTab, new ScRangeName( *pNewRanges ) ); + else + pDoc->SetRangeName( new ScRangeName( *pNewRanges ) ); + } pDoc->CompileNameFormula( false ); // CompileFormulaString |