summaryrefslogtreecommitdiff
path: root/oox/qa
diff options
context:
space:
mode:
authorDaniel Arato (NISZ) <arato.daniel@nisz.hu>2020-09-29 16:37:41 +0200
committerLászló Németh <nemeth@numbertext.org>2020-10-09 10:12:35 +0200
commita9c5c0d814a266096483572b84c72875ef8efd77 (patch)
tree88e3ccb249e188f10050addc1a7cfdf173dc8e71 /oox/qa
parent20da1a5dd37c7edac620566c992d5a53b23a5f12 (diff)
tdf#133037 OOXML shape import: camera rotation along Z
Instead of implementing proper OOXML 3D rotation (which would be an entirely new feature if I understand correctly), I merely interpret attribute "rev" of the rotation element a:camera/a:rot as a directive to rotate the entire shape the usual 2D way. That is already implemented and works well. This isn't the same thing Word does, but it might be good enough for now. This is kind of a mock solution, but it will be very easy to revert if it turns out to cause problems. Note: the export worked well previously, too (moreover, reloading the first LO export fixed the import). Change-Id: I2a99c119880bbed1c5b6430c4638cfbd10b7ac06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103627 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox/qa')
-rw-r--r--oox/qa/unit/data/camera-rotation-revolution.docxbin0 -> 23748 bytes
-rw-r--r--oox/qa/unit/drawingml.cxx25
2 files changed, 25 insertions, 0 deletions
diff --git a/oox/qa/unit/data/camera-rotation-revolution.docx b/oox/qa/unit/data/camera-rotation-revolution.docx
new file mode 100644
index 000000000000..74054aa82b3f
--- /dev/null
+++ b/oox/qa/unit/data/camera-rotation-revolution.docx
Binary files differ
diff --git a/oox/qa/unit/drawingml.cxx b/oox/qa/unit/drawingml.cxx
index 7fcee1756a6f..6a0415b257f2 100644
--- a/oox/qa/unit/drawingml.cxx
+++ b/oox/qa/unit/drawingml.cxx
@@ -265,6 +265,31 @@ CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testShapeTextAdjustLeft)
CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust_BLOCK, eAdjust);
}
+CPPUNIT_TEST_FIXTURE(OoxDrawingmlTest, testCameraRotationRevolution)
+{
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "camera-rotation-revolution.docx";
+ load(aURL);
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+ uno::Reference<container::XNamed> xShape0(xDrawPage->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<container::XNamed> xShape1(xDrawPage->getByIndex(1), uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xShapeProps0(xShape0, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySet> xShapeProps1(xShape1, uno::UNO_QUERY);
+ sal_Int32 nRotateAngle0;
+ sal_Int32 nRotateAngle1;
+ xShapeProps0->getPropertyValue("RotateAngle") >>= nRotateAngle0;
+ xShapeProps1->getPropertyValue("RotateAngle") >>= nRotateAngle1;
+
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 8000
+ // - Actual : 0
+ // so the camera rotation would not have been factored into how the shape is displayed
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(8000), nRotateAngle0);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(27000), nRotateAngle1);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */