Port stuff to our private implementation of SGI extensions

This commit is contained in:
Fridrich Štrba 2011-02-08 17:39:31 +01:00
parent 63ec47e630
commit d935718b6e
4 changed files with 146 additions and 13 deletions

View File

@ -47,7 +47,7 @@
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <functional> #include <o3tl/compat_functional.hxx>
#include <algorithm> #include <algorithm>
#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
@ -270,7 +270,7 @@ Sequence<OUString> CanvasFactory::getAvailableServiceNames()
std::transform(m_aAvailableImplementations.begin(), std::transform(m_aAvailableImplementations.begin(),
m_aAvailableImplementations.end(), m_aAvailableImplementations.end(),
aServiceNames.getArray(), aServiceNames.getArray(),
std::select1st<AvailPair>()); o3tl::select1st<AvailPair>());
return aServiceNames; return aServiceNames;
} }
@ -355,7 +355,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
boost::bind(&OUString::equals, boost::bind(&OUString::equals,
boost::cref(serviceName), boost::cref(serviceName),
boost::bind( boost::bind(
std::select1st<CachePair>(), o3tl::select1st<CachePair>(),
_1)))) != aEnd ) _1)))) != aEnd )
{ {
Reference<XInterface> xCanvas( use( aMatch->second, args, xContext ) ); Reference<XInterface> xCanvas( use( aMatch->second, args, xContext ) );
@ -371,7 +371,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
boost::bind(&OUString::equals, boost::bind(&OUString::equals,
boost::cref(serviceName), boost::cref(serviceName),
boost::bind( boost::bind(
std::select1st<AvailPair>(), o3tl::select1st<AvailPair>(),
_1)))) == aAvailEnd ) _1)))) == aAvailEnd )
{ {
return Reference<XInterface>(); return Reference<XInterface>();
@ -384,7 +384,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
boost::bind(&OUString::equals, boost::bind(&OUString::equals,
boost::cref(serviceName), boost::cref(serviceName),
boost::bind( boost::bind(
std::select1st<AvailPair>(), o3tl::select1st<AvailPair>(),
_1)))) == aAAEnd ) _1)))) == aAAEnd )
{ {
return Reference<XInterface>(); return Reference<XInterface>();
@ -397,7 +397,7 @@ Reference<XInterface> CanvasFactory::lookupAndUse(
boost::bind(&OUString::equals, boost::bind(&OUString::equals,
boost::cref(serviceName), boost::cref(serviceName),
boost::bind( boost::bind(
std::select1st<AvailPair>(), o3tl::select1st<AvailPair>(),
_1)))) == aAccelEnd ) _1)))) == aAccelEnd )
{ {
return Reference<XInterface>(); return Reference<XInterface>();

View File

@ -39,7 +39,7 @@
#include <basegfx/range/rangeexpander.hxx> #include <basegfx/range/rangeexpander.hxx>
#include <algorithm> #include <algorithm>
#include <functional> #include <o3tl/compat_functional.hxx>
#include <boost/bind.hpp> #include <boost/bind.hpp>
@ -426,7 +426,7 @@ namespace canvas
aEnd, aEnd,
::boost::bind( ::basegfx::B2DRangeExpander(aTrueArea), ::boost::bind( ::basegfx::B2DRangeExpander(aTrueArea),
::boost::bind( &SpriteInfo::getUpdateArea, ::boost::bind( &SpriteInfo::getUpdateArea,
::boost::bind( ::std::select2nd<AreaComponent>(), ::boost::bind( ::o3tl::select2nd<AreaComponent>(),
_1 ) ) ) ); _1 ) ) ) );
// and check whether _any_ of the sprites tells that its area // and check whether _any_ of the sprites tells that its area
@ -452,7 +452,7 @@ namespace canvas
aEnd, aEnd,
::boost::bind( &SpriteInfo::needsUpdate, ::boost::bind( &SpriteInfo::needsUpdate,
::boost::bind( ::boost::bind(
::std::select2nd<SpriteConnectedRanges::ComponentType>(), ::o3tl::select2nd<SpriteConnectedRanges::ComponentType>(),
_1 ) ) ) != aEnd ); _1 ) ) ) != aEnd );
} }

View File

@ -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 <functional>
namespace o3tl
{
template<class T>
struct identity : public std::unary_function<T, T>
{
T operator()(const T& y) const
{
return (y);
}
};
template<class T1,class T2>
struct project1st : public std::binary_function<T1, T2, T1>
{
T1 operator()(const T1& y, const T2&) const
{
return (y);
}
};
template<class T1,class T2>
struct project2nd : public std::binary_function<T1, T2, T2>
{
T2 operator()(const T1&, const T2& x) const
{
return (x);
}
};
template<class P>
struct select1st : public std::unary_function<P, typename P::first_type>
{
const typename P::first_type& operator()(const P& y) const
{
return (y.first);
}
};
template<class P>
struct select2nd : public std::unary_function<P, typename P::second_type>
{
const typename P::second_type& operator()(const P& y) const
{
return (y.second);
}
};
template<class F1, class F2>
class unary_compose : public std::unary_function<typename F2::argument_type, typename F1::result_type>
{
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<class F1, class F2>
inline unary_compose<F1, F2> compose1(const F1& fnction1, const F2& fnction2)
{
return (unary_compose<F1, F2>(fnction1, fnction2));
}
template<class F1, class F2, class F3>
class binary_compose : public std::unary_function<typename F2::argument_type,typename F1::result_type>
{
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<class F1, class F2, class F3>
inline binary_compose<F1, F2, F3> compose2(const F1& fnction1, const F2& fnction2, const F3& fnction3)
{
return (binary_compose<F1, F2, F3>(fnction1, fnction2, fnction3));
}
} // namespace o3tl
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -70,7 +70,7 @@
#include <map> #include <map>
#include <boost/unordered_map.hpp> #include <boost/unordered_map.hpp>
#include <algorithm> #include <algorithm>
#include <functional> #include <o3tl/compat_functional.hxx>
#include "tools/urlobj.hxx" #include "tools/urlobj.hxx"
#include "osl/file.hxx" #include "osl/file.hxx"
#include <com/sun/star/awt/XSimpleTabController.hpp> #include <com/sun/star/awt/XSimpleTabController.hpp>
@ -477,7 +477,7 @@ void SAL_CALL UnoControlDialogModel::dispose( ) throw(RuntimeException)
::std::transform( ::std::transform(
maModels.begin(), maModels.end(), // source range maModels.begin(), maModels.end(), // source range
aChildModels.begin(), // target location 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 // now dispose
@ -780,7 +780,7 @@ Sequence< ::rtl::OUString > UnoControlDialogModel::getElementNames() throw(Runti
::std::transform( ::std::transform(
maModels.begin(), maModels.end(), // source range maModels.begin(), maModels.end(), // source range
aNames.getArray(), // target 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; return aNames;
@ -992,7 +992,7 @@ Sequence< Reference< XControlModel > > SAL_CALL UnoControlDialogModel::getContro
::std::transform( ::std::transform(
aSortedModels.begin(), aSortedModels.end(), aSortedModels.begin(), aSortedModels.end(),
::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ), ::std::copy( aUnindexedModels.begin(), aUnindexedModels.end(), aReturn.getArray() ),
::std::select2nd< MapIndexToModel::value_type >( ) ::o3tl::select2nd< MapIndexToModel::value_type >( )
); );
return aReturn; return aReturn;