Kaydet (Commit) 003ba905 authored tarafından Michael Stahl's avatar Michael Stahl

sc: replace boost::ptr_map with std::map<std::unique_ptr>

Change-Id: I0cc3addefa436050259785ccf2ce540a84e9fcae
üst e61465d2
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <sal/config.h> #include <sal/config.h>
#include <o3tl/ptr_container.hxx>
#include <svl/zforlist.hxx> #include <svl/zforlist.hxx>
#include <sal/macros.h> #include <sal/macros.h>
...@@ -2398,12 +2397,13 @@ bool ScXMLImport::GetValidation(const OUString& sName, ScMyImportValidation& aVa ...@@ -2398,12 +2397,13 @@ bool ScXMLImport::GetValidation(const OUString& sName, ScMyImportValidation& aVa
void ScXMLImport::AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp) void ScXMLImport::AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp)
{ {
::std::unique_ptr<ScMyNamedExpression> p(pNamedExp); ::std::unique_ptr<ScMyNamedExpression> p(pNamedExp);
SheetNamedExpMap::iterator itr = maSheetNamedExpressions.find(nTab); SheetNamedExpMap::iterator itr = m_SheetNamedExpressions.find(nTab);
if (itr == maSheetNamedExpressions.end()) if (itr == m_SheetNamedExpressions.end())
{ {
// No chain exists for this sheet. Create one. // No chain exists for this sheet. Create one.
::std::unique_ptr<ScMyNamedExpressions> pNew(new ScMyNamedExpressions); ::std::unique_ptr<ScMyNamedExpressions> pNew(new ScMyNamedExpressions);
::std::pair<SheetNamedExpMap::iterator, bool> r = o3tl::ptr_container::insert(maSheetNamedExpressions, nTab, std::move(pNew)); ::std::pair<SheetNamedExpMap::iterator, bool> r =
m_SheetNamedExpressions.insert(std::make_pair(nTab, std::move(pNew)));
if (!r.second) if (!r.second)
// insertion failed. // insertion failed.
return; return;
...@@ -3157,15 +3157,14 @@ void ScXMLImport::SetSheetNamedRanges() ...@@ -3157,15 +3157,14 @@ void ScXMLImport::SetSheetNamedRanges()
if (!pDoc) if (!pDoc)
return; return;
SheetNamedExpMap::const_iterator itr = maSheetNamedExpressions.begin(), itrEnd = maSheetNamedExpressions.end(); for (auto const& itr : m_SheetNamedExpressions)
for (; itr != itrEnd; ++itr)
{ {
SCTAB nTab = itr->first; const SCTAB nTab = itr.first;
ScRangeName* pRangeNames = pDoc->GetRangeName(nTab); ScRangeName* pRangeNames = pDoc->GetRangeName(nTab);
if (!pRangeNames) if (!pRangeNames)
continue; continue;
const ScMyNamedExpressions& rNames = *itr->second; const ScMyNamedExpressions& rNames = *itr.second;
::std::for_each(rNames.begin(), rNames.end(), RangeNameInserter(pDoc, *pRangeNames, *this)); ::std::for_each(rNames.begin(), rNames.end(), RangeNameInserter(pDoc, *pRangeNames, *this));
} }
} }
......
...@@ -42,12 +42,13 @@ ...@@ -42,12 +42,13 @@
#include <com/sun/star/util/XNumberFormatTypes.hpp> #include <com/sun/star/util/XNumberFormatTypes.hpp>
#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp> #include <com/sun/star/sheet/XSheetCellRangeContainer.hpp>
#include <boost/noncopyable.hpp>
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>
#include <map>
#include <vector> #include <vector>
#include <list> #include <list>
#include <boost/ptr_container/ptr_map.hpp>
#include <boost/noncopyable.hpp>
class ScMyStyleNumberFormats; class ScMyStyleNumberFormats;
class XMLNumberFormatAttributesExportHelper; class XMLNumberFormatAttributesExportHelper;
...@@ -823,7 +824,7 @@ class ScXMLEditAttributeMap; ...@@ -823,7 +824,7 @@ class ScXMLEditAttributeMap;
class ScXMLImport: public SvXMLImport, boost::noncopyable class ScXMLImport: public SvXMLImport, boost::noncopyable
{ {
typedef std::unordered_map< OUString, sal_Int16, OUStringHash > CellTypeMap; typedef std::unordered_map< OUString, sal_Int16, OUStringHash > CellTypeMap;
typedef ::boost::ptr_map<SCTAB, ScMyNamedExpressions> SheetNamedExpMap; typedef ::std::map<SCTAB, std::unique_ptr<ScMyNamedExpressions>> SheetNamedExpMap;
CellTypeMap aCellTypeMap; CellTypeMap aCellTypeMap;
...@@ -939,7 +940,7 @@ class ScXMLImport: public SvXMLImport, boost::noncopyable ...@@ -939,7 +940,7 @@ class ScXMLImport: public SvXMLImport, boost::noncopyable
ScMyTables aTables; ScMyTables aTables;
ScMyNamedExpressions* m_pMyNamedExpressions; ScMyNamedExpressions* m_pMyNamedExpressions;
SheetNamedExpMap maSheetNamedExpressions; SheetNamedExpMap m_SheetNamedExpressions;
ScMyLabelRanges* pMyLabelRanges; ScMyLabelRanges* pMyLabelRanges;
ScMyImportValidations* pValidations; ScMyImportValidations* pValidations;
......
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