[Libreoffice-commits] core.git: include/oox oox/source

Szymon Kłos szymon.klos at collabora.com
Fri Jun 9 08:43:42 UTC 2017


 include/oox/drawingml/drawingmltypes.hxx |    6 ++++++
 oox/source/vml/vmlformatting.cxx         |    4 +---
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 15957e14408e7b525c71914739faa63bd827117d
Author: Szymon Kłos <szymon.klos at collabora.com>
Date:   Thu Jun 8 21:06:11 2017 +0200

    VML: EMU to Points conversion
    
    Change-Id: Icd2dbd6e894975615268dc4aa52d1d53bf9c0bca
    Reviewed-on: https://gerrit.libreoffice.org/38581
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx
index 6a4a99f426fe..0b1ea4be7c72 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -153,6 +153,7 @@ IndexRange GetIndexRange( const css::uno::Reference< css::xml::sax::XFastAttribu
 
 
 const sal_Int32 EMU_PER_HMM = 360;      /// 360 EMUs per 1/100 mm.
+const sal_Int32 EMU_PER_PT = 12700;
 
 /** Converts the passed 32-bit integer value from 1/100 mm to EMUs. */
 inline sal_Int64 convertHmmToEmu( sal_Int32 nValue )
@@ -167,6 +168,11 @@ inline sal_Int32 convertEmuToHmm( sal_Int64 nValue )
     return getLimitedValue< sal_Int32, sal_Int64 >( (nValue + nCorrection) / EMU_PER_HMM, SAL_MIN_INT32, SAL_MAX_INT32 );
 }
 
+/** Converts the passed 64-bit integer value from EMUs to Points. */
+inline float convertEmuToPoints( sal_Int64 nValue )
+{
+    return (float) nValue / EMU_PER_PT;
+}
 
 /** A structure for a point with 64-bit integer components. */
 struct EmuPoint
diff --git a/oox/source/vml/vmlformatting.cxx b/oox/source/vml/vmlformatting.cxx
index c52b48e6e674..cb7ea244c554 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -929,9 +929,7 @@ void TextpathModel::pushToPropMap(ShapePropertyMap& rPropMap, const uno::Referen
                 else if (aName == "font-size")
                 {
                     oox::OptValue<OUString> aOptString(aValue);
-                    sal_Int64 nEmu = lclGetEmu( rGraphicHelper, aOptString, 1 );
-                    // 1 point = 1/72 inch = 12,700 EMU
-                    float nSize = nEmu / 12700;
+                    float nSize = drawingml::convertEmuToPoints(lclGetEmu(rGraphicHelper, aOptString, 1));
 
                     uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
                     xPropertySet->setPropertyValue("CharHeight", uno::makeAny(nSize));


More information about the Libreoffice-commits mailing list