[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.4' - oox/source sw/qa
Miklos Vajna
vmiklos at collabora.co.uk
Fri Nov 13 01:40:57 PST 2015
oox/source/drawingml/shape.cxx | 13 +++++++++++--
sw/qa/extras/ooxmlimport/data/tdf85232.docx |binary
sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 11 +++++++++++
3 files changed, 22 insertions(+), 2 deletions(-)
New commits:
commit d78e31003e98e1404cfaf52fb4a9815f4ba1c409
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Nov 11 08:57:31 2015 +0100
tdf#85232 WPG import: fix handling of line shapes
The missing convertMm100ToTwip() calls mispositioned the line shapes
inside the groupshape in case of using drawingML inside DOCX files.
(cherry picked from commit 11129d89b152db54c86bb2bda58c24b8abb6c5a8)
Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
Conflicts:
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
Change-Id: I0c9d652de43d779f9073a8bfe22866ce4f31d0fa
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 81251f2..6ccdf27 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -478,10 +478,11 @@ Reference< XShape > Shape::createAndInsert(
aTransformation.translate( aCenter.getX(), aCenter.getY() );
}
+ bool bInGroup = !aParentTransformation.isIdentity();
if( maPosition.X != 0 || maPosition.Y != 0)
{
// if global position is used, add it to transformation
- if (mbWps && aParentTransformation.isIdentity())
+ if (mbWps && !bInGroup)
aTransformation.translate( maPosition.X * EMU_PER_HMM, maPosition.Y * EMU_PER_HMM);
else
aTransformation.translate( maPosition.X, maPosition.Y );
@@ -503,10 +504,18 @@ Reference< XShape > Shape::createAndInsert(
sal_Int32 i, nNumPoints = aPoly.count();
uno::Sequence< awt::Point > aPointSequence( nNumPoints );
awt::Point* pPoints = aPointSequence.getArray();
+ uno::Reference<lang::XServiceInfo> xModelInfo(rFilterBase.getModel(), uno::UNO_QUERY);
+ bool bIsWriter = xModelInfo->supportsService("com.sun.star.text.TextDocument");
for( i = 0; i < nNumPoints; ++i )
{
const ::basegfx::B2DPoint aPoint( aPoly.getB2DPoint( i ) );
- pPoints[ i ] = awt::Point( static_cast< sal_Int32 >( aPoint.getX() ), static_cast< sal_Int32 >( aPoint.getY() ) );
+ if (bIsWriter && bInGroup)
+ // Writer's draw page is in twips, and these points get passed
+ // to core without any unit conversion when Writer
+ // postprocesses only the group shape itself.
+ pPoints[i] = awt::Point(static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getX())), static_cast<sal_Int32>(convertMm100ToTwip(aPoint.getY())));
+ else
+ pPoints[i] = awt::Point(static_cast<sal_Int32>(aPoint.getX()), static_cast<sal_Int32>(aPoint.getY()));
}
uno::Sequence< uno::Sequence< awt::Point > > aPolyPolySequence( 1 );
aPolyPolySequence.getArray()[ 0 ] = aPointSequence;
diff --git a/sw/qa/extras/ooxmlimport/data/tdf85232.docx b/sw/qa/extras/ooxmlimport/data/tdf85232.docx
new file mode 100644
index 0000000..35e8a88
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf85232.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index a71c4f9..b7c5b82 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -2657,6 +2657,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf92454, "tdf92454.docx")
CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, xParagraph->getPropertyState("ParaFirstLineIndent"));
}
+DECLARE_OOXMLIMPORT_TEST(testTdf85232, "tdf85232.docx")
+{
+ uno::Reference<drawing::XShapes> xShapes(getShapeByName("Group 219"), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShape(xShapes->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapeDescriptor> xShapeDescriptor(xShape, uno::UNO_QUERY);
+ // Make sure we're not testing the ellipse child.
+ CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.LineShape"), xShapeDescriptor->getShapeType());
+ // This was 2900: horizontal position of the line was incorrect, the 3 children were not connected visually.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(2267), xShape->getPosition().X);
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list