[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - sc/qa sc/source
Szabolcs Toth (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jan 19 10:44:18 UTC 2021
sc/qa/unit/data/ods/tdf139258_rotated_image.ods |binary
sc/qa/unit/subsequent_export-test.cxx | 21 +++++++++++++++++++++
sc/source/filter/xcl97/xcl97rec.cxx | 11 ++++-------
3 files changed, 25 insertions(+), 7 deletions(-)
New commits:
commit aa23da6b9e935fbfcb0b432d43c72f7a6db50657
Author: Szabolcs Toth <toth.szabolcs at nisz.hu>
AuthorDate: Thu Dec 31 10:31:30 2020 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jan 19 11:43:42 2021 +0100
tdf#139258 XLSX export: fix position of rotated images
Follow-up of commit a4eec60c388cc65ae0b4c8ea0fd7235f520a749d
(tdf#123613 XLSX export: fix position of rotated shapes) and
commit 368c56144aab5794c39d5bc2082d9b3d6d7cebdb (refactor
for xlsx shape export).
Change-Id: If5a79685efa1a80ea82eac19aed12bb426d10987
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108533
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit fddad2ed797f1773ed5be979a0b05d3f976b744e)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109517
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/sc/qa/unit/data/ods/tdf139258_rotated_image.ods b/sc/qa/unit/data/ods/tdf139258_rotated_image.ods
new file mode 100755
index 000000000000..a90537c14bd9
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf139258_rotated_image.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 054452eb6784..e2da767d9bbb 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -278,6 +278,7 @@ public:
void testTdf129969();
void testTdf84874();
void testTdf136721_paper_size();
+ void testTdf139258_rotated_image();
CPPUNIT_TEST_SUITE(ScExportTest);
CPPUNIT_TEST(test);
@@ -454,6 +455,7 @@ public:
CPPUNIT_TEST(testTdf129969);
CPPUNIT_TEST(testTdf84874);
CPPUNIT_TEST(testTdf136721_paper_size);
+ CPPUNIT_TEST(testTdf139258_rotated_image);
CPPUNIT_TEST_SUITE_END();
@@ -5778,6 +5780,25 @@ void ScExportTest::testTdf136721_paper_size()
assertXPath(pDoc, "/x:worksheet/x:pageSetup", "paperSize", "70");
}
+void ScExportTest::testTdf139258_rotated_image()
+{
+ // Check that the topleft position of the image is correct.
+ ScDocShellRef xShell = loadDoc(u"tdf139258_rotated_image.", FORMAT_ODS);
+ 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);
+
+ assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:col", "1");
+ assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:from/xdr:row", "12");
+ assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:col", "6");
+ assertXPathContent(pDrawing, "/xdr:wsDr/xdr:twoCellAnchor/xdr:to/xdr:row", "25");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 1fde9272f3f5..2eacb3edf28b 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1109,13 +1109,10 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >&
{
sal_Int16 nHalfWidth = aSize.Width / 2;
sal_Int16 nHalfHeight = aSize.Height / 2;
- // aTopLeft needs correction for rotated customshapes
- if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
- {
- const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape
- aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth;
- aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight;
- }
+
+ const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape
+ aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth;
+ aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight;
// MSO changes the anchor positions at these angles and that does an extra 90 degrees
// rotation on our shapes, so we output it in such position that MSO
More information about the Libreoffice-commits
mailing list