[Libreoffice-commits] .: 2 commits - sfx2/README svx/source

Takeshi Abe tabe at kemper.freedesktop.org
Sat Apr 28 07:00:34 PDT 2012


 sfx2/README                    |    2 +-
 svx/source/svdraw/svdconv.hxx  |   31 +++++++++++++++++++++++++++++++
 svx/source/svdraw/svdoashp.cxx |    4 +---
 svx/source/svdraw/svdobj.cxx   |    5 +----
 svx/source/svdraw/svdocapt.cxx |    5 +----
 svx/source/svdraw/svdomeas.cxx |    4 +---
 svx/source/svdraw/svdopath.cxx |    9 +--------
 svx/source/svdraw/svdotext.cxx |    7 +------
 8 files changed, 38 insertions(+), 29 deletions(-)

New commits:
commit a6cfa6b50239e0e0221387691e7bb1211fc81049
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Sat Apr 28 22:56:47 2012 +0900

    extract ImplTwipsToMM/ImplMMToTwips into a common header
    
    Change-Id: I8d4aa1326a6e9f903b536ec2656155bfe1ce4988

diff --git a/svx/source/svdraw/svdconv.hxx b/svx/source/svdraw/svdconv.hxx
new file mode 100644
index 0000000..3e25013
--- /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 23898e1..8b18e12 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 b9d7003..ce624e0 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 54ee2a1..eca1f62 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 ec6aafd..2e7cd05 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 48726ca..25b7fa5 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 96c9b34..b274da8 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()
commit 9097f177a1a11c7e485ed3c5028099b7a7b14d53
Author: Takeshi Abe <tabe at fixedpoint.jp>
Date:   Sat Apr 28 02:19:11 2012 +0900

    fixed typo
    
    Change-Id: I98bf41fb13dfdb0a1e3402c0a2db8bc1d2ced5f6

diff --git a/sfx2/README b/sfx2/README
index 367eb26..7170fdb 100644
--- a/sfx2/README
+++ b/sfx2/README
@@ -1,4 +1,4 @@
-This is core gui code, contining base-classes for documents
+This is core gui code, containing base-classes for documents
 
 Document load/save code is maintained in [git:sfx2/source/doc/docfile.cxx]
 SfxMedium class, which handles all the twisty load and save corner cases.


More information about the Libreoffice-commits mailing list