[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-4.3' - 5 commits - chart2/qa include/oox oox/source

Andras Timar andras.timar at collabora.com
Thu Feb 19 07:14:46 PST 2015


 chart2/qa/extras/chart2import.cxx                           |   20 ++++++++++++
 chart2/qa/extras/data/xlsx/chart-area-style-background.xlsx |binary
 include/oox/helper/graphichelper.hxx                        |    2 -
 oox/source/drawingml/chart/chartspaceconverter.cxx          |    9 -----
 oox/source/drawingml/chart/objectformatter.cxx              |   16 +++++++++
 oox/source/helper/graphichelper.cxx                         |    4 +-
 oox/source/ppt/pptimport.cxx                                |    6 +--
 7 files changed, 42 insertions(+), 15 deletions(-)

New commits:
commit 5bd236a51a8ab7319966dffb402abb97919b4e7c
Author: Andras Timar <andras.timar at collabora.com>
Date:   Thu Feb 19 11:55:01 2015 +0100

    fix chart2 unit test backport
    
    Change-Id: I40a3816b0a942ca9dcdb84c0fe96b21c71496c9f

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index c4d2952..f210c44 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -18,6 +18,7 @@
 #include <com/sun/star/chart/XChartData.hpp>
 #include <com/sun/star/chart2/XInternalDataProvider.hpp>
 #include <com/sun/star/chart/XChartDataArray.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
 
 #include <com/sun/star/util/Color.hpp>
 
commit 348c18b1516572a13aa79c0ca173976fec2ae483
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Feb 18 22:00:11 2015 +0100

    no need for that anymore
    
    Change-Id: I53002c0b97da66c44429b5ace0fc709b5e8a325f
    (cherry picked from commit de684f47da785c0da6194df1f582648ebf3d1569)

diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 6f2b3ff..5093ce4 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -80,10 +80,6 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern
 
     // 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)
commit dc9135df67a0dc703e7ee2b82a37af2d0e2e8004
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Feb 18 21:44:28 2015 +0100

    add test for missing chart area style fill import, tdf#89451
    
    (cherry picked from commit a9924d94e7db6db50b8b36a311f7d7abf80e4700)
    
    Conflicts:
    	chart2/qa/extras/chart2import.cxx
    
    Change-Id: I052838eaf4134a72feb067fc2a1355fabcafe11f

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 7cff8fd..c4d2952 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -41,6 +41,7 @@ public:
     void testSimpleStrictXLSX();
     void testDelayedCellImport(); // chart range referencing content on later sheets
     void testFlatODSStackedColumnChart();
+    void testChartAreaStyleBackgroundXLSX();
     void testNumberFormatsXLSX();
 
     CPPUNIT_TEST_SUITE(Chart2ImportTest);
@@ -67,6 +68,7 @@ public:
     CPPUNIT_TEST(testSimpleStrictXLSX);
     CPPUNIT_TEST(testDelayedCellImport);
     CPPUNIT_TEST(testFlatODSStackedColumnChart);
+    CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX);
     CPPUNIT_TEST(testNumberFormatsXLSX);
     CPPUNIT_TEST_SUITE_END();
 
@@ -386,6 +388,23 @@ void Chart2ImportTest::testFlatODSStackedColumnChart()
     // The stacked column chart should consist of 5 data series.
     CPPUNIT_ASSERT_EQUAL(sal_Int32(5), aSeriesSeq.getLength());
 }
+void Chart2ImportTest::testChartAreaStyleBackgroundXLSX()
+{
+    load("/chart2/qa/extras/data/xlsx/", "chart-area-style-background.xlsx");
+    uno::Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+    CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+    // "Automatic" chart background fill in xlsx should be loaded as solid white.
+    Reference<beans::XPropertySet> xPropSet = xChartDoc->getPageBackground();
+    CPPUNIT_ASSERT(xPropSet.is());
+    drawing::FillStyle eStyle = xPropSet->getPropertyValue("FillStyle").get<drawing::FillStyle>();
+    sal_Int32 nColor = xPropSet->getPropertyValue("FillColor").get<sal_Int32>();
+    CPPUNIT_ASSERT_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid fill.",
+        eStyle == drawing::FillStyle_SOLID);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("'Automatic' chart background fill in xlsx should be loaded as solid white.",
+        sal_Int32(0), nColor);
+}
+
 
 void Chart2ImportTest::testNumberFormatsXLSX()
 {
diff --git a/chart2/qa/extras/data/xlsx/chart-area-style-background.xlsx b/chart2/qa/extras/data/xlsx/chart-area-style-background.xlsx
new file mode 100644
index 0000000..2baf1e2
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/chart-area-style-background.xlsx differ
commit 3d48f83ef03d3cd49703c00003133aa63aa3c97c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Feb 18 21:19:08 2015 +0100

    better way to set default for chart area fill style, related tdf#89451
    
    Change-Id: Iee7fea0f55cf54d43a349b6cc0ffa25995069e40
    (cherry picked from commit 32fe0c6adcff25a0df536127ca980413e1cabefd)

diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx
index 5981445..09a226c 100644
--- a/include/oox/helper/graphichelper.hxx
+++ b/include/oox/helper/graphichelper.hxx
@@ -76,7 +76,7 @@ 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;
+    virtual sal_Int32 getDefaultChartAreaFillStyle() const;
 
     // Device info and device dependent unit conversion -----------------------
 
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 661fd32..d27b18f 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -32,6 +32,7 @@
 #include "oox/drawingml/theme.hxx"
 #include "oox/drawingml/chart/chartspacemodel.hxx"
 #include "oox/helper/modelobjecthelper.hxx"
+#include <oox/helper/graphichelper.hxx>
 
 namespace oox {
 namespace drawingml {
@@ -907,6 +908,11 @@ FillFormatter::FillFormatter( ObjectFormatterData& rData, const AutoFormatEntry*
         if( const Theme* pTheme = mrData.mrFilter.getCurrentTheme() )
             if( const FillProperties* pFillProps = pTheme->getFillStyle( pAutoFormatEntry->mnThemedIdx ) )
                 *mxAutoFill = *pFillProps;
+
+        if (eObjType == OBJECTTYPE_CHARTSPACE)
+        {
+            mxAutoFill->moFillType = rData.mrFilter.getGraphicHelper().getDefaultChartAreaFillStyle();
+        }
     }
 }
 
diff --git a/oox/source/helper/graphichelper.cxx b/oox/source/helper/graphichelper.cxx
index 5281da2..e730806 100644
--- a/oox/source/helper/graphichelper.cxx
+++ b/oox/source/helper/graphichelper.cxx
@@ -158,9 +158,9 @@ sal_Int32 GraphicHelper::getPaletteColor( sal_Int32 /*nPaletteIdx*/ ) const
     return API_RGB_TRANSPARENT;
 }
 
-drawing::FillStyle GraphicHelper::getDefaultChartAreaFillStyle() const
+sal_Int32 GraphicHelper::getDefaultChartAreaFillStyle() const
 {
-    return drawing::FillStyle_SOLID;
+    return XML_solidFill;
 }
 
 // Device info and device dependent unit conversion ---------------------------
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index bb200f8..4c97055 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -192,7 +192,7 @@ class PptGraphicHelper : public GraphicHelper
 public:
     explicit            PptGraphicHelper( const PowerPointImport& rFilter );
     virtual sal_Int32   getSchemeColor( sal_Int32 nToken ) const SAL_OVERRIDE;
-    virtual drawing::FillStyle getDefaultChartAreaFillStyle() const SAL_OVERRIDE;
+    virtual sal_Int32 getDefaultChartAreaFillStyle() const SAL_OVERRIDE;
 private:
     const PowerPointImport& mrFilter;
 };
@@ -208,9 +208,9 @@ sal_Int32 PptGraphicHelper::getSchemeColor( sal_Int32 nToken ) const
     return mrFilter.getSchemeColor( nToken );
 }
 
