From 7fa3d4db1db47a7a62fdd66485a286d331a3587f Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Mon, 18 May 2015 14:17:06 +0900 Subject: editeng: simplify code by std::none_of Change-Id: I6fb427b4e3d1179cf9291daa7204f3892a8e271f Reviewed-on: https://gerrit.libreoffice.org/15838 Tested-by: Jenkins Reviewed-by: Michael Stahl --- editeng/source/accessibility/AccessibleStaticTextBase.cxx | 4 ++-- editeng/source/editeng/editobj.cxx | 15 +++++---------- 2 files changed, 7 insertions(+), 12 deletions(-) (limited to 'editeng') diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx index 6a1c21c362c5..4f1c07f01365 100644 --- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx +++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx @@ -981,8 +981,8 @@ namespace accessibility { const beans::PropertyValue* pItr = aIntersectionSeq.getConstArray(); const beans::PropertyValue* pEnd = pItr + aIntersectionSeq.getLength(); - const beans::PropertyValue* pFind = ::std::find_if( pItr, pEnd, ::std::bind2nd( PropertyValueEqualFunctor(), boost::cref( pDefAttr[i] ) ) ); - if ( pFind == pEnd && pDefAttr[i].Handle != 0) + bool bNone = ::std::none_of( pItr, pEnd, ::std::bind2nd( PropertyValueEqualFunctor(), boost::cref( pDefAttr[i] ) ) ); + if ( bNone && pDefAttr[i].Handle != 0) { aDiffVec.push_back( pDefAttr[i] ); } diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index ecee5b62ef22..c9cce3d29bf9 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -49,6 +49,7 @@ #include #include +#include #if DEBUG_EDIT_ENGINE #include @@ -1191,11 +1192,8 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const for ( sal_uInt16 nChar = 0; nChar < rC.GetText().getLength(); nChar++ ) { const ContentInfo::XEditAttributesType& rAttribs = rC.aAttribs; - ContentInfo::XEditAttributesType::const_iterator it = - std::find_if(rAttribs.begin(), rAttribs.end(), - FindAttribByChar(EE_CHAR_FONTINFO, nChar)); - - if (it == rAttribs.end()) + if ( std::none_of(rAttribs.begin(), rAttribs.end(), + FindAttribByChar(EE_CHAR_FONTINFO, nChar)) ) { sal_Unicode cOld = rC.GetText()[ nChar ]; char cConv = OUStringToOString(OUString(ConvertFontToSubsFontChar(hConv, cOld)), RTL_TEXTENCODING_SYMBOL).toChar(); @@ -1454,11 +1452,8 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream ) for ( sal_uInt16 nChar = 0; nChar < pC->GetText().getLength(); nChar++ ) { const ContentInfo::XEditAttributesType& rAttribs = pC->aAttribs; - ContentInfo::XEditAttributesType::const_iterator it = - std::find_if(rAttribs.begin(), rAttribs.end(), - FindAttribByChar(EE_CHAR_FONTINFO, nChar)); - - if (it == rAttribs.end()) + if ( std::none_of(rAttribs.begin(), rAttribs.end(), + FindAttribByChar(EE_CHAR_FONTINFO, nChar)) ) { sal_Unicode cOld = pC->GetText()[ nChar ]; DBG_ASSERT( cOld >= 0xF000, "cOld not converted?!" ); -- cgit