From 49870ccb9b405573595b43df95a6704108c276d6 Mon Sep 17 00:00:00 2001 From: Andrzej Hunt Date: Mon, 21 Jul 2014 21:13:15 +0200 Subject: Add Point and Size versions of convertMm100ToTwip/TwipToMm100. There seem to be quite a few cases where the individual components are being converted, this way we can just conver the entire object as one. Change-Id: I0043b6f40520d7497e6edc185187706b255f2354 --- include/tools/mapunit.hxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/tools/mapunit.hxx b/include/tools/mapunit.hxx index a68b6b45b251..af3eaa9ef390 100644 --- a/include/tools/mapunit.hxx +++ b/include/tools/mapunit.hxx @@ -20,6 +20,8 @@ #ifndef INCLUDED_TOOLS_MAPUNIT_HXX #define INCLUDED_TOOLS_MAPUNIT_HXX +#include "gen.hxx" + enum MapUnit { MAP_100TH_MM, MAP_10TH_MM, MAP_MM, MAP_CM, MAP_1000TH_INCH, MAP_100TH_INCH, MAP_10TH_INCH, MAP_INCH, MAP_POINT, MAP_TWIP, MAP_PIXEL, MAP_SYSFONT, MAP_APPFONT, @@ -33,6 +35,18 @@ inline sal_Int64 convertTwipToMm100(sal_Int64 n) return (n*127-36)/72; } +inline Point convertTwipToMm100(const Point& rPoint) +{ + return Point(convertTwipToMm100(rPoint.getX()), + convertTwipToMm100(rPoint.getY())); +} + +inline Size convertTwipToMm100(const Size& rSize) +{ + return Size(convertTwipToMm100(rSize.getWidth()), + convertTwipToMm100(rSize.getHeight())); +} + inline sal_Int64 convertMm100ToTwip(sal_Int64 n) { if (n >= 0) @@ -41,6 +55,18 @@ inline sal_Int64 convertMm100ToTwip(sal_Int64 n) return (n*72-63)/127; } +inline Point convertMm100ToTwip(const Point& rPoint) +{ + return Point(convertMm100ToTwip(rPoint.getX()), + convertMm100ToTwip(rPoint.getY())); +} + +inline Size convertMm100ToTwip(const Size& rSize) +{ + return Size(convertMm100ToTwip(rSize.getWidth()), + convertMm100ToTwip(rSize.getHeight())); +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit v1.2.3