Kaydet (Commit) 36ac7749 authored tarafından Miklos Vajna's avatar Miklos Vajna

DOCX import: make sure rotation does not affect shape position

Change-Id: I7916a24d63bb7c995267059e9bedbf1f08adc152
üst 2916dfdb
......@@ -272,6 +272,17 @@ DECLARE_OOXMLEXPORT_TEST(testChartDupe, "chart-dupe.docx")
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xEmbeddedObjects->getCount());
}
DECLARE_OOXMLEXPORT_TEST(testPositionAndRotation, "position-and-rotation.docx")
{
// The document should look like: "This line is tricky, <image> because only 'This line is tricky,' is on the left."
// But the image was pushed down, so it did not break the line into two text portions.
uno::Reference<drawing::XShape> xShape = getShape(1);
// Should be 1559, was -5639
CPPUNIT_ASSERT(xShape->getPosition().X > 1500);
// Should be 88, was 473
CPPUNIT_ASSERT(xShape->getPosition().Y < 100);
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -779,9 +779,23 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue)
if (xServiceInfo->supportsService("com.sun.star.drawing.GroupShape") ||
xServiceInfo->supportsService("com.sun.star.drawing.GraphicObjectShape"))
{
// You would expect that position and rotation are
// independent, but they are not. Till we are not
// there yet to handle all scaling, translation and
// rotation with a single transformation matrix,
// make sure there is no rotation set when we set
// the position.
sal_Int32 nRotation = 0;
xShapeProps->getPropertyValue("RotateAngle") >>= nRotation;
if (nRotation)
xShapeProps->setPropertyValue("RotateAngle", uno::makeAny(sal_Int32(0)));
// Position of the groupshape should be set after children have been added.
// fdo#80555: also set position for graphic shapes here
m_xShape->setPosition(awt::Point(m_pImpl->nLeftPosition, m_pImpl->nTopPosition));
if (nRotation)
xShapeProps->setPropertyValue("RotateAngle", uno::makeAny(nRotation));
}
m_pImpl->applyRelativePosition(xShapeProps);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment