summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-06-07 15:48:25 +0200
committerGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-06-08 11:23:02 +0200
commit3644c9ab6f15a5d539681e84a1d29aa30af561d5 (patch)
tree5fee35350c75218c8fb1f816f4a4487d8831c015 /oox
parentc744dac16ad808c73021cb2cecefe1d484934451 (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> Reviewed-on: https://gerrit.libreoffice.org/73681
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx18
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);
}