summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2021-04-11 13:03:27 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-05-07 00:07:54 +0200
commite72b36434dc299d0fb3ecc97045fbb9ca2b9abf8 (patch)
treebf5766adce19e7c1782aec5672d1220a7269f9b5 /sw
parent6eac9d960f2bb5dae54ef6ca8e7c659e8c79d011 (diff)
tdf#141540 fix docx import of group or line with rotation
... and fix case wrap 'Square' and 'in Line' with them. Non-uniform scaling of a rotated shape might produce skew. Such had happened, when setting group or line to the size contained in GraphicImport. Avoid it. Writer has special rules for shape position and marging in case of wrap 'Square' and 'in Line', depending on rotation angle. The patch adds the needed margins. The patch changes some unit tests where we now get slightly different values. The patch fixes the wrong skew in sample document of tdf#73022. Change-Id: Ic743790c3fc8b8b10a4324d9e0184ad945cdceb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114193 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com> (cherry picked from commit 2a70cfb09c4d89154d229b6a95cf076e8bd76798) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115195 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx3
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport6.cxx8
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport.cxx3
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx15
4 files changed, 19 insertions, 10 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index e4287f12e978..49cc931b1b27 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -78,6 +78,9 @@ DECLARE_OOXMLEXPORT_TEST(testRelorientation, "relorientation.docx")
uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xGroup->getByIndex(0), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.GroupShape"), xShapeDescriptor->getShapeType());
+ // 'actual child size' = 'group ext' * 'child ext' / 'chExt from group', see section 'chExt' in
+ // [MS-OI29500]. Here for width from file 3108960 * 4896 / 4911 = 3099464 EMU. That corresponds to
+ // width 8.61cm and 325px in UI in Word and rounds down to 8609 Hmm. FIXME: Expected value is wrong.
// Right after import we get a rounding error: 8662 vs 8664.
if (mbExported)
{
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
index a8477c523e53..cc63f77e5c56 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx
@@ -125,12 +125,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDmlTextshapeB, "dml-textshapeB.docx")
uno::Reference<container::XIndexAccess> xGroup(getShape(1), uno::UNO_QUERY);
uno::Reference<drawing::XShape> xShape(xGroup->getByIndex(3), uno::UNO_QUERY);
// Connector was incorrectly shifted towards the top left corner, X was 192, Y was -5743.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(3778), xShape->getPosition().X);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(-5066), xShape->getPosition().Y);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(3776), xShape->getPosition().X);
+ // Value as of LO7.2. Whole group is still shifted 3mm to rigth and 5mm down.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-5063), xShape->getPosition().Y);
xShape.set(xGroup->getByIndex(5), uno::UNO_QUERY);
// This was incorrectly shifted towards the top of the page, Y was -5011.
- CPPUNIT_ASSERT_EQUAL(sal_Int32(-4715), xShape->getPosition().Y);
+ // Value as of LO 7.2
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-4712), xShape->getPosition().Y);
}
DECLARE_OOXMLEXPORT_TEST(testDMLSolidfillAlpha, "dml-solidfill-alpha.docx")
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 49713ada5e8b..d240abbfe628 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -712,7 +712,8 @@ DECLARE_OOXMLIMPORT_TEST(testFdo43641, "fdo43641.docx")
uno::Reference<container::XIndexAccess> xGroupShape(getShape(1), uno::UNO_QUERY);
uno::Reference<drawing::XShape> xLine(xGroupShape->getByIndex(1), uno::UNO_QUERY);
// This was 2200, not 2579 in mm100, i.e. the size of the line shape was incorrect.
- CPPUNIT_ASSERT_EQUAL(oox::drawingml::convertEmuToHmm(928440), xLine->getSize().Width);
+ // File cx=928694EMU = 2579.7Hmm, round up 2580Hmm. Currently off by 1.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(2579), xLine->getSize().Width);
}
DECLARE_OOXMLIMPORT_TEST(testGroupshapeSdt, "groupshape-sdt.docx")
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index f2d81877bdeb..43608c5bd136 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -205,8 +205,9 @@ DECLARE_OOXMLIMPORT_TEST(testTdf118693, "tdf118693.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(10162), aPosGroup.X);
CPPUNIT_ASSERT_EQUAL(sal_Int32(118), aPosGroup.Y);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(6369), aSizeGroup.Width);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(4983), aSizeGroup.Height);
+ // As of LO7.2 width by 1 too small, height by 2 too small. Reason unclear.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(6368), aSizeGroup.Width);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4981), aSizeGroup.Height);
// Without the fix in place, this test would have failed at many places
// as the first shape in the group would have had an incorrect position,
@@ -216,10 +217,10 @@ DECLARE_OOXMLIMPORT_TEST(testTdf118693, "tdf118693.docx")
awt::Point aPosShape1 = xShape1->getPosition();
awt::Size aSizeShape1 = xShape1->getSize();
- CPPUNIT_ASSERT_EQUAL(sal_Int32(12863), aPosShape1.X);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(12861), aPosShape1.X);
CPPUNIT_ASSERT_EQUAL(sal_Int32(146), aPosShape1.Y);
CPPUNIT_ASSERT_EQUAL(sal_Int32(3669), aSizeShape1.Width);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(4914), aSizeShape1.Height);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4912), aSizeShape1.Height);
uno::Reference<drawing::XShape> xShape2(xGroup->getByIndex(1), uno::UNO_QUERY_THROW);
awt::Point aPosShape2 = xShape2->getPosition();
@@ -228,7 +229,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf118693, "tdf118693.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(10162), aPosShape2.X);
CPPUNIT_ASSERT_EQUAL(sal_Int32(118), aPosShape2.Y);
CPPUNIT_ASSERT_EQUAL(sal_Int32(4595), aSizeShape2.Width);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(4983), aSizeShape2.Height);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(4981), aSizeShape2.Height);
}
DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx")
@@ -284,7 +285,9 @@ DECLARE_OOXMLIMPORT_TEST(test120551, "tdf120551.docx")
auto nHoriOrientPosition = getProperty<sal_Int32>(getShape(1), "HoriOrientPosition");
// Without the accompanying fix in place, this test would have failed with
// 'Expected: 430, Actual : -2542'.
- CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(430), nHoriOrientPosition);
+ // CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(430), nHoriOrientPosition);
+ // File 140335EMU = 389,8Hmm
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(392), nHoriOrientPosition);
}
DECLARE_OOXMLIMPORT_TEST(testTdf111550, "tdf111550.docx")