oox/source/export/chartexport.cxx |   26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 0d55bd08f77c01fa6e34becc1505268dda7851b8
Author: Caolán McNamara <caol...@redhat.com>
Date:   Thu Jan 18 17:36:31 2018 +0000

    crashtesting: multiple export failures
    
    since...
    
    commit 84392651d2731cce91c3b2e144bed4ac07e4ddf1
    Date:   Wed Jan 3 23:27:16 2018 +0100
    
        tdf#114173 Preserve size of chart legend during xlsx export
    
    Change-Id: Iebc936a0f490d6b707dfee0343732753f56728e7
    Reviewed-on: https://gerrit.libreoffice.org/48147
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>
    (cherry picked from commit fa68bed11c180ebb0d45fb7779d538098b2921ff)
    Reviewed-on: https://gerrit.libreoffice.org/48153
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/oox/source/export/chartexport.cxx 
b/oox/source/export/chartexport.cxx
index cf00594d23c1..128a166c6c4a 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -862,13 +862,9 @@ void ChartExport::exportLegend( const Reference< 
css::chart::XChartDocument >& x
                     XML_val, "edge",
                     FSEND);
             chart2::RelativePosition aPos = 
aRelativePos.get<chart2::RelativePosition>();
-            uno::Any aRelativeSize = xProp->getPropertyValue("RelativeSize");
-            chart2::RelativeSize aSize = 
aRelativeSize.get<chart2::RelativeSize>();
 
             const double x = aPos.Primary;
             const double y = aPos.Secondary;
-            const double w = aSize.Primary;
-            const double h = aSize.Secondary;
 
             pFS->singleElement(FSNS(XML_c, XML_x),
                     XML_val, IS(x),
@@ -877,13 +873,23 @@ void ChartExport::exportLegend( const Reference< 
css::chart::XChartDocument >& x
                     XML_val, IS(y),
                     FSEND);
 
-            pFS->singleElement(FSNS(XML_c, XML_w),
-                    XML_val, IS(w),
-                    FSEND);
+            uno::Any aRelativeSize = xProp->getPropertyValue("RelativeSize");
+            if (aRelativeSize.hasValue())
+            {
+                chart2::RelativeSize aSize = 
aRelativeSize.get<chart2::RelativeSize>();
+
+                const double w = aSize.Primary;
+                const double h = aSize.Secondary;
+
+                pFS->singleElement(FSNS(XML_c, XML_w),
+                        XML_val, IS(w),
+                        FSEND);
+
+                pFS->singleElement(FSNS(XML_c, XML_h),
+                        XML_val, IS(h),
+                        FSEND);
+            }
 
-            pFS->singleElement(FSNS(XML_c, XML_h),
-                    XML_val, IS(h),
-                    FSEND);
             SAL_WARN_IF(aPos.Anchor != css::drawing::Alignment_TOP_LEFT, 
"oox", "unsupported anchor position");
 
             pFS->endElement(FSNS(XML_c, XML_manualLayout));
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to