[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-7-0' - sc/qa sc/source

Szabolcs Toth (via logerrit) logerrit at kemper.freedesktop.org
Wed Mar 3 14:09:24 UTC 2021


 sc/qa/unit/subsequent_export-test.cxx |   21 +++++++++++++++++++++
 sc/source/filter/xcl97/xcl97rec.cxx   |   11 +++--------
 2 files changed, 24 insertions(+), 8 deletions(-)

New commits:
commit 33dbe50194dbfaf2748691e6259eefdc63d35e67
Author:     Szabolcs Toth <toth.szabolcs at nisz.hu>
AuthorDate: Thu Dec 31 10:31:30 2020 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Wed Mar 3 15:08:49 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>
    (cherry picked from commit aa23da6b9e935fbfcb0b432d43c72f7a6db50657)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111885
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 760b194ed371..8df43f1e4922 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -276,6 +276,7 @@ public:
     void testTdf138824_linkToParentDirectory();
     void testTdf129969();
     void testTdf84874();
+    void testTdf139258_rotated_image();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -446,6 +447,7 @@ public:
     CPPUNIT_TEST(testTdf138824_linkToParentDirectory);
     CPPUNIT_TEST(testTdf129969);
     CPPUNIT_TEST(testTdf84874);
+    CPPUNIT_TEST(testTdf139258_rotated_image);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -5694,6 +5696,25 @@ void ScExportTest::testTdf84874()
     xDocSh->DoClose();
 }
 
+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 38ad870c4970..b8676ca00e4e 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1103,14 +1103,9 @@ 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
             // can draw this shape correctly.


More information about the Libreoffice-commits mailing list