[Libreoffice-commits] core.git: editeng/source

Takeshi Abe tabe at fixedpoint.jp
Thu May 21 03:09:35 PDT 2015


 editeng/source/accessibility/AccessibleStaticTextBase.cxx |    4 +--
 editeng/source/editeng/editobj.cxx                        |   15 ++++----------
 2 files changed, 7 insertions(+), 12 deletions(-)

New commits:
commit 7fa3d4db1db47a7a62fdd66485a286d331a3587f
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Mon May 18 14:17:06 2015 +0900

    editeng: simplify code by std::none_of
    
    Change-Id: I6fb427b4e3d1179cf9291daa7204f3892a8e271f
    Reviewed-on: https://gerrit.libreoffice.org/15838
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index 6a1c21c..4f1c07f 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 ecee5b6..c9cce3d 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -49,6 +49,7 @@
 #include <tools/tenccvt.hxx>
 
 #include <libxml/xmlwriter.h>
+#include <algorithm>
 
 #if DEBUG_EDIT_ENGINE
 #include <iostream>
@@ -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?!" );


More information about the Libreoffice-commits mailing list