summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-07-21 21:13:15 +0200
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-30 21:37:10 +0200
commit49870ccb9b405573595b43df95a6704108c276d6 (patch)
treee30872950985de22fba42104b272c3d066c6c0ac
parentc3f803982b23355765913a948ec2dcefa4d159a2 (diff)
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
-rw-r--r--include/tools/mapunit.hxx26
1 files changed, 26 insertions, 0 deletions
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: */