diff options
author | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-06-07 15:48:25 +0200 |
---|---|---|
committer | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-06-07 23:12:45 +0200 |
commit | 8aae7e4bc8dee27bc9dce3f1478777beeeb76e2f (patch) | |
tree | fdbce7d1138f9920bc81dc2f37a5316d3afb6483 /oox | |
parent | 42223dc7577e18f085592ae2cc06fa4bf3362631 (diff) |
tdf#125551 PPTX export: correct position and size of diagrams
Save position and size of diagram background instead of whole group shape.
Some diagrams contain shapes that are outside these boundaries. That caused
diagram to grow and move.
Change-Id: I909c13a5dc268f77832234b3884b91292922823c
Reviewed-on: https://gerrit.libreoffice.org/73663
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/drawingml.cxx | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index cd91bb12cbe0..85834a14b1b0 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -67,6 +67,7 @@ #include <com/sun/star/drawing/TextHorizontalAdjust.hpp> #include <com/sun/star/drawing/TextVerticalAdjust.hpp> #include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/drawing/XShapes.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/graphic/XGraphic.hpp> @@ -4074,10 +4075,19 @@ void DrawingML::WriteDiagram(const css::uno::Reference<css::drawing::XShape>& rX mpFS->endElementNS(XML_p, XML_nvGraphicFramePr); - awt::Point aPos = rXShape->getPosition(); - awt::Size aSize = rXShape->getSize(); - WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height)), - XML_p, false, false, 0, false); + // store size and position of background shape instead of group shape + // as some shapes may be outside + css::uno::Reference<css::drawing::XShapes> xShapes(rXShape, uno::UNO_QUERY); + if (xShapes.is() && xShapes->hasElements()) + { + css::uno::Reference<css::drawing::XShape> xShapeBg(xShapes->getByIndex(0), + uno::UNO_QUERY); + awt::Point aPos = xShapeBg->getPosition(); + awt::Size aSize = xShapeBg->getSize(); + WriteTransformation( + tools::Rectangle(Point(aPos.X, aPos.Y), Size(aSize.Width, aSize.Height)), + XML_p, false, false, 0, false); + } mpFS->startElementNS(XML_a, XML_graphic); } |