summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-08-19 15:45:57 +0200
committerMichael Stahl <mstahl@redhat.com>2015-08-19 19:36:18 +0000
commitb5ae7dbc871df57686a603dfa99e8179a0e3a4b8 (patch)
tree23970f3c875bf1c2244e4dc7f37a86c74ed40cbb
parent013efe75eba3d209a7bd072d608126dac6fa191c (diff)
sc: replace boost::ptr_set with std::set<std::unique_ptr>
Change-Id: I93bdb33a442a358b0067d57499b11d73bfbaa2d9 Reviewed-on: https://gerrit.libreoffice.org/17860 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sc/inc/dbdata.hxx16
-rw-r--r--sc/source/core/data/documen3.cxx4
-rw-r--r--sc/source/core/data/document.cxx4
-rw-r--r--sc/source/core/tool/dbdata.cxx105
-rw-r--r--sc/source/core/tool/rangeutl.cxx2
-rw-r--r--sc/source/core/tool/tokenstringcontext.cxx2
-rw-r--r--sc/source/filter/xml/XMLExportDatabaseRanges.cxx5
-rw-r--r--sc/source/ui/app/inputwin.cxx2
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx10
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx14
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2
-rw-r--r--sc/source/ui/navipi/content.cxx2
-rw-r--r--sc/source/ui/unoobj/datauno.cxx4
-rw-r--r--sc/source/ui/view/cellsh2.cxx2
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx3
15 files changed, 106 insertions, 71 deletions
diff --git a/sc/inc/dbdata.hxx b/sc/inc/dbdata.hxx
index a5d67656f5de..877a7fc0e50d 100644
--- a/sc/inc/dbdata.hxx
+++ b/sc/inc/dbdata.hxx
@@ -26,9 +26,11 @@
#include "global.hxx"
#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/ptr_container/ptr_set.hpp>
#include <boost/scoped_ptr.hpp>
+#include <memory>
+#include <set>
+
class ScDocument;
struct ScSortParam;
struct ScQueryParam;
@@ -73,9 +75,9 @@ private:
using ScRefreshTimer::operator==;
public:
- struct less : public ::std::binary_function<ScDBData, ScDBData, bool>
+ struct less : public ::std::binary_function<std::unique_ptr<ScDBData>, std::unique_ptr<ScDBData>, bool>
{
- bool operator() (const ScDBData& left, const ScDBData& right) const;
+ bool operator() (const std::unique_ptr<ScDBData>& left, const std::unique_ptr<ScDBData>& right) const;
};
SC_DLLPUBLIC ScDBData(const OUString& rName,
@@ -185,12 +187,14 @@ public:
{
friend class ScDBCollection;
- typedef ::boost::ptr_set<ScDBData, ScDBData::less> DBsType;
- DBsType maDBs;
+ typedef ::std::set<std::unique_ptr<ScDBData>, ScDBData::less> DBsType;
+ DBsType m_DBs;
ScDBCollection& mrParent;
ScDocument& mrDoc;
NamedDBs(ScDBCollection& rParent, ScDocument& rDoc);
NamedDBs(const NamedDBs& r);
+ NamedDBs & operator=(NamedDBs const&) = delete;
+
public:
typedef DBsType::iterator iterator;
typedef DBsType::const_iterator const_iterator;
@@ -201,10 +205,10 @@ public:
const_iterator end() const;
ScDBData* findByIndex(sal_uInt16 nIndex);
ScDBData* findByUpperName(const OUString& rName);
+ iterator findByUpperName2(const OUString& rName);
// Takes ownership of p iff it returns true:
SAL_WARN_UNUSED_RESULT bool insert(ScDBData* p);
void erase(iterator itr);
- void erase(const ScDBData& r);
bool empty() const;
size_t size() const;
bool operator== (const NamedDBs& r) const;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 5e6aa4d8566b..2353e91f17bd 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -242,7 +242,7 @@ void ScDocument::SetDBCollection( ScDBCollection* pNewDBCollection, bool bRemove
ScDBCollection::NamedDBs::const_iterator itr = rNamedDBs.begin(), itrEnd = rNamedDBs.end();
for (; itr != itrEnd; ++itr)
{
- const ScDBData& rOldData = *itr;
+ const ScDBData& rOldData = **itr;
if (!rOldData.HasAutoFilter())
continue;
@@ -1591,7 +1591,7 @@ bool ScDocument::GetFormulaEntries( ScTypedCaseStrSet& rStrings )
const ScDBCollection::NamedDBs& rDBs = pDBCollection->getNamedDBs();
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (; itr != itrEnd; ++itr)
- rStrings.insert(ScTypedStrData(itr->GetName(), 0.0, ScTypedStrData::DbName));
+ rStrings.insert(ScTypedStrData((*itr)->GetName(), 0.0, ScTypedStrData::DbName));
}
// Content of name ranges
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 976c63ab2381..3570386aec5e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -5497,9 +5497,9 @@ bool ScDocument::RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow,
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (; itr != itrEnd; ++itr)
{
- if (itr->HasAutoFilter())
+ if ((*itr)->HasAutoFilter())
{
- itr->GetArea( nDBTab, nDBStartCol,nDBStartRow, nDBEndCol,nDBEndRow );
+ (*itr)->GetArea(nDBTab, nDBStartCol,nDBStartRow, nDBEndCol,nDBEndRow);
if ( nDBTab==nTab && nDBStartRow<=nEndRow && nDBEndRow>=nStartRow &&
nDBStartCol<=nEndCol && nDBEndCol>=nStartCol )
{
diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx
index d896b2290577..4857b18c94aa 100644
--- a/sc/source/core/tool/dbdata.cxx
+++ b/sc/source/core/tool/dbdata.cxx
@@ -43,9 +43,9 @@ using ::std::find_if;
using ::std::remove_if;
using ::std::pair;
-bool ScDBData::less::operator() (const ScDBData& left, const ScDBData& right) const
+bool ScDBData::less::operator() (const std::unique_ptr<ScDBData>& left, const std::unique_ptr<ScDBData>& right) const
{
- return ScGlobal::GetpTransliteration()->compareString(left.GetUpperName(), right.GetUpperName()) < 0;
+ return ScGlobal::GetpTransliteration()->compareString(left->GetUpperName(), right->GetUpperName()) < 0;
}
ScDBData::ScDBData( const OUString& rName,
@@ -670,7 +670,7 @@ public:
}
};
-class UpdateRefFunc : public unary_function<ScDBData, void>
+class UpdateRefFunc : public unary_function<std::unique_ptr<ScDBData>, void>
{
ScDocument* mpDoc;
UpdateRefMode meMode;
@@ -698,9 +698,13 @@ public:
{
r.UpdateReference(mpDoc, meMode, mnCol1, mnRow1, mnTab1, mnCol2, mnRow2, mnTab2, mnDx, mnDy, mnDz);
}
+ void operator() (std::unique_ptr<ScDBData> const& p)
+ {
+ p->UpdateReference(mpDoc, meMode, mnCol1, mnRow1, mnTab1, mnCol2, mnRow2, mnTab2, mnDx, mnDy, mnDz);
+ }
};
-class UpdateMoveTabFunc : public unary_function<ScDBData, void>
+class UpdateMoveTabFunc : public unary_function<std::unique_ptr<ScDBData>, void>
{
SCTAB mnOldTab;
SCTAB mnNewTab;
@@ -710,9 +714,13 @@ public:
{
r.UpdateMoveTab(mnOldTab, mnNewTab);
}
+ void operator() (std::unique_ptr<ScDBData> const& p)
+ {
+ p->UpdateMoveTab(mnOldTab, mnNewTab);
+ }
};
-class FindByCursor : public unary_function<ScDBData, bool>
+class FindByCursor : public unary_function<std::unique_ptr<ScDBData>, bool>
{
SCCOL mnCol;
SCROW mnRow;
@@ -726,9 +734,13 @@ public:
{
return r.IsDBAtCursor(mnCol, mnRow, mnTab, mbStartOnly);
}
+ bool operator() (std::unique_ptr<ScDBData> const& p)
+ {
+ return p->IsDBAtCursor(mnCol, mnRow, mnTab, mbStartOnly);
+ }
};
-class FindByRange : public unary_function<ScDBData, bool>
+class FindByRange : public unary_function<std::unique_ptr<ScDBData>, bool>
{
const ScRange& mrRange;
public:
@@ -739,27 +751,32 @@ public:
return r.IsDBAtArea(
mrRange.aStart.Tab(), mrRange.aStart.Col(), mrRange.aStart.Row(), mrRange.aEnd.Col(), mrRange.aEnd.Row());
}
+ bool operator() (std::unique_ptr<ScDBData> const& p)
+ {
+ return p->IsDBAtArea(
+ mrRange.aStart.Tab(), mrRange.aStart.Col(), mrRange.aStart.Row(), mrRange.aEnd.Col(), mrRange.aEnd.Row());
+ }
};
-class FindByIndex : public unary_function<ScDBData, bool>
+class FindByIndex : public unary_function<std::unique_ptr<ScDBData>, bool>
{
sal_uInt16 mnIndex;
public:
FindByIndex(sal_uInt16 nIndex) : mnIndex(nIndex) {}
- bool operator() (const ScDBData& r) const
+ bool operator() (std::unique_ptr<ScDBData> const& p) const
{
- return r.GetIndex() == mnIndex;
+ return p->GetIndex() == mnIndex;
}
};
-class FindByUpperName : public unary_function<ScDBData, bool>
+class FindByUpperName : public unary_function<std::unique_ptr<ScDBData>, bool>
{
const OUString& mrName;
public:
FindByUpperName(const OUString& rName) : mrName(rName) {}
- bool operator() (const ScDBData& r) const
+ bool operator() (std::unique_ptr<ScDBData> const& p) const
{
- return r.GetUpperName() == mrName;
+ return p->GetUpperName() == mrName;
}
};
@@ -779,41 +796,54 @@ public:
ScDBCollection::NamedDBs::NamedDBs(ScDBCollection& rParent, ScDocument& rDoc) :
mrParent(rParent), mrDoc(rDoc) {}
-ScDBCollection::NamedDBs::NamedDBs(const NamedDBs& r) :
- maDBs(r.maDBs), mrParent(r.mrParent), mrDoc(r.mrDoc) {}
+ScDBCollection::NamedDBs::NamedDBs(const NamedDBs& r)
+ : mrParent(r.mrParent)
+ , mrDoc(r.mrDoc)
+{
+ for (auto const& it : r.m_DBs)
+ {
+ m_DBs.insert(std::unique_ptr<ScDBData>(new ScDBData(*it)));
+ }
+}
ScDBCollection::NamedDBs::iterator ScDBCollection::NamedDBs::begin()
{
- return maDBs.begin();
+ return m_DBs.begin();
}
ScDBCollection::NamedDBs::iterator ScDBCollection::NamedDBs::end()
{
- return maDBs.end();
+ return m_DBs.end();
}
ScDBCollection::NamedDBs::const_iterator ScDBCollection::NamedDBs::begin() const
{
- return maDBs.begin();
+ return m_DBs.begin();
}
ScDBCollection::NamedDBs::const_iterator ScDBCollection::NamedDBs::end() const
{
- return maDBs.end();
+ return m_DBs.end();
}
ScDBData* ScDBCollection::NamedDBs::findByIndex(sal_uInt16 nIndex)
{
DBsType::iterator itr = find_if(
- maDBs.begin(), maDBs.end(), FindByIndex(nIndex));
- return itr == maDBs.end() ? NULL : &(*itr);
+ m_DBs.begin(), m_DBs.end(), FindByIndex(nIndex));
+ return itr == m_DBs.end() ? nullptr : itr->get();
}
ScDBData* ScDBCollection::NamedDBs::findByUpperName(const OUString& rName)
{
DBsType::iterator itr = find_if(
- maDBs.begin(), maDBs.end(), FindByUpperName(rName));
- return itr == maDBs.end() ? NULL : &(*itr);
+ m_DBs.begin(), m_DBs.end(), FindByUpperName(rName));
+ return itr == m_DBs.end() ? nullptr : itr->get();
+}
+
+auto ScDBCollection::NamedDBs::findByUpperName2(const OUString& rName) -> iterator
+{
+ return find_if(
+ m_DBs.begin(), m_DBs.end(), FindByUpperName(rName));
}
bool ScDBCollection::NamedDBs::insert(ScDBData* p)
@@ -822,7 +852,7 @@ bool ScDBCollection::NamedDBs::insert(ScDBData* p)
if (!pData->GetIndex())
pData->SetIndex(mrParent.nEntryIndex++);
- pair<DBsType::iterator, bool> r = o3tl::ptr_container::insert(maDBs, std::move(pData));
+ pair<DBsType::iterator, bool> r = m_DBs.insert(std::move(pData));
if (r.second && p->HasImportParam() && !p->HasImportSelection())
{
@@ -834,27 +864,22 @@ bool ScDBCollection::NamedDBs::insert(ScDBData* p)
void ScDBCollection::NamedDBs::erase(iterator itr)
{
- maDBs.erase(itr);
-}
-
-void ScDBCollection::NamedDBs::erase(const ScDBData& r)
-{
- maDBs.erase(r);
+ m_DBs.erase(itr);
}
bool ScDBCollection::NamedDBs::empty() const
{
- return maDBs.empty();
+ return m_DBs.empty();
}
size_t ScDBCollection::NamedDBs::size() const
{
- return maDBs.size();
+ return m_DBs.size();
}
bool ScDBCollection::NamedDBs::operator== (const NamedDBs& r) const
{
- return maDBs == r.maDBs;
+ return m_DBs == r.m_DBs;
}
ScDBCollection::AnonDBs::iterator ScDBCollection::AnonDBs::begin()
@@ -946,7 +971,7 @@ const ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab
NamedDBs::DBsType::const_iterator itr = find_if(
maNamedDBs.begin(), maNamedDBs.end(), FindByCursor(nCol, nRow, nTab, bStartOnly));
if (itr != maNamedDBs.end())
- return &(*itr);
+ return itr->get();
// Check for the sheet-local anonymous db range.
const ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
@@ -970,7 +995,7 @@ ScDBData* ScDBCollection::GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool
NamedDBs::DBsType::iterator itr = find_if(
maNamedDBs.begin(), maNamedDBs.end(), FindByCursor(nCol, nRow, nTab, bStartOnly));
if (itr != maNamedDBs.end())
- return &(*itr);
+ return itr->get();
// Check for the sheet-local anonymous db range.
ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
@@ -995,7 +1020,7 @@ const ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1
NamedDBs::DBsType::const_iterator itr = find_if(
maNamedDBs.begin(), maNamedDBs.end(), FindByRange(aRange));
if (itr != maNamedDBs.end())
- return &(*itr);
+ return itr->get();
// Check for the sheet-local anonymous db range.
ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
@@ -1024,7 +1049,7 @@ ScDBData* ScDBCollection::GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCO
NamedDBs::DBsType::iterator itr = find_if(
maNamedDBs.begin(), maNamedDBs.end(), FindByRange(aRange));
if (itr != maNamedDBs.end())
- return &(*itr);
+ return itr->get();
// Check for the sheet-local anonymous db range.
ScDBData* pNoNameData = pDoc->GetAnonymousDBData(nTab);
@@ -1055,7 +1080,7 @@ void ScDBCollection::DeleteOnTab( SCTAB nTab )
NamedDBs::DBsType::iterator itr = maNamedDBs.begin(), itrEnd = maNamedDBs.end();
for (; itr != itrEnd; ++itr)
{
- if (func(*itr))
+ if (func(**itr))
v.push_back(itr);
}
}
@@ -1109,17 +1134,17 @@ ScDBData* ScDBCollection::GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab )
SCTAB nAreaTab;
SCCOL nStartCol, nEndCol;
SCROW nStartRow, nEndRow;
- itr->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
+ (*itr)->GetArea( nAreaTab, nStartCol, nStartRow, nEndCol, nEndRow );
if ( nTab == nAreaTab && nCol+1 >= nStartCol && nCol <= nEndCol+1 &&
nRow+1 >= nStartRow && nRow <= nEndRow+1 )
{
if ( nCol < nStartCol || nCol > nEndCol || nRow < nStartRow || nRow > nEndRow )
{
if (!pNearData)
- pNearData = &(*itr); // remember first adjacent area
+ pNearData = itr->get(); // remember first adjacent area
}
else
- return &(*itr); // not "unbenannt"/"unnamed" and cursor within
+ return itr->get(); // not "unbenannt"/"unnamed" and cursor within
}
}
if (pNearData)
diff --git a/sc/source/core/tool/rangeutl.cxx b/sc/source/core/tool/rangeutl.cxx
index 7c5f13d6f843..3ffcc5454396 100644
--- a/sc/source/core/tool/rangeutl.cxx
+++ b/sc/source/core/tool/rangeutl.cxx
@@ -1025,7 +1025,7 @@ bool ScAreaNameIterator::Next( OUString& rName, ScRange& rRange )
{
if (pDBCollection && maDBPos != maDBEnd)
{
- const ScDBData& rData = *maDBPos;
+ const ScDBData& rData = **maDBPos;
++maDBPos;
rData.GetArea(rRange);
rName = rData.GetName();
diff --git a/sc/source/core/tool/tokenstringcontext.cxx b/sc/source/core/tool/tokenstringcontext.cxx
index 44babecdc21f..4517975aeaef 100644
--- a/sc/source/core/tool/tokenstringcontext.cxx
+++ b/sc/source/core/tool/tokenstringcontext.cxx
@@ -83,7 +83,7 @@ TokenStringContext::TokenStringContext( const ScDocument* pDoc, formula::Formula
ScDBCollection::NamedDBs::const_iterator it = rNamedDBs.begin(), itEnd = rNamedDBs.end();
for (; it != itEnd; ++it)
{
- const ScDBData& rData = *it;
+ const ScDBData& rData = **it;
maNamedDBs.insert(IndexNameMapType::value_type(rData.GetIndex(), rData.GetName()));
}
}
diff --git a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
index e9bf1236546c..3673e87793e7 100644
--- a/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
+++ b/sc/source/filter/xml/XMLExportDatabaseRanges.cxx
@@ -160,6 +160,11 @@ public:
write(rData.GetName(), rData);
}
+ void operator() (std::unique_ptr<ScDBData> const& p)
+ {
+ return operator()(*p);
+ }
+
private:
void write(const OUString& rName, const ScDBData& rData)
{
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index 57288e033ae9..7054af63037e 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -343,7 +343,7 @@ bool ScInputWindow::UseSubTotal(ScRangeList* pRangeList)
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (; !bSubTotal && itr != itrEnd; ++itr)
{
- const ScDBData& rDB = *itr;
+ const ScDBData& rDB = **itr;
if (!rDB.HasAutoFilter())
continue;
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index df1beb0e18e6..8854ecdd082c 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -341,7 +341,7 @@ void ScDbNameDlg::UpdateNames()
{
DBsType::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (; itr != itrEnd; ++itr)
- m_pEdName->InsertEntry(itr->GetName());
+ m_pEdName->InsertEntry((*itr)->GetName());
}
else
{
@@ -504,14 +504,14 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl)
namespace {
-class FindByName : public ::std::unary_function<ScDBData, bool>
+class FindByName : public ::std::unary_function<std::unique_ptr<ScDBData>, bool>
{
const OUString& mrName;
public:
FindByName(const OUString& rName) : mrName(rName) {}
- bool operator() (const ScDBData& r) const
+ bool operator() (std::unique_ptr<ScDBData> const& p) const
{
- return r.GetName().equals(mrName);
+ return p->GetName().equals(mrName);
}
};
@@ -539,7 +539,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, RemoveBtnHdl)
SCTAB nTab;
SCCOL nColStart, nColEnd;
SCROW nRowStart, nRowEnd;
- itr->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd );
+ (*itr)->GetArea( nTab, nColStart, nRowStart, nColEnd, nRowEnd );
aRemoveList.push_back(
ScRange( ScAddress( nColStart, nRowStart, nTab ),
ScAddress( nColEnd, nRowEnd, nTab ) ) );
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index ff748c484cfa..e7bf8faecbe2 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -118,8 +118,8 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
bool bUndo = rDoc.IsUndoEnabled();
ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
- const ScDBData* p = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rName));
- if (p)
+ auto const iter = rDBs.findByUpperName2(ScGlobal::pCharClass->uppercase(rName));
+ if (iter != rDBs.end())
{
ScDocShellModificator aModificator( rDocShell );
@@ -128,7 +128,7 @@ bool ScDBDocFunc::DeleteDBRange(const OUString& rName)
pUndoColl = new ScDBCollection( *pDocColl );
rDoc.PreprocessDBDataUpdate();
- rDBs.erase(*p);
+ rDBs.erase(iter);
rDoc.CompileHybridFormula();
if (bUndo)
@@ -153,18 +153,18 @@ bool ScDBDocFunc::RenameDBRange( const OUString& rOld, const OUString& rNew )
ScDBCollection* pDocColl = rDoc.GetDBCollection();
bool bUndo = rDoc.IsUndoEnabled();
ScDBCollection::NamedDBs& rDBs = pDocColl->getNamedDBs();
- const ScDBData* pOld = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rOld));
+ auto const iterOld = rDBs.findByUpperName2(ScGlobal::pCharClass->uppercase(rOld));
const ScDBData* pNew = rDBs.findByUpperName(ScGlobal::pCharClass->uppercase(rNew));
- if (pOld && !pNew)
+ if (iterOld != rDBs.end() && !pNew)
{
ScDocShellModificator aModificator( rDocShell );
- ScDBData* pNewData = new ScDBData(rNew, *pOld);
+ ScDBData* pNewData = new ScDBData(rNew, **iterOld);
ScDBCollection* pUndoColl = new ScDBCollection( *pDocColl );
rDoc.PreprocessDBDataUpdate();
- rDBs.erase(*pOld);
+ rDBs.erase(iterOld);
bool bInserted = rDBs.insert(pNewData);
if (!bInserted) // Fehler -> alten Zustand wiederherstellen
{
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index f2ade2a7072c..a2225f564f50 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -496,7 +496,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
ScDBCollection::NamedDBs::iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (; itr != itrEnd; ++itr)
{
- ScDBData& rDBData = *itr;
+ ScDBData& rDBData = **itr;
if ( rDBData.IsStripData() &&
rDBData.HasImportParam() && !rDBData.HasImportSelection() )
{
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index ab70ebcaf7ed..5dd7d765b7db 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -902,7 +902,7 @@ void ScContentTree::GetDbNames()
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (; itr != itrEnd; ++itr)
{
- const OUString& aStrName = itr->GetName();
+ const OUString& aStrName = (*itr)->GetName();
InsertContent(SC_CONTENT_DBAREA, aStrName);
}
}
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index eb2b7d17abab..7bda63839dba 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -2249,7 +2249,7 @@ ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByIndex_Impl(size_t nIndex)
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin();
::std::advance(itr, nIndex); // boundary check is done above.
- return new ScDatabaseRangeObj(pDocShell, itr->GetName());
+ return new ScDatabaseRangeObj(pDocShell, (*itr)->GetName());
}
ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByName_Impl(const OUString& aName)
@@ -2380,7 +2380,7 @@ uno::Sequence<OUString> SAL_CALL ScDatabaseRangesObj::getElementNames()
uno::Sequence<OUString> aSeq(rDBs.size());
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (size_t i = 0; itr != itrEnd; ++itr, ++i)
- aSeq[i] = itr->GetName();
+ aSeq[i] = (*itr)->GetName();
return aSeq;
}
diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 9bb397d4a5bb..d16b70dab1ed 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -719,7 +719,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq )
const ScDBCollection::NamedDBs& rDBs = pDBCol->getNamedDBs();
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (; itr != itrEnd; ++itr)
- aList.push_back(itr->GetName());
+ aList.push_back((*itr)->GetName());
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 8890c4b8c713..8633840f517e 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -1601,7 +1601,8 @@ void ScTabViewShell::Construct( TriState nForceDesignMode )
ScDBCollection::NamedDBs::const_iterator itr = rDBs.begin(), itrEnd = rDBs.end();
for (; itr != itrEnd; ++itr)
{
- if (itr->IsStripData() && itr->HasImportParam() && !itr->HasImportSelection())
+ if ((*itr)->IsStripData() && (*itr)->HasImportParam()
+ && !(*itr)->HasImportSelection())
{
bReImport = true;
break;