summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-02-05 19:35:14 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-02-06 17:05:44 +0100
commit956c09ca7d690471f62e8e2e14ad04fefcebf7e7 (patch)
treec681ace388370acf5842c73d45e9e9d8880777af /oox
parentca074a47e8fdae396633dad6f59450508bb2c9f0 (diff)
Use more conversion functions from <tools/UnitConversion.hxx>
This unifies conversion functions to provide both floating-point and integral overloads, with correct rounding for the latter. Also sanitizing code it templatized to allow reuse if needed. Change-Id: Ibe1c9fe4d5baa226c600445779dbaf7dc41a02cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110487 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/chart/typegroupconverter.cxx3
-rw-r--r--oox/source/ole/vbacontrol.cxx4
2 files changed, 4 insertions, 3 deletions
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index f6cea5df9b38..6cc4d81eba25 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -43,6 +43,7 @@
#include <oox/token/namespaces.hxx>
#include <oox/token/properties.hxx>
#include <oox/token/tokens.hxx>
+#include <tools/UnitConversion.hxx>
namespace oox::drawingml::chart {
@@ -489,7 +490,7 @@ void TypeGroupConverter::convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSym
}
// symbol size (points in OOXML, 1/100 mm in Chart2)
- sal_Int32 nSize = static_cast< sal_Int32 >( nOoxSize * (2540.0 / 72.0) + 0.5 );
+ sal_Int32 nSize = convertPointToMm100(nOoxSize);
aSymbol.Size.Width = aSymbol.Size.Height = nSize;
if(xShapeProps.is())
diff --git a/oox/source/ole/vbacontrol.cxx b/oox/source/ole/vbacontrol.cxx
index 1b85c27dd6f6..07c91483c773 100644
--- a/oox/source/ole/vbacontrol.cxx
+++ b/oox/source/ole/vbacontrol.cxx
@@ -30,6 +30,7 @@
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include <sal/log.hxx>
+#include <tools/UnitConversion.hxx>
#include <xmlscript/xmldlg_imexp.hxx>
#include <oox/helper/attributelist.hxx>
#include <oox/helper/binaryinputstream.hxx>
@@ -706,8 +707,7 @@ void VbaFormControl::moveEmbeddedToAbsoluteParent()
const AxFontDataModel* pFontModel = dynamic_cast< const AxFontDataModel* >( mxCtrlModel.get() );
if( pFontModel && (pFontModel->getControlType() == API_CONTROL_GROUPBOX) )
{
- // convert points to 1/100 mm (1 pt = 1/72 inch = 2.54/72 cm = 2540/72 1/100 mm)
- sal_Int32 nFontHeight = static_cast< sal_Int32 >( pFontModel->getFontHeight() * 2540 / 72 );
+ sal_Int32 nFontHeight = convertPointToMm100(pFontModel->getFontHeight());
aDistance.second += nFontHeight / 2;
}