diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-03-15 14:50:20 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-03-15 23:51:41 -0400 |
commit | 3098641cba6f749f3be091fd70af483aa709f25b (patch) | |
tree | 426f2951e206997c11e523ab83764b124408e79f /sc/source/ui/docshell/docfunc.cxx | |
parent | 225b3351763112756a7fa373230d1bee1f96a6a6 (diff) |
Added skeleton for undo of all range names, global and local.
Diffstat (limited to 'sc/source/ui/docshell/docfunc.cxx')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index fd824d63f69c..9cf20421cbe3 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -100,6 +100,7 @@ #include "tabprotection.hxx" #include "clipparam.hxx" #include "externalrefmgr.hxx" +#include "undorangename.hxx" #include <memory> #include <basic/basmgr.hxx> @@ -4485,20 +4486,27 @@ bool ScDocFunc::ModifyRangeNames( const ScRangeName& rNewRanges ) return SetNewRangeNames( new ScRangeName(rNewRanges) ); } -void ScDocFunc::ModifyAllRangeNames( const ScRangeName* pGlobal, const ::std::map<SCTAB, const ScRangeName*>& rTabs ) +void ScDocFunc::ModifyAllRangeNames( const ScRangeName* pGlobal, const ScRangeName::TabNameCopyMap& rTabs ) { - typedef ::std::map<SCTAB, const ScRangeName*> MapType; - ScDocShellModificator aModificator(rDocShell); ScDocument* pDoc = rDocShell.GetDocument(); + if (pDoc->IsUndoEnabled()) + { + ScRangeName* pOldGlobal = pDoc->GetRangeName(); + ScRangeName::TabNameCopyMap aOldLocals; + pDoc->GetAllTabRangeNames(aOldLocals); + rDocShell.GetUndoManager()->AddUndoAction( + new ScUndoAllRangeNames(&rDocShell, pOldGlobal, pGlobal, aOldLocals, rTabs)); + } + pDoc->CompileNameFormula(true); // global names pDoc->SetRangeName(new ScRangeName(*pGlobal)); // sheet-local names - MapType::const_iterator itr = rTabs.begin(), itrEnd = rTabs.end(); + ScRangeName::TabNameCopyMap::const_iterator itr = rTabs.begin(), itrEnd = rTabs.end(); for (; itr != itrEnd; ++itr) pDoc->SetRangeName(itr->first, new ScRangeName(*itr->second)); |