summaryrefslogtreecommitdiff
path: root/sc/source/filter/inc/ftools.hxx
diff options
context:
space:
mode:
authorRĂ¼diger Timm <rt@openoffice.org>2004-05-18 11:44:39 +0000
committerRĂ¼diger Timm <rt@openoffice.org>2004-05-18 11:44:39 +0000
commitd0df5dc3f3954620592108410cc5dc0bdd5d4a29 (patch)
treea5dcd928f86a4464acb89a3d41daac910a808bd1 /sc/source/filter/inc/ftools.hxx
parent85e6cb54d08f617107c6d6c16e7e5cfb59542736 (diff)
INTEGRATION: CWS dr17 (1.8.4); FILE MERGED
2004/04/16 13:54:39 dr 1.8.4.1: #i27879# export of scrollbar/spinbutton
Diffstat (limited to 'sc/source/filter/inc/ftools.hxx')
-rw-r--r--sc/source/filter/inc/ftools.hxx24
1 files changed, 22 insertions, 2 deletions
diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx
index f9d4809c8bb0..4225def4c449 100644
--- a/sc/source/filter/inc/ftools.hxx
+++ b/sc/source/filter/inc/ftools.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ftools.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: hr $ $Date: 2004-04-13 12:28:00 $
+ * last change: $Author: rt $ $Date: 2004-05-18 12:44:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -114,6 +114,16 @@
// Value range limit helpers --------------------------------------------------
+/** Returns the value, if it is not less than nMin, otherwise nMin. */
+template< typename ReturnType, typename Type >
+inline ReturnType llimit( Type nValue, ReturnType nMin )
+{ return static_cast< ReturnType >( ::std::max< Type >( nValue, nMin ) ); }
+
+/** Returns the value, if it fits into ReturnType, otherwise the minimum value of ReturnType. */
+template< typename ReturnType, typename Type >
+inline ReturnType llimit( Type nValue )
+{ return ::llimit( nValue, ::std::numeric_limits< ReturnType >::min() ); }
+
/** Returns the value, if it is not greater than nMax, otherwise nMax. */
template< typename ReturnType, typename Type >
inline ReturnType ulimit( Type nValue, ReturnType nMax )
@@ -124,6 +134,16 @@ template< typename ReturnType, typename Type >
inline ReturnType ulimit( Type nValue )
{ return ::ulimit( nValue, ::std::numeric_limits< ReturnType >::max() ); }
+/** Returns the value, if it is not less than nMin and not greater than nMax, otherwise one of the limits. */
+template< typename ReturnType, typename Type >
+inline ReturnType lulimit( Type nValue, ReturnType nMin, ReturnType nMax )
+{ return static_cast< ReturnType >( ::std::max< Type >( ::std::min< Type >( nValue, nMax ), nMin ) ); }
+
+/** Returns the value, if it fits into ReturnType, otherwise one of the limits of ReturnType. */
+template< typename ReturnType, typename Type >
+inline ReturnType lulimit( Type nValue )
+{ return ::lulimit( nValue, ::std::numeric_limits< ReturnType >::min(), ::std::numeric_limits< ReturnType >::max() ); }
+
// Read from bitfields --------------------------------------------------------