summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSzabolcs Toth <toth.szabolcs@nisz.hu>2021-05-19 08:42:29 +0200
committerLászló Németh <nemeth@numbertext.org>2021-05-25 13:41:29 +0200
commitb2190523e0b226bcae19cc8c3ce8a83855c7f009 (patch)
tree784b0e90daf8882ce93f13d1d0395d743ba5eaa1 /sc
parent4c1bab94d7c113f2fcb5458809fe8ec0683be951 (diff)
tdf#141644 OOXML shape import: fix upright text rotate angle
Text rotate angle was not imported correctly with "upright" setting, e.g. resulting horizontal text in shapes of XLSX documents instead of vertical. Change-Id: I2ad9ba3465278220e64123c4400acff4125310d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115777 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/xlsx/tdf141644.xlsxbin0 -> 9364 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx4
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx27
3 files changed, 29 insertions, 2 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf141644.xlsx b/sc/qa/unit/data/xlsx/tdf141644.xlsx
new file mode 100644
index 000000000000..61599d53fd62
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf141644.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 6d1b927e931a..7a74e6ebf1f6 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -5856,8 +5856,8 @@ void ScExportTest::testTdf137000_handle_upright()
= XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/drawing1.xml");
CPPUNIT_ASSERT(pDrawing);
- assertXPathNoAttribute(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr",
- "rot");
+ assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr",
+ "rot", "-5400000");
}
void ScExportTest::testTdf126305_DataValidatyErrorAlert()
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 078bd9d3686a..0aed0e30c4b2 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -311,6 +311,7 @@ public:
void testShapeRotationImport();
void testShapeDisplacementOnRotationImport();
void testTextBoxBodyUpright();
+ void testTextBoxBodyRotateAngle();
void testTextLengthDataValidityXLSX();
void testDeleteCircles();
void testDrawCircleInMergeCells();
@@ -512,6 +513,7 @@ public:
CPPUNIT_TEST(testShapeRotationImport);
CPPUNIT_TEST(testShapeDisplacementOnRotationImport);
CPPUNIT_TEST(testTextBoxBodyUpright);
+ CPPUNIT_TEST(testTextBoxBodyRotateAngle);
CPPUNIT_TEST(testTextLengthDataValidityXLSX);
CPPUNIT_TEST(testDeleteCircles);
CPPUNIT_TEST(testDrawCircleInMergeCells);
@@ -5557,6 +5559,31 @@ void ScFiltersTest::testTextBoxBodyUpright()
CPPUNIT_ASSERT_EQUAL(sal_Int32(90), nAngle);
}
+void ScFiltersTest::testTextBoxBodyRotateAngle()
+{
+ ScDocShellRef xDocSh = loadDoc(u"tdf141644.", FORMAT_XLSX);
+ CPPUNIT_ASSERT_MESSAGE("Failed to load tdf141644.xlsx", xDocSh.is());
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocSh->GetModel(), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<drawing::XShape> xShape(xPage->getByIndex(0), uno::UNO_QUERY_THROW);
+ uno::Reference<beans::XPropertySet> xShapeProperties(xShape, uno::UNO_QUERY_THROW);
+
+ // Check the new textRotateAngle.
+ sal_Int32 nAngle;
+ uno::Any aGeom = xShapeProperties->getPropertyValue("CustomShapeGeometry");
+ auto aGeomSeq = aGeom.get<Sequence<beans::PropertyValue>>();
+ for (const auto& aProp : std::as_const(aGeomSeq))
+ {
+ if (aProp.Name == "TextPreRotateAngle")
+ {
+ aProp.Value >>= nAngle;
+ break;
+ }
+ }
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(-270), nAngle);
+}
+
void ScFiltersTest::testTextLengthDataValidityXLSX()
{
ScDocShellRef xDocSh = loadDoc(u"textLengthDataValidity.", FORMAT_XLSX);