diff options
author | Kohei Yoshida <kyoshida@novell.com> | 2011-03-15 11:12:55 -0400 |
---|---|---|
committer | Kohei Yoshida <kyoshida@novell.com> | 2011-03-15 23:51:41 -0400 |
commit | 225b3351763112756a7fa373230d1bee1f96a6a6 (patch) | |
tree | 897e880463d3ae213f9a69e1c09306f1fd41adea /sc/source/ui/docshell/docfunc.cxx | |
parent | a040ea619d62a2cbc854f8f11d154cd84148a51d (diff) |
Implement ModifyAllRangeNames(), minus undo.
Diffstat (limited to 'sc/source/ui/docshell/docfunc.cxx')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index ed7c979a2688..fd824d63f69c 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4487,6 +4487,25 @@ bool ScDocFunc::ModifyRangeNames( const ScRangeName& rNewRanges ) void ScDocFunc::ModifyAllRangeNames( const ScRangeName* pGlobal, const ::std::map<SCTAB, const ScRangeName*>& rTabs ) { + typedef ::std::map<SCTAB, const ScRangeName*> MapType; + + ScDocShellModificator aModificator(rDocShell); + ScDocument* pDoc = rDocShell.GetDocument(); + + pDoc->CompileNameFormula(true); + + // global names + pDoc->SetRangeName(new ScRangeName(*pGlobal)); + + // sheet-local names + MapType::const_iterator itr = rTabs.begin(), itrEnd = rTabs.end(); + for (; itr != itrEnd; ++itr) + pDoc->SetRangeName(itr->first, new ScRangeName(*itr->second)); + + pDoc->CompileNameFormula(false); + + aModificator.SetDocumentModified(); + SFX_APP()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED)); } bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc ) // takes ownership of pNewRanges |