Cleanup in sfx2 tree
Replaced a few std::for_each occurences by range based for loops,
and the only boost::bind in such tree by a lambda, alongside with
a bind2nd call and boost/bind.hxx headers cleanup.
Change-Id: Ie5e58f5b7d23ec846fd7457a6bad0132e0278dbf
Reviewed-on: https://gerrit.libreoffice.org/19662
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx
index 8d93542..a1876f8 100644
--- a/sfx2/inc/pch/precompiled_sfx.hxx
+++ b/sfx2/inc/pch/precompiled_sfx.hxx
@@ -40,7 +40,6 @@
#include <basic/sbxmeth.hxx>
#include <basic/sbxobj.hxx>
#include <basic/sbxvar.hxx>
#include <boost/bind.hpp>
#include <boost/logic/tribool.hpp>
#include <boost/noncopyable.hpp>
#include <boost/optional.hpp>
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 580de68..5679c35 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -1197,8 +1197,8 @@ void SfxFilterContainer::ReadFilters_Impl( bool bUpdate )
{
// global filter arry was modified, factory specific ones might need an
// update too
std::for_each(aImplArr.begin(), aImplArr.end(),
std::mem_fun_ref(&SfxFilterMatcher_Impl::Update));
for (auto& aImpl : aImplArr)
aImpl.Update();
}
}
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index 1122f80..385cf2a 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -48,14 +48,9 @@
#include <libxml/tree.h>
#include <boost/bind.hpp>
#include <boost/tuple/tuple.hpp>
#include <vector>
#include <set>
#include <map>
#include <functional>
#include <algorithm>
#include <unotools/ucbhelper.hxx>
#include <com/sun/star/uri/XUriReference.hpp>
@@ -890,9 +885,9 @@ throw (uno::RuntimeException, lang::IllegalArgumentException, std::exception)
getAllParts(*m_pImpl) );
::std::remove_copy_if(parts.begin(), parts.end(),
::std::back_inserter(ret),
::boost::bind(
::std::logical_not<bool>(),
::boost::bind(&isPartOfType, ::boost::ref(*m_pImpl), _1, i_xType) ));
[this, &i_xType](uno::Reference< rdf::XURI > aPart) {
return !isPartOfType(*m_pImpl, aPart, i_xType);
} );
return ::comphelper::containerToSequence(ret);
}
@@ -1162,12 +1157,11 @@ throw (uno::RuntimeException, lang::IllegalArgumentException,
"exception", *this, uno::makeAny(e));
}
std::for_each(StgFiles.begin(), StgFiles.end(),
boost::bind(addContentOrStylesFileImpl, boost::ref(*m_pImpl), _1));
for (const auto& aStgFile : StgFiles)
addContentOrStylesFileImpl(*m_pImpl, aStgFile);
std::for_each(MfstMetadataFiles.begin(), MfstMetadataFiles.end(),
boost::bind(importFile, boost::ref(*m_pImpl),
i_xStorage, baseURI, i_xHandler, _1));
for (const auto& aMfstMetadataFile : MfstMetadataFiles)
importFile(*m_pImpl, i_xStorage, baseURI, i_xHandler, aMfstMetadataFile);
}
void SAL_CALL DocumentMetadataAccess::storeMetadataToStorage(
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx
index b5929b4..77cf953 100644
--- a/sfx2/source/doc/Metadatable.cxx
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -640,13 +640,11 @@ removeLink(Metadatable* i_pObject)
XmlIdRegistryDocument::~XmlIdRegistryDocument()
{
// notify all list elements that are actually in the clipboard
for (XmlIdMap_t::iterator iter(m_pImpl->m_XmlIdMap.begin());
iter != m_pImpl->m_XmlIdMap.end(); ++iter)
{
::std::for_each(iter->second.first.begin(), iter->second.first.end(),
removeLink);
::std::for_each(iter->second.second.begin(), iter->second.second.end(),
removeLink);
for (auto& aXmlId : m_pImpl->m_XmlIdMap) {
for (auto aLink : aXmlId.second.first)
removeLink(aLink);
for (auto aLink : aXmlId.second.second)
removeLink(aLink);
}
}
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 1d0717a..82e919e 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -577,7 +577,7 @@ namespace
io_rTypes.getConstArray(),
io_rTypes.getConstArray() + io_rTypes.getLength(),
aStrippedTypes.getArray(),
::std::bind2nd( ::std::equal_to< uno::Type >(), i_rTypeToStrip )
[&i_rTypeToStrip](const uno::Type& aType) { return aType == i_rTypeToStrip; }
);
io_rTypes = aStrippedTypes;
}
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index e67d9d9..42a2a81 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -39,8 +39,6 @@
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/ui/XToolPanel.hpp>
#include <boost/bind.hpp>
using namespace css;
using namespace css::uno;