summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSzabolcs Toth <toth.szabolcs@nisz.hu>2020-09-17 11:22:09 +0200
committerLászló Németh <nemeth@numbertext.org>2020-10-06 09:45:51 +0200
commitff5ca4e5fc6a9fb24b0eb6eb629210b024473f67 (patch)
treeb8855d7478fea1aaee4d3a61aacd6695a68a1e45 /sc
parentdfa1856cdb4c69985ef1e809d33055427b6fbd76 (diff)
tdf#137000 XLSX shape export: fix upright
Upright is an XML attribute of xdr:txBody/a:bodyPr. It is set in MSO when in a textbox menu we choose "Do not rotate this element". LO import uses a text rotation opposite shape rotation to create upright text, but when exporting the attribute "upright" we must make sure that the text rotation in bodyPr is 0, not the temporary opposite value. Otherwise MSO rotates the text. Note: integer precision of rotation is enough for interoperability, because it's possible to rotate the shapes only by whole degrees in MSO. Follow-up of commit 8c23be49fb5a9044989532e6e20feb1e3ff64f2b (tdf#106197 XLSX shape import: keep text upright). Co-authored-by: Balázs Regényi Change-Id: I0ffae41f83d3fc3a1fa37f413a8fc9fd8ccd9b6b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103094 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/tdf137000_export_upright.xlsxbin0 -> 8919 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx22
2 files changed, 22 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/tdf137000_export_upright.xlsx b/sc/qa/unit/data/xlsx/tdf137000_export_upright.xlsx
new file mode 100644
index 000000000000..5ac0a75eabb6
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf137000_export_upright.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index a5e935dfb740..89a3659fe640 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -270,6 +270,8 @@ public:
void testTdf123353();
void testTdf133688_precedents();
void testTdf91251_missingOverflowRoundtrip();
+ void testTdf137000_handle_upright();
+
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -434,6 +436,7 @@ public:
CPPUNIT_TEST(testTdf123353);
CPPUNIT_TEST(testTdf133688_precedents);
CPPUNIT_TEST(testTdf91251_missingOverflowRoundtrip);
+ CPPUNIT_TEST(testTdf137000_handle_upright);
CPPUNIT_TEST_SUITE_END();
@@ -5483,6 +5486,25 @@ void ScExportTest::testTdf91251_missingOverflowRoundtrip()
assertXPath(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:sp/xdr:txBody/a:bodyPr", "horzOverflow", "clip");
}
+void ScExportTest::testTdf137000_handle_upright()
+{
+ // tdf#106197 When exporting the "upright" attribute, we must set
+ // TextPreRotateAngle to 0.
+ // (Upright is an xml attribute of xdr:txBody/a:bodyPr. It is set when
+ // in a textbox menu we choose: do not rotate this element.)
+ ScDocShellRef xShell = loadDoc("tdf137000_export_upright.", FORMAT_XLSX);
+ CPPUNIT_ASSERT(xShell.is());
+
+ std::shared_ptr<utl::TempFile> pXPathFile
+ = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX);
+ xmlDocUniquePtr pDrawing
+ = 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");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();