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

Takeshi Abe tabe at fixedpoint.jp
Thu Apr 30 04:51:38 PDT 2015


 xmloff/source/draw/XMLGraphicsDefaultStyle.cxx |   13 +++++++------
 xmloff/source/text/txtparae.cxx                |    5 +++--
 xmloff/source/xforms/TokenContext.cxx          |    5 ++---
 3 files changed, 12 insertions(+), 11 deletions(-)

New commits:
commit c675a2d669c191f3b18ae006c78ef83efba14c30
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Thu Apr 30 01:57:43 2015 +0900

    xmloff: simplify code by using std::all_of/std::any_of/std::none_of
    
    Change-Id: I87311d8989c23538983d45ad9b12a64080441d78
    Reviewed-on: https://gerrit.libreoffice.org/15569
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
index bcca5b8..3473e57 100644
--- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
+++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx
@@ -32,6 +32,7 @@
 #include <xmloff/maptype.hxx>
 
 #include "XMLShapePropertySetContext.hxx"
+#include <algorithm>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -149,8 +150,8 @@ void XMLGraphicsDefaultStyle::SetDefaults()
                 ->getPropertySetMapper());
         sal_Int32 const nStrokeIndex(
             pImpPrMap->GetEntryIndex(XML_NAMESPACE_SVG, "stroke-color", 0));
-        if (std::find_if(GetProperties().begin(), GetProperties().end(),
-                    XMLPropertyByIndex(nStrokeIndex)) == GetProperties().end())
+        if (std::none_of(GetProperties().begin(), GetProperties().end(),
+                         XMLPropertyByIndex(nStrokeIndex)))
         {
             sal_Int32 const nStroke(
                     (bIsAOO4) ? RGB_COLORDATA(128, 128, 128) : COL_BLACK);
@@ -160,8 +161,8 @@ void XMLGraphicsDefaultStyle::SetDefaults()
             ? RGB_COLORDATA(0xCF, 0xE7, 0xF5) : RGB_COLORDATA(153, 204, 255));
         sal_Int32 const nFillIndex(
             pImpPrMap->GetEntryIndex(XML_NAMESPACE_DRAW, "fill-color", 0));
-        if (std::find_if(GetProperties().begin(), GetProperties().end(),
-                    XMLPropertyByIndex(nFillIndex)) == GetProperties().end())
+        if (std::none_of(GetProperties().begin(), GetProperties().end(),
+                         XMLPropertyByIndex(nFillIndex)))
         {
             xDefaults->setPropertyValue("FillColor", makeAny(nFillColor));
         }
@@ -169,8 +170,8 @@ void XMLGraphicsDefaultStyle::SetDefaults()
         {
             sal_Int32 const nFill2Index(pImpPrMap->GetEntryIndex(
                         XML_NAMESPACE_DRAW, "secondary-fill-color", 0));
-            if (std::find_if(GetProperties().begin(), GetProperties().end(),
-                    XMLPropertyByIndex(nFill2Index)) == GetProperties().end())
+            if (std::none_of(GetProperties().begin(), GetProperties().end(),
+                             XMLPropertyByIndex(nFill2Index)))
             {
                 xDefaults->setPropertyValue("FillColor2", makeAny(nFillColor));
             }
diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx
index 5be4ccc..46a19e8 100644
--- a/xmloff/source/text/txtparae.cxx
+++ b/xmloff/source/text/txtparae.cxx
@@ -108,6 +108,7 @@
 #include <list>
 #include <unordered_map>
 #include <vector>
+#include <algorithm>
 
 using namespace ::std;
 using namespace ::com::sun::star;
@@ -665,7 +666,7 @@ void XMLTextParagraphExport::Add( sal_uInt16 nFamily,
             break;
         }
 
-        if( find_if( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) != xPropStates.end() )
+        if( std::any_of( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) )
         {
             GetAutoStylePool().Add( nFamily, sParent, xPropStates );
             if( !sCondParent.isEmpty() && sParent != sCondParent )
@@ -709,7 +710,7 @@ OUString XMLTextParagraphExport::Find(
             ++ppAddStates;
         }
     }
-    if( find_if( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) != xPropStates.end() )
+    if( std::any_of( xPropStates.begin(), xPropStates.end(), lcl_validPropState ) )
         sName = GetAutoStylePool().Find( nFamily, sName, xPropStates );
 
     return sName;
diff --git a/xmloff/source/xforms/TokenContext.cxx b/xmloff/source/xforms/TokenContext.cxx
index 6d07235..981c15e 100644
--- a/xmloff/source/xforms/TokenContext.cxx
+++ b/xmloff/source/xforms/TokenContext.cxx
@@ -19,8 +19,6 @@
 
 #include <sal/config.h>
 
-#include <functional>
-
 #include "TokenContext.hxx"
 #include <xmloff/xmltkmap.hxx>
 #include <xmloff/xmlimp.hxx>
@@ -28,6 +26,7 @@
 #include <xmloff/xmlerror.hxx>
 
 #include <tools/debug.hxx>
+#include <algorithm>
 
 using com::sun::star::uno::Reference;
 using com::sun::star::xml::sax::XAttributeList;
@@ -134,7 +133,7 @@ void TokenContext::Characters( const OUString& rCharacters )
     const sal_Unicode* pEnd = &( pBegin[ rCharacters.getLength() ] );
 
     // raise error if non-whitespace character is found
-    if( ::std::find_if( pBegin, pEnd, ::std::not1(::std::ptr_fun(lcl_IsWhiteSpace)) ) != pEnd )
+    if( !::std::all_of( pBegin, pEnd, lcl_IsWhiteSpace ) )
         GetImport().SetError( XMLERROR_UNKNOWN_CHARACTERS, rCharacters );
 }
 


More information about the Libreoffice-commits mailing list