From d178d7bef193565a7d6aacbc37a58dfc4bd7b316 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Fri, 2 Sep 2011 01:55:45 -0400 Subject: [PATCH] fdo#40466: Get charts to import from xlsx again. This regression was probably caused by a bad merge of OOo m106. --- oox/source/xls/drawingfragment.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/oox/source/xls/drawingfragment.cxx b/oox/source/xls/drawingfragment.cxx index 248677573421..7a95fe4b2ada 100644 --- a/oox/source/xls/drawingfragment.cxx +++ b/oox/source/xls/drawingfragment.cxx @@ -283,11 +283,20 @@ void DrawingFragment::onEndElement() getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Y, 0, SAL_MAX_INT32 ), getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Width, 0, SAL_MAX_INT32 ), getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.Height, 0, SAL_MAX_INT32 ) ); + + // Make sure to set the position and size *before* calling addShape(). + mxShape->setPosition(::com::sun::star::awt::Point(aShapeRectEmu.X, aShapeRectEmu.Y)); + mxShape->setSize(::com::sun::star::awt::Size(aShapeRectEmu.Width, aShapeRectEmu.Height)); + basegfx::B2DHomMatrix aTransformation; mxShape->addShape( getOoxFilter(), &getTheme(), mxDrawPage, aTransformation, &aShapeRectEmu32 ); - // collect all shape positions in the WorksheetHelper base class - extendShapeBoundingBox( aShapeRectEmu32 ); + /* Collect all shape positions in the WorksheetHelper base + class. But first, scale EMUs to 1/100 mm. */ + Rectangle aShapeRectHmm( + convertEmuToHmm( aShapeRectEmu.X ), convertEmuToHmm( aShapeRectEmu.Y ), + convertEmuToHmm( aShapeRectEmu.Width ), convertEmuToHmm( aShapeRectEmu.Height ) ); + extendShapeBoundingBox( aShapeRectHmm ); } } mxShape.reset();