From 84272d115da1165ac5f7cf4ae53875855d762b25 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Fri, 4 Apr 2014 13:39:38 +0300 Subject: Introduce twip/mm100 conversion functions instead of duplicated macros Change-Id: Ib689e35b417e0e9016cd6a239c986e0603a99d62 Reviewed-on: https://gerrit.libreoffice.org/8837 Tested-by: LibreOffice gerrit bot Reviewed-by: Miklos Vajna --- svl/source/items/ptitem.cxx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'svl') diff --git a/svl/source/items/ptitem.cxx b/svl/source/items/ptitem.cxx index 1b66c809d74d..c9c36e26a51e 100644 --- a/svl/source/items/ptitem.cxx +++ b/svl/source/items/ptitem.cxx @@ -22,17 +22,13 @@ #include #include #include +#include #include #include using namespace ::com::sun::star; -#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) -#define MM100_TO_TWIP(MM100) ((MM100) >= 0 ? (((MM100)*72L+63L)/127L) : (((MM100)*72L-63L)/127L)) - - - TYPEINIT1_AUTOFACTORY(SfxPointItem, SfxPoolItem); @@ -113,8 +109,8 @@ bool SfxPointItem::QueryValue( uno::Any& rVal, awt::Point aTmp(aVal.X(), aVal.Y()); if( bConvert ) { - aTmp.X = TWIP_TO_MM100(aTmp.X); - aTmp.Y = TWIP_TO_MM100(aTmp.Y); + aTmp.X = convertTwipToMm100(aTmp.X); + aTmp.Y = convertTwipToMm100(aTmp.Y); } nMemberId &= ~CONVERT_TWIPS; switch ( nMemberId ) @@ -143,15 +139,15 @@ bool SfxPointItem::PutValue( const uno::Any& rVal, bRet = ( rVal >>= aValue ); if( bConvert ) { - aValue.X = MM100_TO_TWIP(aValue.X); - aValue.Y = MM100_TO_TWIP(aValue.Y); + aValue.X = convertMm100ToTwip(aValue.X); + aValue.Y = convertMm100ToTwip(aValue.Y); } } else { bRet = ( rVal >>= nVal ); if( bConvert ) - nVal = MM100_TO_TWIP( nVal ); + nVal = convertMm100ToTwip( nVal ); } if ( bRet ) -- cgit