From 4dbed9ef9a2299587d75bd9fae96b05dac0675c3 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 31 Oct 2014 09:29:02 +0100 Subject: Use oox::drawingml::convertEmuToHmm() And get rid of the writerfilter copy, that does no rounding. Adjusted testcases: - testFdo80555: 245 -> 247 (should be 246.944444444, so a good change) - testDMLGroupShapeChildPosition: roundtripped values are now closer to the initial ones, so also a good change Change-Id: I4dec7857a0df77face01b7a8ba1da7c647a24b6c --- writerfilter/source/dmapper/ConversionHelper.cxx | 5 ----- writerfilter/source/dmapper/ConversionHelper.hxx | 2 -- writerfilter/source/dmapper/GraphicHelpers.cxx | 5 +++-- writerfilter/source/dmapper/GraphicImport.cxx | 16 ++++++++-------- 4 files changed, 11 insertions(+), 17 deletions(-) (limited to 'writerfilter') diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index 2d147a51fad4..ad19d0860acf 100644 --- a/writerfilter/source/dmapper/ConversionHelper.cxx +++ b/writerfilter/source/dmapper/ConversionHelper.cxx @@ -423,11 +423,6 @@ sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t) return convertTwipToMM100( _t ); } -sal_Int32 convertEMUToMM100(sal_Int32 _t) -{ - return _t / 360; -} - sal_Int16 convertTableJustification( sal_Int32 nIntValue ) { sal_Int16 nOrient = text::HoriOrientation::LEFT_AND_WIDTH; diff --git a/writerfilter/source/dmapper/ConversionHelper.hxx b/writerfilter/source/dmapper/ConversionHelper.hxx index 7a49663d8e9a..53ff4b644903 100644 --- a/writerfilter/source/dmapper/ConversionHelper.hxx +++ b/writerfilter/source/dmapper/ConversionHelper.hxx @@ -45,8 +45,6 @@ namespace ConversionHelper{ // export just for test SAL_DLLPUBLIC_EXPORT sal_Int32 convertTwipToMM100(sal_Int32 _t); SAL_DLLPUBLIC_EXPORT sal_uInt32 convertTwipToMM100Unsigned(sal_Int32 _t); - // probably the most useless unit in the world - English Metric Units (EMU) 360 000 EMU == 1cm - sal_Int32 convertEMUToMM100(sal_Int32 _t); sal_Int16 convertTableJustification( sal_Int32 nIntValue ); sal_Int16 ConvertNumberingType(sal_Int32 nFmt); diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx index c0ba37bc339e..237421eb5787 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -27,6 +27,7 @@ #include #include "dmapperLoggers.hxx" +#include #include using namespace std; @@ -152,9 +153,9 @@ sal_Int16 PositionHandler::orientation() const void PositionHandler::setPositionOffset(const OUString & sText, bool vertical) { if( vertical ) - savedPositionOffsetV = ConversionHelper::convertEMUToMM100( sText.toInt32()); + savedPositionOffsetV = oox::drawingml::convertEmuToHmm(sText.toInt32()); else - savedPositionOffsetH = ConversionHelper::convertEMUToMM100( sText.toInt32()); + savedPositionOffsetH = oox::drawingml::convertEmuToHmm(sText.toInt32()); } int PositionHandler::getPositionOffset(bool vertical) diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 38b6c57a64ee..56c5355169bc 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -544,12 +544,12 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) case NS_ooxml::LN_CT_Border_shadow: m_pImpl->aBorders[m_pImpl->nCurrentBorderLine].bHasShadow = nIntValue ? true : false; break; - case NS_ooxml::LN_CT_Border_frame: // ignored + case NS_ooxml::LN_CT_Border_frame: break; - case NS_ooxml::LN_CT_PositiveSize2D_cx:// 90407; - case NS_ooxml::LN_CT_PositiveSize2D_cy:// 90408; + case NS_ooxml::LN_CT_PositiveSize2D_cx: + case NS_ooxml::LN_CT_PositiveSize2D_cy: { - sal_Int32 nDim = ConversionHelper::convertEMUToMM100( nIntValue ); + sal_Int32 nDim = oox::drawingml::convertEmuToHmm(nIntValue); if( nName == NS_ooxml::LN_CT_PositiveSize2D_cx ) m_pImpl->setXSize(nDim); else @@ -858,16 +858,16 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) } break; case NS_ooxml::LN_CT_Inline_distT: - m_pImpl->nTopMargin = ConversionHelper::convertEMUToMM100(nIntValue); + m_pImpl->nTopMargin = oox::drawingml::convertEmuToHmm(nIntValue); break; case NS_ooxml::LN_CT_Inline_distB: - m_pImpl->nBottomMargin = ConversionHelper::convertEMUToMM100(nIntValue); + m_pImpl->nBottomMargin = oox::drawingml::convertEmuToHmm(nIntValue); break; case NS_ooxml::LN_CT_Inline_distL: - m_pImpl->nLeftMargin = ConversionHelper::convertEMUToMM100(nIntValue); + m_pImpl->nLeftMargin = oox::drawingml::convertEmuToHmm(nIntValue); break; case NS_ooxml::LN_CT_Inline_distR: - m_pImpl->nRightMargin = ConversionHelper::convertEMUToMM100(nIntValue); + m_pImpl->nRightMargin = oox::drawingml::convertEmuToHmm(nIntValue); break; case NS_ooxml::LN_CT_GraphicalObjectData_uri: rValue.getString(); -- cgit