diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-04-04 13:39:38 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-04-11 10:19:05 +0000 |
commit | 84272d115da1165ac5f7cf4ae53875855d762b25 (patch) | |
tree | fa97d5319616492e230ebe03a08e1f898c389d77 /svx/source/items/grfitem.cxx | |
parent | 8568fec3b942e725a0114ff137a61b3292e079ed (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 'svx/source/items/grfitem.cxx')
-rw-r--r-- | svx/source/items/grfitem.cxx | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx index be3181097ba9..05232eb82b0f 100644 --- a/svx/source/items/grfitem.cxx +++ b/svx/source/items/grfitem.cxx @@ -21,13 +21,10 @@ #include <svx/grfcrop.hxx> #include <editeng/itemtype.hxx> #include <com/sun/star/text/GraphicCrop.hpp> +#include <tools/mapunit.hxx> 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_FACTORY( SvxGrfCrop, SfxPoolItem , new SvxGrfCrop(0)) - /****************************************************************************** * Implementierung class SwCropGrf ******************************************************************************/ @@ -99,10 +96,10 @@ bool SvxGrfCrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const if( bConvert ) { - aRet.Right = TWIP_TO_MM100(aRet.Right ); - aRet.Top = TWIP_TO_MM100(aRet.Top ); - aRet.Left = TWIP_TO_MM100(aRet.Left ); - aRet.Bottom = TWIP_TO_MM100(aRet.Bottom); + aRet.Right = convertTwipToMm100(aRet.Right ); + aRet.Top = convertTwipToMm100(aRet.Top ); + aRet.Left = convertTwipToMm100(aRet.Left ); + aRet.Bottom = convertTwipToMm100(aRet.Bottom); } @@ -120,10 +117,10 @@ bool SvxGrfCrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) return false; if( bConvert ) { - aVal.Right = MM100_TO_TWIP(aVal.Right ); - aVal.Top = MM100_TO_TWIP(aVal.Top ); - aVal.Left = MM100_TO_TWIP(aVal.Left ); - aVal.Bottom = MM100_TO_TWIP(aVal.Bottom); + aVal.Right = convertMm100ToTwip(aVal.Right ); + aVal.Top = convertMm100ToTwip(aVal.Top ); + aVal.Left = convertMm100ToTwip(aVal.Left ); + aVal.Bottom = convertMm100ToTwip(aVal.Bottom); } nLeft = aVal.Left ; |