chart2/qa/extras/chart2import.cxx | 19 ++++++++++++ chart2/qa/extras/data/xlsx/chart-area-style-background.xlsx |binary include/oox/helper/graphichelper.hxx | 2 - oox/source/drawingml/chart/chartspaceconverter.cxx | 5 --- oox/source/drawingml/chart/objectformatter.cxx | 16 +++++++++- oox/source/helper/graphichelper.cxx | 4 +- oox/source/ppt/pptimport.cxx | 6 +-- 7 files changed, 41 insertions(+), 11 deletions(-)
New commits: commit a9924d94e7db6db50b8b36a311f7d7abf80e4700 Author: Markus Mohrhard <[email protected]> Date: Wed Feb 18 21:44:28 2015 +0100 add test for missing chart area style fill import, tdf#89451 Change-Id: I052838eaf4134a72feb067fc2a1355fabcafe11f diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx index 45fe865..1eaa74d 100644 --- a/chart2/qa/extras/chart2import.cxx +++ b/chart2/qa/extras/chart2import.cxx @@ -56,6 +56,7 @@ public: void testFdo54361(); void testFdo54361_1(); void testAutoBackgroundXLSX(); + void testChartAreaStyleBackgroundXLSX(); // void testTextCanOverlapXLSX(); // TODO : temporarily disabled. void testNumberFormatsXLSX(); @@ -87,6 +88,7 @@ public: CPPUNIT_TEST(testFdo54361); CPPUNIT_TEST(testFdo54361_1); CPPUNIT_TEST(testAutoBackgroundXLSX); + CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX); // CPPUNIT_TEST(testTextCanOverlapXLSX); // TODO : temporarily disabled. CPPUNIT_TEST(testNumberFormatsXLSX); CPPUNIT_TEST_SUITE_END(); @@ -639,6 +641,23 @@ void Chart2ImportTest::testAutoBackgroundXLSX() (nColor & 0x00FFFFFF) == 0x00FFFFFF); // highest 2 bytes are transparency which we ignore here. } +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); +} + /* TODO : temporarily disabled. void Chart2ImportTest::testTextCanOverlapXLSX() { 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 32fe0c6adcff25a0df536127ca980413e1cabefd Author: Markus Mohrhard <[email protected]> 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 diff --git a/include/oox/helper/graphichelper.hxx b/include/oox/helper/graphichelper.hxx index 37c882a..e8be96c 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 f5f02fd..d66726d 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -34,6 +34,7 @@ #include "oox/drawingml/theme.hxx" #include "drawingml/chart/chartspacemodel.hxx" #include "oox/helper/modelobjecthelper.hxx" +#include <oox/helper/graphichelper.hxx> namespace oox { namespace drawingml { @@ -877,6 +878,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 2714cf5..7434125 100644 --- a/oox/source/helper/graphichelper.cxx +++ b/oox/source/helper/graphichelper.cxx @@ -157,9 +157,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 328d16a..fc29c1c 100644 --- a/oox/source/ppt/pptimport.cxx +++ b/oox/source/ppt/pptimport.cxx @@ -193,7 +193,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; }; @@ -209,9 +209,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 a51300bc9223b28fc5da6059e4fe1d2af62fb323 Author: Markus Mohrhard <[email protected]> Date: Wed Feb 18 20:16:43 2015 +0100 implement fill based on style also for chart area, tdf#89451 Change-Id: I7b488e222cd44e75d1e0ff7f8e545e9399f418b5 diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx index 37de52d..559d11a 100644 --- a/oox/source/drawingml/chart/chartspaceconverter.cxx +++ b/oox/source/drawingml/chart/chartspaceconverter.cxx @@ -80,10 +80,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 f655008..f5f02fd 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -167,6 +167,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 ), @@ -536,7 +544,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 */ ), _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
