summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-12-03 19:58:27 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2011-12-03 20:15:02 +0100
commit3e3f729cd668aa241345166f1046a8f0dd9ac83b (patch)
treea42ecfd6dadef6db0bafe47a1fa99fc074e78fb4
parentcells creation : do not use uno calls at loading time (diff)
downloadcore-3e3f729cd668aa241345166f1046a8f0dd9ac83b.tar.gz
core-3e3f729cd668aa241345166f1046a8f0dd9ac83b.zip
correctly select new entry after returning from Define Names
-rw-r--r--sc/source/ui/inc/namemgrtable.hxx1
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx6
-rw-r--r--sc/source/ui/namedlg/namemgrtable.cxx12
3 files changed, 19 insertions, 0 deletions
diff --git a/sc/source/ui/inc/namemgrtable.hxx b/sc/source/ui/inc/namemgrtable.hxx
index bbbcab60bd41..69bc102bfb1a 100644
--- a/sc/source/ui/inc/namemgrtable.hxx
+++ b/sc/source/ui/inc/namemgrtable.hxx
@@ -83,6 +83,7 @@ public:
void addEntry( const ScRangeNameLine& rLine );
void DeleteSelectedEntries();
+ void SetEntry( const ScRangeNameLine& rLine );
void GetCurrentLine(ScRangeNameLine& rLine);
bool IsMultiSelection();
diff --git a/sc/source/ui/namedlg/namedlg.cxx b/sc/source/ui/namedlg/namedlg.cxx
index 93456b551433..a3a27147c17b 100644
--- a/sc/source/ui/namedlg/namedlg.cxx
+++ b/sc/source/ui/namedlg/namedlg.cxx
@@ -364,7 +364,13 @@ bool ScNameDlg::AddPushed()
void ScNameDlg::SetEntry(const rtl::OUString& rName, const rtl::OUString& rScope)
{
if (!rName.isEmpty())
+ {
mbDataChanged = true;
+ ScRangeNameLine aLine;
+ aLine.aName = rName;
+ aLine.aScope = rScope;
+ mpRangeManagerTable->SetEntry(aLine);
+ }
}
void ScNameDlg::RemovePushed()
diff --git a/sc/source/ui/namedlg/namemgrtable.cxx b/sc/source/ui/namedlg/namemgrtable.cxx
index 40bd5aa459e9..99b1ea0367ba 100644
--- a/sc/source/ui/namedlg/namemgrtable.cxx
+++ b/sc/source/ui/namedlg/namemgrtable.cxx
@@ -209,6 +209,18 @@ std::vector<ScRangeNameLine> ScRangeManagerTable::GetSelectedEntries()
return aSelectedEntries;
}
+void ScRangeManagerTable::SetEntry(const ScRangeNameLine& rLine)
+{
+ for (SvLBoxEntry* pEntry = First(); pEntry; pEntry = Next(pEntry))
+ {
+ if (rLine.aName == rtl::OUString(GetEntryText(pEntry, 0))
+ && rLine.aScope == rtl::OUString(GetEntryText(pEntry, 2)))
+ {
+ SetCurEntry(pEntry);
+ }
+ }
+}
+
namespace {
//ensure that the minimum column size is respected