From d935718b6ea067fb1e79dbdb2ee91d7e3f640f85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fridrich=20=C5=A0trba?= Date: Tue, 8 Feb 2011 17:39:31 +0100 Subject: [PATCH] Port stuff to our private implementation of SGI extensions --- canvas/source/factory/cf_service.cxx | 12 +- canvas/source/tools/spriteredrawmanager.cxx | 6 +- o3tl/inc/o3tl/compat_functional.hxx | 133 ++++++++++++++++++++ toolkit/source/controls/dialogcontrol.cxx | 8 +- 4 files changed, 146 insertions(+), 13 deletions(-) create mode 100644 o3tl/inc/o3tl/compat_functional.hxx diff --git a/canvas/source/factory/cf_service.cxx b/canvas/source/factory/cf_service.cxx index fb54ae3e8c6c..3ce6cfeacd22 100644 --- a/canvas/source/factory/cf_service.cxx +++ b/canvas/source/factory/cf_service.cxx @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) @@ -270,7 +270,7 @@ Sequence CanvasFactory::getAvailableServiceNames() std::transform(m_aAvailableImplementations.begin(), m_aAvailableImplementations.end(), aServiceNames.getArray(), - std::select1st()); + o3tl::select1st()); return aServiceNames; } @@ -355,7 +355,7 @@ Reference CanvasFactory::lookupAndUse( boost::bind(&OUString::equals, boost::cref(serviceName), boost::bind( - std::select1st(), + o3tl::select1st(), _1)))) != aEnd ) { Reference xCanvas( use( aMatch->second, args, xContext ) ); @@ -371,7 +371,7 @@ Reference CanvasFactory::lookupAndUse( boost::bind(&OUString::equals, boost::cref(serviceName), boost::bind( - std::select1st(), + o3tl::select1st(), _1)))) == aAvailEnd ) { return Reference(); @@ -384,7 +384,7 @@ Reference CanvasFactory::lookupAndUse( boost::bind(&OUString::equals, boost::cref(serviceName), boost::bind( - std::select1st(), + o3tl::select1st(), _1)))) == aAAEnd ) { return Reference(); @@ -397,7 +397,7 @@ Reference CanvasFactory::lookupAndUse( boost::bind(&OUString::equals, boost::cref(serviceName), boost::bind( - std::select1st(), + o3tl::select1st(), _1)))) == aAccelEnd ) { return Reference(); diff --git a/canvas/source/tools/spriteredrawmanager.cxx b/canvas/source/tools/spriteredrawmanager.cxx index a9984c5b0383..32faba6eaec4 100644 --- a/canvas/source/tools/spriteredrawmanager.cxx +++ b/canvas/source/tools/spriteredrawmanager.cxx @@ -39,7 +39,7 @@ #include #include -#include +#include #include @@ -426,7 +426,7 @@ namespace canvas aEnd, ::boost::bind( ::basegfx::B2DRangeExpander(aTrueArea), ::boost::bind( &SpriteInfo::getUpdateArea, - ::boost::bind( ::std::select2nd(), + ::boost::bind( ::o3tl::select2nd(), _1 ) ) ) ); // and check whether _any_ of the sprites tells that its area @@ -452,7 +452,7 @@ namespace canvas aEnd, ::boost::bind( &SpriteInfo::needsUpdate, ::boost::bind( - ::std::select2nd(), + ::o3tl::select2nd(), _1 ) ) ) != aEnd ); } diff --git a/o3tl/inc/o3tl/compat_functional.hxx b/o3tl/inc/o3tl/compat_functional.hxx new file mode 100644 index 000000000000..40c78ff9b449 --- /dev/null +++ b/o3tl/inc/o3tl/compat_functional.hxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * + * Copyright (c) 1994 + * Hewlett-Packard Company + * + * Copyright (c) 1996-1998 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1997 + * Moscow Center for SPARC Technology + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ + +/* + * Lifted and paraphrased from STLport + */ + +#ifndef INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX +#define INCLUDED_O3TL_COMPAT_FUNCTIONAL_HXX + +#include + +namespace o3tl +{ + +template +struct identity : public std::unary_function +{ + T operator()(const T& y) const + { + return (y); + } +}; + +template +struct project1st : public std::binary_function +{ + T1 operator()(const T1& y, const T2&) const + { + return (y); + } +}; + +template +struct project2nd : public std::binary_function +{ + T2 operator()(const T1&, const T2& x) const + { + return (x); + } +}; + +template +struct select1st : public std::unary_function +{ + const typename P::first_type& operator()(const P& y) const + { + return (y.first); + } +}; + +template +struct select2nd : public std::unary_function +{ + const typename P::second_type& operator()(const P& y) const + { + return (y.second); + } +}; + +template +class unary_compose : public std::unary_function +{ + public: + unary_compose(const F1& fnction1, const F2& fnction2) : ftor1(fnction1), ftor2(fnction2) {} + + typename F1::result_type operator()(const typename F2::argument_type& y) const + { + return (ftor1(ftor2(y))); + } + + protected: + F1 ftor1; + F2 ftor2; +}; + +template +inline unary_compose compose1(const F1& fnction1, const F2& fnction2) +{ + return (unary_compose(fnction1, fnction2)); +} + +template +class binary_compose : public std::unary_function +{ + public: + binary_compose(const F1& fnction1, const F2& fnction2, const F3& fnction3) : ftor1(fnction1), ftor2(fnction2), ftor3(fnction3) {} + + typename F1::result_type operator()(const typename F2::argument_type& y) const + { + return (ftor1(ftor2(y), ftor3(y))); + } + + protected: + F1 ftor1; + F2 ftor2; + F3 ftor3; +}; + +template +inline binary_compose compose2(const F1& fnction1, const F2& fnction2, const F3& fnction3) +{ + return (binary_compose(fnction1, fnction2, fnction3)); +} + +} // namespace o3tl + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 6b7aadc7da8f..c23b91ff6834 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -70,7 +70,7 @@ #include #include #include -#include +#include #include "tools/urlobj.hxx" #include "osl/file.hxx" #include @@ -477,7 +477,7 @@ void SAL_CALL UnoControlDialogModel::dispose( ) throw(RuntimeException) ::std::transform( maModels.begin(), maModels.end(), // source range aChildModels.begin(), // target location - ::std::select1st< UnoControlModelHolder >( ) // operation to apply -> select the XControlModel part + ::o3tl::select1st< UnoControlModelHolder >( ) // operation to apply -> select the XControlModel part ); // now dispose @@ -780,7 +780,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getElementNames() throw(Runti ::std::transform( maModels.begin(), maModels.end(), // source range aNames.getArray(), // target range - ::std::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name) + ::o3tl::select2nd< UnoControlModelHolder >() // operator to apply: select the second element (the name) ); return aNames; @@ -992,7 +992,7 @@ Sequence< Reference< XControlModel > > SAL_CALL UnoControlDialogModel::getContro ::std::transform( aSortedModels.begin(), aSortedModels.end(), ::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ), - ::std::select2nd< MapIndexToModel::value_type >( ) + ::o3tl::select2nd< MapIndexToModel::value_type >( ) ); return aReturn;