summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2014-04-04 13:39:38 +0300
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-04-11 10:19:05 +0000
commit84272d115da1165ac5f7cf4ae53875855d762b25 (patch)
treefa97d5319616492e230ebe03a08e1f898c389d77 /svl
parent8568fec3b942e725a0114ff137a61b3292e079ed (diff)
Introduce twip/mm100 conversion functions instead of duplicated macros
Change-Id: Ib689e35b417e0e9016cd6a239c986e0603a99d62 Reviewed-on: https://gerrit.libreoffice.org/8837 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'svl')
-rw-r--r--svl/source/items/ptitem.cxx16
1 files changed, 6 insertions, 10 deletions
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 <com/sun/star/uno/Any.hxx>
#include <com/sun/star/awt/Point.hpp>
#include <tools/stream.hxx>
+#include <tools/mapunit.hxx>
#include <svl/poolitem.hxx>
#include <svl/memberid.hrc>
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 )