summaryrefslogtreecommitdiff
path: root/sc/source/ui/namedlg
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 /sc/source/ui/namedlg
parent62ec7f9e824ed1c17f01beaf8f4cec3b76b3aae9 (diff)
correctly select new entry after returning from Define Names
Diffstat (limited to 'sc/source/ui/namedlg')
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx6
-rw-r--r--sc/source/ui/namedlg/namemgrtable.cxx12
2 files changed, 18 insertions, 0 deletions
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