sc/source/ui/inc/namedlg.hrc | 1 sc/source/ui/inc/namedlg.hxx | 3 ++ sc/source/ui/namedlg/namedlg.cxx | 53 +++++++++++++++++++++++++++++++++++--- sc/source/ui/namedlg/namepast.cxx | 6 ++++ sc/source/ui/src/namedlg.src | 4 ++ 5 files changed, 64 insertions(+), 3 deletions(-)
New commits: commit a22ce3e4483f6fe462eaba8826a91355957e3676 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Nov 23 09:00:19 2011 +0100 ManageNames: only update the range names if we really changed data diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index fc2fc0f..c6f4f4a 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<rtl::OUString, ScRangeName> RangeNameContainer; diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index d21355c..c273894 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; } } commit 68c591429fd0fc6189d53d4f718fb3edf9038dfb Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Nov 23 08:49:37 2011 +0100 ManageNames: set correct text for multiselection diff --git a/sc/source/ui/inc/namedlg.hrc b/sc/source/ui/inc/namedlg.hrc index db5c08c..37212c6 100644 --- a/sc/source/ui/inc/namedlg.hrc +++ b/sc/source/ui/inc/namedlg.hrc @@ -56,5 +56,6 @@ #define STR_ERR_NAME_EXISTS 73 #define STR_ERR_NAME_INVALID 74 #define STR_DEFAULT_INFO 75 +#define STR_MULTI_SELECT 76 #define FT_INFO 72 diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index ed72e65..fc2fc0f 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -88,6 +88,7 @@ private: const rtl::OUString maErrInvalidNameStr; const rtl::OUString maErrNameInUse; const rtl::OUString maStrInfoDefault; + const rtl::OUString maStrMultiSelect; ScViewData* mpViewData; ScDocument* mpDoc; diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index f0c3b3f..d21355c 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -106,6 +106,7 @@ ScNameDlg::ScNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, maErrInvalidNameStr( ResId::toString(ScResId(STR_ERR_NAME_INVALID))), maErrNameInUse ( ResId::toString(ScResId(STR_ERR_NAME_EXISTS))), maStrInfoDefault ( ResId::toString(ScResId(STR_DEFAULT_INFO))), + maStrMultiSelect ( ResId::toString(ScResId(STR_MULTI_SELECT))), // mpViewData ( ptrViewData ), mpDoc ( ptrViewData->GetDocument() ), @@ -444,6 +445,9 @@ void ScNameDlg::SelectionChanged() if (mpRangeManagerTable->IsMultiSelection()) { + maEdName.SetText(maStrMultiSelect); + maEdAssign.SetText(maStrMultiSelect); + maEdName.Disable(); maEdAssign.Disable(); maLbScope.Disable(); diff --git a/sc/source/ui/src/namedlg.src b/sc/source/ui/src/namedlg.src index 71225ca..66977f7 100644 --- a/sc/source/ui/src/namedlg.src +++ b/sc/source/ui/src/namedlg.src @@ -212,4 +212,8 @@ ModelessDialog RID_SCDLG_NAMES { Text [en-US] = "Select cells in the document to update the range."; }; + String STR_MULTI_SELECT + { + Text [en-US] = "(multiple)"; + }; }; commit 6a56210854bc6600f559589531617fb65e250870 Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Nov 23 08:22:02 2011 +0100 ManageNames: disable some elements if table is empty diff --git a/sc/source/ui/inc/namedlg.hxx b/sc/source/ui/inc/namedlg.hxx index 6a9523f..ed72e65 100644 --- a/sc/source/ui/inc/namedlg.hxx +++ b/sc/source/ui/inc/namedlg.hxx @@ -109,6 +109,7 @@ private: bool IsNameValid(); bool IsFormulaValid(); + void CheckForEmptyTable(); ScRangeName* GetRangeName(const rtl::OUString& rScope); diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx index 1f2060b..f0c3b3f 100644 --- a/sc/source/ui/namedlg/namedlg.cxx +++ b/sc/source/ui/namedlg/namedlg.cxx @@ -178,8 +178,12 @@ void ScNameDlg::Init() SelectionChanged(); } + CheckForEmptyTable(); + //TODO: fix the Add Button maBtnAdd.Disable(); + //TODO: discuss the Select Range button with UX + maBtnSelect.Disable(); } sal_Bool ScNameDlg::IsRefInputMode() const @@ -213,6 +217,35 @@ sal_Bool ScNameDlg::Close() return DoClose( ScNameDlgWrapper::GetChildWindowId() ); } +void ScNameDlg::CheckForEmptyTable() +{ + if (!mpRangeManagerTable->GetEntryCount()) + { + maBtnDelete.Disable(); + maEdAssign.Disable(); + maEdName.Disable(); + maLbScope.Disable(); + + maBtnCriteria.Disable(); + maBtnPrintArea.Disable(); + maBtnColHeader.Disable(); + maBtnRowHeader.Disable(); + } + else + { + maBtnDelete.Enable(); + maEdAssign.Enable(); + maEdName.Enable(); + maLbScope.Enable(); + + + maBtnCriteria.Enable(); + maBtnPrintArea.Enable(); + maBtnColHeader.Enable(); + maBtnRowHeader.Enable(); + } +} + void ScNameDlg::CancelPushed() { DoClose( ScNameDlgWrapper::GetChildWindowId() ); @@ -343,6 +376,7 @@ void ScNameDlg::RemovePushed() if (pData) pRangeName->erase(*pData); } + CheckForEmptyTable(); } void ScNameDlg::NameModified() @@ -400,6 +434,8 @@ void ScNameDlg::NameModified() void ScNameDlg::SelectionChanged() { + + //don't update if we have just modified due to user input if (!mbNeedUpdate) { commit 717438333eaa48898728ddc1f6b1394651dab48c Author: Markus Mohrhard <markus.mohrh...@googlemail.com> Date: Wed Nov 23 08:15:35 2011 +0100 ManageNames: disable paste buttons if table is empty diff --git a/sc/source/ui/namedlg/namepast.cxx b/sc/source/ui/namedlg/namepast.cxx index 9c57061..8613308 100644 --- a/sc/source/ui/namedlg/namepast.cxx +++ b/sc/source/ui/namedlg/namepast.cxx @@ -70,6 +70,12 @@ ScNamePasteDlg::ScNamePasteDlg( Window * pParent, ScDocShell* pShell, bool ) maBtnPasteAll.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl)); maBtnClose.SetClickHdl( LINK( this, ScNamePasteDlg, ButtonHdl)); + if (!mpTable->GetEntryCount()) + { + maBtnPaste.Disable(); + maBtnPasteAll.Disable(); + } + FreeResource(); } _______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits