From 48ad658a7aacf849e773aa5d3400540d81f988f2 Mon Sep 17 00:00:00 2001
From: Balazs Varga <balazs.varga991@gmail.com>
Date: Thu, 26 Nov 2020 17:44:24 +0100
Subject: tdf#138561 OOXML Chart import: fix custom shape position

and size within charts. Use default page size for custom
shapes, too, like in the case of other shapes (legend, titles,
etc.), until we get the actual size of the embedded chart.

Follow up commit: a01ccdfa5fd5a0260b7aedf955e1e5aa0df072c3
(tdf#138307 Chart import: fix disappeared text from custom shape)

Change-Id: Id6da7322326fbe8dfa570264107db59cc45dff31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106704
Reviewed-by: Balazs Varga <varga.balazs3@nisz.hu>
Tested-by: Balazs Varga <varga.balazs3@nisz.hu>
(cherry picked from commit f1a5bb0b79c212a0459b1a17dd15f1159e663dbd)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106820
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
---
 oox/source/drawingml/chart/chartspaceconverter.cxx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'oox')

diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 1f90c2e092eb..d33e0086cc08 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -275,9 +275,13 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern
             drawing page instead, it is not possible to embed OLE objects. */
         bool bOleSupport = rxExternalPage.is();
 
+        awt::Size aChartSize = getChartSize();
+        if( aChartSize.Width <= 0 || aChartSize.Height <= 0 )
+            aChartSize = getDefaultPageSize();
+
         // now, xShapes is not null anymore
         getFilter().importFragment( new ChartDrawingFragment(
-            getFilter(), mrModel.maDrawingPath, xShapes, getChartSize(), aShapesOffset, bOleSupport ) );
+            getFilter(), mrModel.maDrawingPath, xShapes, aChartSize, aShapesOffset, bOleSupport ) );
     }
     catch( Exception& )
     {
-- 
cgit