From 279c7f83a57c4d3991930ee80e9d9c287c21270a Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 27 Feb 2019 17:04:02 +0100 Subject: oox smartart, picture strip: fix lack of margin in text shapes Shape text has two kind of spacing inside the shape's bounding box: the shape-level margin and the paragraph-level one. Only the second was handled in the tx algorithm so far, add support for the first. The margins taken from constraints were way large by default: the only explanation I found for that is that SmartArt layout sometimes calculates in MMs, sometimes in Points, and the ratio between the two is exactly the Impress / PowerPoint margin. So assume that indeed that unit difference is the reason for the smaller in-PowerPoint margin values and do the same on our side. Change-Id: I6f1e54301e2e9b33a7e721be34244d968cccf42d Reviewed-on: https://gerrit.libreoffice.org/68453 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- sd/qa/unit/import-tests-smartart.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'sd/qa') diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 3d30f576cce0..3a98496735ef 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -15,6 +15,7 @@ #include #include +#include using namespace ::com::sun::star; @@ -965,6 +966,20 @@ void SdImportTestSmartArt::testPictureStrip() CPPUNIT_ASSERT_GREATER(xTitle->getPosition().Y + xTitle->getSize().Height, xGroup->getPosition().Y); + // Make sure that left margin is 60% of width (if you count width in points and margin in mms). + uno::Reference xFirstText(getChildShape(getChildShape(xGroup, 0), 0), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstText.is()); + sal_Int32 nTextLeftDistance = 0; + xFirstText->getPropertyValue("TextLeftDistance") >>= nTextLeftDistance; + uno::Reference xFirstTextShape(xFirstText, uno::UNO_QUERY); + CPPUNIT_ASSERT(xFirstTextShape.is()); + sal_Int32 nWidth = xFirstTextShape->getSize().Width; + double fFactor = oox::drawingml::convertPointToMms(0.6); + // Without the accompanying fix in place, this test would have failed with 'Expected: 3440, + // Actual : 263', i.e. the left margin was too small. + CPPUNIT_ASSERT_EQUAL(static_cast(nWidth * fFactor), nTextLeftDistance); + xDocShRef->DoClose(); } -- cgit