1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _BGFX_RANGE_RANGEEXPANDER_HXX 29 #define _BGFX_RANGE_RANGEEXPANDER_HXX 30 31 #include <basegfx/range/b1drange.hxx> 32 #include <basegfx/range/b1irange.hxx> 33 #include <basegfx/range/b2drange.hxx> 34 #include <basegfx/range/b2irange.hxx> 35 #include <basegfx/range/b3drange.hxx> 36 #include <basegfx/range/b3irange.hxx> 37 38 namespace basegfx 39 { 40 /** Generic functor for expanding a range with a number of other 41 ranges. 42 43 Since *Range::expand() is overloaded, straight-forward 44 application of ::boost::bind and friends fails (because of 45 ambiguities). Thus, this functor template can be used, to 46 expand the given range with a number of other ranges, passed 47 in at the function operator. 48 49 @tpl RangeType 50 Range type to operate with. Preferrably, one of B1*Range, 51 B2*Range, or B3*Range. 52 */ 53 template< typename RangeType > class RangeExpander 54 { 55 public: 56 typedef RangeType ValueType; 57 typedef void result_type; 58 59 explicit RangeExpander( ValueType& rBounds ) : 60 mrBounds( rBounds ) 61 { 62 } 63 64 void operator()( const ValueType& rBounds ) 65 { 66 mrBounds.expand( rBounds ); 67 } 68 69 private: 70 ValueType& mrBounds; 71 }; 72 73 typedef RangeExpander< B1DRange > B1DRangeExpander; 74 typedef RangeExpander< B1IRange > B1IRangeExpander; 75 typedef RangeExpander< B2DRange > B2DRangeExpander; 76 typedef RangeExpander< B2IRange > B2IRangeExpander; 77 typedef RangeExpander< B3DRange > B3DRangeExpander; 78 typedef RangeExpander< B3IRange > B3IRangeExpander; 79 80 } // end of namespace basegfx 81 82 83 #endif /* _BGFX_RANGE_RANGEEXPANDER_HXX */ 84