summaryrefslogtreecommitdiff
path: root/sc/source/ui/docshell/docfunc.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/docshell/docfunc.cxx')
-rw-r--r--sc/source/ui/docshell/docfunc.cxx25
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,