[Libreoffice-commits] core.git: sc/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 25 15:18:09 UTC 2020


 sc/source/filter/xcl97/xcl97rec.cxx |   28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

New commits:
commit 03e28651142af2ffa7a3749b879f31bde98a2173
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Aug 25 14:44:34 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 25 17:17:29 2020 +0200

    crashtesting: exceptions thrown on export to xlsx
    
    e.g. ooo37900-1.xls
    
    since...
    
    commit 5e8875780d665b7ae0fee1a053b5ce78ec513f69
    Date:   Mon Aug 17 10:55:43 2020 +0200
    
        tdf#135828 XLSX shape export: fix distortion of rotated shapes
    
    Change-Id: Ib426486d9ea8be5d9a4eaa3a8e02bc849af683d8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101333
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx
index 7af2ddc59fa2..6cde8226c0ea 100644
--- a/sc/source/filter/xcl97/xcl97rec.cxx
+++ b/sc/source/filter/xcl97/xcl97rec.cxx
@@ -1097,21 +1097,25 @@ void XclObjAny::WriteFromTo( XclExpXmlStream& rStrm, const Reference< XShape >&
     awt::Size   aSize       = rShape->getSize();
 
     uno::Reference< beans::XPropertySet > xShapeProperties(rShape, uno::UNO_QUERY_THROW);
-    uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle");
-    sal_Int32 nRot = nRotProp.get<sal_Int32>();
-
-    if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100))
+    uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xShapeProperties->getPropertySetInfo();
+    if (xPropertySetInfo->hasPropertyByName("RotateAngle"))
     {
-        // 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.
+        uno::Any nRotProp = xShapeProperties->getPropertyValue("RotateAngle");
+        sal_Int32 nRot = nRotProp.get<sal_Int32>();
+
+        if ((nRot >= 45 * 100 && nRot < 135 * 100) || (nRot >= 225 * 100 && nRot < 315 * 100))
+        {
+            // 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.
 
-        sal_Int16 nHalfWidth = aSize.Width / 2;
-        sal_Int16 nHalfHeight = aSize.Height / 2;
-        aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth;
-        aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight;
+            sal_Int16 nHalfWidth = aSize.Width / 2;
+            sal_Int16 nHalfHeight = aSize.Height / 2;
+            aTopLeft.X = aTopLeft.X - nHalfHeight + nHalfWidth;
+            aTopLeft.Y = aTopLeft.Y - nHalfWidth + nHalfHeight;
 
-        std::swap(aSize.Width, aSize.Height);
+            std::swap(aSize.Width, aSize.Height);
+        }
     }
 
     tools::Rectangle   aLocation( aTopLeft.X, aTopLeft.Y, aTopLeft.X + aSize.Width, aTopLeft.Y + aSize.Height );


More information about the Libreoffice-commits mailing list