diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-11-21 05:09:10 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2011-11-23 06:25:33 +0100 |
commit | 106f128f359deb1c9553c105eff4bf829fdd9736 (patch) | |
tree | 57a563b4e8549de6c88ac5d686b17aa85c8b4361 /sc/source/ui/docshell/docfunc.cxx | |
parent | 26c86c78c5eb4b15e6f4fa9074045c97fcb50173 (diff) |
ManageNames: make global undo work again with dialog
Diffstat (limited to 'sc/source/ui/docshell/docfunc.cxx')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 39600bd9ece3..739b973861c3 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -74,6 +74,7 @@ #include "drwlayer.hxx" #include "editutil.hxx" #include "globstr.hrc" +#include "globalnames.hxx" #include "olinetab.hxx" #include "patattr.hxx" #include "rangenam.hxx" @@ -4528,6 +4529,30 @@ bool ScDocFunc::SetNewRangeNames( ScRangeName* pNewRanges, bool bModifyDoc, SCTA return true; } +void ScDocFunc::ModifyAllRangeNames( const boost::ptr_map<rtl::OUString, ScRangeName>& rRangeMap ) +{ + ScDocShellModificator aModificator(rDocShell); + ScDocument* pDoc = rDocShell.GetDocument(); + + if (pDoc->IsUndoEnabled()) + { + std::map<rtl::OUString, ScRangeName*> aOldRangeMap; + pDoc->GetRangeNameMap(aOldRangeMap); + rDocShell.GetUndoManager()->AddUndoAction( + new ScUndoAllRangeNames(&rDocShell, aOldRangeMap, rRangeMap)); + } + + pDoc->CompileNameFormula(true); + + // set all range names + pDoc->SetAllRangeNames(rRangeMap); + + pDoc->CompileNameFormula(false); + + aModificator.SetDocumentModified(); + SFX_APP()->Broadcast(SfxSimpleHint(SC_HINT_AREAS_CHANGED)); +} + //------------------------------------------------------------------------ void ScDocFunc::CreateOneName( ScRangeName& rList, |