-drawing::FillStyle PptGraphicHelper::getDefaultChartAreaFillStyle() const
+sal_Int32 PptGraphicHelper::getDefaultChartAreaFillStyle() const
 {
-    return drawing::FillStyle_NONE;
+    return XML_noFill;
 }
 
 } // namespace
commit 83da3926ce6e9f7321fd5d633fd2678beb6c8f37
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Feb 18 20:16:43 2015 +0100

    implement fill based on style also for chart area, tdf#89451
    
    Change-Id: I7b488e222cd44e75d1e0ff7f8e545e9399f418b5
    (cherry picked from commit a51300bc9223b28fc5da6059e4fe1d2af62fb323)

diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 232ce6e5..6f2b3ff 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -84,10 +84,7 @@ void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExtern
         PROP_FillStyle,
         uno::makeAny(getFilter().getGraphicHelper().getDefaultChartAreaFillStyle()));
 
-    if( mrModel.mxShapeProp.is() )
-    {
-        getFormatter().convertFrameFormatting( aBackPropSet, mrModel.mxShapeProp, OBJECTTYPE_CHARTSPACE );
-    }
+    getFormatter().convertFrameFormatting( aBackPropSet, mrModel.mxShapeProp, OBJECTTYPE_CHARTSPACE );
 
     // convert plot area (container of all chart type groups)
     PlotAreaConverter aPlotAreaConv( *this, mrModel.mxPlotArea.getOrCreate() );
diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx
index 53328b9..661fd32 100644
--- a/oox/source/drawingml/chart/objectformatter.cxx
+++ b/oox/source/drawingml/chart/objectformatter.cxx
@@ -171,6 +171,14 @@ static const AutoFormatEntry spNoFormats[] =
     AUTOFORMAT_END()
 };
 
+static const AutoFormatEntry spChartSpaceFill[] =
+{
+    AUTOFORMAT_COLOR( 1, 32, THEMED_STYLE_SUBTLE, XML_bg1 ),
+    AUTOFORMAT_COLOR( 33, 40, THEMED_STYLE_SUBTLE, XML_lt1 ),
+    AUTOFORMAT_COLOR( 41, 48, THEMED_STYLE_SUBTLE, XML_dk1 ),
+    AUTOFORMAT_END()
+};
+
 static const AutoFormatEntry spDataTableLines[] =
 {
     AUTOFORMAT_COLORMOD(  1, 32, THEMED_STYLE_SUBTLE, XML_tx1, XML_tint, 75000 ),
@@ -544,7 +552,7 @@ struct ObjectTypeFormatEntry
 static const ObjectTypeFormatEntry spObjTypeFormatEntries[] =
 {
     //                object type                property info      auto text          auto line            auto fill              auto effect
-    TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE,     &saCommonPropInfo, 0,                 spNoFormats,         spNoFormats,           0 /* eq to Ch2 */ ),
+    TYPEFORMAT_FRAME( OBJECTTYPE_CHARTSPACE,     &saCommonPropInfo, 0,                 spNoFormats,         spChartSpaceFill,      0 /* eq to Ch2 */ ),
     TYPEFORMAT_FRAME( OBJECTTYPE_CHARTTITLE,     &saCommonPropInfo, spChartTitleTexts, 0 /* eq to Ch2 */,   0 /* eq to Ch2 */,     0 /* eq to Ch2 */ ),
     TYPEFORMAT_FRAME( OBJECTTYPE_LEGEND,         &saCommonPropInfo, spOtherTexts,      spNoFormats,         spNoFormats,           0 /* eq to Ch2 */ ),
     TYPEFORMAT_FRAME( OBJECTTYPE_PLOTAREA2D,     &saCommonPropInfo, 0,                 0 /* eq to Ch2 */,   spPlotArea2dFills,     0 /* eq to Ch2 */ ),


More information about the Libreoffice-commits mailing list