diff options
author | Regényi Balázs <regenyi.balazs@nisz.hu> | 2020-10-22 13:36:25 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-10-26 18:22:18 +0100 |
commit | ed943c6afeb33b9fee0ef530df7db592aa152a73 (patch) | |
tree | 7d8b12ad188fb03c2231aae8f1a3cabe6e17744b /oox | |
parent | 41e230e81b50235b5b86f883ef424a8ba5b42288 (diff) |
tdf#97517 DOCX VML shape import: fix missing vertical mirroring
The MirroredX property is set (in the CustomShapeGeometry property), but
it is not supported for the LineShape by UNO, so we have to make the
mirroring during importing.
Change-Id: I65a1f9a115a003c056ae31f4bc217206a0e6dcd8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104656
Tested-by: Jenkins
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index d70a9563e106..54f1fcec5ae6 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -1004,11 +1004,39 @@ Reference< XShape > PolyLineShape::implConvertAndInsert( const Reference< XShape return xShape; } +namespace +{ + void doMirrorX(SdrObject* pShape) + { + Point aCenter(pShape->GetSnapRect().Center()); + Point aPoint2(aCenter); + aPoint2.setY(aPoint2.getY() + 1); + pShape->NbcMirror(aCenter, aPoint2); + } +} + LineShape::LineShape(Drawing& rDrawing) : SimpleShape(rDrawing, "com.sun.star.drawing.LineShape") { } +Reference<XShape> LineShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const awt::Rectangle& rShapeRect) const +{ + Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect); + // Handle vertical flip. + // tdf#97517 The MirroredX property (in the CustomShapeGeometry property) is not supported for + // the LineShape by UNO, so we have to make the mirroring here + if (!maTypeModel.maFlip.isEmpty()) + { + if (SdrObject* pShape = GetSdrObjectFromXShape(xShape)) + { + if (maTypeModel.maFlip.startsWith("x")) + doMirrorX(pShape); + } + } + return xShape; +} + awt::Rectangle LineShape::getAbsRectangle() const { const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); @@ -1150,12 +1178,7 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes if (SdrObject* pShape = GetSdrObjectFromXShape(xShape)) { if (maTypeModel.maFlip.startsWith("x")) - { - Point aCenter(pShape->GetSnapRect().Center()); - Point aPoint2(aCenter); - aPoint2.setY(aPoint2.getY() + 1); - pShape->NbcMirror(aCenter, aPoint2); - } + doMirrorX(pShape); if (maTypeModel.maFlip.endsWith("y")) { Point aCenter(pShape->GetSnapRect().Center()); |