summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorTakeshi Abe <tabe@fixedpoint.jp>2012-04-28 22:56:47 +0900
committerTakeshi Abe <tabe@fixedpoint.jp>2012-04-28 22:58:36 +0900
commita6cfa6b50239e0e0221387691e7bb1211fc81049 (patch)
treef080f0789a0f89719ed3d5c4069542427690960d /svx
parent9097f177a1a11c7e485ed3c5028099b7a7b14d53 (diff)
extract ImplTwipsToMM/ImplMMToTwips into a common header
Change-Id: I8d4aa1326a6e9f903b536ec2656155bfe1ce4988
Diffstat (limited to 'svx')
-rw-r--r--svx/source/svdraw/svdconv.hxx31
-rw-r--r--svx/source/svdraw/svdoashp.cxx4
-rw-r--r--svx/source/svdraw/svdobj.cxx5
-rw-r--r--svx/source/svdraw/svdocapt.cxx5
-rw-r--r--svx/source/svdraw/svdomeas.cxx4
-rw-r--r--svx/source/svdraw/svdopath.cxx9
-rw-r--r--svx/source/svdraw/svdotext.cxx7
7 files changed, 37 insertions, 28 deletions
diff --git a/svx/source/svdraw/svdconv.hxx b/svx/source/svdraw/svdconv.hxx
new file mode 100644
index 000000000000..3e25013516ec
--- /dev/null
+++ b/svx/source/svdraw/svdconv.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Copyright 2012 LibreOffice contributors.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef _SVDCONV_HXX
+#define _SVDCONV_HXX
+
+template<typename T> inline T ImplMMToTwips(T val);
+template<>
+inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+template<>
+inline sal_Int32 ImplMMToTwips(sal_Int32 nVal) { return ((nVal * 72 + 63) / 127); }
+template<>
+inline sal_Int64 ImplMMToTwips(sal_Int64 nVal) { return ((nVal * 72 + 63) / 127); }
+
+template<typename T> inline T ImplTwipsToMM(T val);
+template<>
+inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
+template<>
+inline sal_Int32 ImplTwipsToMM(sal_Int32 nVal) { return ((nVal * 127 + 36) / 72); }
+template<>
+inline sal_Int64 ImplTwipsToMM(sal_Int64 nVal) { return ((nVal * 127 + 36) / 72); }
+
+#endif // _SVDCONV_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 23898e1fec08..8b18e12efe4d 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -89,9 +89,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/tools/unotools.hxx>
-
-inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
-inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+#include "svdconv.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index b9d70031823e..ce624e0cb435 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -117,13 +117,10 @@
#include <svx/svdundo.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <svx/sdrobjectfilter.hxx>
+#include "svdconv.hxx"
using namespace ::com::sun::star;
-// replace macros above with type-detecting methods
-inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
-inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
-
////////////////////////////////////////////////////////////////////////////////////////////////////
TYPEINIT0(SdrObjUserCall);
diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx
index 54ee2a16ced2..eca1f620b228 100644
--- a/svx/source/svdraw/svdocapt.cxx
+++ b/svx/source/svdraw/svdocapt.cxx
@@ -57,10 +57,7 @@
#include <basegfx/range/b2drange.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <svx/sdrhittesthelper.hxx>
-
-// #i32599#
-inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
-inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+#include "svdconv.hxx"
////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx
index ec6aafdef7db..2e7cd0546c29 100644
--- a/svx/source/svdraw/svdomeas.cxx
+++ b/svx/source/svdraw/svdomeas.cxx
@@ -67,6 +67,7 @@
#include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include "svdconv.hxx"
////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -1371,9 +1372,6 @@ sal_uInt16 SdrMeasureObj::GetOutlinerViewAnchorMode() const
// implemented since currently it is derived from SdrTextObj which uses
// a functionality based on SnapRect which is not useful here
-inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
-inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
-
sal_Bool SdrMeasureObj::TRGetBaseGeometry(basegfx::B2DHomMatrix& rMatrix, basegfx::B2DPolyPolygon& /*rPolyPolygon*/) const
{
// handle the same as a simple line since the definition is based on two points
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 48726caa1ee9..25b7fa5a4d72 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -57,14 +57,7 @@
#include <vcl/salbtype.hxx> // FRound
#include <svx/sdr/contact/viewcontactofsdrpathobj.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
-
-// replace macros above with type-safe methods
-inline sal_Int32 ImplTwipsToMM(sal_Int32 nVal) { return ((nVal * 127 + 36) / 72); }
-inline sal_Int32 ImplMMToTwips(sal_Int32 nVal) { return ((nVal * 72 + 63) / 127); }
-inline sal_Int64 ImplTwipsToMM(sal_Int64 nVal) { return ((nVal * 127 + 36) / 72); }
-inline sal_Int64 ImplMMToTwips(sal_Int64 nVal) { return ((nVal * 72 + 63) / 127); }
-inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
-inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
+#include "svdconv.hxx"
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/range/b2drange.hxx>
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 96c9b34545a6..b274da8a219d 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -66,18 +66,13 @@
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <vcl/virdev.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include "svdconv.hxx"
//////////////////////////////////////////////////////////////////////////////
using namespace com::sun::star;
//////////////////////////////////////////////////////////////////////////////
-// replace macros above with type-safe methods
-inline double ImplTwipsToMM(double fVal) { return (fVal * (127.0 / 72.0)); }
-inline double ImplMMToTwips(double fVal) { return (fVal * (72.0 / 127.0)); }
-
-
-//////////////////////////////////////////////////////////////////////////////
// BaseProperties section
sdr::properties::BaseProperties* SdrTextObj::CreateObjectSpecificProperties()