summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/o3tl/deleter.hxx34
-rw-r--r--sc/inc/stlalgorithm.hxx13
-rw-r--r--sc/source/core/data/column.cxx3
-rw-r--r--sc/source/core/data/columnspanset.cxx4
-rw-r--r--sc/source/core/data/document.cxx4
-rw-r--r--sc/source/core/data/dptabres.cxx6
-rw-r--r--sc/source/core/data/table3.cxx4
-rw-r--r--sc/source/core/tool/chartlis.cxx7
-rw-r--r--sc/source/core/tool/rangelst.cxx6
-rw-r--r--sc/source/filter/xcl97/xcl97rec.cxx4
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx4
-rw-r--r--sc/source/ui/view/viewdata.cxx4
12 files changed, 59 insertions, 34 deletions
diff --git a/include/o3tl/deleter.hxx b/include/o3tl/deleter.hxx
new file mode 100644
index 000000000000..7f9e50dd9146
--- /dev/null
+++ b/include/o3tl/deleter.hxx
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_O3TL_DELETER_HXX
+#define INCLUDED_O3TL_DELETER_HXX
+
+#include <functional>
+
+namespace o3tl {
+
+/**
+ * Function object to allow deleting instances stored in STL containers as
+ * pointers.
+ */
+template<typename T>
+struct default_deleter : public std::unary_function<T*, void>
+{
+ void operator() (T* p)
+ {
+ delete p;
+ }
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/inc/stlalgorithm.hxx b/sc/inc/stlalgorithm.hxx
index d7b4d517b3d3..3c7014446fa4 100644
--- a/sc/inc/stlalgorithm.hxx
+++ b/sc/inc/stlalgorithm.hxx
@@ -15,19 +15,6 @@
#include <rtl/alloc.h>
-/**
- * Function object to allow deleting instances stored in STL containers as
- * pointers.
- */
-template<typename T>
-struct ScDeleteObjectByPtr : public ::std::unary_function<T*, void>
-{
- void operator() (T* p)
- {
- delete p;
- }
-};
-
namespace sc {
/**
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 443d8fd2f5db..4a25df7fd2ce 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -51,6 +51,7 @@
#include <svl/sharedstringpool.hxx>
#include <editeng/scripttypeitem.hxx>
#include <editeng/fieldupdater.hxx>
+#include <o3tl/deleter.hxx>
#include <cstring>
#include <map>
@@ -2227,7 +2228,7 @@ class UpdateRefOnNonCopy : std::unary_function<sc::FormulaGroupEntry, void>
if (!mpUndoDoc->SetFormulaCells(rOldPos, aCells))
// Insertion failed. Delete all formula cells.
- std::for_each(aCells.begin(), aCells.end(), ScDeleteObjectByPtr<ScFormulaCell>());
+ std::for_each(aCells.begin(), aCells.end(), o3tl::default_deleter<ScFormulaCell>());
}
public:
diff --git a/sc/source/core/data/columnspanset.cxx b/sc/source/core/data/columnspanset.cxx
index b06f9f7ed2c1..8cef96692b81 100644
--- a/sc/source/core/data/columnspanset.cxx
+++ b/sc/source/core/data/columnspanset.cxx
@@ -8,7 +8,6 @@
*/
#include "columnspanset.hxx"
-#include "stlalgorithm.hxx"
#include "column.hxx"
#include "table.hxx"
#include "document.hxx"
@@ -16,6 +15,7 @@
#include "markdata.hxx"
#include "rangelst.hxx"
#include <fstalgorithm.hxx>
+#include <o3tl/deleter.hxx>
#include <algorithm>
@@ -67,7 +67,7 @@ ColumnSpanSet::~ColumnSpanSet()
if (!pTab)
continue;
- std::for_each(pTab->begin(), pTab->end(), ScDeleteObjectByPtr<ColumnType>());
+ std::for_each(pTab->begin(), pTab->end(), o3tl::default_deleter<ColumnType>());
delete pTab;
}
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index d0db4bdd906d..02a1bbb0607a 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -84,7 +84,6 @@
#include "externalrefmgr.hxx"
#include "tabprotection.hxx"
#include "clipparam.hxx"
-#include "stlalgorithm.hxx"
#include "defaultsoptions.hxx"
#include "editutil.hxx"
#include "stringutil.hxx"
@@ -99,6 +98,7 @@
#include <tokenstringcontext.hxx>
#include <formula/vectortoken.hxx>
+#include <o3tl/deleter.hxx>
#include <map>
#include <limits>
@@ -785,7 +785,7 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets )
TableContainer::iterator it = maTabs.begin() + nTab;
TableContainer::iterator itEnd = it + nSheets;
- std::for_each(it, itEnd, ScDeleteObjectByPtr<ScTable>());
+ std::for_each(it, itEnd, o3tl::default_deleter<ScTable>());
maTabs.erase(it, itEnd);
// UpdateBroadcastAreas must be called between UpdateDeleteTab,
// which ends listening, and StartAllListeners, to not modify
diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx
index 792ebb43b497..542cf54e1be3 100644
--- a/sc/source/core/data/dptabres.cxx
+++ b/sc/source/core/data/dptabres.cxx
@@ -27,13 +27,13 @@
#include "dpitemdata.hxx"
#include "document.hxx"
-#include "stlalgorithm.hxx"
#include "dpresfilter.hxx"
#include "dputil.hxx"
#include <osl/diagnose.h>
#include <rtl/math.hxx>
#include <rtl/strbuf.hxx>
+#include <o3tl/deleter.hxx>
#include <math.h>
#include <float.h>
@@ -757,7 +757,7 @@ ScDPResultData::ScDPResultData( ScDPSource& rSrc ) :
ScDPResultData::~ScDPResultData()
{
- std::for_each(maDimMembers.begin(), maDimMembers.end(), ScDeleteObjectByPtr<ResultMembers>());
+ std::for_each(maDimMembers.begin(), maDimMembers.end(), o3tl::default_deleter<ResultMembers>());
}
void ScDPResultData::SetMeasureData(
@@ -3550,7 +3550,7 @@ ScDPDataDimension::ScDPDataDimension( const ScDPResultData* pData ) :
ScDPDataDimension::~ScDPDataDimension()
{
- std::for_each(maMembers.begin(), maMembers.end(), ScDeleteObjectByPtr<ScDPDataMember>());
+ std::for_each(maMembers.begin(), maMembers.end(), o3tl::default_deleter<ScDPDataMember>());
}
void ScDPDataDimension::InitFrom( const ScDPResultDimension* pDim )
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 22a2a09da47f..860d0777078f 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -56,13 +56,13 @@
#include "tokenarray.hxx"
#include "mtvcellfunc.hxx"
#include "columnspanset.hxx"
-#include <stlalgorithm.hxx>
#include <fstalgorithm.hxx>
#include <listenercontext.hxx>
#include <sharedformula.hxx>
#include <refhint.hxx>
#include <svl/sharedstringpool.hxx>
+#include <o3tl/deleter.hxx>
#include <vector>
#include <boost/scoped_ptr.hpp>
@@ -293,7 +293,7 @@ public:
delete[] pppInfo;
if (mpRows)
- std::for_each(mpRows->begin(), mpRows->end(), ScDeleteObjectByPtr<Row>());
+ std::for_each(mpRows->begin(), mpRows->end(), o3tl::default_deleter<Row>());
}
void SetKeepQuery( bool b ) { mbKeepQuery = b; }
diff --git a/sc/source/core/tool/chartlis.cxx b/sc/source/core/tool/chartlis.cxx
index db5c6cf34b0e..fafbf25c4e1a 100644
--- a/sc/source/core/tool/chartlis.cxx
+++ b/sc/source/core/tool/chartlis.cxx
@@ -23,7 +23,8 @@
#include "brdcst.hxx"
#include "document.hxx"
#include "reftokenhelper.hxx"
-#include "stlalgorithm.hxx"
+
+#include <o3tl/deleter.hxx>
using namespace com::sun::star;
using ::std::vector;
@@ -575,7 +576,7 @@ void ScChartListenerCollection::FreeUnused()
std::for_each(aUsed.begin(), aUsed.end(), InsertChartListener(maListeners));
// Now, delete the ones no longer needed.
- std::for_each(aUnused.begin(), aUnused.end(), ScDeleteObjectByPtr<ScChartListener>());
+ std::for_each(aUnused.begin(), aUnused.end(), o3tl::default_deleter<ScChartListener>());
}
void ScChartListenerCollection::FreeUno( const uno::Reference< chart::XChartDataChangeEventListener >& rListener,
@@ -603,7 +604,7 @@ void ScChartListenerCollection::FreeUno( const uno::Reference< chart::XChartData
std::for_each(aUsed.begin(), aUsed.end(), InsertChartListener(maListeners));
// Now, delete the ones no longer needed.
- std::for_each(aUnused.begin(), aUnused.end(), ScDeleteObjectByPtr<ScChartListener>());
+ std::for_each(aUnused.begin(), aUnused.end(), o3tl::default_deleter<ScChartListener>());
}
void ScChartListenerCollection::StartTimer()
diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx
index 37c7a0e425c3..c5b0d211bc4f 100644
--- a/sc/source/core/tool/rangelst.cxx
+++ b/sc/source/core/tool/rangelst.cxx
@@ -26,7 +26,7 @@
#include "refupdat.hxx"
#include "rechead.hxx"
#include "compiler.hxx"
-#include "stlalgorithm.hxx"
+#include <o3tl/deleter.hxx>
using ::std::vector;
using ::std::advance;
@@ -1073,7 +1073,7 @@ ScRange* ScRangeList::Remove(size_t nPos)
void ScRangeList::RemoveAll()
{
- for_each(maRanges.begin(), maRanges.end(), ScDeleteObjectByPtr<ScRange>());
+ for_each(maRanges.begin(), maRanges.end(), o3tl::default_deleter<ScRange>());
maRanges.clear();
}
@@ -1196,7 +1196,7 @@ ScRangeList ScRangeList::GetIntersectedRange(const ScRange& rRange) const
// ScRangePairList
ScRangePairList::~ScRangePairList()
{
- for_each( maPairs.begin(), maPairs.end(), ScDeleteObjectByPtr<ScRangePair>() );
+ for_each( maPairs.begin(), maPairs.end(), o3tl::default_deleter<ScRangePair>() );
maPairs.clear();
}
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 5f1853c8d3ee..abf9d3b107b0 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -56,6 +56,7 @@
#include <filter/msfilter/msoleexp.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <o3tl/deleter.hxx>
#include <stdio.h>
@@ -68,7 +69,6 @@
#include "docoptio.hxx"
#include "patattr.hxx"
#include "tabprotection.hxx"
-#include "stlalgorithm.hxx"
#include <com/sun/star/sheet/XCellAddressable.hpp>
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
@@ -109,7 +109,7 @@ XclExpObjList::XclExpObjList( const XclExpRoot& rRoot, XclEscherEx& rEscherEx )
XclExpObjList::~XclExpObjList()
{
- ::std::for_each(maObjs.begin(), maObjs.end(), ScDeleteObjectByPtr<XclObj>());
+ std::for_each(maObjs.begin(), maObjs.end(), o3tl::default_deleter<XclObj>());
delete pMsodrawingPerSheet;
delete pSolverContainer;
}
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 29e4efa1f889..e5cb28ebf47d 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -32,7 +32,6 @@
#include "compiler.hxx"
#include "reftokenhelper.hxx"
#include "chartlis.hxx"
-#include "stlalgorithm.hxx"
#include "tokenuno.hxx"
#include "docsh.hxx"
#include "cellvalue.hxx"
@@ -55,6 +54,7 @@
#include <comphelper/processfactory.hxx>
#include <rtl/math.hxx>
+#include <o3tl/deleter.hxx>
SC_SIMPLE_SERVICE_INFO( ScChart2DataProvider, "ScChart2DataProvider",
"com.sun.star.chart2.data.DataProvider")
@@ -156,7 +156,7 @@ struct TokenTable : boost::noncopyable
}
void clear()
{
- ::std::for_each(maTokens.begin(), maTokens.end(), ScDeleteObjectByPtr<FormulaToken>());
+ std::for_each(maTokens.begin(), maTokens.end(), o3tl::default_deleter<FormulaToken>());
}
void push_back( FormulaToken* pToken )
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 7df4869a0f2a..9b2331fc31da 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -61,6 +61,8 @@
#include <rtl/ustrbuf.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <o3tl/deleter.hxx>
+
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/document/NamedPropertyValues.hpp>
@@ -456,7 +458,7 @@ ScViewData::~ScViewData()
KillEditView();
delete pOptions;
::std::for_each(
- maTabData.begin(), maTabData.end(), ScDeleteObjectByPtr<ScViewDataTable>());
+ maTabData.begin(), maTabData.end(), o3tl::default_deleter<ScViewDataTable>());
}
void ScViewData::UpdateCurrentTab()