Blob Blame History Raw
From feed03c590232659e6278ed7eb4137c479543b86 Mon Sep 17 00:00:00 2001
From: Kohei Yoshida <kohei.yoshida@collabora.com>
Date: Fri, 1 Aug 2014 21:39:49 -0400
Subject: [PATCH 080/137] bnc#886540: Default chart background for pptx docs
 should be transparent.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Charts in docx and xlsx OTOH use solid white as the default fill style.

(cherry picked from commit 4a8f2431718f99de6fd9ee3461d703d007261c03)

Conflicts:
	oox/source/drawingml/chart/chartspaceconverter.cxx
	oox/source/ppt/pptimport.cxx

Change-Id: Ic4351fe65cabc12d60214b67c7026a317841f2c7
Reviewed-on: https://gerrit.libreoffice.org/10737
Reviewed-by: Matúš Kukan <matus.kukan@collabora.com>
Tested-by: Matúš Kukan <matus.kukan@collabora.com>
---
 include/oox/helper/graphichelper.hxx               | 3 +++
 oox/source/drawingml/chart/chartspaceconverter.cxx | 9 ++++++++-
 oox/source/helper/graphichelper.cxx                | 5 +++++
 oox/source/ppt/pptimport.cxx                       | 6 ++++++
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
index b96e993..9e90531 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -24,6 +24,7 @@
 #include <map>
 #include <rtl/ustring.hxx>
 #include <com/sun/star/awt/DeviceInfo.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include <com/sun/star/uno/Reference.hxx>
 #include <oox/helper/binarystreambase.hxx>
 #include <oox/helper/storagebase.hxx>
@@ -75,6 +76,8 @@ public:
     /** Derived classes may implement to resolve a palette index to an RGB color. */
     virtual sal_Int32   getPaletteColor( sal_Int32 nPaletteIdx ) const;
 
+    virtual css::drawing::FillStyle getDefaultChartAreaFillStyle() const;
+
     // Device info and device dependent unit conversion -----------------------
 
     /** Returns information about the output device. */
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index db04215..eeba446 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -25,12 +25,14 @@
 #include <com/sun/star/chart2/XTitled.hpp>
 #include <com/sun/star/chart2/data/XDataReceiver.hpp>
 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/drawingml/chart/chartconverter.hxx"
 #include "oox/drawingml/chart/chartdrawingfragment.hxx"
 #include "oox/drawingml/chart/chartspacemodel.hxx"
 #include "oox/drawingml/chart/plotareaconverter.hxx"
 #include "oox/drawingml/chart/titleconverter.hxx"
+#include <oox/helper/graphichelper.hxx>
 
 using namespace ::com::sun::star;
 using ::com::sun::star::uno::Reference;
@@ -90,8 +92,13 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern
     {
     }
 
-    // formatting of the chart background
+    // formatting of the chart background.  The default fill style varies with applications.
     PropertySet aBackPropSet( getChartDocument()->getPageBackground() );
+
+    aBackPropSet.setProperty(
+        PROP_FillStyle,
+        uno::makeAny(getFilter().getGraphicHelper().getDefaultChartAreaFillStyle()));
+
     getFormatter().convertFrameFormatting( aBackPropSet, mrModel.mxShapeProp, OBJECTTYPE_CHARTSPACE );
 
     // convert plot area (container of all chart type groups)
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index 5cb2b69..e40f019 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -158,6 +158,11 @@ sal_Int32 GraphicHelper::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const
     return API_RGB_TRANSPARENT;
 }
 
+drawing::FillStyle GraphicHelper::getDefaultChartAreaFillStyle() const
+{
+    return drawing::FillStyle_SOLID;
+}
+
 // Device info and device dependent unit conversion ---------------------------
 
 const awt::DeviceInfo& GraphicHelper::getDeviceInfo() const
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index fc9dadf..d294b79 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -185,6 +185,7 @@ class PptGraphicHelper : public GraphicHelper
 public:
     explicit            PptGraphicHelper( const PowerPointImport& rFilter );
     virtual sal_Int32   getSchemeColor( sal_Int32 nToken ) const;
+    virtual drawing::FillStyle getDefaultChartAreaFillStyle() const;
 private:
     const PowerPointImport& mrFilter;
 };
@@ -200,6 +201,11 @@ sal_Int32 PptGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
     return mrFilter.getSchemeColor( nToken );
 }
 
+drawing::FillStyle PptGraphicHelper::getDefaultChartAreaFillStyle() const
+{
+    return drawing::FillStyle_NONE;
+}
+
 } // namespace
 
 GraphicHelper* PowerPointImport::implCreateGraphicHelper() const
-- 
1.9.3