sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx | 6 +++--- sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 2 +- writerfilter/source/dmapper/ConversionHelper.cxx | 5 ----- writerfilter/source/dmapper/ConversionHelper.hxx | 2 -- writerfilter/source/dmapper/GraphicHelpers.cxx | 5 +++-- writerfilter/source/dmapper/GraphicImport.cxx | 16 ++++++++-------- 6 files changed, 15 insertions(+), 21 deletions(-)
New commits: commit 4dbed9ef9a2299587d75bd9fae96b05dac0675c3 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Fri Oct 31 09:29:02 2014 +0100 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 diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx index 62e9df0..1432888 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx @@ -314,12 +314,12 @@ DECLARE_OOXMLEXPORT_TEST(testDMLShapeFillPattern, "dml-shape-fillpattern.docx") DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeChildPosition, "dml-groupshape-childposition.docx") { - // Problem was parent transformation was ingnored fully, but translate component + // Problem was parent transformation was ignored fully, but translate component // which specify the position must be also applied for children of the group. uno::Reference<drawing::XShapes> xGroup(getShape(1), uno::UNO_QUERY); uno::Reference<drawing::XShape> xChildGroup(xGroup->getByIndex(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? -2119 : -2122), xChildGroup->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? -2120 : -2122), xChildGroup->getPosition().X); CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 11336 : 11333), xChildGroup->getPosition().Y); xGroup.set(xChildGroup, uno::UNO_QUERY); @@ -328,7 +328,7 @@ DECLARE_OOXMLEXPORT_TEST(testDMLGroupShapeChildPosition, "dml-groupshape-childpo CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 11336 : 11333), xChildGroup->getPosition().Y); xChildGroup.set(xGroup->getByIndex(1), uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? -2119 : -2122), xChildGroup->getPosition().X); + CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? -2120 : -2122), xChildGroup->getPosition().X); CPPUNIT_ASSERT_EQUAL(sal_Int32(mbExported ? 14026 : 14023), xChildGroup->getPosition().Y); } diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index adc0df2..3992564 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -2268,7 +2268,7 @@ DECLARE_OOXMLIMPORT_TEST(testFdo80555, "fdo80555.docx") uno::Reference<drawing::XShape> xShape = getShape(1); // Shape was wrongly placed at X=0, Y=0 CPPUNIT_ASSERT_EQUAL(sal_Int32(3318), xShape->getPosition().X); - CPPUNIT_ASSERT_EQUAL(sal_Int32(245), xShape->getPosition().Y); + CPPUNIT_ASSERT_EQUAL(sal_Int32(247), xShape->getPosition().Y); } DECLARE_OOXMLIMPORT_TEST(testFdo76803, "fdo76803.docx") diff --git a/writerfilter/source/dmapper/ConversionHelper.cxx b/writerfilter/source/dmapper/ConversionHelper.cxx index 2d147a5..ad19d08 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 7a49663..53ff4b6 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 c0ba37b..237421e 100644 --- a/writerfilter/source/dmapper/GraphicHelpers.cxx +++ b/writerfilter/source/dmapper/GraphicHelpers.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/text/WrapTextMode.hpp> #include "dmapperLoggers.hxx" +#include <oox/drawingml/drawingmltypes.hxx> #include <iostream> 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 38b6c57..56c5355 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits