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 /include/tools/mapunit.hxx | |
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 'include/tools/mapunit.hxx')
-rw-r--r-- | include/tools/mapunit.hxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/tools/mapunit.hxx b/include/tools/mapunit.hxx index 0076b685ddcb..a68b6b45b251 100644 --- a/include/tools/mapunit.hxx +++ b/include/tools/mapunit.hxx @@ -25,6 +25,22 @@ enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, MAP_RELATIVE, MAP_LASTENUMDUMMY }; +inline sal_Int64 convertTwipToMm100(sal_Int64 n) +{ + if (n >= 0) + return (n*127+36)/72; + else + return (n*127-36)/72; +} + +inline sal_Int64 convertMm100ToTwip(sal_Int64 n) +{ + if (n >= 0) + return (n*72+63)/127; + else + return (n*72-63)/127; +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |