Kaydet (Commit) 4a00c3d7 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

fdo#44831: Named range should overwrite existing name.

When inserting a new named range, it should overwrite any existing
name if one exists.  That was the old behavior in 3.3 prior to my
range name rework, and because of ptr_map not overwriting existing
key, that behavior had changed unintentionally.

Let's revert to the old behavior.
üst 43507c9e
...@@ -222,7 +222,7 @@ public: ...@@ -222,7 +222,7 @@ public:
SC_DLLPUBLIC size_t size() const; SC_DLLPUBLIC size_t size() const;
bool empty() const; bool empty() const;
/** Insert object into set if not a duplicate. /** Insert object into set.
@ATTENTION: The underlying ::boost::ptr_set_adapter::insert(p) takes @ATTENTION: The underlying ::boost::ptr_set_adapter::insert(p) takes
ownership of p and if it can't insert it deletes the object! So, if ownership of p and if it can't insert it deletes the object! So, if
this insert here returns false the object where p pointed to is gone! this insert here returns false the object where p pointed to is gone!
......
...@@ -894,6 +894,7 @@ bool ScRangeName::insert(ScRangeData* p) ...@@ -894,6 +894,7 @@ bool ScRangeName::insert(ScRangeData* p)
} }
rtl::OUString aName(p->GetUpperName()); rtl::OUString aName(p->GetUpperName());
maData.erase(aName); // ptr_map won't insert it if a duplicate name exists.
pair<DataType::iterator, bool> r = maData.insert(aName, p); pair<DataType::iterator, bool> r = maData.insert(aName, p);
if (r.second) if (r.second)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment