summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-06-08 21:06:11 +0200
committerSzymon Kłos <szymon.klos@collabora.com>2017-06-10 20:03:29 +0200
commit08c566dfd79e2c364bbd1ef673ff244ff948949c (patch)
tree831cac10cdd6f35b179364283416a0460841ac8f
parente3426d9a628fe3ba1cd2cb3d765c3199f9db4de7 (diff)
VML: EMU to Points conversion
Change-Id: Icd2dbd6e894975615268dc4aa52d1d53bf9c0bca Reviewed-on: https://gerrit.libreoffice.org/38581 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--include/oox/drawingml/drawingmltypes.hxx6
-rw-r--r--oox/source/vml/vmlformatting.cxx4
2 files changed, 7 insertions, 3 deletions
diff --git a/include/oox/drawingml/drawingmltypes.hxx b/include/oox/drawingml/drawingmltypes.hxx
index 2aac13c669a7..a845f728541f 100644
--- a/include/oox/drawingml/drawingmltypes.hxx
+++ b/include/oox/drawingml/drawingmltypes.hxx
@@ -152,6 +152,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 )
@@ -166,6 +167,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 253d9eb18dc1..d8183227d6e6 100644
--- a/oox/source/vml/vmlformatting.cxx
+++ b/oox/source/vml/vmlformatting.cxx
@@ -904,9 +904,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));