From a22ce3e4483f6fe462eaba8826a91355957e3676 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Wed, 23 Nov 2011 09:00:19 +0100 Subject: ManageNames: only update the range names if we really changed data --- sc/source/ui/inc/namedlg.hxx | 1 + sc/source/ui/namedlg/namedlg.cxx | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'sc') diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index fc2fc0f2b65c..c6f4f4abe15d 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -96,6 +96,7 @@ private: Selection maCurSel; bool mbNeedUpdate; + bool mbDataChanged; typedef boost::ptr_map RangeNameContainer; diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index d21355cbc201..c27389400892 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -111,7 +111,8 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, mpViewData ( ptrViewData ), mpDoc ( ptrViewData->GetDocument() ), maCursorPos ( aCursorPos ), - mbNeedUpdate ( true ) + mbNeedUpdate ( true ), + mbDataChanged ( false ) { Init(); FreeResource(); @@ -213,8 +214,11 @@ void ScNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP ) sal_Bool ScNameDlg::Close() { - ScDocFunc aFunc(*mpViewData->GetDocShell()); - aFunc.ModifyAllRangeNames(maRangeMap); + if (mbDataChanged) + { + ScDocFunc aFunc(*mpViewData->GetDocShell()); + aFunc.ModifyAllRangeNames(maRangeMap); + } return DoClose( ScNameDlgWrapper::GetChildWindowId() ); } @@ -376,6 +380,8 @@ void ScNameDlg::RemovePushed() // be safe and check for possible problems if (pData) pRangeName->erase(*pData); + + mbDataChanged = true; } CheckForEmptyTable(); } @@ -430,6 +436,7 @@ void ScNameDlg::NameModified() aLine.aScope = aNewScope; mpRangeManagerTable->addEntry(aLine); mbNeedUpdate = true; + mbDataChanged = true; } } -- cgit