[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - oox/source sd/qa
Grzegorz Araminowicz (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jun 8 09:23:44 UTC 2019
oox/source/export/drawingml.cxx | 18 ++++++++++++++----
sd/qa/unit/data/pptx/tdf125551.pptx |binary
sd/qa/unit/export-tests-ooxml2.cxx | 17 +++++++++++++++++
3 files changed, 31 insertions(+), 4 deletions(-)
New commits:
commit 3644c9ab6f15a5d539681e84a1d29aa30af561d5
Author: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
AuthorDate: Fri Jun 7 15:48:25 2019 +0200
Commit: Grzegorz Araminowicz <grzegorz.araminowicz at collabora.com>
CommitDate: Sat Jun 8 11:23:02 2019 +0200
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 at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/73681
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);
}
diff --git a/sd/qa/unit/data/pptx/tdf125551.pptx b/sd/qa/unit/data/pptx/tdf125551.pptx
new file mode 100644
index 000000000000..fb7c106d20e2
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf125551.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index bc987a018af2..9c6cc27aa804 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -205,6 +205,7 @@ public:
void testTdf125360();
void testTdf125360_1();
void testTdf125360_2();
+ void testTdf125551();
CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
@@ -292,6 +293,7 @@ public:
CPPUNIT_TEST(testTdf125360);
CPPUNIT_TEST(testTdf125360_1);
CPPUNIT_TEST(testTdf125360_2);
+ CPPUNIT_TEST(testTdf125551);
CPPUNIT_TEST_SUITE_END();
@@ -2318,6 +2320,21 @@ void SdOOXMLExportTest2::testTdf125360_2()
xDocShRef->DoClose();
}
+void SdOOXMLExportTest2::testTdf125551()
+{
+ ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf125551.pptx"), PPTX);
+ utl::TempFile tempFile;
+ xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+ uno::Reference<drawing::XShapes> xGroupShape(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY);
+ uno::Reference<drawing::XShape> xShapeBg(xGroupShape->getByIndex(0), uno::UNO_QUERY);
+
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1024), xShapeBg->getPosition().X);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(576), xShapeBg->getPosition().Y);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(10815), xShapeBg->getSize().Width);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8587), xShapeBg->getSize().Height);
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();
More information about the Libreoffice-commits
mailing list