summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2015-01-02 23:11:55 +0100
committerKohei Yoshida <libreoffice@kohei.us>2015-01-03 00:47:32 +0000
commit31e82d9f6f07335a2526bd44956eebfcaf0a289d (patch)
tree55b81bf98c82aef6712ffda756134a7a3506a72d /sc
parente26f57446179a10a621b31a77446424a8ce14f7b (diff)
Add deleteOnTab for ScDBCollection::AnonDBs
and use it instead of just using remove_if which is useless nothing! Change-Id: I37d8254b05123e50b076ddbb6f67726198ec4d6c Reviewed-on: https://gerrit.libreoffice.org/13723 Reviewed-by: Kohei Yoshida <libreoffice@kohei.us> Tested-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/dbdata.hxx1
-rw-r--r--sc/source/core/tool/dbdata.cxx8
2 files changed, 8 insertions, 1 deletions
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index bb2684a409f4..c2a842602eed 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -203,6 +203,7 @@ public:
const_iterator end() const;
const ScDBData* findAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const;
const ScDBData* findByRange(const ScRange& rRange) const;
+ void deleteOnTab(SCTAB nTab);
ScDBData* getByRange(const ScRange& rRange);
void insert(ScDBData* p);
bool empty() const;
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index e96e5b894dec..5dd0f6a463a5 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -762,6 +762,12 @@ const ScDBData* ScDBCollection::AnonDBs::findByRange(const ScRange& rRange) cons
return itr == maDBs.end() ? NULL : &(*itr);
}
+void ScDBCollection::AnonDBs::deleteOnTab(SCTAB nTab)
+{
+ FindByTable func(nTab);
+ maDBs.erase_if(func);
+}
+
ScDBData* ScDBCollection::AnonDBs::getByRange(const ScRange& rRange)
{
const ScDBData* pData = findByRange(rRange);
@@ -905,7 +911,7 @@ void ScDBCollection::DeleteOnTab( SCTAB nTab )
for (; itr != itrEnd; ++itr)
maNamedDBs.erase(*itr);
- remove_if(maAnonDBs.begin(), maAnonDBs.end(), func);
+ maAnonDBs.deleteOnTab(nTab);
}
void ScDBCollection::UpdateReference(UpdateRefMode eUpdateRefMode,