summaryrefslogtreecommitdiff
path: root/svx/qa
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2019-08-02 21:19:30 +0200
committerRegina Henschel <rb.henschel@t-online.de>2019-08-10 12:07:21 +0200
commitba61c3174bc24bc03e3f72fbc8d102b3312b5ff6 (patch)
treeccbe131e58d2dd83f9d1447d5893305a982e19cf /svx/qa
parentdb6470829f68cb01bb43ab1d9640f814a51f740c (diff)
tdf#126512 make handle of ooxml-shapes usable in odp
The error was that handles in OOXML shapes can be used in LibreOffice as long as you work in OOXML format, but not anymore when you convert the file to ODF. Handles in OOXML reference the adjustment values by name, e.g. 'RefX = adj5'. ODF has no way to save this, so this information is lost. The patch reconstructs this information from the shape definition of the preset shape. It gets the preset shape name 'foo' from the shape type 'ooxml-foo'. This means that it only works with our own naming convention. Still, I think it's an improvement for our users. Change-Id: Iebd9f36a5c36356a12c8687e961c7802111cbd85 Reviewed-on: https://gerrit.libreoffice.org/76887 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'svx/qa')
-rw-r--r--svx/qa/unit/customshapes.cxx47
-rw-r--r--svx/qa/unit/data/tdf126512_OOXMLHandleMovementInODF.odpbin0 -> 62627 bytes
2 files changed, 47 insertions, 0 deletions
diff --git a/svx/qa/unit/customshapes.cxx b/svx/qa/unit/customshapes.cxx
index b70a8e536218..5d1d4c3f44fe 100644
--- a/svx/qa/unit/customshapes.cxx
+++ b/svx/qa/unit/customshapes.cxx
@@ -413,6 +413,53 @@ CPPUNIT_TEST_FIXTURE(CustomshapesTest, testQuadraticCurveTo)
//Add some tolerance
CPPUNIT_ASSERT_DOUBLES_EQUAL_MESSAGE("bad height of quadraticcurveto", 3004, fHeight, 10.0);
}
+
+CPPUNIT_TEST_FIXTURE(CustomshapesTest, testTdf126512_OOXML_handle_in_ODP)
+{
+ // The test covers all preset shapes with handles. Connectors are included as ordinary
+ // shapes to prevent converting. The file was created in PowerPoint 365 and then
+ // opened and exported to ODF format by LibreOffice.
+ // Error was, that for shapes, which were originally imported from OOXML, the handles
+ // could not be moved at all.
+ const OUString sFileName("tdf126512_OOXMLHandleMovementInODF.odp");
+ OUString sURL = m_directories.getURLFromSrc(sDataDirectory) + sFileName;
+ mxComponent = loadFromDesktop(sURL, "com.sun.star.comp.drawing.DrawingDocument");
+ CPPUNIT_ASSERT_MESSAGE("Could not load document", mxComponent.is());
+
+ OUString sErrors; // sErrors collects shape type and handle index for failing cases
+ for (sal_uInt8 i = 0; i < countShapes(); i++)
+ {
+ uno::Reference<drawing::XShape> xShape(getShape(i));
+ SdrObjCustomShape& rSdrObjCustomShape(
+ static_cast<SdrObjCustomShape&>(*GetSdrObjectFromXShape(xShape)));
+ OUString sShapeType("non-primitive"); // only to initialize, value not used here
+ const SdrCustomShapeGeometryItem& rGeometryItem(
+ rSdrObjCustomShape.GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY));
+ const uno::Any* pAny = rGeometryItem.GetPropertyValueByName("Type");
+ if (pAny)
+ *pAny >>= sShapeType;
+
+ sal_uInt8 nHandlesCount = rSdrObjCustomShape.GetInteractionHandles().size();
+ for (sal_uInt8 j = 0; j < nHandlesCount; j++)
+ {
+ css::awt::Point aInitialPosition(
+ rSdrObjCustomShape.GetInteractionHandles()[j].aPosition);
+ // The handles are initialized in the test document, so that if the handle is moveable
+ // in that direction at all, then it can move at least with an amount of 100.
+ Point aDesiredPosition(aInitialPosition.X + 100, aInitialPosition.Y + 100);
+ rSdrObjCustomShape.DragMoveCustomShapeHdl(aDesiredPosition, j, false);
+ css::awt::Point aObservedPosition(
+ rSdrObjCustomShape.GetInteractionHandles()[j].aPosition);
+ if (aInitialPosition.X == aObservedPosition.X
+ && aInitialPosition.Y == aObservedPosition.Y)
+ {
+ sErrors += "\n";
+ sErrors += OUString::number(i) + " " + sShapeType + " " + OUString::number(j);
+ }
+ }
+ }
+ CPPUNIT_ASSERT_EQUAL(OUString(), sErrors);
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/qa/unit/data/tdf126512_OOXMLHandleMovementInODF.odp b/svx/qa/unit/data/tdf126512_OOXMLHandleMovementInODF.odp
new file mode 100644
index 000000000000..7dd283f8807d
--- /dev/null
+++ b/svx/qa/unit/data/tdf126512_OOXMLHandleMovementInODF.odp
Binary files differ