diff options
author | Regényi Balázs <regenyi.balazs@nisz.hu> | 2020-10-22 16:12:11 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-10-27 14:05:55 +0100 |
commit | ca83804ffcd0d6f81fa7c32be990c4ceeb4a60b7 (patch) | |
tree | 270980b9ec34c54f0004b5d89d525a2c1cf403e0 /oox/source/vml | |
parent | c690d49770d0c93a95bd8c3d11e95c1d17a17a60 (diff) |
tdf#137678 DOCX VML shape import: fix missing horizontal mirroring
The MirroredY 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: Iaa7e3a352598ad12c5e0d40b4fcd43fd197c4df9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104662
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox/source/vml')
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 54f1fcec5ae6..43b54a658db6 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -1013,6 +1013,28 @@ namespace aPoint2.setY(aPoint2.getY() + 1); pShape->NbcMirror(aCenter, aPoint2); } + + void doMirrorY(SdrObject* pShape) + { + Point aCenter(pShape->GetSnapRect().Center()); + Point aPoint2(aCenter); + aPoint2.setX(aPoint2.getX() + 1); + pShape->NbcMirror(aCenter, aPoint2); + } + + void handleMirroring(const ShapeTypeModel& rTypeModel, Reference<XShape>& rxShape) + { + if (!rTypeModel.maFlip.isEmpty()) + { + if (SdrObject* pShape = GetSdrObjectFromXShape(rxShape)) + { + if (rTypeModel.maFlip.startsWith("x")) + doMirrorX(pShape); + if (rTypeModel.maFlip.endsWith("y")) + doMirrorY(pShape); + } + } + } } LineShape::LineShape(Drawing& rDrawing) @@ -1023,17 +1045,10 @@ LineShape::LineShape(Drawing& rDrawing) 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); - } - } + // tdf#97517 tdf#137678 + // The MirroredX and MirroredY properties (in the CustomShapeGeometry property) are not + // supported for the LineShape by UNO, so we have to make the mirroring here. + handleMirroring(maTypeModel, xShape); return xShape; } @@ -1173,21 +1188,7 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes } // Handle horizontal and vertical flip. - if (!maTypeModel.maFlip.isEmpty()) - { - if (SdrObject* pShape = GetSdrObjectFromXShape(xShape)) - { - if (maTypeModel.maFlip.startsWith("x")) - doMirrorX(pShape); - if (maTypeModel.maFlip.endsWith("y")) - { - Point aCenter(pShape->GetSnapRect().Center()); - Point aPoint2(aCenter); - aPoint2.setX(aPoint2.getX() + 1); - pShape->NbcMirror(aCenter, aPoint2); - } - } - } + handleMirroring(maTypeModel, xShape); return xShape; } |