diff options
author | Arkadiy Illarionov <qarkai@gmail.com> | 2018-08-29 00:47:33 +0300 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-29 11:40:29 +0200 |
commit | 085269d25a705b656436feac47149296b4b4b35d (patch) | |
tree | 3195c0526652ebd9e125507aa17cd15b2acfb368 /writerfilter | |
parent | b0e74b65a86eb965c3e93da2fb77972cc5445f3c (diff) |
Replace find_if with proper quantifier algorithms
Change-Id: Icc820a47ac891c358883f9c01224f676c58fdd11
Reviewed-on: https://gerrit.libreoffice.org/59744
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 14 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 5 |
2 files changed, 6 insertions, 13 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 508e74e017ae..e881f279a83f 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1397,11 +1397,10 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq; m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq; auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq); - auto itPrevParaAutoAfter = std::find_if(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) + bool bPrevParaAutoAfter = std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "ParaBottomMarginAfterAutoSpacing"; }); - bool bPrevParaAutoAfter = itPrevParaAutoAfter != aPrevProperties.end(); if (bPrevParaAutoAfter) { // Previous after spacing is set to auto, set previous after space to 0. @@ -1453,22 +1452,18 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // set top margin of the previous auto paragraph in cells, keeping zero bottom margin only at the first one if (m_nTableDepth > 0 && m_nTableDepth == m_nTableCellDepth && m_xPreviousParagraph.is()) { - bool bParaChangedTopMargin = false; - auto itParaTopMargin = std::find_if(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue) + bool bParaChangedTopMargin = std::any_of(aProperties.begin(), aProperties.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "ParaTopMargin"; }); - if (itParaTopMargin != aProperties.end()) - bParaChangedTopMargin = true; uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq; m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq; auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq); - auto itPrevParaAutoBefore = std::find_if(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) + bool bPrevParaAutoBefore = std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "ParaTopMarginBeforeAutoSpacing"; }); - bool bPrevParaAutoBefore = itPrevParaAutoBefore != aPrevProperties.end(); if ((bPrevParaAutoBefore && !bParaChangedTopMargin) || (bParaChangedTopMargin && m_bParaAutoBefore)) { @@ -2517,11 +2512,10 @@ void DomainMapper_Impl::ClearPreviousParagraph() uno::Sequence<beans::PropertyValue> aPrevPropertiesSeq; m_xPreviousParagraph->getPropertyValue("ParaInteropGrabBag") >>= aPrevPropertiesSeq; auto aPrevProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aPrevPropertiesSeq); - auto itPrevParaAutoAfter = std::find_if(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) + bool bPrevParaAutoAfter = std::any_of(aPrevProperties.begin(), aPrevProperties.end(), [](const beans::PropertyValue& rValue) { return rValue.Name == "ParaBottomMarginAfterAutoSpacing"; }); - bool bPrevParaAutoAfter = itPrevParaAutoAfter != aPrevProperties.end(); bool bPrevNumberingRules = false; uno::Reference<container::XNamed> xPreviousNumberingRules(m_xPreviousParagraph->getPropertyValue("NumberingRules"), uno::UNO_QUERY); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 29d5dedb7308..1c6c858bc12d 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2026,9 +2026,8 @@ void RTFDocumentImpl::resetAttributes() static bool lcl_containsProperty(const uno::Sequence<beans::Property>& rProperties, const OUString& rName) { - return std::find_if(rProperties.begin(), rProperties.end(), - [&](const beans::Property& rProperty) { return rProperty.Name == rName; }) - != rProperties.end(); + return std::any_of(rProperties.begin(), rProperties.end(), + [&](const beans::Property& rProperty) { return rProperty.Name == rName; }); } RTFError RTFDocumentImpl::popState() |